summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-17 19:03:47 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-17 19:03:47 +0000
commitc57959ad6a4c0f5329762f401fd7871ffb2ee90c (patch)
treef223828f827382311611edf114ddd0c42cb3b23f
parent9508a382f8a9f241dab097d921b6d290c1c3a776 (diff)
merge XFree86 4.3.0.1 to -CURRENT
-rw-r--r--Xext/EVI.c10
-rw-r--r--Xext/appgroup.c18
-rw-r--r--Xext/bigreq.c18
-rw-r--r--Xext/cup.c17
-rw-r--r--Xext/dpms.c88
-rw-r--r--Xext/dpmsstubs.c8
-rw-r--r--Xext/mbuf.c558
-rw-r--r--Xext/mbufbf.c1
-rw-r--r--Xext/mbufpx.c1
-rw-r--r--Xext/mitmisc.c24
-rw-r--r--Xext/panoramiX.c1301
-rw-r--r--Xext/panoramiXSwap.c89
-rw-r--r--Xext/panoramiXprocs.c3996
-rw-r--r--Xext/security.c25
-rw-r--r--Xext/shape.c370
-rw-r--r--Xext/shm.c719
-rw-r--r--Xext/sleepuntil.c48
-rw-r--r--Xext/sync.c298
-rw-r--r--Xext/xcmisc.c32
-rw-r--r--Xext/xprint.c578
-rw-r--r--Xext/xtest.c52
-rw-r--r--Xext/xtest1dd.c127
-rw-r--r--Xext/xtest1di.c87
-rw-r--r--Xi/allowev.c12
-rw-r--r--Xi/chgdctl.c18
-rw-r--r--Xi/chgfctl.c48
-rw-r--r--Xi/chgkbd.c24
-rw-r--r--Xi/chgkmap.c13
-rw-r--r--Xi/chgprop.c13
-rw-r--r--Xi/chgptr.c30
-rw-r--r--Xi/closedev.c16
-rw-r--r--Xi/devbell.c12
-rw-r--r--Xi/exevents.c253
-rw-r--r--Xi/extinit.c189
-rw-r--r--Xi/getbmap.c11
-rw-r--r--Xi/getdctl.c16
-rw-r--r--Xi/getfctl.c21
-rw-r--r--Xi/getfocus.c10
-rw-r--r--Xi/getkmap.c15
-rw-r--r--Xi/getmmap.c11
-rw-r--r--Xi/getprop.c26
-rw-r--r--Xi/getselev.c23
-rw-r--r--Xi/getvers.c11
-rw-r--r--Xi/grabdev.c15
-rw-r--r--Xi/grabdevb.c13
-rw-r--r--Xi/grabdevk.c13
-rw-r--r--Xi/gtmotion.c15
-rw-r--r--Xi/listdev.c28
-rw-r--r--Xi/opendev.c16
-rw-r--r--Xi/queryst.c15
-rw-r--r--Xi/selectev.c13
-rw-r--r--Xi/sendexev.c20
-rw-r--r--Xi/setbmap.c15
-rw-r--r--Xi/setdval.c13
-rw-r--r--Xi/setfocus.c13
-rw-r--r--Xi/setmmap.c15
-rw-r--r--Xi/setmode.c13
-rw-r--r--Xi/stubs.c18
-rw-r--r--Xi/ungrdev.c9
-rw-r--r--Xi/ungrdevb.c12
-rw-r--r--Xi/ungrdevk.c12
-rw-r--r--XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias1
-rw-r--r--XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias1
-rw-r--r--Xprint/AttrValid.c12
-rw-r--r--Xprint/AttrValid.h15
-rw-r--r--Xprint/DiPrint.h21
-rw-r--r--Xprint/Init.c259
-rw-r--r--Xprint/Oid.c26
-rw-r--r--Xprint/Oid.h3
-rw-r--r--Xprint/OidStrs.h260
-rw-r--r--Xprint/Util.c84
-rw-r--r--Xprint/attributes.c238
-rw-r--r--Xprint/attributes.h54
-rw-r--r--Xprint/ddxInit.c177
-rw-r--r--Xprint/mediaSizes.c28
-rw-r--r--Xprint/pcl/Pcl.h115
-rw-r--r--Xprint/pcl/PclArc.c56
-rw-r--r--Xprint/pcl/PclArea.c129
-rw-r--r--Xprint/pcl/PclColor.c36
-rw-r--r--Xprint/pcl/PclCursor.c53
-rw-r--r--Xprint/pcl/PclGC.c146
-rw-r--r--Xprint/pcl/PclInit.c111
-rw-r--r--Xprint/pcl/PclLine.c96
-rw-r--r--Xprint/pcl/PclMisc.c11
-rw-r--r--Xprint/pcl/PclPixel.c7
-rw-r--r--Xprint/pcl/PclPixmap.c11
-rw-r--r--Xprint/pcl/PclPolygon.c141
-rw-r--r--Xprint/pcl/PclPrint.c80
-rw-r--r--Xprint/pcl/PclSFonts.c12
-rw-r--r--Xprint/pcl/PclSpans.c61
-rw-r--r--Xprint/pcl/PclText.c134
-rw-r--r--Xprint/pcl/PclWindow.c14
-rw-r--r--Xprint/pcl/Pclmap.h214
-rw-r--r--Xprint/ps/Ps.h56
-rw-r--r--Xprint/ps/PsArea.c138
-rw-r--r--Xprint/ps/PsAttVal.c11
-rw-r--r--Xprint/ps/PsAttr.c2
-rw-r--r--Xprint/ps/PsCache.c194
-rw-r--r--Xprint/ps/PsColor.c2
-rw-r--r--Xprint/ps/PsFonts.c9
-rw-r--r--Xprint/ps/PsGC.c6
-rw-r--r--Xprint/ps/PsInit.c61
-rw-r--r--Xprint/ps/PsLine.c1
-rw-r--r--Xprint/ps/PsMisc.c1
-rw-r--r--Xprint/ps/PsPixel.c1
-rw-r--r--Xprint/ps/PsPixmap.c12
-rw-r--r--Xprint/ps/PsPolygon.c3
-rw-r--r--Xprint/ps/PsPrint.c7
-rw-r--r--Xprint/ps/PsSpans.c12
-rw-r--r--Xprint/ps/PsText.c7
-rw-r--r--Xprint/ps/PsWindow.c14
-rw-r--r--Xprint/ps/psout.c43
-rw-r--r--Xprint/ps/psout.h15
-rw-r--r--Xprint/raster/Raster.c103
-rw-r--r--Xprint/raster/Raster.h25
-rw-r--r--Xprint/raster/RasterAttVal.c6
-rw-r--r--cfb/cfb.h443
-rw-r--r--cfb/cfb8bit.c15
-rw-r--r--cfb/cfb8bit.h394
-rw-r--r--cfb/cfb8line.c619
-rw-r--r--cfb/cfballpriv.c16
-rw-r--r--cfb/cfbbitblt.c465
-rw-r--r--cfb/cfbblt.c349
-rw-r--r--cfb/cfbbres.c113
-rw-r--r--cfb/cfbbresd.c152
-rw-r--r--cfb/cfbbstore.c14
-rw-r--r--cfb/cfbcmap.c548
-rw-r--r--cfb/cfbfillarc.c117
-rw-r--r--cfb/cfbfillrct.c31
-rw-r--r--cfb/cfbfillsp.c143
-rw-r--r--cfb/cfbgc.c30
-rw-r--r--cfb/cfbgetsp.c61
-rw-r--r--cfb/cfbglblt8.c87
-rw-r--r--cfb/cfbhrzvert.c387
-rw-r--r--cfb/cfbigblt8.c21
-rw-r--r--cfb/cfbimage.c24
-rw-r--r--cfb/cfbline.c28
-rw-r--r--cfb/cfbmap.h392
-rw-r--r--cfb/cfbmskbits.c188
-rw-r--r--cfb/cfbmskbits.h277
-rw-r--r--cfb/cfbpixmap.c27
-rw-r--r--cfb/cfbply1rct.c70
-rw-r--r--cfb/cfbpntwin.c426
-rw-r--r--cfb/cfbpolypnt.c62
-rw-r--r--cfb/cfbpush8.c18
-rw-r--r--cfb/cfbrctstp8.c79
-rw-r--r--cfb/cfbrrop.c10
-rw-r--r--cfb/cfbrrop.h201
-rw-r--r--cfb/cfbscrinit.c51
-rw-r--r--cfb/cfbsetsp.c36
-rw-r--r--cfb/cfbsolid.c1089
-rw-r--r--cfb/cfbteblt8.c31
-rw-r--r--cfb/cfbtegblt.c37
-rw-r--r--cfb/cfbtile32.c181
-rw-r--r--cfb/cfbtileodd.c255
-rw-r--r--cfb/cfbzerarc.c99
-rw-r--r--cfb/stip68kgnu.h161
-rw-r--r--cfb/stipsparc.s3
-rw-r--r--cfb/stipsprc32.s3
-rw-r--r--dbe/dbe.c28
-rw-r--r--dbe/midbe.c21
-rw-r--r--dix/atom.c7
-rw-r--r--dix/buildatoms7
-rw-r--r--dix/colormap.c41
-rw-r--r--dix/cursor.c70
-rw-r--r--dix/devices.c190
-rw-r--r--dix/dispatch.c496
-rw-r--r--dix/dixfonts.c351
-rw-r--r--dix/dixutils.c69
-rw-r--r--dix/events.c1174
-rw-r--r--dix/extension.c44
-rw-r--r--dix/gc.c54
-rw-r--r--dix/globals.c25
-rw-r--r--dix/grabs.c52
-rw-r--r--dix/initatoms.c5
-rw-r--r--dix/main.c295
-rw-r--r--dix/pixmap.c7
-rw-r--r--dix/privates.c101
-rw-r--r--dix/property.c26
-rw-r--r--dix/resource.c160
-rw-r--r--dix/swaprep.c60
-rw-r--r--dix/swapreq.c10
-rw-r--r--dix/tables.c402
-rw-r--r--dix/window.c339
-rw-r--r--dix/xpstubs.c2
-rw-r--r--doc/Xserver.man.pre271
-rw-r--r--hw/kdrive/Imakefile34
-rw-r--r--hw/kdrive/Kdrive.tmpl17
-rw-r--r--hw/kdrive/Makefile.am10
-rw-r--r--hw/kdrive/Xkdrive.man77
-rw-r--r--hw/kdrive/chips/Imakefile14
-rw-r--r--hw/kdrive/chips/chips.c305
-rw-r--r--hw/kdrive/chips/chips.h122
-rw-r--r--hw/kdrive/chips/chipsdraw.c493
-rw-r--r--hw/kdrive/chips/chipsstub.c62
-rw-r--r--hw/kdrive/fbdev/Imakefile19
-rw-r--r--hw/kdrive/fbdev/Makefile.am29
-rw-r--r--hw/kdrive/fbdev/Xfbdev.man28
-rw-r--r--hw/kdrive/fbdev/fbdev.c693
-rw-r--r--hw/kdrive/fbdev/fbdev.h142
-rw-r--r--hw/kdrive/fbdev/fbinit.c90
-rw-r--r--hw/kdrive/i810/Imakefile21
-rw-r--r--hw/kdrive/i810/i810.c2104
-rw-r--r--hw/kdrive/i810/i810.h503
-rw-r--r--hw/kdrive/i810/i810_cursor.c418
-rw-r--r--hw/kdrive/i810/i810_reg.h696
-rw-r--r--hw/kdrive/i810/i810_video.c1136
-rw-r--r--hw/kdrive/i810/i810draw.c606
-rw-r--r--hw/kdrive/i810/i810draw.h46
-rw-r--r--hw/kdrive/i810/i810stub.c84
-rw-r--r--hw/kdrive/igs/Imakefile13
-rw-r--r--hw/kdrive/igs/igs.c669
-rw-r--r--hw/kdrive/igs/igs.h329
-rw-r--r--hw/kdrive/igs/igscmap.c64
-rw-r--r--hw/kdrive/igs/igscurs.c347
-rw-r--r--hw/kdrive/igs/igsdraw.c1538
-rw-r--r--hw/kdrive/igs/igsdraw.h260
-rw-r--r--hw/kdrive/igs/igsreg.c971
-rw-r--r--hw/kdrive/igs/igsreg.h157
-rw-r--r--hw/kdrive/igs/igsstub.c66
-rw-r--r--hw/kdrive/ipaq/Imakefile13
-rw-r--r--hw/kdrive/ipaq/ipaq.c65
-rw-r--r--hw/kdrive/itsy/Imakefile14
-rw-r--r--hw/kdrive/itsy/itsy.c321
-rw-r--r--hw/kdrive/itsy/itsy.h42
-rw-r--r--hw/kdrive/itsy/kbd.c237
-rw-r--r--hw/kdrive/itsy/ts.c212
-rw-r--r--hw/kdrive/linux/Imakefile25
-rw-r--r--hw/kdrive/linux/Makefile.am39
-rw-r--r--hw/kdrive/linux/agp.c355
-rw-r--r--hw/kdrive/linux/agp.h71
-rw-r--r--hw/kdrive/linux/bus.c101
-rw-r--r--hw/kdrive/linux/keyboard.c487
-rw-r--r--hw/kdrive/linux/klinux.h34
-rw-r--r--hw/kdrive/linux/linux.c475
-rw-r--r--hw/kdrive/linux/mouse.c1011
-rw-r--r--hw/kdrive/linux/ms.c163
-rw-r--r--hw/kdrive/linux/ps2.c153
-rw-r--r--hw/kdrive/linux/ts.c223
-rw-r--r--hw/kdrive/linux/tslib.c248
-rw-r--r--hw/kdrive/mach64/Makefile.am38
-rw-r--r--hw/kdrive/mach64/fourcc.h134
-rw-r--r--hw/kdrive/mach64/mach64.c435
-rw-r--r--hw/kdrive/mach64/mach64.h655
-rw-r--r--hw/kdrive/mach64/mach64curs.c392
-rw-r--r--hw/kdrive/mach64/mach64draw.c476
-rw-r--r--hw/kdrive/mach64/mach64draw.h72
-rw-r--r--hw/kdrive/mach64/mach64stub.c66
-rw-r--r--hw/kdrive/mach64/mach64video.c1038
-rw-r--r--hw/kdrive/mga/Makefile.am28
-rw-r--r--hw/kdrive/mga/mga.c244
-rw-r--r--hw/kdrive/mga/mga.h140
-rw-r--r--hw/kdrive/mga/mgadraw.c267
-rw-r--r--hw/kdrive/mga/mgastub.c59
-rw-r--r--hw/kdrive/nvidia/Makefile.am27
-rw-r--r--hw/kdrive/nvidia/fourcc.h134
-rw-r--r--hw/kdrive/nvidia/nvidia.c363
-rw-r--r--hw/kdrive/nvidia/nvidia.h251
-rw-r--r--hw/kdrive/nvidia/nvidiacurs.c392
-rw-r--r--hw/kdrive/nvidia/nvidiadraw.c239
-rw-r--r--hw/kdrive/nvidia/nvidiadraw.h72
-rw-r--r--hw/kdrive/nvidia/nvidiastub.c59
-rw-r--r--hw/kdrive/nvidia/nvidiavideo.c1018
-rw-r--r--hw/kdrive/pcmcia/Imakefile13
-rw-r--r--hw/kdrive/pcmcia/modes.h66
-rw-r--r--hw/kdrive/pcmcia/pcmcia.c1200
-rw-r--r--hw/kdrive/pcmcia/pcmcia.h268
-rw-r--r--hw/kdrive/pcmcia/pcmciacurs.c452
-rw-r--r--hw/kdrive/pcmcia/pcmciarotate.c335
-rw-r--r--hw/kdrive/pcmcia/pcmciashadow.c200
-rw-r--r--hw/kdrive/pcmcia/pcmciastub.c57
-rw-r--r--hw/kdrive/r128/Makefile.am28
-rw-r--r--hw/kdrive/r128/r128.c254
-rw-r--r--hw/kdrive/r128/r128.h127
-rw-r--r--hw/kdrive/r128/r128draw.c295
-rw-r--r--hw/kdrive/r128/r128stub.c62
-rw-r--r--hw/kdrive/savage/Imakefile14
-rw-r--r--hw/kdrive/savage/s3.c1838
-rw-r--r--hw/kdrive/savage/s3.h537
-rw-r--r--hw/kdrive/savage/s3.nick41
-rw-r--r--hw/kdrive/savage/s3clock.c87
-rw-r--r--hw/kdrive/savage/s3cmap.c125
-rw-r--r--hw/kdrive/savage/s3curs.c433
-rw-r--r--hw/kdrive/savage/s3draw.c3247
-rw-r--r--hw/kdrive/savage/s3draw.h471
-rw-r--r--hw/kdrive/savage/s3gc.c308
-rw-r--r--hw/kdrive/savage/s3reg.c1304
-rw-r--r--hw/kdrive/savage/s3reg.h230
-rw-r--r--hw/kdrive/savage/s3rtst.c144
-rw-r--r--hw/kdrive/savage/s3stub.c90
-rw-r--r--hw/kdrive/sis530/Imakefile14
-rw-r--r--hw/kdrive/sis530/sis.c924
-rw-r--r--hw/kdrive/sis530/sis.h1218
-rw-r--r--hw/kdrive/sis530/sisclock.c235
-rw-r--r--hw/kdrive/sis530/siscmap.c67
-rw-r--r--hw/kdrive/sis530/siscurs.c367
-rw-r--r--hw/kdrive/sis530/sisdraw.c1726
-rw-r--r--hw/kdrive/sis530/sisdraw.h183
-rw-r--r--hw/kdrive/sis530/sisio.c33
-rw-r--r--hw/kdrive/sis530/sisstub.c63
-rw-r--r--hw/kdrive/smi/Makefile.am32
-rw-r--r--hw/kdrive/smi/smi.c344
-rw-r--r--hw/kdrive/smi/smi.h260
-rw-r--r--hw/kdrive/smi/smidraw.c343
-rw-r--r--hw/kdrive/smi/smidraw.h72
-rw-r--r--hw/kdrive/smi/smistub.c62
-rw-r--r--hw/kdrive/smi/smivideo.c1016
-rw-r--r--hw/kdrive/src/Makefile.am27
-rw-r--r--hw/kdrive/src/kaa.c1076
-rw-r--r--hw/kdrive/src/kasync.c307
-rw-r--r--hw/kdrive/src/kcmap.c297
-rw-r--r--hw/kdrive/src/kcolor.c884
-rw-r--r--hw/kdrive/src/kcurscol.c96
-rw-r--r--hw/kdrive/src/kdrive.c1471
-rw-r--r--hw/kdrive/src/kdrive.h828
-rw-r--r--hw/kdrive/src/kinfo.c147
-rw-r--r--hw/kdrive/src/kinput.c1649
-rw-r--r--hw/kdrive/src/kkeymap.c238
-rw-r--r--hw/kdrive/src/kkeymap.h58
-rw-r--r--hw/kdrive/src/kloadmap.c203
-rw-r--r--hw/kdrive/src/kmap.c181
-rw-r--r--hw/kdrive/src/kmode.c385
-rw-r--r--hw/kdrive/src/knoop.c297
-rw-r--r--hw/kdrive/src/koffscreen.c326
-rw-r--r--hw/kdrive/src/kpict.c69
-rw-r--r--hw/kdrive/src/kshadow.c86
-rw-r--r--hw/kdrive/src/ktest.c79
-rw-r--r--hw/kdrive/src/kxv.c1779
-rw-r--r--hw/kdrive/src/kxv.h305
-rw-r--r--hw/kdrive/src/vga.c331
-rw-r--r--hw/kdrive/src/vga.h147
-rw-r--r--hw/kdrive/trident/Imakefile16
-rw-r--r--hw/kdrive/trident/trident.c613
-rw-r--r--hw/kdrive/trident/trident.h272
-rw-r--r--hw/kdrive/trident/tridentcurs.c392
-rw-r--r--hw/kdrive/trident/tridentdraw.c499
-rw-r--r--hw/kdrive/trident/tridentdraw.h72
-rw-r--r--hw/kdrive/trident/tridentstub.c82
-rw-r--r--hw/kdrive/trio/Imakefile20
-rw-r--r--hw/kdrive/trio/s3.c1016
-rw-r--r--hw/kdrive/trio/s3.h1203
-rw-r--r--hw/kdrive/trio/s3clock.c88
-rw-r--r--hw/kdrive/trio/s3cmap.c73
-rw-r--r--hw/kdrive/trio/s3curs.c419
-rw-r--r--hw/kdrive/trio/s3stub.c62
-rw-r--r--hw/kdrive/ts300/Imakefile14
-rw-r--r--hw/kdrive/ts300/ts300.c133
-rw-r--r--hw/kdrive/vesa/Imakefile14
-rw-r--r--hw/kdrive/vesa/Makefile.am35
-rw-r--r--hw/kdrive/vesa/Xvesa.man101
-rw-r--r--hw/kdrive/vesa/vbe.c679
-rw-r--r--hw/kdrive/vesa/vbe.h160
-rw-r--r--hw/kdrive/vesa/vesa.c1782
-rw-r--r--hw/kdrive/vesa/vesa.h298
-rw-r--r--hw/kdrive/vesa/vesainit.c86
-rw-r--r--hw/kdrive/vesa/vga.c244
-rw-r--r--hw/kdrive/vesa/vga.h61
-rw-r--r--hw/kdrive/vesa/vm86.c730
-rw-r--r--hw/kdrive/vesa/vm86.h172
-rw-r--r--hw/kdrive/vxworks/Imakefile15
-rw-r--r--hw/kdrive/vxworks/vxkbd.c265
-rw-r--r--hw/kdrive/vxworks/vxmouse.c124
-rw-r--r--hw/kdrive/vxworks/vxworks.c68
-rw-r--r--hw/vfb/InitInput.c7
-rw-r--r--hw/vfb/InitOutput.c129
-rw-r--r--hw/vfb/Xvfb.man.pre11
-rw-r--r--hw/xfree86/common/atKeynames.h159
-rw-r--r--hw/xfree86/common/compiler.h2367
-rw-r--r--hw/xfree86/common/xf86.h1080
-rw-r--r--hw/xfree86/common/xf86Config.c5588
-rw-r--r--hw/xfree86/common/xf86Cursor.c750
-rw-r--r--hw/xfree86/common/xf86Events.c1655
-rw-r--r--hw/xfree86/common/xf86Init.c1804
-rw-r--r--hw/xfree86/common/xf86Io.c304
-rw-r--r--hw/xfree86/common/xf86Kbd.c111
-rw-r--r--hw/xfree86/common/xf86KbdBSD.c896
-rw-r--r--hw/xfree86/common/xf86KbdLnx.c142
-rw-r--r--hw/xfree86/common/xf86KbdMach.c9
-rw-r--r--hw/xfree86/common/xf86Keymap.h356
-rw-r--r--hw/xfree86/common/xf86Priv.h321
-rw-r--r--hw/xfree86/common/xf86Version.h38
-rw-r--r--hw/xfree86/common/xf86XKB.c79
-rw-r--r--hw/xfree86/common/xf86Xinput.c1150
-rw-r--r--hw/xfree86/common/xf86Xinput.h379
-rw-r--r--hw/xfree86/dixmods/extmod/xf86vmode.c1952
-rw-r--r--hw/xfree86/os-support/README.OS-lib157
-rw-r--r--hw/xfree86/os-support/assyntax.h6
-rw-r--r--hw/xfree86/os-support/bsd/bsd_VTsw.c20
-rw-r--r--hw/xfree86/os-support/bsd/bsd_init.c354
-rw-r--r--hw/xfree86/os-support/bsd/bsd_io.c204
-rw-r--r--hw/xfree86/os-support/bsd/bsd_jstk.c53
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c119
-rw-r--r--hw/xfree86/os-support/linux/lnx_io.c225
-rw-r--r--hw/xfree86/os-support/linux/lnx_jstk.c77
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c1370
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_init.c45
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_io.c78
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_mmap.c25
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_video.c597
-rw-r--r--hw/xfree86/os-support/misc/xf86_IlHack.c5
-rw-r--r--hw/xfree86/os-support/misc/xf86_Util.c64
-rw-r--r--hw/xfree86/os-support/sco/VTsw_sco.c110
-rw-r--r--hw/xfree86/os-support/sco/sco_init.c503
-rw-r--r--hw/xfree86/os-support/sco/sco_io.c328
-rw-r--r--hw/xfree86/os-support/sco/sco_mouse.c384
-rw-r--r--hw/xfree86/os-support/sco/sco_video.c457
-rw-r--r--hw/xfree86/os-support/shared/VTsw_noop.c15
-rw-r--r--hw/xfree86/os-support/shared/VTsw_usl.c23
-rw-r--r--hw/xfree86/os-support/shared/bios_devmem.c96
-rw-r--r--hw/xfree86/os-support/shared/ioperm_noop.c35
-rw-r--r--hw/xfree86/os-support/shared/posix_tty.c820
-rw-r--r--hw/xfree86/os-support/shared/std_kbdEv.c17
-rw-r--r--hw/xfree86/os-support/shared/sysv_kbd.c33
-rw-r--r--hw/xfree86/os-support/sysv/sysv_init.c59
-rw-r--r--hw/xfree86/os-support/sysv/sysv_io.c50
-rw-r--r--hw/xfree86/os-support/sysv/sysv_video.c574
-rw-r--r--hw/xfree86/os-support/sysv/xqueue.c606
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h526
-rw-r--r--hw/xfree86/os-support/xf86_OSproc.h522
-rw-r--r--hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c5
-rw-r--r--hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre6
-rw-r--r--hw/xfree86/utils/kbd_mode/sun-kbd_mode.c12
-rw-r--r--hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre5
-rw-r--r--hw/xfree86/utils/scanpci/scanpci.c2355
-rw-r--r--hw/xfree86/utils/xorgconfig/Cards1439
-rw-r--r--hw/xfree86/utils/xorgconfig/cards.c59
-rw-r--r--hw/xfree86/utils/xorgconfig/cards.h14
-rw-r--r--hw/xnest/Color.c2
-rw-r--r--hw/xnest/Cursor.c4
-rw-r--r--hw/xnest/Display.c9
-rw-r--r--hw/xnest/Display.h3
-rw-r--r--hw/xnest/Drawable.h3
-rw-r--r--hw/xnest/Events.c5
-rw-r--r--hw/xnest/Font.c2
-rw-r--r--hw/xnest/GC.c12
-rw-r--r--hw/xnest/GCOps.c2
-rw-r--r--hw/xnest/Handlers.c3
-rw-r--r--hw/xnest/Init.c40
-rw-r--r--hw/xnest/Keyboard.c135
-rw-r--r--hw/xnest/Pixmap.c16
-rw-r--r--hw/xnest/Screen.c56
-rw-r--r--hw/xnest/TestExt.c9
-rw-r--r--hw/xnest/Window.c14
-rw-r--r--hw/xnest/Xnest.h5
-rw-r--r--hw/xnest/Xnest.man.pre5
-rw-r--r--include/closestr.h29
-rw-r--r--include/colormap.h4
-rw-r--r--include/cursor.h34
-rw-r--r--include/cursorstr.h6
-rw-r--r--include/dix.h141
-rw-r--r--include/dixfont.h356
-rw-r--r--include/dixstruct.h63
-rw-r--r--include/extension.h4
-rw-r--r--include/extnsionst.h35
-rw-r--r--include/gc.h3
-rw-r--r--include/gcstruct.h15
-rw-r--r--include/input.h39
-rw-r--r--include/inputstr.h3
-rw-r--r--include/misc.h69
-rw-r--r--include/miscstruct.h8
-rw-r--r--include/opaque.h38
-rw-r--r--include/os.h216
-rw-r--r--include/property.h5
-rw-r--r--include/propertyst.h4
-rw-r--r--include/regionstr.h31
-rw-r--r--include/resource.h78
-rw-r--r--include/screenint.h8
-rw-r--r--include/scrnintstr.h93
-rw-r--r--include/servermd.h288
-rw-r--r--include/site.h10
-rw-r--r--include/validate.h3
-rw-r--r--include/window.h12
-rw-r--r--include/windowstr.h1
-rw-r--r--lbx/lbxcmap.c152
-rw-r--r--lbx/lbxdix.c124
-rw-r--r--lbx/lbxexts.c63
-rw-r--r--lbx/lbxgfx.c121
-rw-r--r--lbx/lbxmain.c279
-rw-r--r--lbx/lbxopts.c221
-rw-r--r--lbx/lbxprop.c53
-rw-r--r--lbx/lbxserve.h204
-rw-r--r--lbx/lbxsquish.c6
-rw-r--r--lbx/lbxsrvopts.h43
-rw-r--r--lbx/lbxswap.c138
-rw-r--r--lbx/lbxtables.c8
-rw-r--r--lbx/lbxtags.c59
-rw-r--r--lbx/lbxtags.h57
-rw-r--r--lbx/lbxzerorep.c8
-rw-r--r--mfb/fastblt.h26
-rw-r--r--mfb/maskbits.c8868
-rw-r--r--mfb/maskbits.h85
-rw-r--r--mfb/mergerop.h247
-rw-r--r--mfb/mfb.h90
-rw-r--r--mfb/mfbbitblt.c14
-rw-r--r--mfb/mfbblt.c20
-rw-r--r--mfb/mfbbres.c3
-rw-r--r--mfb/mfbbresd.c3
-rw-r--r--mfb/mfbclip.c4
-rw-r--r--mfb/mfbcmap.c52
-rw-r--r--mfb/mfbfillarc.c3
-rw-r--r--mfb/mfbfillrct.c8
-rw-r--r--mfb/mfbfillsp.c66
-rw-r--r--mfb/mfbgc.c43
-rw-r--r--mfb/mfbgetsp.c5
-rw-r--r--mfb/mfbhrzvert.c3
-rw-r--r--mfb/mfbimage.c6
-rw-r--r--mfb/mfbimggblt.c35
-rw-r--r--mfb/mfbline.c11
-rw-r--r--mfb/mfbply1rct.c32
-rw-r--r--mfb/mfbplygblt.c14
-rw-r--r--mfb/mfbpolypnt.c5
-rw-r--r--mfb/mfbpushpxl.c8
-rw-r--r--mfb/mfbscrclse.c3
-rw-r--r--mfb/mfbscrinit.c51
-rw-r--r--mfb/mfbsetsp.c6
-rw-r--r--mfb/mfbtegblt.c95
-rw-r--r--mfb/mfbtile.c3
-rw-r--r--mfb/mfbzerarc.c7
-rw-r--r--mi/cbrt.c17
-rw-r--r--mi/mi.h177
-rw-r--r--mi/miarc.c562
-rw-r--r--mi/mibitblt.c61
-rw-r--r--mi/mibstore.c266
-rw-r--r--mi/mibstore.h42
-rw-r--r--mi/mibstorest.h6
-rw-r--r--mi/miclipn.c21
-rw-r--r--mi/micursor.c2
-rw-r--r--mi/midash.c11
-rw-r--r--mi/midispcur.c262
-rw-r--r--mi/mieq.c7
-rw-r--r--mi/miexpose.c56
-rw-r--r--mi/mifillarc.c57
-rw-r--r--mi/mifillarc.h17
-rw-r--r--mi/mifillrct.c3
-rw-r--r--mi/mifpoly.h11
-rw-r--r--mi/mifpolycon.c25
-rw-r--r--mi/migc.c82
-rw-r--r--mi/migc.h41
-rw-r--r--mi/miglblt.c13
-rw-r--r--mi/miinitext.c385
-rw-r--r--mi/miline.h15
-rw-r--r--mi/mipointer.c77
-rw-r--r--mi/mipointer.h98
-rw-r--r--mi/mipointrst.h6
-rw-r--r--mi/mipoly.h13
-rw-r--r--mi/mipolycon.c41
-rw-r--r--mi/mipolygen.c2
-rw-r--r--mi/mipolypnt.c2
-rw-r--r--mi/mipolyrect.c2
-rw-r--r--mi/mipolyseg.c2
-rw-r--r--mi/mipolytext.c2
-rw-r--r--mi/mipolyutil.c5
-rw-r--r--mi/mipushpxl.c90
-rw-r--r--mi/miregion.c323
-rw-r--r--mi/miscrinit.c149
-rw-r--r--mi/mispans.c31
-rw-r--r--mi/mispans.h17
-rw-r--r--mi/misprite.c415
-rw-r--r--mi/misprite.h17
-rw-r--r--mi/mispritest.h8
-rw-r--r--mi/mivaltree.c124
-rw-r--r--mi/miwideline.c217
-rw-r--r--mi/miwideline.h40
-rw-r--r--mi/miwindow.c88
-rw-r--r--mi/mizerarc.c21
-rw-r--r--mi/mizerarc.h5
-rw-r--r--mi/mizerline.c590
-rw-r--r--os/WaitFor.c182
-rw-r--r--os/access.c569
-rw-r--r--os/auth.c189
-rw-r--r--os/connection.c310
-rw-r--r--os/io.c163
-rw-r--r--os/k5auth.c3
-rw-r--r--os/lbxio.c42
-rw-r--r--os/mitauth.c54
-rw-r--r--os/oscolor.c32
-rw-r--r--os/osdep.h189
-rw-r--r--os/osinit.c42
-rw-r--r--os/rpcauth.c41
-rw-r--r--os/secauth.c30
-rw-r--r--os/utils.c1179
-rw-r--r--os/xdmauth.c9
-rw-r--r--os/xdmcp.c377
-rw-r--r--record/record.c76
-rw-r--r--record/set.c12
-rw-r--r--xkb/XKBAlloc.c1
-rw-r--r--xkb/XKBGAlloc.c1
-rw-r--r--xkb/XKBMAlloc.c1
-rw-r--r--xkb/XKBMisc.c18
-rw-r--r--xkb/ddxBeep.c29
-rw-r--r--xkb/ddxConfig.c10
-rw-r--r--xkb/ddxCtrls.c14
-rw-r--r--xkb/ddxDevBtn.c3
-rw-r--r--xkb/ddxFakeMtn.c92
-rw-r--r--xkb/ddxKillSrv.c9
-rw-r--r--xkb/ddxList.c21
-rw-r--r--xkb/ddxLoad.c107
-rw-r--r--xkb/ddxVT.c21
-rw-r--r--xkb/maprules.c664
-rw-r--r--xkb/xkb.c67
-rw-r--r--xkb/xkbAccessX.c16
-rw-r--r--xkb/xkbActions.c104
-rw-r--r--xkb/xkbDflts.h203
-rw-r--r--xkb/xkbEvents.c75
-rw-r--r--xkb/xkbInit.c181
-rw-r--r--xkb/xkbLEDs.c18
-rw-r--r--xkb/xkbPrKeyEv.c55
-rw-r--r--xkb/xkbSwap.c7
-rw-r--r--xkb/xkbUtils.c19
-rw-r--r--xkb/xkbconfig.c151
-rw-r--r--xkb/xkberrs.c6
-rw-r--r--xkb/xkbfmisc.c78
-rw-r--r--xkb/xkbout.c18
-rw-r--r--xkb/xkbtext.c15
-rw-r--r--xkb/xkmread.c13
615 files changed, 42560 insertions, 100702 deletions
diff --git a/Xext/EVI.c b/Xext/EVI.c
index 8ccc31af2..aa3734b02 100644
--- a/Xext/EVI.c
+++ b/Xext/EVI.c
@@ -21,6 +21,8 @@ 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.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/EVI.c,v 3.9 2001/10/28 03:32:50 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "dixstruct.h"
@@ -34,7 +36,7 @@ static EviPrivPtr eviPriv;
static int
ProcEVIQueryVersion(ClientPtr client)
{
- REQUEST(xEVIQueryVersionReq);
+ /* REQUEST(xEVIQueryVersionReq); */
xEVIQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
@@ -167,11 +169,11 @@ EVIResetProc(ExtensionEntry *extEntry)
void
EVIExtensionInit(void)
{
- ExtensionEntry *extEntry, *AddExtension();
- if (extEntry = AddExtension(EVINAME, 0, 0,
+ ExtensionEntry *extEntry;
+ if ((extEntry = AddExtension(EVINAME, 0, 0,
ProcEVIDispatch,
SProcEVIDispatch,
- EVIResetProc, StandardMinorOpcode))
+ EVIResetProc, StandardMinorOpcode)))
{
XEVIReqCode = (unsigned char)extEntry->base;
eviPriv = eviDDXInit();
diff --git a/Xext/appgroup.c b/Xext/appgroup.c
index 71e74da38..37e6ee0bc 100644
--- a/Xext/appgroup.c
+++ b/Xext/appgroup.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.9 2001/12/17 20:52:25 dawes Exp $ */
/*
Copyright 1996, 1998, 2001 The Open Group
@@ -74,9 +75,9 @@ static int XagCallbackRefCount = 0;
static RESTYPE RT_APPGROUP;
static AppGroupPtr appGrpList = NULL;
-extern WindowPtr* WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char* ConnectionInfo;
+extern int connBlockScreenStart;
static
int XagAppGroupFree (what, id)
@@ -121,7 +122,7 @@ void XagClientStateChange (pcbl, nulldata, calldata)
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp;
- XID authId;
+ XID authId = 0;
if (!pClient->appgroup) {
switch (pClient->clientState) {
@@ -220,13 +221,13 @@ XagExtensionInit ()
{
ExtensionEntry* extEntry;
- if (extEntry = AddExtension (XAGNAME,
+ if ((extEntry = AddExtension (XAGNAME,
0,
XagNumberErrors,
ProcXagDispatch,
SProcXagDispatch,
XagResetProc,
- StandardMinorOpcode)) {
+ StandardMinorOpcode))) {
XagReqCode = (unsigned char)extEntry->base;
XagErrorBase = extEntry->errorBase;
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
@@ -247,7 +248,7 @@ static
int ProcXagQueryVersion (client)
register ClientPtr client;
{
- REQUEST (xXagQueryVersionReq);
+ /* REQUEST (xXagQueryVersionReq); */
xXagQueryVersionReply rep;
register int n;
@@ -309,8 +310,6 @@ static
void CreateConnectionInfo (pAppGrp)
AppGroupPtr pAppGrp;
{
- extern int connBlockScreenStart;
- xConnSetup *setup = (xConnSetup*) ConnectionInfo;
xWindowRoot* rootp;
xWindowRoot* roots[MAXSCREENS];
unsigned int rootlens[MAXSCREENS];
@@ -376,7 +375,6 @@ AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs)
CARD32* attribs;
{
AppGroupPtr pAppGrp;
- int i;
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
if (pAppGrp) {
@@ -570,7 +568,7 @@ int ProcXagCreateAssoc (client)
if (stuff->window_type != XagWindowTypeX11)
#endif
return BadMatch;
-#ifdef WIN32 /* and Mac, etc */
+#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
if (!LocalClient (client))
return BadAccess;
#endif
@@ -584,7 +582,7 @@ static
int ProcXagDestroyAssoc (client)
register ClientPtr client;
{
- REQUEST (xXagDestroyAssocReq);
+ /* REQUEST (xXagDestroyAssocReq); */
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
diff --git a/Xext/bigreq.c b/Xext/bigreq.c
index 4f4bf5c02..0d2dc5178 100644
--- a/Xext/bigreq.c
+++ b/Xext/bigreq.c
@@ -26,7 +26,9 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/bigreq.c,v 3.5 2001/12/14 19:58:48 dawes Exp $ */
+#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -36,17 +38,23 @@ from The Open Group.
#include "bigreqstr.h"
static unsigned char XBigReqCode;
-static int ProcBigReqDispatch();
-static void BigReqResetProc();
+
+static void BigReqResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcBigReqDispatch);
void
BigReqExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XBigReqExtensionName, 0, 0,
+ if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
- BigReqResetProc, StandardMinorOpcode))
+ BigReqResetProc, StandardMinorOpcode)) != 0)
XBigReqCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
}
diff --git a/Xext/cup.c b/Xext/cup.c
index 4e8cf66b4..2159417bb 100644
--- a/Xext/cup.c
+++ b/Xext/cup.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/cup.c,v 1.10 2001/12/14 19:58:48 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
@@ -35,11 +36,16 @@ in this Software without prior written authorization from The Open Group.
#include "colormapst.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "swapreq.h"
#define _XCUP_SERVER_
#include "Xcupstr.h"
#include "Xfuncproto.h"
+#ifndef EXTMODULE
#include "../os/osdep.h"
+#else
+#include "xf86_ansic.h"
+#endif
static int ProcDispatch (), SProcDispatch ();
static void ResetProc ();
@@ -121,13 +127,13 @@ XcupExtensionInit ()
{
ExtensionEntry* extEntry;
- if (extEntry = AddExtension (XCUPNAME,
+ if ((extEntry = AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
- StandardMinorOpcode)) {
+ StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
}
@@ -146,7 +152,7 @@ static
int ProcQueryVersion (client)
register ClientPtr client;
{
- REQUEST (xXcupQueryVersionReq);
+ /* REQUEST (xXcupQueryVersionReq); */
xXcupQueryVersionReply rep;
register int n;
@@ -214,7 +220,6 @@ int ProcStoreColors (client)
int ncolors, n;
xXcupStoreColorsReply rep;
xColorItem* cptr;
- Pixel pixel;
if (!(pcmp->class & DynamicClass))
return BadMatch;
@@ -302,7 +307,7 @@ int SProcGetReservedColormapEntries (client)
}
static
-int SProcStoreColors (client)
+int SProcXcupStoreColors (client)
ClientPtr client;
{
register int n;
@@ -331,7 +336,7 @@ int SProcDispatch (client)
case X_XcupGetReservedColormapEntries:
return SProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
- return SProcStoreColors (client);
+ return SProcXcupStoreColors (client);
default:
return BadRequest;
}
diff --git a/Xext/dpms.c b/Xext/dpms.c
index ebc992dc2..23c377fb4 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -27,43 +27,55 @@ Equipment Corporation.
******************************************************************/
+/*
+ * HISTORY
+ *
+ * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00
+ */
+
+/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.9 2001/10/28 03:32:50 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
+#include "opaque.h"
+#define DPMS_SERVER
#include "dpms.h"
#include "dpmsstr.h"
-#include <stdio.h>
+#include "dpmsproc.h"
static unsigned char DPMSCode;
-static int ProcDPMSDispatch(), SProcDPMSDispatch();
-static void DPMSResetProc();
-static int ProcDPMSGetVersion(), SProcDPMSGetVersion();
-static int ProcDPMSGetTimeouts(), SProcDPMSGetTimeouts();
-static int ProcDPMSSetTimeouts(), ProcDPMSSetTimeouts();
-static int ProcDPMSEnable(), ProcDPMSEnable();
-static int ProcDPMSDisable(), ProcDPMSDisable();
-static int ProcDPMSForceLevel(), ProcDPMSForceLevel();
-
-extern void Swap32Write(); /* XXX should be in header file */
-extern CARD32 ScreenSaverTime;
-extern CARD32 DPMSStandbyTime;
-extern CARD32 DPMSSuspendTime;
-extern CARD32 DPMSOffTime;
-extern BOOL DPMSCapableFlag;
-extern BOOL DPMSEnabled;
-extern CARD16 DPMSPowerLevel;
+static DISPATCH_PROC(ProcDPMSDispatch);
+static DISPATCH_PROC(SProcDPMSDispatch);
+static DISPATCH_PROC(ProcDPMSGetVersion);
+static DISPATCH_PROC(SProcDPMSGetVersion);
+static DISPATCH_PROC(ProcDPMSGetTimeouts);
+static DISPATCH_PROC(SProcDPMSGetTimeouts);
+static DISPATCH_PROC(ProcDPMSSetTimeouts);
+static DISPATCH_PROC(SProcDPMSSetTimeouts);
+static DISPATCH_PROC(ProcDPMSEnable);
+static DISPATCH_PROC(SProcDPMSEnable);
+static DISPATCH_PROC(ProcDPMSDisable);
+static DISPATCH_PROC(SProcDPMSDisable);
+static DISPATCH_PROC(ProcDPMSForceLevel);
+static DISPATCH_PROC(SProcDPMSForceLevel);
+static DISPATCH_PROC(ProcDPMSInfo);
+static DISPATCH_PROC(SProcDPMSInfo);
+static DISPATCH_PROC(ProcDPMSCapable);
+static DISPATCH_PROC(SProcDPMSCapable);
+static void DPMSResetProc(ExtensionEntry* extEntry);
void
DPMSExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(DPMSExtensionName, 0, 0,
+ if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
- DPMSResetProc, StandardMinorOpcode))
+ DPMSResetProc, StandardMinorOpcode)))
DPMSCode = (unsigned char)extEntry->base;
return;
}
@@ -79,7 +91,7 @@ static int
ProcDPMSGetVersion(client)
register ClientPtr client;
{
- REQUEST(xDPMSGetVersionReq);
+ /* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep;
register int n;
@@ -100,10 +112,9 @@ ProcDPMSGetVersion(client)
}
static int
-ProcDPMSCapable(client)
- register ClientPtr client;
+ProcDPMSCapable(register ClientPtr client)
{
- REQUEST(xDPMSCapableReq);
+ /* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep;
register int n;
@@ -114,6 +125,9 @@ ProcDPMSCapable(client)
rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ }
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
return(client->noClientException);
}
@@ -122,7 +136,7 @@ static int
ProcDPMSGetTimeouts(client)
register ClientPtr client;
{
- REQUEST(xDPMSGetTimeoutsReq);
+ /* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep;
register int n;
@@ -150,7 +164,6 @@ ProcDPMSSetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSSetTimeoutsReq);
- register int n;
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
@@ -176,7 +189,7 @@ static int
ProcDPMSEnable(client)
register ClientPtr client;
{
- REQUEST(xDPMSEnableReq);
+ /* REQUEST(xDPMSEnableReq); */
REQUEST_SIZE_MATCH(xDPMSEnableReq);
@@ -190,13 +203,11 @@ static int
ProcDPMSDisable(client)
register ClientPtr client;
{
- REQUEST(xDPMSDisableReq);
+ /* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
-#ifdef DPMSExtension
DPMSSet(DPMSModeOn);
-#endif
DPMSEnabled = FALSE;
@@ -217,9 +228,7 @@ ProcDPMSForceLevel(client)
if (stuff->level == DPMSModeOn) {
lastDeviceEventTime.milliseconds =
GetTimeInMillis();
- }
-#if 0
- else if (stuff->level == DPMSModeStandby) {
+ } else if (stuff->level == DPMSModeStandby) {
lastDeviceEventTime.milliseconds =
GetTimeInMillis() - DPMSStandbyTime;
} else if (stuff->level == DPMSModeSuspend) {
@@ -232,20 +241,16 @@ ProcDPMSForceLevel(client)
client->errorValue = stuff->level;
return BadValue;
}
-#endif
-#ifdef DPMSExtension
DPMSSet(stuff->level);
-#endif
return(client->noClientException);
}
static int
-ProcDPMSInfo(client)
- register ClientPtr client;
+ProcDPMSInfo(register ClientPtr client)
{
- REQUEST(xDPMSInfoReq);
+ /* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep;
register int n;
@@ -309,8 +314,7 @@ SProcDPMSGetVersion(client)
}
static int
-SProcDPMSCapable(client)
- register ClientPtr client;
+SProcDPMSCapable(register ClientPtr client)
{
REQUEST(xDPMSCapableReq);
register int n;
diff --git a/Xext/dpmsstubs.c b/Xext/dpmsstubs.c
index 6f635f42b..ac1ee352a 100644
--- a/Xext/dpmsstubs.c
+++ b/Xext/dpmsstubs.c
@@ -26,23 +26,23 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/dpmsstubs.c,v 3.4 2001/01/17 22:13:15 dawes Exp $ */
typedef int Bool;
#define FALSE 0
-Bool DPMSSupported()
+Bool DPMSSupported(void)
{
return FALSE;
}
-int DPSMGet(level)
- int *level;
+int DPSMGet(int *level)
{
return -1;
}
-void DPMSSet(level)
+void DPMSSet(int level)
{
}
diff --git a/Xext/mbuf.c b/Xext/mbuf.c
index c65ed3dd2..16a59e58e 100644
--- a/Xext/mbuf.c
+++ b/Xext/mbuf.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.14 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -27,29 +28,29 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mbuf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
-#include "misc.h"
+#include "window.h"
#include "os.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
+#include "gcstruct.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
+#include "sleepuntil.h"
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#include "multibufst.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#ifndef WIN32
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <stdio.h>
+#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
#endif
/* given an OtherClientPtr obj, get the ClientPtr */
@@ -60,121 +61,99 @@ in this Software without prior written authorization from The Open Group.
#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
-#ifdef PANORAMIX
-extern int PanoramiXNumScreens;
-extern Bool noPanoramiXExtension;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
-extern PanoramiXData *panoramiXdataPtr;
-#endif
-
-/* The _Multibuffer and _Multibuffers structures below refer to each other,
- * so we need this forward declaration
- */
-
-typedef struct _Multibuffers *MultibuffersPtr;
-
-/*
- * per-Multibuffer data
- */
-
-typedef struct _Multibuffer {
- MultibuffersPtr pMultibuffers; /* associated window data */
- Mask eventMask; /* MultibufferClobberNotifyMask|ExposureMask|MultibufferUpdateNotifyMask */
- Mask otherEventMask; /* mask of all other clients event masks */
- OtherClients *otherClients; /* other clients that want events */
- int number; /* index of this buffer into array */
- int side; /* always Mono */
- int clobber; /* Unclobbered, PartiallyClobbered, FullClobbered */
- PixmapPtr pPixmap; /* associated pixmap */
-} MultibufferRec, *MultibufferPtr;
-
-/*
- * per-window data
- */
-
-typedef struct _Multibuffers {
- WindowPtr pWindow; /* associated window */
- int numMultibuffer; /* count of buffers */
- int refcnt; /* ref count for delete */
- int displayedMultibuffer; /* currently active buffer */
- int updateAction; /* Undefined, Background, Untouched, Copied */
- int updateHint; /* Frequent, Intermittent, Static */
- int windowMode; /* always Mono */
-
- TimeStamp lastUpdate; /* time of last update */
-
- unsigned short width, height; /* last known window size */
- short x, y; /* for static gravity */
-
- MultibufferPtr buffers; /* array of numMultibuffer buffers */
-} MultibuffersRec;
-
-/*
- * per-screen data
- */
-typedef struct _MultibufferScreen {
- Bool (*PositionWindow)();
-} MultibufferScreenRec, *MultibufferScreenPtr;
-
-/*
- * per display-image-buffers request data.
- */
-
-typedef struct _DisplayRequest {
- struct _DisplayRequest *next;
- TimeStamp activateTime;
- ClientPtr pClient;
- XID id;
-} DisplayRequestRec, *DisplayRequestPtr;
-
static unsigned char MultibufferReqCode;
static int MultibufferEventBase;
static int MultibufferErrorBase;
int MultibufferScreenIndex = -1;
int MultibufferWindowIndex = -1;
-static void PerformDisplayRequest ();
-static void DisposeDisplayRequest ();
-static Bool QueueDisplayRequest ();
-
-static void BumpTimeStamp ();
+static void PerformDisplayRequest (
+#if NeedFunctionPrototypes
+ MultibuffersPtr * /* ppMultibuffers */,
+ MultibufferPtr * /* pMultibuffer */,
+ int /* nbuf */
+#endif
+ );
+static Bool QueueDisplayRequest (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ TimeStamp /* activateTime */
+#endif
+ );
-void MultibufferExpose ();
-void MultibufferUpdate ();
-static void AliasMultibuffer ();
-int CreateImageBuffers ();
-void DestroyImageBuffers ();
-int DisplayImageBuffers ();
-static void RecalculateMultibufferOtherEvents ();
-static int EventSelectForMultibuffer();
+static void BumpTimeStamp (
+#if NeedFunctionPrototypes
+ TimeStamp * /* ts */,
+ CARD32 /* inc */
+#endif
+ );
+static void AliasMultibuffer (
+#if NeedFunctionPrototypes
+ MultibuffersPtr /* pMultibuffers */,
+ int /* i */
+#endif
+ );
+static void RecalculateMultibufferOtherEvents (
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */
+#endif
+ );
+static int EventSelectForMultibuffer(
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */,
+ ClientPtr /* client */,
+ Mask /* mask */
+#endif
+ );
/*
* The Pixmap associated with a buffer can be found as a resource
* with this type
*/
RESTYPE MultibufferDrawableResType;
-static int MultibufferDrawableDelete ();
+static int MultibufferDrawableDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
/*
* The per-buffer data can be found as a resource with this type.
* the resource id of the per-buffer data is the same as the resource
* id of the pixmap
*/
static RESTYPE MultibufferResType;
-static int MultibufferDelete ();
+static int MultibufferDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
/*
* The per-window data can be found as a resource with this type,
* using the window resource id
*/
static RESTYPE MultibuffersResType;
-static int MultibuffersDelete ();
+static int MultibuffersDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
/*
* Clients other than the buffer creator attach event masks in
* OtherClient structures; each has a resource of this type.
*/
static RESTYPE OtherClientResType;
-static int OtherClientDelete ();
+static int OtherClientDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
/****************
* MultibufferExtensionInit
@@ -183,10 +162,70 @@ static int OtherClientDelete ();
*
****************/
-static int ProcMultibufferDispatch(), SProcMultibufferDispatch();
-static void MultibufferResetProc();
-static void SClobberNotifyEvent(), SUpdateNotifyEvent();
-static Bool MultibufferPositionWindow();
+extern DISPATCH_PROC(ProcGetBufferAttributes);
+
+static DISPATCH_PROC(ProcClearImageBufferArea);
+static DISPATCH_PROC(ProcCreateImageBuffers);
+static DISPATCH_PROC(ProcDestroyImageBuffers);
+static DISPATCH_PROC(ProcDisplayImageBuffers);
+static DISPATCH_PROC(ProcGetBufferInfo);
+static DISPATCH_PROC(ProcGetBufferVersion);
+static DISPATCH_PROC(ProcGetMBufferAttributes);
+static DISPATCH_PROC(ProcMultibufferDispatch);
+static DISPATCH_PROC(ProcSetBufferAttributes);
+static DISPATCH_PROC(ProcSetMBufferAttributes);
+static DISPATCH_PROC(SProcClearImageBufferArea);
+static DISPATCH_PROC(SProcCreateImageBuffers);
+static DISPATCH_PROC(SProcDestroyImageBuffers);
+static DISPATCH_PROC(SProcDisplayImageBuffers);
+static DISPATCH_PROC(SProcGetBufferAttributes);
+static DISPATCH_PROC(SProcGetBufferInfo);
+static DISPATCH_PROC(SProcGetBufferVersion);
+static DISPATCH_PROC(SProcGetMBufferAttributes);
+static DISPATCH_PROC(SProcMultibufferDispatch);
+static DISPATCH_PROC(SProcSetBufferAttributes);
+static DISPATCH_PROC(SProcSetMBufferAttributes);
+
+static void MultibufferResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SClobberNotifyEvent(
+#if NeedFunctionPrototypes
+ xMbufClobberNotifyEvent * /* from */,
+ xMbufClobberNotifyEvent * /* to */
+# endif
+ );
+static void SUpdateNotifyEvent(
+#if NeedFunctionPrototypes
+ xMbufUpdateNotifyEvent * /* from */,
+ xMbufUpdateNotifyEvent * /* to */
+#endif
+ );
+static Bool MultibufferPositionWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ int /* x */,
+ int /* y */
+#endif
+ );
+
+static void SetupBackgroundPainter (
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ GCPtr /* pGC */
+#endif
+ );
+
+static int DeliverEventsToMultibuffer (
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */,
+ xEvent * /* pEvents */,
+ int /* count */,
+ Mask /* filter */
+#endif
+ );
void
MultibufferExtensionInit()
@@ -243,8 +282,8 @@ MultibufferExtensionInit()
MultibufferReqCode = (unsigned char)extEntry->base;
MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase;
- EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = SClobberNotifyEvent;
- EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = SUpdateNotifyEvent;
+ EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
+ EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
}
}
@@ -275,7 +314,6 @@ static int
ProcGetBufferVersion (client)
register ClientPtr client;
{
- REQUEST(xMbufGetBufferVersionReq);
xMbufGetBufferVersionReply rep;
register int n;
@@ -331,8 +369,8 @@ SetupBackgroundPainter (pWin, pGC)
case BackgroundPixmap:
gcvalues[0] = (pointer) FillTiled;
gcvalues[1] = (pointer) background.pixmap;
- gcvalues[2] = (pointer) ts_x_origin;
- gcvalues[3] = (pointer) ts_y_origin;
+ gcvalues[2] = (pointer)(long) ts_x_origin;
+ gcvalues[3] = (pointer)(long) ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
@@ -430,80 +468,8 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
return Success;
}
-#ifdef PANORAMIX
-static int
-ProcPanoramiXCreateImageBuffers (client)
- register ClientPtr client;
-{
- REQUEST(xMbufCreateImageBuffersReq);
-
- register int result;
- int i, j, k, len;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *next;
- PanoramiXWindow *pPanoramiXids;
- PanoramiXWindow *pPanoramiXPrev_ids;
- PanoramiXPmap *local;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- CARD32 *value, *orig_ids;
- XID *ids;
- XID ID;
- DrawablePtr pDrawable;
-
- REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
- ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
- orig_ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
- if (!ids)
- return BadAlloc;
- memcpy((char *)orig_ids, (char *) &stuff[1], len * sizeof(XID));
- value = (CARD32 *)&stuff[1];
- /* New resources are pixmaps */
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->window = pPanoramiXWin->info[j].id;
- for (i = 0; i < len; i++) {
- ids[i] = (XID)orig_ids[i];
- /* These will be MultibufferDrawableResType & MultibufferResType */
- pPanoramiXPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
- if (!pPanoramiXPmap) {
- local = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
- for (k = 0; k <= PanoramiXNumScreens - 1; k++) {
- ID = k ? FakeClientID(client->index) : ids[i];
- local->info[k].id = ID;
- }
- local->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
- pPanoramiXPmap->next = local;
- value[i] = local->info[j].id;
- }else
- value[i] = pPanoramiXPmap->info[j].id;
- }
- if (!j)
- noPanoramiXExtension = TRUE;
- result = ProcCreateImageBuffers (client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- if (ids)
- Xfree(ids);
- if (orig_ids)
- Xfree(orig_ids);
- if (local)
- Xfree(local);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcCreateImageBuffers (client)
register ClientPtr client;
{
@@ -565,10 +531,7 @@ ProcCreateImageBuffers (client)
swapl(&rep.length, n);
swaps(&rep.numberBuffer, n);
}
-#ifdef PANORAMIX
- if (noPanoramiXExtension)
-#endif
- WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
+ WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
return (client->noClientException);
}
@@ -585,16 +548,6 @@ ProcDisplayImageBuffers (client)
CARD32 minDelay;
TimeStamp activateTime, bufferTime;
-#ifdef PANORAMIX
- WindowPtr pWndw;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- MultibufferPtr *pScrn0Multibuffer;
- MultibuffersPtr *ppScrn0Multibuffers;
- int k;
- int panoramiX_buf = 0;
- Bool FoundScreen;
-
-#endif
REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
@@ -602,23 +555,6 @@ ProcDisplayImageBuffers (client)
return Success;
minDelay = stuff->minDelay;
ids = (XID *) &stuff[1];
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- int maxbuf = 0;
- maxbuf = nbuf * PanoramiXNumScreens;
- ppScrn0Multibuffers = (MultibuffersPtr *) xalloc(maxbuf * sizeof (MultibuffersPtr));
- pScrn0Multibuffer = (MultibufferPtr *) xalloc (maxbuf * sizeof(MultibufferPtr));
- if (!ppScrn0Multibuffers || !pScrn0Multibuffer)
- {
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- xfree (ppScrn0Multibuffers);
- xfree (pScrn0Multibuffer);
- client->errorValue = 0;
- return BadAlloc;
- }
- }
-#endif
ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer)
@@ -632,81 +568,6 @@ ProcDisplayImageBuffers (client)
activateTime.milliseconds = 0;
for (i = 0; i < nbuf; i++)
{
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- pPanoramiXPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
- if (!pPanoramiXPmap){
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- xfree (ppMultibuffers);
- xfree (pMultibuffer);
- client->errorValue = ids[i];
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- FoundScreen = FALSE;
- pScrn0Multibuffer[panoramiX_buf] = (MultibufferPtr)
- LookupIDByType (ids[i], MultibufferResType);
- ppScrn0Multibuffers[i] = pScrn0Multibuffer[i]->pMultibuffers;
- pWndw = ppScrn0Multibuffers[i]->pWindow;
- for (k = 0; (k < PanoramiXNumScreens && !FoundScreen); k++) {
- pMultibuffer[panoramiX_buf] = (MultibufferPtr)
- LookupIDByType (pPanoramiXPmap->info[k].id, MultibufferResType);
- if (!pMultibuffer[i])
- {
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- xfree (ppMultibuffers);
- xfree (pMultibuffer);
- client->errorValue = ids[i];
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- ppMultibuffers[panoramiX_buf] = pMultibuffer[panoramiX_buf]->pMultibuffers;
- /* Figure out where the buffer resides, which screens */
- if ( ((pWndw->drawable.x < 0) &&
- (pWndw->drawable.x + pWndw->drawable.width < 0))
- || ( (pWndw->drawable.x >
- panoramiXdataPtr[k].x + panoramiXdataPtr[k].width) &&
- (pWndw->drawable.x + pWndw->drawable.width >
- panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)))
- /* its not on screen - k -, try next screen */
- continue;
- if ( ((pWndw->drawable.y < 0) &&
- (pWndw->drawable.y + pWndw->drawable.height < 0))
- || ( (pWndw->drawable.y >
- panoramiXdataPtr[k].y + panoramiXdataPtr[k].height) &&
- (pWndw->drawable.y + pWndw->drawable.height >
- panoramiXdataPtr[k].y + panoramiXdataPtr[k].height)))
- /* its not on screen - k -, try next screen */
- continue;
-
- /* The window resides on screen k, which means we need to
- keep the buffer information for this screen */
- panoramiX_buf++;
-
- /* Is it only on this screen, or does it enter onto another
- screen */
- if ( ((pWndw->drawable.x + pWndw->drawable.width) <=
- (panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)) &&
- ((pWndw->drawable.y + pWndw->drawable.height) <=
- (panoramiXdataPtr[k].y +
- panoramiXdataPtr[k].height )) )
- FoundScreen = TRUE;
- } /* for each screen k */
- for (j = 0; j < i; j++)
- {
- if (ppScrn0Multibuffers[i] == ppScrn0Multibuffers[j])
- {
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- DEALLOCATE_LOCAL(ppScrn0Multibuffers);
- DEALLOCATE_LOCAL(pScrn0Multibuffer);
- DEALLOCATE_LOCAL(ppMultibuffers);
- DEALLOCATE_LOCAL(pMultibuffer);
- client->errorValue = ids[i];
- return BadMatch;
- }
- }
- bufferTime = ppScrn0Multibuffers[i]->lastUpdate;
- }else {
-#endif
pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i],
MultibufferResType);
if (!pMultibuffer[i])
@@ -728,9 +589,6 @@ MultibufferResType);
}
}
bufferTime = ppMultibuffers[i]->lastUpdate;
-#ifdef PANORAMIX
- }
-#endif
BumpTimeStamp (&bufferTime, minDelay);
if (CompareTimeStamps (bufferTime, activateTime) == LATER)
activateTime = bufferTime;
@@ -742,54 +600,15 @@ MultibufferResType);
;
}
else
-#ifdef PANORAMIX
- if (!noPanoramiXExtension){
- PerformDisplayRequest (ppMultibuffers, pMultibuffer, panoramiX_buf);
- }else
-#endif
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
-#ifdef PANORAMIX
- if (!noPanoramiXExtension){
- DEALLOCATE_LOCAL(ppScrn0Multibuffers);
- DEALLOCATE_LOCAL(pScrn0Multibuffer);
- }
-#endif
-
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
return Success;
}
-#ifdef PANORAMIX
-static int
-ProcPanoramiXDestroyImageBuffers (client)
- ClientPtr client;
-{
- REQUEST (xMbufDestroyImageBuffersReq);
- WindowPtr pWin;
-
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = ProcDestroyImageBuffers (client);
- BREAK_IF(result != Success);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcDestroyImageBuffers (client)
register ClientPtr client;
{
@@ -803,34 +622,7 @@ ProcDestroyImageBuffers (client)
return Success;
}
-#ifdef PANORAMIX
-static int
-ProcPanoramiXSetMBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST (xMbufSetMBufferAttributesReq);
- WindowPtr pWin;
-
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_SIZE_MATCH (xMbufSetMBufferAttributesReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = ProcSetMBufferAttributes (client);
- BREAK_IF(result != Success);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcSetMBufferAttributes (client)
register ClientPtr client;
{
@@ -839,7 +631,7 @@ ProcSetMBufferAttributes (client)
MultibuffersPtr pMultibuffers;
int len;
Mask vmask;
- Mask index;
+ Mask index2;
CARD32 updateHint;
XID *vlist;
@@ -857,9 +649,9 @@ ProcSetMBufferAttributes (client)
vlist = (XID *) &stuff[1];
while (vmask)
{
- index = (Mask) lowbit (vmask);
- vmask &= ~index;
- switch (index)
+ index2 = (Mask) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
{
case MultibufferWindowUpdateHint:
updateHint = (CARD32) *vlist;
@@ -936,7 +728,7 @@ ProcSetBufferAttributes (client)
REQUEST(xMbufSetBufferAttributesReq);
MultibufferPtr pMultibuffer;
int len;
- Mask vmask, index;
+ Mask vmask, index2;
XID *vlist;
Mask eventMask;
int result;
@@ -952,9 +744,9 @@ ProcSetBufferAttributes (client)
vlist = (XID *) &stuff[1];
while (vmask)
{
- index = (Mask) lowbit (vmask);
- vmask &= ~index;
- switch (index)
+ index2 = (Mask) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
{
case MultibufferBufferEventMask:
eventMask = (Mask) *vlist;
@@ -971,6 +763,7 @@ ProcSetBufferAttributes (client)
return Success;
}
+int
ProcGetBufferAttributes (client)
register ClientPtr client;
{
@@ -1150,34 +943,13 @@ ProcMultibufferDispatch (client)
case X_MbufGetBufferVersion:
return ProcGetBufferVersion (client);
case X_MbufCreateImageBuffers:
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXCreateImageBuffers (client);
- else
- return ProcCreateImageBuffers (client);
-#else
return ProcCreateImageBuffers (client);
-#endif
case X_MbufDisplayImageBuffers:
return ProcDisplayImageBuffers (client);
case X_MbufDestroyImageBuffers:
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXDestroyImageBuffers (client);
- else
- return ProcDestroyImageBuffers (client);
-#else
return ProcDestroyImageBuffers (client);
-#endif
case X_MbufSetMBufferAttributes:
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXSetMBufferAttributes (client);
- else
- return ProcSetMBufferAttributes (client);
-#else
return ProcSetMBufferAttributes (client);
-#endif
case X_MbufGetMBufferAttributes:
return ProcGetMBufferAttributes (client);
case X_MbufSetBufferAttributes:
@@ -1447,8 +1219,6 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
if (pExposed)
{
RegionPtr pWinSize;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- extern RegionPtr CreateUnclippedWinSize();
pWinSize = CreateUnclippedWinSize (pWin);
/* pExposed is window-relative, but at this point
@@ -1456,13 +1226,13 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
* window-relative so that region ops involving
* pExposed and pWinSize behave sensibly.
*/
- REGION_TRANSLATE(pScreen, pWinSize,
- -pWin->drawable.x,
- -pWin->drawable.y);
- REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
- REGION_DESTROY(pScreen, pWinSize);
+ REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize,
+ -pWin->drawable.x, -pWin->drawable.y);
+ REGION_INTERSECT(pWin->drawable.pScreen, pExposed,
+ pExposed, pWinSize);
+ REGION_DESTROY(pWin->drawable.pScreen, pWinSize);
MultibufferExpose (pPrevMultibuffer, pExposed);
- REGION_DESTROY(pScreen, pExposed);
+ REGION_DESTROY(pWin->drawable.pScreen, pExposed);
}
graphicsExpose = FALSE;
DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
@@ -1590,8 +1360,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
return 0;
/* maybe send event to owner */
- if (attempt = TryClientEvents(
- bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0))
+ if ((attempt = TryClientEvents(
+ bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
@@ -1602,8 +1372,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
/* maybe send event to other clients */
for (other = pMultibuffer->otherClients; other; other=other->next)
{
- if (attempt = TryClientEvents(
- rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0))
+ if ((attempt = TryClientEvents(
+ rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
@@ -1664,15 +1434,15 @@ MultibufferExpose (pMultibuffer, pRegion)
/* send UpdateNotify event */
void
-MultibufferUpdate (pMultibuffer, time)
+MultibufferUpdate (pMultibuffer, time2)
MultibufferPtr pMultibuffer;
- CARD32 time;
+ CARD32 time2;
{
xMbufUpdateNotifyEvent event;
event.type = MultibufferEventBase + MultibufferUpdateNotify;
event.buffer = pMultibuffer->pPixmap->drawable.id;
- event.timeStamp = time;
+ event.timeStamp = time2;
(void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
1, (Mask)MultibufferUpdateNotifyMask);
}
diff --git a/Xext/mbufbf.c b/Xext/mbufbf.c
index 3c873086f..925745712 100644
--- a/Xext/mbufbf.c
+++ b/Xext/mbufbf.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/*
Copyright 1989, 1998 The Open Group
diff --git a/Xext/mbufpx.c b/Xext/mbufpx.c
index 9474cc9aa..9c531c292 100644
--- a/Xext/mbufpx.c
+++ b/Xext/mbufpx.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
diff --git a/Xext/mitmisc.c b/Xext/mitmisc.c
index 63e496209..b6038edba 100644
--- a/Xext/mitmisc.c
+++ b/Xext/mitmisc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -28,6 +29,7 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
+#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -40,17 +42,28 @@ in this Software without prior written authorization from The Open Group.
extern Bool permitOldBugs;
static unsigned char MITReqCode;
-static int ProcMITDispatch(), SProcMITDispatch();
-static void MITResetProc();
+
+static void MITResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcMITDispatch);
+static DISPATCH_PROC(ProcMITGetBugMode);
+static DISPATCH_PROC(ProcMITSetBugMode);
+static DISPATCH_PROC(SProcMITDispatch);
+static DISPATCH_PROC(SProcMITGetBugMode);
+static DISPATCH_PROC(SProcMITSetBugMode);
void
MITMiscExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(MITMISCNAME, 0, 0,
+ if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
- MITResetProc, StandardMinorOpcode))
+ MITResetProc, StandardMinorOpcode)) != 0)
MITReqCode = (unsigned char)extEntry->base;
}
@@ -81,7 +94,6 @@ static int
ProcMITGetBugMode(client)
register ClientPtr client;
{
- REQUEST(xMITGetBugModeReq);
xMITGetBugModeReply rep;
register int n;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 2d3eb7c42..fb0b9c541 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -23,11 +23,13 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.32 2002/08/01 00:30:34 mvojkovi Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "X.h"
#include "Xproto.h"
+#include "Xarch.h"
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@@ -39,32 +41,44 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
-#if 0
-#include <sys/workstation.h>
-#include <X11/Xserver/ws.h>
-#endif
#include "panoramiX.h"
#include "panoramiXproto.h"
+#include "panoramiXsrv.h"
+#include "globals.h"
+#include "servermd.h"
+#include "resource.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
static unsigned char PanoramiXReqCode = 0;
/*
* PanoramiX data declarations
*/
-int PanoramiXPixWidth;
-int PanoramiXPixHeight;
-int PanoramiXNumScreens;
+int PanoramiXPixWidth = 0;
+int PanoramiXPixHeight = 0;
+int PanoramiXNumScreens = 0;
+
+PanoramiXData *panoramiXdataPtr = NULL;
-PanoramiXData *panoramiXdataPtr;
-PanoramiXWindow *PanoramiXWinRoot;
-PanoramiXGC *PanoramiXGCRoot;
-PanoramiXCmap *PanoramiXCmapRoot;
-PanoramiXPmap *PanoramiXPmapRoot;
-PanoramiXEdge panoramiXEdgePtr[MAXSCREENS];
-RegionRec PanoramiXScreenRegion[MAXSCREENS];
-PanoramiXCDT PanoramiXColorDepthTable[MAXSCREENS];
-PanoramiXDepth PanoramiXLargestScreenDepth;
+RegionRec PanoramiXScreenRegion;
+
+int PanoramiXNumDepths;
+DepthPtr PanoramiXDepths;
+int PanoramiXNumVisuals;
+VisualPtr PanoramiXVisuals;
+/* We support at most 256 visuals */
+XID *PanoramiXVisualTable = NULL;
+
+unsigned long XRC_DRAWABLE;
+unsigned long XRT_WINDOW;
+unsigned long XRT_PIXMAP;
+unsigned long XRT_GC;
+unsigned long XRT_COLORMAP;
+
int (* SavedProcVector[256]) ();
ScreenInfo *GlobalScrInfo;
@@ -75,7 +89,6 @@ static int ProcPanoramiXDispatch();
* Function prototypes
*/
-static void locate_neighbors(int);
static void PanoramiXResetProc(ExtensionEntry*);
/*
@@ -83,16 +96,9 @@ static void PanoramiXResetProc(ExtensionEntry*);
*/
extern int SProcPanoramiXDispatch();
-extern Bool noPanoramiXExtension;
-extern Bool PanoramiXVisibilityNotifySent;
-extern WindowPtr *WindowTable;
-#if 0
-extern ScreenArgsRec screenArgs[MAXSCREENS];
-#endif
-extern int defaultBackingStore;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
-extern int (* ProcVector[256]) ();
+extern xConnSetupPrefix connSetupPrefix;
/*
* Server dispatcher function replacements
@@ -104,11 +110,10 @@ int PanoramiXChangeSaveSet(), PanoramiXReparentWindow();
int PanoramiXMapWindow(), PanoramiXMapSubwindows();
int PanoramiXUnmapWindow(), PanoramiXUnmapSubwindows();
int PanoramiXConfigureWindow(), PanoramiXCirculateWindow();
-int PanoramiXGetGeometry(), PanoramiXChangeProperty();
-int PanoramiXDeleteProperty(), PanoramiXSendEvent();
+int PanoramiXGetGeometry(), PanoramiXTranslateCoords();
int PanoramiXCreatePixmap(), PanoramiXFreePixmap();
int PanoramiXCreateGC(), PanoramiXChangeGC();
-int PanoramiXCopyGC();
+int PanoramiXCopyGC(), PanoramiXCopyColormapAndFree();
int PanoramiXSetDashes(), PanoramiXSetClipRectangles();
int PanoramiXFreeGC(), PanoramiXClearToBackground();
int PanoramiXCopyArea(), PanoramiXCopyPlane();
@@ -122,8 +127,326 @@ int PanoramiXImageText8(), PanoramiXImageText16();
int PanoramiXCreateColormap(), PanoramiXFreeColormap();
int PanoramiXInstallColormap(), PanoramiXUninstallColormap();
int PanoramiXAllocColor(), PanoramiXAllocNamedColor();
-int PanoramiXAllocColorCells();
+int PanoramiXAllocColorCells(), PanoramiXStoreNamedColor();
int PanoramiXFreeColors(), PanoramiXStoreColors();
+int PanoramiXAllocColorPlanes();
+
+static int PanoramiXGCIndex = -1;
+static int PanoramiXScreenIndex = -1;
+
+typedef struct {
+ DDXPointRec clipOrg;
+ DDXPointRec patOrg;
+ GCFuncs *wrapFuncs;
+} PanoramiXGCRec, *PanoramiXGCPtr;
+
+typedef struct {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+} PanoramiXScreenRec, *PanoramiXScreenPtr;
+
+RegionRec XineramaScreenRegions[MAXSCREENS];
+
+static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void XineramaChangeGC(GCPtr, unsigned long);
+static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
+static void XineramaDestroyGC(GCPtr);
+static void XineramaChangeClip(GCPtr, int, pointer, int);
+static void XineramaDestroyClip(GCPtr);
+static void XineramaCopyClip(GCPtr, GCPtr);
+
+GCFuncs XineramaGCFuncs = {
+ XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
+ XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
+};
+
+#define Xinerama_GC_FUNC_PROLOGUE(pGC)\
+ PanoramiXGCPtr pGCPriv = \
+ (PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\
+ (pGC)->funcs = pGCPriv->wrapFuncs;
+
+#define Xinerama_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->funcs = &XineramaGCFuncs;
+
+
+static Bool
+XineramaCloseScreen (int i, ScreenPtr pScreen)
+{
+ PanoramiXScreenPtr pScreenPriv =
+ (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]);
+ if (pScreen->myNum == 0)
+ REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
+
+ xfree ((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+XineramaCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ PanoramiXScreenPtr pScreenPriv =
+ (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
+ Bool ret;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ if((ret = (*pScreen->CreateGC)(pGC))) {
+ PanoramiXGCPtr pGCPriv =
+ (PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr;
+
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGC->funcs = &XineramaGCFuncs;
+
+ pGCPriv->clipOrg.x = pGC->clipOrg.x;
+ pGCPriv->clipOrg.y = pGC->clipOrg.y;
+ pGCPriv->patOrg.x = pGC->patOrg.x;
+ pGCPriv->patOrg.y = pGC->patOrg.y;
+ }
+ pScreen->CreateGC = XineramaCreateGC;
+
+ return ret;
+}
+
+static void
+XineramaValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+
+ if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) {
+ /* the root window */
+ int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x;
+ int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y;
+ int new_val;
+
+ new_val = pGCPriv->clipOrg.x - x_off;
+ if(pGC->clipOrg.x != new_val) {
+ pGC->clipOrg.x = new_val;
+ changes |= GCClipXOrigin;
+ }
+ new_val = pGCPriv->clipOrg.y - y_off;
+ if(pGC->clipOrg.y != new_val) {
+ pGC->clipOrg.y = new_val;
+ changes |= GCClipYOrigin;
+ }
+ new_val = pGCPriv->patOrg.x - x_off;
+ if(pGC->patOrg.x != new_val) {
+ pGC->patOrg.x = new_val;
+ changes |= GCTileStipXOrigin;
+ }
+ new_val = pGCPriv->patOrg.y - y_off;
+ if(pGC->patOrg.y != new_val) {
+ pGC->patOrg.y = new_val;
+ changes |= GCTileStipYOrigin;
+ }
+ } else {
+ if(pGC->clipOrg.x != pGCPriv->clipOrg.x) {
+ pGC->clipOrg.x = pGCPriv->clipOrg.x;
+ changes |= GCClipXOrigin;
+ }
+ if(pGC->clipOrg.y != pGCPriv->clipOrg.y) {
+ pGC->clipOrg.y = pGCPriv->clipOrg.y;
+ changes |= GCClipYOrigin;
+ }
+ if(pGC->patOrg.x != pGCPriv->patOrg.x) {
+ pGC->patOrg.x = pGCPriv->patOrg.x;
+ changes |= GCTileStipXOrigin;
+ }
+ if(pGC->patOrg.y != pGCPriv->patOrg.y) {
+ pGC->patOrg.y = pGCPriv->patOrg.y;
+ changes |= GCTileStipYOrigin;
+ }
+ }
+
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaDestroyGC(GCPtr pGC)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+
+ if(mask & GCTileStipXOrigin)
+ pGCPriv->patOrg.x = pGC->patOrg.x;
+ if(mask & GCTileStipYOrigin)
+ pGCPriv->patOrg.y = pGC->patOrg.y;
+ if(mask & GCClipXOrigin)
+ pGCPriv->clipOrg.x = pGC->clipOrg.x;
+ if(mask & GCClipYOrigin)
+ pGCPriv->clipOrg.y = pGC->clipOrg.y;
+
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ PanoramiXGCPtr pSrcPriv =
+ (PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr;
+ Xinerama_GC_FUNC_PROLOGUE (pGCDst);
+
+ if(mask & GCTileStipXOrigin)
+ pGCPriv->patOrg.x = pSrcPriv->patOrg.x;
+ if(mask & GCTileStipYOrigin)
+ pGCPriv->patOrg.y = pSrcPriv->patOrg.y;
+ if(mask & GCClipXOrigin)
+ pGCPriv->clipOrg.x = pSrcPriv->clipOrg.x;
+ if(mask & GCClipYOrigin)
+ pGCPriv->clipOrg.y = pSrcPriv->clipOrg.y;
+
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ Xinerama_GC_FUNC_EPILOGUE (pGCDst);
+}
+
+static void
+XineramaChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ Xinerama_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+XineramaDestroyClip(GCPtr pGC)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+
+int
+XineramaDeleteResource(pointer data, XID id)
+{
+ xfree(data);
+ return 1;
+}
+
+
+static Bool
+XineramaFindIDOnAnyScreen(pointer resource, XID id, pointer privdata)
+{
+ PanoramiXRes *res = (PanoramiXRes*)resource;
+ int j;
+
+ FOR_NSCREENS(j)
+ if(res->info[j].id == *((XID*)privdata)) return TRUE;
+
+ return FALSE;
+}
+
+PanoramiXRes *
+PanoramiXFindIDOnAnyScreen(RESTYPE type, XID id)
+{
+ return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
+ XineramaFindIDOnAnyScreen, &id);
+}
+
+typedef struct {
+ int screen;
+ int id;
+} PanoramiXSearchData;
+
+
+static Bool
+XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
+{
+ PanoramiXRes *res = (PanoramiXRes*)resource;
+ PanoramiXSearchData *data = (PanoramiXSearchData*)privdata;
+
+ return (res->info[data->screen].id == data->id);
+}
+
+PanoramiXRes *
+PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
+{
+ PanoramiXSearchData data;
+
+ if(!screen)
+ return LookupIDByType(id, type);
+
+ data.screen = screen;
+ data.id = id;
+
+ return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
+ XineramaFindIDByScrnum, &data);
+}
+
+WindowPtr
+PanoramiXChangeWindow(int ScrnNum, WindowPtr pWin)
+{
+ int num = pWin->drawable.pScreen->myNum;
+
+ if(num != ScrnNum) {
+ PanoramiXRes *win;
+
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, num);
+
+ if (win)
+ pWin = (WindowPtr) LookupIDByType(win->info[ScrnNum].id, RT_WINDOW);
+ }
+
+ return pWin;
+}
+
+typedef struct _connect_callback_list {
+ void (*func)(void);
+ struct _connect_callback_list *next;
+} XineramaConnectionCallbackList;
+
+static XineramaConnectionCallbackList *ConnectionCallbackList = NULL;
+
+Bool
+XineramaRegisterConnectionBlockCallback(void (*func)(void))
+{
+ XineramaConnectionCallbackList *newlist;
+
+ if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList))))
+ return FALSE;
+
+ newlist->next = ConnectionCallbackList;
+ newlist->func = func;
+ ConnectionCallbackList = newlist;
+
+ return TRUE;
+}
/*
* PanoramiXExtensionInit():
@@ -134,14 +457,16 @@ int PanoramiXFreeColors(), PanoramiXStoreColors();
void PanoramiXExtensionInit(int argc, char *argv[])
{
- int i, j, PhyScrNum, ArgScrNum;
- Bool success = FALSE;
- ExtensionEntry *extEntry, *AddExtension();
- PanoramiXData *panoramiXtempPtr;
- ScreenPtr pScreen;
+ int i;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
+ ScreenPtr pScreen;
+ PanoramiXScreenPtr pScreenPriv;
+ int w, h;
- if (!noPanoramiXExtension)
- {
+ if (noPanoramiXExtension)
+ return;
+
GlobalScrInfo = &screenInfo; /* For debug visibility */
PanoramiXNumScreens = screenInfo.numScreens;
if (PanoramiXNumScreens == 1) { /* Only 1 screen */
@@ -165,13 +490,43 @@ void PanoramiXExtensionInit(int argc, char *argv[])
* run in non-PanoramiXeen mode.
*/
- panoramiXdataPtr = (PanoramiXData *) Xcalloc(PanoramiXNumScreens * sizeof(PanoramiXData));
- PanoramiXWinRoot = (PanoramiXWindow *) Xcalloc(sizeof(PanoramiXWindow));
- PanoramiXGCRoot = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
- PanoramiXCmapRoot = (PanoramiXCmap *) Xcalloc(sizeof(PanoramiXCmap));
- PanoramiXPmapRoot = (PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
- BREAK_IF(!(panoramiXdataPtr && PanoramiXWinRoot && PanoramiXGCRoot &&
- PanoramiXCmapRoot && PanoramiXPmapRoot));
+ panoramiXdataPtr = (PanoramiXData *)
+ xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
+
+ BREAK_IF(!panoramiXdataPtr);
+ BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
+ BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0);
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex,
+ sizeof(PanoramiXGCRec))) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
+ pScreen->devPrivates[PanoramiXScreenIndex].ptr =
+ (pointer)pScreenPriv;
+ if(!pScreenPriv) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+
+ pScreen->CreateGC = XineramaCreateGC;
+ pScreen->CloseScreen = XineramaCloseScreen;
+ }
+
+ XRC_DRAWABLE = CreateNewResourceClass();
+ XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) |
+ XRC_DRAWABLE;
+ XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) |
+ XRC_DRAWABLE;
+ XRT_GC = CreateNewResourceType(XineramaDeleteResource);
+ XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource);
panoramiXGeneration = serverGeneration;
success = TRUE;
@@ -182,117 +537,40 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME);
return;
}
-
- /* Set up a default configuration base on horizontal ordering */
- for (i = PanoramiXNumScreens -1; i >= 0 ; i--) {
- panoramiXdataPtr[i].above = panoramiXdataPtr[i].below = -1;
- panoramiXdataPtr[i].left = panoramiXdataPtr[i].right = -1;
- panoramiXEdgePtr[i].no_edges = TRUE;
- }
- for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
- panoramiXdataPtr[i].left = i - 1;
- panoramiXdataPtr[i].right = i + 1;
- }
- panoramiXdataPtr[PanoramiXNumScreens - 1].right = -1;
+
- /*
- * Position the screens relative to each other based on
- * command line options.
- */
+ REGION_INIT(pScreen, &PanoramiXScreenRegion, NullBox, 1);
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ BoxRec TheBox;
-#if 0
- for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
- if (wsRemapPhysToLogScreens)
- i = wsPhysToLogScreens[PhyScrNum];
- else
- i = PhyScrNum;
- if (i < 0)
- continue;
- panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
- panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
- if (screenArgs[i].flags & ARG_EDGE_L) {
- ArgScrNum = screenArgs[PhyScrNum].edge_left;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].left = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].right = i;
- else {
- if ( i >= 1 )
- panoramiXdataPtr[i - 1].right = -1;
- }
- }
- if (screenArgs[i].flags & ARG_EDGE_R) {
- ArgScrNum = screenArgs[PhyScrNum].edge_right;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].right = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].left = i;
- }
- if (screenArgs[i].flags & ARG_EDGE_T) {
- ArgScrNum = screenArgs[PhyScrNum].edge_top;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].above = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].below = i;
- }
- if (screenArgs[i].flags & ARG_EDGE_B) {
- ArgScrNum = screenArgs[PhyScrNum].edge_bottom;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].below = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].above = i;
- }
- }
-#else
- for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
- i = PhyScrNum;
- if (i < 0)
- continue;
+ panoramiXdataPtr[i].x = dixScreenOrigins[i].x;
+ panoramiXdataPtr[i].y = dixScreenOrigins[i].y;
panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
+
+ TheBox.x1 = panoramiXdataPtr[i].x;
+ TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width;
+ TheBox.y1 = panoramiXdataPtr[i].y;
+ TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height;
+
+ REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1);
+ REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion,
+ &XineramaScreenRegions[i]);
}
-#endif
- /*
- * Find the upper-left screen and then locate all the others
- */
- panoramiXtempPtr = panoramiXdataPtr;
- for (i = PanoramiXNumScreens; i; i--, panoramiXtempPtr++)
- if (panoramiXtempPtr->above == -1 && panoramiXtempPtr->left == -1)
- break;
- locate_neighbors(PanoramiXNumScreens - i);
+
+ PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width;
+ PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height;
+
+ for (i = 1; i < PanoramiXNumScreens; i++) {
+ w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
+ h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
+
+ if(PanoramiXPixWidth < w)
+ PanoramiXPixWidth = w;
+ if(PanoramiXPixHeight < h)
+ PanoramiXPixHeight = h;
+ }
/*
* Put our processes into the ProcVector
@@ -314,9 +592,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow;
ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow;
ProcVector[X_GetGeometry] = PanoramiXGetGeometry;
- ProcVector[X_ChangeProperty] = PanoramiXChangeProperty;
- ProcVector[X_DeleteProperty] = PanoramiXDeleteProperty;
- ProcVector[X_SendEvent] = PanoramiXSendEvent;
+ ProcVector[X_TranslateCoords] = PanoramiXTranslateCoords;
ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap;
ProcVector[X_FreePixmap] = PanoramiXFreePixmap;
ProcVector[X_CreateGC] = PanoramiXCreateGC;
@@ -344,252 +620,262 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ProcVector[X_ImageText16] = PanoramiXImageText16;
ProcVector[X_CreateColormap] = PanoramiXCreateColormap;
ProcVector[X_FreeColormap] = PanoramiXFreeColormap;
+ ProcVector[X_CopyColormapAndFree] = PanoramiXCopyColormapAndFree;
ProcVector[X_InstallColormap] = PanoramiXInstallColormap;
ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap;
ProcVector[X_AllocColor] = PanoramiXAllocColor;
ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor;
ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells;
+ ProcVector[X_AllocColorPlanes] = PanoramiXAllocColorPlanes;
ProcVector[X_FreeColors] = PanoramiXFreeColors;
- ProcVector[X_StoreColors] = PanoramiXStoreColors;
+ ProcVector[X_StoreColors] = PanoramiXStoreColors;
+ ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
- }
- else
- return;
+#ifdef RENDER
+ PanoramiXRenderInit ();
+#endif
}
-extern
+
+extern Bool CreateConnectionBlock(void);
+
Bool PanoramiXCreateConnectionBlock(void)
{
- int i;
+ int i, j, length;
+ Bool disableBackingStore = FALSE;
+ Bool disableSaveUnders = FALSE;
int old_width, old_height;
- int width_mult, height_mult;
+ float width_mult, height_mult;
xWindowRoot *root;
xConnSetup *setup;
+ xVisualType *visual;
+ xDepth *depth;
+ VisualPtr pVisual;
+ ScreenPtr pScreen;
/*
* Do normal CreateConnectionBlock but faking it for only one screen
*/
+ if(!PanoramiXNumDepths) {
+ ErrorF("PanoramiX error: Incompatible screens. No common visuals\n");
+ return FALSE;
+ }
+
+ for(i = 1; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) {
+ ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n");
+ return FALSE;
+ }
+ if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
+ disableBackingStore = TRUE;
+ if(pScreen->saveUnderSupport != screenInfo.screens[0]->saveUnderSupport)
+ disableSaveUnders = TRUE;
+ }
+
+ if(disableBackingStore || disableSaveUnders) {
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(disableBackingStore)
+ pScreen->backingStoreSupport = NotUseful;
+ if(disableSaveUnders)
+ pScreen->saveUnderSupport = NotUseful;
+ }
+ }
+
+ i = screenInfo.numScreens;
+ screenInfo.numScreens = 1;
if (!CreateConnectionBlock()) {
+ screenInfo.numScreens = i;
return FALSE;
}
+ screenInfo.numScreens = i;
+
+ setup = (xConnSetup *) ConnectionInfo;
+ root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
+ length = connBlockScreenStart + sizeof(xWindowRoot);
+
+ /* overwrite the connection block */
+ root->nDepths = PanoramiXNumDepths;
+
+ for (i = 0; i < PanoramiXNumDepths; i++) {
+ depth = (xDepth *) (ConnectionInfo + length);
+ depth->depth = PanoramiXDepths[i].depth;
+ depth->nVisuals = PanoramiXDepths[i].numVids;
+ length += sizeof(xDepth);
+ visual = (xVisualType *)(ConnectionInfo + length);
+
+ for (j = 0; j < depth->nVisuals; j++, visual++) {
+ visual->visualID = PanoramiXDepths[i].vids[j];
+
+ for (pVisual = PanoramiXVisuals;
+ pVisual->vid != visual->visualID;
+ pVisual++)
+ ;
+
+ visual->class = pVisual->class;
+ visual->bitsPerRGB = pVisual->bitsPerRGBValue;
+ visual->colormapEntries = pVisual->ColormapEntries;
+ visual->redMask = pVisual->redMask;
+ visual->greenMask = pVisual->greenMask;
+ visual->blueMask = pVisual->blueMask;
+ }
+
+ length += (depth->nVisuals * sizeof(xVisualType));
+ }
+
+ connSetupPrefix.length = length >> 2;
+
+ xfree(PanoramiXVisuals);
+ for (i = 0; i < PanoramiXNumDepths; i++)
+ xfree(PanoramiXDepths[i].vids);
+ xfree(PanoramiXDepths);
+
/*
* OK, change some dimensions so it looks as if it were one big screen
*/
-
- setup = (xConnSetup *) ConnectionInfo;
- setup->numRoots = 1;
- root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
old_width = root->pixWidth;
old_height = root->pixHeight;
- for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
- if (panoramiXdataPtr[i].right == -1 )
- root->pixWidth = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
- if (panoramiXdataPtr[i].below == -1)
- root->pixHeight = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
- }
- PanoramiXPixWidth = root->pixWidth;
- PanoramiXPixHeight = root->pixHeight;
- width_mult = root->pixWidth / old_width;
- height_mult = root->pixHeight / old_height;
+
+ root->pixWidth = PanoramiXPixWidth;
+ root->pixHeight = PanoramiXPixHeight;
+ width_mult = (1.0 * root->pixWidth) / old_width;
+ height_mult = (1.0 * root->pixHeight) / old_height;
root->mmWidth *= width_mult;
root->mmHeight *= height_mult;
- return TRUE;
-}
-extern
-Bool PanoramiXCreateScreenRegion(pWin)
-WindowPtr pWin;
-{
- ScreenPtr pScreen;
- BoxRec box;
- int i;
- Bool ret;
-
- pScreen = pWin->drawable.pScreen;
- for (i = 0; i < PanoramiXNumScreens; i++) {
- box.x1 = 0 - panoramiXdataPtr[i].x;
- box.x2 = box.x1 + PanoramiXPixWidth;
- box.y1 = 0 - panoramiXdataPtr[i].y;
- box.y2 = box.y1 + PanoramiXPixHeight;
- REGION_INIT(pScreen, &PanoramiXScreenRegion[i], &box, 1);
- ret = REGION_NOTEMPTY(pScreen, &PanoramiXScreenRegion[i]);
- if (!ret)
- return ret;
- }
- return ret;
-}
+ while(ConnectionCallbackList) {
+ pointer tmp;
-extern
-void PanoramiXDestroyScreenRegion(pWin)
-WindowPtr pWin;
-{
- ScreenPtr pScreen;
- int i;
- Bool ret;
+ tmp = (pointer)ConnectionCallbackList;
+ (*ConnectionCallbackList->func)();
+ ConnectionCallbackList = ConnectionCallbackList->next;
+ xfree(tmp);
+ }
- pScreen = pWin->drawable.pScreen;
- for (i = 0; i < PanoramiXNumScreens; i++)
- REGION_DESTROY(pScreen, &PanoramiXScreenRegion[i]);
+ return TRUE;
}
-/*
- * Assign the Root window and colormap ID's in the PanoramiXScreen Root
- * linked lists. Note: WindowTable gets setup in dix_main by
- * InitRootWindow, and GlobalScrInfo is screenInfo which gets setup
- * by InitOutput.
- */
extern
void PanoramiXConsolidate(void)
{
- int i,j,k,v,d,n, thisMaxDepth;
- int depthIndex;
- DepthPtr pDepth, pLargeDepth;
- VisualPtr pVisual;
- VisualID it;
- register WindowPtr pWin, pLargeWin;
- Bool SameDepth;
-
- PanoramiXLargestScreenDepth.numDepths = (screenInfo.screens[PanoramiXNumScreens -1])->numDepths;
- PanoramiXLargestScreenDepth.screenNum = PanoramiXNumScreens - 1;
- SameDepth = TRUE;
- for (i = 0; i < 2; i++)
- {
- for (j =0; j < 6; j++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].numDepths=0;
- for (n = 0; n < 6; n++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].listDepths[n]=0;
+ int i, j, k;
+ VisualPtr pVisual, pVisual2;
+ ScreenPtr pScreen, pScreen2;
+ PanoramiXRes *root, *defmap;
+
+ if(!PanoramiXVisualTable)
+ PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID));
+
+ pScreen = screenInfo.screens[0];
+ pVisual = pScreen->visuals;
+
+ PanoramiXNumDepths = 0;
+ PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec));
+ PanoramiXNumVisuals = 0;
+ PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec));
+
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = pVisual->vid;
+
+ /* check if the visual exists on all screens */
+ for (j = 1; j < PanoramiXNumScreens; j++) {
+ pScreen2 = screenInfo.screens[j];
+ pVisual2 = pScreen2->visuals;
+
+ for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) {
+ if ((pVisual->class == pVisual2->class) &&
+ (pVisual->ColormapEntries == pVisual2->ColormapEntries) &&
+ (pVisual->nplanes == pVisual2->nplanes) &&
+ (pVisual->redMask == pVisual2->redMask) &&
+ (pVisual->greenMask == pVisual2->greenMask) &&
+ (pVisual->blueMask == pVisual2->blueMask) &&
+ (pVisual->offsetRed == pVisual2->offsetRed) &&
+ (pVisual->offsetGreen == pVisual2->offsetGreen) &&
+ (pVisual->offsetBlue == pVisual2->offsetBlue))
+ {
+ Bool AlreadyUsed = FALSE;
+#if 0
+/* Open GL should do this reduction, not us */
+ for (l = 0; l < 256; l++) {
+ if (pVisual2->vid ==
+ PanoramiXVisualTable[(l * MAXSCREENS) + j])
+ {
+ AlreadyUsed = TRUE;
+ break;
+ }
+ }
+#endif
+ if (!AlreadyUsed) {
+ PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] =
+ pVisual2->vid;
+ break;
+ }
+ }
+ }
}
- for (k = 0; k < 33; k++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].vmap[k].numVids=0;
- for (v = 0; v < 10; v++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].vmap[k].vid[v]=0;
+
+ /* if it doesn't exist on all screens we can't use it */
+ for (j = 0; j < PanoramiXNumScreens; j++) {
+ if (!PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j]) {
+ PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = 0;
+ break;
}
}
- }
- }
- for (i = PanoramiXNumScreens - 1; i >= 0; i--)
- {
- PanoramiXWinRoot->info[i].id = WindowTable[i]->drawable.id;
- PanoramiXCmapRoot->info[i].id = (screenInfo.screens[i])->defColormap;
-
- /* Create a Color-Depth-Table, this will help us deal
- with mixing graphics boards and visuals, of course
- given that the boards support multi-screen to begin
- with. Fill the panoramiXCDT table by screen, then
- visual type and allowable depths.
- */
- pWin = WindowTable[i];
- if ( (screenInfo.screens[i])->numDepths >
- PanoramiXLargestScreenDepth.numDepths )
- {
- PanoramiXLargestScreenDepth.numDepths = (screenInfo.screens[i])->numDepths;
- PanoramiXLargestScreenDepth.screenNum = i;
- SameDepth = FALSE;
- }
- for (v = 0, pVisual = pWin->drawable.pScreen->visuals;
- v < pWin->drawable.pScreen->numVisuals; v++, pVisual++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[pVisual->class].numDepths = (screenInfo.screens[i])->numDepths;
- for ( j = 0; j < (screenInfo.screens[i])->numDepths; j++)
- {
- pDepth = (DepthPtr) &pWin->drawable.pScreen->allowedDepths[j];
- PanoramiXColorDepthTable[i].panoramiXScreenMap[pVisual->class].listDepths[j] = pDepth->depth;
- for (d = 0; d < pDepth->numVids; d++)
- {
- if (pVisual->vid == pDepth->vids[d])
- {
- PanoramiXColorDepthTable[i].
- panoramiXScreenMap[pVisual->class].vmap[pDepth->depth].
- vid[
- PanoramiXColorDepthTable[i].
- panoramiXScreenMap[pVisual->class].
- vmap[pDepth->depth].numVids++
- ]
- = pDepth->vids[d];
- }
- }
- }
- }
- PanoramiXColorDepthTable[i].numVisuals = 6;
- } /* for each screen */
- /* Fill in ColorDepthTable for mixed visuals with varying depth.
- Can't do that until we figure out how to handle mixed visuals
- and varying card visual/depth initialization. If we can decide
- how to map the relationship, then we can use this table to
- shove the information into and use for cross-referencing when
- necessary.
-
- In the meantime, check to see if the screens are the same,
- if they don't then disable panoramiX, print out a message,
- don't support this mode.
- */
-}
-/* Since locate_neighbors is recursive, a quick simple example
- is in order.This mostly so you can see what the initial values are.
-
- Given 3 screens:
- upperleft screen[0]
- panoramiXdataPtr[0].x = 0
- panoramiXdataPtr[0].y = 0
- panoramiXdataPtr[0].width = 640
- panoramiXdataPtr[0].height = 480
- panoramiXdataPtr[0].below = -1
- panoramiXdataPtr[0].right = 1
- panoramiXdataPtr[0].above = -1
- panoramiXdataPtr[0].left = -1
- middle screen[1]
- panoramiXdataPtr[1].x = 0
- panoramiXdataPtr[1].y = 0
- panoramiXdataPtr[1].width = 640
- panoramiXdataPtr[1].height = 480
- panoramiXdataPtr[1].below = -1
- panoramiXdataPtr[1].right = 2
- panoramiXdataPtr[1].above = -1
- panoramiXdataPtr[1].left = 0
- last right screen[2]
- panoramiXdataPtr[2].x = 0
- panoramiXdataPtr[2].y = 0
- panoramiXdataPtr[2].width = 640
- panoramiXdataPtr[2].height = 480
- panoramiXdataPtr[2].below = -1
- panoramiXdataPtr[2].right = -1
- panoramiXdataPtr[2].above = -1
- panoramiXdataPtr[2].left = 1
-
- Calling locate_neighbors(0) results in:
- panoramiXdataPtr[0].x = 0
- panoramiXdataPtr[0].y = 0
- panoramiXdataPtr[1].x = 640
- panoramiXdataPtr[1].y = 0
- panoramiXdataPtr[2].x = 1280
- panoramiXdataPtr[2].y = 0
-*/
-
-static void locate_neighbors(int i)
-{
- int j;
-
- j = panoramiXdataPtr[i].right;
- if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
- panoramiXdataPtr[j].x = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
- panoramiXdataPtr[j].y = panoramiXdataPtr[i].y;
- locate_neighbors(j);
- }
- j = panoramiXdataPtr[i].below;
- if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
- panoramiXdataPtr[j].y = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
- panoramiXdataPtr[j].x = panoramiXdataPtr[i].x;
- locate_neighbors(j);
+ /* if it does, make sure it's in the list of supported depths and visuals */
+ if(PanoramiXVisualTable[pVisual->vid * MAXSCREENS]) {
+ Bool GotIt = FALSE;
+
+ PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid;
+ PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class;
+ PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue;
+ PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries;
+ PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes;
+ PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue;
+ PanoramiXNumVisuals++;
+
+ for (j = 0; j < PanoramiXNumDepths; j++) {
+ if (PanoramiXDepths[j].depth == pVisual->nplanes) {
+ PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid;
+ PanoramiXDepths[j].numVids++;
+ GotIt = TRUE;
+ break;
+ }
+ }
+
+ if (!GotIt) {
+ PanoramiXDepths[PanoramiXNumDepths].depth = pVisual->nplanes;
+ PanoramiXDepths[PanoramiXNumDepths].numVids = 1;
+ PanoramiXDepths[PanoramiXNumDepths].vids = xalloc(sizeof(VisualID) * 256);
+ PanoramiXDepths[PanoramiXNumDepths].vids[0] = pVisual->vid;
+ PanoramiXNumDepths++;
+ }
+ }
+ }
+
+
+ root = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ root->type = XRT_WINDOW;
+ defmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ defmap->type = XRT_COLORMAP;
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ root->info[i].id = WindowTable[i]->drawable.id;
+ root->u.win.class = InputOutput;
+ defmap->info[i].id = (screenInfo.screens[i])->defColormap;
}
-}
+ AddResource(root->info[0].id, XRT_WINDOW, root);
+ AddResource(defmap->info[0].id, XRT_COLORMAP, defmap);
+}
/*
@@ -597,46 +883,25 @@ static void locate_neighbors(int i)
* Exit, deallocating as needed.
*/
-static void PanoramiXResetProc(extEntry)
- ExtensionEntry* extEntry;
+static void PanoramiXResetProc(ExtensionEntry* extEntry)
{
int i;
- PanoramiXList *pPanoramiXList;
- PanoramiXList *tempList;
- for (pPanoramiXList = PanoramiXPmapRoot; pPanoramiXList; pPanoramiXList = tempList){
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
- for (pPanoramiXList = PanoramiXCmapRoot; pPanoramiXList; pPanoramiXList = tempList){
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
- for (pPanoramiXList = PanoramiXGCRoot; pPanoramiXList; pPanoramiXList = tempList) {
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
- for (pPanoramiXList = PanoramiXWinRoot; pPanoramiXList; pPanoramiXList = tempList) {
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
+#ifdef RENDER
+ PanoramiXRenderReset ();
+#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--; )
ProcVector[i] = SavedProcVector[i];
- Xfree(panoramiXdataPtr);
-
+
+ Xfree(panoramiXdataPtr);
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXQueryVersion (ClientPtr client)
-#else
-ProcPanoramiXQueryVersion (client)
- register ClientPtr client;
-#endif
{
- REQUEST(xPanoramiXQueryVersionReq);
+ /* REQUEST(xPanoramiXQueryVersionReq); */
xPanoramiXQueryVersionReply rep;
register int n;
@@ -649,18 +914,15 @@ ProcPanoramiXQueryVersion (client)
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXGetState(ClientPtr client)
-#else
-ProcPanoramiXGetState(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
@@ -686,12 +948,7 @@ ProcPanoramiXGetState(client)
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXGetScreenCount(ClientPtr client)
-#else
-ProcPanoramiXGetScreenCount(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
@@ -716,12 +973,7 @@ ProcPanoramiXGetScreenCount(client)
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXGetScreenSize(ClientPtr client)
-#else
-ProcPanoramiXGetScreenSize(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
@@ -741,29 +993,84 @@ ProcPanoramiXGetScreenSize(client)
if (client->swapped) {
swaps (&rep.sequenceNumber, n);
swapl (&rep.length, n);
- swaps (rep.width, n);
- swaps (rep.height, n);
+ swaps (&rep.width, n);
+ swaps (&rep.height, n);
}
WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep);
return client->noClientException;
}
-void PrintList(PanoramiXList *head)
+int
+ProcXineramaIsActive(ClientPtr client)
+{
+ /* REQUEST(xXineramaIsActiveReq); */
+ xXineramaIsActiveReply rep;
+
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !noPanoramiXExtension;
+ if (client->swapped) {
+ register int n;
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.state, n);
+ }
+ WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ return client->noClientException;
+}
+
+
+int
+ProcXineramaQueryScreens(ClientPtr client)
{
- int i = 0;
+ /* REQUEST(xXineramaQueryScreensReq); */
+ xXineramaQueryScreensReply rep;
+
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
+ rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ if (client->swapped) {
+ register int n;
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.number, n);
+ }
+ WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
- for (; head; i++, head = head->next)
- fprintf(stderr, "%2d next = 0x%010lx, id[0] = 0x%08x, id[1] = 0x%08x\n",
- i, head->next, head->info[0].id, head->info[1].id);
+ if(!noPanoramiXExtension) {
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ scratch.x_org = panoramiXdataPtr[i].x;
+ scratch.y_org = panoramiXdataPtr[i].y;
+ scratch.width = panoramiXdataPtr[i].width;
+ scratch.height = panoramiXdataPtr[i].height;
+
+ if(client->swapped) {
+ register int n;
+ swaps (&scratch.x_org, n);
+ swaps (&scratch.y_org, n);
+ swaps (&scratch.width, n);
+ swaps (&scratch.height, n);
+ }
+ WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
+ }
+
+ return client->noClientException;
}
+
+
static int
-#if NeedFunctionPrototypes
ProcPanoramiXDispatch (ClientPtr client)
-#else
-ProcPanoramiXDispatch (client)
- ClientPtr client;
-#endif
{ REQUEST(xReq);
switch (stuff->data)
{
@@ -775,6 +1082,184 @@ ProcPanoramiXDispatch (client)
return ProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return ProcPanoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return ProcXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return ProcXineramaQueryScreens(client);
}
return BadRequest;
}
+
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+#define SHIFT_L(v,s) (v) << (s)
+#define SHIFT_R(v,s) (v) >> (s)
+#else
+#define SHIFT_L(v,s) (v) >> (s)
+#define SHIFT_R(v,s) (v) << (s)
+#endif
+
+static void
+CopyBits(char *dst, int shiftL, char *src, int bytes)
+{
+ /* Just get it to work. Worry about speed later */
+ int shiftR = 8 - shiftL;
+
+ while(bytes--) {
+ *dst |= SHIFT_L(*src, shiftL);
+ *(dst + 1) |= SHIFT_R(*src, shiftR);
+ dst++; src++;
+ }
+}
+
+
+/* Caution. This doesn't support 2 and 4 bpp formats. We expect
+ 1 bpp and planar data to be already cleared when presented
+ to this function */
+
+void
+XineramaGetImageData(
+ DrawablePtr *pDrawables,
+ int left,
+ int top,
+ int width,
+ int height,
+ unsigned int format,
+ unsigned long planemask,
+ char *data,
+ int pitch,
+ Bool isRoot
+){
+ RegionRec SrcRegion, GrabRegion;
+ BoxRec SrcBox, *pbox;
+ int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
+ DrawablePtr pDraw = pDrawables[0];
+ char *ScratchMem = NULL;
+
+ size = 0;
+
+ /* find box in logical screen space */
+ SrcBox.x1 = left;
+ SrcBox.y1 = top;
+ if(!isRoot) {
+ SrcBox.x1 += pDraw->x + panoramiXdataPtr[0].x;
+ SrcBox.y1 += pDraw->y + panoramiXdataPtr[0].y;
+ }
+ SrcBox.x2 = SrcBox.x1 + width;
+ SrcBox.y2 = SrcBox.y1 + height;
+
+ REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1);
+ REGION_INIT(pScreen, &GrabRegion, NullBox, 1);
+
+ depth = (format == XYPixmap) ? 1 : pDraw->depth;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ pDraw = pDrawables[i];
+
+ inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox);
+
+ if(inOut == rgnIN) {
+ (*pDraw->pScreen->GetImage)(pDraw,
+ SrcBox.x1 - pDraw->x - panoramiXdataPtr[i].x,
+ SrcBox.y1 - pDraw->y - panoramiXdataPtr[i].y,
+ width, height, format, planemask, data);
+ break;
+ } else if (inOut == rgnOUT)
+ continue;
+
+ REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion,
+ &XineramaScreenRegions[i]);
+
+ nbox = REGION_NUM_RECTS(&GrabRegion);
+
+ if(nbox) {
+ pbox = REGION_RECTS(&GrabRegion);
+
+ while(nbox--) {
+ w = pbox->x2 - pbox->x1;
+ h = pbox->y2 - pbox->y1;
+ ScratchPitch = PixmapBytePad(w, depth);
+ sizeNeeded = ScratchPitch * h;
+
+ if(sizeNeeded > size) {
+ char *tmpdata = ScratchMem;
+ ScratchMem = xrealloc(ScratchMem, sizeNeeded);
+ if(ScratchMem)
+ size = sizeNeeded;
+ else {
+ ScratchMem = tmpdata;
+ break;
+ }
+ }
+
+ x = pbox->x1 - pDraw->x - panoramiXdataPtr[i].x;
+ y = pbox->y1 - pDraw->y - panoramiXdataPtr[i].y;
+
+ (*pDraw->pScreen->GetImage)(pDraw, x, y, w, h,
+ format, planemask, ScratchMem);
+
+ /* copy the memory over */
+
+ if(depth == 1) {
+ int k, shift, leftover, index, index2;
+
+ x = pbox->x1 - SrcBox.x1;
+ y = pbox->y1 - SrcBox.y1;
+ shift = x & 7;
+ x >>= 3;
+ leftover = w & 7;
+ w >>= 3;
+
+ /* clean up the edge */
+ if(leftover) {
+ int mask = (1 << leftover) - 1;
+ for(j = h, k = w; j--; k += ScratchPitch)
+ ScratchMem[k] &= mask;
+ }
+
+ for(j = 0, index = (pitch * y) + x, index2 = 0; j < h;
+ j++, index += pitch, index2 += ScratchPitch)
+ {
+ if(w) {
+ if(!shift)
+ memcpy(data + index, ScratchMem + index2, w);
+ else
+ CopyBits(data + index, shift,
+ ScratchMem + index2, w);
+ }
+
+ if(leftover) {
+ data[index + w] |=
+ SHIFT_L(ScratchMem[index2 + w], shift);
+ if((shift + leftover) > 8)
+ data[index + w + 1] |=
+ SHIFT_R(ScratchMem[index2 + w],(8 - shift));
+ }
+ }
+ } else {
+ j = BitsPerPixel(depth) >> 3;
+ x = (pbox->x1 - SrcBox.x1) * j;
+ y = pbox->y1 - SrcBox.y1;
+ w *= j;
+
+ for(j = 0; j < h; j++) {
+ memcpy(data + (pitch * (y + j)) + x,
+ ScratchMem + (ScratchPitch * j), w);
+ }
+ }
+ pbox++;
+ }
+
+ REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion);
+ if(!REGION_NOTEMPTY(pScreen, &SrcRegion))
+ break;
+ }
+
+ }
+
+ if(ScratchMem)
+ xfree(ScratchMem);
+
+ REGION_UNINIT(pScreen, &SrcRegion);
+ REGION_UNINIT(pScreen, &GrabRegion);
+}
diff --git a/Xext/panoramiXSwap.c b/Xext/panoramiXSwap.c
index c6bb5071e..e78624187 100644
--- a/Xext/panoramiXSwap.c
+++ b/Xext/panoramiXSwap.c
@@ -23,6 +23,7 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.8 2001/08/23 13:01:36 alanh Exp $ */
#include <stdio.h>
#include "X.h"
@@ -44,20 +45,16 @@ Equipment Corporation.
#endif
#include "panoramiX.h"
#include "panoramiXproto.h"
+#include "panoramiXsrv.h"
+#include "globals.h"
/*
-/*
* External references for data variables
*/
-extern Bool noPanoramiXExtension;
-extern Bool PanoramiXVisibilityNotifySent;
-extern WindowPtr *WindowTable;
-extern int defaultBackingStore;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
-extern int (* ProcVector[256]) ();
#if NeedFunctionPrototypes
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
@@ -68,50 +65,38 @@ extern int (* ProcVector[256]) ();
PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount);
-PROC_EXTERN(PropPanoramiXGetScreenSize);
+PROC_EXTERN(ProcPanoramiXGetScreenSize);
+
+PROC_EXTERN(ProcXineramaIsActive);
+PROC_EXTERN(ProcXineramaQueryScreens);
static int
-#if NeedFunctionPrototypes
SProcPanoramiXQueryVersion (ClientPtr client)
-#else
-SProcPanoramiXQueryVersion (client)
- register ClientPtr client;
-#endif
{
- register int n;
- REQUEST(xPanoramiXQueryVersionReq);
+ REQUEST(xPanoramiXQueryVersionReq);
+ register int n;
- swaps(&stuff->length,n);
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
- return ProcPanoramiXQueryVersion(client);
+ swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return ProcPanoramiXQueryVersion(client);
}
static int
-#if NeedFunctionPrototypes
SProcPanoramiXGetState(ClientPtr client)
-#else
-SProcPanoramiXGetState(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetStateReq);
- register int n;
+ register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
-
+ return ProcPanoramiXGetState(client);
}
static int
-#if NeedFunctionPrototypes
SProcPanoramiXGetScreenCount(ClientPtr client)
-#else
-SProcPanoramixGetScreenCount(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenCountReq);
- register int n;
+ register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
@@ -119,29 +104,43 @@ SProcPanoramixGetScreenCount(client)
}
static int
-#if NeedFunctionPrototypes
SProcPanoramiXGetScreenSize(ClientPtr client)
-#else
-SProcPanoramiXGetScreenSize(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenSizeReq);
- WindowPtr pWin;
- register int n;
+ register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
return ProcPanoramiXGetScreenSize(client);
}
+
+static int
+SProcXineramaIsActive(ClientPtr client)
+{
+ REQUEST(xXineramaIsActiveReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcXineramaIsActive(client);
+}
+
+
+static int
+SProcXineramaQueryScreens(ClientPtr client)
+{
+ REQUEST(xXineramaQueryScreensReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcXineramaQueryScreens(client);
+}
+
+
int
-#if NeedFunctionPrototypes
SProcPanoramiXDispatch (ClientPtr client)
-#else
-SProcPanoramiXDispatch (client)
- ClientPtr client;
-#endif
{ REQUEST(xReq);
switch (stuff->data)
{
@@ -153,6 +152,10 @@ SProcPanoramiXDispatch (client)
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
- return BadRequest;
+ case X_XineramaIsActive:
+ return SProcXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcXineramaQueryScreens(client);
}
+ return BadRequest;
}
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index cd54bdcb3..37b54f4bc 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -24,6 +24,10 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
+
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.33 2002/04/10 21:38:53 mvojkovi Exp $ */
+
#include <stdio.h>
#include "X.h"
#define NEED_REPLIES
@@ -40,757 +44,485 @@ Equipment Corporation.
#include "misc.h"
#include "dixstruct.h"
#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#include "resource.h"
+
+#define XINERAMA_IMAGE_BUFSIZE (256*1024)
+#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
+ CWDontPropagate | CWOverrideRedirect | CWCursor )
-extern Bool noPanoramiXExtension;
-extern Bool PanoramiXVisibilityNotifySent;
-extern Bool PanoramiXMapped;
-extern int PanoramiXNumScreens;
-extern int PanoramiXPixWidth;
-extern int PanoramiXPixHeight;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXGC *PanoramiXGCRoot;
-extern PanoramiXCmap *PanoramiXCmapRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
-extern PanoramiXData *panoramiXdataPtr;
-extern PanoramiXCDT PanoramiXColorDepthTable[MAXSCREENS];
extern ScreenInfo *GlobalScrInfo;
-extern int (* SavedProcVector[256])();
-extern void (* ReplySwapVector[256])();
-extern WindowPtr *WindowTable;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
-extern XID clientErrorValue;
-
-extern void Swap32Write();
-
-extern long defaultScreenSaverTime;
-extern long defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultScreenSaverAllowExposures;
-static ClientPtr onlyClient;
-static Bool grabbingClient = FALSE;
-#ifdef __alpha /* THIS NEEDS TO BE LONG !!!! Change driver! */
-int *checkForInput[2];
-#else
-long *checkForInput[2];
-#endif
-extern int connBlockScreenStart;
-
-extern int (* InitialVector[3]) ();
-extern int (* ProcVector[256]) ();
-extern int (* SwappedProcVector[256]) ();
+extern int (* SavedProcVector[256]) ();
extern void (* EventSwapVector[128]) ();
-extern void (* ReplySwapVector[256]) ();
extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(),
WriteSConnectionInfo();
extern void WriteSConnSetupPrefix();
-extern char *ClientAuthorized();
-extern Bool InsertFakeRequest();
-static void KillAllClients();
-static void DeleteClientFromAnySelections();
-extern void ProcessWorkQueue();
-
-
-static int nextFreeClientID; /* always MIN free client ID */
-
-static int nClients; /* number active clients */
-
-char isItTimeToYield;
/* Various of the DIX function interfaces were not designed to allow
* the client->errorValue to be set on BadValue and other errors.
* Rather than changing interfaces and breaking untold code we introduce
* a new global that dispatch can use.
*/
-XID clientErrorValue; /* XXX this is a kludge */
-
-
-#define SAME_SCREENS(a, b) (\
- (a.pScreen == b.pScreen))
+extern XID clientErrorValue; /* XXX this is a kludge */
-
-
-extern int Ones();
-
-int PanoramiXCreateWindow(register ClientPtr client)
+int PanoramiXCreateWindow(ClientPtr client)
{
- register WindowPtr pParent, pWin;
+ PanoramiXRes *parent, *newWin;
+ PanoramiXRes *backPix = NULL;
+ PanoramiXRes *bordPix = NULL;
+ PanoramiXRes *cmap = NULL;
REQUEST(xCreateWindowReq);
- int result, j = 0;
- unsigned len;
- Bool FoundIt = FALSE;
- Window winID;
- Window parID;
- PanoramiXWindow *localWin;
- PanoramiXWindow *parentWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXCmap *pPanoramiXCmap = NULL;
- PanoramiXPmap *pBackgndPmap = NULL;
- PanoramiXPmap *pBorderPmap = NULL;
- VisualID orig_visual;
- XID orig_wid;
- int orig_x, orig_y;
- register Mask orig_mask;
- int cmap_offset = 0;
- int pback_offset = 0;
- int pbord_offset = 0;
- int class_index, this_class_index;
- int vid_index, this_vid_index;
+ int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
+ int result = 0, len, j;
+ int orig_x, orig_y;
+ XID orig_visual, tmp;
+ Bool parentIsRoot;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
- IF_RETURN((Ones((Mask)stuff->mask) != len), BadLength);
- orig_mask = stuff->mask;
- PANORAMIXFIND_ID(parentWin, stuff->parent);
- if (parentWin) {
- localWin = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
- IF_RETURN(!localWin, BadAlloc);
- } else {
- return BadWindow;
- }
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWBackPixmap)) {
- XID pmapID;
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if (!(parent = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if(stuff->class == CopyFromParent)
+ stuff->class = parent->u.win.class;
+
+ if((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
+ if ((Mask)stuff->mask & CWBackPixmap) {
pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pback_offset);
- if (pmapID) {
- pBackgndPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBackgndPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWBorderPixmap)) {
- XID pmapID;
-
+ if ((Mask)stuff->mask & CWBorderPixmap) {
pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pbord_offset);
- if (pmapID) {
- pBorderPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBorderPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWColormap)) {
- Colormap cmapID;
-
+ if ((Mask)stuff->mask & CWColormap) {
cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
- cmapID = *((CARD32 *) &stuff[1] + cmap_offset);
- if (cmapID) {
- pPanoramiXCmap = PanoramiXCmapRoot;
- PANORAMIXFIND_ID(pPanoramiXCmap, cmapID);
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
}
}
+
+ if(!(newWin = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newWin->type = XRT_WINDOW;
+ newWin->u.win.visibility = VisibilityNotViewable;
+ newWin->u.win.class = stuff->class;
+ newWin->info[0].id = stuff->wid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newWin->info[j].id = FakeClientID(client->index);
+
+ if (stuff->class == InputOnly)
+ stuff->visual = CopyFromParent;
+ orig_visual = stuff->visual;
orig_x = stuff->x;
orig_y = stuff->y;
- orig_wid = stuff->wid;
- orig_visual = stuff->visual;
- for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
- winID = j ? FakeClientID(client->index) : orig_wid;
- localWin->info[j].id = winID;
- }
- localWin->FreeMe = FALSE;
- localWin->visibility = VisibilityNotViewable;
- localWin->VisibilitySent = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXWin, PanoramiXWinRoot);
- pPanoramiXWin->next = localWin;
- if ( (stuff->visual != CopyFromParent) && (stuff->depth != 0))
- {
- /* Find the correct visual for this screen */
- for (class_index = 0; class_index < PanoramiXColorDepthTable[0].numVisuals;
-class_index++)
- {
- for (vid_index = 0; vid_index < PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[stuff->depth].numVids; vid_index++)
- {
- if ( stuff->visual == PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[stuff->depth].vid[vid_index] )
- {
- this_class_index = class_index;
- this_vid_index = vid_index;
- FoundIt = TRUE;
- break;
- }
- }
- }
- }
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (parentWin == PanoramiXWinRoot) {
+ parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id);
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->wid = newWin->info[j].id;
+ stuff->parent = parent->info[j].id;
+ if (parentIsRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
}
- stuff->wid = localWin->info[j].id;
- parID = (XID)(parentWin->info[j].id);
- pParent = (WindowPtr)SecurityLookupWindow(parID, client,SecurityReadAccess);
- IF_RETURN((!pParent),BadWindow);
- stuff->parent = parID;
- if ( (orig_visual != CopyFromParent) && (stuff->depth != 0) && FoundIt )
- {
- stuff->visual = PanoramiXColorDepthTable[j].panoramiXScreenMap[this_class_index].vmap[stuff->depth].vid[this_vid_index];
- }
- if (pBackgndPmap)
- *((CARD32 *) &stuff[1] + pback_offset) = pBackgndPmap->info[j].id;
- if (pBorderPmap)
- *((CARD32 *) &stuff[1] + pbord_offset) = pBorderPmap->info[j].id;
- if (pPanoramiXCmap)
- *((CARD32 *) &stuff[1] + cmap_offset) = pPanoramiXCmap->info[j].id;
- stuff->mask = orig_mask;
- result = (*SavedProcVector[X_CreateWindow])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXWin->next = NULL;
- if (localWin)
- Xfree(localWin);
- }
+ if (backPix)
+ *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
+ if (bordPix)
+ *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id;
+ if (cmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
+ if ( orig_visual != CopyFromParent )
+ stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j];
+ result = (*SavedProcVector[X_CreateWindow])(client);
+ if(result != Success) break;
+ }
+
+ if (result == Success)
+ AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
+ else
+ xfree(newWin);
+
return (result);
}
-
-int PanoramiXChangeWindowAttributes(register ClientPtr client)
+int PanoramiXChangeWindowAttributes(ClientPtr client)
{
- register WindowPtr pWin;
+ PanoramiXRes *win;
+ PanoramiXRes *backPix = NULL;
+ PanoramiXRes *bordPix = NULL;
+ PanoramiXRes *cmap = NULL;
REQUEST(xChangeWindowAttributesReq);
- register int result;
- int len;
- int j;
- Window winID;
- Mask orig_valueMask;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWinback = NULL;
- PanoramiXCmap *pPanoramiXCmap = NULL;
- PanoramiXPmap *pBackgndPmap = NULL;
- PanoramiXPmap *pBorderPmap = NULL;
- int cmap_offset = 0;
- int pback_offset = 0;
- int pbord_offset = 0;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
+ int result = 0, len, j;
+ XID tmp;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
+
len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
- IF_RETURN((len != Ones((Mask) stuff->valueMask)), BadLength);
- orig_valueMask = stuff->valueMask;
- winID = stuff->window;
- for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->window);
- pPanoramiXWin = pPanoramiXWin->next)
- pPanoramiXWinback = pPanoramiXWin;
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, winID);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWBackPixmap)) {
- XID pmapID;
+ if (Ones(stuff->valueMask) != len)
+ return BadLength;
+ if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if((win->u.win.class == InputOnly) &&
+ (stuff->valueMask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
+
+ if ((Mask)stuff->valueMask & CWBackPixmap) {
pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pback_offset);
- if (pmapID) {
- pBackgndPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBackgndPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWBorderPixmap)) {
- XID pmapID;
-
+ if ((Mask)stuff->valueMask & CWBorderPixmap) {
pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pbord_offset);
- if (pmapID) {
- pBorderPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBorderPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWColormap )) {
- Colormap cmapID;
-
+ if ((Mask)stuff->valueMask & CWColormap) {
cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1));
- cmapID = *((CARD32 *) &stuff[1] + cmap_offset);
- if (cmapID) {
- pPanoramiXCmap = PanoramiXCmapRoot;
- PANORAMIXFIND_ID(pPanoramiXCmap, cmapID);
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
}
}
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- stuff->valueMask = orig_valueMask;
- if (pBackgndPmap)
- *((CARD32 *) &stuff[1] + pback_offset) = pBackgndPmap->info[j].id;
- if (pBorderPmap)
- *((CARD32 *) &stuff[1] + pbord_offset) = pBorderPmap->info[j].id;
- if (pPanoramiXCmap)
- *((CARD32 *) &stuff[1] + cmap_offset) = pPanoramiXCmap->info[j].id;
- result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
- BREAK_IF(result != Success);
- }
- if ((result == Success) && pPanoramiXWinback &&
- pPanoramiXWin && pPanoramiXWin->FreeMe) {
- pPanoramiXWinback->next = pPanoramiXWin->next;
- Xfree(pPanoramiXWin);
- }
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ if (backPix)
+ *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
+ if (bordPix)
+ *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id;
+ if (cmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
+ result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
+ }
+
return (result);
}
int PanoramiXDestroyWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWinback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->id);
- pPanoramiXWin = pPanoramiXWin->next)
- pPanoramiXWinback = pPanoramiXWin;
- IF_RETURN(!pPanoramiXWin,BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->id = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_DestroyWindow])(client);
- BREAK_IF(result != Success);
- }
- if ((result == Success) && pPanoramiXWinback &&
- pPanoramiXWin && pPanoramiXWin->FreeMe) {
- pPanoramiXWinback->next = pPanoramiXWin->next;
- Xfree(pPanoramiXWin);
- }
- PANORAMIX_FREE(client);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_DestroyWindow])(client);
+ if(result != Success) break;
+ }
+
+ /* Since ProcDestroyWindow is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
return (result);
}
int PanoramiXDestroySubwindows(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWinback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->id);
- pPanoramiXWin = pPanoramiXWin->next)
- pPanoramiXWinback = pPanoramiXWin;
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->id = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_DestroySubwindows])(client);
- }
- if ((result == Success) && pPanoramiXWinback &&
- pPanoramiXWin && pPanoramiXWin->FreeMe) {
- pPanoramiXWinback->next = pPanoramiXWin->next;
- Xfree(pPanoramiXWin);
- }
- PANORAMIX_FREE(client);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_DestroySubwindows])(client);
+ if(result != Success) break;
+ }
+
+ /* DestroySubwindows is using FreeResource which will free
+ our resources for us on the last pass through the loop above */
+
return (result);
}
int PanoramiXChangeSaveSet(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xChangeSaveSetReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
- if (!stuff->window)
- result = (* SavedProcVector[X_ChangeSaveSet])(client);
- else {
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_ChangeSaveSet])(client);
- }
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ result = (*SavedProcVector[X_ChangeSaveSet])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXReparentWindow(register ClientPtr client)
+int PanoramiXReparentWindow(ClientPtr client)
{
- register WindowPtr pWin, pParent;
+ PanoramiXRes *win, *parent;
+ int result = 0, j;
+ int x, y;
+ Bool parentIsRoot;
REQUEST(xReparentWindowReq);
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXPar = PanoramiXWinRoot;
REQUEST_SIZE_MATCH(xReparentWindowReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PANORAMIXFIND_ID(pPanoramiXPar, stuff->parent);
- IF_RETURN(!pPanoramiXPar, BadWindow);
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXPar), j) {
- stuff->window = pPanoramiXWin->info[j].id;
- stuff->parent = pPanoramiXPar->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if(!(parent = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ x = stuff->x;
+ y = stuff->y;
+ parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id);
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ stuff->parent = parent->info[j].id;
+ if(parentIsRoot) {
+ stuff->x = x - panoramiXdataPtr[j].x;
+ stuff->y = y - panoramiXdataPtr[j].y;
+ }
result = (*SavedProcVector[X_ReparentWindow])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXMapWindow(register ClientPtr client)
+int PanoramiXMapWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
- Window winID;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility */
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
-SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- winID = pPanoramiXWin->info[j].id;
- pWin = (WindowPtr) SecurityLookupWindow(winID,
-client,SecurityReadAccess);
- IF_RETURN((!pWin), BadWindow);
- stuff->id = winID;
- result = (*SavedProcVector[X_MapWindow])(client);
- }
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_MapWindow])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXMapSubwindows(register ClientPtr client)
+int PanoramiXMapSubwindows(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility values */
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
-
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- stuff->id = pPanoramiXWin->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
result = (*SavedProcVector[X_MapSubwindows])(client);
+ if(result != Success) break;
}
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- PANORAMIX_FREE(client);
+
return (result);
}
-int PanoramiXUnmapWindow(register ClientPtr client)
+int PanoramiXUnmapWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility values */
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
-
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- stuff->id = pPanoramiXWin->info[j].id;
- result = (*SavedProcVector[X_UnmapWindow])(client);
- }
-
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- PANORAMIX_FREE(client);
- return (client->noClientException);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_UnmapWindow])(client);
+ if(result != Success) break;
+ }
+
+ return (result);
}
-int PanoramiXUnmapSubwindows(register ClientPtr client)
+int PanoramiXUnmapSubwindows(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility values */
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
-
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- stuff->id = pPanoramiXWin->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
result = (*SavedProcVector[X_UnmapSubwindows])(client);
+ if(result != Success) break;
}
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- PANORAMIX_FREE(client);
- return (client->noClientException);
+ return (result);
}
-int PanoramiXConfigureWindow(register ClientPtr client)
+int PanoramiXConfigureWindow(ClientPtr client)
{
- register WindowPtr pWin;
+ PanoramiXRes *win;
+ PanoramiXRes *sib = NULL;
+ WindowPtr pWin;
+ int result = 0, j, len, sib_offset = 0, x = 0, y = 0;
+ int x_offset = -1;
+ int y_offset = -1;
REQUEST(xConfigureWindowReq);
- register int result;
- unsigned len, i, things;
- XID changes[32];
- register Mask orig_mask;
- int j, sib_position;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXSib = NULL;
- int x_off = 0, y_off = 0;
- XID *pStuff;
- XID *origStuff, *modStuff;
- Mask local_mask;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
+
len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
- things = Ones((Mask)stuff->mask);
- IF_RETURN((things != len), BadLength);
- orig_mask = stuff->mask;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- if (!pPanoramiXWin) {
- client->errorValue = stuff->window;
- return (BadWindow);
- }
- if (things > 0) {
- pStuff = (XID *) ALLOCATE_LOCAL(things * sizeof(XID));
- memcpy((char *) pStuff, (char *) &stuff[1], things * sizeof(XID));
- local_mask = (CWSibling | CWX | CWY) & ((Mask) stuff->mask);
- if (local_mask & CWSibling) {
- sib_position = Ones((Mask) stuff->mask & (CWSibling - 1));
- pPanoramiXSib = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXSib, *(pStuff + sib_position));
- }
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- winID = pPanoramiXWin->info[j].id;
- pWin = (WindowPtr)SecurityLookupWindow(winID, client,SecurityReadAccess);
- if (!pWin) {
- client->errorValue = pPanoramiXWin->info[0].id;
- return (BadWindow);
- }
- stuff->window = winID;
- if (pWin->parent
- && (pWin->parent->drawable.id == PanoramiXWinRoot->info[j].id)) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- modStuff = (XID *) &stuff[1];
- origStuff = pStuff;
- i = things;
- if (local_mask & CWX) {
- *modStuff++ = *origStuff++ - x_off;
- i--;
- }
- if (local_mask & CWY) {
- *modStuff++ = *origStuff++ - y_off;
- i--;
- }
- for ( ; i; i--)
- *modStuff++ = *origStuff++;
- if (pPanoramiXSib)
- *((XID *) &stuff[1] + sib_position) = pPanoramiXSib->info[j].id;
- stuff->mask = orig_mask;
- result = (*SavedProcVector[X_ConfigureWindow])(client);
- }
- DEALLOCATE_LOCAL(pStuff);
- PANORAMIX_FREE(client);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ /* because we need the parent */
+ if (!(pWin = (WindowPtr)SecurityLookupIDByType(
+ client, stuff->window, RT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if ((Mask)stuff->mask & CWSibling) {
+ XID tmp;
+ sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
+ if(!(sib = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+ }
+ }
+
+ if(pWin->parent && (pWin->parent == WindowTable[0])) {
+ if ((Mask)stuff->mask & CWX) {
+ x_offset = 0;
+ x = *((CARD32 *)&stuff[1]);
+ }
+ if ((Mask)stuff->mask & CWY) {
+ y_offset = (x_offset == -1) ? 0 : 1;
+ y = *((CARD32 *) &stuff[1] + y_offset);
+ }
+ }
+
+ /* have to go forward or you get expose events before
+ ConfigureNotify events */
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
+ if(sib)
+ *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id;
+ if(x_offset >= 0)
+ *((CARD32 *) &stuff[1] + x_offset) = x - panoramiXdataPtr[j].x;
+ if(y_offset >= 0)
+ *((CARD32 *) &stuff[1] + y_offset) = y - panoramiXdataPtr[j].y;
+ result = (*SavedProcVector[X_ConfigureWindow])(client);
+ if(result != Success) break;
+ }
+
return (result);
- } else
- return (client->noClientException);
}
-int PanoramiXCirculateWindow(register ClientPtr client)
+int PanoramiXCirculateWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xCirculateWindowReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xCirculateWindowReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
result = (*SavedProcVector[X_CirculateWindow])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXGetGeometry(register ClientPtr client)
+int PanoramiXGetGeometry(ClientPtr client)
{
xGetGeometryReply rep;
- register DrawablePtr pDraw;
+ DrawablePtr pDraw;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -798,1883 +530,1489 @@ int PanoramiXGetGeometry(register ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep.root = WindowTable[0]->drawable.id;
rep.depth = pDraw->depth;
+ rep.width = pDraw->width;
+ rep.height = pDraw->height;
+ rep.x = rep.y = rep.borderWidth = 0;
- if (stuff->id == PanoramiXWinRoot->info[0].id) {
- xConnSetup *setup = (xConnSetup *) ConnectionInfo;
+ if (stuff->id == rep.root) {
xWindowRoot *root = (xWindowRoot *)
(ConnectionInfo + connBlockScreenStart);
rep.width = root->pixWidth;
rep.height = root->pixHeight;
- } else {
- rep.width = pDraw->width;
- rep.height = pDraw->height;
- }
-
- /* XXX - Because the pixmap-implementation of the multibuffer extension
- * may have the buffer-id's drawable resource value be a pointer
- * to the buffer's window instead of the buffer itself
- * (this happens if the buffer is the displayed buffer),
- * we also have to check that the id matches before we can
- * truly say that it is a DRAWABLE_WINDOW.
- */
-
- if ((pDraw->type == UNDRAWABLE_WINDOW) ||
- ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) {
- register WindowPtr pWin = (WindowPtr)pDraw;
+ } else
+ if ((pDraw->type == UNDRAWABLE_WINDOW) || (pDraw->type == DRAWABLE_WINDOW))
+ {
+ WindowPtr pWin = (WindowPtr)pDraw;
rep.x = pWin->origin.x - wBorderWidth (pWin);
rep.y = pWin->origin.y - wBorderWidth (pWin);
+ if(pWin->parent == WindowTable[0]) {
+ rep.x += panoramiXdataPtr[0].x;
+ rep.y += panoramiXdataPtr[0].y;
+ }
rep.borderWidth = pWin->borderWidth;
- } else { /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */
- rep.x = rep.y = rep.borderWidth = 0;
}
+
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
return (client->noClientException);
}
+int PanoramiXTranslateCoords(ClientPtr client)
+{
+ INT16 x, y;
+ REQUEST(xTranslateCoordsReq);
-int PanoramiXChangeProperty(ClientPtr client)
-{
- int result, j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- REQUEST(xChangePropertyReq);
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
- REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_ChangeProperty])(client);
- if (result != Success) {
- stuff->window = pPanoramiXWin->info[0].id;
- break;
- }
- }
- return (result);
-}
-
-
-int PanoramiXDeleteProperty(ClientPtr client)
-{
- int result, j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- REQUEST(xDeletePropertyReq);
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
- REQUEST_SIZE_MATCH(xDeletePropertyReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_DeleteProperty])(client);
- BREAK_IF(result != Success);
- }
- PANORAMIX_FREE(client);
- return (result);
-}
+ register WindowPtr pWin, pDst;
+ xTranslateCoordsReply rep;
+ REQUEST_SIZE_MATCH(xTranslateCoordsReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client,
+ SecurityReadAccess);
+ if (!pDst)
+ return(BadWindow);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.sameScreen = xTrue;
+ rep.child = None;
-int PanoramiXSendEvent(ClientPtr client)
-{
- int result, j;
- BYTE orig_type;
- Mask orig_eventMask;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- REQUEST(xSendEventReq);
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
- REQUEST_SIZE_MATCH(xSendEventReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->destination);
- orig_type = stuff->event.u.u.type;
- orig_eventMask = stuff->eventMask;
- if (!pPanoramiXWin) {
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_SendEvent])(client);
- noPanoramiXExtension = FALSE;
+ if(pWin == WindowTable[0]) {
+ x = stuff->srcX - panoramiXdataPtr[0].x;
+ y = stuff->srcY - panoramiXdataPtr[0].y;
+ } else {
+ x = pWin->drawable.x + stuff->srcX;
+ y = pWin->drawable.y + stuff->srcY;
}
- else {
- noPanoramiXExtension = FALSE;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->destination = pPanoramiXWin->info[j].id;
- stuff->eventMask = orig_eventMask;
- stuff->event.u.u.type = orig_type;
- if (!j)
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_SendEvent])(client);
- noPanoramiXExtension = FALSE;
- }
+ pWin = pDst->firstChild;
+ while (pWin) {
+#ifdef SHAPE
+ BoxRec box;
+#endif
+ if ((pWin->mapped) &&
+ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
+ (x < pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth (pWin)) &&
+ (y >= pWin->drawable.y - wBorderWidth (pWin)) &&
+ (y < pWin->drawable.y + (int)pWin->drawable.height +
+ wBorderWidth (pWin))
+#ifdef SHAPE
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ POINT_IN_REGION(pWin->drawable.pScreen,
+ wBoundingShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
+#endif
+ )
+ {
+ rep.child = pWin->drawable.id;
+ pWin = (WindowPtr) NULL;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ rep.dstX = x - pDst->drawable.x;
+ rep.dstY = y - pDst->drawable.y;
+ if(pDst == WindowTable[0]) {
+ rep.dstX += panoramiXdataPtr[0].x;
+ rep.dstY += panoramiXdataPtr[0].y;
}
- return (result);
-}
+ WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
+ return(client->noClientException);
+}
-int PanoramiXCreatePixmap(register ClientPtr client)
+int PanoramiXCreatePixmap(ClientPtr client)
{
- PixmapPtr pMap;
- register DrawablePtr pDraw;
+ PanoramiXRes *refDraw, *newPix;
+ int result = 0, j;
REQUEST(xCreatePixmapReq);
- DepthPtr pDepth;
- int result, j;
- Pixmap pmapID;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXPmap *pPanoramiXPmap;
- PanoramiXPmap *localPmap;
- XID orig_pid;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
- localPmap =(PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
- IF_RETURN(!localPmap, BadAlloc);
-
- pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!pDraw, BadDrawable);
-
- pPanoramiXWin = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadWindow);
-
- orig_pid = stuff->pid;
- FOR_NSCREENS_OR_ONCE(pPanoramiXPmap, j) {
- pmapID = j ? FakeClientID(client->index) : orig_pid;
- localPmap->info[j].id = pmapID;
- }
- localPmap->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
- pPanoramiXPmap->next = localPmap;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->pid = localPmap->info[j].id;
- stuff->drawable = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_CreatePixmap])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXPmap->next = NULL;
- if (localPmap)
- Xfree(localPmap);
+ if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
+
+ if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newPix->type = XRT_PIXMAP;
+ newPix->u.pix.shared = FALSE;
+ newPix->info[0].id = stuff->pid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newPix->info[j].id = FakeClientID(client->index);
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->pid = newPix->info[j].id;
+ stuff->drawable = refDraw->info[j].id;
+ result = (*SavedProcVector[X_CreatePixmap])(client);
+ if(result != Success) break;
}
+
+ if (result == Success)
+ AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
+ else
+ xfree(newPix);
+
return (result);
}
int PanoramiXFreePixmap(ClientPtr client)
{
- PixmapPtr pMap;
- int result, j;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- PanoramiXPmap *pPanoramiXPmapback = NULL;
+ PanoramiXRes *pix;
+ int result = 0, j;
REQUEST(xResourceReq);
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXPmap && (pPanoramiXPmap->info[0].id != stuff->id);
- pPanoramiXPmap = pPanoramiXPmap->next)
- pPanoramiXPmapback = pPanoramiXPmap;
- if (!pPanoramiXPmap)
- result = (* SavedProcVector[X_FreePixmap])(client);
- else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->id = pPanoramiXPmap->info[j].id;
- result = (* SavedProcVector[X_FreePixmap])(client);
- }
- if ((result == Success) && pPanoramiXPmapback &&
- pPanoramiXPmap && pPanoramiXPmap->FreeMe ) {
- pPanoramiXPmapback->next = pPanoramiXPmap->next;
- Xfree(pPanoramiXPmap);
- }
+
+ client->errorValue = stuff->id;
+
+ if(!(pix = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_PIXMAP, SecurityDestroyAccess)))
+ return BadPixmap;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = pix->info[j].id;
+ result = (*SavedProcVector[X_FreePixmap])(client);
+ if(result != Success) break;
}
+
+ /* Since ProcFreePixmap is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
return (result);
}
-int PanoramiXCreateGC(register ClientPtr client)
+int PanoramiXCreateGC(ClientPtr client)
{
- int result, j;
- GC *pGC;
- DrawablePtr pDraw;
- unsigned len, i;
+ PanoramiXRes *refDraw;
+ PanoramiXRes *newGC;
+ PanoramiXRes *stip = NULL;
+ PanoramiXRes *tile = NULL;
+ PanoramiXRes *clip = NULL;
REQUEST(xCreateGCReq);
- GContext GCID;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *localGC;
- PanoramiXGC *pPanoramiXGC;
- PanoramiXPmap *pPanoramiXTile = NULL, *pPanoramiXStip = NULL;
- PanoramiXPmap *pPanoramiXClip = NULL;
- int tile_offset, stip_offset, clip_offset;
- XID orig_GC;
+ int tile_offset = 0, stip_offset = 0, clip_offset = 0;
+ int result = 0, len, j;
+ XID tmp;
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
+
client->errorValue = stuff->gc;
- pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!pDraw, BadDrawable);
- pPanoramiXWin = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
-
- len = client->req_len - (sizeof(xCreateGCReq) >> 2);
- IF_RETURN((len != Ones((Mask)stuff->mask)), BadLength);
- localGC = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
- IF_RETURN(!localGC, BadAlloc);
- orig_GC = stuff->gc;
- if ((Mask)stuff->mask & GCTile) {
- XID tileID;
+ len = client->req_len - (sizeof(xCreateGCReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
+ if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
- tileID = *((CARD32 *) &stuff[1] + tile_offset);
- if (tileID) {
- pPanoramiXTile = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXTile, tileID);
+ if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
+ if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCStipple) {
- XID stipID;
-
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
- stipID = *((CARD32 *) &stuff[1] + stip_offset);
- if (stipID) {
- pPanoramiXStip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXStip, stipID);
+ if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
+ if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCClipMask) {
- XID clipID;
-
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
- clipID = *((CARD32 *) &stuff[1] + clip_offset);
- if (clipID) {
- pPanoramiXClip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXClip, clipID);
+ if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
+ if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- GCID = j ? FakeClientID(client->index) : orig_GC;
- localGC->info[j].id = GCID;
- }
- localGC->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXGC, PanoramiXGCRoot);
- pPanoramiXGC->next = localGC;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->gc = localGC->info[j].id;
- stuff->drawable = pPanoramiXWin->info[j].id;
- if (pPanoramiXTile)
- *((CARD32 *) &stuff[1] + tile_offset) = pPanoramiXTile->info[j].id;
- if (pPanoramiXStip)
- *((CARD32 *) &stuff[1] + stip_offset) = pPanoramiXStip->info[j].id;
- if (pPanoramiXClip)
- *((CARD32 *) &stuff[1] + clip_offset) = pPanoramiXClip->info[j].id;
- result = (* SavedProcVector[X_CreateGC])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXGC->next = NULL;
- Xfree(localGC);
+
+ if(!(newGC = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newGC->type = XRT_GC;
+ newGC->info[0].id = stuff->gc;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newGC->info[j].id = FakeClientID(client->index);
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = newGC->info[j].id;
+ stuff->drawable = refDraw->info[j].id;
+ if (tile)
+ *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id;
+ if (stip)
+ *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id;
+ if (clip)
+ *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id;
+ result = (*SavedProcVector[X_CreateGC])(client);
+ if(result != Success) break;
}
+
+ if (result == Success)
+ AddResource(newGC->info[0].id, XRT_GC, newGC);
+ else
+ xfree(newGC);
+
return (result);
}
-
int PanoramiXChangeGC(ClientPtr client)
{
- GC *pGC;
+ PanoramiXRes *gc;
+ PanoramiXRes *stip = NULL;
+ PanoramiXRes *tile = NULL;
+ PanoramiXRes *clip = NULL;
REQUEST(xChangeGCReq);
- int result, j;
- unsigned len;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- PanoramiXPmap *pPanoramiXTile = NULL, *pPanoramiXStip = NULL;
- PanoramiXPmap *pPanoramiXClip = NULL;
- int tile_offset, stip_offset, clip_offset;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ int tile_offset = 0, stip_offset = 0, clip_offset = 0;
+ int result = 0, len, j;
+ XID tmp;
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
- VERIFY_GC(pGC, stuff->gc, client);
- len = client->req_len - (sizeof(xChangeGCReq) >> 2);
- IF_RETURN((len != Ones((Mask)stuff->mask)), BadLength);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- if ((Mask)stuff->mask & GCTile) {
- XID tileID;
+
+ len = client->req_len - (sizeof(xChangeGCReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if (!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
- tile_offset = Ones((Mask)stuff->mask & (GCTile -1) );
- tileID = *((CARD32 *) &stuff[1] + tile_offset);
- if (tileID) {
- pPanoramiXTile = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXTile, tileID);
+ if ((Mask)stuff->mask & GCTile) {
+ tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
+ if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCStipple) {
- XID stipID;
-
- stip_offset = Ones((Mask)stuff->mask & (GCStipple -1 ));
- stipID = *((CARD32 *) &stuff[1] + stip_offset);
- if (stipID) {
- pPanoramiXStip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXStip, stipID);
+ stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
+ if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCClipMask) {
- XID clipID;
-
- clip_offset = Ones((Mask)stuff->mask & (GCClipMask -1));
- clipID = *((CARD32 *) &stuff[1] + clip_offset);
- if (clipID) {
- pPanoramiXClip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXClip, clipID);
+ clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
+ if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXTile)
- *((CARD32 *) &stuff[1] + tile_offset) = pPanoramiXTile->info[j].id;
- if (pPanoramiXStip)
- *((CARD32 *) &stuff[1] + stip_offset) = pPanoramiXStip->info[j].id;
- if (pPanoramiXClip)
- *((CARD32 *) &stuff[1] + clip_offset) = pPanoramiXClip->info[j].id;
- result = (* SavedProcVector[X_ChangeGC])(client);
- BREAK_IF(result != Success);
- }
- PANORAMIX_FREE(client);
+
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ if (tile)
+ *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id;
+ if (stip)
+ *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id;
+ if (clip)
+ *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id;
+ result = (*SavedProcVector[X_ChangeGC])(client);
+ if(result != Success) break;
+ }
+
return (result);
}
int PanoramiXCopyGC(ClientPtr client)
{
- int j, result;
- PanoramiXGC *pPanoramiXGCSrc = PanoramiXGCRoot;
- PanoramiXGC *pPanoramiXGCDst = PanoramiXGCRoot;
+ PanoramiXRes *srcGC, *dstGC;
+ int result = 0, j;
REQUEST(xCopyGCReq);
REQUEST_SIZE_MATCH(xCopyGCReq);
- PANORAMIXFIND_ID(pPanoramiXGCSrc, stuff->srcGC);
- IF_RETURN(!pPanoramiXGCSrc, BadGC);
- PANORAMIXFIND_ID(pPanoramiXGCDst, stuff->dstGC);
- IF_RETURN(!pPanoramiXGCDst, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGCDst, j) {
- stuff->srcGC = pPanoramiXGCSrc->info[j].id;
- stuff->dstGC = pPanoramiXGCDst->info[j].id;
- result = (* SavedProcVector[X_CopyGC])(client);
- BREAK_IF(result != Success);
+
+ if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->srcGC, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dstGC, XRT_GC, SecurityWriteAccess)))
+ return BadGC;
+
+ FOR_NSCREENS(j) {
+ stuff->srcGC = srcGC->info[j].id;
+ stuff->dstGC = dstGC->info[j].id;
+ result = (*SavedProcVector[X_CopyGC])(client);
+ if(result != Success) break;
}
+
return (result);
}
int PanoramiXSetDashes(ClientPtr client)
{
- GC *pGC;
+ PanoramiXRes *gc;
+ int result = 0, j;
REQUEST(xSetDashesReq);
- int result, j;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
- VERIFY_GC(pGC, stuff->gc, client);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_SetDashes])(client);
- BREAK_IF(result != Success);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityWriteAccess)))
+ return BadGC;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_SetDashes])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXSetClipRectangles(register ClientPtr client)
+int PanoramiXSetClipRectangles(ClientPtr client)
{
- int result;
- register GC *pGC;
+ PanoramiXRes *gc;
+ int result = 0, j;
REQUEST(xSetClipRectanglesReq);
- int j;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_SetClipRectangles])(client);
- BREAK_IF(result != Success);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityWriteAccess)))
+ return BadGC;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_SetClipRectangles])(client);
+ if(result != Success) break;
}
+
return (result);
}
int PanoramiXFreeGC(ClientPtr client)
{
- register GC *pGC;
+ PanoramiXRes *gc;
+ int result = 0, j;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- PanoramiXGC *pPanoramiXGCback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXGC && (pPanoramiXGC->info[0].id != stuff->id);
- pPanoramiXGC = pPanoramiXGC->next)
- pPanoramiXGCback = pPanoramiXGC;
- IF_RETURN(!pPanoramiXGC, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->id = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_FreeGC])(client);
- BREAK_IF(result != Success);
- }
- if ((result == Success) && pPanoramiXGCback &&
- pPanoramiXGC && pPanoramiXGC->FreeMe) {
- pPanoramiXGCback->next = pPanoramiXGC->next;
- if (pPanoramiXGC)
- Xfree(pPanoramiXGC);
- }
- PANORAMIX_FREE(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_GC, SecurityDestroyAccess)))
+ return BadGC;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = gc->info[j].id;
+ result = (*SavedProcVector[X_FreeGC])(client);
+ if(result != Success) break;
+ }
+
+ /* Since ProcFreeGC is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
return (result);
}
-int PanoramiXClearToBackground(register ClientPtr client)
+int PanoramiXClearToBackground(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j, x, y;
+ Bool isRoot;
REQUEST(xClearAreaReq);
- register WindowPtr pWin;
- int result, j;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- int orig_x, orig_y;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xClearAreaReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- orig_x = stuff->x;
- orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- winID = pPanoramiXWin->info[j].id;
- pWin = (WindowPtr) SecurityLookupWindow(winID, client, SecurityReadAccess);
- if (!pWin) {
- client->errorValue = pPanoramiXWin->info[0].id;
- return (BadWindow);
- }
- stuff->window = winID;
- if (pWin->drawable.id == PanoramiXWinRoot->info[j].id) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ x = stuff->x;
+ y = stuff->y;
+ isRoot = (stuff->window == WindowTable[0]->drawable.id);
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ if(isRoot) {
+ stuff->x = x - panoramiXdataPtr[j].x;
+ stuff->y = y - panoramiXdataPtr[j].y;
}
result = (*SavedProcVector[X_ClearArea])(client);
+ if(result != Success) break;
}
- PANORAMIX_FREE(client);
+
return (result);
}
+/*
+ For Window to Pixmap copies you're screwed since each screen's
+ pixmap will look like what it sees on its screen. Unless the
+ screens overlap and the window lies on each, the two copies
+ will be out of sync. To remedy this we do a GetImage and PutImage
+ in place of the copy. Doing this as a single Image isn't quite
+ correct since it will include the obscured areas but we will
+ have to fix this later. (MArk).
+*/
+
int PanoramiXCopyArea(ClientPtr client)
{
- int j, result;
- Window srcID, dstID;
- DrawablePtr pSrc, pDst;
- GContext GCID;
- GC *pGC;
- PanoramiXWindow *pPanoramiXSrcRoot;
- PanoramiXWindow *pPanoramiXDstRoot;
- PanoramiXWindow *pPanoramiXSrc;
- PanoramiXWindow *pPanoramiXDst;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ int j, result = 0, srcx, srcy, dstx, dsty;
+ PanoramiXRes *gc, *src, *dst;
+ Bool srcIsRoot = FALSE;
+ Bool dstIsRoot = FALSE;
+ Bool srcShared, dstShared;
REQUEST(xCopyAreaReq);
- int srcx = stuff->srcX, srcy = stuff->srcY;
- int dstx = stuff->dstX, dsty = stuff->dstY;
REQUEST_SIZE_MATCH(xCopyAreaReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
- if (stuff->dstDrawable != stuff->srcDrawable) {
- VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client);
- if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
- client->errorValue = stuff->dstDrawable;
- return (BadMatch);
- }
+ if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
+
+ srcShared = IS_SHARED_PIXMAP(src);
+
+ if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ dstShared = IS_SHARED_PIXMAP(dst);
+
+ if(dstShared && srcShared)
+ return (* SavedProcVector[X_CopyArea])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ if((dst->type == XRT_WINDOW) &&
+ (stuff->dstDrawable == WindowTable[0]->drawable.id))
+ dstIsRoot = TRUE;
+ if((src->type == XRT_WINDOW) &&
+ (stuff->srcDrawable == WindowTable[0]->drawable.id))
+ srcIsRoot = TRUE;
+
+ srcx = stuff->srcX; srcy = stuff->srcY;
+ dstx = stuff->dstX; dsty = stuff->dstY;
+ if((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDst;
+ GCPtr pGC;
+ char *data;
+ int pitch;
+
+ FOR_NSCREENS(j)
+ VERIFY_DRAWABLE(drawables[j], src->info[j].id, client);
+
+ pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
+ if(!(data = xcalloc(1, stuff->height * pitch)))
+ return BadAlloc;
+
+ XineramaGetImageData(drawables, srcx, srcy,
+ stuff->width, stuff->height, ZPixmap, ~0, data, pitch,
+ srcIsRoot);
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client);
+
+ if(drawables[0]->depth != pDst->depth) {
+ client->errorValue = stuff->dstDrawable;
+ xfree(data);
+ return (BadMatch);
+ }
+
+ (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
+ stuff->width, stuff->height,
+ 0, ZPixmap, data);
+
+ if(dstShared) break;
+ }
+
+ xfree(data);
+
+ result = Success;
} else {
- pSrc = pDst;
- }
- pPanoramiXSrcRoot = (pSrc->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXDstRoot = (pDst->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXSrc = pPanoramiXSrcRoot;
- pPanoramiXDst = pPanoramiXDstRoot;
- PANORAMIXFIND_ID(pPanoramiXSrc, stuff->srcDrawable);
- IF_RETURN(!pPanoramiXSrc, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXDst, stuff->dstDrawable);
- IF_RETURN(!pPanoramiXDst, BadDrawable);
- GCID = stuff->gc;
- PANORAMIXFIND_ID(pPanoramiXGC, GCID);
- IF_RETURN(!pPanoramiXGC, BadGC);
-
- FOR_NSCREENS_OR_ONCE(pPanoramiXSrc, j) {
- stuff->dstDrawable = pPanoramiXDst->info[j].id;
- stuff->srcDrawable = pPanoramiXSrc->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXSrc == pPanoramiXSrcRoot) {
- stuff->srcX = srcx - panoramiXdataPtr[j].x;
- stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ DrawablePtr pDst = NULL, pSrc = NULL;
+ GCPtr pGC = NULL;
+ RegionPtr pRgn[MAXSCREENS];
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->dstDrawable = dst->info[j].id;
+ stuff->srcDrawable = src->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (srcIsRoot) {
+ stuff->srcX = srcx - panoramiXdataPtr[j].x;
+ stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ }
+ if (dstIsRoot) {
+ stuff->dstX = dstx - panoramiXdataPtr[j].x;
+ stuff->dstY = dsty - panoramiXdataPtr[j].y;
+ }
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
+ SecurityReadAccess);
+ if ((pDst->pScreen != pSrc->pScreen) ||
+ (pDst->depth != pSrc->depth)) {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
+ }
+ } else
+ pSrc = pDst;
+
+ pRgn[j] = (*pGC->ops->CopyArea)(pSrc, pDst, pGC,
+ stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY);
+
+ if(dstShared) {
+ while(j--) pRgn[j] = NULL;
+ break;
+ }
}
- if (pPanoramiXDst == pPanoramiXDstRoot) {
- stuff->dstX = dstx - panoramiXdataPtr[j].x;
- stuff->dstY = dsty - panoramiXdataPtr[j].y;
+
+ if(pGC->graphicsExposures) {
+ ScreenPtr pScreen = pDst->pScreen;
+ RegionRec totalReg;
+ Bool overlap;
+
+ REGION_INIT(pScreen, &totalReg, NullBox, 1);
+ FOR_NSCREENS_BACKWARD(j) {
+ if(pRgn[j]) {
+ if(srcIsRoot) {
+ REGION_TRANSLATE(pScreen, pRgn[j],
+ panoramiXdataPtr[j].x, panoramiXdataPtr[j].y);
+ }
+ REGION_APPEND(pScreen, &totalReg, pRgn[j]);
+ REGION_DESTROY(pScreen, pRgn[j]);
+ }
+ }
+ REGION_VALIDATE(pScreen, &totalReg, &overlap);
+ (*pScreen->SendGraphicsExpose)(
+ client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
+ REGION_UNINIT(pScreen, &totalReg);
}
- result = (* SavedProcVector[X_CopyArea])(client);
- BREAK_IF(result != Success);
+
+ result = client->noClientException;
}
+
return (result);
}
+
int PanoramiXCopyPlane(ClientPtr client)
{
- int SrcScr = -1, DstScr = -1;
- PixmapPtr pMap = NULL;
- Pixmap pmapID;
- PanoramiXRect SrcRect, DstRect;
- int i, j, k;
- Window srcID, dstID;
- DrawablePtr pSrc, pDst;
- GContext GCID;
- GContext GCIDbase;
- GC *pGC;
- PanoramiXWindow *pPanoramiXSrc;
- PanoramiXWindow *pPanoramiXDst;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- RegionPtr *PanoramiXRgnPtrs;
- RegionPtr *FetchRgnPtrs = NULL;
- RegionPtr pRgn;
+ int j, srcx, srcy, dstx, dsty;
+ PanoramiXRes *gc, *src, *dst;
+ Bool srcIsRoot = FALSE;
+ Bool dstIsRoot = FALSE;
+ Bool srcShared, dstShared;
+ DrawablePtr psrcDraw, pdstDraw = NULL;
+ GCPtr pGC = NULL;
+ RegionPtr pRgn[MAXSCREENS];
REQUEST(xCopyPlaneReq);
- int srcx = stuff->srcX, srcy = stuff->srcY;
- int dstx = stuff->dstX, dsty = stuff->dstY;
- int width = stuff->width, height = stuff->height;
REQUEST_SIZE_MATCH(xCopyPlaneReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
- if (stuff->dstDrawable != stuff->srcDrawable) {
- VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client);
- if (pDst->pScreen != pSrc->pScreen) {
- client->errorValue = stuff->dstDrawable;
- return (BadMatch);
- }
- } else {
- pSrc = pDst;
- }
+ if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
- /*
- * Check to see if stuff->bitPlane has exactly ONE good bit set
- */
+ srcShared = IS_SHARED_PIXMAP(src);
+ if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
- if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
- (stuff->bitPlane > (1L << (pSrc->depth - 1))))
- {
- client->errorValue = stuff->bitPlane;
- return(BadValue);
- }
-
- pPanoramiXSrc = (pSrc->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXDst = (pDst->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXSrc, stuff->srcDrawable);
- IF_RETURN(!pPanoramiXSrc, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXDst, stuff->dstDrawable);
- IF_RETURN(!pPanoramiXDst, BadDrawable);
- GCIDbase = stuff->gc;
- PANORAMIXFIND_ID(pPanoramiXGC, GCIDbase);
- IF_RETURN(!pPanoramiXGC, BadGC);
-
- /*
- * Unless both are pixmaps, need to do special things to accomodate
- * being on multiple screens, different screens, etc.
- */
-
- if (pSrc->type != DRAWABLE_PIXMAP) {
- SrcRect.x = pSrc->x + srcx;
- SrcRect.y = pSrc->y + srcy;
- SrcRect.width = width;
- SrcRect.height = height;
- for (SrcScr = PanoramiXNumScreens - 1; SrcScr>=0; SrcScr-- )
- if (RECTA_SUBSUMES_RECTB(panoramiXdataPtr[SrcScr], SrcRect))
- break;
- }
- if (pDst->type != DRAWABLE_PIXMAP) {
- DstRect.x = pDst->x + dstx;
- DstRect.y = pDst->y + dsty;
- DstRect.width = width;
- DstRect.height = height;
- for (DstScr = PanoramiXNumScreens - 1; DstScr>=0; DstScr--)
- if (RECTA_SUBSUMES_RECTB(panoramiXdataPtr[DstScr], DstRect))
- break;
- }
-
- /*
- * If source is on multiple screens, different screen from destination,
- * destination is on multiple screens, or destination is a pixmap,
- * need to get info into local pixmap for subsequent transfer.
- */
-
-
- if ((pSrc->type != DRAWABLE_PIXMAP) &&
- (SrcScr < 0 || DstScr < 0 || SrcScr != DstScr
- || pDst->type == DRAWABLE_PIXMAP)) {
- unsigned char save_alu;
- RegionRec tempReg;
- RegionPtr pCompositeClip;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
-
- pMap = (PixmapPtr) (*pSrc->pScreen->CreatePixmap)(pSrc->pScreen,
- width, height, pGC->depth);
- PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
- pPanoramiXPmap->next =
- (PanoramiXPmap *)Xcalloc(sizeof(PanoramiXPmap));
- pPanoramiXPmap = pPanoramiXPmap->next;
- pmapID = FakeClientID(0);
- AddResource(pmapID, RT_PIXMAP, (pointer)pMap);
- for (j = PanoramiXNumScreens - 1; j>=0; j--)
- pPanoramiXPmap->info[j].id = pmapID;
- tempReg.extents.x1 = 0;
- tempReg.extents.y1 = 0;
- tempReg.extents.x2 = width;
- tempReg.extents.y2 = height;
- tempReg.data = NULL;
- FetchRgnPtrs =
- (RegionPtr *) ALLOCATE_LOCAL(PanoramiXNumScreens * sizeof(RegionPtr));
- i = 0;
- FOR_NSCREENS_OR_ONCE(pPanoramiXSrc, j) {
- if ((SrcScr >= 0) && pPanoramiXSrc)
- j = SrcScr;
- srcID = pPanoramiXSrc->info[j].id;
- pSrc = (DrawablePtr) SecurityLookupIDByClass(client, srcID, RC_DRAWABLE,
- SecurityReadAccess);
- GCID = pPanoramiXGC->info[j].id;
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- pMap->drawable.pScreen = pSrc->pScreen;
- pGC->pScreen = pSrc->pScreen;
- save_alu = pGC->alu;
- pGC->alu = GXcopy;
- pCompositeClip = ((miPrivGC*)
- (pGC->devPrivates[miGCPrivateIndex].ptr))->pCompositeClip;
- ((miPrivGC*)(pGC->devPrivates[miGCPrivateIndex].ptr))->pCompositeClip =
-&tempReg;
- FetchRgnPtrs[i++] = (*pGC->ops->CopyPlane)(pSrc, (DrawablePtr) pMap,
- pGC, srcx, srcy, width, height, 0, 0, stuff->bitPlane);
- pGC->alu = save_alu;
- ((miPrivGC*) (pGC->devPrivates[miGCPrivateIndex].ptr))->pCompositeClip =
-pCompositeClip;
- if (SrcScr >= 0)
- j = 0;
- }
- }
+ dstShared = IS_SHARED_PIXMAP(dst);
- if (pMap) {
- pSrc = (DrawablePtr) pMap;
- srcx = 0;
- srcy = 0;
- }
- PanoramiXRgnPtrs =
- (RegionPtr *) ALLOCATE_LOCAL(PanoramiXNumScreens * sizeof(RegionPtr));
- k = 0;
- /* if src and dst are entirely on one screen,
- then we only need one simple transfer */
- if ((DstScr >= 0) && (pMap || (SrcScr >=0))) {
- dstID = pPanoramiXDst->info[DstScr].id;
- pDst = (DrawablePtr) SecurityLookupIDByClass(client, dstID, RC_DRAWABLE,
- SecurityReadAccess);
- GCID = pPanoramiXGC->info[DstScr].id;
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- ValidateGC(pDst, pGC);
- if (pMap) {
- pMap->drawable.pScreen = pDst->pScreen;
- } else {
- srcID = pPanoramiXSrc->info[SrcScr].id;
- if (srcID != dstID) {
- pSrc = (DrawablePtr) SecurityLookupIDByClass(client, srcID, RC_DRAWABLE,
- SecurityReadAccess);
- } else
- pSrc = pDst;
+ if(dstShared && srcShared)
+ return (* SavedProcVector[X_CopyPlane])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ if((dst->type == XRT_WINDOW) &&
+ (stuff->dstDrawable == WindowTable[0]->drawable.id))
+ dstIsRoot = TRUE;
+ if((src->type == XRT_WINDOW) &&
+ (stuff->srcDrawable == WindowTable[0]->drawable.id))
+ srcIsRoot = TRUE;
+
+ srcx = stuff->srcX; srcy = stuff->srcY;
+ dstx = stuff->dstX; dsty = stuff->dstY;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->dstDrawable = dst->info[j].id;
+ stuff->srcDrawable = src->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (srcIsRoot) {
+ stuff->srcX = srcx - panoramiXdataPtr[j].x;
+ stuff->srcY = srcy - panoramiXdataPtr[j].y;
}
- if (pMap)
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- 1);
- else
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- stuff->bitPlane);
- }else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXDst, j) {
- if (DstScr >= 0) {
- dstID = pPanoramiXDst->info[DstScr].id;
- GCID = pPanoramiXGC->info[DstScr].id;
- } else {
- dstID = pPanoramiXDst->info[j].id;
- GCID = pPanoramiXGC->info[j].id;
+ if (dstIsRoot) {
+ stuff->dstX = dstx - panoramiXdataPtr[j].x;
+ stuff->dstY = dsty - panoramiXdataPtr[j].y;
}
- pDst = (DrawablePtr) SecurityLookupIDByClass(client, dstID, RC_DRAWABLE,
- SecurityReadAccess);
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- ValidateGC(pDst, pGC);
- if (pMap) {
- pMap->drawable.pScreen = pDst->pScreen;
- } else {
- srcID = pPanoramiXSrc->info[j].id;
- if (srcID != dstID) {
- pSrc = (DrawablePtr) SecurityLookupIDByClass(client, srcID, RC_DRAWABLE,
- SecurityReadAccess);
- } else {
- pSrc = pDst;
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
+ SecurityReadAccess);
+ if (pdstDraw->pScreen != psrcDraw->pScreen) {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
}
+ } else
+ psrcDraw = pdstDraw;
+
+ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
+ (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
+ client->errorValue = stuff->bitPlane;
+ return(BadValue);
}
- if (pMap)
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- 1);
- else
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- stuff->bitPlane);
- }
- }
-
- if (pMap) {
- for (j = PanoramiXNumScreens - 1; j>=0; j--)
- if (PanoramiXRgnPtrs[j])
- (*pDst->pScreen->RegionDestroy) (PanoramiXRgnPtrs[j]);
- DEALLOCATE_LOCAL(PanoramiXRgnPtrs);
- PanoramiXRgnPtrs = FetchRgnPtrs;
- k = i;
- }
- j = 1;
- i = 0;
- pRgn = PanoramiXRgnPtrs[i];
- while ((j < k) && pRgn && !REGION_NIL(pRgn)) {
- if (PanoramiXRgnPtrs[j]) {
- (*pGC->pScreen->Intersect)(pRgn, pRgn, PanoramiXRgnPtrs[j++]);
- } else {
- pRgn = PanoramiXRgnPtrs[i++];
+
+ pRgn[j] = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC,
+ stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY, stuff->bitPlane);
+
+ if(dstShared) {
+ while(j--) pRgn[j] = NULL;
+ break;
}
}
- for (j = 0 ; j < k; j++) {
- pRgn = PanoramiXRgnPtrs[j];
- GCID = pPanoramiXGC->info[j].id;
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- if (pGC && pGC->graphicsExposures)
- (*pDst->pScreen->SendGraphicsExpose) (client, pRgn,
- stuff->dstDrawable, X_CopyPlane, 0);
- if (pRgn)
- (*pDst->pScreen->RegionDestroy) (pRgn);
- }
- DEALLOCATE_LOCAL(PanoramiXRgnPtrs);
- if (pMap) {
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- PanoramiXPmap *pback = PanoramiXPmapRoot;
-
- for (; pPanoramiXPmap && (pPanoramiXPmap->info[0].id != pmapID);
- pPanoramiXPmap = pPanoramiXPmap->next)
- pback = pPanoramiXPmap;
- FreeResource(pPanoramiXPmap->info[0].id, RT_NONE);
- if (pback) {
- pback->next = pPanoramiXPmap->next;
- Xfree(pPanoramiXPmap);
+
+ if(pGC->graphicsExposures) {
+ ScreenPtr pScreen = pdstDraw->pScreen;
+ RegionRec totalReg;
+ Bool overlap;
+
+ REGION_INIT(pScreen, &totalReg, NullBox, 1);
+ FOR_NSCREENS_BACKWARD(j) {
+ if(pRgn[j]) {
+ REGION_APPEND(pScreen, &totalReg, pRgn[j]);
+ REGION_DESTROY(pScreen, pRgn[j]);
+ }
}
+ REGION_VALIDATE(pScreen, &totalReg, &overlap);
+ (*pScreen->SendGraphicsExpose)(
+ client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
+ REGION_UNINIT(pScreen, &totalReg);
}
+
return (client->noClientException);
}
int PanoramiXPolyPoint(ClientPtr client)
{
- int result, npoint, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ PanoramiXRes *gc, *draw;
+ int result = 0, npoint, j;
xPoint *origPts;
- xPoint *origPtr, *modPtr;
+ Bool isRoot;
REQUEST(xPolyPointReq);
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, locDraw->id);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyPoint])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint > 0) {
origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xPoint *) &stuff[1];
- origPtr = origPts;
- for (i = npoint; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyPoint])(client);
- BREAK_IF(result != Success);
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xPoint *pnts = (xPoint*)&stuff[1];
+ int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
+
+ while(i--) {
+ pnts->x -= x_off;
+ pnts->y -= y_off;
+ pnts++;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyPoint])(client);
+ if(result != Success) break;
}
DEALLOCATE_LOCAL(origPts);
return (result);
- }else
+ } else
return (client->noClientException);
-
}
int PanoramiXPolyLine(ClientPtr client)
{
- int result, npoint, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ PanoramiXRes *gc, *draw;
+ int result = 0, npoint, j;
xPoint *origPts;
- xPoint *origPtr, *modPtr;
+ Bool isRoot;
REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, locDraw->id);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != locDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyLine])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 0){
origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xPoint *) &stuff[1];
- origPtr = origPts;
- for (i = npoint; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyLine])(client);
- BREAK_IF(result != Success);
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xPoint *pnts = (xPoint*)&stuff[1];
+ int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
+
+ while(i--) {
+ pnts->x -= x_off;
+ pnts->y -= y_off;
+ pnts++;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyLine])(client);
+ if(result != Success) break;
}
DEALLOCATE_LOCAL(origPts);
return (result);
- }else
+ } else
return (client->noClientException);
}
int PanoramiXPolySegment(ClientPtr client)
{
- int result, nsegs, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ int result = 0, nsegs, i, j;
+ PanoramiXRes *gc, *draw;
xSegment *origSegs;
- xSegment *origPtr, *modPtr;
+ Bool isRoot;
REQUEST(xPolySegmentReq);
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != locDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolySegment])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
- IF_RETURN((nsegs & 4), BadLength);
+ if(nsegs & 4) return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
- origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
- memcpy((char *) origSegs, (char *) &stuff[1], nsegs *
-sizeof(xSegment));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xSegment *) &stuff[1];
- origPtr = origSegs;
- for (i = nsegs; i; i--) {
- modPtr->x1 = origPtr->x1 - x_off;
- modPtr->y1 = origPtr->y1 - y_off;
- modPtr->x2 = origPtr->x2 - x_off;
- modPtr++->y2 = origPtr++->y2 - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolySegment])(client);
- BREAK_IF(result != Success);
+ origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
+ memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xSegment *segs = (xSegment*)&stuff[1];
+
+ for (i = nsegs; i--; segs++) {
+ segs->x1 -= x_off;
+ segs->x2 -= x_off;
+ segs->y1 -= y_off;
+ segs->y2 -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolySegment])(client);
+ if(result != Success) break;
}
- DEALLOCATE_LOCAL(origSegs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origSegs);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyRectangle(ClientPtr client)
{
- int result, nrects, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ int result = 0, nrects, i, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
xRectangle *origRecs;
- xRectangle *origPtr, *modPtr;
REQUEST(xPolyRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyRectangle])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
- IF_RETURN((nrects & 4), BadLength);
+ if(nrects & 4) return BadLength;
nrects >>= 3;
if (nrects > 0){
- origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
- memcpy((char *) origRecs, (char *) &stuff[1], nrects *
-sizeof(xRectangle));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xRectangle *) &stuff[1];
- origPtr = origRecs;
- for (i = nrects; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr->y = origPtr->y - y_off;
- modPtr->width = origPtr->width - x_off;
- modPtr++->height = origPtr++->height - y_off;
+ origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+ memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+
+ if(x_off || y_off) {
+ xRectangle *rects = (xRectangle *) &stuff[1];
+
+ for (i = nrects; i--; rects++) {
+ rects->x -= x_off;
+ rects->y -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyRectangle])(client);
+ if(result != Success) break;
}
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyRectangle])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origRecs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origRecs);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyArc(ClientPtr client)
{
- int result, narcs, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
+ int result = 0, narcs, i, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
xArc *origArcs;
- xArc *origPtr, *modPtr;
REQUEST(xPolyArcReq);
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot :
-PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyArc])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
- IF_RETURN((narcs % sizeof(xArc)), BadLength);
+ if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0){
- origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
- memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xArc *) &stuff[1];
- origPtr = origArcs;
- for (i = narcs; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
+ origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xArc *arcs = (xArc *) &stuff[1];
+
+ for (i = narcs; i--; arcs++) {
+ arcs->x -= x_off;
+ arcs->y -= y_off;
+ }
+ }
+ }
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyArc])(client);
+ if(result != Success) break;
}
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyArc])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origArcs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origArcs);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXFillPoly(ClientPtr client)
{
- int result, count, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
+ int result = 0, count, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
DDXPointPtr locPts;
- DDXPointPtr origPts, modPts;
REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_FillPoly])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (count > 0){
- locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
- memcpy((char *) locPts, (char *) &stuff[1], count *
-sizeof(DDXPointRec));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPts = (DDXPointPtr) &stuff[1];
- origPts = locPts;
- for (i = count; i; i--) {
- modPts->x = origPts->x - x_off;
- modPts++->y = origPts++->y - y_off;
+ locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
+ memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ DDXPointPtr pnts = (DDXPointPtr)&stuff[1];
+ int i = (stuff->coordMode==CoordModePrevious) ? 1 : count;
+
+ while(i--) {
+ pnts->x -= x_off;
+ pnts->y -= y_off;
+ pnts++;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_FillPoly])(client);
+ if(result != Success) break;
}
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_FillPoly])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(locPts);
- return (result);
- }else
+ DEALLOCATE_LOCAL(locPts);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyFillRectangle(ClientPtr client)
{
- int result, things, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
- xRectangle *origThings;
- xRectangle *origPtr, *modPtr;
+ int result = 0, things, i, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ xRectangle *origRects;
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot :
-PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyFillRectangle])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
- IF_RETURN((things & 4), BadLength);
+ if(things & 4) return BadLength;
things >>= 3;
if (things > 0){
- origThings = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
- memcpy((char *) origThings, (char *)&stuff[1], things *
-sizeof(xRectangle));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
+ origRects = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
+ memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xRectangle *rects = (xRectangle *) &stuff[1];
+
+ for (i = things; i--; rects++) {
+ rects->x -= x_off;
+ rects->y -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyFillRectangle])(client);
+ if(result != Success) break;
}
- modPtr = (xRectangle *) &stuff[1];
- origPtr = origThings;
- for (i = things; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyFillRectangle])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origThings);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origRects);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyFillArc(ClientPtr client)
{
- int result, arcs, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int result = 0, narcs, i, j;
xArc *origArcs;
- xArc *origPtr, *modPtr;
REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot :
-PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- arcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
- IF_RETURN((arcs % sizeof(xArc)), BadLength);
- arcs /= sizeof(xArc);
- if (arcs > 0) {
- origArcs = (xArc *) ALLOCATE_LOCAL(arcs * sizeof(xArc));
- memcpy((char *) origArcs, (char *)&stuff[1], arcs * sizeof(xArc));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyFillArc])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
+ IF_RETURN((narcs % sizeof(xArc)), BadLength);
+ narcs /= sizeof(xArc);
+ if (narcs > 0) {
+ origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xArc *arcs = (xArc *) &stuff[1];
+
+ for (i = narcs; i--; arcs++) {
+ arcs->x -= x_off;
+ arcs->y -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyFillArc])(client);
+ if(result != Success) break;
}
- modPtr = (xArc *) &stuff[1];
- origPtr = origArcs;
- for (i = arcs; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyFillArc])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origArcs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origArcs);
+ return (result);
+ } else
return (client->noClientException);
}
-/* 64-bit server notes: the protocol restricts padding of images to
- * 8-, 16-, or 32-bits. We would like to have 64-bits for the server
- * to use internally. Removes need for internal alignment checking.
- * All of the PutImage functions could be changed individually, but
- * as currently written, they call other routines which require things
- * to be 64-bit padded on scanlines, so we changed things here.
- * If an image would be padded differently for 64- versus 32-, then
- * copy each scanline to a 64-bit padded scanline.
- * Also, we need to make sure that the image is aligned on a 64-bit
- * boundary, even if the scanlines are padded to our satisfaction.
- */
-
-int PanoramiXPutImage(register ClientPtr client)
+int PanoramiXPutImage(ClientPtr client)
{
- register GC *pGC;
- register DrawablePtr pDraw;
- long lengthProto, /* length of scanline protocl padded */
- length; /* length of scanline server padded */
- char *tmpImage;
- int j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- int orig_x, orig_y;
- int result;
-
-
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int j, result = 0, orig_x, orig_y;
REQUEST(xPutImageReq);
REQUEST_AT_LEAST_SIZE(xPutImageReq);
- pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!pDraw, BadDrawable);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin,BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PutImage])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->dstX;
orig_y = stuff->dstY;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ if (isRoot) {
stuff->dstX = orig_x - panoramiXdataPtr[j].x;
stuff->dstY = orig_y - panoramiXdataPtr[j].y;
- }
- if (pDraw->type == DRAWABLE_PIXMAP) {
- if (stuff->width > panoramiXdataPtr[j].width)
- stuff->dstX = orig_x - panoramiXdataPtr[j].x;
- if (stuff->height > panoramiXdataPtr[j].height)
- stuff->dstY = orig_y - panoramiXdataPtr[j].y;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PutImage])(client);
- }
- return(result);
+ }
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PutImage])(client);
+ if(result != Success) break;
+ }
+ return (result);
}
-typedef struct _SrcParts{
- int x1, y1, x2, y2, width, ByteWidth;
- char *buf;
-} SrcPartsRec;
-
-
-int PanoramiXGetImage(register ClientPtr client)
+int PanoramiXGetImage(ClientPtr client)
{
- register DrawablePtr pDraw;
- int nlines, linesPerBuf;
- register int height, linesDone;
- long widthBytesLine, length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLineProto, lengthProto;
- char *tmpImage;
-#endif
- Mask plane;
- char *pBuf;
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDraw;
+ PanoramiXRes *draw;
xGetImageReply xgi;
- int j, k, ScrNum;
- DrawablePtr locDraw;
- SrcPartsRec srcParts;
- BoxRec SrcBox;
- char *BufPtr, *PartPtr;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ Bool isRoot;
+ char *pBuf;
+ int i, x, y, w, h, format;
+ Mask plane = 0, planemask;
+ int linesDone, nlines, linesPerBuf;
+ long widthBytesLine, length;
REQUEST(xGetImageReq);
- height = stuff->height;
REQUEST_SIZE_MATCH(xGetImageReq);
+
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
return(BadValue);
}
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(draw->type == XRT_PIXMAP)
+ return (*SavedProcVector[X_GetImage])(client);
+
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
- ScrNum = 0;
- if (stuff->drawable == PanoramiXWinRoot->info[0].id) {
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++) {
- ScrNum = j;
- VERIFY_DRAWABLE(pDraw, pPanoramiXWin->info[ScrNum].id, client);
- if (stuff->x < panoramiXdataPtr[ScrNum].x &&
- stuff->y < panoramiXdataPtr[ScrNum].y )
- break;
- }
- }
- if (pDraw->type == DRAWABLE_WINDOW) {
- if (!((WindowPtr) pDraw)->realized /* Check for viewable */
- || pDraw->x + stuff->x < 0 /* Check for on screen */
- || pDraw->x + stuff->x + (int)stuff->width > PanoramiXPixWidth
- || pDraw->y + stuff->y < 0
- || pDraw->y + stuff->y + height > PanoramiXPixHeight
- || stuff->x < - wBorderWidth((WindowPtr)pDraw) /* Inside border */
- || stuff->x + (int)stuff->width >
- wBorderWidth((WindowPtr)pDraw) + (int) pDraw->width
- + panoramiXdataPtr[ScrNum].x
- || stuff->y < -wBorderWidth((WindowPtr)pDraw)
- || stuff->y + height >
- wBorderWidth ((WindowPtr)pDraw) + (int) pDraw->height
- + panoramiXdataPtr[ScrNum].y)
+
+ if(!((WindowPtr)pDraw)->realized)
+ return(BadMatch);
+
+ x = stuff->x;
+ y = stuff->y;
+ w = stuff->width;
+ h = stuff->height;
+ format = stuff->format;
+ planemask = stuff->planeMask;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ if(isRoot) {
+ if( /* check for being onscreen */
+ x < 0 || x + w > PanoramiXPixWidth ||
+ y < 0 || y + h > PanoramiXPixHeight )
return(BadMatch);
- VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
- xgi.visual = wVisual (((WindowPtr) pDraw));
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadWindow);
} else {
- if (stuff->x < 0 || stuff->x + (int)stuff->width > pDraw->width
- || stuff->y < 0 || stuff->y + height > pDraw->height)
+ if( /* check for being onscreen */
+ panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
+ panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
+ panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
+ panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ /* check for being inside of border */
+ x < - wBorderWidth((WindowPtr)pDraw) ||
+ x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
+ y < -wBorderWidth((WindowPtr)pDraw) ||
+ y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
return(BadMatch);
- xgi.visual = None;
}
+
+ drawables[0] = pDraw;
+ for(i = 1; i < PanoramiXNumScreens; i++)
+ VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+
+ xgi.visual = wVisual (((WindowPtr) pDraw));
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
- if (stuff->format == ZPixmap) {
- widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
- length = widthBytesLine * height;
+ if(format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(w, pDraw->depth);
+ length = widthBytesLine * h;
+
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
- lengthProto = widthBytesLineProto * height;
-#endif
} else {
- widthBytesLine = BitmapBytePad(stuff->width);
+ widthBytesLine = BitmapBytePad(w);
plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */
- length = widthBytesLine * height *
- Ones(stuff->planeMask & (plane | (plane - 1)));
+ length = widthBytesLine * h *
+ Ones(planemask & (plane | (plane - 1)));
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = BitmapBytePadProto(stuff->width);
- lengthProto = widthBytesLineProto * height *
- Ones(stuff->planeMask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- xgi.length = (lengthProto + 3) >> 2;
-#else
xgi.length = (length + 3) >> 2;
-#endif
- if (widthBytesLine == 0 || height == 0) {
+ if (widthBytesLine == 0 || h == 0)
linesPerBuf = 0;
- } else if (widthBytesLine >= IMAGE_BUFSIZE) {
+ else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE)
linesPerBuf = 1;
- } else {
- linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > height)
- linesPerBuf = height;
+ else {
+ linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > h)
+ linesPerBuf = h;
}
length = linesPerBuf * widthBytesLine;
- if (linesPerBuf < height) {
-
- /*
- * Have to make sure intermediate buffers don't need padding
- */
-
- while ((linesPerBuf > 1)
- && (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))) {
- linesPerBuf--;
- length -= widthBytesLine;
- }
- while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)) {
- linesPerBuf++;
- length += widthBytesLine;
- }
- }
- IF_RETURN((!(pBuf = (char *) ALLOCATE_LOCAL(length))), BadAlloc);
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /*
- * Check for protocol/server padding differences
- */
-
- if (widthBytesLine != widthBytesLineProto)
- if (!(tmpImage = (char *) ALLOCATE_LOCAL(length))) {
- DEALLOCATE_LOCAL(pBuf);
- return (BadAlloc);
- }
-#endif
+ if(!(pBuf = xalloc(length)))
+ return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
if (linesPerBuf == 0) {
-
- /*
- * Nothing to do
- */
-
- } else if (stuff->format == ZPixmap) {
+ /* nothing to do */
+ }
+ else if (format == ZPixmap) {
linesDone = 0;
- while (height - linesDone > 0) {
- nlines = min(linesPerBuf, height - linesDone);
- if (pDraw->type == DRAWABLE_WINDOW) {
- SrcBox.x1 = pDraw->x + stuff->x;
- SrcBox.y1 = pDraw->y + stuff->y + linesDone;
- SrcBox.x2 = SrcBox.x1 + stuff->width;
- SrcBox.y2 = SrcBox.y1 + nlines;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
-
- /*
- * If it isn't even on this screen, just continue.
- */
+ while (h - linesDone > 0) {
+ nlines = min(linesPerBuf, h - linesDone);
- if ((SrcBox.x1 >= panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)
- || (SrcBox.x2 <= panoramiXdataPtr[j].x)
- || (SrcBox.y1 >= panoramiXdataPtr[j].y+panoramiXdataPtr[j].height)
- || (SrcBox.y2 <= panoramiXdataPtr[j].y))
- continue;
-
- srcParts.x1 = max(SrcBox.x1 - panoramiXdataPtr[j].x, 0);
- srcParts.x2 = min(SrcBox.x2 - panoramiXdataPtr[j].x,
- panoramiXdataPtr[j].width);
- srcParts.y1 = max(SrcBox.y1 - panoramiXdataPtr[j].y, 0);
- srcParts.y2 = min(SrcBox.y2 - panoramiXdataPtr[j].y,
- panoramiXdataPtr[j].height);
- srcParts.width = srcParts.x2 - srcParts.x1;
- srcParts.ByteWidth = PixmapBytePad(srcParts.width,pDraw->depth);
- srcParts.buf = (char *) Xalloc(nlines * srcParts.ByteWidth);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client,
- pPanoramiXWin->info[j].id,
- RC_DRAWABLE,
- SecurityReadAccess);
- (*pDraw->pScreen->GetImage)(locDraw,
- srcParts.x1 - locDraw->x,
- srcParts.y1 - locDraw->y,
- srcParts.width,
- srcParts.y2 - srcParts.y1,
- stuff->format,
- (unsigned long)stuff->planeMask,
- srcParts.buf);
- BufPtr = pBuf
- + srcParts.x1 - stuff->x - (pDraw->x - panoramiXdataPtr[j].x)
- + widthBytesLine * (srcParts.y1 - stuff->y
- - (pDraw->y + linesDone - panoramiXdataPtr[j].y));
- PartPtr = srcParts.buf;
- for (k = (srcParts.y2 - srcParts.y1); k; k--) {
- bcopy(PartPtr, BufPtr, srcParts.width);
- BufPtr += widthBytesLine;
- PartPtr += srcParts.ByteWidth;
- }
- Xfree(srcParts.buf);
- }
- } else {
- (*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y + linesDone,
- stuff->width, nlines, stuff->format,
- (unsigned long)stuff->planeMask, pBuf);
- }
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /*
- * For 64-bit server, convert image to pad to 32 bits
- */
-
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- bzero(tmpImage,length);
-
- for (i = 0, bufPtr = pBuf, protoPtr = tmpImage; i < nlines;
- bufPtr += widthBytesLine, protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr,bufPtr,widthBytesLineProto);
-
- /*
- * Note this is NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
-
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto), tmpImage);
- } else
-#endif
- {
+ if(pDraw->depth == 1)
+ bzero(pBuf, nlines * widthBytesLine);
- /*
- * Note this is NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
+ XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
+ format, planemask, pBuf, widthBytesLine, isRoot);
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine), pBuf);
- }
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
linesDone += nlines;
}
- } else { /* XYPixmap */
+ } else { /* XYPixmap */
for (; plane; plane >>= 1) {
- if (stuff->planeMask & plane) {
+ if (planemask & plane) {
linesDone = 0;
- while (height - linesDone > 0) {
- nlines = min(linesPerBuf, height - linesDone);
- (*pDraw->pScreen->GetImage) (pDraw,
- stuff->x,
- stuff->y + linesDone,
- stuff->width,
- nlines,
- stuff->format,
- (unsigned long)plane,
- pBuf);
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /*
- * For 64-bit server, convert image to pad to 32 bits
- */
-
- if (widthBytesLine != widthBytesLineProto) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- bzero(tmpImage, length);
-
- for (i = 0,bufPtr = pBuf,protoPtr =tmpImage; i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- bcopy(bufPtr, protoPtr, widthBytesLineProto);
-
- /*
- * Note: NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
-
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto), tmpImage);
- } else
-#endif
- {
+ while (h - linesDone > 0) {
+ nlines = min(linesPerBuf, h - linesDone);
- /*
- * Note: NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
+ bzero(pBuf, nlines * widthBytesLine);
+
+ XineramaGetImageData(drawables, x, y + linesDone, w,
+ nlines, format, plane, pBuf,
+ widthBytesLine, isRoot);
+
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine), pBuf);
- }
linesDone += nlines;
}
}
}
}
- DEALLOCATE_LOCAL(pBuf);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if (widthBytesLine != widthBytesLineProto)
- DEALLOCATE_LOCAL(tmpImage);
-#endif
+ xfree(pBuf);
return (client->noClientException);
}
+/* The text stuff should be rewritten so that duplication happens
+ at the GlyphBlt level. That is, loading the font and getting
+ the glyphs should only happen once */
+
int
-PanoramiXPolyText8(register ClientPtr client)
+PanoramiXPolyText8(ClientPtr client)
{
- int result, j;
-
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- PixmapPtr pPixmap;
- GC *pGC;
- int orig_x, orig_y;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int result = 0, j;
+ int orig_x, orig_y;
REQUEST(xPolyTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != pDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyText8])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- stuff->x = orig_x;
- stuff->y = orig_y;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- } else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
- if (!j)
- noPanoramiXExtension = TRUE;
result = (*SavedProcVector[X_PolyText8])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
int
-PanoramiXPolyText16(register ClientPtr client)
+PanoramiXPolyText16(ClientPtr client)
{
- int result, j;
-
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- GC *pGC;
- int orig_x, orig_y;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int result = 0, j;
+ int orig_x, orig_y;
REQUEST(xPolyTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != pDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyText16])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- stuff->x = orig_x;
- stuff->y = orig_y;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- } else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
- if (!j)
- noPanoramiXExtension = TRUE;
result = (*SavedProcVector[X_PolyText16])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
-
int PanoramiXImageText8(ClientPtr client)
{
- int result, j;
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- GCPtr pGC;
+ int result = 0, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
int orig_x, orig_y;
REQUEST(xImageTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_ImageText8])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- }else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
result = (*SavedProcVector[X_ImageText8])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
@@ -2682,249 +2020,217 @@ int PanoramiXImageText8(ClientPtr client)
int PanoramiXImageText16(ClientPtr client)
{
- int result, j;
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- GCPtr pGC;
+ int result = 0, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
int orig_x, orig_y;
REQUEST(xImageTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_ImageText16])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- }else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
result = (*SavedProcVector[X_ImageText16])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
-int PanoramiXCreateColormap(register ClientPtr client)
-{
- VisualPtr pVisual;
- ColormapPtr pmap;
- Colormap mid;
- register WindowPtr pWin;
- ScreenPtr pScreen;
- DepthPtr pDepth;
+int PanoramiXCreateColormap(ClientPtr client)
+{
+ PanoramiXRes *win, *newCmap;
+ int result = 0, j, orig_visual;
REQUEST(xCreateColormapReq);
- int i, result;
- int vid_index, class_index;
- int this_vid_index, this_class_index, this_depth;
- int j = 0;
- VisualID orig_visual;
- Colormap cmapID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXCmap *localCmap;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
- short VisualClass;
- Bool ClassKnown;
- Bool FoundIt = FALSE;
-
REQUEST_SIZE_MATCH(xCreateColormapReq);
- mid = stuff->mid;
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ if(!stuff->visual || (stuff->visual > 255))
+ return BadValue;
+
+ if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newCmap->type = XRT_COLORMAP;
+ newCmap->info[0].id = stuff->mid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newCmap->info[j].id = FakeClientID(client->index);
+
orig_visual = stuff->visual;
- j = 0;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- if (pPanoramiXWin) {
- localCmap = (PanoramiXCmap *)Xcalloc(sizeof(PanoramiXCmap));
- IF_RETURN(!localCmap, BadAlloc);
- } else {
- return BadWindow;
- }
- for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
- cmapID = j ? FakeClientID(client->index) : mid;
- localCmap->info[j].id = cmapID;
- }
- localCmap->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXCmap, PanoramiXCmapRoot);
- pPanoramiXCmap->next = localCmap;
-
- /* Use Screen 0 to get the matching Visual ID */
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- SecurityReadAccess);
- if ( stuff->visual != CopyFromParent)
- {
- /* Find the correct visual for screen 0 */
- for (class_index = 0; class_index < PanoramiXColorDepthTable[0].numVisuals;
-class_index++)
- {
- for (j = 0; j < PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index
-].numDepths; j++ )
- {
- pDepth = (DepthPtr) &pWin->drawable.pScreen->allowedDepths[j];
- for (vid_index = 0; vid_index < PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[pDepth->depth].numVids; vid_index++)
- {
- if ( stuff->visual == PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[pDepth->depth].vid[vid_index] )
- {
- this_class_index = class_index;
- this_vid_index = vid_index;
- this_depth = pDepth->depth;
- FoundIt = TRUE;
- break;
- }
- }
- }
- }
- }
- if (!pWin)
- return(BadWindow);
- pScreen = pWin->drawable.pScreen;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->mid = localCmap->info[j].id;
- stuff->window = pPanoramiXWin->info[j].id;
- /* Look for the matching visual class, and use its
- visual id for creating this colormap. */
- if ( orig_visual != CopyFromParent && FoundIt )
- {
- stuff->visual = PanoramiXColorDepthTable[j].panoramiXScreenMap[this_class_index].vmap[this_depth].vid[this_vid_index];
- }
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->mid = newCmap->info[j].id;
+ stuff->window = win->info[j].id;
+ stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j];
result = (* SavedProcVector[X_CreateColormap])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXCmap->next = NULL ;
- if (localCmap)
- Xfree(localCmap);
+ if(result != Success) break;
}
+
+ if (result == Success)
+ AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
+ else
+ xfree(newCmap);
+
return (result);
}
int PanoramiXFreeColormap(ClientPtr client)
{
- ColormapPtr pmap;
+ PanoramiXRes *cmap;
+ int result = 0, j;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
- PanoramiXCmap *pPanoramiXCmapback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXCmap && (pPanoramiXCmap->info[0].id != stuff->id);
- pPanoramiXCmap = pPanoramiXCmap->next)
- pPanoramiXCmapback = pPanoramiXCmap;
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->id = pPanoramiXCmap->info[j].id;
+ client->errorValue = stuff->id;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_COLORMAP, SecurityDestroyAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = cmap->info[j].id;
result = (* SavedProcVector[X_FreeColormap])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
- if ((result == Success) && pPanoramiXCmapback &&
- pPanoramiXCmap && pPanoramiXCmap->FreeMe) {
- pPanoramiXCmapback->next = pPanoramiXCmap->next;
- Xfree(pPanoramiXCmap);
+
+ /* Since ProcFreeColormap is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
+ return (result);
+}
+
+
+int
+PanoramiXCopyColormapAndFree(ClientPtr client)
+{
+ PanoramiXRes *cmap, *newCmap;
+ int result = 0, j;
+ REQUEST(xCopyColormapAndFreeReq);
+
+ REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
+
+ client->errorValue = stuff->srcCmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->srcCmap, XRT_COLORMAP,
+ SecurityReadAccess | SecurityWriteAccess)))
+ return BadColor;
+
+ if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newCmap->type = XRT_COLORMAP;
+ newCmap->info[0].id = stuff->mid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newCmap->info[j].id = FakeClientID(client->index);
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->srcCmap = cmap->info[j].id;
+ stuff->mid = newCmap->info[j].id;
+ result = (* SavedProcVector[X_CopyColormapAndFree])(client);
+ if(result != Success) break;
}
- PANORAMIX_FREE(client);
+
+ if (result == Success)
+ AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
+ else
+ xfree(newCmap);
+
return (result);
}
-int PanoramiXInstallColormap(register ClientPtr client)
+int PanoramiXInstallColormap(ClientPtr client)
{
- ColormapPtr pcmp;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST_SIZE_MATCH(xResourceReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->id);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->id = pPanoramiXCmap->info[j].id;
+
+ client->errorValue = stuff->id;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->id = cmap->info[j].id;
result = (* SavedProcVector[X_InstallColormap])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
-int PanoramiXUninstallColormap(register ClientPtr client)
+int PanoramiXUninstallColormap(ClientPtr client)
{
- ColormapPtr pcmp;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST_SIZE_MATCH(xResourceReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->id);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->id = pPanoramiXCmap->info[j].id;
+
+ client->errorValue = stuff->id;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = cmap->info[j].id;
result = (* SavedProcVector[X_UninstallColormap])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
- PANORAMIX_FREE(client);
return (result);
}
int PanoramiXAllocColor(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xAllocColorReq);
REQUEST_SIZE_MATCH(xAllocColorReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- if (!pPanoramiXCmap){
- noPanoramiXExtension = TRUE;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_AllocColor])(client);
- noPanoramiXExtension = FALSE;
- }else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- if (!j)
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_AllocColor])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
- }
+ if(result != Success) break;
}
return (result);
}
@@ -2932,20 +2238,22 @@ int PanoramiXAllocColor(ClientPtr client)
int PanoramiXAllocNamedColor(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xAllocNamedColorReq);
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- if (!j)
- noPanoramiXExtension = TRUE;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_AllocNamedColor])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
@@ -2953,82 +2261,114 @@ int PanoramiXAllocNamedColor(ClientPtr client)
int PanoramiXAllocColorCells(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xAllocColorCellsReq);
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- if (!pPanoramiXCmap) {
- noPanoramiXExtension = TRUE;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_AllocColorCells])(client);
- noPanoramiXExtension = FALSE;
- }else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- if (!j)
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_AllocColorCells])(client);
- noPanoramiXExtension = FALSE;
- /* Because id's are eventually searched for in
- some client list, we don't check for success
- on fake id's last id will be real, we really
- only care about results related to real id's
- BREAK_IF(result != Success);
- */
- }
+ if(result != Success) break;
}
return (result);
}
-int PanoramiXFreeColors(register ClientPtr client)
+int PanoramiXAllocColorPlanes(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
- REQUEST(xFreeColorsReq);
+ int result = 0, j;
+ PanoramiXRes *cmap;
+ REQUEST(xAllocColorPlanesReq);
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
+ result = (* SavedProcVector[X_AllocColorPlanes])(client);
+ if(result != Success) break;
+ }
+ return (result);
+}
+
+
+
+int PanoramiXFreeColors(ClientPtr client)
+{
+ int result = 0, j;
+ PanoramiXRes *cmap;
+ REQUEST(xFreeColorsReq);
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_FreeColors])(client);
- /* Because id's are eventually searched for in
- some client list, we don't check for success
- on fake id's last id will be real, we really
- only care about results related to real id's */
}
- PANORAMIX_FREE(client);
return (result);
}
int PanoramiXStoreColors(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xStoreColorsReq);
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- if (!pPanoramiXCmap)
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_StoreColors])(client);
- else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- result = (* SavedProcVector[X_StoreColors])(client);
- BREAK_IF(result != Success);
- }
+ if(result != Success) break;
+ }
+ return (result);
+}
+
+
+int PanoramiXStoreNamedColor(ClientPtr client)
+{
+ int result = 0, j;
+ PanoramiXRes *cmap;
+ REQUEST(xStoreNamedColorReq);
+
+ REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
+ result = (* SavedProcVector[X_StoreNamedColor])(client);
+ if(result != Success) break;
}
return (result);
}
diff --git a/Xext/security.c b/Xext/security.c
index c2db8f4dd..9af380dd6 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.11 2002/05/31 18:45:53 dawes Exp $ */
#include "dixstruct.h"
#include "extnsionst.h"
@@ -50,7 +51,7 @@ extern unsigned char LbxReqCode;
#ifndef DEFAULTPOLICYFILE
# define DEFAULTPOLICYFILE NULL
#endif
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
#include <X11/Xos.h>
#undef index
#endif
@@ -82,9 +83,6 @@ int (*SwappedUntrustedProcVector[256])(
#endif
);
-extern int ProcBadRequest();
-
-
/* SecurityAudit
*
* Arguments:
@@ -150,7 +148,7 @@ SecurityDeleteAuthorization(value, id)
/* send revoke events */
- while (pEventClient = pAuth->eventClients)
+ while ((pEventClient = pAuth->eventClients))
{
/* send revocation event event */
ClientPtr client = rClient(pEventClient);
@@ -318,7 +316,7 @@ static int
ProcSecurityQueryVersion(client)
ClientPtr client;
{
- REQUEST(xSecurityQueryVersionReq);
+ /* REQUEST(xSecurityQueryVersionReq); */
xSecurityQueryVersionReply rep;
/* paranoia: this "can't happen" because this extension is hidden
@@ -395,7 +393,6 @@ ProcSecurityGenerateAuthorization(client)
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
int err; /* error to return from this function */
- int status; /* return value from os functions */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */
@@ -788,7 +785,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
Bool untrusted_got_event;
Bool found_event_window;
Mask eventmask;
- int reqtype;
+ int reqtype = 0;
/* trusted clients always allowed to do anything */
if (client->trustLevel == XSecurityClientTrusted)
@@ -1361,8 +1358,11 @@ SecurityFreePropertyAccessList()
}
} /* SecurityFreePropertyAccessList */
-
+#ifndef __UNIXOS2__
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
+#else
+#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
+#endif
static char *
SecuritySkipWhitespace(p)
@@ -1441,7 +1441,6 @@ SecurityParsePropertyAccessRule(p)
char action = SecurityDefaultAction;
char readAction, writeAction, destroyAction;
PropertyAccessPtr pacl, prev, cur;
- ATOM atom;
char *mustHaveProperty = NULL;
char *mustHaveValue = NULL;
Bool invalid;
@@ -1641,7 +1640,11 @@ SecurityLoadPropertyAccessList()
if (!SecurityPolicyFile)
return;
+#ifndef __UNIXOS2__
f = fopen(SecurityPolicyFile, "r");
+#else
+ f = fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
+#endif
if (!f)
{
ErrorF("error opening security policy file %s\n",
@@ -1969,7 +1972,7 @@ SecurityExtensionInit()
SecurityEventBase = extEntry->eventBase;
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
- SwapSecurityAuthorizationRevokedEvent;
+ (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
/* initialize untrusted proc vectors */
diff --git a/Xext/shape.c b/Xext/shape.c
index bff7d2502..7bd161dcc 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.16 2001/12/14 19:58:50 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -27,7 +28,6 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: shape.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -43,26 +43,101 @@ in this Software without prior written authorization from The Open Group.
#include "shapestr.h"
#include "regionstr.h"
#include "gcstruct.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+typedef RegionPtr (*CreateDftPtr)(
+#if NeedNestedPrototypes
+ WindowPtr /* pWin */
+#endif
+ );
+
+static int ShapeFreeClient(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ XID /* id */
+#endif
+ );
+static int ShapeFreeEvents(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ XID /* id */
+#endif
+ );
+static void SendShapeNotify(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ int /* which */
+#endif
+ );
+static void ShapeResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SShapeNotifyEvent(
+#if NeedFunctionPrototypes
+ xShapeNotifyEvent * /* from */,
+ xShapeNotifyEvent * /* to */
+#endif
+ );
+static int
+RegionOperate (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ WindowPtr /* pWin */,
+ int /* kind */,
+ RegionPtr * /* destRgnp */,
+ RegionPtr /* srcRgn */,
+ int /* op */,
+ int /* xoff */,
+ int /* yoff */,
+ CreateDftPtr /* create */
+#endif
+ );
+
+#if NeedFunctionPrototypes
+#define CREATE_PROC(func) RegionPtr func(WindowPtr /* pWin */)
+#else
+#define CREATE_PROC(func) RegionPtr func(/* WindowPtr pWin */)
+#endif
+
+static CREATE_PROC(CreateBoundingShape);
+static CREATE_PROC(CreateClipShape);
+
+#undef CREATE_PROC
+
+static DISPATCH_PROC(ProcShapeCombine);
+static DISPATCH_PROC(ProcShapeDispatch);
+static DISPATCH_PROC(ProcShapeGetRectangles);
+static DISPATCH_PROC(ProcShapeInputSelected);
+static DISPATCH_PROC(ProcShapeMask);
+static DISPATCH_PROC(ProcShapeOffset);
+static DISPATCH_PROC(ProcShapeQueryExtents);
+static DISPATCH_PROC(ProcShapeQueryVersion);
+static DISPATCH_PROC(ProcShapeRectangles);
+static DISPATCH_PROC(ProcShapeSelectInput);
+static DISPATCH_PROC(SProcShapeCombine);
+static DISPATCH_PROC(SProcShapeDispatch);
+static DISPATCH_PROC(SProcShapeGetRectangles);
+static DISPATCH_PROC(SProcShapeInputSelected);
+static DISPATCH_PROC(SProcShapeMask);
+static DISPATCH_PROC(SProcShapeOffset);
+static DISPATCH_PROC(SProcShapeQueryExtents);
+static DISPATCH_PROC(SProcShapeQueryVersion);
+static DISPATCH_PROC(SProcShapeRectangles);
+static DISPATCH_PROC(SProcShapeSelectInput);
#ifdef PANORAMIX
#include "panoramiX.h"
+#include "panoramiXsrv.h"
#endif
-static int ShapeFreeClient(), ShapeFreeEvents();
-static void SendShapeNotify();
-static int ProcShapeDispatch(), SProcShapeDispatch();
-static void ShapeResetProc(), SShapeNotifyEvent();
-
static unsigned char ShapeReqCode = 0;
static int ShapeEventBase = 0;
static RESTYPE ClientType, EventType; /* resource types for event masks */
-#ifdef PANORAMIX
-extern int PanoramiXNumScreens;
-extern Bool noPanoramiXExtension;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
-#endif
/*
* each window has a list of clients requesting
* ShapeNotify events. Each client has a resource
@@ -91,7 +166,7 @@ typedef struct _ShapeEvent {
void
ShapeExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
ClientType = CreateNewResourceType(ShapeFreeClient);
EventType = CreateNewResourceType(ShapeFreeEvents);
@@ -102,7 +177,7 @@ ShapeExtensionInit()
{
ShapeReqCode = (unsigned char)extEntry->base;
ShapeEventBase = extEntry->eventBase;
- EventSwapVector[ShapeEventBase] = SShapeNotifyEvent;
+ EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
}
}
@@ -113,7 +188,7 @@ ExtensionEntry *extEntry;
{
}
-static
+static int
RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
ClientPtr client;
WindowPtr pWin;
@@ -121,7 +196,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
RegionPtr *destRgnp, srcRgn;
int op;
int xoff, yoff;
- RegionPtr (*create)(); /* creates a reasonable *destRgnp */
+ CreateDftPtr create; /* creates a reasonable *destRgnp */
{
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -133,7 +208,31 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
REGION_DESTROY(pScreen, srcRgn);
return Success;
}
- switch (op) {
+
+ /* May/30/2001:
+ * The shape.PS specs say if src is None, existing shape is to be
+ * removed (and so the op-code has no meaning in such removal);
+ * see shape.PS, page 3, ShapeMask.
+ */
+ if (srcRgn == NULL) {
+ if (*destRgnp != NULL) {
+ REGION_DESTROY (pScreen, *destRgnp);
+ *destRgnp = 0;
+ /* go on to remove shape and generate ShapeNotify */
+ }
+ else {
+ /* May/30/2001:
+ * The target currently has no shape in effect, so nothing to
+ * do here. The specs say that ShapeNotify is generated whenever
+ * the client region is "modified"; since no modification is done
+ * here, we do not generate that event. The specs does not say
+ * "it is an error to request removal when there is no shape in
+ * effect", so we return good status.
+ */
+ return Success;
+ }
+ }
+ else switch (op) {
case ShapeSet:
if (*destRgnp)
REGION_DESTROY(pScreen, *destRgnp);
@@ -204,7 +303,6 @@ static int
ProcShapeQueryVersion (client)
register ClientPtr client;
{
- REQUEST(xShapeQueryVersionReq);
xShapeQueryVersionReply rep;
register int n;
@@ -228,42 +326,8 @@ ProcShapeQueryVersion (client)
* ProcShapeRectangles
*
*****************/
-#ifdef PANORAMIX
-static int
-ProcPanoramiXShapeRectangles (client)
- register ClientPtr client;
-{
- WindowPtr pWin;
- ScreenPtr pScreen;
- REQUEST(xShapeRectanglesReq);
- xRectangle *prects;
- int nrects, ctype;
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- RegionPtr (*createDefault)();
- int destBounding;
-
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- result = ProcShapeRectangles (client);
- BREAK_IF(result != Success);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcShapeRectangles (client)
register ClientPtr client;
{
@@ -274,7 +338,7 @@ ProcShapeRectangles (client)
int nrects, ctype;
RegionPtr srcRgn;
RegionPtr *destRgn;
- RegionPtr (*createDefault)();
+ CreateDftPtr createDefault;
int destBounding;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
@@ -324,49 +388,37 @@ ProcShapeRectangles (client)
stuff->xOff, stuff->yOff, createDefault);
}
-/**************
- * ProcShapeMask
- **************/
-
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeMask (client)
+ProcPanoramiXShapeRectangles (client)
register ClientPtr client;
{
- WindowPtr pWin;
- ScreenPtr pScreen;
- REQUEST(xShapeMaskReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- PixmapPtr pPixmap;
- RegionPtr (*createDefault)();
- int destBounding;
+ REQUEST(xShapeRectanglesReq);
+ PanoramiXRes *win;
+ int j, result = 0;
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXPmap *pPmap = PanoramiXPmapRoot;
+ REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
- REQUEST_SIZE_MATCH (xShapeMaskReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- PANORAMIXFIND_ID(pPmap, stuff->src);
- IF_RETURN(!pPmap, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- stuff->src = pPmap->info[j].id;
- result = ProcShapeMask (client);
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ result = ProcShapeRectangles (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
-#ifdef PANORAMIX
-int
-#else
+
+/**************
+ * ProcShapeMask
+ **************/
+
+
static int
-#endif
ProcShapeMask (client)
register ClientPtr client;
{
@@ -376,7 +428,7 @@ ProcShapeMask (client)
RegionPtr srcRgn;
RegionPtr *destRgn;
PixmapPtr pPixmap;
- RegionPtr (*createDefault)();
+ CreateDftPtr createDefault;
int destBounding;
REQUEST_SIZE_MATCH (xShapeMaskReq);
@@ -425,45 +477,45 @@ ProcShapeMask (client)
stuff->xOff, stuff->yOff, createDefault);
}
-/************
- * ProcShapeCombine
- ************/
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeCombine (client)
+ProcPanoramiXShapeMask (client)
register ClientPtr client;
{
- WindowPtr pSrcWin, pDestWin;
- ScreenPtr pScreen;
- REQUEST(xShapeCombineReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- RegionPtr (*createDefault)();
- RegionPtr (*createSrc)();
- RegionPtr tmp;
- int destBounding;
+ REQUEST(xShapeMaskReq);
+ PanoramiXRes *win, *pmap;
+ int j, result = 0;
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ REQUEST_SIZE_MATCH (xShapeMaskReq);
- REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- result = ProcShapeCombine (client);
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if(stuff->src != None) {
+ if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->src, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
+ } else
+ pmap = NULL;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ if(pmap)
+ stuff->src = pmap->info[j].id;
+ result = ProcShapeMask (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
-#ifdef PANORAMIX
-int
-#else
+
+/************
+ * ProcShapeCombine
+ ************/
+
static int
-#endif
ProcShapeCombine (client)
register ClientPtr client;
{
@@ -472,8 +524,8 @@ ProcShapeCombine (client)
REQUEST(xShapeCombineReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
- RegionPtr (*createDefault)();
- RegionPtr (*createSrc)();
+ CreateDftPtr createDefault;
+ CreateDftPtr createSrc;
RegionPtr tmp;
int destBounding;
@@ -539,40 +591,41 @@ ProcShapeCombine (client)
stuff->xOff, stuff->yOff, createDefault);
}
-/*************
- * ProcShapeOffset
- *************/
+
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeOffset (client)
+ProcPanoramiXShapeCombine (client)
register ClientPtr client;
{
- WindowPtr pWin;
- ScreenPtr pScreen;
- REQUEST(xShapeOffsetReq);
- RegionPtr srcRgn;
+ REQUEST(xShapeCombineReq);
+ PanoramiXRes *win, *win2;
+ int j, result = 0;
+
+ REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
- REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- result = ProcShapeOffset (client);
+ if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->src, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ stuff->src = win2->info[j].id;
+ result = ProcShapeCombine (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
-#ifdef PANORAMIX
-int
-#else
+/*************
+ * ProcShapeOffset
+ *************/
+
static int
-#endif
ProcShapeOffset (client)
register ClientPtr client;
{
@@ -607,6 +660,32 @@ ProcShapeOffset (client)
return Success;
}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShapeOffset (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeOffsetReq);
+ PanoramiXRes *win;
+ int j, result = 0;
+
+ REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ result = ProcShapeOffset (client);
+ if(result != Success) break;
+ }
+ return (result);
+}
+#endif
+
+
static int
ProcShapeQueryExtents (client)
register ClientPtr client;
@@ -616,6 +695,7 @@ ProcShapeQueryExtents (client)
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
register int n;
+ RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
pWin = LookupWindow (stuff->window, client);
@@ -626,9 +706,9 @@ ProcShapeQueryExtents (client)
rep.sequenceNumber = client->sequence;
rep.boundingShaped = (wBoundingShape(pWin) != 0);
rep.clipShaped = (wClipShape(pWin) != 0);
- if (wBoundingShape(pWin)) {
+ if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin));
+ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -640,9 +720,9 @@ ProcShapeQueryExtents (client)
rep.yBoundingShape = extents.y1;
rep.widthBoundingShape = extents.x2 - extents.x1;
rep.heightBoundingShape = extents.y2 - extents.y1;
- if (wClipShape(pWin)) {
+ if ((region = wClipShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin));
+ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents;
} else {
extents.x1 = 0;
@@ -1001,37 +1081,29 @@ ProcShapeDispatch (client)
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeRectangles (client);
else
- return ProcShapeRectangles (client);
-#else
- return ProcShapeRectangles (client);
#endif
+ return ProcShapeRectangles (client);
case X_ShapeMask:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeMask (client);
else
- return ProcShapeMask (client);
-#else
- return ProcShapeMask (client);
#endif
+ return ProcShapeMask (client);
case X_ShapeCombine:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeCombine (client);
else
- return ProcShapeCombine (client);
-#else
- return ProcShapeCombine (client);
#endif
+ return ProcShapeCombine (client);
case X_ShapeOffset:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeOffset (client);
else
- return ProcShapeOffset (client);
-#else
- return ProcShapeOffset (client);
#endif
+ return ProcShapeOffset (client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents (client);
case X_ShapeSelectInput:
diff --git a/Xext/shm.c b/Xext/shm.c
index 0a9f3af59..3ba9ad2c1 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.36 2002/04/03 19:51:11 herrb Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -29,8 +30,15 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: shm.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
#include <sys/types.h>
+#ifndef Lynx
#include <sys/ipc.h>
#include <sys/shm.h>
+#else
+#include <ipc.h>
+#include <shm.h>
+#endif
+#include <unistd.h>
+#include <sys/stat.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include "X.h"
@@ -48,6 +56,14 @@ in this Software without prior written authorization from The Open Group.
#define _XSHM_SERVER_
#include "shmstr.h"
#include "Xfuncproto.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
typedef struct _ShmDesc {
struct _ShmDesc *next;
@@ -58,21 +74,57 @@ typedef struct _ShmDesc {
unsigned long size;
} ShmDescRec, *ShmDescPtr;
-static void miShmPutImage(), fbShmPutImage();
-static PixmapPtr fbShmCreatePixmap();
-static int ProcShmDispatch(), SProcShmDispatch();
-static int ShmDetachSegment();
-static void ShmResetProc(), SShmCompletionEvent();
+static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
+static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
+static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
+static int ShmDetachSegment(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* shmseg */
+#endif
+ );
+static void ShmResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SShmCompletionEvent(
+#if NeedFunctionPrototypes
+ xShmCompletionEvent * /* from */,
+ xShmCompletionEvent * /* to */
+#endif
+ );
+
+static Bool ShmDestroyPixmap (PixmapPtr pPixmap);
+
+static DISPATCH_PROC(ProcShmAttach);
+static DISPATCH_PROC(ProcShmCreatePixmap);
+static DISPATCH_PROC(ProcShmDetach);
+static DISPATCH_PROC(ProcShmDispatch);
+static DISPATCH_PROC(ProcShmGetImage);
+static DISPATCH_PROC(ProcShmPutImage);
+static DISPATCH_PROC(ProcShmQueryVersion);
+static DISPATCH_PROC(SProcShmAttach);
+static DISPATCH_PROC(SProcShmCreatePixmap);
+static DISPATCH_PROC(SProcShmDetach);
+static DISPATCH_PROC(SProcShmDispatch);
+static DISPATCH_PROC(SProcShmGetImage);
+static DISPATCH_PROC(SProcShmPutImage);
+static DISPATCH_PROC(SProcShmQueryVersion);
static unsigned char ShmReqCode;
-static int ShmCompletionCode;
-static int BadShmSegCode;
-static RESTYPE ShmSegType, ShmPixType;
+int ShmCompletionCode;
+int BadShmSegCode;
+RESTYPE ShmSegType;
static ShmDescPtr Shmsegs;
static Bool sharedPixmaps;
static int pixmapFormat;
static int shmPixFormat[MAXSCREENS];
static ShmFuncsPtr shmFuncs[MAXSCREENS];
+static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
+#ifdef PIXPRIV
+static int shmPixmapPrivate;
+#endif
static ShmFuncs miFuncs = {NULL, miShmPutImage};
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
@@ -106,20 +158,60 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
} \
}
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#include <sys/signal.h>
+
+static Bool badSysCall = FALSE;
+
+static void
+SigSysHandler(signo)
+int signo;
+{
+ badSysCall = TRUE;
+}
+
+static Bool CheckForShmSyscall()
+{
+ void (*oldHandler)();
+ int shmid = -1;
+
+ /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
+ oldHandler = signal(SIGSYS, SigSysHandler);
+
+ badSysCall = FALSE;
+ shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
+ /* Clean up */
+ if (shmid != -1)
+ {
+ shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
+ }
+ signal(SIGSYS, oldHandler);
+ return(!badSysCall);
+}
+#endif
+
void
ShmExtensionInit()
{
ExtensionEntry *extEntry;
int i;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ if (!CheckForShmSyscall())
+ {
+ ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
+ return;
+ }
+#endif
+
sharedPixmaps = xFalse;
pixmapFormat = 0;
-#else
- sharedPixmaps = xTrue;
- pixmapFormat = shmPixFormat[0];
- for (i = 0; i < screenInfo.numScreens; i++)
{
+ sharedPixmaps = xTrue;
+ pixmapFormat = shmPixFormat[0];
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
if (!shmFuncs[i])
shmFuncs[i] = &miFuncs;
if (!shmFuncs[i]->CreatePixmap)
@@ -129,13 +221,29 @@ ShmExtensionInit()
sharedPixmaps = xFalse;
pixmapFormat = 0;
}
- }
- if (!pixmapFormat)
+ }
+ if (!pixmapFormat)
pixmapFormat = ZPixmap;
+ if (sharedPixmaps)
+ {
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
+ screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
+ }
+#ifdef PIXPRIV
+ shmPixmapPrivate = AllocatePixmapPrivateIndex();
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ if (!AllocatePixmapPrivate(screenInfo.screens[i],
+ shmPixmapPrivate, 0))
+ return;
+ }
#endif
+ }
+ }
ShmSegType = CreateNewResourceType(ShmDetachSegment);
- ShmPixType = CreateNewResourceType(ShmDetachSegment);
- if (ShmSegType && ShmPixType &&
+ if (ShmSegType &&
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
ProcShmDispatch, SProcShmDispatch,
ShmResetProc, StandardMinorOpcode)))
@@ -143,7 +251,7 @@ ShmExtensionInit()
ShmReqCode = (unsigned char)extEntry->base;
ShmCompletionCode = extEntry->eventBase;
BadShmSegCode = extEntry->errorBase;
- EventSwapVector[ShmCompletionCode] = SShmCompletionEvent;
+ EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
}
}
@@ -177,6 +285,41 @@ ShmSetPixmapFormat(pScreen, format)
shmPixFormat[pScreen->myNum] = format;
}
+static Bool
+ShmDestroyPixmap (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ Bool ret;
+ if (pPixmap->refcnt == 1)
+ {
+ ShmDescPtr shmdesc;
+#ifdef PIXPRIV
+ shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
+#else
+ char *base = (char *) pPixmap->devPrivate.ptr;
+
+ if (base != (pointer) (pPixmap + 1))
+ {
+ for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next)
+ {
+ if (shmdesc->addr <= base && base <= shmdesc->addr + shmdesc->size)
+ break;
+ }
+ }
+ else
+ shmdesc = 0;
+#endif
+ if (shmdesc)
+ ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
+ }
+
+ pScreen->DestroyPixmap = destroyPixmap[pScreen->myNum];
+ ret = (*pScreen->DestroyPixmap) (pPixmap);
+ destroyPixmap[pScreen->myNum] = pScreen->DestroyPixmap;
+ pScreen->DestroyPixmap = ShmDestroyPixmap;
+ return ret;
+}
+
void
ShmRegisterFbFuncs(pScreen)
ScreenPtr pScreen;
@@ -188,7 +331,6 @@ static int
ProcShmQueryVersion(client)
register ClientPtr client;
{
- REQUEST(xShmQueryVersionReq);
xShmQueryVersionReply rep;
register int n;
@@ -214,6 +356,47 @@ ProcShmQueryVersion(client)
return (client->noClientException);
}
+/*
+ * Simulate the access() system call for a shared memory segement,
+ * using the credentials from the client if available
+ */
+static int
+shm_access(ClientPtr client, struct ipc_perm *perm, int readonly)
+{
+ int uid, gid;
+ mode_t mask;
+
+ if (LocalClientCred(client, &uid, &gid) != -1) {
+
+ /* User id 0 always gets access */
+ if (uid == 0) {
+ return 0;
+ }
+ /* Check the owner */
+ if (perm->uid == uid || perm->cuid == uid) {
+ mask = S_IRUSR;
+ if (!readonly) {
+ mask |= S_IWUSR;
+ }
+ return (perm->mode & mask) == mask ? 0 : -1;
+ }
+ /* Check the group */
+ if (perm->gid == gid || perm->cgid == gid) {
+ mask = S_IRGRP;
+ if (!readonly) {
+ mask |= S_IWGRP;
+ }
+ return (perm->mode & mask) == mask ? 0 : -1;
+ }
+ }
+ /* Otherwise, check everyone else */
+ mask = S_IROTH;
+ if (!readonly) {
+ mask |= S_IWOTH;
+ }
+ return (perm->mode & mask) == mask ? 0 : -1;
+}
+
static int
ProcShmAttach(client)
register ClientPtr client;
@@ -252,6 +435,17 @@ ProcShmAttach(client)
xfree(shmdesc);
return BadAccess;
}
+
+ /* The attach was performed with root privs. We must
+ * do manual checking of access rights for the credentials
+ * of the client */
+
+ if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
+ shmdt(shmdesc->addr);
+ xfree(shmdesc);
+ return BadAccess;
+ }
+
shmdesc->shmid = stuff->shmid;
shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
@@ -342,7 +536,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
PixmapPtr pPixmap;
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
- /*XXX*/depth, PixmapBytePad(w, depth), (pointer)data);
+ BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
if (!pPixmap)
return;
if (format == XYBitmap)
@@ -358,6 +552,251 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
data);
}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShmPutImage(register ClientPtr client)
+{
+ int j, result = 0, orig_x, orig_y;
+ PanoramiXRes *draw, *gc;
+ Bool sendEvent, isRoot;
+
+ REQUEST(xShmPutImageReq);
+ REQUEST_SIZE_MATCH(xShmPutImageReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ orig_x = stuff->dstX;
+ orig_y = stuff->dstY;
+ sendEvent = stuff->sendEvent;
+ stuff->sendEvent = 0;
+ FOR_NSCREENS(j) {
+ if(!j) stuff->sendEvent = sendEvent;
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->dstX = orig_x - panoramiXdataPtr[j].x;
+ stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ }
+ result = ProcShmPutImage(client);
+ if(result != client->noClientException) break;
+ }
+ return(result);
+}
+
+static int
+ProcPanoramiXShmGetImage(ClientPtr client)
+{
+ PanoramiXRes *draw;
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDraw;
+ xShmGetImageReply xgi;
+ ShmDescPtr shmdesc;
+ int i, x, y, w, h, format;
+ Mask plane = 0, planemask;
+ long lenPer = 0, length, widthBytesLine;
+ Bool isRoot;
+
+ REQUEST(xShmGetImageReq);
+
+ REQUEST_SIZE_MATCH(xShmGetImageReq);
+
+ if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
+ client->errorValue = stuff->format;
+ return(BadValue);
+ }
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if (draw->type == XRT_PIXMAP)
+ return ProcShmGetImage(client);
+
+ VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+
+ x = stuff->x;
+ y = stuff->y;
+ w = stuff->width;
+ h = stuff->height;
+ format = stuff->format;
+ planemask = stuff->planeMask;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ if(isRoot) {
+ if( /* check for being onscreen */
+ x < 0 || x + w > PanoramiXPixWidth ||
+ y < 0 || y + h > PanoramiXPixHeight )
+ return(BadMatch);
+ } else {
+ if( /* check for being onscreen */
+ panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
+ panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
+ panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
+ panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ /* check for being inside of border */
+ x < - wBorderWidth((WindowPtr)pDraw) ||
+ x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
+ y < -wBorderWidth((WindowPtr)pDraw) ||
+ y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
+ return(BadMatch);
+ }
+
+ drawables[0] = pDraw;
+ for(i = 1; i < PanoramiXNumScreens; i++)
+ VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+
+ xgi.visual = wVisual(((WindowPtr)pDraw));
+ xgi.type = X_Reply;
+ xgi.length = 0;
+ xgi.sequenceNumber = client->sequence;
+ xgi.depth = pDraw->depth;
+
+ if(format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(w, pDraw->depth);
+ length = widthBytesLine * h;
+ } else {
+ widthBytesLine = PixmapBytePad(w, 1);
+ lenPer = widthBytesLine * h;
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ length = lenPer * Ones(planemask & (plane | (plane - 1)));
+ }
+
+ VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
+ xgi.size = length;
+
+ if (length == 0) {/* nothing to do */ }
+ else if (format == ZPixmap) {
+ XineramaGetImageData(drawables, x, y, w, h, format, planemask,
+ shmdesc->addr + stuff->offset,
+ widthBytesLine, isRoot);
+ } else {
+
+ length = stuff->offset;
+ for (; plane; plane >>= 1) {
+ if (planemask & plane) {
+ XineramaGetImageData(drawables, x, y, w, h,
+ format, plane, shmdesc->addr + length,
+ widthBytesLine, isRoot);
+ length += lenPer;
+ }
+ }
+ }
+
+ if (client->swapped) {
+ register int n;
+ swaps(&xgi.sequenceNumber, n);
+ swapl(&xgi.length, n);
+ swapl(&xgi.visual, n);
+ swapl(&xgi.size, n);
+ }
+ WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+
+ return(client->noClientException);
+}
+
+static int
+ProcPanoramiXShmCreatePixmap(client)
+ register ClientPtr client;
+{
+ ScreenPtr pScreen = NULL;
+ PixmapPtr pMap = NULL;
+ DrawablePtr pDraw;
+ DepthPtr pDepth;
+ int i, j, result;
+ ShmDescPtr shmdesc;
+ REQUEST(xShmCreatePixmapReq);
+ PanoramiXRes *newPix;
+
+ REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
+ client->errorValue = stuff->pid;
+ if (!sharedPixmaps)
+ return BadImplementation;
+ LEGAL_NEW_RESOURCE(stuff->pid, client);
+ VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+ if (!stuff->width || !stuff->height)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ if (stuff->depth != 1)
+ {
+ pDepth = pDraw->pScreen->allowedDepths;
+ for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
+ return BadValue;
+ }
+CreatePmap:
+ VERIFY_SHMSIZE(shmdesc, stuff->offset,
+ PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
+ client);
+
+ if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newPix->type = XRT_PIXMAP;
+ newPix->u.pix.shared = TRUE;
+ newPix->info[0].id = stuff->pid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newPix->info[j].id = FakeClientID(client->index);
+
+ result = (client->noClientException);
+
+ FOR_NSCREENS(j) {
+ pScreen = screenInfo.screens[j];
+
+ pMap = (*shmFuncs[j]->CreatePixmap)(pScreen,
+ stuff->width, stuff->height, stuff->depth,
+ shmdesc->addr + stuff->offset);
+
+ if (pMap) {
+#ifdef PIXPRIV
+ pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
+#endif
+ shmdesc->refcnt++;
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = newPix->info[j].id;
+ if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {
+ (*pScreen->DestroyPixmap)(pMap);
+ result = BadAlloc;
+ break;
+ }
+ } else {
+ result = BadAlloc;
+ break;
+ }
+ }
+
+ if(result == BadAlloc) {
+ while(j--) {
+ (*pScreen->DestroyPixmap)(pMap);
+ FreeResource(newPix->info[j].id, RT_NONE);
+ }
+ xfree(newPix);
+ } else
+ AddResource(stuff->pid, XRT_PIXMAP, newPix);
+
+ return result;
+}
+
+#endif
+
static int
ProcShmPutImage(client)
register ClientPtr client;
@@ -365,11 +804,6 @@ ProcShmPutImage(client)
register GCPtr pGC;
register DrawablePtr pDraw;
long length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long lengthProto;
- char *tmpImage;
- int tmpAlloced = 0;
-#endif
ShmDescPtr shmdesc;
REQUEST(xShmPutImageReq);
@@ -383,9 +817,6 @@ ProcShmPutImage(client)
if (stuff->depth != 1)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
-#endif
}
else if (stuff->format == XYPixmap)
{
@@ -393,19 +824,12 @@ ProcShmPutImage(client)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
length *= stuff->depth;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
- lengthProto *= stuff->depth;
-#endif
}
else if (stuff->format == ZPixmap)
{
if (pDraw->depth != stuff->depth)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth);
-#endif
}
else
{
@@ -413,13 +837,8 @@ ProcShmPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto * stuff->totalHeight,
- client);
-#else
VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
client);
-#endif
if (stuff->srcX > stuff->totalWidth)
{
client->errorValue = stuff->srcX;
@@ -441,63 +860,6 @@ ProcShmPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* handle 64 bit case where protocol may pad to 32 and we want 64
- * In this case, length is what the server wants and lengthProto is
- * what the protocol thinks it is. If the the two are different,
- * copy the protocol version (i.e. the memory shared between the
- * server and the client) to a version with a scanline pad of 64.
- */
- if (length != lengthProto)
- {
- register int i;
- char * stuffptr, /* pointer into protocol data */
- * tmpptr; /* new location to copy to */
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
- return (BadAlloc);
- tmpAlloced = 1;
-
- bzero(tmpImage,length*stuff->totalHeight);
-
- if (stuff->format == XYPixmap)
- {
- int lineBytes = PixmapBytePad(stuff->totalWidth, 1);
- int lineBytesProto = PixmapBytePadProto(stuff->totalWidth, 1);
- int depth = stuff->depth;
-
- stuffptr = shmdesc->addr + stuff->offset ;
- tmpptr = tmpImage;
- for (i = 0; i < stuff->totalHeight*stuff->depth;
- stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
- bcopy(stuffptr,tmpptr,lineBytesProto);
- }
- else
- {
- for (i = 0,
- stuffptr = shmdesc->addr + stuff->offset,
- tmpptr=tmpImage;
- i < stuff->totalHeight;
- stuffptr += lengthProto,tmpptr += length, i++)
- bcopy(stuffptr,tmpptr,lengthProto);
- }
- }
- /* handle 64-bit case where stuff is not 64-bit aligned
- */
- else if ((unsigned long)(shmdesc->addr+stuff->offset) &
- (sizeof(long)-1))
- {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
- return (BadAlloc);
- tmpAlloced = 1;
- bcopy((char *)(shmdesc->addr+stuff->offset),
- tmpImage,
- length*stuff->totalHeight);
- }
- else
- tmpImage = (char *)(shmdesc->addr+stuff->offset);
-#endif
-
if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
((stuff->format != ZPixmap) &&
(stuff->srcX < screenInfo.bitmapScanlinePad) &&
@@ -509,11 +871,7 @@ ProcShmPutImage(client)
stuff->dstX, stuff->dstY,
stuff->totalWidth, stuff->srcHeight,
stuff->srcX, stuff->format,
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- tmpImage +
-#else
shmdesc->addr + stuff->offset +
-#endif
(stuff->srcY * length));
else
(*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
@@ -522,12 +880,7 @@ ProcShmPutImage(client)
stuff->srcX, stuff->srcY,
stuff->srcWidth, stuff->srcHeight,
stuff->dstX, stuff->dstY,
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- tmpImage);
-
-#else
shmdesc->addr + stuff->offset);
-#endif
if (stuff->sendEvent)
{
@@ -543,12 +896,7 @@ ProcShmPutImage(client)
WriteEventsToClient(client, 1, (xEvent *) &ev);
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if (tmpAlloced)
- DEALLOCATE_LOCAL(tmpImage);
-#endif
-
- return (client->noClientException);
+ return (client->noClientException);
}
@@ -558,17 +906,11 @@ ProcShmGetImage(client)
register ClientPtr client;
{
register DrawablePtr pDraw;
- long lenPer, length;
- Mask plane;
+ long lenPer = 0, length;
+ Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int n;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLine,widthBytesLineProto;
- long lenPerProto,lengthProto;
- char *tmpImage;
- int tmpAlloced = 0;
-#endif
REQUEST(xShmGetImageReq);
@@ -616,43 +958,18 @@ ProcShmGetImage(client)
xgi.depth = pDraw->depth;
if(stuff->format == ZPixmap)
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
- length = widthBytesLine * stuff->height;
- widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
- lengthProto = widthBytesLineProto * stuff->height;
-#else
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
-#endif
}
else
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLine = PixmapBytePad(stuff->width, 1);
- lenPer = widthBytesLine * stuff->height;
- plane = ((Mask)1) << (pDraw->depth - 1);
- /* only planes asked for */
- length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
-
- widthBytesLineProto = PixmapBytePadProto(stuff->width, 1);
- lenPerProto = widthBytesLineProto * stuff->height;
- lengthProto = lenPerProto * Ones(stuff->planeMask &
- (plane | (plane - 1)));
-#else
lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */
length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client);
- xgi.size = lengthProto;
-#else
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
-#endif
if (length == 0)
{
@@ -660,105 +977,25 @@ ProcShmGetImage(client)
}
else if (stuff->format == ZPixmap)
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* check for protocol/server padding differences.
- */
- if ((widthBytesLine != widthBytesLineProto) ||
- ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1)))
- {
- /* temp stuff for 64 bit alignment stuff */
- register char * bufPtr, * protoPtr;
- register int i;
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
- return (BadAlloc);
- tmpAlloced = 1;
-
- (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, stuff->planeMask,
- tmpImage);
-
- /* for 64-bit server, convert image to pad to 32 bits
- */
- bzero(shmdesc->addr + stuff->offset,lengthProto);
-
- for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset;
- i < stuff->height;
- bufPtr += widthBytesLine,protoPtr += widthBytesLineProto,
- i++)
- bcopy(bufPtr,protoPtr,widthBytesLineProto);
- }
- else
- {
- (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, stuff->planeMask,
- shmdesc->addr + stuff->offset);
- }
-#else
(*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset);
-#endif
}
else
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* check for protocol/server padding differences.
- */
- if ((widthBytesLine != widthBytesLineProto) ||
- ((unsigned long)shmdesc->addr + stuff->offset &
- (sizeof(long)-1)))
- {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
- return (BadAlloc);
- tmpAlloced = 1;
- }
-#endif
length = stuff->offset;
for (; plane; plane >>= 1)
{
if (stuff->planeMask & plane)
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ((widthBytesLine != widthBytesLineProto) ||
- ((unsigned long)shmdesc->addr + stuff->offset &
- (sizeof(long)-1)))
- {
- /* get image for each plane.
- */
- (*pDraw->pScreen->GetImage)(pDraw,
- stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, plane,
- tmpImage);
-
- /* for 64-bit server, convert image to pad to 32 bits */
- bzero(shmdesc->addr+length, widthBytesLine);
- bcopy(tmpImage, shmdesc->addr+length, widthBytesLineProto);
- /* increment length */
- length += lenPerProto;
- }
- else /* no diff between protocol and server */
- {
- (*pDraw->pScreen->GetImage)(pDraw,
- stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, plane,
- shmdesc->addr + length);
- length += lenPer;
- }
-#else
(*pDraw->pScreen->GetImage)(pDraw,
stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, plane,
shmdesc->addr + length);
length += lenPer;
-#endif
}
}
}
@@ -771,11 +1008,6 @@ ProcShmGetImage(client)
}
WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if (tmpAlloced)
- DEALLOCATE_LOCAL(tmpImage);
-#endif
-
return(client->noClientException);
}
@@ -794,8 +1026,10 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
return NullPixmap;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
- /*XXX*/depth, PixmapBytePad(width, depth), (pointer)addr))
+ BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
+ (*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap;
+ }
return pPixmap;
}
@@ -841,14 +1075,15 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap)
{
+#ifdef PIXPRIV
+ pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
+#endif
+ shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
{
- shmdesc->refcnt++;
- if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc))
- return(client->noClientException);
- FreeResource(stuff->pid, RT_NONE);
+ return(client->noClientException);
}
}
return (BadAlloc);
@@ -868,11 +1103,23 @@ ProcShmDispatch (client)
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmPutImage(client);
+#endif
return ProcShmPutImage(client);
case X_ShmGetImage:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmGetImage(client);
+#endif
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
- return ProcShmCreatePixmap(client);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmCreatePixmap(client);
+#endif
+ return ProcShmCreatePixmap(client);
default:
return BadRequest;
}
diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 292924ed6..eb2b96a76 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -25,9 +25,11 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/Xext/sleepuntil.c,v 3.5 2001/12/14 19:58:51 dawes Exp $ */
/* dixsleep.c - implement millisecond timeouts for X clients */
+#include "sleepuntil.h"
#include "X.h"
#include "Xmd.h"
#include "misc.h"
@@ -41,7 +43,13 @@ typedef struct _Sertafied {
TimeStamp revive;
ClientPtr pClient;
XID id;
- void (*notifyFunc)();
+ void (*notifyFunc)(
+#if NeedNestedPrototypes
+ ClientPtr /* client */,
+ pointer /* closure */
+#endif
+ );
+
pointer closure;
} SertafiedRec, *SertafiedPtr;
@@ -49,11 +57,35 @@ static SertafiedPtr pPending;
static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered;
static int SertafiedGeneration;
-static void ClientAwaken();
-static int SertafiedDelete();
-static void SertafiedBlockHandler();
-static void SertafiedWakeupHandler();
+static void ClientAwaken(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ pointer /* closure */
+#endif
+);
+static int SertafiedDelete(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+static void SertafiedBlockHandler(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ OSTimePtr /* wt */,
+ pointer /* LastSelectMask */
+#endif
+);
+static void SertafiedWakeupHandler(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ int /* i */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+int
ClientSleepUntil (client, revive, notifyFunc, closure)
ClientPtr client;
TimeStamp *revive;
@@ -152,7 +184,7 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pointer LastSelectMask;
{
SertafiedPtr pReq, pNext;
- unsigned long newdelay, olddelay;
+ unsigned long delay;
TimeStamp now;
if (!pPending)
@@ -177,8 +209,8 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pReq = pPending;
if (!pReq)
return;
- newdelay = pReq->revive.milliseconds - now.milliseconds;
- AdjustWaitForDelay (wt, newdelay);
+ delay = pReq->revive.milliseconds - now.milliseconds;
+ AdjustWaitForDelay (wt, delay);
}
static void
diff --git a/Xext/sync.c b/Xext/sync.c
index 8274d2522..079a804e3 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -50,10 +50,10 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
+/* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.11 2001/12/14 19:58:51 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "Xmd.h"
@@ -67,6 +67,15 @@ PERFORMANCE OF THIS SOFTWARE.
#include "sync.h"
#include "syncstr.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <stdio.h>
+#if !defined(WIN32) && !defined(Lynx)
+#include <sys/time.h>
+#endif
+#endif
+
/*
* Local Global Variables
*/
@@ -87,13 +96,254 @@ static SyncCounter **SysCounterList = NULL;
#define XSyncCAAllTrigger \
(XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
+static int
+FreeAlarm(
+#if NeedFunctionPrototypes
+ pointer /* addr */,
+ XID /* id */
+#endif
+);
+
+static int
+FreeAlarmClient(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+
+static int
+FreeAwait(
+#if NeedFunctionPrototypes
+ pointer /* addr */,
+ XID /* id */
+#endif
+);
+
+static void
+ServertimeBracketValues(
+#if NeedFunctionPrototypes
+ pointer /* pCounter */,
+ CARD64 * /* pbracket_less */,
+ CARD64 * /* pbracket_greater */
+#endif
+);
+
+static void
+ServertimeQueryValue(
+#if NeedFunctionPrototypes
+ pointer /* pCounter */,
+ CARD64 * /* pValue_return */
+#endif
+);
+
+static void
+ServertimeWakeupHandler(
+#if NeedFunctionPrototypes
+ pointer /* env */,
+ int /* rc */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+static int
+SyncInitTrigger(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncTrigger * /* pTrigger */,
+ XSyncCounter /* counter */,
+ Mask /* changes */
+#endif
+);
+
+static void
+SAlarmNotifyEvent(
+#if NeedFunctionPrototypes
+ xSyncAlarmNotifyEvent * /* from */,
+ xSyncAlarmNotifyEvent * /* to */
+#endif
+);
+
+static void
+SCounterNotifyEvent(
+#if NeedFunctionPrototypes
+ xSyncCounterNotifyEvent * /* from */,
+ xSyncCounterNotifyEvent * /* to */
+#endif
+);
+
+static void
+ServertimeBlockHandler(
+#if NeedFunctionPrototypes
+ pointer /* env */,
+ struct timeval ** /* wt */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+static int
+SyncAddTriggerToCounter(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+extern void
+SyncAlarmCounterDestroyed(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static void
+SyncAlarmTriggerFired(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static void
+SyncAwaitTriggerFired(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static int
+SyncChangeAlarmAttributes(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncAlarm * /* pAlarm */,
+ Mask /* mask */,
+ CARD32 * /* values */
+#endif
+);
+
+static Bool
+SyncCheckTriggerNegativeComparison(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerNegativeTransition(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerPositiveComparison(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerPositiveTransition(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static SyncCounter *
+SyncCreateCounter(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ XSyncCounter /* id */,
+ CARD64 /* initialvalue */
+#endif
+);
+
static void SyncComputeBracketValues(
#if NeedFunctionPrototypes
- SyncCounter * /* pCounter */,
- Bool /* startOver */
+ SyncCounter * /* pCounter */,
+ Bool /* startOver */
#endif
);
+static void
+SyncDeleteTriggerFromCounter(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static Bool
+SyncEventSelectForAlarm(
+#if NeedFunctionPrototypes
+ SyncAlarm * /* pAlarm */,
+ ClientPtr /* client */,
+ Bool /* wantevents */
+#endif
+);
+
+static void
+SyncInitServerTime(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+static void
+SyncResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static void
+SyncSendAlarmNotifyEvents(
+#if NeedFunctionPrototypes
+ SyncAlarm * /* pAlarm */
+#endif
+);
+
+static void
+SyncSendCounterNotifyEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncAwait ** /* ppAwait */,
+ int /* num_events */
+#endif
+);
+
+static DISPATCH_PROC(ProcSyncAwait);
+static DISPATCH_PROC(ProcSyncChangeAlarm);
+static DISPATCH_PROC(ProcSyncChangeCounter);
+static DISPATCH_PROC(ProcSyncCreateAlarm);
+static DISPATCH_PROC(ProcSyncCreateCounter);
+static DISPATCH_PROC(ProcSyncDestroyAlarm);
+static DISPATCH_PROC(ProcSyncDestroyCounter);
+static DISPATCH_PROC(ProcSyncDispatch);
+static DISPATCH_PROC(ProcSyncGetPriority);
+static DISPATCH_PROC(ProcSyncInitialize);
+static DISPATCH_PROC(ProcSyncListSystemCounters);
+static DISPATCH_PROC(ProcSyncQueryAlarm);
+static DISPATCH_PROC(ProcSyncQueryCounter);
+static DISPATCH_PROC(ProcSyncSetCounter);
+static DISPATCH_PROC(ProcSyncSetPriority);
+static DISPATCH_PROC(SProcSyncAwait);
+static DISPATCH_PROC(SProcSyncChangeAlarm);
+static DISPATCH_PROC(SProcSyncChangeCounter);
+static DISPATCH_PROC(SProcSyncCreateAlarm);
+static DISPATCH_PROC(SProcSyncCreateCounter);
+static DISPATCH_PROC(SProcSyncDestroyAlarm);
+static DISPATCH_PROC(SProcSyncDestroyCounter);
+static DISPATCH_PROC(SProcSyncDispatch);
+static DISPATCH_PROC(SProcSyncGetPriority);
+static DISPATCH_PROC(SProcSyncInitialize);
+static DISPATCH_PROC(SProcSyncListSystemCounters);
+static DISPATCH_PROC(SProcSyncQueryAlarm);
+static DISPATCH_PROC(SProcSyncQueryCounter);
+static DISPATCH_PROC(SProcSyncSetCounter);
+static DISPATCH_PROC(SProcSyncSetPriority);
+
/* Each counter maintains a simple linked list of triggers that are
* interested in the counter. The two functions below are used to
* delete and add triggers on this list.
@@ -462,26 +712,26 @@ SyncAlarmTriggerFired(pTrigger)
{
Bool overflow;
CARD64 oldvalue;
- SyncTrigger *pTrigger = &pAlarm->trigger;
+ SyncTrigger *paTrigger = &pAlarm->trigger;
/* "The alarm is updated by repeatedly adding delta to the
* value of the trigger and re-initializing it until it
* becomes FALSE."
*/
- oldvalue = pTrigger->test_value;
+ oldvalue = paTrigger->test_value;
/* XXX really should do something smarter here */
do
{
- XSyncValueAdd(&pTrigger->test_value, pTrigger->test_value,
+ XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
pAlarm->delta, &overflow);
} while (!overflow &&
- (*pTrigger->CheckTrigger)(pTrigger,
- pTrigger->pCounter->value));
+ (*paTrigger->CheckTrigger)(paTrigger,
+ paTrigger->pCounter->value));
- new_test_value = pTrigger->test_value;
- pTrigger->test_value = oldvalue;
+ new_test_value = paTrigger->test_value;
+ paTrigger->test_value = oldvalue;
/* "If this update would cause value to fall outside the range
* for an INT64...no change is made to value (test-value) and
@@ -710,7 +960,6 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
Mask mask;
CARD32 *values;
{
- SyncAlarmClientList *pClients;
int status;
XSyncCounter counter;
Mask origmask = mask;
@@ -719,9 +968,9 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
while (mask)
{
- int index = lowbit(mask);
- mask &= ~index;
- switch (index)
+ int index2 = lowbit(mask);
+ mask &= ~index2;
+ switch (index2)
{
case XSyncCACounter:
mask &= ~XSyncCACounter;
@@ -998,7 +1247,6 @@ FreeAlarm(addr, id)
XID id;
{
SyncAlarm *pAlarm = (SyncAlarm *) addr;
- SyncAlarmClientList *pClient;
pAlarm->state = XSyncAlarmDestroyed;
@@ -1139,7 +1387,6 @@ static int
ProcSyncInitialize(client)
ClientPtr client;
{
- REQUEST(xSyncInitializeReq);
xSyncInitializeReply rep;
int n;
@@ -1166,10 +1413,9 @@ static int
ProcSyncListSystemCounters(client)
ClientPtr client;
{
- REQUEST(xSyncListSystemCountersReq);
xSyncListSystemCountersReply rep;
int i, len;
- xSyncSystemCounter *list, *walklist;
+ xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
@@ -1318,7 +1564,6 @@ ProcSyncCreateCounter(client)
ClientPtr client;
{
REQUEST(xSyncCreateCounterReq);
- SyncCounter *pCounter;
CARD64 initial;
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
@@ -1440,9 +1685,8 @@ ProcSyncAwait(client)
{
REQUEST(xSyncAwaitReq);
int len, items;
- int n, i;
+ int i;
xSyncWaitCondition *pProtocolWaitConds;
- int ret;
SyncAwaitUnion *pAwaitUnion;
SyncAwait *pAwait;
int status;
@@ -1606,7 +1850,6 @@ ProcSyncCreateAlarm(client)
REQUEST(xSyncCreateAlarmReq);
SyncAlarm *pAlarm;
int status;
- int i;
unsigned long len, vmask;
SyncTrigger *pTrigger;
@@ -2063,8 +2306,6 @@ static int
SProcSyncDispatch(client)
ClientPtr client;
{
- int n;
-
REQUEST(xReq);
switch (stuff->data)
@@ -2154,8 +2395,6 @@ SyncResetProc(extEntry)
}
-static void SyncInitServerTime();
-
/*
* ** Initialise the extension.
*/
@@ -2188,8 +2427,8 @@ SyncExtensionInit()
SyncReqCode = extEntry->base;
SyncEventBase = extEntry->eventBase;
SyncErrorBase = extEntry->errorBase;
- EventSwapVector[SyncEventBase + XSyncCounterNotify] = SCounterNotifyEvent;
- EventSwapVector[SyncEventBase + XSyncAlarmNotify] = SAlarmNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
/*
* Although SERVERTIME is implemented by the OS layer, we initialise it
@@ -2211,9 +2450,6 @@ SyncExtensionInit()
*/
-#ifndef WIN32
-#include <sys/time.h>
-#endif
static pointer ServertimeCounter;
static XSyncValue Now;
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 4977fdf88..1d3b416db 100644
--- a/Xext/xcmisc.c
+++ b/Xext/xcmisc.c
@@ -26,28 +26,44 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xcmisc.c,v 3.5 2001/12/14 19:58:51 dawes Exp $ */
+#define NEED_EVENTS
+#define NEED_REPLIES
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
+#include "swaprep.h"
#include "xcmiscstr.h"
static unsigned char XCMiscCode;
-static int ProcXCMiscDispatch(), SProcXCMiscDispatch();
-static void XCMiscResetProc();
-extern void Swap32Write(); /* XXX should be in header file */
+
+static void XCMiscResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcXCMiscDispatch);
+static DISPATCH_PROC(ProcXCMiscGetVersion);
+static DISPATCH_PROC(ProcXCMiscGetXIDList);
+static DISPATCH_PROC(ProcXCMiscGetXIDRange);
+static DISPATCH_PROC(SProcXCMiscDispatch);
+static DISPATCH_PROC(SProcXCMiscGetVersion);
+static DISPATCH_PROC(SProcXCMiscGetXIDList);
+static DISPATCH_PROC(SProcXCMiscGetXIDRange);
void
XCMiscExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XCMiscExtensionName, 0, 0,
+ if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
- XCMiscResetProc, StandardMinorOpcode))
+ XCMiscResetProc, StandardMinorOpcode)) != 0)
XCMiscCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
}
@@ -63,7 +79,6 @@ static int
ProcXCMiscGetVersion(client)
register ClientPtr client;
{
- REQUEST(xXCMiscGetVersionReq);
xXCMiscGetVersionReply rep;
register int n;
@@ -86,7 +101,6 @@ static int
ProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
- REQUEST(xXCMiscGetXIDRangeReq);
xXCMiscGetXIDRangeReply rep;
register int n;
XID min_id, max_id;
@@ -137,7 +151,7 @@ ProcXCMiscGetXIDList(client)
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
if (count)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
DEALLOCATE_LOCAL(pids);
diff --git a/Xext/xprint.c b/Xext/xprint.c
index 6e2013140..db9a25135 100644
--- a/Xext/xprint.c
+++ b/Xext/xprint.c
@@ -1,4 +1,4 @@
-/* $Xorg: xprint.c,v 1.5 2001/03/05 20:42:36 pookie Exp $ */
+/* $Xorg: xprint.c,v 1.5 2001/03/05 20:42:26 pookie Exp $ */
/*
(c) Copyright 1996 Hewlett-Packard Company
(c) Copyright 1996 International Business Machines Corp.
@@ -64,8 +64,11 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/xprint.c,v 1.13 2001/11/23 19:21:31 dawes Exp $ */
+#define _XP_PRINT_SERVER_
#include "X.h"
+#include "Xos.h"
#define NEED_EVENTS
#include "Xproto.h"
#undef NEED_EVENTS
@@ -76,105 +79,90 @@ copyright holders.
#include "extnsionst.h"
#include "dixstruct.h"
#include "Xatom.h"
-#define _XP_PRINT_SERVER_
#include "Print.h"
#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
#include "../Xprint/DiPrint.h"
-
-extern WindowPtr *WindowTable; /* declared in dix:globals.c */
-
-extern WindowPtr XpDiValidatePrinter();
-extern char *XpDiGetDriverName();
-extern char *XpGetAttributes();
-extern char *XpGetOneAttribute();
-extern int XpRehashPrinterList();
-extern void XpSetFontResFunc();
-
-static void XpResetProc();
-
-static int ProcXpDispatch();
-static int ProcXpSwappedDispatch();
-
-static int ProcXpQueryVersion();
-static int ProcXpGetPrinterList();
-static int ProcXpCreateContext();
-static int ProcXpSetContext();
-static int ProcXpGetContext();
-static int ProcXpDestroyContext();
-static int ProcXpGetContextScreen();
-static int ProcXpStartJob();
-static int ProcXpEndJob();
-static int ProcXpStartDoc();
-static int ProcXpEndDoc();
-static int ProcXpStartPage();
-static int ProcXpEndPage();
-static int ProcXpSelectInput();
-static int ProcXpInputSelected();
-static int ProcXpPutDocumentData();
-static int ProcXpGetDocumentData();
-static int ProcXpGetAttributes();
-static int ProcXpGetOneAttribute();
-static int ProcXpSetAttributes();
-static int ProcXpRehashPrinterList();
-static int ProcXpQueryScreens();
-static int ProcXpGetPageDimensions();
-static int ProcXpSetImageResolution();
-static int ProcXpGetImageResolution();
-
-static void SwapXpNotifyEvent();
-static void SwapXpAttributeEvent();
-
-static int SProcXpGetPrinterList();
-static int SProcXpCreateContext();
-static int SProcXpSetContext();
-static int SProcXpGetContext();
-static int SProcXpDestroyContext();
-static int SProcXpGetContextScreen();
-static int SProcXpStartJob();
-static int SProcXpEndJob();
-static int SProcXpStartDoc();
-static int SProcXpEndDoc();
-static int SProcXpStartPage();
-static int SProcXpEndPage();
-static int SProcXpSelectInput();
-static int SProcXpInputSelected();
-static int SProcXpPutDocumentData();
-static int SProcXpGetDocumentData();
-static int SProcXpGetAttributes();
-static int SProcXpGetOneAttribute();
-static int SProcXpSetAttributes();
-static int SProcXpRehashPrinterList();
-static int SProcXpGetPageDimensions();
-static int SProcXpSetImageResolution();
-static int SProcXpGetImageResolution();
-
-static void SendXpNotify();
-static void SendAttributeNotify();
-static int XpFreeClient();
-static int XpFreeContext();
-static int XpFreePage();
-static int XpFreeEvents();
-static Bool XpCloseScreen();
-static CARD32 GetAllEventMasks();
-static struct _XpEvent *AddEventRec();
-static void DeleteEventRec();
-static struct _XpEvent *FindEventRec();
-static struct _XpClient *CreateXpClient();
-static void FreeXpClient();
-static void InitContextPrivates();
-static void ResetContextPrivates();
-static struct _XpClient *FindClient();
-static struct _XpClient *AcquireClient();
+#include "../Xprint/attributes.h"
+
+static void XpResetProc(ExtensionEntry *);
+
+static int ProcXpDispatch(ClientPtr);
+static int ProcXpSwappedDispatch(ClientPtr);
+
+static int ProcXpQueryVersion(ClientPtr);
+static int ProcXpGetPrinterList(ClientPtr);
+static int ProcXpCreateContext(ClientPtr);
+static int ProcXpSetContext(ClientPtr);
+static int ProcXpGetContext(ClientPtr);
+static int ProcXpDestroyContext(ClientPtr);
+static int ProcXpGetContextScreen(ClientPtr);
+static int ProcXpStartJob(ClientPtr);
+static int ProcXpEndJob(ClientPtr);
+static int ProcXpStartDoc(ClientPtr);
+static int ProcXpEndDoc(ClientPtr);
+static int ProcXpStartPage(ClientPtr);
+static int ProcXpEndPage(ClientPtr);
+static int ProcXpSelectInput(ClientPtr);
+static int ProcXpInputSelected(ClientPtr);
+static int ProcXpPutDocumentData(ClientPtr);
+static int ProcXpGetDocumentData(ClientPtr);
+static int ProcXpGetAttributes(ClientPtr);
+static int ProcXpGetOneAttribute(ClientPtr);
+static int ProcXpSetAttributes(ClientPtr);
+static int ProcXpRehashPrinterList(ClientPtr);
+static int ProcXpQueryScreens(ClientPtr);
+static int ProcXpGetPageDimensions(ClientPtr);
+static int ProcXpSetImageResolution(ClientPtr);
+static int ProcXpGetImageResolution(ClientPtr);
+
+static void SwapXpNotifyEvent(xPrintPrintEvent *, xPrintPrintEvent *);
+static void SwapXpAttributeEvent(xPrintAttributeEvent *, xPrintAttributeEvent *);
+
+static int SProcXpGetPrinterList(ClientPtr);
+static int SProcXpCreateContext(ClientPtr);
+static int SProcXpSetContext(ClientPtr);
+static int SProcXpGetContext(ClientPtr);
+static int SProcXpDestroyContext(ClientPtr);
+static int SProcXpGetContextScreen(ClientPtr);
+static int SProcXpStartJob(ClientPtr);
+static int SProcXpEndJob(ClientPtr);
+static int SProcXpStartDoc(ClientPtr);
+static int SProcXpEndDoc(ClientPtr);
+static int SProcXpStartPage(ClientPtr);
+static int SProcXpEndPage(ClientPtr);
+static int SProcXpSelectInput(ClientPtr);
+static int SProcXpInputSelected(ClientPtr);
+static int SProcXpPutDocumentData(ClientPtr);
+static int SProcXpGetDocumentData(ClientPtr);
+static int SProcXpGetAttributes(ClientPtr);
+static int SProcXpGetOneAttribute(ClientPtr);
+static int SProcXpSetAttributes(ClientPtr);
+static int SProcXpRehashPrinterList(ClientPtr);
+static int SProcXpGetPageDimensions(ClientPtr);
+static int SProcXpSetImageResolution(ClientPtr);
+static int SProcXpGetImageResolution(ClientPtr);
+
+static void SendXpNotify(XpContextPtr, int, int);
+static void SendAttributeNotify(XpContextPtr, int);
+static int XpFreeClient(pointer, XID);
+static int XpFreeContext(pointer, XID);
+static int XpFreePage(pointer, XID);
+static Bool XpCloseScreen(int, ScreenPtr);
+static CARD32 GetAllEventMasks(XpContextPtr);
+static struct _XpClient *CreateXpClient(ClientPtr);
+static void InitContextPrivates(XpContextPtr);
+static void ResetContextPrivates(void);
+static struct _XpClient *FindClient(XpContextPtr, ClientPtr);
+static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr);
typedef struct _driver {
struct _driver *next;
char *name;
- int (* CreateContext)();
+ int (* CreateContext)(XpContextPtr);
} XpDriverRec, *XpDriverPtr;
typedef struct _xpScreen {
- Bool (* CloseScreen)();
+ Bool (* CloseScreen)(int, ScreenPtr);
struct _driver *drivers;
} XpScreenRec, *XpScreenPtr;
@@ -196,6 +184,8 @@ typedef struct _XpClient {
XID contextClientID; /* unneeded sanity check? */
} XpClientRec, *XpClientPtr;
+static void FreeXpClient(XpClientPtr, Bool);
+
/*
* Each StartPage request specifies a window which forms the top level
* window of the page. One of the following structs is created as a
@@ -240,8 +230,7 @@ static XpScreenPtr XpScreens[MAXSCREENS];
static unsigned char XpReqCode;
static int XpEventBase;
static int XpErrorBase;
-static int XpGeneration = 0;
-static int XpWindowPrivateIndex;
+static unsigned long XpGeneration = 0;
static int XpClientPrivateIndex;
/* Variables for the context private machinery.
@@ -293,9 +282,9 @@ static CARD32 allEvents = XPPrintMask | XPAttributeMask;
*/
void
-XpExtensionInit()
+XpExtensionInit(void)
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
int i;
RTclient = CreateNewResourceType(XpFreeClient);
@@ -309,8 +298,8 @@ XpExtensionInit()
XpReqCode = (unsigned char)extEntry->base;
XpEventBase = extEntry->eventBase;
XpErrorBase = extEntry->errorBase;
- EventSwapVector[XpEventBase] = SwapXpNotifyEvent;
- EventSwapVector[XpEventBase+1] = SwapXpAttributeEvent;
+ EventSwapVector[XpEventBase] = (EventSwapPtr) SwapXpNotifyEvent;
+ EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent;
}
if(XpGeneration != serverGeneration)
@@ -347,15 +336,15 @@ XpExtensionInit()
}
static void
-XpResetProc(extEntry)
- ExtensionEntry extEntry;
+XpResetProc(ExtensionEntry *extEntry)
{
- int i;
-
/*
* We can't free up the XpScreens recs here, because extensions are
* closed before screens, and our CloseScreen function uses the XpScreens
* recs.
+
+ int i;
+
for(i = 0; i < MAXSCREENS; i++)
{
if(XpScreens[i] != (XpScreenPtr)NULL)
@@ -366,11 +355,9 @@ XpResetProc(extEntry)
}
static Bool
-XpCloseScreen(index, pScreen)
- int index;
- ScreenPtr pScreen;
+XpCloseScreen(int index, ScreenPtr pScreen)
{
- Bool (* CloseScreen)();
+ Bool (* CloseScreen)(int, ScreenPtr);
CloseScreen = XpScreens[index]->CloseScreen;
if(XpScreens[index] != (XpScreenPtr)NULL)
@@ -399,9 +386,9 @@ XpCloseScreen(index, pScreen)
return (*CloseScreen)(index, pScreen);
}
+#if 0 /* NOT USED */
static void
-FreeScreenEntry(pScreenEntry)
- XpScreenPtr pScreenEntry;
+FreeScreenEntry(XpScreenPtr pScreenEntry)
{
XpDriverPtr pDriver;
@@ -416,6 +403,7 @@ FreeScreenEntry(pScreenEntry)
}
xfree(pScreenEntry);
}
+#endif
/*
* XpRegisterInitFunc tells the print extension which screens
@@ -426,24 +414,20 @@ FreeScreenEntry(pScreenEntry)
* whenever a context gets created for a particular driver on this screen.
*/
void
-XpRegisterInitFunc(pScreen, driverName, initContext)
- ScreenPtr pScreen;
- char *driverName;
- int (*initContext)();
+XpRegisterInitFunc(ScreenPtr pScreen, char *driverName, int (*initContext)(struct _XpContext *))
{
XpDriverPtr pDriver;
- if(XpScreens[pScreen->myNum] == (XpScreenPtr)NULL)
+ if(XpScreens[pScreen->myNum] == 0)
{
if((XpScreens[pScreen->myNum] =
- (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == (XpScreenPtr)NULL)
+ (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == 0)
return;
- XpScreens[pScreen->myNum]->CloseScreen = (Bool(*)())NULL;
- XpScreens[pScreen->myNum]->drivers = (XpDriverPtr)NULL;
+ XpScreens[pScreen->myNum]->CloseScreen = 0;
+ XpScreens[pScreen->myNum]->drivers = 0;
}
- if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) ==
- (XpDriverPtr)NULL)
+ if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) == 0)
return;
pDriver->next = XpScreens[pScreen->myNum]->drivers;
pDriver->name = driverName;
@@ -452,8 +436,7 @@ XpRegisterInitFunc(pScreen, driverName, initContext)
}
static int
-ProcXpDispatch(client)
- ClientPtr client;
+ProcXpDispatch(ClientPtr client)
{
REQUEST(xReq);
@@ -515,8 +498,7 @@ ProcXpDispatch(client)
}
static int
-ProcXpSwappedDispatch(client)
- ClientPtr client;
+ProcXpSwappedDispatch(ClientPtr client)
{
int temp;
REQUEST(xReq);
@@ -581,10 +563,9 @@ ProcXpSwappedDispatch(client)
}
static int
-ProcXpQueryVersion(client)
- ClientPtr client;
+ProcXpQueryVersion(ClientPtr client)
{
- REQUEST(xPrintQueryVersionReq);
+ /* REQUEST(xPrintQueryVersionReq); */
xPrintQueryVersionReply rep;
register int n;
long l;
@@ -614,12 +595,12 @@ ProcXpQueryVersion(client)
******************************************************************************/
static int
-ProcXpGetPrinterList(client)
- ClientPtr client;
+ProcXpGetPrinterList(ClientPtr client)
{
REQUEST(xPrintGetPrinterListReq);
- int totalSize, numEntries;
- XpDiListEntry **pList, *pEntry;
+ int totalSize;
+ int numEntries;
+ XpDiListEntry **pList;
xPrintGetPrinterListReply *rep;
int n, i, totalBytes;
long l;
@@ -699,10 +680,9 @@ ProcXpGetPrinterList(client)
******************************************************************************/
static int
-ProcXpQueryScreens(client)
- ClientPtr client;
+ProcXpQueryScreens(ClientPtr client)
{
- REQUEST(xPrintQueryScreensReq);
+ /* REQUEST(xPrintQueryScreensReq); */
int i, numPrintScreens, totalSize;
WINDOW *pWinId;
xPrintQueryScreensReply *rep;
@@ -752,8 +732,7 @@ ProcXpQueryScreens(client)
}
static int
-ProcXpGetPageDimensions(client)
- ClientPtr client;
+ProcXpGetPageDimensions(ClientPtr client)
{
REQUEST(xPrintGetPageDimensionsReq);
CARD16 width, height;
@@ -774,12 +753,12 @@ ProcXpGetPageDimensions(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetMediumDimensions != (int (*)())NULL)
+ if(pContext->funcs.GetMediumDimensions != 0)
result = pContext->funcs.GetMediumDimensions(pContext, &width, &height);
else
return BadImplementation;
- if(pContext->funcs.GetReproducibleArea != (int (*)())NULL)
+ if(pContext->funcs.GetReproducibleArea != 0)
result = pContext->funcs.GetReproducibleArea(pContext, &rect);
else
return BadImplementation;
@@ -814,8 +793,7 @@ ProcXpGetPageDimensions(client)
}
static int
-ProcXpSetImageResolution(client)
- ClientPtr client;
+ProcXpSetImageResolution(ClientPtr client)
{
REQUEST(xPrintSetImageResolutionReq);
xPrintSetImageResolutionReply rep;
@@ -836,7 +814,7 @@ ProcXpSetImageResolution(client)
}
rep.prevRes = pContext->imageRes;
- if(pContext->funcs.SetImageResolution != (int (*)())NULL)
+ if(pContext->funcs.SetImageResolution != 0)
result = pContext->funcs.SetImageResolution(pContext,
(int)stuff->imageRes,
&status);
@@ -863,14 +841,11 @@ ProcXpSetImageResolution(client)
}
static int
-ProcXpGetImageResolution(client)
- ClientPtr client;
+ProcXpGetImageResolution(ClientPtr client)
{
REQUEST(xPrintGetImageResolutionReq);
xPrintGetImageResolutionReply rep;
XpContextPtr pContext;
- Bool status;
- int result;
REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq);
@@ -912,10 +887,9 @@ ProcXpGetImageResolution(client)
******************************************************************************/
static int
-ProcXpRehashPrinterList(client)
- ClientPtr client;
+ProcXpRehashPrinterList(ClientPtr client)
{
- REQUEST(xPrintRehashPrinterListReq);
+ /* REQUEST(xPrintRehashPrinterListReq); */
REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq);
@@ -950,15 +924,13 @@ ProcXpRehashPrinterList(client)
* is then called.
*/
static int
-ProcXpCreateContext(client)
- ClientPtr client;
+ProcXpCreateContext(ClientPtr client)
{
REQUEST(xPrintCreateContextReq);
XpScreenPtr pPrintScreen;
WindowPtr pRoot;
- char *printerName, *driverName;
+ char *driverName;
XpContextPtr pContext;
- XpClientPtr pNewPrintClient;
int result = Success;
XpDriverPtr pDriver;
@@ -969,7 +941,7 @@ ProcXpCreateContext(client)
/*
* Check to see if the printer name is valid.
*/
- if((pRoot = XpDiValidatePrinter(stuff + 1, stuff->printerNameLen)) ==
+ if((pRoot = XpDiValidatePrinter((char *)(stuff + 1), stuff->printerNameLen)) ==
(WindowPtr)NULL)
return BadMatch;
@@ -998,22 +970,22 @@ ProcXpCreateContext(client)
pContext->clientSlept = (ClientPtr)NULL;
pContext->imageRes = 0;
- pContext->funcs.DestroyContext = (int (*)())NULL;
- pContext->funcs.StartJob = (int (*)())NULL;
- pContext->funcs.EndJob = (int (*)())NULL;
- pContext->funcs.StartDoc = (int (*)())NULL;
- pContext->funcs.EndDoc = (int (*)())NULL;
- pContext->funcs.StartPage = (int (*)())NULL;
- pContext->funcs.EndPage = (int (*)())NULL;
- pContext->funcs.PutDocumentData = (int (*)())NULL;
- pContext->funcs.GetDocumentData = (int (*)())NULL;
- pContext->funcs.GetAttributes = (char * (*)())NULL;
- pContext->funcs.GetOneAttribute = (char * (*)())NULL;
- pContext->funcs.SetAttributes = (int (*)())NULL;
- pContext->funcs.AugmentAttributes = (int (*)())NULL;
- pContext->funcs.GetMediumDimensions = (int (*)())NULL;
- pContext->funcs.GetReproducibleArea = (int (*)())NULL;
- pContext->funcs.SetImageResolution = (int (*)())NULL;
+ pContext->funcs.DestroyContext = 0;
+ pContext->funcs.StartJob = 0;
+ pContext->funcs.EndJob = 0;
+ pContext->funcs.StartDoc = 0;
+ pContext->funcs.EndDoc = 0;
+ pContext->funcs.StartPage = 0;
+ pContext->funcs.EndPage = 0;
+ pContext->funcs.PutDocumentData = 0;
+ pContext->funcs.GetDocumentData = 0;
+ pContext->funcs.GetAttributes = 0;
+ pContext->funcs.GetOneAttribute = 0;
+ pContext->funcs.SetAttributes = 0;
+ pContext->funcs.AugmentAttributes = 0;
+ pContext->funcs.GetMediumDimensions = 0;
+ pContext->funcs.GetReproducibleArea = 0;
+ pContext->funcs.SetImageResolution = 0;
if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) ==
(char *)NULL)
@@ -1034,7 +1006,7 @@ ProcXpCreateContext(client)
{
if(!strcmp(driverName, pDriver->name))
{
- if(pDriver->CreateContext != (Bool (*)())NULL)
+ if(pDriver->CreateContext != 0)
pDriver->CreateContext(pContext);
else
return BadImplementation;
@@ -1053,8 +1025,7 @@ ProcXpCreateContext(client)
* and stashes the contextID in the client's devPrivate.
*/
static int
-ProcXpSetContext(client)
- ClientPtr client;
+ProcXpSetContext(ClientPtr client)
{
REQUEST(xPrintSetContextReq);
@@ -1111,22 +1082,18 @@ ProcXpSetContext(client)
}
XpContextPtr
-XpGetPrintContext(client)
- ClientPtr client;
+XpGetPrintContext(ClientPtr client)
{
return (client->devPrivates[XpClientPrivateIndex].ptr);
}
static int
-ProcXpGetContext(client)
- ClientPtr client;
+ProcXpGetContext(ClientPtr client)
{
- REQUEST(xPrintGetContextReq);
+ /* REQUEST(xPrintGetContextReq); */
xPrintGetContextReply rep;
XpContextPtr pContext;
- XpClientPtr pNewPrintClient;
- int result = Success;
register int n;
register long l;
@@ -1156,14 +1123,11 @@ ProcXpGetContext(client)
* to be called.
*/
static int
-ProcXpDestroyContext(client)
- ClientPtr client;
+ProcXpDestroyContext(ClientPtr client)
{
REQUEST(xPrintDestroyContextReq);
XpContextPtr pContext;
- XpClientPtr pXpClient;
- ClientPtr curClient;
REQUEST_SIZE_MATCH(xPrintDestroyContextReq);
@@ -1185,8 +1149,7 @@ ProcXpDestroyContext(client)
}
static int
-ProcXpGetContextScreen(client)
- ClientPtr client;
+ProcXpGetContextScreen(ClientPtr client)
{
REQUEST(xPrintGetContextScreenReq);
xPrintGetContextScreenReply rep;
@@ -1229,9 +1192,7 @@ ProcXpGetContextScreen(client)
* itself.
*/
static int
-XpFreeContext(data, id)
- pointer data;
- XID id;
+XpFreeContext(pointer data, XID id)
{
XpContextPtr pContext = (XpContextPtr)data;
@@ -1245,7 +1206,7 @@ XpFreeContext(data, id)
XpPagePtr pPage = (XpPagePtr)LookupIDByType(
pContext->pageWin, RTpage);
- pContext->funcs.EndPage(pContext, pWin, TRUE);
+ pContext->funcs.EndPage(pContext, pWin);
SendXpNotify(pContext, XPEndPageNotify, TRUE);
pContext->state &= ~PAGE_STARTED;
if(pPage)
@@ -1259,7 +1220,7 @@ XpFreeContext(data, id)
pContext->state &= ~DOC_RAW_STARTED;
pContext->state &= ~DOC_COOKED_STARTED;
}
- if(pContext->funcs.EndJob != (int (*)())NULL)
+ if(pContext->funcs.EndJob != 0)
{
pContext->funcs.EndJob(pContext, TRUE);
SendXpNotify(pContext, XPEndJobNotify, TRUE);
@@ -1272,7 +1233,7 @@ XpFreeContext(data, id)
* Tell the driver we're destroying the context
* This allows the driver to free and ContextPrivate data
*/
- if(pContext->funcs.DestroyContext != (int (*)())NULL)
+ if(pContext->funcs.DestroyContext != 0)
pContext->funcs.DestroyContext(pContext);
/* Free up all the XpClientRecs */
@@ -1291,11 +1252,10 @@ XpFreeContext(data, id)
* is freed. It simply calls the FreeXpClient routine to do the work.
*/
static int
-XpFreeClient(data, id)
- pointer data;
- XID id;
+XpFreeClient(pointer data, XID id)
{
FreeXpClient((XpClientPtr)data, TRUE);
+ return Success;
}
/*
@@ -1309,9 +1269,7 @@ XpFreeClient(data, id)
* XpClientRec's XID).
*/
static void
-FreeXpClient(pXpClient, freeResource)
- XpClientPtr pXpClient;
- Bool freeResource;
+FreeXpClient(XpClientPtr pXpClient, Bool freeResource)
{
XpClientPtr pCurrent, pPrev;
XpContextPtr pContext = pXpClient->context;
@@ -1355,8 +1313,7 @@ FreeXpClient(pXpClient, freeResource)
* freeing of the Rec when the client's connection is closed.
*/
static XpClientPtr
-CreateXpClient(client)
- ClientPtr client;
+CreateXpClient(ClientPtr client)
{
XpClientPtr pNewPrintClient;
XID clientResource;
@@ -1389,9 +1346,7 @@ CreateXpClient(client)
* the page resource.
*/
static int
-XpFreePage(data, id)
- pointer data;
- XID id;
+XpFreePage(pointer data, XID id)
{
XpPagePtr page = (XpPagePtr)data;
int result = Success;
@@ -1401,9 +1356,8 @@ XpFreePage(data, id)
if(page->context != (XpContextPtr)NULL &&
page->context->state & PAGE_STARTED)
{
- XpScreenPtr pPrintScreen = XpScreens[page->context->screenNum];
- if(page->context->funcs.EndPage != (int (*)())NULL)
- result = page->context->funcs.EndPage(page->context, pWin, TRUE);
+ if(page->context->funcs.EndPage != 0)
+ result = page->context->funcs.EndPage(page->context, pWin);
SendXpNotify(page->context, XPEndPageNotify, (int)TRUE);
page->context->pageWin = 0; /* None, NULL??? XXX */
}
@@ -1420,8 +1374,7 @@ XpFreePage(data, id)
*/
static void
-InitContextPrivates(context)
- XpContextPtr context;
+InitContextPrivates(XpContextPtr context)
{
register char *ptr;
DevUnion *ppriv;
@@ -1450,7 +1403,7 @@ InitContextPrivates(context)
}
static void
-ResetContextPrivates()
+ResetContextPrivates(void)
{
contextPrivateCount = 0;
contextPrivateLen = 0;
@@ -1461,15 +1414,13 @@ ResetContextPrivates()
}
int
-XpAllocateContextPrivateIndex()
+XpAllocateContextPrivateIndex(void)
{
return contextPrivateCount++;
}
Bool
-XpAllocateContextPrivate(index, amount)
- int index;
- unsigned amount;
+XpAllocateContextPrivate(int index, unsigned amount)
{
unsigned oldamount;
@@ -1497,9 +1448,7 @@ XpAllocateContextPrivate(index, amount)
}
static XpClientPtr
-AcquireClient(pContext, client)
- XpContextPtr pContext;
- ClientPtr client;
+AcquireClient(XpContextPtr pContext, ClientPtr client)
{
XpClientPtr pXpClient;
@@ -1517,9 +1466,7 @@ AcquireClient(pContext, client)
}
static XpClientPtr
-FindClient(pContext, client)
- XpContextPtr pContext;
- ClientPtr client;
+FindClient(XpContextPtr pContext, ClientPtr client)
{
XpClientPtr pXpClient;
@@ -1539,8 +1486,7 @@ FindClient(pContext, client)
******************************************************************************/
static int
-ProcXpStartJob(client)
- ClientPtr client;
+ProcXpStartJob(ClientPtr client)
{
REQUEST(xPrintStartJobReq);
XpContextPtr pContext;
@@ -1564,9 +1510,10 @@ ProcXpStartJob(client)
}
pPrintScreen = XpScreens[pContext->screenNum];
- if(pContext->funcs.StartJob != (int (*)())NULL)
+ if(pContext->funcs.StartJob != 0)
result = pContext->funcs.StartJob(pContext,
- (stuff->saveData == XPGetData)? TRUE:FALSE);
+ (stuff->saveData == XPGetData)? TRUE:FALSE,
+ client);
else
return BadImplementation;
@@ -1583,12 +1530,10 @@ ProcXpStartJob(client)
}
static int
-ProcXpEndJob(client)
- ClientPtr client;
+ProcXpEndJob(ClientPtr client)
{
REQUEST(xPrintEndJobReq);
XpScreenPtr pPrintScreen;
- WindowPtr pWin;
int result = Success;
XpContextPtr pContext;
@@ -1617,8 +1562,8 @@ ProcXpEndJob(client)
if(stuff->cancel != TRUE)
return XpErrorBase+XPBadSequence;
- if(pContext->funcs.EndPage != (int (*)())NULL)
- result = pContext->funcs.EndPage(pContext, pWin, TRUE);
+ if(pContext->funcs.EndPage != 0)
+ result = pContext->funcs.EndPage(pContext, pWin);
else
return BadImplementation;
@@ -1632,7 +1577,7 @@ ProcXpEndJob(client)
if(result != Success) return result;
}
- if(pContext->funcs.EndDoc != (int (*)())NULL)
+ if(pContext->funcs.EndDoc != 0)
result = pContext->funcs.EndDoc(pContext, stuff->cancel);
else
return BadImplementation;
@@ -1640,7 +1585,7 @@ ProcXpEndJob(client)
SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
}
- if(pContext->funcs.EndJob != (int (*)())NULL)
+ if(pContext->funcs.EndJob != 0)
result = pContext->funcs.EndJob(pContext, stuff->cancel);
else
return BadImplementation;
@@ -1656,9 +1601,7 @@ ProcXpEndJob(client)
}
static Bool
-DoStartDoc(client, c)
- ClientPtr client;
- XpStDocPtr c;
+DoStartDoc(ClientPtr client, XpStDocPtr c)
{
XpScreenPtr pPrintScreen;
int result = Success;
@@ -1670,7 +1613,7 @@ DoStartDoc(client, c)
if(!c->slept)
{
c->slept = TRUE;
- ClientSleep(client, DoStartDoc, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c);
c->pContext->clientSlept = client;
}
return TRUE;
@@ -1678,7 +1621,7 @@ DoStartDoc(client, c)
pPrintScreen = XpScreens[pContext->screenNum];
- if(pContext->funcs.StartDoc != (int (*)())NULL)
+ if(pContext->funcs.StartDoc != 0)
result = pContext->funcs.StartDoc(pContext, c->type);
else
{
@@ -1699,11 +1642,9 @@ DoStartDoc(client, c)
}
static int
-ProcXpStartDoc(client)
- ClientPtr client;
+ProcXpStartDoc(ClientPtr client)
{
REQUEST(xPrintStartDocReq);
- XpScreenPtr pPrintScreen;
int result = Success;
XpContextPtr pContext;
XpStDocPtr c;
@@ -1738,8 +1679,7 @@ ProcXpStartDoc(client)
}
static int
-ProcXpEndDoc(client)
- ClientPtr client;
+ProcXpEndDoc(ClientPtr client)
{
REQUEST(xPrintEndDocReq);
XpScreenPtr pPrintScreen;
@@ -1767,8 +1707,8 @@ ProcXpEndDoc(client)
XpPagePtr pPage = (XpPagePtr)LookupIDByType(
pContext->pageWin, RTpage);
- if(pContext->funcs.EndPage != (int (*)())NULL)
- result = pContext->funcs.EndPage(pContext, pWin, TRUE);
+ if(pContext->funcs.EndPage != 0)
+ result = pContext->funcs.EndPage(pContext, pWin);
else
return BadImplementation;
@@ -1783,7 +1723,7 @@ ProcXpEndDoc(client)
return result;
}
- if(pContext->funcs.EndDoc != (int (*)())NULL)
+ if(pContext->funcs.EndDoc != 0)
result = pContext->funcs.EndDoc(pContext, stuff->cancel);
else
return BadImplementation;
@@ -1800,9 +1740,9 @@ ProcXpEndDoc(client)
}
static Bool
-DoStartPage(client, c)
- ClientPtr client;
- XpStPagePtr c;
+DoStartPage(
+ ClientPtr client,
+ XpStPagePtr c)
{
XpScreenPtr pPrintScreen;
WindowPtr pWin = c->pWin;
@@ -1816,7 +1756,7 @@ DoStartPage(client, c)
if(!c->slept)
{
c->slept = TRUE;
- ClientSleep(client, DoStartPage, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c);
c->pContext->clientSlept = client;
}
return TRUE;
@@ -1825,7 +1765,7 @@ DoStartPage(client, c)
if(!(pContext->state & DOC_COOKED_STARTED))
{
/* Implied StartDoc if it was omitted */
- if(pContext->funcs.StartDoc != (int (*)())NULL)
+ if(pContext->funcs.StartDoc != 0)
result = pContext->funcs.StartDoc(pContext, XPDocNormal);
else
{
@@ -1878,7 +1818,7 @@ DoStartPage(client, c)
pPrintScreen = XpScreens[pContext->screenNum];
- if(pContext->funcs.StartPage != (int (*)())NULL)
+ if(pContext->funcs.StartPage != 0)
result = pContext->funcs.StartPage(pContext, pWin);
else
{
@@ -1897,15 +1837,12 @@ DoStartPage(client, c)
}
static int
-ProcXpStartPage(client)
- ClientPtr client;
+ProcXpStartPage(ClientPtr client)
{
REQUEST(xPrintStartPageReq);
- XpScreenPtr pPrintScreen;
WindowPtr pWin;
int result = Success;
XpContextPtr pContext;
- XpPagePtr pPage;
XpStPagePtr c;
REQUEST_SIZE_MATCH(xPrintStartPageReq);
@@ -1944,8 +1881,7 @@ ProcXpStartPage(client)
}
static int
-ProcXpEndPage(client)
- ClientPtr client;
+ProcXpEndPage(ClientPtr client)
{
REQUEST(xPrintEndPageReq);
XpScreenPtr pPrintScreen;
@@ -1967,8 +1903,8 @@ ProcXpEndPage(client)
pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW);
/* Call the ddx's EndPage proc. */
- if(pContext->funcs.EndPage != (int (*)())NULL)
- result = pContext->funcs.EndPage(pContext, pWin, stuff->cancel);
+ if(pContext->funcs.EndPage != 0)
+ result = pContext->funcs.EndPage(pContext, pWin);
else
return BadImplementation;
@@ -1996,14 +1932,13 @@ ProcXpEndPage(client)
******************************************************************************/
static int
-ProcXpPutDocumentData(client)
- ClientPtr client;
+ProcXpPutDocumentData(ClientPtr client)
{
REQUEST(xPrintPutDocumentDataReq);
XpContextPtr pContext;
DrawablePtr pDraw;
int result = Success;
- int len, totalSize;
+ unsigned totalSize;
char *pData, *pDoc_fmt, *pOptions;
REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
@@ -2040,7 +1975,7 @@ ProcXpPutDocumentData(client)
if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len)
return BadLength;
- if(pContext->funcs.PutDocumentData != (int (*)())NULL)
+ if(pContext->funcs.PutDocumentData != 0)
{
result = (*pContext->funcs.PutDocumentData)(pContext, pDraw,
pData, stuff->len_data,
@@ -2058,12 +1993,10 @@ ProcXpPutDocumentData(client)
}
static int
-ProcXpGetDocumentData(client)
- ClientPtr client;
+ProcXpGetDocumentData(ClientPtr client)
{
REQUEST(xPrintGetDocumentDataReq);
xPrintGetDocumentDataReply rep;
- XpScreenPtr pPrintScreen;
XpContextPtr pContext;
int result = Success;
@@ -2079,7 +2012,7 @@ ProcXpGetDocumentData(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetDocumentData == (int (*)())NULL)
+ if(pContext->funcs.GetDocumentData == 0)
return BadImplementation;
if(!(pContext->state & JOB_GET_DATA) ||
@@ -2132,8 +2065,7 @@ ProcXpGetDocumentData(client)
******************************************************************************/
static int
-ProcXpGetAttributes(client)
- ClientPtr client;
+ProcXpGetAttributes(ClientPtr client)
{
REQUEST(xPrintGetAttributesReq);
XpContextPtr pContext;
@@ -2163,7 +2095,7 @@ ProcXpGetAttributes(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetAttributes == (char *(*)())NULL)
+ if(pContext->funcs.GetAttributes == 0)
return BadImplementation;
if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) ==
(char *)NULL)
@@ -2203,8 +2135,7 @@ ProcXpGetAttributes(client)
}
static int
-ProcXpSetAttributes(client)
- ClientPtr client;
+ProcXpSetAttributes(ClientPtr client)
{
REQUEST(xPrintSetAttributesReq);
int result = Success;
@@ -2236,7 +2167,7 @@ ProcXpSetAttributes(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.SetAttributes == (int (*)())NULL)
+ if(pContext->funcs.SetAttributes == 0)
return BadImplementation;
/*
@@ -2275,14 +2206,14 @@ ProcXpSetAttributes(client)
}
static int
-ProcXpGetOneAttribute(client)
- ClientPtr client;
+ProcXpGetOneAttribute(ClientPtr client)
{
REQUEST(xPrintGetOneAttributeReq);
XpContextPtr pContext;
char *value, *attrName;
xPrintGetOneAttributeReply *pRep;
- int totalSize, n;
+ int totalSize;
+ int n;
unsigned long l;
REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq);
@@ -2316,7 +2247,7 @@ ProcXpGetOneAttribute(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetOneAttribute == (char *(*)())NULL)
+ if(pContext->funcs.GetOneAttribute == 0)
return BadImplementation;
if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type,
attrName)) == (char *)NULL)
@@ -2364,8 +2295,7 @@ ProcXpGetOneAttribute(client)
static int
-ProcXpSelectInput(client)
- ClientPtr client;
+ProcXpSelectInput(ClientPtr client)
{
REQUEST(xPrintSelectInputReq);
int result = Success;
@@ -2403,14 +2333,12 @@ ProcXpSelectInput(client)
}
static int
-ProcXpInputSelected(client)
- ClientPtr client;
+ProcXpInputSelected(ClientPtr client)
{
REQUEST(xPrintInputSelectedReq);
xPrintInputSelectedReply rep;
register int n;
- long l, allMask;
- WindowPtr pWin;
+ long l;
XpClientPtr pXpClient;
XpContextPtr pContext;
@@ -2446,9 +2374,7 @@ ProcXpInputSelected(client)
}
static void
-SendAttributeNotify(pContext, which)
- XpContextPtr pContext;
- int which;
+SendAttributeNotify(XpContextPtr pContext, int which)
{
XpClientPtr pXpClient;
xPrintAttributeEvent ae;
@@ -2473,11 +2399,9 @@ SendAttributeNotify(pContext, which)
WriteEventsToClient (client, 1, (xEvent *) &ae);
}
}
+
static void
-SendXpNotify(pContext, which, val)
- XpContextPtr pContext;
- int which;
- int val;
+SendXpNotify(XpContextPtr pContext, int which, int val)
{
XpClientPtr pXpClient;
xPrintPrintEvent pe;
@@ -2505,8 +2429,7 @@ SendXpNotify(pContext, which, val)
}
static CARD32
-GetAllEventMasks(pContext)
- XpContextPtr pContext;
+GetAllEventMasks(XpContextPtr pContext)
{
XpClientPtr pPrintClient;
CARD32 totalMask = (CARD32)0;
@@ -2526,11 +2449,8 @@ GetAllEventMasks(pContext)
* does not currently have a context set.
*/
XpContextPtr
-XpContextOfClient(client)
- ClientPtr client;
+XpContextOfClient(ClientPtr client)
{
- XpContextPtr pContext;
-
return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
}
@@ -2542,8 +2462,7 @@ XpContextOfClient(client)
******************************************************************************/
static int
-SProcXpCreateContext(client)
- ClientPtr client;
+SProcXpCreateContext(ClientPtr client)
{
int i;
long n;
@@ -2558,8 +2477,7 @@ SProcXpCreateContext(client)
}
static int
-SProcXpGetPrinterList(client)
- ClientPtr client;
+SProcXpGetPrinterList(ClientPtr client)
{
int i;
long n;
@@ -2573,11 +2491,9 @@ SProcXpGetPrinterList(client)
}
static int
-SProcXpRehashPrinterList(client)
- ClientPtr client;
+SProcXpRehashPrinterList(ClientPtr client)
{
int i;
- long n;
REQUEST(xPrintRehashPrinterListReq);
swaps(&stuff->length, i);
@@ -2585,11 +2501,9 @@ SProcXpRehashPrinterList(client)
}
static int
-SProcXpSetContext(client)
- ClientPtr client;
+SProcXpSetContext(ClientPtr client)
{
int i;
- long n;
REQUEST(xPrintSetContextReq);
swaps(&stuff->length, i);
@@ -2598,8 +2512,7 @@ SProcXpSetContext(client)
}
static int
-SProcXpGetContext(client)
- ClientPtr client;
+SProcXpGetContext(ClientPtr client)
{
int i;
@@ -2609,8 +2522,7 @@ SProcXpGetContext(client)
}
static int
-SProcXpDestroyContext(client)
- ClientPtr client;
+SProcXpDestroyContext(ClientPtr client)
{
int i;
long n;
@@ -2622,8 +2534,7 @@ SProcXpDestroyContext(client)
}
static int
-SProcXpGetContextScreen(client)
- ClientPtr client;
+SProcXpGetContextScreen(ClientPtr client)
{
int i;
long n;
@@ -2635,8 +2546,7 @@ SProcXpGetContextScreen(client)
}
static int
-SProcXpInputSelected(client)
- ClientPtr client;
+SProcXpInputSelected(ClientPtr client)
{
int i;
long n;
@@ -2648,8 +2558,7 @@ SProcXpInputSelected(client)
}
static int
-SProcXpStartJob(client)
- ClientPtr client;
+SProcXpStartJob(ClientPtr client)
{
int i;
@@ -2659,8 +2568,7 @@ SProcXpStartJob(client)
}
static int
-SProcXpEndJob(client)
- ClientPtr client;
+SProcXpEndJob(ClientPtr client)
{
int i;
@@ -2670,8 +2578,7 @@ SProcXpEndJob(client)
}
static int
-SProcXpStartDoc(client)
- ClientPtr client;
+SProcXpStartDoc(ClientPtr client)
{
int i;
@@ -2681,8 +2588,7 @@ SProcXpStartDoc(client)
}
static int
-SProcXpEndDoc(client)
- ClientPtr client;
+SProcXpEndDoc(ClientPtr client)
{
int i;
@@ -2692,8 +2598,7 @@ SProcXpEndDoc(client)
}
static int
-SProcXpStartPage(client)
- ClientPtr client;
+SProcXpStartPage(ClientPtr client)
{
int i;
long n;
@@ -2705,8 +2610,7 @@ SProcXpStartPage(client)
}
static int
-SProcXpEndPage(client)
- ClientPtr client;
+SProcXpEndPage(ClientPtr client)
{
int i;
@@ -2716,8 +2620,7 @@ SProcXpEndPage(client)
}
static int
-SProcXpPutDocumentData(client)
- ClientPtr client;
+SProcXpPutDocumentData(ClientPtr client)
{
long n;
int i;
@@ -2732,8 +2635,7 @@ SProcXpPutDocumentData(client)
}
static int
-SProcXpGetDocumentData(client)
- ClientPtr client;
+SProcXpGetDocumentData(ClientPtr client)
{
long n;
int i;
@@ -2746,8 +2648,7 @@ SProcXpGetDocumentData(client)
}
static int
-SProcXpGetAttributes(client)
- ClientPtr client;
+SProcXpGetAttributes(ClientPtr client)
{
long n;
int i;
@@ -2759,8 +2660,7 @@ SProcXpGetAttributes(client)
}
static int
-SProcXpSetAttributes(client)
- ClientPtr client;
+SProcXpSetAttributes(ClientPtr client)
{
long n;
int i;
@@ -2773,8 +2673,7 @@ SProcXpSetAttributes(client)
}
static int
-SProcXpGetOneAttribute(client)
- ClientPtr client;
+SProcXpGetOneAttribute(ClientPtr client)
{
long n;
int i;
@@ -2787,8 +2686,7 @@ SProcXpGetOneAttribute(client)
}
static int
-SProcXpSelectInput(client)
- ClientPtr client;
+SProcXpSelectInput(ClientPtr client)
{
long n;
int i;
@@ -2799,9 +2697,9 @@ SProcXpSelectInput(client)
swapl(&stuff->printContext, n);
return ProcXpSelectInput(client);
}
+
static int
-SProcXpGetPageDimensions(client)
- ClientPtr client;
+SProcXpGetPageDimensions(ClientPtr client)
{
long n;
int i;
@@ -2811,9 +2709,9 @@ SProcXpGetPageDimensions(client)
swapl(&stuff->printContext, n);
return ProcXpGetPageDimensions(client);
}
+
static int
-SProcXpSetImageResolution(client)
- ClientPtr client;
+SProcXpSetImageResolution(ClientPtr client)
{
long n;
int i;
@@ -2824,9 +2722,9 @@ SProcXpSetImageResolution(client)
swaps(&stuff->imageRes, i);
return ProcXpSetImageResolution(client);
}
+
static int
-SProcXpGetImageResolution(client)
- ClientPtr client;
+SProcXpGetImageResolution(ClientPtr client)
{
long n;
int i;
@@ -2838,8 +2736,7 @@ SProcXpGetImageResolution(client)
}
static void
-SwapXpNotifyEvent(src, dst)
- xPrintPrintEvent *src, *dst;
+SwapXpNotifyEvent(xPrintPrintEvent *src, xPrintPrintEvent *dst)
{
/*
* Swap the sequence number and context fields.
@@ -2856,8 +2753,7 @@ SwapXpNotifyEvent(src, dst)
}
static void
-SwapXpAttributeEvent(src, dst)
- xPrintAttributeEvent *src, *dst;
+SwapXpAttributeEvent(xPrintAttributeEvent *src, xPrintAttributeEvent *dst)
{
/*
* Swap the sequence number and context fields.
diff --git a/Xext/xtest.c b/Xext/xtest.c
index a07cf6186..47e7418d8 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.7 2001/12/14 19:58:51 dawes Exp $ */
#include "X.h"
#define NEED_EVENTS
@@ -37,6 +38,8 @@ from The Open Group.
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
+#include "dixevents.h"
+#include "sleepuntil.h"
#define _XTEST_SERVER_
#include "XTest.h"
#include "xteststr.h"
@@ -44,27 +47,49 @@ from The Open Group.
#include "XI.h"
#include "XIproto.h"
#define EXTENSION_EVENT_BASE 64
+#include "extinit.h" /* LookupDeviceIntRec */
#endif /* XINPUT */
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
static unsigned char XTestReqCode;
-static int ProcXTestDispatch(), SProcXTestDispatch();
-static void XTestResetProc();
-static int XTestSwapFakeInput();
-CursorPtr GetSpriteCursor();
-WindowPtr GetCurrentRootWindow();
+
#ifdef XINPUT
extern int DeviceValuator;
-DeviceIntPtr LookupDeviceIntRec();
#endif /* XINPUT */
+static void XTestResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+static int XTestSwapFakeInput(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ xReq * /* req */
+#endif
+);
+
+static DISPATCH_PROC(ProcXTestCompareCursor);
+static DISPATCH_PROC(ProcXTestDispatch);
+static DISPATCH_PROC(ProcXTestFakeInput);
+static DISPATCH_PROC(ProcXTestGetVersion);
+static DISPATCH_PROC(ProcXTestGrabControl);
+static DISPATCH_PROC(SProcXTestCompareCursor);
+static DISPATCH_PROC(SProcXTestDispatch);
+static DISPATCH_PROC(SProcXTestFakeInput);
+static DISPATCH_PROC(SProcXTestGetVersion);
+static DISPATCH_PROC(SProcXTestGrabControl);
+
void
XTestExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XTestExtensionName, 0, 0,
+ if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
- XTestResetProc, StandardMinorOpcode))
+ XTestResetProc, StandardMinorOpcode)) != 0)
XTestReqCode = (unsigned char)extEntry->base;
}
@@ -79,7 +104,6 @@ static int
ProcXTestGetVersion(client)
register ClientPtr client;
{
- REQUEST(xXTestGetVersionReq);
xXTestGetVersionReply rep;
register int n;
@@ -142,12 +166,12 @@ ProcXTestFakeInput(client)
int nev;
int n;
xEvent *ev;
- DeviceIntPtr dev;
+ DeviceIntPtr dev = NULL;
WindowPtr root;
int type;
#ifdef XINPUT
Bool extension = FALSE;
- deviceValuator *dv;
+ deviceValuator *dv = NULL;
int base;
int *values;
#endif /* XINPUT */
@@ -468,7 +492,7 @@ XTestSwapFakeInput(client, req)
register int nev;
register xEvent *ev;
xEvent sev;
- void (*proc)(), NotImplemented();
+ EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
@@ -476,7 +500,7 @@ XTestSwapFakeInput(client, req)
/* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
- if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) {
+ if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
diff --git a/Xext/xtest1dd.c b/Xext/xtest1dd.c
index 38c977557..8a2b779be 100644
--- a/Xext/xtest1dd.c
+++ b/Xext/xtest1dd.c
@@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.c,v 3.5 2001/12/14 19:58:52 dawes Exp $ */
/***************************************************************
* include files
@@ -70,6 +71,8 @@ University of California.
#define XTestSERVER_SIDE
#include "xtestext1.h"
+#include "xtest1dd.h"
+
/***************************************************************
* defines
***************************************************************/
@@ -96,8 +99,6 @@ extern int XTestFakeAckType;
/*
* used in the WriteReplyToClient macro
*/
-extern void (* ReplySwapVector[256]) ();
-
extern int exclusive_steal;
/***************************************************************
@@ -286,24 +287,62 @@ KeyCode xtest_command_key = 0;
* function declarations
***************************************************************/
-void flush_input_actions();
-void XTestStealJumpData();
-void XTestGenerateEvent();
-void XTestGetPointerPos();
-void XTestJumpPointer();
-
-static void parse_key_fake();
-static void parse_motion_fake();
-static void parse_jump_fake();
-static void parse_delay_fake();
-static void send_ack();
-static void start_play_clock();
-static void compute_action_time();
-static int find_residual_time();
+static void parse_key_fake(
+#if NeedFunctionPrototypes
+ XTestKeyInfo * /* fkey */
+#endif
+ );
+static void parse_motion_fake(
+#if NeedFunctionPrototypes
+ XTestMotionInfo * /* fmotion */
+#endif
+ );
+static void parse_jump_fake(
+#if NeedFunctionPrototypes
+ XTestJumpInfo * /* fjump */
+#endif
+ );
+static void parse_delay_fake(
+#if NeedFunctionPrototypes
+ XTestDelayInfo * /* tevent */
+#endif
+ );
+static void send_ack(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+static void start_play_clock(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+static void compute_action_time(
+#if NeedFunctionPrototypes
+ struct timeval * /* rtime */
+#endif
+ );
+static int find_residual_time(
+#if NeedFunctionPrototypes
+ struct timeval * /* rtime */
+#endif
+ );
-static CARD16 check_time_event();
-static CARD32 current_ms();
-static int there_is_room();
+static CARD16 check_time_event(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+static CARD32 current_ms(
+#if NeedFunctionPrototypes
+ struct timeval * /* otime */
+#endif
+ );
+static int there_is_room(
+#if NeedFunctionPrototypes
+ int /* actsize */
+#endif
+ );
/******************************************************************************
*
@@ -450,8 +489,8 @@ XTestStealJumpData(jx, jy, dev_type)
/*
* the x and y coordinates to jump to
*/
-short jx;
-short jy;
+int jx;
+int jy;
/*
* which device caused the jump
*/
@@ -527,7 +566,7 @@ current_ms(otime)
struct timeval *otime;
{
struct timeval tval;
- unsigned long ctime;
+ unsigned long the_ms;
unsigned long sec;
unsigned long usec;
@@ -556,8 +595,8 @@ struct timeval *otime;
* compute the number of milliseconds contained in
* 'sec' seconds and 'usec' microseconds
*/
- ctime = (sec * 1000000 + usec) / 1000;
- return (ctime);
+ the_ms = (sec * 1000000L + usec) / 1000L;
+ return (the_ms);
}
/******************************************************************************
@@ -673,8 +712,8 @@ XTestStealMotionData(dx, dy, dev_type, mx, my)
/*
* the x and y delta motion of the locator
*/
-short dx;
-short dy;
+int dx;
+int dy;
/*
* which locator did the moving
*/
@@ -682,8 +721,8 @@ int dev_type;
/*
* the x and y position of the locator before the delta motion
*/
-short mx;
-short my;
+int mx;
+int my;
{
/*
* pointer to a XTestMOTION_ACTION input action
@@ -791,20 +830,20 @@ XTestStealKeyData(keycode, keystate, dev_type, locx, locy)
/*
* which key/button moved
*/
-CARD8 keycode;
+unsigned keycode;
/*
* whether the key/button was pressed or released
*/
-char keystate;
+int keystate;
/*
* which device caused the input action
*/
-int dev_type;
+int dev_type;
/*
* the x and y coordinates of the locator when the action happenned
*/
-short locx;
-short locy;
+int locx;
+int locy;
{
/*
* pointer to key/button motion input action
@@ -814,7 +853,7 @@ short locy;
* time delta from previous event
*/
CARD16 tchar;
- char keytrans;
+ char keytrans = 0;
/*
* update the logical position of the locator if the physical position
@@ -1445,8 +1484,8 @@ struct timeval *rtime;
* the current time.
*/
static int
-find_residual_time(rtime)
-struct timeval *rtime;
+find_residual_time(the_residual)
+struct timeval *the_residual;
{
/*
* if > 0, there is time to wait. If < 0, then don't wait
@@ -1507,8 +1546,8 @@ struct timeval *rtime;
}
else
{
- rtime->tv_usec = pusec - busec;
- rtime->tv_sec = 0;
+ the_residual->tv_usec = pusec - busec;
+ the_residual->tv_sec = 0;
}
}
else
@@ -1519,14 +1558,14 @@ struct timeval *rtime;
* 'borrow' a second's worth of microseconds
* from the seconds left to wait
*/
- rtime->tv_usec = 1000000 - busec + pusec;
+ the_residual->tv_usec = 1000000 - busec + pusec;
psec--;
- rtime->tv_sec = psec - bsec;
+ the_residual->tv_sec = psec - bsec;
}
else
{
- rtime->tv_sec = psec - bsec;
- rtime->tv_usec = pusec - busec;
+ the_residual->tv_sec = psec - bsec;
+ the_residual->tv_usec = pusec - busec;
}
}
}
@@ -1540,8 +1579,8 @@ struct timeval *rtime;
/*
* set the time to wait to 0
*/
- rtime->tv_sec = 0;
- rtime->tv_usec = 0;
+ the_residual->tv_sec = 0;
+ the_residual->tv_usec = 0;
}
return(wait);
}
diff --git a/Xext/xtest1di.c b/Xext/xtest1di.c
index cd8f5e727..43c1d58d1 100644
--- a/Xext/xtest1di.c
+++ b/Xext/xtest1di.c
@@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.3 2001/12/14 19:58:52 dawes Exp $ */
/*****************************************************************************
* include files
@@ -72,6 +73,8 @@ University of California.
#define XTestSERVER_SIDE
#include "xtestext1.h"
+#include "xtest1dd.h"
+
/*****************************************************************************
* defines
****************************************************************************/
@@ -81,10 +84,6 @@ University of California.
****************************************************************************/
/*
- * holds the addresses of the routines that handle byte-swapping of replys
- */
-extern void (* ReplySwapVector[256]) ();
-/*
* id of client using XTestGetInput
*
* defined in xtest1dd.c
@@ -137,31 +136,44 @@ static XID current_client_id;
* function declarations
****************************************************************************/
-static int ProcXTestDispatch();
-static int SProcXTestDispatch();
-static void XTestResetProc();
-static int ProcTestFakeInput();
-static int SProcTestFakeInput();
-static int ProcTestGetInput();
-static int SProcTestGetInput();
-static int ProcTestStopInput();
-static int SProcTestStopInput();
-static int ProcTestReset();
-static int SProcTestReset();
-static int ProcTestQueryInputSize();
-static int SProcTestQueryInputSize();
-static void SReplyXTestDispatch();
-static void SEventXTestDispatch();
-void NotImplemented();
-
-void abort_play_back();
-void return_input_array_size();
-void steal_input();
-void stop_stealing_input();
-void flush_input_actions();
-void parse_fake_input();
-
-static int XTestCurrentClientGone();
+static DISPATCH_PROC(ProcXTestDispatch);
+static DISPATCH_PROC(SProcXTestDispatch);
+static DISPATCH_PROC(ProcTestFakeInput);
+static DISPATCH_PROC(SProcTestFakeInput);
+static DISPATCH_PROC(ProcTestGetInput);
+static DISPATCH_PROC(SProcTestGetInput);
+static DISPATCH_PROC(ProcTestStopInput);
+static DISPATCH_PROC(SProcTestStopInput);
+static DISPATCH_PROC(ProcTestReset);
+static DISPATCH_PROC(SProcTestReset);
+static DISPATCH_PROC(ProcTestQueryInputSize);
+static DISPATCH_PROC(SProcTestQueryInputSize);
+
+static void XTestResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* unused */
+#endif
+ );
+static void SReplyXTestDispatch(
+#if NeedFunctionPrototypes
+ ClientPtr /* client_ptr */,
+ int /* size */,
+ char * /* reply_ptr */
+#endif
+ );
+static void SEventXTestDispatch(
+#if NeedFunctionPrototypes
+ xEvent * /* from */,
+ xEvent * /* to */
+#endif
+ );
+
+static int XTestCurrentClientGone(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
/*****************************************************************************
*
@@ -180,10 +192,6 @@ XTestExtension1Init()
* holds the pointer to the extension entry structure
*/
ExtensionEntry *extEntry;
- /*
- * This routine adds the extension to the server extension table.
- */
- ExtensionEntry *AddExtension();
extEntry = AddExtension(XTestEXTENSION_NAME,
XTestEVENT_COUNT,
@@ -213,7 +221,7 @@ XTestExtension1Init()
* install the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table
*/
- ReplySwapVector[XTestReqCode] = SReplyXTestDispatch;
+ ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch;
/*
* install the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table
@@ -647,7 +655,6 @@ static int
ProcTestStopInput(client)
register ClientPtr client;
{
- REQUEST(xTestStopInputReq);
REQUEST_SIZE_MATCH(xTestStopInputReq);
if (on_steal_input && (current_xtest_client == client))
{
@@ -686,7 +693,6 @@ static int
ProcTestReset(client)
register ClientPtr client;
{
- REQUEST(xTestResetReq);
REQUEST_SIZE_MATCH(xTestResetReq);
on_steal_input = FALSE;
exclusive_steal = FALSE;
@@ -711,7 +717,6 @@ static int
ProcTestQueryInputSize(client)
register ClientPtr client;
{
- REQUEST(xTestQueryInputSizeReq);
REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
/*
* defined in xtest1dd.c
@@ -728,14 +733,16 @@ ProcTestQueryInputSize(client)
* connected to it. It must put eveything back the way it was before
* this extension was installed.
*/
+/*ARGSUSED*/
static void
-XTestResetProc()
+XTestResetProc(unused)
+ ExtensionEntry * unused;
{
/*
* remove the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table
*/
- ReplySwapVector[XTestReqCode] = NotImplemented;
+ ReplySwapVector[XTestReqCode] = ReplyNotSwappd;
/*
* remove the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table
@@ -755,7 +762,7 @@ XTestResetProc()
/*****************************************************************************
*
- * ProcTestQueryInputSize
+ * PXTestCurrentClientGone
*
* This routine is called when a client that has asked for input actions
* to be sent to it "goes away". This routine must clean up the
diff --git a/Xi/allowev.c b/Xi/allowev.c
index db98d8c93..2eb463d41 100644
--- a/Xi/allowev.c
+++ b/Xi/allowev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/allowev.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/***********************************************************************
*
@@ -60,10 +61,12 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "allowev.h"
+#include "dixevents.h"
/***********************************************************************
*
@@ -96,7 +99,6 @@ ProcXAllowDeviceEvents(client)
{
TimeStamp time;
DeviceIntPtr thisdev;
- void AllowSome ();
REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index e5dab66c1..f5988d76b 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgdctl.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,13 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h" /* control constants */
+#include "XIstubs.h"
-extern int IReqCode;
-extern int BadDevice, DeviceBusy;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "chgdctl.h"
/***********************************************************************
*
@@ -91,10 +94,12 @@ SProcXChangeDeviceControl(client)
*
*/
+int
ProcXChangeDeviceControl(client)
ClientPtr client;
{
- int i, len, status;
+ unsigned len;
+ int i, status;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
@@ -150,7 +155,7 @@ ProcXChangeDeviceControl(client)
BadValue);
return Success;
}
- status = ChangeDeviceControl(client, dev, r);
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r);
if (status == Success)
{
a = &dev->valuator->axes[r->first_valuator];
@@ -195,6 +200,7 @@ ProcXChangeDeviceControl(client)
*
*/
+void
SRepXChangeDeviceControl (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c
index 0b945de23..213fc7bf5 100644
--- a/Xi/chgfctl.c
+++ b/Xi/chgfctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgfctl.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/********************************************************************
*
@@ -60,11 +61,13 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h" /* control constants */
-#define DO_ALL (-1)
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "chgfctl.h"
-extern int IReqCode;
-extern int BadDevice;
-DeviceIntPtr LookupDeviceIntRec();
+#define DO_ALL (-1)
/***********************************************************************
*
@@ -92,10 +95,11 @@ SProcXChangeFeedbackControl(client)
*
*/
+int
ProcXChangeFeedbackControl(client)
ClientPtr client;
{
- int len;
+ unsigned len;
DeviceIntPtr dev;
KbdFeedbackPtr k;
PtrFeedbackPtr p;
@@ -128,7 +132,7 @@ ProcXChangeFeedbackControl(client)
for (k=dev->kbdfeed; k; k=k->next)
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
{
- ChangeKbdFeedback (client, dev, stuff->mask, k, &stuff[1]);
+ ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -142,7 +146,7 @@ ProcXChangeFeedbackControl(client)
for (p=dev->ptrfeed; p; p=p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
{
- ChangePtrFeedback (client, dev, stuff->mask, p, &stuff[1]);
+ ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -163,7 +167,7 @@ ProcXChangeFeedbackControl(client)
for (s=dev->stringfeed; s; s=s->next)
if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
{
- ChangeStringFeedback (client, dev, stuff->mask,s,&stuff[1]);
+ ChangeStringFeedback (client, dev, stuff->mask,s,(xStringFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -178,7 +182,7 @@ ProcXChangeFeedbackControl(client)
for (i=dev->intfeed; i; i=i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
{
- ChangeIntegerFeedback (client, dev,stuff->mask,i,&stuff[1]);
+ ChangeIntegerFeedback (client, dev,stuff->mask,i,(xIntegerFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -192,7 +196,7 @@ ProcXChangeFeedbackControl(client)
for (l=dev->leds; l; l=l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
{
- ChangeLedFeedback (client, dev, stuff->mask, l, &stuff[1]);
+ ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -206,7 +210,7 @@ ProcXChangeFeedbackControl(client)
for (b=dev->bell; b; b=b->next)
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
{
- ChangeBellFeedback (client, dev, stuff->mask, b, &stuff[1]);
+ ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -224,6 +228,7 @@ ProcXChangeFeedbackControl(client)
*
*/
+int
ChangeKbdFeedback (client, dev, mask, k, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -332,7 +337,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (mask & DvAutoRepeatMode)
{
- int index = (key >> 3);
+ int inx = (key >> 3);
int kmask = (1 << (key & 7));
t = (CARD8) f->auto_repeat_mode;
if (t == AutoRepeatModeOff)
@@ -340,24 +345,24 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (key == DO_ALL)
kctrl.autoRepeat = FALSE;
else
- kctrl.autoRepeats[index] &= ~kmask;
+ kctrl.autoRepeats[inx] &= ~kmask;
}
else if (t == AutoRepeatModeOn)
{
if (key == DO_ALL)
kctrl.autoRepeat = TRUE;
else
- kctrl.autoRepeats[index] |= kmask;
+ kctrl.autoRepeats[inx] |= kmask;
}
else if (t == AutoRepeatModeDefault)
{
if (key == DO_ALL)
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else
- kctrl.autoRepeats[index] &= ~kmask;
- kctrl.autoRepeats[index] =
- (kctrl.autoRepeats[index] & ~kmask) |
- (defaultKeyboardControl.autoRepeats[index] & kmask);
+ kctrl.autoRepeats[inx] &= ~kmask;
+ kctrl.autoRepeats[inx] =
+ (kctrl.autoRepeats[inx] & ~kmask) |
+ (defaultKeyboardControl.autoRepeats[inx] & kmask);
}
else
{
@@ -379,6 +384,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
*
*/
+int
ChangePtrFeedback (client, dev, mask, p, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -460,6 +466,7 @@ ChangePtrFeedback (client, dev, mask, p, f)
*
*/
+int
ChangeIntegerFeedback (client, dev, mask, i, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -486,6 +493,7 @@ ChangeIntegerFeedback (client, dev, mask, i, f)
*
*/
+int
ChangeStringFeedback (client, dev, mask, s, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -495,7 +503,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
{
register char n;
register long *p;
- int i, j, len;
+ int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f+1);
@@ -543,6 +551,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
*
*/
+int
ChangeBellFeedback (client, dev, mask, b, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -617,6 +626,7 @@ ChangeBellFeedback (client, dev, mask, b, f)
*
*/
+int
ChangeLedFeedback (client, dev, mask, l, f)
ClientPtr client;
DeviceIntPtr dev;
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index f48b4682b..b0b82ee6d 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgkbd.c,v 3.6 2001/12/14 19:58:54 dawes Exp $ */
/***********************************************************************
*
@@ -59,14 +60,16 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
+#include "globals.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
-extern int IReqCode;
-extern int BadDevice;
-extern int ChangeDeviceNotify;
-extern Mask ChangeDeviceNotifyMask;
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgkbd.h"
+#include "chgptr.h"
/***********************************************************************
*
@@ -93,6 +96,7 @@ SProcXChangeKeyboardDevice(client)
*
*/
+int
ProcXChangeKeyboardDevice (client)
register ClientPtr client;
{
@@ -104,7 +108,6 @@ ProcXChangeKeyboardDevice (client)
KeyClassPtr k;
xChangeKeyboardDeviceReply rep;
changeDeviceNotify ev;
- extern Bool Must_have_memory;
REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
@@ -169,14 +172,14 @@ ProcXChangeKeyboardDevice (client)
for (i=0; i<df->traceSize; i++)
df->trace[i] = xf->trace[i];
RegisterOtherDevice (xkbd);
- RegisterKeyboardDevice ((DevicePtr)dev);
+ RegisterKeyboardDevice (dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewKeyboard;
- SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1);
+ SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
@@ -195,6 +198,7 @@ ProcXChangeKeyboardDevice (client)
*
*/
+void
SRepXChangeKeyboardDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c
index 3e70f2dcf..2b638252f 100644
--- a/Xi/chgkmap.c
+++ b/Xi/chgkmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgkmap.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceMappingNotify;
-DeviceIntPtr LookupDeviceIntRec();
+#include "chgkmap.h"
/***********************************************************************
*
@@ -99,6 +101,7 @@ SProcXChangeDeviceKeyMapping(client)
*
*/
+int
ProcXChangeDeviceKeyMapping(client)
register ClientPtr client;
{
@@ -120,7 +123,7 @@ ProcXChangeDeviceKeyMapping(client)
ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
- &stuff[1]);
+ (KeySym *)&stuff[1]);
if (ret != Success)
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
diff --git a/Xi/chgprop.c b/Xi/chgprop.c
index 769bcbbb9..96ce0bebe 100644
--- a/Xi/chgprop.c
+++ b/Xi/chgprop.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgprop.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,14 @@ SOFTWARE.
#include "windowstr.h"
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
-extern int BadMode;
-extern int BadClass;
-extern int IReqCode;
-DeviceIntPtr LookupDeviceIntRec();
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgprop.h"
+#include "grabdev.h"
/***********************************************************************
*
@@ -100,6 +104,7 @@ SProcXChangeDeviceDontPropagateList(client)
*
*/
+int
ProcXChangeDeviceDontPropagateList (client)
register ClientPtr client;
{
diff --git a/Xi/chgptr.c b/Xi/chgptr.c
index 8c65c6ec2..c6ece1d65 100644
--- a/Xi/chgptr.c
+++ b/Xi/chgptr.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgptr.c,v 3.7 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -56,21 +57,21 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
-extern int IReqCode;
-extern int BadDevice;
-extern int ChangeDeviceNotify;
-extern Mask ChangeDeviceNotifyMask;
-extern InputInfo inputInfo;
-extern ScreenInfo screenInfo;
-extern WindowPtr *WindowTable;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#include "dixevents.h"
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgptr.h"
/***********************************************************************
*
@@ -97,6 +98,7 @@ SProcXChangePointerDevice(client)
*
*/
+int
ProcXChangePointerDevice (client)
register ClientPtr client;
{
@@ -157,14 +159,14 @@ ProcXChangePointerDevice (client)
if (!dev->ptrfeed)
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
RegisterOtherDevice (xptr);
- RegisterPointerDevice ((DevicePtr)dev);
+ RegisterPointerDevice (dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewPointer;
- SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1);
+ SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingPointer, 0, 0, client);
rep.status = 0;
@@ -175,6 +177,7 @@ ProcXChangePointerDevice (client)
return Success;
}
+void
DeleteFocusClassDeviceStruct(dev)
DeviceIntPtr dev;
{
@@ -189,6 +192,7 @@ DeleteFocusClassDeviceStruct(dev)
*
*/
+void
SendEventToAllWindows (dev, mask, ev, count)
DeviceIntPtr dev;
Mask mask;
@@ -214,6 +218,7 @@ SendEventToAllWindows (dev, mask, ev, count)
*
*/
+void
FindInterestedChildren (dev, p1, mask, ev, count)
DeviceIntPtr dev;
WindowPtr p1;
@@ -239,6 +244,7 @@ FindInterestedChildren (dev, p1, mask, ev, count)
*
*/
+void
SRepXChangePointerDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/closedev.c b/Xi/closedev.c
index 66fb185cb..1f7e7dbd2 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/closedev.c,v 3.4 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -61,13 +62,12 @@ SOFTWARE.
#include "scrnintstr.h" /* screen structure */
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern ScreenInfo screenInfo;
-extern WindowPtr *WindowTable;
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "closedev.h"
/***********************************************************************
*
@@ -137,6 +137,7 @@ ProcXCloseDevice(client)
*
*/
+void
DeleteEventsFromChildren(dev, p1, client)
DeviceIntPtr dev;
WindowPtr p1;
@@ -160,6 +161,7 @@ DeleteEventsFromChildren(dev, p1, client)
*
*/
+void
DeleteDeviceEvents (dev, pWin, client)
DeviceIntPtr dev;
WindowPtr pWin;
@@ -169,7 +171,7 @@ DeleteDeviceEvents (dev, pWin, client)
OtherInputMasks *pOthers;
GrabPtr grab, next;
- if (pOthers=wOtherInputMasks(pWin))
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others=pOthers->inputClients; others;
others = others->next)
if (SameClient(others,client))
diff --git a/Xi/devbell.c b/Xi/devbell.c
index 60e58e147..98520ec1c 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/devbell.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "devbell.h"
/***********************************************************************
*
@@ -89,6 +90,7 @@ SProcXDeviceBell(client)
*
*/
+int
ProcXDeviceBell (client)
register ClientPtr client;
{
@@ -99,7 +101,7 @@ ProcXDeviceBell (client)
int newpercent;
CARD8 class;
pointer ctrl;
- void (*proc)();
+ BellProcPtr proc;
REQUEST(xDeviceBellReq);
REQUEST_SIZE_MATCH(xDeviceBellReq);
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 7131b3c7a..76a693e6c 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -44,6 +44,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/exevents.c,v 3.10 2001/12/14 19:58:55 dawes Exp $ */
/********************************************************************
*
@@ -62,6 +63,14 @@ SOFTWARE.
#include "windowstr.h"
#include "miscstruct.h"
#include "region.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixevents.h" /* DeliverFocusedEvent */
+#include "dixgrabs.h" /* CreateGrab() */
+
+#include "chgptr.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \
@@ -72,24 +81,17 @@ SOFTWARE.
#define Motion_Filter(class) (DevicePointerMotionMask | \
(class)->state | (class)->motionMask)
-void ActivateKeyboardGrab();
-void DeactivateKeyboardGrab();
-void ProcessOtherEvent();
-void RecalculateDeviceDeliverableEvents();
-static Bool ShouldFreeInputMasks();
-static Bool MakeInputMasks ();
-extern int DeviceKeyPress;
-extern int DeviceButtonPress;
-extern int DeviceValuator;
-extern Mask DevicePointerMotionMask;
-extern Mask DeviceMappingNotifyMask;
-extern Mask DeviceButtonMotionMask;
-extern Mask DeviceButtonGrabMask;
-extern Mask DeviceOwnerGrabButtonMask;
-extern Mask PropagateMask[];
-extern WindowPtr GetSpriteWindow();
-extern InputInfo inputInfo;
-extern int RT_INPUTCLIENT;
+static Bool ShouldFreeInputMasks(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ Bool /* ignoreSelectedEvents */
+#endif
+ );
+static Bool MakeInputMasks (
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */
+#endif
+ );
/**************************************************************************
*
@@ -99,47 +101,40 @@ extern int RT_INPUTCLIENT;
void
RegisterOtherDevice (device)
- DevicePtr device;
+ DeviceIntPtr device;
{
- device->processInputProc = ProcessOtherEvent;
- device->realInputProc = ProcessOtherEvent;
- ((DeviceIntPtr)device)->ActivateGrab = ActivateKeyboardGrab;
- ((DeviceIntPtr)device)->DeactivateGrab = DeactivateKeyboardGrab;
+ device->public.processInputProc = ProcessOtherEvent;
+ device->public.realInputProc = ProcessOtherEvent;
+ (device)->ActivateGrab = ActivateKeyboardGrab;
+ (device)->DeactivateGrab = DeactivateKeyboardGrab;
}
-extern int DeviceMotionNotify;
-
/*ARGSUSED*/
void
ProcessOtherEvent (xE, other, count)
- deviceKeyButtonPointer *xE;
+ xEventPtr xE;
register DeviceIntPtr other;
int count;
{
- extern int DeviceKeyRelease;
- extern int DeviceButtonRelease;
- extern int ProximityIn;
- extern int ProximityOut;
register BYTE *kptr;
register int i;
register CARD16 modifiers;
register CARD16 mask;
GrabPtr grab = other->grab;
Bool deactivateDeviceGrab = FALSE;
- int key, bit, rootX, rootY;
+ int key = 0, bit = 0, rootX, rootY;
ButtonClassPtr b = other->button;
KeyClassPtr k = other->key;
ValuatorClassPtr v = other->valuator;
- void NoticeEventTime();
deviceValuator *xV = (deviceValuator *) xE;
- if (xE->type != DeviceValuator) {
+ if (xE->u.u.type != DeviceValuator) {
GetSpritePosition(&rootX, &rootY);
- xE->root_x = rootX;
- xE->root_y = rootY;
- key = xE->detail;
+ xE->u.keyButtonPointer.rootX = rootX;
+ xE->u.keyButtonPointer.rootY = rootY;
+ key = xE->u.u.detail;
NoticeEventTime(xE);
- xE->state = inputInfo.keyboard->key->state |
+ xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
inputInfo.pointer->button->state;
bit = 1 << (key & 7);
}
@@ -186,7 +181,7 @@ ProcessOtherEvent (xE, other, count)
}
}
- if (xE->type == DeviceKeyPress)
+ if (xE->u.u.type == DeviceKeyPress)
{
modifiers = k->modifierMap[key];
kptr = &k->down[key >> 3];
@@ -194,9 +189,9 @@ ProcessOtherEvent (xE, other, count)
{
if (!modifiers)
{
- xE->type = DeviceKeyRelease;
+ xE->u.u.type = DeviceKeyRelease;
ProcessOtherEvent(xE, other, count);
- xE->type = DeviceKeyPress;
+ xE->u.u.type = DeviceKeyPress;
/* release can have side effects, don't fall through */
ProcessOtherEvent(xE, other, count);
}
@@ -222,7 +217,7 @@ ProcessOtherEvent (xE, other, count)
return;
}
}
- else if (xE->type == DeviceKeyRelease)
+ else if (xE->u.u.type == DeviceKeyRelease)
{
kptr = &k->down[key >> 3];
if (!(*kptr & bit)) /* guard against duplicates */
@@ -249,7 +244,7 @@ ProcessOtherEvent (xE, other, count)
if (other->fromPassiveGrab && (key == other->activatingKey))
deactivateDeviceGrab = TRUE;
}
- else if (xE->type == DeviceButtonPress)
+ else if (xE->u.u.type == DeviceButtonPress)
{
kptr = &b->down[key >> 3];
*kptr |= bit;
@@ -257,18 +252,18 @@ ProcessOtherEvent (xE, other, count)
other->valuator->motionHintWindow = NullWindow;
b->buttonsDown++;
b->motionMask = DeviceButtonMotionMask;
- xE->detail = b->map[key];
- if (xE->detail == 0)
+ xE->u.u.detail = b->map[key];
+ if (xE->u.u.detail == 0)
return;
- if (xE->detail <= 5)
- b->state |= (Button1Mask >> 1) << xE->detail;
+ if (xE->u.u.detail <= 5)
+ b->state |= (Button1Mask >> 1) << xE->u.u.detail;
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
if (!grab)
if (CheckDeviceGrabs(other, xE, 0, count))
return;
}
- else if (xE->type == DeviceButtonRelease)
+ else if (xE->u.u.type == DeviceButtonRelease)
{
kptr = &b->down[key >> 3];
*kptr &= ~bit;
@@ -276,18 +271,18 @@ ProcessOtherEvent (xE, other, count)
other->valuator->motionHintWindow = NullWindow;
if (!--b->buttonsDown)
b->motionMask = 0;
- xE->detail = b->map[key];
- if (xE->detail == 0)
+ xE->u.u.detail = b->map[key];
+ if (xE->u.u.detail == 0)
return;
- if (xE->detail <= 5)
- b->state &= ~((Button1Mask >> 1) << xE->detail);
+ if (xE->u.u.detail <= 5)
+ b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
if (!b->state && other->fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
- else if (xE->type == ProximityIn)
+ else if (xE->u.u.type == ProximityIn)
other->valuator->mode &= ~OutOfProximity;
- else if (xE->type == ProximityOut)
+ else if (xE->u.u.type == ProximityOut)
other->valuator->mode |= OutOfProximity;
if (grab)
@@ -302,9 +297,9 @@ ProcessOtherEvent (xE, other, count)
(*other->DeactivateGrab)(other);
}
-InitProximityClassDeviceStruct(dev)
- DeviceIntPtr dev;
- {
+int
+InitProximityClassDeviceStruct( DeviceIntPtr dev)
+{
register ProximityClassPtr proxc;
proxc = (ProximityClassPtr)xalloc(sizeof(ProximityClassRec));
@@ -312,15 +307,17 @@ InitProximityClassDeviceStruct(dev)
return FALSE;
dev->proximity = proxc;
return TRUE;
- }
+}
-InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, max_res)
- DeviceIntPtr dev;
- int axnum;
- int minval;
- int maxval;
- int resolution;
- {
+void
+InitValuatorAxisStruct( DeviceIntPtr dev,
+ int axnum,
+ int minval,
+ int maxval,
+ int resolution,
+ int min_res,
+ int max_res )
+{
register AxisInfoPtr ax = dev->valuator->axes + axnum;
ax->min_value = minval;
@@ -328,18 +325,27 @@ InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, max_res)
ax->resolution = resolution;
ax->min_resolution = min_res;
ax->max_resolution = max_res;
- }
+}
-static void FixDeviceStateNotify (dev, ev, k, b, v, first)
+static void
+#if NeedFunctionPrototypes
+FixDeviceStateNotify (
+ DeviceIntPtr dev,
+ deviceStateNotify *ev,
+ KeyClassPtr k,
+ ButtonClassPtr b,
+ ValuatorClassPtr v,
+ int first)
+#else
+FixDeviceStateNotify (dev, ev, k, b, v, first)
DeviceIntPtr dev;
deviceStateNotify *ev;
KeyClassPtr k;
ButtonClassPtr b;
ValuatorClassPtr v;
int first;
- {
- extern int DeviceStateNotify;
-
+#endif
+{
ev->type = DeviceStateNotify;
ev->deviceid = dev->id;
ev->time = currentTime.milliseconds;
@@ -376,12 +382,21 @@ static void FixDeviceStateNotify (dev, ev, k, b, v, first)
}
}
-static void FixDeviceValuator (dev, ev, v, first)
+static void
+#if NeedFunctionPrototypes
+FixDeviceValuator (
+ DeviceIntPtr dev,
+ deviceValuator *ev,
+ ValuatorClassPtr v,
+ int first)
+#else
+FixDeviceValuator (dev, ev, v, first)
DeviceIntPtr dev;
deviceValuator *ev;
ValuatorClassPtr v;
int first;
- {
+#endif
+{
int nval = v->numAxes - first;
ev->type = DeviceValuator;
@@ -400,18 +415,12 @@ static void FixDeviceValuator (dev, ev, v, first)
first += ev->num_valuators;
}
+void
DeviceFocusEvent(dev, type, mode, detail, pWin)
DeviceIntPtr dev;
int type, mode, detail;
register WindowPtr pWin;
{
- extern int DeviceFocusIn;
- extern int DeviceFocusOut;
- extern int DeviceKeyStateNotify;
- extern int DeviceButtonStateNotify;
- extern int DeviceValuatorStateNotify;
- extern Mask DeviceStateNotifyMask;
- extern Mask DeviceFocusChangeMask;
deviceFocus event;
if (type == FocusIn)
@@ -426,15 +435,13 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
event.window = pWin->drawable.id;
event.time = currentTime.milliseconds;
- (void)
- DeliverEventsToWindow(pWin, &event, 1, DeviceFocusChangeMask, NullGrab,
- dev->id);
+ (void) DeliverEventsToWindow(pWin, (xEvent *)&event, 1,
+ DeviceFocusChangeMask, NullGrab, dev->id);
if ((type == DeviceFocusIn) &&
(wOtherInputMasks(pWin)) &&
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
{
- int i,j;
int evcount = 1;
deviceStateNotify *ev, *sev;
deviceKeyStateNotify *kev;
@@ -518,19 +525,34 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
nval -= 3;
if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator (dev, ev++, v, first);
+ FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
first += 3;
nval -= 3;
}
}
- (void) DeliverEventsToWindow(pWin, sev, evcount, DeviceStateNotifyMask,
- NullGrab, dev->id);
+ (void) DeliverEventsToWindow(pWin, (xEvent *)sev, evcount,
+ DeviceStateNotifyMask, NullGrab, dev->id);
xfree (sev);
}
}
int
+#if NeedFunctionPrototypes
+GrabButton(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ BYTE this_device_mode,
+ BYTE other_devices_mode,
+ CARD16 modifiers,
+ DeviceIntPtr modifier_device,
+ CARD8 button,
+ Window grabWindow,
+ BOOL ownerEvents,
+ Cursor rcursor,
+ Window rconfineTo,
+ Mask eventMask)
+#else
GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
modifier_device, button, grabWindow, ownerEvents, rcursor, rconfineTo,
eventMask)
@@ -546,11 +568,10 @@ GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
Cursor rcursor;
Window rconfineTo;
Mask eventMask;
-
+#endif
{
WindowPtr pWin, confineTo;
CursorPtr cursor;
- GrabPtr CreateGrab();
GrabPtr grab;
if ((this_device_mode != GrabModeSync) &&
@@ -609,6 +630,19 @@ GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
}
int
+#if NeedFunctionPrototypes
+GrabKey(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ BYTE this_device_mode,
+ BYTE other_devices_mode,
+ CARD16 modifiers,
+ DeviceIntPtr modifier_device,
+ CARD8 key,
+ Window grabWindow,
+ BOOL ownerEvents,
+ Mask mask)
+#else
GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
modifier_device, key, grabWindow, ownerEvents, mask)
ClientPtr client;
@@ -621,10 +655,9 @@ GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
Window grabWindow;
BOOL ownerEvents;
Mask mask;
-
+#endif
{
WindowPtr pWin;
- GrabPtr CreateGrab();
GrabPtr grab;
KeyClassPtr k = dev->key;
@@ -673,8 +706,6 @@ GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
return AddPassiveGrabToList(grab);
}
-extern Mask DevicePointerMotionHintMask;
-
int
SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
DeviceIntPtr dev;
@@ -803,7 +834,7 @@ RecalculateDeviceDeliverableEvents(pWin)
pChild = pWin;
while (1)
{
- if (inputMasks = wOtherInputMasks(pChild))
+ if ((inputMasks = wOtherInputMasks(pChild)) != 0)
{
for (others = inputMasks->inputClients; others;
others = others->next)
@@ -892,10 +923,10 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
Bool propagate;
xEvent *ev;
Mask mask;
+ int count;
{
WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
- WindowPtr GetCurrentRootWindow();
WindowPtr spriteWin=GetSpriteWindow();
if (dest == PointerWindow)
@@ -996,7 +1027,7 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
KeyCode *inputMap;
KeyClassPtr *k;
{
- KeyCode *map;
+ KeyCode *map = NULL;
int inputMapLen;
register int i;
@@ -1070,15 +1101,22 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
return(MappingSuccess);
}
-int
+void
+#if NeedFunctionPrototypes
+SendDeviceMappingNotify(
+ CARD8 request,
+ KeyCode firstKeyCode,
+ CARD8 count,
+ DeviceIntPtr dev)
+#else
SendDeviceMappingNotify(request, firstKeyCode, count, dev)
CARD8 request, count;
KeyCode firstKeyCode;
DeviceIntPtr dev;
- {
+#endif
+{
xEvent event;
deviceMappingNotify *ev = (deviceMappingNotify *) &event;
- extern int DeviceMappingNotify;
ev->type = DeviceMappingNotify;
ev->request = request;
@@ -1090,10 +1128,21 @@ SendDeviceMappingNotify(request, firstKeyCode, count, dev)
ev->count = count;
}
- SendEventToAllWindows (dev, DeviceMappingNotifyMask, ev, 1);
+ SendEventToAllWindows (dev, DeviceMappingNotifyMask, (xEvent *)ev, 1);
}
int
+#if NeedFunctionPrototypes
+ChangeKeyMapping(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ unsigned len,
+ int type,
+ KeyCode firstKeyCode,
+ CARD8 keyCodes,
+ CARD8 keySymsPerKeyCode,
+ KeySym *map)
+#else
ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
keySymsPerKeyCode, map)
ClientPtr client;
@@ -1104,6 +1153,7 @@ ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
CARD8 keyCodes;
CARD8 keySymsPerKeyCode;
KeySym *map;
+#endif
{
KeySymsRec keysyms;
KeyClassPtr k = dev->key;
@@ -1158,7 +1208,7 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
DeleteDeviceFromAnyExtEvents(pWin, dev);
if (freeResources)
- while (inputMasks = wOtherInputMasks(pWin))
+ while ((inputMasks = wOtherInputMasks(pWin)) != 0)
{
ic = inputMasks->inputClients;
for (i=0; i<EMASKSIZE; i++)
@@ -1167,6 +1217,7 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
}
}
+void
DeleteDeviceFromAnyExtEvents(pWin, dev)
WindowPtr pWin;
DeviceIntPtr dev;
@@ -1241,7 +1292,6 @@ MaybeSendDeviceMotionNotifyHint (pEvents, mask)
Mask mask;
{
DeviceIntPtr dev;
- DeviceIntPtr LookupDeviceIntRec ();
dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS);
if (pEvents->type == DeviceMotionNotify)
@@ -1262,7 +1312,7 @@ MaybeSendDeviceMotionNotifyHint (pEvents, mask)
return (0);
}
-int
+void
CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
WindowPtr pWin;
int type;
@@ -1272,7 +1322,6 @@ CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
Mask deliveryMask;
{
DeviceIntPtr dev;
- DeviceIntPtr LookupDeviceIntRec ();
dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS);
if (type == DeviceMotionNotify)
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 37148ebd2..ce5d96c8a 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/extinit.c,v 3.6 2001/12/14 19:58:55 dawes Exp $ */
/********************************************************************
*
@@ -55,6 +56,7 @@ SOFTWARE.
#define NUMTYPES 15
#define NEED_EVENTS
+#define NEED_REPLIES
#include "X.h"
#include "Xproto.h"
#include "inputstr.h"
@@ -63,6 +65,51 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h"
+#include "dixevents.h"
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
+#include "swaprep.h"
+
+/* modules local to Xi */
+#include "allowev.h"
+#include "chgdctl.h"
+#include "chgfctl.h"
+#include "chgkbd.h"
+#include "chgprop.h"
+#include "chgptr.h"
+#include "closedev.h"
+#include "devbell.h"
+#include "getbmap.h"
+#include "getbmap.h"
+#include "getdctl.h"
+#include "getfctl.h"
+#include "getfocus.h"
+#include "getkmap.h"
+#include "getmmap.h"
+#include "getprop.h"
+#include "getselev.h"
+#include "getvers.h"
+#include "getvers.h"
+#include "grabdev.h"
+#include "grabdevb.h"
+#include "grabdevk.h"
+#include "gtmotion.h"
+#include "listdev.h"
+#include "opendev.h"
+#include "queryst.h"
+#include "selectev.h"
+#include "sendexev.h"
+#include "chgkmap.h"
+#include "setbmap.h"
+#include "setdval.h"
+#include "setfocus.h"
+#include "setmmap.h"
+#include "setmode.h"
+#include "ungrdev.h"
+#include "ungrdevb.h"
+#include "ungrdevk.h"
+
static Mask lastExtEventMask = 1;
int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE];
@@ -141,10 +188,8 @@ int RT_INPUTCLIENT;
*
*/
-extern void (* ReplySwapVector[256]) ();
-extern void (* EventSwapVector[128]) ();
extern XExtensionVersion AllExtensionVersions[];
-extern InputInfo inputInfo;
+
Mask PropagateMask[MAX_DEVICES];
/*****************************************************************
@@ -153,12 +198,6 @@ Mask PropagateMask[MAX_DEVICES];
*
*/
-int ProcIDispatch();
-int SProcIDispatch();
-void SReplyIDispatch();
-void IResetProc();
-void SEventIDispatch();
-void NotImplemented();
static XExtensionVersion thisversion =
{XI_Present,
XI_Add_XChangeDeviceControl_Major,
@@ -177,10 +216,8 @@ static XExtensionVersion thisversion =
void
XInputExtensionInit()
- {
- ExtensionEntry *extEntry, *AddExtension();
- int XShutDownDevice();
- int InputClientGone();
+{
+ ExtensionEntry *extEntry;
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
@@ -189,9 +226,9 @@ XInputExtensionInit()
IReqCode = extEntry->base;
AllExtensionVersions[IReqCode-128] = thisversion;
MakeDeviceTypeAtoms ();
- RT_INPUTCLIENT = CreateNewResourceType(InputClientGone);
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone);
FixExtensionEvents (extEntry);
- ReplySwapVector[IReqCode] = SReplyIDispatch;
+ ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
@@ -224,7 +261,7 @@ XInputExtensionInit()
int
ProcIDispatch (client)
register ClientPtr client;
- {
+{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(ProcXGetExtensionVersion(client));
@@ -315,7 +352,7 @@ ProcIDispatch (client)
int
SProcIDispatch(client)
register ClientPtr client;
- {
+{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(SProcXGetExtensionVersion(client));
@@ -401,54 +438,59 @@ SProcIDispatch(client)
*
*/
+/* FIXME: this would be more concise and readable in ANSI C */
+#define DISPATCH(code) \
+ if (rep->RepType == X_##code) \
+ SRepX##code (client, len, (x##code##Reply *) rep)
+
void
SReplyIDispatch (client, len, rep)
ClientPtr client;
int len;
xGrabDeviceReply *rep; /* All we look at is the type field */
- { /* This is common to all replies */
+{ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
- SRepXGetExtensionVersion (client, len, rep);
+ SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep);
else if (rep->RepType == X_ListInputDevices)
- SRepXListInputDevices (client, len, rep);
+ SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep);
else if (rep->RepType == X_OpenDevice)
- SRepXOpenDevice (client, len, rep);
+ SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep);
else if (rep->RepType == X_SetDeviceMode)
- SRepXSetDeviceMode (client, len, rep);
+ SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
- SRepXGetSelectedExtensionEvents (client, len, rep);
+ SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
- SRepXGetDeviceDontPropagateList (client, len, rep);
+ SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep);
else if (rep->RepType == X_GetDeviceMotionEvents)
- SRepXGetDeviceMotionEvents (client, len, rep);
+ SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_ChangeKeyboardDevice)
- SRepXChangeKeyboardDevice (client, len, rep);
+ SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep);
else if (rep->RepType == X_ChangePointerDevice)
- SRepXChangePointerDevice (client, len, rep);
+ SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep);
else if (rep->RepType == X_GrabDevice)
- SRepXGrabDevice (client, len, rep);
+ SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep);
else if (rep->RepType == X_GetDeviceFocus)
- SRepXGetDeviceFocus (client, len, rep);
+ SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep);
else if (rep->RepType == X_GetFeedbackControl)
- SRepXGetFeedbackControl (client, len, rep);
+ SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
- SRepXGetDeviceKeyMapping (client, len, rep);
+ SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
- SRepXGetDeviceModifierMapping (client, len, rep);
+ SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
- SRepXSetDeviceModifierMapping (client, len, rep);
+ SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
- SRepXGetDeviceButtonMapping (client, len, rep);
+ SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
- SRepXSetDeviceButtonMapping (client, len, rep);
+ SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_QueryDeviceState)
- SRepXQueryDeviceState (client, len, rep);
+ SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep);
else if (rep->RepType == X_SetDeviceValuators)
- SRepXSetDeviceValuators (client, len, rep);
+ SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep);
else if (rep->RepType == X_GetDeviceControl)
- SRepXGetDeviceControl (client, len, rep);
+ SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep);
else if (rep->RepType == X_ChangeDeviceControl)
- SRepXChangeDeviceControl (client, len, rep);
+ SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep);
else
{
FatalError("XINPUT confused sending swapped reply");
@@ -461,15 +503,17 @@ SReplyIDispatch (client, len, rep)
*
* Swap any events defined in this extension.
*/
+#define DO_SWAP(func,type) func ((type *)from, (type *)to)
+
void
SEventIDispatch (from, to)
xEvent *from;
xEvent *to;
- {
+{
int type = from->u.u.type & 0177;
if (type == DeviceValuator)
- SEventDeviceValuator (from, to);
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress)
{
SKeyButtonPtrEvent (from, to);
@@ -496,9 +540,9 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceFocusIn)
- SEventFocus (from, to);
+ DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut)
- SEventFocus (from, to);
+ DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn)
{
SKeyButtonPtrEvent (from, to);
@@ -510,15 +554,15 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceStateNotify)
- SDeviceStateNotifyEvent (from, to);
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify)
- SDeviceKeyStateNotifyEvent (from, to);
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify)
- SDeviceButtonStateNotifyEvent (from, to);
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify)
- SDeviceMappingNotifyEvent (from, to);
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify)
- SChangeDeviceNotifyEvent (from, to);
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else
{
FatalError("XInputExtension: Impossible event!\n");
@@ -531,6 +575,7 @@ SEventIDispatch (from, to)
*
*/
+void
SEventDeviceValuator (from, to)
deviceValuator *from;
deviceValuator *to;
@@ -549,10 +594,11 @@ SEventDeviceValuator (from, to)
}
}
+void
SEventFocus (from, to)
deviceFocus *from;
deviceFocus *to;
- {
+{
register char n;
*to = *from;
@@ -561,10 +607,11 @@ SEventFocus (from, to)
swapl(&to->window, n);
}
+void
SDeviceStateNotifyEvent (from, to)
deviceStateNotify *from;
deviceStateNotify *to;
- {
+{
register int i;
register char n;
INT32 *ip B32;
@@ -579,30 +626,33 @@ SDeviceStateNotifyEvent (from, to)
}
}
+void
SDeviceKeyStateNotifyEvent (from, to)
deviceKeyStateNotify *from;
deviceKeyStateNotify *to;
- {
+{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
}
+void
SDeviceButtonStateNotifyEvent (from, to)
deviceButtonStateNotify *from;
deviceButtonStateNotify *to;
- {
+{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
}
+void
SChangeDeviceNotifyEvent (from, to)
changeDeviceNotify *from;
changeDeviceNotify *to;
- {
+{
register char n;
*to = *from;
@@ -610,10 +660,11 @@ SChangeDeviceNotifyEvent (from, to)
swapl(&to->time, n);
}
+void
SDeviceMappingNotifyEvent (from, to)
deviceMappingNotify *from;
deviceMappingNotify *to;
- {
+{
register char n;
*to = *from;
@@ -627,14 +678,11 @@ SDeviceMappingNotifyEvent (from, to)
*
*/
+void
FixExtensionEvents (extEntry)
ExtensionEntry *extEntry;
- {
- Mask mask, GetNextExtEventMask();
- void SetMaskForExtEvent();
- void SetEventInfo();
- void AllowPropagateSuppress();
- void SetExclusiveAccess();
+{
+ Mask mask;
DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1;
@@ -733,8 +781,9 @@ FixExtensionEvents (extEntry)
*
*/
+void
RestoreExtensionEvents ()
- {
+{
int i;
IReqCode = 0;
@@ -781,10 +830,11 @@ RestoreExtensionEvents ()
*/
void
-IResetProc()
+IResetProc(unused)
+ ExtensionEntry *unused;
{
- ReplySwapVector[IReqCode] = NotImplemented;
+ ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented;
EventSwapVector[DeviceKeyPress] = NotImplemented;
EventSwapVector[DeviceKeyRelease] = NotImplemented;
@@ -809,12 +859,12 @@ IResetProc()
*
*/
-int
+void
AssignTypeAndName (dev, type, name)
DeviceIntPtr dev;
Atom type;
char *name;
- {
+{
dev->type = type;
dev->name = (char *) xalloc(strlen(name)+1);
strcpy (dev->name, name);
@@ -826,7 +876,7 @@ AssignTypeAndName (dev, type, name)
*
*/
-int
+void
MakeDeviceTypeAtoms ()
{
int i;
@@ -844,9 +894,14 @@ MakeDeviceTypeAtoms ()
*/
DeviceIntPtr
+#if NeedFunctionPrototypes
+LookupDeviceIntRec (
+ CARD8 id)
+#else
LookupDeviceIntRec (id)
CARD8 id;
- {
+#endif
+{
DeviceIntPtr dev;
for (dev=inputInfo.devices; dev; dev=dev->next)
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index 35c2d5c7d..fb22a1422 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getbmap.c,v 3.3 2001/12/14 19:58:56 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getbmap.h"
/***********************************************************************
*
@@ -88,6 +89,7 @@ SProcXGetDeviceButtonMapping(client)
*
*/
+int
ProcXGetDeviceButtonMapping (client)
register ClientPtr client;
{
@@ -134,6 +136,7 @@ ProcXGetDeviceButtonMapping (client)
*
*/
+void
SRepXGetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 684160706..5b24bffbe 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getdctl.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/********************************************************************
*
@@ -59,12 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
-void CopySwapDeviceResolution();
+#include "getdctl.h"
/***********************************************************************
*
@@ -92,6 +92,7 @@ SProcXGetDeviceControl(client)
*
*/
+int
ProcXGetDeviceControl(client)
ClientPtr client;
{
@@ -134,7 +135,7 @@ ProcXGetDeviceControl(client)
return Success;
}
- buf = (char *) Xalloc (total_length);
+ buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
@@ -156,7 +157,7 @@ ProcXGetDeviceControl(client)
rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -210,6 +211,7 @@ CopySwapDeviceResolution (client, v, buf, length)
*
*/
+void
SRepXGetDeviceControl (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index e06470fbc..59c2c122b 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getfctl.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/********************************************************************
*
@@ -59,17 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
-void CopySwapKbdFeedback();
-void CopySwapPtrFeedback();
-void CopySwapIntegerFeedback();
-void CopySwapStringFeedback();
-void CopySwapLedFeedback();
-void CopySwapBellFeedback();
+#include "getfctl.h"
/***********************************************************************
*
@@ -95,6 +90,7 @@ SProcXGetFeedbackControl(client)
*
*/
+int
ProcXGetFeedbackControl(client)
ClientPtr client;
{
@@ -165,7 +161,7 @@ ProcXGetFeedbackControl(client)
return Success;
}
- buf = (char *) Xalloc (total_length);
+ buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
@@ -190,7 +186,7 @@ ProcXGetFeedbackControl(client)
rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -407,6 +403,7 @@ CopySwapBellFeedback (client, b, buf)
*
*/
+void
SRepXGetFeedbackControl (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index 1e34df413..2b916da11 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getfocus.c,v 3.3 2001/12/14 19:58:56 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getfocus.h"
/***********************************************************************
*
@@ -136,6 +137,7 @@ ProcXGetDeviceFocus(client)
*
*/
+void
SRepXGetDeviceFocus (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 783dc5506..4a7a7e296 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getkmap.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getkmap.h"
/***********************************************************************
*
@@ -89,10 +91,10 @@ SProcXGetDeviceKeyMapping(client)
*
*/
+int
ProcXGetDeviceKeyMapping(client)
register ClientPtr client;
{
- extern void CopySwap32Write();
xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev;
KeySymsPtr k;
@@ -140,7 +142,7 @@ ProcXGetDeviceKeyMapping(client)
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
- client->pSwapReplyFunc = CopySwap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient(
client,
k->mapWidth * stuff->count * sizeof(KeySym),
@@ -157,6 +159,7 @@ ProcXGetDeviceKeyMapping(client)
*
*/
+void
SRepXGetDeviceKeyMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 93b5748c0..67e36b442 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getmmap.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h" /* Request macro */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getmmap.h"
/***********************************************************************
*
@@ -89,6 +90,7 @@ SProcXGetDeviceModifierMapping(client)
*
*/
+int
ProcXGetDeviceModifierMapping(client)
ClientPtr client;
{
@@ -138,6 +140,7 @@ ProcXGetDeviceModifierMapping(client)
*
*/
+void
SRepXGetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getprop.c b/Xi/getprop.c
index ee53b87cb..a3f3226ea 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getprop.c,v 3.6 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,15 @@ SOFTWARE.
#include "windowstr.h" /* window structs */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
+
+#include "getprop.h"
-extern int IReqCode;
-extern void (* ReplySwapVector[256]) ();
extern XExtEventInfo EventInfo[];
-DeviceIntPtr LookupDeviceIntRec();
+extern int ExtEventIndex;
/***********************************************************************
*
@@ -91,16 +96,15 @@ SProcXGetDeviceDontPropagateList(client)
*
*/
+int
ProcXGetDeviceDontPropagateList (client)
register ClientPtr client;
{
CARD16 count = 0;
int i;
- XEventClass *buf, *tbuf;
+ XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
- XEventClass *ClassFromMask ();
- void Swap32Write();
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq);
@@ -121,7 +125,7 @@ ProcXGetDeviceDontPropagateList (client)
return Success;
}
- if (others = wOtherInputMasks(pWin))
+ if ((others = wOtherInputMasks(pWin)) != 0)
{
for (i=0; i<EMASKSIZE; i++)
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
@@ -129,7 +133,7 @@ ProcXGetDeviceDontPropagateList (client)
if (count)
{
rep.count = count;
- buf = (XEventClass *) Xalloc (rep.count * sizeof(XEventClass));
+ buf = (XEventClass *) xalloc (rep.count * sizeof(XEventClass));
rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
tbuf = buf;
@@ -144,9 +148,9 @@ ProcXGetDeviceDontPropagateList (client)
if (count)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
- Xfree (buf);
+ xfree (buf);
}
return Success;
}
@@ -169,7 +173,6 @@ XEventClass
int i,j;
int id = maskndx;
Mask tmask = 0x80000000;
- extern int ExtEventIndex;
for (i=0; i<32; i++,tmask>>=1)
if (tmask & mask)
@@ -193,6 +196,7 @@ XEventClass
*
*/
+void
SRepXGetDeviceDontPropagateList (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 8ac16d1d0..75b9137a6 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xi/getselev.c,v 3.6 2001/12/14 19:58:57 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -60,10 +61,13 @@ SOFTWARE.
#include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
-extern int IReqCode;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getprop.h"
+#include "getselev.h"
/***********************************************************************
*
@@ -99,11 +103,9 @@ ProcXGetSelectedExtensionEvents(client)
int total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
- XEventClass *buf;
+ XEventClass *buf = NULL;
XEventClass *tclient;
XEventClass *aclient;
- XEventClass *ClassFromMask ();
- void Swap32Write();
OtherInputMasks *pOthers;
InputClientsPtr others;
@@ -124,7 +126,7 @@ ProcXGetSelectedExtensionEvents(client)
return Success;
}
- if (pOthers=wOtherInputMasks(pWin))
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
{
for (others = pOthers->inputClients; others; others=others->next)
for (i=0; i<EMASKSIZE; i++)
@@ -143,7 +145,7 @@ ProcXGetSelectedExtensionEvents(client)
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof (XEventClass);
rep.length = (total_length + 3) >> 2;
- buf = (XEventClass *) Xalloc (total_length);
+ buf = (XEventClass *) xalloc (total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
@@ -160,9 +162,9 @@ ProcXGetSelectedExtensionEvents(client)
if (total_length)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient( client, total_length, buf);
- Xfree (buf);
+ xfree (buf);
}
return Success;
}
@@ -174,6 +176,7 @@ ProcXGetSelectedExtensionEvents(client)
*
*/
+void
SRepXGetSelectedExtensionEvents (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getvers.c b/Xi/getvers.c
index 8628a2851..c220b5a81 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getvers.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -59,10 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getvers.h"
-extern int IReqCode;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
XExtensionVersion AllExtensionVersions[128];
/***********************************************************************
@@ -90,6 +93,7 @@ SProcXGetExtensionVersion(client)
*
*/
+int
ProcXGetExtensionVersion (client)
register ClientPtr client;
{
@@ -133,6 +137,7 @@ ProcXGetExtensionVersion (client)
*
*/
+void
SRepXGetExtensionVersion (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index cb2370adf..80f948de5 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdev.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -61,13 +62,15 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixevents.h" /* GrabDevice */
+
+#include "grabdev.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int BadClass;
extern XExtEventInfo EventInfo[];
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+extern int ExtEventIndex;
/***********************************************************************
*
@@ -171,7 +174,6 @@ CreateMaskFromList (client, list, count, mask, dev, req)
int i,j;
int device;
DeviceIntPtr tdev;
- extern int ExtEventIndex;
for (i=0; i<EMASKSIZE; i++)
{
@@ -212,6 +214,7 @@ CreateMaskFromList (client, list, count, mask, dev, req)
*
*/
+void
SRepXGrabDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index ddc44c12d..cbc4fd8bd 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdevb.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,13 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "grabdev.h"
+#include "grabdevb.h"
/***********************************************************************
*
@@ -154,7 +157,7 @@ ProcXGrabDeviceButton(client)
return Success;
ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button,
- stuff->grabWindow, stuff->ownerEvents, NullCursor, NullWindow,
+ stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0,
tmp[stuff->grabbed_device].mask);
if (ret != Success)
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index 6db6b8d09..d7481801b 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdevk.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -60,13 +61,13 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadClass;
-extern int BadDevice;
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "grabdev.h"
+#include "grabdevk.h"
/***********************************************************************
*
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 65a4e0a19..1ddcca3ae 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/gtmotion.c,v 3.7 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "gtmotion.h"
/***********************************************************************
*
@@ -97,11 +99,11 @@ ProcXGetDeviceMotionEvents(client)
{
INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep;
- int i, j, num_events, axes, size, tsize;
+ unsigned long i;
+ int num_events, axes, size = 0, tsize;
unsigned long nEvents;
DeviceIntPtr dev;
TimeStamp start, stop;
- void XSwapTimeCoordWrite();
int length = 0;
ValuatorClassPtr v;
@@ -192,6 +194,7 @@ ProcXGetDeviceMotionEvents(client)
*
*/
+void
SRepXGetDeviceMotionEvents (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/listdev.c b/Xi/listdev.c
index ff6155f19..ac4c875a1 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/listdev.c,v 3.4 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -59,22 +60,14 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h" /* FIXME */
+
+#include "listdev.h"
#define VPC 20 /* Max # valuators per chunk */
-extern InputInfo inputInfo;
-extern int IReqCode;
-extern int BadDevice;
-extern void (*ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
-
-void CopySwapKeyClass ();
-void CopySwapButtonClass ();
-int CopySwapValuatorClass ();
-void SizeDeviceInfo ();
-void ListDeviceInfo ();
-void AddOtherInputDevices ();
-void CopyDeviceName ();
-void CopySwapDevice ();
/***********************************************************************
*
@@ -99,6 +92,7 @@ SProcXListInputDevices(client)
*
*/
+int
ProcXListInputDevices (client)
register ClientPtr client;
{
@@ -114,7 +108,6 @@ ProcXListInputDevices (client)
xDeviceInfo *dev;
DeviceIntPtr d;
- REQUEST(xListInputDevicesReq);
REQUEST_SIZE_MATCH(xListInputDevicesReq);
rep.repType = X_Reply;
@@ -131,7 +124,7 @@ ProcXListInputDevices (client)
SizeDeviceInfo (d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
- devbuf = (char *) Xalloc (total_length);
+ devbuf = (char *) xalloc (total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
@@ -146,7 +139,7 @@ ProcXListInputDevices (client)
rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -396,6 +389,7 @@ CopySwapValuatorClass (client, v, buf)
*
*/
+void
SRepXListInputDevices (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 30d6293f0..26210fa86 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/opendev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -56,17 +57,18 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
#include "windowstr.h" /* window structure */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "opendev.h"
-extern int IReqCode;
-extern int BadDevice;
extern CARD8 event_base [];
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
@@ -102,7 +104,6 @@ ProcXOpenDevice(client)
int status = Success;
xOpenDeviceReply rep;
DeviceIntPtr dev;
- void OpenInputDevice();
REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq);
@@ -186,6 +187,7 @@ ProcXOpenDevice(client)
*
*/
+void
SRepXOpenDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 66319b2f3..598ab85ae 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xi/queryst.c,v 3.5 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -41,11 +42,12 @@ from The Open Group.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "queryst.h"
/***********************************************************************
*
@@ -129,7 +131,7 @@ ProcXQueryDeviceState(client)
(v->numAxes * sizeof(int)));
num_classes++;
}
- buf = (char *) Xalloc (total_length);
+ buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
@@ -184,7 +186,7 @@ ProcXQueryDeviceState(client)
WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient (client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -195,6 +197,7 @@ ProcXQueryDeviceState(client)
*
*/
+void
SRepXQueryDeviceState (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/selectev.c b/Xi/selectev.c
index 510062993..a46a02928 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/selectev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -61,12 +62,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "selectev.h"
-extern int IReqCode;
extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[];
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
@@ -137,7 +142,7 @@ ProcXSelectExtensionEvent (client)
for (i=0; i<EMASKSIZE; i++)
if (tmp[i].dev != NULL)
{
- if ((ret = SelectForWindow(tmp[i].dev, pWin, client, tmp[i].mask,
+ if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask,
ExtExclusiveMasks[i], ExtValidMasks[i])) != Success)
{
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
index 36a1ad326..ae6f8cdc6 100644
--- a/Xi/sendexev.c
+++ b/Xi/sendexev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/sendexev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -61,12 +62,15 @@ SOFTWARE.
#include "windowstr.h" /* Window */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-extern void (* EventSwapVector[128]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "grabdev.h"
+#include "sendexev.h"
+
+extern int lastEvent; /* Defined in extension.c */
/***********************************************************************
*
@@ -83,7 +87,7 @@ SProcXSendExtensionEvent(client)
register int i;
xEvent eventT;
xEvent *eventP;
- void (*proc)(), NotImplemented();
+ EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length, n);
@@ -116,11 +120,11 @@ SProcXSendExtensionEvent(client)
*
*/
+int
ProcXSendExtensionEvent (client)
register ClientPtr client;
{
int ret;
- extern int lastEvent; /* Defined in extension.c */
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
@@ -163,7 +167,7 @@ ProcXSendExtensionEvent (client)
return Success;
ret = (SendEvent (client, dev, stuff->destination,
- stuff->propagate, &stuff[1], tmp[stuff->deviceid].mask,
+ stuff->propagate, (xEvent *)&stuff[1], tmp[stuff->deviceid].mask,
stuff->num_events));
if (ret != Success)
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index b5335de05..52553948d 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setbmap.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -62,12 +63,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceMappingNotify;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setbmap.h"
/***********************************************************************
*
@@ -92,6 +93,7 @@ SProcXSetDeviceButtonMapping(client)
*
*/
+int
ProcXSetDeviceButtonMapping (client)
register ClientPtr client;
{
@@ -124,7 +126,7 @@ ProcXSetDeviceButtonMapping (client)
return Success;
}
- ret = SetButtonMapping (client, dev, stuff->map_length, &stuff[1]);
+ ret = SetButtonMapping (client, dev, stuff->map_length, (BYTE *)&stuff[1]);
if (ret == BadValue || ret == BadMatch)
{
@@ -150,6 +152,7 @@ ProcXSetDeviceButtonMapping (client)
*
*/
+void
SRepXSetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 533b1ef5b..fe2e13853 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setdval.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -56,14 +57,15 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setdval.h"
/***********************************************************************
*
@@ -154,6 +156,7 @@ ProcXSetDeviceValuators(client)
*
*/
+void
SRepXSetDeviceValuators (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/setfocus.c b/Xi/setfocus.c
index afa5de15b..599934549 100644
--- a/Xi/setfocus.c
+++ b/Xi/setfocus.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setfocus.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -61,11 +62,13 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h"
-extern int IReqCode;
-extern int BadDevice;
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "dixevents.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setfocus.h"
/***********************************************************************
*
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index 16f3373a8..4c4d19c8b 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setmmap.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/********************************************************************
*
@@ -59,12 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceMappingNotify;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setmmap.h"
/***********************************************************************
*
@@ -90,6 +91,7 @@ SProcXSetDeviceModifierMapping(client)
*
*/
+int
ProcXSetDeviceModifierMapping(client)
ClientPtr client;
{
@@ -116,7 +118,7 @@ ProcXSetDeviceModifierMapping(client)
ret = SetModifierMapping(client, dev, stuff->length,
(sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier,
- &stuff[1], &kp);
+ (BYTE *)&stuff[1], &kp);
if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed)
{
@@ -143,6 +145,7 @@ ProcXSetDeviceModifierMapping(client)
*
*/
+void
SRepXSetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/setmode.c b/Xi/setmode.c
index f2458f4e6..9c3feb4db 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setmode.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -56,14 +57,15 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setmode.h"
/***********************************************************************
*
@@ -138,6 +140,7 @@ ProcXSetDeviceMode(client)
*
*/
+void
SRepXSetDeviceMode (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 9c9269719..991f8b433 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/stubs.c,v 3.4 2001/12/14 19:58:59 dawes Exp $ */
/*
* stubs.c -- stub routines for the X server side of the XINPUT
@@ -62,6 +63,7 @@ SOFTWARE.
#include "inputstr.h"
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
/***********************************************************************
*
@@ -95,6 +97,7 @@ ChangeKeyboardDevice (old_dev, new_dev)
/***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/
+ return BadMatch;
}
@@ -129,9 +132,17 @@ ChangeKeyboardDevice (old_dev, new_dev)
*/
int
+#if NeedFunctionPrototypes
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+#else
ChangePointerDevice (old_dev, new_dev, x, y)
DeviceIntPtr old_dev, new_dev;
unsigned char x, y;
+#endif
{
/***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
@@ -143,6 +154,7 @@ ChangePointerDevice (old_dev, new_dev, x, y)
else
axes_changed = FALSE;
*************************************************************************/
+ return BadMatch;
}
/***********************************************************************
@@ -194,13 +206,13 @@ CloseInputDevice (d, client)
void
AddOtherInputDevices ()
{
+ /**********************************************************************
+ for each uninitialized device, do something like:
+
DeviceIntPtr dev;
DeviceProc deviceProc;
pointer private;
- /**********************************************************************
- for each uninitialized device, do something like:
-
dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
dev->public.devicePrivate = private;
RegisterOtherDevice(dev);
diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c
index 90a01a4bc..a1ab911fe 100644
--- a/Xi/ungrdev.c
+++ b/Xi/ungrdev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdev.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "ungrdev.h"
/***********************************************************************
*
diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c
index 917efda9c..66ccc72af 100644
--- a/Xi/ungrdevb.c
+++ b/Xi/ungrdevb.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevb.c,v 3.4 2001/12/14 19:59:00 dawes Exp $ */
/***********************************************************************
*
@@ -60,15 +61,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixgrabs.h"
+
+#include "ungrdevb.h"
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
Mod3Mask | Mod4Mask | Mod5Mask )
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceButtonPress;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c
index 26c75f365..d7632db2a 100644
--- a/Xi/ungrdevk.c
+++ b/Xi/ungrdevk.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevk.c,v 3.4 2001/12/14 19:59:00 dawes Exp $ */
/***********************************************************************
*
@@ -60,15 +61,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixgrabs.h"
+
+#include "ungrdevk.h"
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
Mod3Mask | Mod4Mask | Mod5Mask )
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-extern int DeviceKeyPress;
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
diff --git a/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias b/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
index e69de29bb..1499aa845 100644
--- a/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
+++ b/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
@@ -0,0 +1 @@
+! So the file isn't empty
diff --git a/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias b/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
index e69de29bb..1499aa845 100644
--- a/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
+++ b/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
@@ -0,0 +1 @@
+! So the file isn't empty
diff --git a/Xprint/AttrValid.c b/Xprint/AttrValid.c
index 1303701af..83d6b9674 100644
--- a/Xprint/AttrValid.c
+++ b/Xprint/AttrValid.c
@@ -30,13 +30,11 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include <scrnintstr.h>
+/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.5 2001/12/21 21:02:04 dawes Exp $ */
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <scrnintstr.h>
-#include "AttrValid.h"
+#include "attributes.h"
/*
* default medium-source-sizes supported = na-letter w/.25" margins
@@ -48,7 +46,7 @@ static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
&DefaultMediumSize, 1
};
static XpOidMediumSourceSize DefaultMediumSourceSize = {
- xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
+ xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
};
static XpOidMediumSS DefaultMediumSS = {
&DefaultMediumSourceSize, 1
@@ -300,7 +298,7 @@ XpPutMediumSSAttr(XpContextPtr pContext,
}
const XpOidMediumSS*
-XpGetDefaultMediumSS()
+XpGetDefaultMediumSS(void)
{
return &DefaultMediumSS;
}
diff --git a/Xprint/AttrValid.h b/Xprint/AttrValid.h
index dab3c2def..87ab48b69 100644
--- a/Xprint/AttrValid.h
+++ b/Xprint/AttrValid.h
@@ -30,12 +30,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.7 2001/12/21 21:02:04 dawes Exp $ */
#ifndef _Xp_AttrValid_h
#define _Xp_AttrValid_h
+#include <X11/extensions/Printstr.h>
#include "Oid.h"
-#include "attributes.h"
#define XpNumber(a) (sizeof(a) / sizeof(*(a)))
@@ -83,6 +84,9 @@ typedef struct
(const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
#define XpPutStringAttr(pContext, pool, oid, value) \
XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
+
+#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
+
/*
* XpOid-valued attribute access
*/
@@ -175,7 +179,7 @@ void XpPutMediumSSAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidMediumSS* msss);
-const XpOidMediumSS* XpGetDefaultMediumSS();
+const XpOidMediumSS* XpGetDefaultMediumSS(void);
/*
* XpOidTrayMediumList-valued attribute access
@@ -189,12 +193,15 @@ void XpPutTrayMediumListAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidTrayMediumList* tm);
+BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
+
/*
* Attribute pool validation
*/
void XpValidateAttributePool(XpContextPtr pContext,
XPAttributes pool,
const XpValidatePoolsRec* vpr);
+void XpValidateNotificationProfile(XpContextPtr pContext);
void XpValidatePrinterPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidateJobPool(XpContextPtr pContext,
@@ -203,6 +210,10 @@ void XpValidateDocumentPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidatePagePool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
+void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes);
+#endif /* _XP_PRINT_SERVER_ */
#endif /* _Xp_AttrValid_h - don't add anything after this line */
diff --git a/Xprint/DiPrint.h b/Xprint/DiPrint.h
index a4b969141..3830c20d2 100644
--- a/Xprint/DiPrint.h
+++ b/Xprint/DiPrint.h
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/DiPrint.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
+
/*
* The XpDiListEntry struct is the type of each element of the array
* handed back to the extension code to handle a GetPrinterList request.
@@ -38,6 +40,11 @@ copyright holders.
* request will allow us to build it with the description in the locale of
* the requesting client.
*/
+#ifndef _XpDiPrint_H_
+#define _XpDiPrint_H_ 1
+
+#include "scrnintstr.h"
+
typedef struct _diListEntry {
char *name;
char *description;
@@ -52,3 +59,17 @@ extern XpDiListEntry **XpDiGetPrinterList(
char *name,
int localeLen,
char *locale);
+
+extern char * XpDiGetDriverName(int index, char *printerName);
+
+extern WindowPtr XpDiValidatePrinter(char *printerName, int printerNameLen);
+
+extern int XprintOptions(int argc, char **argv, int i);
+
+extern void PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv);
+
+extern void _XpVoidNoop(void);
+
+extern Bool _XpBoolNoop(void);
+
+#endif /* _XpDiPrint_H_ */
diff --git a/Xprint/Init.c b/Xprint/Init.c
index 06757fa77..a022c31c7 100644
--- a/Xprint/Init.c
+++ b/Xprint/Init.c
@@ -50,6 +50,7 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.13 2001/12/21 21:02:04 dawes Exp $ */
#include <unistd.h>
#include <stdlib.h>
@@ -74,53 +75,23 @@ copyright holders.
#include "cursor.h"
#include "misc.h"
#include "windowstr.h"
-#include "scrnintstr.h"
#include "inputstr.h"
#include "gcstruct.h"
#include "fonts/fontstruct.h"
#include "errno.h"
-#define _XP_PRINT_SERVER_
-#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
-
typedef char *XPointer;
+#define HAVE_XPointer 1
+
#define Status int
#include <Xresource.h>
#include "DiPrint.h"
-#include "AttrValid.h"
#include "attributes.h"
-extern char *display; /* display number as a string */
-
-#if 0
-/* extern char *Xalloc(); */
-extern void Xfree();
-/* extern char *Xrealloc(); */
-#else
#include "os.h"
-#endif
-
-extern char *getenv();
-extern void XpAddPrinterAttribute();
-extern char *XpGetConfigDir();
-extern XpContextPtr XpContextOfClient();
-
-/*
-extern int GiveUp();
-*/
-
-extern WindowPtr *WindowTable; /* declared in dix:globals.c */
-
-#if NeedFunctionPrototypes
-
-static void GetDriverFromPrinterName(
- char *printerName,
- char **driverName,
- Bool (**initScreenFunc)());
static void GenericScreenInit(
int index,
ScreenPtr pScreen,
@@ -132,15 +103,6 @@ static Bool InitPrintDrivers(
int argc,
char **argv);
-#else
-
-static void GetDriverFromPrinterName();
-static void GenericScreenInit();
-static Bool InitPrintDrivers();
-
-#endif
-
-
/*
* The following two defines are used to build the name "X*printers", where
* the "*" is replaced by the display number. This is used to construct
@@ -188,7 +150,7 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
" print substr($5, 1, x-1)"
" }' | sort";
#else
-#if defined(CSRG_BASED) || defined(linux)
+#if defined(CSRG_BASED) || defined(linux) || defined(ISC) || defined(__GNUC__)
const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
"sed -e /:/s/// | sort";
#else
@@ -209,12 +171,11 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
static
PixmapFormatRec RasterPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
-extern Bool InitializeRasterDriver();
-extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
+#include "raster/Raster.h"
#endif
@@ -222,51 +183,45 @@ extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
static
PixmapFormatRec ColorPclPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD,
- 8, 8, BITMAP_SCANLINE_PAD,
- 24,32, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
-extern Bool InitializeColorPclDriver();
-extern XpValidatePoolsRec PclValidatePoolsRec;
-
#endif
#ifdef XPMONOPCLDDX
static
PixmapFormatRec MonoPclPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
-extern Bool InitializeMonoPclDriver();
-extern XpValidatePoolsRec PclValidatePoolsRec;
+#endif
+#if defined(XPPCLDDX) || defined(XPMONOPCLDDX)
+#include "pcl/Pcl.h"
#endif
#ifdef XPPSDDX
static
PixmapFormatRec PSPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD,
- 8, 8, BITMAP_SCANLINE_PAD,
- 24,32, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
-extern Bool InitializePsDriver();
-extern XpValidatePoolsRec PsValidatePoolsRec;
+#include "ps/Ps.h"
#endif
-
-typedef Bool (*pBFunc)();
-typedef void (*pVFunc)();
/*
* The driverInitArray contains an entry for each driver the
* server knows about. Each element contains pointers to pixmap formats, the
@@ -375,10 +330,6 @@ static const char configFilePath[] =
static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
-static int printScreenPrivIndex,
- printWindowPrivIndex,
- printGCPrivIndex;
-static unsigned long printGeneration = 0;
static char *configFileName = (char *)NULL;
static Bool freeDefaultFontPath = FALSE;
static char *origFontPath = (char *)NULL;
@@ -389,12 +340,11 @@ static char *origFontPath = (char *)NULL;
* of the next option to process.
*/
int
-XprintOptions(argc, argv, i)
- int argc;
- char **argv;
- int i;
+XprintOptions(
+ int argc,
+ char **argv,
+ int i)
{
- extern void ddxUseMsg();
if(strcmp(argv[i], "-XpFile") == 0)
{
if ((i + 1) >= argc) {
@@ -427,9 +377,7 @@ static pIFunc
GetInitFunc(driverName)
*/
-static Bool (*
-GetInitFunc(driverName))()
- char *driverName;
+static pBFunc GetInitFunc(char *driverName)
{
driverInitRec *pInitRec;
int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
@@ -441,7 +389,7 @@ GetInitFunc(driverName))()
return pInitRec->initFunc;
}
- return (Bool(*)())NULL;
+ return 0;
}
static void
@@ -464,17 +412,17 @@ GetDimFuncAndRec(
}
}
- *dimensionsFunc = (pVFunc)NULL;
- *pValRec = (XpValidatePoolsRec *)NULL;
+ *dimensionsFunc = 0;
+ *pValRec = 0;
return;
}
static void
-FreePrinterDb()
+FreePrinterDb(void)
{
PrinterDbPtr pCurEntry, pNextEntry;
- for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
+ for(pCurEntry = printerDb, pNextEntry = 0;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
{
pNextEntry = pCurEntry->next;
@@ -486,7 +434,7 @@ FreePrinterDb()
*/
xfree(pCurEntry);
}
- printerDb = (PrinterDbPtr)NULL;
+ printerDb = 0;
}
/*
@@ -496,8 +444,7 @@ FreePrinterDb()
* XXX AddPrinterDbName needs to check for (and not add) duplicate names.
*/
static Bool
-AddPrinterDbName(name)
- char *name;
+AddPrinterDbName(char *name)
{
PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
@@ -519,8 +466,7 @@ AddPrinterDbName(name)
}
static void
-AugmentPrinterDb(command)
- char *command;
+AugmentPrinterDb(const char *command)
{
FILE *fp;
char name[256];
@@ -539,7 +485,7 @@ AugmentPrinterDb(command)
* FreeNameMap frees all remaining memory associated with the nameMap.
*/
static void
-FreeNameMap()
+FreeNameMap(void)
{
NameMapPtr pEntry, pTmp;
@@ -561,9 +507,7 @@ FreeNameMap()
* AddNameMap adds an element to the nameMap linked list.
*/
static Bool
-AddNameMap(name, qualifier)
- char *name;
- char *qualifier;
+AddNameMap(char *name, char *qualifier)
{
NameMapPtr pEntry;
@@ -585,7 +529,7 @@ AddNameMap(name, qualifier)
* is NULLed out.
*/
static void
-MergeNameMap()
+MergeNameMap(void)
{
NameMapPtr pMap;
PrinterDbPtr pDb;
@@ -608,7 +552,7 @@ MergeNameMap()
* each printer in the printerDb.
*/
static void
-CreatePrinterAttrs()
+CreatePrinterAttrs(void)
{
PrinterDbPtr pDb;
@@ -642,7 +586,7 @@ CreatePrinterAttrs()
* the screens.
*/
static void
-StoreDriverNames()
+StoreDriverNames(void)
{
PrinterDbPtr pEntry;
@@ -653,7 +597,7 @@ StoreDriverNames()
"xp-ddx-identifier");
if(pEntry->driverName == (char *)NULL ||
strlen(pEntry->driverName) == 0 ||
- GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
+ GetInitFunc(pEntry->driverName) == 0)
{
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
ErrorF("Xp Extension: Can't load driver %s\n",
@@ -670,7 +614,7 @@ StoreDriverNames()
}
}
-char *
+static char *
MbStrchr(
char *str,
int ch)
@@ -699,7 +643,7 @@ MbStrchr(
* string must be freed by the caller.
*/
static char *
-GetConfigFileName()
+GetConfigFileName(void)
{
/*
* We need to find the system-wide file, if one exists. This
@@ -711,7 +655,7 @@ GetConfigFileName()
/*
* Check for a LANG-specific file.
*/
- if(dirName = XpGetConfigDir(TRUE))
+ if ((dirName = XpGetConfigDir(TRUE)) != 0)
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@@ -730,7 +674,7 @@ GetConfigFileName()
xfree(filePath);
}
- if(dirName = XpGetConfigDir(FALSE))
+ if ((dirName = XpGetConfigDir(FALSE)) != 0)
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@@ -760,9 +704,8 @@ GetConfigFileName()
* XXX
*/
static PrinterDbPtr
-BuildPrinterDb()
+BuildPrinterDb(void)
{
- char *printerList, *augmentCmd = (char *)NULL;
Bool defaultAugment = TRUE, freeConfigFileName;
if(configFileName && access(configFileName, R_OK) != 0)
@@ -789,7 +732,7 @@ BuildPrinterDb()
{
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
{
- if(ptr = MbStrchr(tok, '\012'))
+ if ((ptr = MbStrchr(tok, '\012')) != 0)
*ptr = (char)'\0';
AddPrinterDbName(tok);
}
@@ -855,8 +798,7 @@ BuildPrinterDb()
}
static void
-FreeDriverMap(driverMap)
- DriverMapPtr driverMap;
+FreeDriverMap(DriverMapPtr driverMap)
{
DriverMapPtr pCurEntry, pNextEntry;
@@ -882,7 +824,7 @@ FreeDriverMap(driverMap)
* the next rehash or server recycle.
*/
int
-XpRehashPrinterList()
+XpRehashPrinterList(void)
{
PrinterDbPtr pEntry, pPrev;
DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt;
@@ -1014,7 +956,7 @@ FindFontDir(
return (char *)NULL;
configDir = XpGetConfigDir(TRUE);
- if(fontDir = ValidateFontDir(configDir, modelName))
+ if ((fontDir = ValidateFontDir(configDir, modelName)) != 0)
{
xfree(configDir);
return fontDir;
@@ -1074,10 +1016,10 @@ AddToFontPath(
* and to properly free the modified version upon server recycle.
*/
static void
-AugmentFontPath()
+AugmentFontPath(void)
{
- char *newPath, *modelID, **allIDs = (char **)NULL;
- PrinterDbPtr pDb, pDbEntry;
+ char *modelID, **allIDs = (char **)NULL;
+ PrinterDbPtr pDbEntry;
int numModels, i;
if(!origFontPath)
@@ -1135,7 +1077,7 @@ AugmentFontPath()
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
{
char *fontDir;
- if(fontDir = FindFontDir(allIDs[i]))
+ if ((fontDir = FindFontDir(allIDs[i])) != 0)
{
AddToFontPath(fontDir);
xfree(fontDir);
@@ -1225,7 +1167,7 @@ XpClientIsPrintClient(
* fpe->name.
*/
if(fpe->name_length < PATH_PREFIX_LEN ||
- (strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) ||
+ (strlen(fontDir) != (unsigned)(fpe->name_length - PATH_PREFIX_LEN)) ||
strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
fpe->name_length - PATH_PREFIX_LEN))
{
@@ -1237,9 +1179,7 @@ XpClientIsPrintClient(
}
static void
-AddFormats(pScreenInfo, driverName)
- ScreenInfo *pScreenInfo;
- char *driverName;
+AddFormats(ScreenInfo *pScreenInfo, char *driverName)
{
int i, j;
driverInitRec *pInitRec;
@@ -1290,10 +1230,10 @@ AddFormats(pScreenInfo, driverName)
************************************************************/
void
-PrinterInitOutput(pScreenInfo, argc, argv)
- ScreenInfo *pScreenInfo;
- int argc;
- char **argv;
+PrinterInitOutput(
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
{
PrinterDbPtr pDb, pDbEntry;
int driverCount = 0, i;
@@ -1454,11 +1394,11 @@ PrinterInitOutput(pScreenInfo, argc, argv)
* screen.
*/
static Bool
-InitPrintDrivers(index, pScreen, argc, argv)
- int index;
- ScreenPtr pScreen;
- int argc;
- char **argv;
+InitPrintDrivers(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
{
PrinterDbPtr pDb, pDb2;
@@ -1479,7 +1419,7 @@ InitPrintDrivers(index, pScreen, argc, argv)
}
if(callInit == TRUE)
{
- Bool (*initFunc)();
+ pBFunc initFunc;
initFunc = GetInitFunc(pDb->driverName);
if(initFunc(index, pScreen, argc, argv) == FALSE)
{
@@ -1492,13 +1432,13 @@ InitPrintDrivers(index, pScreen, argc, argv)
}
void
-_XpVoidNoop()
+_XpVoidNoop(void)
{
return;
}
Bool
-_XpBoolNoop()
+_XpBoolNoop(void)
{
return TRUE;
}
@@ -1510,16 +1450,15 @@ _XpBoolNoop()
*/
static void
-GenericScreenInit( index, pScreen, argc, argv )
- int index;
- ScreenPtr pScreen;
- int argc;
- char **argv;
+GenericScreenInit(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
{
- int i;
float fWidth, fHeight, maxWidth, maxHeight;
unsigned short width, height;
- PrinterDbPtr pDb, pDb2;
+ PrinterDbPtr pDb;
int res, maxRes;
/*
@@ -1543,7 +1482,6 @@ GenericScreenInit( index, pScreen, argc, argv )
{
if(pDb->screenNum == index)
{
-
XpValidatePoolsRec *pValRec;
pVFunc dimensionsFunc;
@@ -1582,9 +1520,9 @@ GenericScreenInit( index, pScreen, argc, argv )
* freeing the associated memory.
*/
static char *
-QualifyName(fileName, searchPath)
- char *fileName;
- char *searchPath;
+QualifyName(
+ char *fileName,
+ char *searchPath)
{
char * curPath = searchPath;
char * nextPath;
@@ -1632,11 +1570,11 @@ QualifyName(fileName, searchPath)
* XXX "localeName" elements of the XpDiListEntry to the specified locale.
*/
static void
-FillPrinterListEntry(pEntry, pDb, localeLen, locale)
- XpDiListEntry *pEntry;
- PrinterDbPtr pDb;
- int localeLen;
- char *locale;
+FillPrinterListEntry(
+ XpDiListEntry *pEntry,
+ PrinterDbPtr pDb,
+ int localeLen,
+ char *locale)
{
static char *localeStr = (char *)NULL;
@@ -1659,18 +1597,19 @@ FillPrinterListEntry(pEntry, pDb, localeLen, locale)
*
*/
static Bool
-GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
- XpDiListEntry *pEntry;
- int nameLen;
- char *name;
- int localeLen;
- char *locale;
+GetPrinterListInfo(
+ XpDiListEntry *pEntry,
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale)
{
- PrinterDbPtr pDb, pDb2;
+ PrinterDbPtr pDb;
for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
{
- if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen))
+ if (strlen(pDb->name) == (unsigned)nameLen
+ && !strncmp(pDb->name, name, nameLen))
{
FillPrinterListEntry(pEntry, pDb, localeLen, locale);
return TRUE;
@@ -1684,8 +1623,7 @@ GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
* for a printer list.
*/
void
-XpDiFreePrinterList(list)
- XpDiListEntry **list;
+XpDiFreePrinterList(XpDiListEntry **list)
{
int i;
@@ -1705,18 +1643,18 @@ XpDiFreePrinterList(list)
* the information for all printers is desired.
*/
XpDiListEntry **
-XpDiGetPrinterList(nameLen, name, localeLen, locale)
- int nameLen;
- char *name;
- int localeLen;
- char *locale;
+XpDiGetPrinterList(
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale)
{
XpDiListEntry **pList;
if(!nameLen || name == (char *)NULL)
{
int i;
- PrinterDbPtr pDb, pDb2;
+ PrinterDbPtr pDb;
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
pDb = pDb->next, i++)
@@ -1763,17 +1701,14 @@ XpDiGetPrinterList(nameLen, name, localeLen, locale)
}
WindowPtr
-XpDiValidatePrinter(printerName, printerNameLen)
- char *printerName;
- int printerNameLen;
+XpDiValidatePrinter(char *printerName, int printerNameLen)
{
PrinterDbPtr pCurEntry;
- WindowPtr pWin;
for(pCurEntry = printerDb;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
{
- if(strlen(pCurEntry->name) == printerNameLen &&
+ if(strlen(pCurEntry->name) == (unsigned)printerNameLen &&
!strncmp(pCurEntry->name, printerName, printerNameLen))
return WindowTable[pCurEntry->screenNum];
}
@@ -1786,9 +1721,7 @@ XpDiValidatePrinter(printerName, printerNameLen)
* on the specified screen.
*/
char *
-XpDiGetDriverName(index, printerName)
- int index;
- char *printerName;
+XpDiGetDriverName(int index, char *printerName)
{
PrinterDbPtr pCurEntry;
diff --git a/Xprint/Oid.c b/Xprint/Oid.c
index 3fe926c00..ac0e54434 100644
--- a/Xprint/Oid.c
+++ b/Xprint/Oid.c
@@ -30,11 +30,9 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "Oid.h"
-#include <X11/Xfuncs.h> /* for memmove */
+/* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.5 2001/10/28 03:32:53 tsi Exp $ */
+
+#include "attributes.h"
/*
* XpOidNotify value strings
@@ -753,7 +751,7 @@ XpOidLinkedListFirstOid(XpOidLinkedList* me)
XpOid
XpOidLinkedListNextOid(XpOidLinkedList* me)
{
- if(me->current ? me->current = me->current->next : xFalse)
+ if(me->current ? (me->current = me->current->next) != 0 : xFalse)
return me->current->oid;
else
return xpoid_none;
@@ -1654,8 +1652,6 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
const XpOidMediumSS* msss)
{
int i_mss, i_ds, i_itm;
- XpOidMediumDiscreteSizeList* ds_list;
- int tray_count;
XpOid current_tray, current_medium;
XpOidMediumDiscreteSizeList* unspecified_tray_ds;
XpOidMediumDiscreteSizeList* tray_ds;
@@ -1715,6 +1711,7 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
* list
*/
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
+ {
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{
/*
@@ -1725,7 +1722,10 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
continue;
}
else
+ {
tray_ds = unspecified_tray_ds;
+ }
+ }
/*
* loop through the discrete sizes list, looking for a size that
* matches the medium for the current input tray
@@ -2107,15 +2107,13 @@ const char* XpOidNotifyString(XpOidNotify notify)
{
switch(notify)
{
+ default:
case XPOID_NOTIFY_UNSUPPORTED:
return (const char*)NULL;
- break;
case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR;
- break;
case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR;
- break;
}
}
@@ -2240,7 +2238,7 @@ XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
const char* first_nonws_ptr;
const char* format;
const char* variant;
- const char* version;
+ const char* version = 0;
int format_len;
int variant_len;
int version_len;
@@ -2553,10 +2551,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* variants must both be NULL or match
*/
if(fmt->variant == (char*)NULL)
+ {
if(list->list[i].variant == (char*)NULL)
return xTrue;
else
continue;
+ }
if(list->list[i].variant == (char*)NULL)
continue;
if(strcmp(fmt->variant, list->list[i].variant) != 0)
@@ -2565,10 +2565,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* versions must both be NULL or match
*/
if(fmt->version == (char*)NULL)
+ {
if(list->list[i].version == (char*)NULL)
return xTrue;
else
continue;
+ }
if(list->list[i].version == (char*)NULL)
continue;
if(strcmp(fmt->version, list->list[i].version) == 0)
diff --git a/Xprint/Oid.h b/Xprint/Oid.h
index 70bd8d3e5..c5574b06e 100644
--- a/Xprint/Oid.h
+++ b/Xprint/Oid.h
@@ -30,6 +30,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/Oid.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
#ifndef _Xp_Oid_h
#define _Xp_Oid_h
@@ -205,7 +206,7 @@ char* XpOidListString(const XpOidList*);
/*
* XpOidLinkedList public methods
*/
-XpOidLinkedList* XpOidLinkedListNew();
+XpOidLinkedList* XpOidLinkedListNew(void);
void XpOidLinkedListDelete(XpOidLinkedList*);
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
diff --git a/Xprint/OidStrs.h b/Xprint/OidStrs.h
index 81119378c..3aab300dc 100644
--- a/Xprint/OidStrs.h
+++ b/Xprint/OidStrs.h
@@ -30,136 +30,140 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* This is an automatically-generated file. Do not edit. */
+/* $XFree86: xc/programs/Xserver/Xprint/OidStrs.h,v 1.5 2001/12/21 21:02:05 dawes Exp $ */
static int XpOidStringMapCount = 127;
+#define OIDATA(name) { name, sizeof(name)-1, 0, 0, 0 }
+
static const XpOidStringMapEntry XpOidStringMap[] = {
- { "", 0 },
- { "", 0 },
- { "descriptor", 10 },
- { "content-orientation", 19 },
- { "copy-count", 10 },
- { "default-printer-resolution", 26 },
- { "default-input-tray", 18 },
- { "default-medium", 14 },
- { "document-format", 15 },
- { "plex", 4 },
- { "xp-listfonts-modes", 18 },
- { "job-name", 8 },
- { "job-owner", 9 },
- { "notification-profile", 20 },
- { "xp-setup-state", 14 },
- { "xp-spooler-command-options", 26 },
- { "content-orientations-supported", 30 },
- { "document-formats-supported", 26 },
- { "dt-pdm-command", 14 },
- { "input-trays-medium", 18 },
- { "medium-source-sizes-supported", 29 },
- { "plexes-supported", 16 },
- { "printer-model", 13 },
- { "printer-name", 12 },
- { "printer-resolutions-supported", 29 },
- { "xp-embedded-formats-supported", 29 },
- { "xp-listfonts-modes-supported", 28 },
- { "xp-page-attributes-supported", 28 },
- { "xp-raw-formats-supported", 24 },
- { "xp-setup-proviso", 16 },
- { "document-attributes-supported", 29 },
- { "job-attributes-supported", 24 },
- { "locale", 6 },
- { "multiple-documents-supported", 28 },
- { "available-compression", 21 },
- { "available-compressions-supported", 32 },
- { "portrait", 8 },
- { "landscape", 9 },
- { "reverse-portrait", 16 },
- { "reverse-landscape", 17 },
- { "iso-a0", 6 },
- { "iso-a1", 6 },
- { "iso-a2", 6 },
- { "iso-a3", 6 },
- { "iso-a4", 6 },
- { "iso-a5", 6 },
- { "iso-a6", 6 },
- { "iso-a7", 6 },
- { "iso-a8", 6 },
- { "iso-a9", 6 },
- { "iso-a10", 7 },
- { "iso-b0", 6 },
- { "iso-b1", 6 },
- { "iso-b2", 6 },
- { "iso-b3", 6 },
- { "iso-b4", 6 },
- { "iso-b5", 6 },
- { "iso-b6", 6 },
- { "iso-b7", 6 },
- { "iso-b8", 6 },
- { "iso-b9", 6 },
- { "iso-b10", 7 },
- { "na-letter", 9 },
- { "na-legal", 8 },
- { "executive", 9 },
- { "folio", 5 },
- { "invoice", 7 },
- { "ledger", 6 },
- { "quarto", 6 },
- { "iso-c3", 6 },
- { "iso-c4", 6 },
- { "iso-c5", 6 },
- { "iso-c6", 6 },
- { "iso-designated-long", 19 },
- { "na-10x13-envelope", 17 },
- { "na-9x12-envelope", 16 },
- { "na-number-10-envelope", 21 },
- { "na-7x9-envelope", 15 },
- { "na-9x11-envelope", 16 },
- { "na-10x14-envelope", 17 },
- { "na-number-9-envelope", 20 },
- { "na-6x9-envelope", 15 },
- { "na-10x15-envelope", 17 },
- { "monarch-envelope", 16 },
- { "a", 1 },
- { "b", 1 },
- { "c", 1 },
- { "d", 1 },
- { "e", 1 },
- { "jis-b0", 6 },
- { "jis-b1", 6 },
- { "jis-b2", 6 },
- { "jis-b3", 6 },
- { "jis-b4", 6 },
- { "jis-b5", 6 },
- { "jis-b6", 6 },
- { "jis-b7", 6 },
- { "jis-b8", 6 },
- { "jis-b9", 6 },
- { "jis-b10", 7 },
- { "simplex", 7 },
- { "duplex", 6 },
- { "tumble", 6 },
- { "top", 3 },
- { "middle", 6 },
- { "bottom", 6 },
- { "envelope", 8 },
- { "manual", 6 },
- { "large-capacity", 14 },
- { "main", 4 },
- { "side", 4 },
- { "event-report-job-completed", 26 },
- { "electronic-mail", 15 },
- { "xp-setup-mandatory", 18 },
- { "xp-setup-optional", 17 },
- { "xp-setup-ok", 11 },
- { "xp-setup-incomplete", 19 },
- { "xp-list-glyph-fonts", 19 },
- { "xp-list-internal-printer-fonts", 30 },
- { "0", 1 },
- { "01", 2 },
- { "02", 2 },
- { "03", 2 },
- { "012", 3 },
- { "013", 3 },
- { "023", 3 },
- { "0123", 4 }
+ OIDATA(""),
+ OIDATA(""),
+ OIDATA("descriptor"),
+ OIDATA("content-orientation"),
+ OIDATA("copy-count"),
+ OIDATA("default-printer-resolution"),
+ OIDATA("default-input-tray"),
+ OIDATA("default-medium"),
+ OIDATA("document-format"),
+ OIDATA("plex"),
+ OIDATA("xp-listfonts-modes"),
+ OIDATA("job-name"),
+ OIDATA("job-owner"),
+ OIDATA("notification-profile"),
+ OIDATA("xp-setup-state"),
+ OIDATA("xp-spooler-command-options"),
+ OIDATA("content-orientations-supported"),
+ OIDATA("document-formats-supported"),
+ OIDATA("dt-pdm-command"),
+ OIDATA("input-trays-medium"),
+ OIDATA("medium-source-sizes-supported"),
+ OIDATA("plexes-supported"),
+ OIDATA("printer-model"),
+ OIDATA("printer-name"),
+ OIDATA("printer-resolutions-supported"),
+ OIDATA("xp-embedded-formats-supported"),
+ OIDATA("xp-listfonts-modes-supported"),
+ OIDATA("xp-page-attributes-supported"),
+ OIDATA("xp-raw-formats-supported"),
+ OIDATA("xp-setup-proviso"),
+ OIDATA("document-attributes-supported"),
+ OIDATA("job-attributes-supported"),
+ OIDATA("locale"),
+ OIDATA("multiple-documents-supported"),
+ OIDATA("available-compression"),
+ OIDATA("available-compressions-supported"),
+ OIDATA("portrait"),
+ OIDATA("landscape"),
+ OIDATA("reverse-portrait"),
+ OIDATA("reverse-landscape"),
+ OIDATA("iso-a0"),
+ OIDATA("iso-a1"),
+ OIDATA("iso-a2"),
+ OIDATA("iso-a3"),
+ OIDATA("iso-a4"),
+ OIDATA("iso-a5"),
+ OIDATA("iso-a6"),
+ OIDATA("iso-a7"),
+ OIDATA("iso-a8"),
+ OIDATA("iso-a9"),
+ OIDATA("iso-a10"),
+ OIDATA("iso-b0"),
+ OIDATA("iso-b1"),
+ OIDATA("iso-b2"),
+ OIDATA("iso-b3"),
+ OIDATA("iso-b4"),
+ OIDATA("iso-b5"),
+ OIDATA("iso-b6"),
+ OIDATA("iso-b7"),
+ OIDATA("iso-b8"),
+ OIDATA("iso-b9"),
+ OIDATA("iso-b10"),
+ OIDATA("na-letter"),
+ OIDATA("na-legal"),
+ OIDATA("executive"),
+ OIDATA("folio"),
+ OIDATA("invoice"),
+ OIDATA("ledger"),
+ OIDATA("quarto"),
+ OIDATA("iso-c3"),
+ OIDATA("iso-c4"),
+ OIDATA("iso-c5"),
+ OIDATA("iso-c6"),
+ OIDATA("iso-designated-long"),
+ OIDATA("na-10x13-envelope"),
+ OIDATA("na-9x12-envelope"),
+ OIDATA("na-number-10-envelope"),
+ OIDATA("na-7x9-envelope"),
+ OIDATA("na-9x11-envelope"),
+ OIDATA("na-10x14-envelope"),
+ OIDATA("na-number-9-envelope"),
+ OIDATA("na-6x9-envelope"),
+ OIDATA("na-10x15-envelope"),
+ OIDATA("monarch-envelope"),
+ OIDATA("a"),
+ OIDATA("b"),
+ OIDATA("c"),
+ OIDATA("d"),
+ OIDATA("e"),
+ OIDATA("jis-b0"),
+ OIDATA("jis-b1"),
+ OIDATA("jis-b2"),
+ OIDATA("jis-b3"),
+ OIDATA("jis-b4"),
+ OIDATA("jis-b5"),
+ OIDATA("jis-b6"),
+ OIDATA("jis-b7"),
+ OIDATA("jis-b8"),
+ OIDATA("jis-b9"),
+ OIDATA("jis-b10"),
+ OIDATA("simplex"),
+ OIDATA("duplex"),
+ OIDATA("tumble"),
+ OIDATA("top"),
+ OIDATA("middle"),
+ OIDATA("bottom"),
+ OIDATA("envelope"),
+ OIDATA("manual"),
+ OIDATA("large-capacity"),
+ OIDATA("main"),
+ OIDATA("side"),
+ OIDATA("event-report-job-completed"),
+ OIDATA("electronic-mail"),
+ OIDATA("xp-setup-mandatory"),
+ OIDATA("xp-setup-optional"),
+ OIDATA("xp-setup-ok"),
+ OIDATA("xp-setup-incomplete"),
+ OIDATA("xp-list-glyph-fonts"),
+ OIDATA("xp-list-internal-printer-fonts"),
+ OIDATA("0"),
+ OIDATA("01"),
+ OIDATA("02"),
+ OIDATA("03"),
+ OIDATA("012"),
+ OIDATA("013"),
+ OIDATA("023"),
+ OIDATA("0123")
};
+
+#undef OIDATA
diff --git a/Xprint/Util.c b/Xprint/Util.c
index efc196f82..9e0bdf925 100644
--- a/Xprint/Util.c
+++ b/Xprint/Util.c
@@ -30,18 +30,23 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include "Xos.h" /* for unistd.h and string.h */
+/* $XFree86: xc/programs/Xserver/Xprint/Util.c,v 1.13 2001/10/31 22:50:28 tsi Exp $ */
+
+/* To get the tempnam() prototype in <stdio.h> */
+#if defined(linux) && defined(__STRICT_ANSI__)
+#undef __STRICT_ANSI__
+#endif
+
+#include <X11/Xos.h> /* for unistd.h and string.h */
#include <stdio.h>
#include <sys/wait.h>
#include <sys/stat.h>
-#include "dixstruct.h"
-#include "scrnintstr.h"
#include "misc.h"
+#include "dixstruct.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Print.h"
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
+
+#include "attributes.h"
#define IN_FILE_STRING "%(InFile)%"
#define OUT_FILE_STRING "%(OutFile)%"
@@ -89,10 +94,10 @@ ReplaceAnyString(
* and the caller is responsible for freeing whatever string is returned.
*/
char *
-ReplaceFileString(string, inFileName, outFileName)
- char *string;
- char *inFileName;
- char *outFileName;
+ReplaceFileString(
+ char *string,
+ char *inFileName,
+ char *outFileName)
{
char *pKeyString,
*pInFileString = IN_FILE_STRING,
@@ -143,9 +148,9 @@ ReplaceFileString(string, inFileName, outFileName)
* we don't delete the job file before the spooler has made a copy.
*/
void
-ExecCommand(pCommand, argVector)
- char *pCommand;
- char **argVector;
+ExecCommand(
+ char *pCommand,
+ char **argVector)
{
pid_t childPid;
int status;
@@ -169,17 +174,19 @@ ExecCommand(pCommand, argVector)
* beginning the transfer.
*/
int
-TransferBytes(pSrcFile, pDstFile, numBytes)
+TransferBytes(
FILE *pSrcFile,
- *pDstFile;
- int numBytes;
+ FILE *pDstFile,
+ int numBytes)
{
char buf[10240];
- int bytesWritten = 0, bytesToXfer;
+#define BUF_SIZE (sizeof(buf)*sizeof(char))
+ int bytesWritten = 0;
+ unsigned bytesToXfer;
- for(bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes);
+ for(bytesToXfer = min(BUF_SIZE, (unsigned)numBytes);
bytesToXfer > 0;
- bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes - bytesWritten))
+ bytesToXfer = min(BUF_SIZE, (unsigned)(numBytes - bytesWritten)))
{
if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer)
return bytesWritten;
@@ -195,10 +202,10 @@ TransferBytes(pSrcFile, pDstFile, numBytes)
* pre, no, and post raster files as well as the raster file itself.
*/
Bool
-CopyContentsAndDelete(ppSrcFile, pSrcFileName, pDstFile)
+CopyContentsAndDelete(
FILE **ppSrcFile,
- *pDstFile;
- char **pSrcFileName;
+ char **pSrcFileName,
+ FILE *pDstFile)
{
struct stat statBuf;
@@ -228,7 +235,8 @@ XpSendDocumentData(
int maxBufSize)
{
xPrintGetDocumentDataReply *pRep;
- int bytesWritten, bytesToWrite;
+ int bytesWritten;
+ unsigned bytesToWrite;
int result = Success;
if(client->clientGone)
@@ -247,8 +255,7 @@ XpSendDocumentData(
pRep->length = (QUADPAD(bytesToWrite)) >> 2;
pRep->dataLen = bytesToWrite;
- if(fread((void *)(pRep + 1), (size_t) 1, bytesToWrite, fp) <
- bytesToWrite)
+ if(fread((void *)(pRep + 1), 1, bytesToWrite, fp) < bytesToWrite)
{
result = BadAlloc; /* XXX poor error choice? */
pRep->statusCode = 2; /* XXX Is this the right value??? */
@@ -316,6 +323,7 @@ XpFinishDocData(
return Success;
}
+#ifndef HAS_MKSTEMP
static
char *XpDirName(char *fname)
{
@@ -334,6 +342,7 @@ char *XpDirName(char *fname)
}
return fn;
}
+#endif
Bool
XpOpenTmpFile(
@@ -341,6 +350,7 @@ XpOpenTmpFile(
char **fname,
FILE **stream)
{
+#ifndef HAS_MKSTEMP
char *fn = NULL;
/* note that there is a small race condition here... */
@@ -348,6 +358,7 @@ XpOpenTmpFile(
!(fn = XpDirName(*fname)) ||
access(fn, W_OK) ||
!(*stream = fopen(*fname, mode)))
+
{
xfree(fn);
xfree(*fname);
@@ -356,5 +367,26 @@ XpOpenTmpFile(
return FALSE;
}
xfree(fn);
+#else
+ int fd;
+
+ *stream = NULL;
+ *fname = (char *)xalloc(14);
+ if (*fname == NULL)
+ return FALSE;
+ strcpy(*fname, "/tmp/xpXXXXXX");
+ fd = mkstemp(*fname);
+ if (fd < 0) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+ *stream = fdopen(fd, mode);
+ if (stream == NULL) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+#endif
return TRUE;
}
diff --git a/Xprint/attributes.c b/Xprint/attributes.c
index 7348d6402..7d71760be 100644
--- a/Xprint/attributes.c
+++ b/Xprint/attributes.c
@@ -44,26 +44,30 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.18 2002/05/31 18:45:53 dawes Exp $ */
-#include <Xproto.h>
+#include <X11/Xproto.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
+#if defined(sun) && defined(SVR4)
+#include <wchar.h>
+#endif
-#include <scrnintstr.h>
+#include "scrnintstr.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Printstr.h>
+#include "attributes.h"
#include "Xrm.c"
static XrmDatabase CopyDb(XrmDatabase inDb);
-extern XrmDatabase XpSpoolerGetServerAttributes();
+extern XrmDatabase XpSpoolerGetServerAttributes(void);
-static int attrGeneration = 0;
+static unsigned long attrGeneration = 0;
typedef struct {
XrmDatabase *pDb;
@@ -137,8 +141,7 @@ static char NULL_STRING[] = "\0";
* $LANG. It makes no attempt to ensure that the directory actually exists.
*/
char *
-XpGetConfigDir(useLocale)
- Bool useLocale;
+XpGetConfigDir(Bool useLocale)
{
char *dirName, *langName, *langDir, *configDir;
Bool freeLangDir = False;
@@ -182,8 +185,7 @@ XpGetConfigDir(useLocale)
* locale (if other than the top-level).
*/
static XrmDatabase
-GetMergedDatabase(attrName)
- char *attrName;
+GetMergedDatabase(const char *attrName)
{
char *dirName, *fileName;
XrmDatabase db;
@@ -220,7 +222,7 @@ GetMergedDatabase(attrName)
* the context.
*/
static void
-BuildSystemAttributes()
+BuildSystemAttributes(void)
{
if(systemAttributes.printers != (XrmDatabase)NULL)
XrmDestroyDatabase(systemAttributes.printers);
@@ -243,13 +245,13 @@ BuildSystemAttributes()
* passed as the client_data (aka "closure").
*/
static Bool
-AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
- XrmDatabase *sourceDB;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValue *value;
- XPointer client_data;
+AddDbEntry(
+ XrmDatabase *sourceDB,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValue *value,
+ XPointer client_data)
{
DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data;
XrmName xrm_name[5];
@@ -293,15 +295,15 @@ AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
* printer.
*/
static XrmDatabase
-BuildPrinterAttrs(printerName, qualifierName)
- char *printerName;
- char *qualifierName;
+BuildPrinterAttrs(
+ char *printerName,
+ char *qualifierName)
{
XrmDatabase printerDB = (XrmDatabase)NULL;
if(systemAttributes.printers != (XrmDatabase)NULL)
{
- char *dirName, *fileName;
+ char *fileName;
XrmDatabase modelDB = (XrmDatabase)NULL;
XrmName xrm_name[5], xrm_class[2];
XrmRepresentation rep_type;
@@ -374,10 +376,10 @@ BuildPrinterAttrs(printerName, qualifierName)
* level doc and job databases.
*/
static XrmDatabase
-BuildABase(printerName, qualifierName, sourceBase)
- char *printerName;
- char *qualifierName;
- XrmDatabase sourceBase;
+BuildABase(
+ char *printerName,
+ char *qualifierName,
+ XrmDatabase sourceBase)
{
XrmDatabase builtDB = (XrmDatabase)NULL;
@@ -425,7 +427,7 @@ BuildABase(printerName, qualifierName, sourceBase)
* databases stored in the global attrList.
*/
static void
-FreeAttrList()
+FreeAttrList(void)
{
PrAttrPtr pAttr, pNext;
@@ -454,7 +456,7 @@ FreeAttrList()
* by calling XpBuildAttributeStore for a new list of printers.
*/
int
-XpRehashAttributes()
+XpRehashAttributes(void)
{
if(attrList != (PrAttrPtr)NULL)
FreeAttrList();
@@ -468,9 +470,9 @@ XpRehashAttributes()
* calls BuildSystemAttributes to create the system-level databases.
*/
void
-XpBuildAttributeStore(printerName, qualifierName)
- char *printerName;
- char *qualifierName;
+XpBuildAttributeStore(
+ char *printerName,
+ char *qualifierName)
{
PrAttrPtr pAttr;
@@ -510,13 +512,13 @@ XpBuildAttributeStore(printerName, qualifierName)
static Bool
-StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
- XrmDatabase *sourceDB;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValue *value;
- XPointer client_data;
+StoreEntry(
+ XrmDatabase *sourceDB,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValue *value,
+ XPointer client_data)
{
XrmDatabase *outDb = (XrmDatabase *)client_data;
@@ -530,8 +532,7 @@ StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
* the copy.
*/
static XrmDatabase
-CopyDb(inDb)
- XrmDatabase inDb;
+CopyDb(XrmDatabase inDb)
{
XrmDatabase outDb = (XrmDatabase)NULL;
XrmQuark empty = NULLQUARK;
@@ -547,8 +548,7 @@ CopyDb(inDb)
* attributes databases for the printer associated with the context.
*/
void
-XpInitAttributes( pContext )
- XpContextPtr pContext;
+XpInitAttributes(XpContextPtr pContext)
{
ContextAttrPtr pCtxtAttrs;
PrAttrPtr pPrAttr = attrList;
@@ -569,8 +569,8 @@ XpInitAttributes( pContext )
}
void
-XpDestroyAttributes( pContext )
- XpContextPtr pContext;
+XpDestroyAttributes(
+ XpContextPtr pContext)
{
ContextAttrPtr pCtxtAttrs;
@@ -596,14 +596,13 @@ XpDestroyAttributes( pContext )
* in which case the pContext parameter is ignored.
*/
char *
-XpGetOneAttribute( pContext, class, attributeName )
- XpContextPtr pContext;
- XPAttributes class;
- char *attributeName;
+XpGetOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributeName)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
- char *retVal;
XrmName xrm_name[3];
XrmRepresentation rep_type;
XrmValue value;
@@ -666,12 +665,11 @@ XpGetOneAttribute( pContext, class, attributeName )
* function does not recognize XPServerAttr.
*/
void
-XpPutOneAttribute( pContext, class, attributeName, value )
-
-XpContextPtr pContext;
-XPAttributes class;
-const char* attributeName;
-const char* value;
+XpPutOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ const char* attributeName,
+ const char* value)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db;
@@ -720,8 +718,8 @@ const char* value;
* struct to indicate the new amount of space available.
*/
static Bool
-ExpandSpace(pStr)
- StringDbStruct *pStr;
+ExpandSpace(
+ StringDbStruct *pStr)
{
char *newSpace;
@@ -740,9 +738,9 @@ ExpandSpace(pStr)
* are updated.
*/
static void
-PutString(pStr, pString)
- StringDbStruct *pStr;
- char *pString;
+PutString(
+ StringDbStruct *pStr,
+ char *pString)
{
int len = strlen(pString);
@@ -760,9 +758,9 @@ PutString(pStr, pString)
* the byte, and the nextPos and space fields are updated.
*/
static void
-PutByte(pStr, byte)
- StringDbStruct *pStr;
- char byte;
+PutByte(
+ StringDbStruct *pStr,
+ char byte)
{
if(pStr->space <= 1)
if(!ExpandSpace(pStr))
@@ -782,13 +780,13 @@ PutByte(pStr, byte)
* This code is based directly on that in "DumpEntry" in Xrm.c.
*/
static Bool
-AppendEntry(db, bindings, quarks, type, value, data)
- XrmDatabase *db;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValuePtr value;
- XPointer data;
+AppendEntry(
+ XrmDatabase *db,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValuePtr value,
+ XPointer data)
{
StringDbStruct *pEnumStr = (StringDbStruct *)data;
Bool firstNameSeen;
@@ -796,7 +794,7 @@ AppendEntry(db, bindings, quarks, type, value, data)
char *s, c;
if (*type != XrmQString)
- return;
+ return False;
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
if (*bindings == XrmBindLoosely) {
@@ -849,13 +847,12 @@ AppendEntry(db, bindings, quarks, type, value, data)
* unlike XpGetOneAttribute, where the caller must not free the string.
*/
char *
-XpGetAttributes( pContext, class )
- XpContextPtr pContext;
- XPAttributes class;
+XpGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
- char *retVal;
StringDbStruct enumStruct;
XrmQuark empty = NULLQUARK;
@@ -904,10 +901,10 @@ XpGetAttributes( pContext, class )
}
int
-XpAugmentAttributes( pContext, class, attributes )
- XpContextPtr pContext;
- XPAttributes class;
- char *attributes;
+XpAugmentAttributes(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes)
{
XrmDatabase db;
ContextAttrPtr pCtxtAttrs;
@@ -940,10 +937,10 @@ XpAugmentAttributes( pContext, class, attributes )
* XpSetAttributes - sets the attribute stores for a specified context.
*/
int
-XpSetAttributes( pContext, class, attributes )
- XpContextPtr pContext;
- XPAttributes class;
- char *attributes;
+XpSetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes)
{
XrmDatabase db;
ContextAttrPtr pCtxtAttrs;
@@ -981,12 +978,11 @@ XpSetAttributes( pContext, class, attributes )
}
void
-XpAddPrinterAttribute(printerName, printerQualifier, attributeName,
- attributeValue)
- char *printerName;
- char *printerQualifier;
- char *attributeName;
- char *attributeValue;
+XpAddPrinterAttribute(
+ char *printerName,
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue)
{
PrAttrPtr pAttr;
@@ -1045,7 +1041,7 @@ static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\
*multiple-documents-supported: False";
XrmDatabase
-XpSpoolerGetServerAttributes()
+XpSpoolerGetServerAttributes(void)
{
char *totalAttrs, *localeName;
XrmDatabase db;
@@ -1065,34 +1061,6 @@ XpSpoolerGetServerAttributes()
}
/*
- * ExecuteCommand takes two pointers - the command to execute,
- * and the "argv" style NULL-terminated vector of arguments for the command.
- * We wait for the command to terminate before continuing to ensure that
- * we don't delete the job file before the spooler has made a copy.
- */
-static void
-ExecCommand(pCommand, argVector)
- char *pCommand;
- char **argVector;
-{
- pid_t childPid;
- int status;
-
- if((childPid = fork()) == 0)
- {
- /* return BadAlloc? */
- if (execv(pCommand, argVector) == -1) {
- FatalError("unable to exec '%s'", pCommand);
- }
- }
- else
- {
- (void) waitpid(childPid, &status, 0);
- }
- return;
-}
-
-/*
* SendFileToCommand takes three character pointers - the file name,
* the command to execute,
* and the "argv" style NULL-terminated vector of arguments for the command.
@@ -1167,8 +1135,6 @@ SendFileToCommand(
}
else
{
- int res;
-
(void) close(pipefd[0]);
outPipe = fdopen(pipefd[1], "w");
@@ -1188,7 +1154,6 @@ SendFileToCommand(
* store for the supplied print context. The ReplaceAnyString utility
* routine is used to perform the actual replacements.
*/
-extern char *ReplaceAnyString(char *, char *, char *);
static char *
ReplaceAllKeywords(
@@ -1233,7 +1198,20 @@ ReplaceAllKeywords(
return command;
}
-#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL))
+#ifdef __QNX__
+#define toascii( c ) ((unsigned)(c) & 0x007f)
+#endif
+
+#if defined(CSRG_BASED) || \
+ defined(linux) || \
+ defined(__CYGWIN__) || \
+ (defined(sun) && !defined(SVR4)) || \
+ (defined(SVR4) && !defined(sun) && !defined(USL)) || \
+ defined(__UNIXOS2__) || \
+ defined(ISC) || \
+ defined(Lynx) || \
+ defined(__QNX__) || \
+ defined(__DARWIN__)
#define iswspace(c) (isascii(c) && isspace(toascii(c)))
#endif
@@ -1387,8 +1365,8 @@ VectorizeCommand(
char ***pVector,
XpContextPtr pContext)
{
- char *cmdName, *curTok;
- int i, numChars;
+ char *cmdName;
+ int numChars;
if(command == (char *)NULL)
return (char *)NULL;
@@ -1410,11 +1388,11 @@ static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-co
#endif
int
-XpSubmitJob(fileName, pContext)
- char *fileName;
- XpContextPtr pContext;
+XpSubmitJob(
+ char *fileName,
+ XpContextPtr pContext)
{
- char **vector, *cmdNam, *cmdOpt, *command, *userName;
+ char **vector, *cmdNam, *command, *userName;
int i;
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
@@ -1452,6 +1430,7 @@ XpSubmitJob(fileName, pContext)
FreeVector(vector);
xfree(cmdNam);
+ return Success;
}
/*
@@ -1524,7 +1503,6 @@ XpGetTrayMediumFromContext(XpContextPtr pCon,
{
char *defMedium, *defTray;
char *t, *m;
- char *pS, *pE, *pLast;
defMedium = XpGetOneAttribute( pCon, XPPageAttr,
"default-medium" );
diff --git a/Xprint/attributes.h b/Xprint/attributes.h
index 59ccb9c63..d9d551f32 100644
--- a/Xprint/attributes.h
+++ b/Xprint/attributes.h
@@ -30,13 +30,32 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/attributes.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
-#include "Oid.h"
+#ifndef _Xp_attributes_h
+#define _Xp_attributes_h 1
+
+#include "scrnintstr.h"
+#include "AttrValid.h"
+
+#define BFuncArgs int ndx, ScreenPtr pScreen, int argc, char **argv
+typedef Bool (*pBFunc)(BFuncArgs);
+
+#define VFuncArgs char *name, XpValidatePoolsRec *pValRec, float *width, float *height, int *res
+typedef void (*pVFunc)(VFuncArgs);
/*
* attributes.c
*/
void XpInitAttributes(XpContextPtr pContext);
+void XpBuildAttributeStore(char *printerName,
+ char *qualifierName);
+void XpAddPrinterAttribute(char *printerName,
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue);
+void XpDestroyAttributes(XpContextPtr pContext);
+char *XpGetConfigDir(Bool useLocale);
char *XpGetOneAttribute(XpContextPtr pContext,
XPAttributes class,
char *attributeName);
@@ -44,6 +63,7 @@ void XpPutOneAttribute(XpContextPtr pContext,
XPAttributes class,
const char* attributeName,
const char* value);
+int XpRehashAttributes(void);
char *XpGetAttributes(XpContextPtr pContext,
XPAttributes class);
int XpAugmentAttributes(XpContextPtr pContext,
@@ -57,6 +77,7 @@ const char *XpGetPrinterAttribute(const char *printerName,
void XpGetTrayMediumFromContext(XpContextPtr pCon,
char **medium,
char **tray);
+int XpSubmitJob(char *fileName, XpContextPtr pContext);
/*
* mediaSizes.c
@@ -76,3 +97,34 @@ void XpGetMediumDimensions(XpContextPtr pContext,
unsigned short *height);
void XpGetReproductionArea(XpContextPtr pContext,
xRectangle *pRect);
+void XpGetMaxWidthHeightRes(const char *printer_name,
+ const XpValidatePoolsRec* vpr,
+ float *width,
+ float *height,
+ int* resolution);
+
+/* Util.c */
+char * ReplaceAnyString(char *string,
+ char *target,
+ char *replacement);
+char * ReplaceFileString(char *string,
+ char *inFileName,
+ char *outFileName);
+void ExecCommand(char *pCommand,
+ char **argVector);
+int TransferBytes(FILE *pSrcFile,
+ FILE *pDstFile,
+ int numBytes);
+Bool CopyContentsAndDelete(FILE **ppSrcFile,
+ char **pSrcFileName,
+ FILE *pDstFile);
+int XpSendDocumentData(ClientPtr client,
+ FILE *fp,
+ int fileLen,
+ int maxBufSize);
+int XpFinishDocData(ClientPtr client);
+Bool XpOpenTmpFile(char *mode,
+ char **fname,
+ FILE **stream);
+
+#endif /* _Xp_attributes_h */
diff --git a/Xprint/ddxInit.c b/Xprint/ddxInit.c
index 3f8cefbe8..a96a766f8 100644
--- a/Xprint/ddxInit.c
+++ b/Xprint/ddxInit.c
@@ -30,19 +30,16 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.14 2001/10/28 03:32:53 tsi Exp $ */
#include "X.h"
#include "Xproto.h"
-#include "screenint.h"
-#include "input.h"
-#include "misc.h"
-#include "scrnintstr.h"
#include "windowstr.h"
#include "servermd.h"
#include "Xos.h"
+#include "DiPrint.h"
-static void Exit();
-void _XpVoidNoop();
+static void Exit(int);
/*-
*-----------------------------------------------------------------------
@@ -72,13 +69,11 @@ void _XpVoidNoop();
*/
void
-InitOutput(pScreenInfo, argc, argv)
- ScreenInfo *pScreenInfo;
- int argc;
- char **argv;
+InitOutput(
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
{
- int i;
-
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
@@ -92,17 +87,17 @@ InitOutput(pScreenInfo, argc, argv)
}
static void
-BellProc(volume, pDev)
- int volume;
- DeviceIntPtr pDev;
+BellProc(
+ int volume,
+ DeviceIntPtr pDev)
{
return;
}
static void
-KeyControlProc(pDev, ctrl)
- DeviceIntPtr pDev;
- KeybdCtrl *ctrl;
+KeyControlProc(
+ DeviceIntPtr pDev,
+ KeybdCtrl *ctrl)
{
return;
}
@@ -111,11 +106,11 @@ static KeySym printKeyMap[256];
static CARD8 printModMap[256];
static int
-KeyboardProc(pKbd, what, argc, argv)
- DevicePtr pKbd;
- int what;
- int argc;
- char *argv[];
+KeyboardProc(
+ DevicePtr pKbd,
+ int what,
+ int argc,
+ char *argv[])
{
KeySymsRec keySyms;
@@ -143,11 +138,11 @@ KeyboardProc(pKbd, what, argc, argv)
#include "../mi/mipointer.h"
static int
-PointerProc(pPtr, what, argc, argv)
- DevicePtr pPtr;
- int what;
- int argc;
- char *argv[];
+PointerProc(
+ DevicePtr pPtr,
+ int what,
+ int argc,
+ char *argv[])
{
#define NUM_BUTTONS 1
CARD8 map[NUM_BUTTONS];
@@ -174,11 +169,11 @@ PointerProc(pPtr, what, argc, argv)
}
void
-InitInput(argc, argv)
- int argc;
- char **argv;
+InitInput(
+ int argc,
+ char **argv)
{
- DevicePtr ptr, kbd;
+ DeviceIntPtr ptr, kbd;
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
@@ -189,28 +184,42 @@ InitInput(argc, argv)
Bool
-LegalModifier(key, dev)
- unsigned int key;
- DevicePtr dev;
+LegalModifier(
+ unsigned int key,
+ DevicePtr dev)
{
return TRUE;
}
void
-ProcessInputEvents()
+ProcessInputEvents(void)
+{
+}
+
+#ifdef __DARWIN__
+void
+DarwinHandleGUI(int argc, char *argv[])
{
}
+#endif
#ifdef DDXOSINIT
void
-OsVendorInit()
+OsVendorInit(void)
+{
+}
+#endif
+
+#ifdef DDXOSFATALERROR
+void
+OsVendorFatalError(void)
{
}
#endif
#ifdef DDXTIME
CARD32
-GetTimeInMillis()
+GetTimeInMillis(void)
{
struct timeval tp;
@@ -226,7 +235,7 @@ GetTimeInMillis()
*
*****************************************/
-void ddxUseMsg()
+void ddxUseMsg(void)
{
/* Right now, let's just do nothing */
}
@@ -237,20 +246,19 @@ static void Exit (code)
exit (code);
}
-void AbortDDX ()
+void AbortDDX (void)
{
}
-void ddxGiveUp() /* Called by GiveUp() */
+void ddxGiveUp(void) /* Called by GiveUp() */
{
}
int
-ddxProcessArgument (argc, argv, i)
- int argc;
- char *argv[];
- int i;
-
+ddxProcessArgument (
+ int argc,
+ char *argv[],
+ int i)
{
#ifdef PRINT_ONLY_SERVER
return XprintOptions(argc, argv, i) - i;
@@ -263,67 +271,76 @@ ddxProcessArgument (argc, argv, i)
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
extern int BadDevice;
-ChangePointerDevice (old_dev, new_dev, x, y)
- DeviceIntPtr old_dev;
- DeviceIntPtr new_dev;
- unsigned char x,y;
+int
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
{
- return (BadDevice);
+ return (BadDevice);
}
int
-ChangeDeviceControl (client, dev, control)
- register ClientPtr client;
- DeviceIntPtr dev;
- xDeviceCtl *control;
+ChangeDeviceControl (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ xDeviceCtl *control)
{
return BadMatch;
}
-OpenInputDevice (dev, client, status)
- DeviceIntPtr dev;
- ClientPtr client;
- int *status;
+void
+OpenInputDevice (
+ DeviceIntPtr dev,
+ ClientPtr client,
+ int *status)
{
return;
}
-AddOtherInputDevices ()
+void
+AddOtherInputDevices (void)
{
return;
}
-CloseInputDevice (dev, client)
- DeviceIntPtr dev;
- ClientPtr client;
+void
+CloseInputDevice (
+ DeviceIntPtr dev,
+ ClientPtr client)
{
return;
}
-ChangeKeyboardDevice (old_dev, new_dev)
- DeviceIntPtr old_dev;
- DeviceIntPtr new_dev;
+int
+ChangeKeyboardDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev)
{
return (Success);
}
-SetDeviceMode (client, dev, mode)
- register ClientPtr client;
- DeviceIntPtr dev;
- int mode;
+int
+SetDeviceMode (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ int mode)
{
return BadMatch;
}
-SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
- register ClientPtr client;
- DeviceIntPtr dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
+int
+SetDeviceValuators (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ int *valuators,
+ int first_valuator,
+ int num_valuators)
{
return BadMatch;
}
@@ -334,21 +351,19 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
#ifdef XTESTEXT1
void
-XTestJumpPointer(x, y, dev)
- int x, y, dev;
+XTestJumpPointer(int x, int y, int dev)
{
return;
}
void
-XTestGetPointerPos(x, y)
+XTestGetPointerPos(int x, int y)
{
return;
}
void
-XTestGenerateEvent(dev, keycode, keystate, x, y)
- int dev, keycode, keystate, x, y;
+XTestGenerateEvent(int dev, int keycode, int keystate, int x, int y)
{
return;
}
diff --git a/Xprint/mediaSizes.c b/Xprint/mediaSizes.c
index eaff20a88..7bb08b412 100644
--- a/Xprint/mediaSizes.c
+++ b/Xprint/mediaSizes.c
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/mediaSizes.c,v 1.5 2001/12/21 21:02:05 dawes Exp $ */
+
/*******************************************************************
**
** *********************************************************
@@ -62,14 +64,8 @@ copyright holders.
#include "scrnintstr.h"
#include "fontstruct.h"
-#define _XP_PRINT_SERVER_
-#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
-
#include "DiPrint.h"
-#include "AttrValid.h"
-
-extern XpContextPtr XpContextOfClient();
+#include "attributes.h"
typedef struct {
XpOid page_size;
@@ -149,8 +145,7 @@ static PageDimensionsRec PageDimensions[] =
* attributes pools have been validated.
*/
int
-XpGetResolution(
- XpContextPtr pContext)
+XpGetResolution(XpContextPtr pContext)
{
unsigned long resolution;
@@ -190,8 +185,7 @@ XpGetResolution(
* attributes pools have been validated.
*/
XpOid
-XpGetContentOrientation(
- XpContextPtr pContext)
+XpGetContentOrientation(XpContextPtr pContext)
{
XpOid orientation;
@@ -421,7 +415,7 @@ XpGetMediumMillimeters(
float *width, /* return */
float *height) /* return */
{
- int i;
+ unsigned i;
*width = *height = 0;
for(i = 0; i < XpNumber(PageDimensions); i++)
@@ -745,9 +739,7 @@ XpGetMaxWidthHeightRes(
}
FontResolutionPtr
-XpGetClientResolutions(client, num)
- ClientPtr client;
- int *num;
+XpGetClientResolutions(ClientPtr client, int *num)
{
static struct _FontResolution res;
int resolution = XpGetResolution(XpContextOfClient(client));
@@ -763,15 +755,13 @@ XpGetClientResolutions(client, num)
}
-void XpSetFontResFunc(client)
- ClientPtr client;
+void XpSetFontResFunc(ClientPtr client)
{
client->fontResFunc = XpGetClientResolutions;
}
-void XpUnsetFontResFunc(client)
- ClientPtr client;
+void XpUnsetFontResFunc(ClientPtr client)
{
client->fontResFunc = NULL;
}
diff --git a/Xprint/pcl/Pcl.h b/Xprint/pcl/Pcl.h
index 0f744eafe..0532e1fcc 100644
--- a/Xprint/pcl/Pcl.h
+++ b/Xprint/pcl/Pcl.h
@@ -11,7 +11,7 @@
** * Created: 1/30/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pcl.h,v 1.12 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCL_H_
#define _PCL_H_
@@ -51,25 +52,12 @@ copyright holders.
#include <stdio.h>
#include "scrnintstr.h"
-/*
-#include "X.h"
-#include "Xproto.h"
-#include "Xatom.h"
-#include "misc.h"
-#include "screenint.h"
-#include "colormapst.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#include "servermd.h" */ /* needed for IMAGE_BUFSIZE */
-
#include "PclDef.h"
#include "Pclmap.h"
#include "PclSFonts.h"
-#define _XP_PRINT_SERVER_
-#include "Print.h"
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
#include "miscstruct.h"
#include "fontstruct.h"
@@ -79,13 +67,16 @@ copyright holders.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
+#endif
#define Status int
#define True 1
#define False 0
#include "misc.h"
-#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
/******
* externally visible variables from PclInit.c
@@ -95,6 +86,11 @@ extern int PclContextPrivateIndex;
extern int PclPixmapPrivateIndex;
extern int PclGCPrivateIndex;
+/******
+ * externally visible variables from PclAttVal.c
+ ******/
+extern XpValidatePoolsRec PclValidatePoolsRec;
+
/*
* This structure defines a mapping from an X colormap ID to a list of
* print contexts which use the colormap.
@@ -159,8 +155,6 @@ typedef struct {
} PclWindowPrivRec, *PclWindowPrivPtr;
typedef struct {
- unsigned freeCompClip;
- RegionPtr pCompositeClip;
unsigned long stippleFg, stippleBg;
} PclGCPrivRec, *PclGCPrivPtr;
@@ -191,7 +185,9 @@ typedef struct {
#endif /* XP_PCL_LJ3 */
#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
/******
* Functions in PclArc.c
@@ -247,18 +243,18 @@ RegionPtr PclCopyPlane(
/******
* Functions in PclAttr.c
******/
-extern char *PclGetAttributes(
+extern char *PclGetAttributes(
XpContextPtr pCon,
XPAttributes pool );
extern char *PclGetOneAttribute(
XpContextPtr pCon,
XPAttributes pool,
char *attr );
-extern int PclAugmentAttributes(
+extern int PclAugmentAttributes(
XpContextPtr pCon,
XPAttributes pool,
char *attrs );
-extern int PclSetAttributes(
+extern int PclSetAttributes(
XpContextPtr pCon,
XPAttributes pool,
char *attrs );
@@ -284,6 +280,16 @@ extern int PclUpdateColormap(DrawablePtr pDrawable,
XpContextPtr pCon,
GCPtr gc,
FILE *outFile);
+extern void PclLookUp(ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b);
+extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc);
+extern unsigned char *PclReadMap(char *, int *);
+
/******
* Functions in PclCursor.c
@@ -316,6 +322,27 @@ extern Bool PclSetCursorPosition(
Bool generateEvent);
/******
+ * Functions in PclSFonts.c
+ ******/
+extern void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code);
+extern void PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col);
+extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void);
+extern void PclDestroySoftFontInfo(
+ PclSoftFontInfoPtr pSoftFontInfo );
+
+/******
* Functions in PclGC.c
******/
extern Bool PclCreateGC(GCPtr pGC);
@@ -326,7 +353,7 @@ extern int PclUpdateDrawableGC(
FILE **outFile);
extern void PclValidateGC(
GCPtr pGC,
- Mask changes,
+ unsigned long changes,
DrawablePtr pDrawable);
extern void PclSetDrawablePrivateStuff(
DrawablePtr pDrawable,
@@ -336,16 +363,34 @@ extern int PclGetDrawablePrivateStuff(
GC *gc,
unsigned long *valid,
FILE **file );
-
+extern void PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc);
+extern void PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable);
+
/******
* Functions in PclInit.c
******/
-extern Bool InitializePclDriver(
+extern Bool PclCloseScreen(
+ int index,
+ ScreenPtr pScreen);
+extern Bool InitializeColorPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeMonoPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeLj3PclDriver(
int ndx,
ScreenPtr pScreen,
int argc,
char **argv);
-static Bool PclDestroyContext( XpContextPtr pCon );
extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
/******
@@ -380,6 +425,12 @@ extern int PclGetMediumDimensions(
extern int PclGetReproducibleArea(
XpContextPtr pCon,
xRectangle *pRect);
+extern void PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio);
/******
* Functions in PclPixel.c
@@ -508,7 +559,6 @@ extern Bool PclPositionWindow(
int x,
int y);
extern Bool PclUnmapWindow(WindowPtr pWindow);
-extern Bool PclUnmapWindow(WindowPtr pWindow);
extern void PclCopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,
@@ -569,12 +619,3 @@ extern int PclGetDocumentData(
#endif /* _PCL_H_ */
-
-
-
-
-
-
-
-
-
diff --git a/Xprint/pcl/PclArc.c b/Xprint/pcl/PclArc.c
index ffdf32907..ca13b3a84 100644
--- a/Xprint/pcl/PclArc.c
+++ b/Xprint/pcl/PclArc.c
@@ -45,6 +45,8 @@ dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArc.c,v 1.5 2001/01/17 22:36:30 dawes Exp $ */
+
#include <stdio.h>
#include <math.h>
#include <errno.h>
@@ -52,14 +54,15 @@ copyright holders.
#include "Pcl.h"
#include "gcstruct.h"
#include "windowstr.h"
+#include "attributes.h"
static void
-PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nArcs;
- xArc *pArcs;
- void (*DoIt)();
+PclDoArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs,
+ void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
{
char t[80];
FILE *outFile;
@@ -140,7 +143,7 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
r.y1 = -Arc.height / 2 - fudge;
r.x2 = Arc.width / 2 + fudge;
r.y2 = Arc.height / 2 + fudge;
- drawRegion = miRegionCreate( &r, 0 );
+ drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 );
SAVE_PCL( outFile, pConPriv, "\033%0A" );
MACRO_END( outFile );
@@ -148,14 +151,13 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/*
* Intersect the bounding box with the clip region.
*/
- region = miRegionCreate( NULL, 0 );
- transClip = miRegionCreate( NULL, 0 );
- miRegionCopy( transClip,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
- miTranslateRegion( transClip, -(xoffset + Arc.x + Arc.width / 2),
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
+ REGION_TRANSLATE( pGC->pScreen, transClip,
+ -(xoffset + Arc.x + Arc.width / 2),
-(yoffset + Arc.y + Arc.height / 2) );
- miIntersect( region, drawRegion, transClip );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -177,9 +179,9 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
- miRegionDestroy( transClip );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, transClip );
}
}
@@ -202,11 +204,11 @@ DrawArc(FILE *outFile,
}
void
-PclPolyArc( pDrawable, pGC, nArcs, pArcs )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nArcs;
- xArc *pArcs;
+PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
{
PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
}
@@ -246,11 +248,11 @@ DoChord(FILE *outFile,
void
-PclPolyFillArc( pDrawable, pGC, nArcs, pArcs )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nArcs;
- xArc *pArcs;
+PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
{
switch( pGC->arcMode )
{
diff --git a/Xprint/pcl/PclArea.c b/Xprint/pcl/PclArea.c
index da3107d5a..971506da6 100644
--- a/Xprint/pcl/PclArea.c
+++ b/Xprint/pcl/PclArea.c
@@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArea.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */
#include <stdio.h>
#include <sys/types.h>
@@ -53,6 +54,9 @@ copyright holders.
#include "region.h"
#include "cfb.h"
+#if 1
+#include "cfb32.h"
+#endif
void
PclPutImage(DrawablePtr pDrawable,
@@ -72,10 +76,10 @@ PclPutImage(DrawablePtr pDrawable,
unsigned long oldPlanemask;
unsigned long i;
long bytesPer;
-
+
if( ( w == 0 ) || ( h == 0 ) )
return;
-
+
if( format != XYPixmap )
{
pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
@@ -85,7 +89,7 @@ PclPutImage(DrawablePtr pDrawable,
depth ), (pointer)pImage );
if( !pPixmap )
return;
-
+
if( format == ZPixmap )
(void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
leftPad, 0, w, h, x, y );
@@ -104,7 +108,7 @@ PclPutImage(DrawablePtr pDrawable,
if( !pPixmap )
return;
-
+
depth = pGC->depth;
oldPlanemask = pGC->planemask;
oldFg = pGC->fgPixel;
@@ -113,12 +117,11 @@ PclPutImage(DrawablePtr pDrawable,
gcv[1] = 0;
DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
bytesPer = (long)h * BitmapBytePad( w + leftPad );
-
+
for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
{
if( i & oldPlanemask )
{
- extern void cfbPutImage(), cfb32PutImage();
gcv[0] = i;
DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
ValidateGC( pDrawable, pGC );
@@ -160,16 +163,16 @@ PclMonoPixmapFragment(FILE *outFile,
{
char *bits, t[80], *row;
int h, w, i;
-
+
/*
* Create a storage area large enough to hold the entire pixmap,
- * then use mfbGetImage to get the appropriate bits.
+ * then use mfbGetImage to get the appropriate bits.
*/
h = y2 - y1;
w = BitmapBytePad( x2 - x1 );
-
+
bits = (char *)xalloc( h * w );
- mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
XYPixmap, ~0, bits );
/*
@@ -179,7 +182,7 @@ PclMonoPixmapFragment(FILE *outFile,
*/
sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
SEND_PCL( outFile, t );
-
+
/*
* Now, wrap the raster in the appropriate PCL code. Right now,
* it's going to go down the wire without any compression. That
@@ -188,14 +191,14 @@ PclMonoPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M",
h, x2 - x1 );
SEND_PCL( outFile, t );
-
+
sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i <= h; i++, row += w )
{
SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w );
}
-
+
SEND_PCL( outFile, "\033*rC" );
/*
@@ -216,21 +219,20 @@ PclColorPixmapFragment(FILE *outFile,
{
char *bits, t[80], *row;
int h, w, i;
- extern void cfbGetImage(), cfb32GetImage();
-
+
/*
* Create a storage area large enough to hold the entire pixmap,
- * then use cfbGetImage to get the appropriate bits.
+ * then use cfbGetImage to get the appropriate bits.
*/
h = y2 - y1;
w = PixmapBytePad( x2 - x1, pix->drawable.depth );
-
+
bits = (char *)xalloc( h * w );
if (pix->drawable.depth <= 8)
- cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits );
else if (pix->drawable.depth <= 32)
- cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits );
/*
@@ -249,16 +251,16 @@ PclColorPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
h, x2 - x1 );
SEND_PCL( outFile, t );
-
+
sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i < h; i++, row += w )
{
SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w );
}
-
+
SEND_PCL( outFile, "\033*rC" );
-
+
/*
* Clean things up a bit
*/
@@ -277,22 +279,20 @@ PclCopyArea(DrawablePtr pSrc,
int dsty)
{
PixmapPtr pixSrc = (PixmapPtr)pSrc;
- char t[80];
- FILE *srcFile, *dstFile;
- GC srcGC, dstGC;
+/*
+ FILE *srcFile;
+ GC srcGC;
+*/
+ FILE *dstFile;
+ GC dstGC;
unsigned long valid;
- struct stat statBuf;
- XpContextPtr pCon;
- xRectangle repro;
- PclPixmapPrivPtr pPriv;
RegionPtr drawRegion, region, whole, ret;
BoxRec box;
BoxPtr prect;
int nrect;
void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
short, short );
- extern RegionPtr mfbCopyArea(), cfbCopyArea(), cfb32CopyArea();
-
+
/*
* Since we don't store any information on a per-window basis, we
* can't copy from a window.
@@ -321,7 +321,7 @@ PclCopyArea(DrawablePtr pSrc,
PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
*/
PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
-
+
/*
* If we're copying to a window, we have to do some actual
* drawing, instead of just handing it off to mfb or cfb. Start
@@ -331,14 +331,11 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = srcy;
box.x2 = srcx + width;
box.y2 = srcy + height;
- drawRegion = miRegionCreate( &box, 0 );
- miTranslateRegion( drawRegion, dstx, dsty );
-
- region = miRegionCreate( NULL, 0 );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)
- (pGC->devPrivates[PclGCPrivateIndex].ptr))
- ->pCompositeClip );
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty );
+
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* Now select the operation to be performed on each box in the
@@ -348,7 +345,7 @@ PclCopyArea(DrawablePtr pSrc,
doFragment = PclMonoPixmapFragment;
else
doFragment = PclColorPixmapFragment;
-
+
/*
* Actually draw each section of the bitmap.
*/
@@ -360,18 +357,18 @@ PclCopyArea(DrawablePtr pSrc,
(*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
prect->y1 - dsty, prect->x2 - dstx,
prect->y2 - dsty, prect->x1, prect->y1 );
-
+
nrect--;
prect++;
}
-
+
/*
* Update the destination's GC to the source's GC.
*/
/*
PclSetDrawablePrivateGC( pDst, srcGC );
*/
-
+
/*
* Determine the region that needs to be returned. This is the
* region of the source that falls outside the boundary of the
@@ -381,24 +378,24 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = 0;
box.x2 = pixSrc->drawable.width;
box.y2 = pixSrc->drawable.height;
- whole = miRegionCreate( &box, 0 );
- ret = miRegionCreate( NULL, 0 );
-
- miTranslateRegion( drawRegion, -dstx, -dsty );
- miSubtract( ret, drawRegion, whole );
-
+ whole = REGION_CREATE( pGC->pScreen, &box, 0 );
+ ret = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty );
+ REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole );
+
/*
* Clean up the regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
- miRegionDestroy( whole );
-
- if( miRegionNotEmpty( ret ) )
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, whole );
+
+ if( REGION_NOTEMPTY( pGC->pScreen, ret ) )
return ret;
else
{
- miRegionDestroy( ret );
+ REGION_DESTROY( pGC->pScreen, ret );
return NULL;
}
}
@@ -418,20 +415,19 @@ PclCopyPlane(DrawablePtr pSrc,
RegionPtr reg;
GCPtr scratchGC;
PixmapPtr scratchPix;
- extern RegionPtr mfbCopyPlane(), cfbCopyPlane(), cfb32CopyPlane();
-
+
/*
* Since we don't store PCL on a per-window basis, there's no good
* way to copy from a window.
*/
if( pSrc->type == DRAWABLE_WINDOW )
return NULL;
-
+
/*
* Copying from a pixmap to a pixmap is already implemented by
* mfb/cfb.
*/
- if( pSrc->type == DRAWABLE_PIXMAP &&
+ if( pSrc->type == DRAWABLE_PIXMAP &&
pDst->type == DRAWABLE_PIXMAP )
{
if( pDst->depth == 1 )
@@ -452,7 +448,7 @@ PclCopyPlane(DrawablePtr pSrc,
*/
scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
height, pDst->depth );
-
+
scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
CopyGC( pGC, scratchGC, ~0L );
@@ -474,14 +470,13 @@ PclCopyPlane(DrawablePtr pSrc,
cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
srcx, srcy, width, height, 0, 0, plane );
}
-
+
reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
height, dstx, dsty );
-
+
FreeScratchGC( scratchGC );
-
+
(*pDst->pScreen->DestroyPixmap)( scratchPix );
-
+
return reg;
}
-
diff --git a/Xprint/pcl/PclColor.c b/Xprint/pcl/PclColor.c
index cd3d2cc12..807e711de 100644
--- a/Xprint/pcl/PclColor.c
+++ b/Xprint/pcl/PclColor.c
@@ -45,10 +45,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclColor.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <math.h>
@@ -58,18 +60,7 @@ copyright holders.
#include "resource.h"
#include "Pcl.h"
-
-PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
- ColormapPtr cmap,
- GCPtr gc);
-
-unsigned char *PclReadMap(char *, int *);
-
-void PclLookUp( ColormapPtr cmap,
- PclContextPrivPtr cPriv,
- unsigned short *r,
- unsigned short *g,
- unsigned short *b);
+#include "cfb.h"
static void lookup(unsigned char *src,
unsigned char *dst,
@@ -166,7 +157,7 @@ void
PclDestroyColormap(ColormapPtr pColor)
{
PclScreenPrivPtr sPriv;
- PclCmapToContexts *pCmap, *tCmap;
+ PclCmapToContexts *pCmap, *tCmap = 0;
PclContextListPtr con, tCon;
PclContextPrivPtr cPriv;
PclPaletteMapPtr pPal;
@@ -263,7 +254,7 @@ PclStoreColors(ColormapPtr pColor,
PclContextListPtr con;
PclContextPrivPtr cPriv;
PclPaletteMapPtr pMap;
- char t[80], t2[30];
+ char t[80];
int i;
sPriv = (PclScreenPrivPtr)pColor->pScreen
@@ -425,7 +416,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
* If the requested colormap is already active, nothing needs to
* be done.
*/
- return;
+ return FALSE;
/*
* Now we activate the palette in the printer
@@ -478,10 +469,10 @@ PclUpdateColormap(DrawablePtr pDrawable,
SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
/* Now program the two colors */
- sprintf( t, "\033*v0a0b0c%dI", cmap->pScreen->blackPixel );
+ sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel );
SEND_PCL( cPriv->pPageFile, t );
- sprintf( t, "\033*v32767a32767b32767c%dI",
- cmap->pScreen->whitePixel );
+ sprintf( t, "\033*v32767a32767b32767c%ldI",
+ (long) cmap->pScreen->whitePixel );
SEND_PCL( cPriv->pPageFile, t );
#endif /* XP_PCL_COLOR */
}
@@ -637,6 +628,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
}
pMap->downloaded = 1;
}
+ return TRUE;
}
@@ -725,7 +717,7 @@ unsigned char *PclReadMap(char *name, int *dim)
fseek(fp, 0, SEEK_SET);
- if (fread(data, sizeof(char), size, fp) != size) {
+ if (fread(data, sizeof(char), size, fp) != (unsigned) size) {
fclose(fp);
free(data);
return(NULL);
@@ -746,11 +738,11 @@ unsigned char *PclReadMap(char *name, int *dim)
static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim)
{
int i;
- unsigned char *p1, *p2, *p3;
- int shift, offset;
#define _INTERPOLATE
#ifndef _INTERPOLATE
+ unsigned char *p1, *p2, *p3;
+
for (i=0; i<num; i++) {
p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
*dst++ = *p1++;
@@ -794,7 +786,7 @@ static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, in
d000, d001, d010, d011,
d100, d101, d110, d111,
dx00, dx01, dx10, dx11,
- dxy0, dxy1, dxyz;
+ dxy0, dxy1;
float scale;
scale = 255.0 / (dim-1);
diff --git a/Xprint/pcl/PclCursor.c b/Xprint/pcl/PclCursor.c
index 88a76f6bf..7e463d498 100644
--- a/Xprint/pcl/PclCursor.c
+++ b/Xprint/pcl/PclCursor.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclCursor.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include <stdio.h>
@@ -52,59 +53,59 @@ copyright holders.
#include "windowstr.h"
void
-PclConstrainCursor( pScreen, pBox )
- ScreenPtr pScreen;
- BoxPtr pBox;
+PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox)
{
}
void
-PclCursorLimits( pScreen, pCursor, pHotBox, pTopLeftBox )
- ScreenPtr pScreen;
- CursorPtr pCursor;
- BoxPtr pHotBox;
- BoxPtr pTopLeftBox;
+PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftBox)
{
}
Bool
-PclDisplayCursor( pScreen, pCursor )
- ScreenPtr pScreen;
- CursorPtr pCursor;
+PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
return True;
}
Bool
-PclRealizeCursor( pScreen, pCursor )
- ScreenPtr pScreen;
- CursorPtr pCursor;
+PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
return True;
}
Bool
-PclUnrealizeCursor( pScreen, pCursor )
- ScreenPtr pScreen;
- CursorPtr pCursor;
+PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
return True;
}
void
-PclRecolorCursor( pScreen, pCursor, displayed )
- ScreenPtr pScreen;
- CursorPtr pCursor;
- Bool displayed;
+PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed)
{
}
Bool
-PclSetCursorPosition( pScreen, x, y, generateEvent )
- ScreenPtr pScreen;
- int x;
- int y;
- Bool generateEvent;
+PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent)
{
return True;
}
diff --git a/Xprint/pcl/PclGC.c b/Xprint/pcl/PclGC.c
index 7f0039e1f..e1fe772bd 100644
--- a/Xprint/pcl/PclGC.c
+++ b/Xprint/pcl/PclGC.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclGC.c,v 1.10 2001/10/28 03:32:54 tsi Exp $ */
#include "gcstruct.h"
@@ -51,6 +52,8 @@ copyright holders.
#include "pixmapstr.h"
#include "colormapst.h"
#include "windowstr.h"
+#include "cfb.h"
+#include "cfb32.h"
#include "migc.h"
#include "scrnintstr.h"
#include "resource.h"
@@ -97,11 +100,8 @@ static GCFuncs PclGCFuncs =
;
Bool
-PclCreateGC( pGC )
- GCPtr pGC;
+PclCreateGC(GCPtr pGC)
{
- PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
-
if( pGC->depth == 1 )
{
if( mfbCreateGC( pGC ) == FALSE )
@@ -125,36 +125,25 @@ PclCreateGC( pGC )
pGC->ops = &PclGCOps;
pGC->funcs = &PclGCFuncs;
- pPriv->pCompositeClip = NULL;
- pPriv->freeCompClip = FALSE;
-
return TRUE;
}
void
PclDestroyGC(GCPtr pGC)
{
- PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
- extern int mfbGCPrivateIndex;
-
/* Handle the mfb and cfb, which share a GC private struct */
- miRegisterGCPrivateIndex( mfbGCPrivateIndex );
miDestroyGC( pGC );
-
- if( pPriv->freeCompClip == TRUE )
- REGION_DESTROY( pGC->pScreen, pPriv->pCompositeClip );
}
int
-PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
- DrawablePtr pDrawable;
- GC *gc;
- unsigned long *valid;
- FILE **file;
+PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file)
{
XpContextPtr pCon;
- PclPixmapPrivPtr pPriv;
PclContextPrivPtr cPriv;
switch( pDrawable->type )
@@ -185,9 +174,9 @@ PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
}
void
-PclSetDrawablePrivateGC( pDrawable, gc )
- DrawablePtr pDrawable;
- GC gc;
+PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc)
{
PixmapPtr pix;
XpContextPtr pCon;
@@ -332,19 +321,17 @@ PclSendPattern(char *bits,
}
int
-PclUpdateDrawableGC( pGC, pDrawable, outFile )
- GCPtr pGC;
- DrawablePtr pDrawable;
- FILE **outFile;
+PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile)
{
- Mask drawableMask, changeMask = 0;
+ Mask changeMask = 0;
GC dGC;
unsigned long valid;
int i;
XpContextPtr pCon;
PclContextPrivPtr cPriv;
- Colormap c;
- ColormapPtr cmap;
PclGCPrivPtr gcPriv = (PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr);
@@ -403,12 +390,14 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
changeMask |= GCTileStipYOrigin;
if( dGC.numInDashList == pGC->numInDashList )
+ {
for( i = 0; i < dGC.numInDashList; i++ )
if( cPriv->dash[i] != pGC->dash[i] )
{
changeMask |= GCDashList;
break;
}
+ }
else
changeMask |= GCDashList;
}
@@ -513,9 +502,11 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCForeground )
{
+#ifdef XP_PCL_COLOR
+ ColormapPtr cmap;
+ Colormap c;
char t[40];
-#ifdef XP_PCL_COLOR
c = wColormap( ((WindowPtr)pDrawable) );
cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
@@ -538,7 +529,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
}
else /* PseudoColor or StaticGray */
{
- sprintf( t, "SP%d;", pGC->fgPixel );
+ sprintf( t, "SP%ld;", (long) pGC->fgPixel );
SEND_PCL( *outFile, t );
}
#else
@@ -654,9 +645,8 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCTile && !pGC->tileIsPixel )
{
- char t[80], *bits, *row, *mod;
- int h, w, w2, sz;
- int i, j;
+ char *bits;
+ int h, w, sz;
h = pGC->tile.pixmap->drawable.height;
w = pGC->tile.pixmap->drawable.width;
@@ -666,7 +656,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w );
bits = (char *)xalloc( sz );
- mfbGetImage(pGC->tile.pixmap, 0, 0, w, h, XYPixmap, ~0, bits);
+ mfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, bits);
PclSendPattern( bits, sz, 1, h, w, 100, *outFile );
xfree( bits );
}
@@ -674,7 +664,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{
sz = h * PixmapBytePad( w, 8 );
bits = (char *)xalloc( sz );
- cfbGetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits);
+ cfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits);
PclSendPattern( bits, sz, 8, h, w, 100, *outFile );
xfree( bits );
}
@@ -684,7 +674,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * PixmapBytePad( w, 24 );
bits = (char *)xalloc( sz );
- cfb32GetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits);
+ cfb32GetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits);
PclSendPattern( bits, sz, 24, h, w, 100, *outFile );
xfree( bits );
}
@@ -723,7 +713,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w );
bits = (char *)xalloc( sz );
- mfbGetImage( pGC->stipple, 0, 0, w, h, XYPixmap, ~0, bits );
+ mfbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits );
w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
/*
@@ -766,10 +756,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{
mfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix );
- mfbCopyPlane( pGC->stipple,
+ mfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 );
- mfbGetImage( scratchPix, 0, 0, w, h, XYPixmap, ~0,
+ mfbGetImage( &(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0,
bits );
}
else if( pGC->depth <= 32 )
@@ -777,10 +767,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
#if PSZ == 8
cfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix );
- cfbCopyPlane( pGC->stipple,
+ cfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 );
- cfbGetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0,
+ cfbGetImage( &(scratchPix->drawable), 0, 0, w, h, ZPixmap, ~0,
bits );
#else
cfb32ValidateGC( scratchGC, ~0L,
@@ -868,14 +858,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
void
-PclComputeCompositeClip(pGC, pDrawable)
- GCPtr pGC;
- DrawablePtr pDrawable;
+PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable)
{
- ScreenPtr pScreen = pGC->pScreen;
- PclGCPrivPtr devPriv = (PclGCPrivPtr)
- (pGC->devPrivates[PclGCPrivateIndex].ptr);
-
if (pDrawable->type == DRAWABLE_WINDOW)
{
WindowPtr pWin = (WindowPtr) pDrawable;
@@ -892,7 +878,7 @@ PclComputeCompositeClip(pGC, pDrawable)
pregWin = &pWin->clipList;
freeTmpClip = FALSE;
}
- freeCompClip = devPriv->freeCompClip;
+ freeCompClip = pGC->freeCompClip;
/*
* if there is no client clip, we can get by with just keeping the
@@ -904,9 +890,9 @@ PclComputeCompositeClip(pGC, pDrawable)
if (pGC->clientClipType == CT_NONE)
{
if (freeCompClip)
- REGION_DESTROY(pScreen, devPriv->pCompositeClip);
- devPriv->pCompositeClip = pregWin;
- devPriv->freeCompClip = freeTmpClip;
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
}
else
{
@@ -919,30 +905,31 @@ PclComputeCompositeClip(pGC, pDrawable)
* clip. if neither is real, create a new region.
*/
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
if (freeCompClip)
{
- REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
+ REGION_DESTROY(pGC->pScreen, pregWin);
}
else if (freeTmpClip)
{
- REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
- devPriv->pCompositeClip = pregWin;
+ REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
+ pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
}
else
{
- devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
- devPriv->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
}
@@ -957,23 +944,23 @@ PclComputeCompositeClip(pGC, pDrawable)
pixbounds.x2 = pDrawable->width;
pixbounds.y2 = pDrawable->height;
- if (devPriv->freeCompClip)
+ if (pGC->freeCompClip)
{
- REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds);
+ REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
}
else
{
- devPriv->freeCompClip = TRUE;
- devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
- devPriv->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
}
} /* end of composite clip for pixmap */
@@ -992,16 +979,11 @@ PclComputeCompositeClip(pGC, pDrawable)
/*ARGSUSED*/
void
-PclValidateGC( pGC, changes, pDrawable )
- GCPtr pGC;
- Mask changes;
- DrawablePtr pDrawable;
+PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable)
{
- XpContextPtr pCon;
- PclContextPrivPtr pConPriv;
- extern int mfbGCPrivateIndex;
- extern int cfbGCPrivateIndex;
-
/*
* Pixmaps should be handled by their respective validation
* functions.
@@ -1010,16 +992,13 @@ PclValidateGC( pGC, changes, pDrawable )
{
if( pDrawable->depth == 1 )
{
- miRegisterGCPrivateIndex( mfbGCPrivateIndex );
mfbValidateGC( pGC, ~0, pDrawable );
}
else if( pDrawable->depth <= 32 )
{
#if PSZ == 8
- miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfbValidateGC( pGC, ~0, pDrawable );
#else
- miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfb32ValidateGC( pGC, ~0, pDrawable );
#endif
}
@@ -1061,4 +1040,3 @@ PclValidateGC( pGC, changes, pDrawable )
PclSetDrawablePrivateGC( pDrawable, *pGC, changes );
*/
}
-
diff --git a/Xprint/pcl/PclInit.c b/Xprint/pcl/PclInit.c
index 791a33dfe..5ee49631e 100644
--- a/Xprint/pcl/PclInit.c
+++ b/Xprint/pcl/PclInit.c
@@ -76,30 +76,26 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclInit.c,v 1.12 2002/10/16 21:13:32 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "Pcl.h"
-#include "AttrValid.h"
#include "cfb.h"
+#include "Xos.h" /* for unlink() */
#include "attributes.h"
-#include "windowstr.h"
+#include "DiPrint.h"
#define MODELDIRNAME "/models"
-extern char *XpGetConfigDir();
-static void AllocatePclPrivates(
- ScreenPtr pScreen);
+static void AllocatePclPrivates(ScreenPtr pScreen);
static int PclInitContext(XpContextPtr pCon);
-
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
-
-extern unsigned char *PclReadMap(char *, int *);
+static Bool PclDestroyContext(XpContextPtr pCon);
int PclScreenPrivateIndex;
int PclContextPrivateIndex;
@@ -153,46 +149,24 @@ Bool
PclCloseScreen(int index,
ScreenPtr pScreen)
{
- Bool status = Success;
PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr;
-/*
- if( pPriv->CloseScreen != (Bool (*)())NULL )
- {
- pScreen->CloseScreen = pPriv->CloseScreen;
- status = pScreen->CloseScreen( index, pScreen );
- pScreen->CloseScreen = PclCloseScreen;
- }
-*/
-
- /*
- * Finish cleaning up cfb (code taken from cfbCloseScreen)
- */
-#ifdef XP_PCL_COLOR
-#ifdef CFB_NEED_SCREEN_PRIVATE
- xfree( pScreen->devPrivates[cfbScreenPrivateIndex].ptr );
-#else
- xfree( pScreen->devPrivate );
-#endif
-#endif
-
+ pScreen->CloseScreen = pPriv->CloseScreen;
xfree( pPriv );
- return status;
+ return (*pScreen->CloseScreen)(index, pScreen);
}
Bool
-InitializePclDriver(ndx, pScreen, argc, argv)
- int ndx;
- ScreenPtr pScreen;
- int argc;
- char **argv;
+InitializePclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
{
- int maxRes, xRes, yRes, maxWidth, maxHeight, maxDim, numBytes;
- int i;
+ int maxRes, xRes, yRes, maxDim;
+ unsigned i;
PclScreenPrivPtr pPriv;
- char **printerNames;
- int numPrinters;
/*
* Register this driver's InitContext function with the print
@@ -227,7 +201,7 @@ InitializePclDriver(ndx, pScreen, argc, argv)
/*
* Clean up the fields that we stomp (code taken from cfbCloseScreen)
*/
- for( i = 0; i < pScreen->numDepths; i++ )
+ for( i = 0; (int) i < pScreen->numDepths; i++ )
xfree( pScreen->allowedDepths[i].vids );
xfree( pScreen->allowedDepths );
xfree( pScreen->visuals );
@@ -236,19 +210,19 @@ InitializePclDriver(ndx, pScreen, argc, argv)
maxRes );
#endif /* XP_PCL_COLOR */
+ miInitializeBackingStore ( pScreen );
+
pScreen->defColormap = FakeClientID(0);
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
-/*
pPriv->CloseScreen = pScreen->CloseScreen;
-*/
pScreen->CloseScreen = PclCloseScreen;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
- pScreen->SaveScreen = _XpBoolNoop;
- pScreen->GetImage = _XpVoidNoop;
- pScreen->GetSpans = _XpVoidNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PclCreateWindow;
pScreen->DestroyWindow = PclDestroyWindow;
/*
@@ -316,30 +290,29 @@ InitializePclDriver(ndx, pScreen, argc, argv)
}
static void
-AllocatePclPrivates(
- ScreenPtr pScreen)
+AllocatePclPrivates(ScreenPtr pScreen)
{
- static int PclGeneration = -1;
+ static unsigned long PclGeneration = 0;
- if(PclGeneration != serverGeneration)
+ if((unsigned long) PclGeneration != serverGeneration)
{
PclScreenPrivateIndex = AllocateScreenPrivateIndex();
PclWindowPrivateIndex = AllocateWindowPrivateIndex();
- AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
- sizeof( PclWindowPrivRec ) );
+ AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
+ sizeof( PclWindowPrivRec ) );
PclContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate( PclContextPrivateIndex,
- sizeof( PclContextPrivRec ) );
+ XpAllocateContextPrivate( PclContextPrivateIndex,
+ sizeof( PclContextPrivRec ) );
PclGCPrivateIndex = AllocateGCPrivateIndex();
- AllocateGCPrivate( pScreen, PclGCPrivateIndex,
- sizeof( PclGCPrivRec ) );
+ AllocateGCPrivate( pScreen, PclGCPrivateIndex,
+ sizeof( PclGCPrivRec ) );
PclPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
- sizeof( PclPixmapPrivRec ) );
+ AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
+ sizeof( PclPixmapPrivRec ) );
PclGeneration = serverGeneration;
}
@@ -364,8 +337,7 @@ static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
default-input-tray default-medium plex";
static int
-PclInitContext( pCon )
- XpContextPtr pCon;
+PclInitContext(XpContextPtr pCon)
{
XpDriverFuncsPtr pFuncs;
PclContextPrivPtr pConPriv;
@@ -373,7 +345,6 @@ PclInitContext( pCon )
char *modelID;
char *configDir;
char *pathName;
- extern XpValidatePoolsRec PclValidatePoolsRec;
int i, j;
float width, height;
XpOidMediumDiscreteSizeList* ds_list;
@@ -392,16 +363,16 @@ PclInitContext( pCon )
pFuncs = &( pCon->funcs );
pFuncs->StartJob = PclStartJob;
pFuncs->EndJob = PclEndJob;
- pFuncs->StartDoc = (int (*)())PclStartDoc;
+ pFuncs->StartDoc = PclStartDoc;
pFuncs->EndDoc = PclEndDoc;
pFuncs->StartPage = PclStartPage;
pFuncs->EndPage = PclEndPage;
pFuncs->PutDocumentData = PclDocumentData;
pFuncs->GetDocumentData = PclGetDocumentData;
- pFuncs->GetAttributes = (char *(*)())PclGetAttributes;
- pFuncs->SetAttributes = (int (*)())PclSetAttributes;
- pFuncs->AugmentAttributes = (int (*)())PclAugmentAttributes;
- pFuncs->GetOneAttribute = (char *(*)())PclGetOneAttribute;
+ pFuncs->GetAttributes = PclGetAttributes;
+ pFuncs->SetAttributes = PclSetAttributes;
+ pFuncs->AugmentAttributes = PclAugmentAttributes;
+ pFuncs->GetOneAttribute = PclGetOneAttribute;
pFuncs->DestroyContext = PclDestroyContext;
pFuncs->GetMediumDimensions = PclGetMediumDimensions;
pFuncs->GetReproducibleArea = PclGetReproducibleArea;
@@ -541,8 +512,7 @@ PclInitContext( pCon )
}
static Bool
-PclDestroyContext( pCon )
- XpContextPtr pCon;
+PclDestroyContext(XpContextPtr pCon)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
@@ -639,8 +609,7 @@ PclDestroyContext( pCon )
}
XpContextPtr
-PclGetContextFromWindow( win )
- WindowPtr win;
+PclGetContextFromWindow(WindowPtr win)
{
PclWindowPrivPtr pPriv;
diff --git a/Xprint/pcl/PclLine.c b/Xprint/pcl/PclLine.c
index 271bdfb16..3c10f97ca 100644
--- a/Xprint/pcl/PclLine.c
+++ b/Xprint/pcl/PclLine.c
@@ -11,7 +11,7 @@
** * Created: 10/11/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclLine.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
#include "gcstruct.h"
@@ -80,16 +81,16 @@ copyright holders.
*/
void
-PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode;
- int nPoints;
- xPoint *pPoints;
+PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
{
- char t[80], window[80];
+ char t[80];
FILE *outFile;
- int xoffset, yoffset;
+ int xoffset = 0, yoffset = 0;
int nbox;
BoxPtr pbox;
xRectangle *drawRects, *r;
@@ -98,7 +99,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
int i;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
@@ -110,7 +111,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Allocate the storage required to deal with the clipping
* regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)
xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) );
@@ -120,7 +121,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* XXX I need to think of a way to test this.
*/
fudge = 3 * pGC->lineWidth + 1;
-
+
/*
* Generate the PCL code to draw the polyline, by defining it as a
* macro which uses the HP-GL/2 line drawing function.
@@ -132,20 +133,20 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x,
pPoints[0].y + pDrawable->y );
SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
-
+
switch( mode )
{
case CoordModeOrigin:
xoffset = pDrawable->x;
yoffset = pDrawable->y;
- SAVE_PCL( outFile, pConPriv, "PA" );
+ SAVE_PCL( outFile, pConPriv, "PA" );
break;
case CoordModePrevious:
xoffset = yoffset = 0;
- SAVE_PCL( outFile, pConPriv, "PR" );
+ SAVE_PCL( outFile, pConPriv, "PR" );
break;
}
-
+
/*
* Build the "drawing region" as we build the PCL to draw the
* line.
@@ -154,13 +155,13 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
{
if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," );
-
+
sprintf( t, "%d,%d", pPoints[i].x + xoffset,
pPoints[i].y + yoffset );
SAVE_PCL( outFile, pConPriv, t );
r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge;
- r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
+ r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge;
r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge;
}
@@ -171,36 +172,35 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Convert the collection of rectangles into a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nPoints - 1, drawRects, CT_UNSORTED );
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1,
+ drawRects, CT_UNSORTED );
if( mode == CoordModePrevious )
- miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire polyline to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
void
-PclPolySegment( pDrawable, pGC, nSegments, pSegments )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nSegments;
- xSegment *pSegments;
+PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments)
{
FILE *outFile, *dummy;
char t[80];
@@ -214,8 +214,8 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
GC cacheGC;
-
-
+
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
@@ -226,7 +226,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
/*
* Allocate the storage for the temporary regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)
xalloc( nSegments * sizeof( xRectangle ) );
@@ -234,12 +234,12 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Calculate the fudge factor, based on the line width
*/
fudge = pGC->lineWidth * 3 + 1;
-
+
/*
* Turn off line joining.
*/
SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
-
+
/*
* Generate the PCL code to draw the segments, by defining them as
* a macro which uses the HP-GL/2 line drawing function.
@@ -254,7 +254,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = drawRects; i < nSegments; i++, r++ )
{
r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset;
@@ -279,18 +279,17 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Convert the collection of rectangles into a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nSegments, drawRects, CT_UNSORTED );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire set of segments to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
@@ -303,12 +302,11 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
cacheGC.joinStyle = !cacheGC.joinStyle;
PclSetDrawablePrivateGC( pDrawable, cacheGC );
PclUpdateDrawableGC( pGC, pDrawable, &outFile );
-
+
/*
- * Clean up
+ * Clean up
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
-
diff --git a/Xprint/pcl/PclMisc.c b/Xprint/pcl/PclMisc.c
index 867393a46..f5d36a263 100644
--- a/Xprint/pcl/PclMisc.c
+++ b/Xprint/pcl/PclMisc.c
@@ -44,9 +44,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclMisc.c,v 1.10 2001/12/02 13:35:28 herrb Exp $ */
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
-#include <stdio.h>
#include "Pcl.h"
#include "cursor.h"
@@ -54,6 +58,7 @@ copyright holders.
#include "windowstr.h"
#include "propertyst.h"
+#include "attributes.h"
/*ARGSUSED*/
@@ -142,12 +147,14 @@ GetPropString(
}
#include <signal.h>
+#include <errno.h>
/* ARGSUSED */
static void SigchldHndlr (
int dummy)
{
int status, w;
+ int olderrno = errno;
struct sigaction act;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
@@ -159,6 +166,7 @@ static void SigchldHndlr (
* Is this really necessary?
*/
sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
}
/*
@@ -248,6 +256,7 @@ char *ptr;
* in the clipped area.
* For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
*/
+void
PclSendData(
FILE *outFile,
PclContextPrivPtr pConPriv,
diff --git a/Xprint/pcl/PclPixel.c b/Xprint/pcl/PclPixel.c
index 23ec464e5..b9685fd1b 100644
--- a/Xprint/pcl/PclPixel.c
+++ b/Xprint/pcl/PclPixel.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixel.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
@@ -60,7 +61,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
int nPoints;
xPoint *pPoints;
{
- char t[80], *command;
+ char t[80];
FILE *outFile;
int xoffset, yoffset;
BoxRec box;
@@ -84,7 +85,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
xloc = pPoints[0].x + pDrawable->x;
yloc = pPoints[0].y + pDrawable->y;
- sprintf( t, "\27%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
+ sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
SEND_PCL( outFile, t );
/*
@@ -94,7 +95,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
for( i = 0; i < nPoints; i++ )
{
- if( miPointInRegion( pGC->clientClip, xloc, yloc, &box ) )
+ if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) )
{
sprintf( t, ",%d,%d", xloc, yloc );
SEND_PCL( outFile, t );
diff --git a/Xprint/pcl/PclPixmap.c b/Xprint/pcl/PclPixmap.c
index fe8d169b1..ba91fc9ec 100644
--- a/Xprint/pcl/PclPixmap.c
+++ b/Xprint/pcl/PclPixmap.c
@@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixmap.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
-/*#include "cfb.h"*/
-/* #include "mfb.h" */
+#include "cfb.h"
+#include "cfb32.h"
+#include "mfb.h"
#include "pixmapstr.h"
PixmapPtr
@@ -56,25 +58,24 @@ PclCreatePixmap(ScreenPtr pScreen,
int height,
int depth)
{
-extern PixmapPtr mfbCreatePixmap(), cfbCreatePixmap(), cfb32CreatePixmap();
-
if( depth == 1 )
return mfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 8 )
return cfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 32 )
return cfb32CreatePixmap( pScreen, width, height, depth );
+ return 0;
}
Bool
PclDestroyPixmap(PixmapPtr pPixmap)
{
-extern Bool mfbDestroyPixmap(), cfbDestroyPixmap(), cfb32DestroyPixmap();
if( pPixmap->drawable.depth == 1 )
return mfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 8 )
return cfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 32 )
return cfb32DestroyPixmap( pPixmap );
+ return 0;
}
diff --git a/Xprint/pcl/PclPolygon.c b/Xprint/pcl/PclPolygon.c
index badbdf18a..a5de77399 100644
--- a/Xprint/pcl/PclPolygon.c
+++ b/Xprint/pcl/PclPolygon.c
@@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPolygon.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
@@ -51,11 +52,11 @@ copyright holders.
#include "windowstr.h"
void
-PclPolyRectangle( pDrawable, pGC, nRects, pRects )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nRects;
- xRectangle *pRects;
+PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
{
char t[80];
FILE *outFile;
@@ -67,23 +68,23 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
int xoffset, yoffset;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
-
+
/*
* Allocate the storage required to deal with the clipping
- * regions.
+ * regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
-
+
fudge = 3 * pGC->lineWidth + 1;
-
+
/*
* Generate the PCL code to draw the rectangles, by defining them
* as a macro which uses the HP-GL/2 rectangle drawing function.
@@ -93,13 +94,13 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
-
+
/* Draw the rectangle */
- sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
+ sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
rect.y + yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t );
@@ -113,49 +114,47 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
}
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile );
-
+
/*
* Convert the collection of rectangles to a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
-
+
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
void
-PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int shape;
- int mode;
- int nPoints;
- DDXPointPtr pPoints;
+PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints)
{
char t[80];
FILE *outFile;
int nbox, i;
BoxPtr pbox;
BoxRec box;
- xRectangle *drawRects, *r;
RegionPtr drawRegion, region;
int xoffset, yoffset;
int xtop, xbottom, yleft, yright;
@@ -163,14 +162,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
char *command;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
-
+
/*
* Generate the PCL code to draw the filled polygon, by defining
* it as a macro which uses the HP-GL/2 polygon drawing function.
@@ -189,7 +188,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
xoffset = yoffset = 0;
command = "PR";
}
-
+
/* Begin the polygon */
sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ yoffset, command );
@@ -198,13 +197,13 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
/* Seed the bounding box */
xtop = xbottom = pPoints[0].x + xoffset;
yleft = yright = pPoints[0].y + yoffset;
-
+
/* Add the rest of the points to the polygon */
for( i = 1; i < nPoints; i++ )
{
if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," );
-
+
sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
yoffset );
SAVE_PCL( outFile, pConPriv, t );
@@ -222,7 +221,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
fillRule = 0;
else
fillRule = 1;
-
+
sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
SAVE_PCL( outFile, pConPriv, t );
MACRO_END ( outFile );
@@ -234,16 +233,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
box.y1 = yleft;
box.x2 = xbottom;
box.y2 = yright;
- drawRegion = miRegionCreate( &box, 0 );
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
if( mode == CoordModePrevious )
- miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
-
- region = miRegionCreate( NULL, 0 );
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -251,22 +248,22 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
}
void
-PclPolyFillRect( pDrawable, pGC, nRects, pRects )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nRects;
- xRectangle *pRects;
+PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
{
char t[80];
FILE *outFile;
@@ -278,24 +275,24 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
short fudge;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
-
+
/*
* Allocate the storage required to deal with the clipping
* regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
fudge = 3 * pGC->lineWidth + 1;
-
+
/*
* Generate the PCL code to draw the filled rectangles, by
* defining them as a macro which uses the HP-GL/2 rectangle
@@ -303,19 +300,19 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
*/
MACRO_START( outFile, pConPriv );
SAVE_PCL( outFile, pConPriv, "\033%0B" );
-
+
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
-
+
/* Draw the rectangle */
sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t );
-
+
/* Build the bounding box */
r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
@@ -325,30 +322,28 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
}
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile );
-
+
/*
* Convert the collection of rectangles to a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
-
+
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
-
diff --git a/Xprint/pcl/PclPrint.c b/Xprint/pcl/PclPrint.c
index 2bfd92d15..f21d6c22a 100644
--- a/Xprint/pcl/PclPrint.c
+++ b/Xprint/pcl/PclPrint.c
@@ -43,6 +43,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPrint.c,v 1.7 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
#include <string.h>
@@ -63,20 +64,14 @@ copyright holders.
#include "AttrValid.h"
#include "Oid.h"
-extern PclSoftFontInfoPtr PclCreateSoftFontInfo();
-extern void PclDestroySoftFontInfo(PclSoftFontInfoPtr);
-
int
-PclStartJob( pCon, sendClientData, client )
- XpContextPtr pCon;
- Bool sendClientData;
- ClientPtr client;
-
+PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
{
PclContextPrivPtr pConPriv =
(PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
- char *jobHeader;
- char s[40];
PclPaletteMap *pal;
/*
@@ -128,9 +123,9 @@ PclStartJob( pCon, sendClientData, client )
}
int
-PclEndJob( pCon, cancel )
- XpContextPtr pCon;
- Bool cancel;
+PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel)
{
PclContextPrivPtr priv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
@@ -143,7 +138,7 @@ PclEndJob( pCon, cancel )
char *fileName, *trailer;
struct stat statBuf;
int n;
- PclPaletteMapPtr p, t;
+ PclPaletteMapPtr p;
trailer = "\033%-12345X@PJL RESET\n";
@@ -152,7 +147,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient );
- priv->getDocClient == NULL;
+ priv->getDocClient = NULL;
priv->getDocBufSize = 0;
}
@@ -183,7 +178,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient );
- priv->getDocClient == NULL;
+ priv->getDocClient = NULL;
priv->getDocBufSize = 0;
}
@@ -249,11 +244,10 @@ PclEndJob( pCon, cancel )
* ClearArea the window and all descendant windows
*/
int
-PclStartPage( pCon, pWin )
- XpContextPtr pCon;
- WindowPtr pWin;
+PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
{
- register WindowPtr pChild;
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
PclWindowPrivPtr pWinPriv =
@@ -261,9 +255,7 @@ PclStartPage( pCon, pWin )
xRectangle repro;
char t[80];
XpOid orient, plex, tray, medium;
- unsigned short wid, ht;
int dir, plexNum, num;
- xEvent event;
/*
* Put a pointer to the context in the window private structure
@@ -490,14 +482,12 @@ SendDocData( PclContextPrivPtr pPriv )
* Write page file to job file
*/
int
-PclEndPage( pCon, pWin )
- XpContextPtr pCon;
- WindowPtr pWin;
+PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
- PclWindowPrivPtr pWinPriv =
- (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
struct stat statBuf;
@@ -566,9 +556,9 @@ PclStartDoc(XpContextPtr pCon,
}
int
-PclEndDoc( pCon, cancel )
- XpContextPtr pCon;
- Bool cancel;
+PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
{
/*
* XXX What should I do if I get cancel == TRUE?
@@ -588,18 +578,18 @@ PclEndDoc( pCon, cancel )
#define DOC_HPGL 2
int
-PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, client)
- XpContextPtr pCon;
- DrawablePtr pDraw;
- char *pData;
- int len_data;
- char *pFmt;
- int len_fmt;
- char *pOpt;
- int len_opt;
- ClientPtr client;
+PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client)
{
- int type;
+ int type = 0;
PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
XpOidDocFmtList *formats;
@@ -703,10 +693,10 @@ PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, cli
*/
int
-PclGetDocumentData( pCon, client, maxBufferSize )
- XpContextPtr pCon;
- ClientPtr client;
- int maxBufferSize;
+PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize)
{
PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
diff --git a/Xprint/pcl/PclSFonts.c b/Xprint/pcl/PclSFonts.c
index 9f19a2387..2f33ab857 100644
--- a/Xprint/pcl/PclSFonts.c
+++ b/Xprint/pcl/PclSFonts.c
@@ -45,6 +45,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSFonts.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
@@ -75,8 +76,7 @@ PclDownloadSoftFont8(
PclSoftFontInfoPtr pSoftFontInfo,
PclFontHead8Ptr pfh,
PclCharDataPtr pcd,
- unsigned char *code,
- int flag
+ unsigned char *code
)
{
/*
@@ -103,8 +103,7 @@ PclDownloadSoftFont16(
PclFontHead16Ptr pfh,
PclCharDataPtr pcd,
unsigned char row,
- unsigned char col,
- int flag
+ unsigned char col
)
{
/*
@@ -129,8 +128,7 @@ PclDownloadSoftFont16(
* of the downloaded soft font.
* **************************************************************************/
PclSoftFontInfoPtr
-PclCreateSoftFontInfo(
-)
+PclCreateSoftFontInfo(void)
{
PclSoftFontInfoPtr pSoftFontInfo;
@@ -154,7 +152,7 @@ PclFontHead8Ptr pfh8, pfh8_next;
PclFontHead16Ptr pfh16, pfh16_next;
PclInternalFontPtr pin, pin_next;
unsigned char nindex_row, nindex_col;
-int i, j;
+int i;
if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
return;
diff --git a/Xprint/pcl/PclSpans.c b/Xprint/pcl/PclSpans.c
index 38d1b7b01..98c17dcf9 100644
--- a/Xprint/pcl/PclSpans.c
+++ b/Xprint/pcl/PclSpans.c
@@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSpans.c,v 1.6 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
@@ -51,33 +52,33 @@ copyright holders.
#include "windowstr.h"
void
-PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nSpans;
- DDXPointPtr pPoints;
- int *pWidths;
- int fSorted;
+PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted)
{
char t[80];
FILE *outFile;
int xoffset, yoffset;
xRectangle *rects, *r;
- RegionPtr fillRegion, region;
+ RegionPtr fillRegion, region = 0;
int i;
int nbox;
BoxPtr pbox;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
-
+
/*
* Build a region out of the spans
*/
rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = rects; i < nSpans; i++, r++ )
{
r->x = pPoints[i].x + xoffset;
@@ -85,15 +86,15 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
r->width = pWidths[i];
r->height = 1;
}
- fillRegion = miRectsToRegion( nSpans, rects, ( fSorted ) ?
+ fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ?
CT_YSORTED : CT_UNSORTED );
-
+
/*
* Intersect this region with the clip region. Whatever's left,
* should be filled.
*/
- miIntersect( region, fillRegion, pGC->clientClip );
-
+ REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip );
+
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
@@ -102,35 +103,33 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
while( nbox )
{
- sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
pbox->x2, pbox->y2 );
SEND_PCL( outFile, t );
-
+
nbox--;
pbox++;
}
/* Go back to PCL */
SEND_PCL( outFile, "\27%0A" );
-
+
/*
* Clean up the temporary regions
*/
- miRegionDestroy( fillRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, fillRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( rects );
}
void
-PclSetSpans( pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted )
- DrawablePtr pDrawable;
- GCPtr pGC;
- char *pSrc;
- DDXPointPtr pPoints;
- int *pWidths;
- int nSpans;
- int fSorted;
+PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted)
{
}
-
-
diff --git a/Xprint/pcl/PclText.c b/Xprint/pcl/PclText.c
index d01baabfa..ae5446a85 100644
--- a/Xprint/pcl/PclText.c
+++ b/Xprint/pcl/PclText.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclText.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */
#ifdef DO_TWO_BYTE_PCL
#include "iconv.h"
@@ -81,13 +82,13 @@ static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
#define INTERNAL_FONT 1
int
-PclPolyText8( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x;
- int y;
- int count;
- char *string;
+PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
@@ -181,8 +182,6 @@ char font_type;
MACRO_END( outFile );
} else {
- char *internalFont;
- int pixel_size;
int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo);
@@ -231,9 +230,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -247,20 +244,20 @@ char font_type;
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
return x+w;
}
int
-PclPolyText16( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x;
- int y;
- int count;
- unsigned short *string;
+PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
@@ -271,7 +268,6 @@ CharInfoPtr charinfo[255], *chinfo;
FILE *outFile;
PclSoftFontInfoPtr pSoftFontInfo;
PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
-PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
PclCharDataRec cd;
FontInfoPtr pfi;
unsigned char row, col;
@@ -321,8 +317,8 @@ char font_type;
col = col - pfi->firstCol;
} else {
def = pfi->defaultCh;
- row = (def>>8)&0xff - pfi->firstRow;
- col = def&0xff - pfi->firstCol;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
}
if ( !pfh16->index[row][col].fid ) {
fillCharDescData(&cd, *chinfo);
@@ -356,8 +352,8 @@ char font_type;
col = col - pfi->firstCol;
} else {
def = pfi->defaultCh;
- row = (def>>8)&0xff - pfi->firstRow;
- col = def&0xff - pfi->firstCol;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
}
if ( last_fid != pfh16->index[row][col].fid ) {
sprintf(t, "%cFI%d;SS;LB",
@@ -380,8 +376,7 @@ char font_type;
} else {
#ifdef DO_TWO_BYTE_PCL
- char *internalFont;
- int pixel_size;
+ PclInternalFontPtr pin;
int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo);
@@ -432,9 +427,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -448,52 +441,52 @@ char font_type;
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
return x+w;
}
void
-PclImageText8( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- int count;
- char *string;
+PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *string)
{
}
void
-PclImageText16( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x;
- int y;
- int count;
- unsigned short *string;
+PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
{
}
void
-PclImageGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nGlyphs;
- CharInfoPtr *pCharInfo;
- pointer pGlyphBase;
+PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
{
}
void
-PclPolyGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nGlyphs;
- CharInfoPtr *pCharInfo;
- pointer pGlyphBase;
+PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
{
}
@@ -509,7 +502,7 @@ PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
FontInfoPtr pfi;
char *fontname;
unsigned char nindex;
-int i, j;
+int i;
unsigned long n;
CharInfoPtr charinfo[1];
unsigned int space_width;
@@ -680,7 +673,7 @@ FontPropPtr props;
FontInfoPtr pfi;
char *fontname;
Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
-int res, width;
+int res, width = 1;
int mask;
int i;
@@ -723,19 +716,19 @@ int i;
mask = 0;
for (i=0; i<pfi->nprops; i++, props++) {
- if ( props->name == xa_pcl_font_name ) {
+ if ( (Atom) props->name == xa_pcl_font_name ) {
pin->pcl_font_name = NameForAtom(props->value);
mask |= 0x1;
} else if ( props->name == XA_POINT_SIZE ) {
pin->height = (float) props->value / 10.0;
mask |= 0x2;
- } else if ( props->name == xa_res ) {
+ } else if ( (Atom) props->name == xa_res ) {
res = (int) props->value;
mask |= 0x4;
- } else if ( props->name == xa_ave_width ) {
+ } else if ( (Atom) props->name == xa_ave_width ) {
width = (int) props->value / 10;
mask |= 0x8;
- } else if ( props->name == xa_spacing ) {
+ } else if ( (Atom) props->name == xa_spacing ) {
pin->spacing = NameForAtom(props->value);
mask |= 0x10;
}
@@ -746,8 +739,11 @@ int i;
return (PclInternalFontPtr) NULL;
}
- if ( *pin->spacing != 'P' || *pin->spacing != 'p' )
+ if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) {
+ if (width == 0)
+ width = 1;
pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */
+ }
pin->next = (PclInternalFontPtr)NULL;
if ( prev == (PclInternalFontPtr) NULL)
@@ -791,7 +787,7 @@ unsigned int byte_width;
unsigned char *p;
register int nbyGlyphWidth;
unsigned char *pglyph, *pg;
-int i, j;
+unsigned int i, j;
pcd->h_offset = pci->metrics.leftSideBearing;
pcd->v_offset = pci->metrics.ascent;
@@ -868,7 +864,7 @@ Atom dest;
pfi = (FontInfoRec *)&pfont->info;
props = pfi->props;
for (i=0; i<pfi->nprops; i++, props++) {
- if ( props->name == dest && props->value == 2 )
+ if ( (Atom) props->name == dest && props->value == 2 )
return INTERNAL_FONT;
}
return DOWNLOAD_FONT;
diff --git a/Xprint/pcl/PclWindow.c b/Xprint/pcl/PclWindow.c
index 7c830b897..b58bd43a1 100644
--- a/Xprint/pcl/PclWindow.c
+++ b/Xprint/pcl/PclWindow.c
@@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclWindow.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "mistruct.h"
@@ -57,8 +59,7 @@ copyright holders.
#include "Pcl.h"
-extern WindowPtr *WindowTable;
-
+#if 0
/*
* The following list of strings defines the properties which will be
* placed on the screen's root window if the property was defined in
@@ -75,7 +76,7 @@ static /* const */ char *propStrings[] = {
DT_PRINT_PAGE_COMMAND,
(char *)NULL
};
-
+#endif
/*
* PclCreateWindow - watch for the creation of the root window.
@@ -207,7 +208,6 @@ PclPaintWindow(
RegionPtr pRegion,
int what)
{
- int status;
WindowPtr pRoot;
#define FUNCTION 0
@@ -367,13 +367,13 @@ PclPaintWindow(
}
break;
case GCClipMask:
- if ((pointer) pGC->clientClipType != (pointer)CT_NONE) {
+ if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) {
gcmask |= index;
gcval[i++] = (pointer)CT_NONE;
}
break;
case GCSubwindowMode:
- if ((pointer) pGC->subWindowMode != newValues[SUBWINDOW]) {
+ if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) {
gcmask |= index;
gcval[i++] = newValues[SUBWINDOW];
}
@@ -387,7 +387,7 @@ PclPaintWindow(
}
break;
case GCFillStyle:
- if ((pointer) pGC->fillStyle != newValues[FILLSTYLE]) {
+ if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) {
gcmask |= index;
gcval[i++] = newValues[FILLSTYLE];
}
diff --git a/Xprint/pcl/Pclmap.h b/Xprint/pcl/Pclmap.h
index ecec35776..1386b0ab4 100644
--- a/Xprint/pcl/Pclmap.h
+++ b/Xprint/pcl/Pclmap.h
@@ -30,166 +30,180 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pclmap.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCLMAP_H_
#define _PCLMAP_H_
#ifdef XP_PCL_COLOR
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) PclCr##subname
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclCr##subname
#define CATNAME(prefix,subname) prefix##Color##subname
#else
-#define NAME(subname) PclCr/**/subname
+#define PCLNAME(subname) PclCr/**/subname
#define CATNAME(prefix,subname) prefix/**/Color/**/subname
#endif
#endif /* XP_PCL_COLOR */
#ifdef XP_PCL_MONO
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) PclMn##subname
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclMn##subname
#define CATNAME(prefix,subname) prefix##Mono##subname
#else
-#define NAME(subname) PclMn/**/subname
+#define PCLNAME(subname) PclMn/**/subname
#define CATNAME(prefix,subname) prefix/**/Mono/**/subname
#endif
#endif /* XP_PCL_MONO */
#ifdef XP_PCL_LJ3
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) PclLj3##subname
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclLj3##subname
#define CATNAME(prefix,subname) prefix##Lj3##subname
#else
-#define NAME(subname) PclLj3/**/subname
+#define PCLNAME(subname) PclLj3/**/subname
#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
#endif
#endif /* XP_PCL_LJ3 */
+#ifdef PCLNAME
+
/* PclInit.c */
#define InitializePclDriver CATNAME(Initialize, PclDriver)
-#define PclCloseScreen NAME(CloseScreen)
-#define PclGetContextFromWindow NAME(GetContextFromWindow)
-#define PclScreenPrivateIndex NAME(ScreenPrivateIndex)
-#define PclWindowPrivateIndex NAME(WindowPrivateIndex)
-#define PclContextPrivateIndex NAME(ContextPrivateIndex)
-#define PclPixmapPrivateIndex NAME(PixmapPrivateIndex)
-#define PclGCPrivateIndex NAME(GCPrivateIndex)
+#define PclCloseScreen PCLNAME(CloseScreen)
+#define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
+#define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex)
+#define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex)
+#define PclContextPrivateIndex PCLNAME(ContextPrivateIndex)
+#define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex)
+#define PclGCPrivateIndex PCLNAME(GCPrivateIndex)
/* PclPrint.c */
-#define PclStartJob NAME(StartJob)
-#define PclEndJob NAME(EndJob)
-#define PclStartPage NAME(StartPage)
-#define PclEndPage NAME(EndPage)
-#define PclStartDoc NAME(StartDoc)
-#define PclEndDoc NAME(EndDoc)
-#define PclDocumentData NAME(DocumentData)
-#define PclGetDocumentData NAME(GetDocumentData)
+#define PclStartJob PCLNAME(StartJob)
+#define PclEndJob PCLNAME(EndJob)
+#define PclStartPage PCLNAME(StartPage)
+#define PclEndPage PCLNAME(EndPage)
+#define PclStartDoc PCLNAME(StartDoc)
+#define PclEndDoc PCLNAME(EndDoc)
+#define PclDocumentData PCLNAME(DocumentData)
+#define PclGetDocumentData PCLNAME(GetDocumentData)
/* PclWindow.c */
-#define PclCreateWindow NAME(CreateWindow)
-#define PclMapWindow NAME(MapWindow)
-#define PclPositionWindow NAME(PositionWindow)
-#define PclUnmapWindow NAME(UnmapWindow)
-#define PclCopyWindow NAME(CopyWindow)
-#define PclChangeWindowAttributes NAME(ChangeWindowAttributes)
-#define PclPaintWindow NAME(PaintWindow)
-#define PclDestroyWindow NAME(DestroyWindow)
+#define PclCreateWindow PCLNAME(CreateWindow)
+#define PclMapWindow PCLNAME(MapWindow)
+#define PclPositionWindow PCLNAME(PositionWindow)
+#define PclUnmapWindow PCLNAME(UnmapWindow)
+#define PclCopyWindow PCLNAME(CopyWindow)
+#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
+#define PclPaintWindow PCLNAME(PaintWindow)
+#define PclDestroyWindow PCLNAME(DestroyWindow)
/* PclGC.c */
-#define PclCreateGC NAME(CreateGC)
-#define PclDestroyGC NAME(DestroyGC)
-#define PclGetDrawablePrivateStuff NAME(GetDrawablePrivateStuff)
-#define PclSetDrawablePrivateGC NAME(SetDrawablePrivateGC)
-#define PclSendPattern NAME(SendPattern)
-#define PclUpdateDrawableGC NAME(UpdateDrawableGC)
-#define PclComputeCompositeClip NAME(ComputeCompositeClip)
-#define PclValidateGC NAME(ValidateGC)
+#define PclCreateGC PCLNAME(CreateGC)
+#define PclDestroyGC PCLNAME(DestroyGC)
+#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff)
+#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC)
+#define PclSendPattern PCLNAME(SendPattern)
+#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC)
+#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip)
+#define PclValidateGC PCLNAME(ValidateGC)
/* PclAttr.c */
-#define PclGetAttributes NAME(GetAttributes)
-#define PclGetOneAttribute NAME(GetOneAttribute)
-#define PclAugmentAttributes NAME(AugmentAttributes)
-#define PclSetAttributes NAME(SetAttributes)
+#define PclGetAttributes PCLNAME(GetAttributes)
+#define PclGetOneAttribute PCLNAME(GetOneAttribute)
+#define PclAugmentAttributes PCLNAME(AugmentAttributes)
+#define PclSetAttributes PCLNAME(SetAttributes)
/* PclColor.c */
-#define PclLookUp NAME(LookUp)
-#define PclCreateDefColormap NAME(CreateDefColormap)
-#define PclCreateColormap NAME(CreateColormap)
-#define PclDestroyColormap NAME(DestroyColormap)
-#define PclInstallColormap NAME(InstallColormap)
-#define PclUninstallColormap NAME(UninstallColormap)
-#define PclListInstalledColormaps NAME(ListInstalledColormaps)
-#define PclStoreColors NAME(StoreColors)
-#define PclResolveColor NAME(ResolveColor)
-#define PclFindPaletteMap NAME(FindPaletteMap)
-#define PclUpdateColormap NAME(UpdateColormap)
-#define PclReadMap NAME(ReadMap)
+#define PclLookUp PCLNAME(LookUp)
+#define PclCreateDefColormap PCLNAME(CreateDefColormap)
+#define PclCreateColormap PCLNAME(CreateColormap)
+#define PclDestroyColormap PCLNAME(DestroyColormap)
+#define PclInstallColormap PCLNAME(InstallColormap)
+#define PclUninstallColormap PCLNAME(UninstallColormap)
+#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps)
+#define PclStoreColors PCLNAME(StoreColors)
+#define PclResolveColor PCLNAME(ResolveColor)
+#define PclFindPaletteMap PCLNAME(FindPaletteMap)
+#define PclUpdateColormap PCLNAME(UpdateColormap)
+#define PclReadMap PCLNAME(ReadMap)
/* PclPixmap.c */
-#define PclCreatePixmap NAME(CreatePixmap)
-#define PclDestroyPixmap NAME(DestroyPixmap)
+#define PclCreatePixmap PCLNAME(CreatePixmap)
+#define PclDestroyPixmap PCLNAME(DestroyPixmap)
/* PclArc.c */
-#define PclDoArc NAME(DoArc)
-#define PclPolyArc NAME(PolyArc)
-#define PclPolyFillArc NAME(PolyFillArc)
+#define PclDoArc PCLNAME(DoArc)
+#define PclPolyArc PCLNAME(PolyArc)
+#define PclPolyFillArc PCLNAME(PolyFillArc)
/* PclArea.c */
-#define PclPutImage NAME(PutImage)
-#define PclCopyArea NAME(CopyArea)
-#define PclCopyPlane NAME(CopyPlane)
+#define PclPutImage PCLNAME(PutImage)
+#define PclCopyArea PCLNAME(CopyArea)
+#define PclCopyPlane PCLNAME(CopyPlane)
/* PclLine */
-#define PclPolyLine NAME(PolyLine)
-#define PclPolySegment NAME(PolySegment)
+#define PclPolyLine PCLNAME(PolyLine)
+#define PclPolySegment PCLNAME(PolySegment)
/* PclPixel.c */
-#define PclPolyPoint NAME(PolyPoint)
-#define PclPushPixels NAME(PushPixels)
+#define PclPolyPoint PCLNAME(PolyPoint)
+#define PclPushPixels PCLNAME(PushPixels)
/* PclPolygon.c */
-#define PclPolyRectangle NAME(PolyRectangle)
-#define PclFillPolygon NAME(FillPolygon)
-#define PclPolyFillRect NAME(PolyFillRect)
+#define PclPolyRectangle PCLNAME(PolyRectangle)
+#define PclFillPolygon PCLNAME(FillPolygon)
+#define PclPolyFillRect PCLNAME(PolyFillRect)
/* PclSpans.c */
-#define PclFillSpans NAME(FillSpans)
-#define PclSetSpans NAME(SetSpans)
+#define PclFillSpans PCLNAME(FillSpans)
+#define PclSetSpans PCLNAME(SetSpans)
/* PclText.c */
-#define PclPolyText8 NAME(PolyText8)
-#define PclPolyText16 NAME(PolyText16)
-#define PclImageText8 NAME(ImageText8)
-#define PclImageText16 NAME(ImageText16)
-#define PclImageGlyphBlt NAME(ImageGlyphBlt)
-#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
-#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
+#define PclPolyText8 PCLNAME(PolyText8)
+#define PclPolyText16 PCLNAME(PolyText16)
+#define PclImageText8 PCLNAME(ImageText8)
+#define PclImageText16 PCLNAME(ImageText16)
+#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
/* PclFonts.c */
-#define PclRealizeFont NAME(RealizeFont)
-#define PclUnrealizeFont NAME(UnrealizeFont)
+#define PclRealizeFont PCLNAME(RealizeFont)
+#define PclUnrealizeFont PCLNAME(UnrealizeFont)
/* PclSFonts.c */
-#define PclDownloadSoftFont8 NAME(DownloadSoftFont8)
-#define PclDownloadSoftFont16 NAME(DownloadSoftFont16)
-#define PclCreateSoftFontInfo NAME(CreateSoftFontInfo)
-#define PclDestroySoftFontInfo NAME(DestroySoftFontInfo)
+#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8)
+#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16)
+#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo)
+#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo)
/* PclMisc.c */
-#define PclQueryBestSize NAME(QueryBestSize)
-#define GetPropString NAME(GetPropString)
-#define SystemCmd NAME(SystemCmd)
-#define PclGetMediumDimensions NAME(GetMediumDimensions)
-#define PclGetReproducibleArea NAME(GetReproducibleArea)
-#define PclSpoolFigs NAME(SpoolFigs)
-#define PclSendData NAME(SendData)
+#define PclQueryBestSize PCLNAME(QueryBestSize)
+#define GetPropString PCLNAME(GetPropString)
+#define SystemCmd PCLNAME(SystemCmd)
+#define PclGetMediumDimensions PCLNAME(GetMediumDimensions)
+#define PclGetReproducibleArea PCLNAME(GetReproducibleArea)
+#define PclSpoolFigs PCLNAME(SpoolFigs)
+#define PclSendData PCLNAME(SendData)
/* PclCursor.c */
-#define PclConstrainCursor NAME(ConstrainCursor)
-#define PclCursorLimits NAME(CursorLimits)
-#define PclDisplayCursor NAME(DisplayCursor)
-#define PclRealizeCursor NAME(RealizeCursor)
-#define PclUnrealizeCursor NAME(UnrealizeCursor)
-#define PclRecolorCursor NAME(RecolorCursor)
-#define PclSetCursorPosition NAME(SetCursorPosition)
+#define PclConstrainCursor PCLNAME(ConstrainCursor)
+#define PclCursorLimits PCLNAME(CursorLimits)
+#define PclDisplayCursor PCLNAME(DisplayCursor)
+#define PclRealizeCursor PCLNAME(RealizeCursor)
+#define PclUnrealizeCursor PCLNAME(UnrealizeCursor)
+#define PclRecolorCursor PCLNAME(RecolorCursor)
+#define PclSetCursorPosition PCLNAME(SetCursorPosition)
+
+#endif
#endif /* _PCLMAP_H_ */
diff --git a/Xprint/ps/Ps.h b/Xprint/ps/Ps.h
index 942e8f9f8..9c65dc26f 100644
--- a/Xprint/ps/Ps.h
+++ b/Xprint/ps/Ps.h
@@ -7,7 +7,6 @@ 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.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@@ -74,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/Ps.h,v 1.13 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PS_H_
#define _PS_H_
@@ -87,24 +87,11 @@ in this Software without prior written authorization from The Open Group.
#include "scrnintstr.h"
#include "dix.h"
-/*
-#include "X.h"
-#include "Xproto.h"
-#include "Xatom.h"
-#include "misc.h"
-#include "screenint.h"
-#include "colormapst.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#include "servermd.h"*/ /* needed for IMAGE_BUFSIZE */
-
#include "PsDef.h"
#include "psout.h"
-#define _XP_PRINT_SERVER_
-#include "Print.h"
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
#include "miscstruct.h"
#include "fontstruct.h"
@@ -114,13 +101,17 @@ in this Software without prior written authorization from The Open Group.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
#define Status int
#define True 1
#define False 0
+#endif
+
#include "misc.h"
-#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
/*
* Public index variables from PsInit.c
@@ -130,7 +121,7 @@ extern int PsScreenPrivateIndex;
extern int PsWindowPrivateIndex;
extern int PsContextPrivateIndex;
extern int PsPixmapPrivateIndex;
-extern int PsGCPrivateIndex;
+extern XpValidatePoolsRec PsValidatePoolsRec;
/*
* Display list structures
@@ -255,7 +246,7 @@ typedef struct
{
XrmDatabase resDB;
ColormapPtr CMap;
- Bool (*DestroyWindow)();
+ Bool (*DestroyWindow)(WindowPtr);
} PsScreenPrivRec, *PsScreenPrivPtr;
typedef struct
@@ -278,12 +269,6 @@ typedef struct
typedef struct
{
- unsigned freeCompClip;
- RegionPtr pCompositeClip;
-} PsGCPrivRec, *PsGCPrivPtr;
-
-typedef struct
-{
XpContextPtr context;
GC lastGC;
int validGC;
@@ -296,7 +281,9 @@ typedef struct
#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
/*
* Functions in PsInit.c
@@ -304,7 +291,6 @@ typedef struct
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
char **argv);
-static Bool PsDestroyContext(XpContextPtr pCon);
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
/*
@@ -328,9 +314,6 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
*/
extern Bool PsCreateGC(GCPtr pGC);
-static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
- unsigned long *valid, PsOutPtr *psOut,
- ColormapPtr *cMap);
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
PsOutPtr *psOut, ColormapPtr *cMap);
extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
@@ -383,6 +366,9 @@ extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *pImage);
+extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *pImage);
extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int width, int height,
int dstx, int dsty);
@@ -517,4 +503,14 @@ extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
+/*
+ * Functions in PsCache.c
+ */
+
+#ifdef BM_CACHE
+extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer);
+extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer);
+extern void PsBmClearImageCache(void);
+#endif
+
#endif /* _PS_H_ */
diff --git a/Xprint/ps/PsArea.c b/Xprint/ps/PsArea.c
index 134686a87..eed650ada 100644
--- a/Xprint/ps/PsArea.c
+++ b/Xprint/ps/PsArea.c
@@ -228,7 +228,7 @@ error:
return;
}
-void
+static void
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, int imageRes, char *pImage)
{
@@ -269,9 +269,9 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
ColormapPtr cMap;
int pageRes, sw, sh;
#ifdef BM_CACHE
- long cache_id = 0;
+ long cache_id = 0;
#endif
-
+
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
if (!imageRes) {
sw = w;
@@ -296,100 +296,100 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_BeginImageCache(psOut, cache_id);
#endif
- if( depth==24 )
+ if( depth==24 )
+ {
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ if( format==XYPixmap )
{
- PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
- if( format==XYPixmap )
- {
- int rowsiz = PixmapBytePad(w, depth);
- char *planes[3];
- planes[0] = pImage;
- planes[1] = &pImage[rowsiz*h];
- planes[2] = &pImage[rowsiz*h*2];
- for( r=0 ; r<h ; r++ )
- {
- char *pt[3];
- for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
- for( c=0 ; c<w ; c++ )
- {
- for( i=0 ; i<3 ; i++ )
- { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
- }
- }
- }
- else if( format==ZPixmap )
+ int rowsiz = PixmapBytePad(w, depth);
+ char *planes[3];
+ planes[0] = pImage;
+ planes[1] = &pImage[rowsiz*h];
+ planes[2] = &pImage[rowsiz*h*2];
+ for( r=0 ; r<h ; r++ )
{
- int rowsiz = PixmapBytePad(w, depth);
- for( r=0 ; r<h ; r++ )
+ char *pt[3];
+ for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
+ for( c=0 ; c<w ; c++ )
{
- char *pt = &pImage[rowsiz*r];
- for( c=0 ; c<w ; c++,pt+=4 )
- {
- if( swap )
- {
- char tmp[4];
- tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
- PsOut_OutImageBytes(psOut, 3, &tmp[1]);
- }
- else
- PsOut_OutImageBytes(psOut, 3, &pt[1]);
- }
+ for( i=0 ; i<3 ; i++ )
+ { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
}
}
- else goto error;
- PsOut_EndImage(psOut);
}
- else if( depth==8 )
+ else if( format==ZPixmap )
{
int rowsiz = PixmapBytePad(w, depth);
- PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
- for( c=0 ; c<w ; c++,pt++ )
+ for( c=0 ; c<w ; c++,pt+=4 )
{
- int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
- char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
- tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
- PsOut_OutImageBytes(psOut, 3, &ipt[1]);
+ PsOut_OutImageBytes(psOut, 3, &pt[1]);
}
}
- PsOut_EndImage(psOut);
}
- else if( depth==1 )
+ else goto error;
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==8 )
+ {
+ int rowsiz = PixmapBytePad(w, depth);
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ for( r=0 ; r<h ; r++ )
{
+ char *pt = &pImage[rowsiz*r];
+ for( c=0 ; c<w ; c++,pt++ )
{
- int rowsiz = BitmapBytePad(w);
- int psrsiz = (w+7)/8;
- PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
- PsGetPixelColor(cMap, pGC->fgPixel),
- x, y, w, h, sw, sh, 1);
- for( r=0 ; r<h ; r++ )
+ int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
+ char *ipt = (char *)&val;
+ if( swap )
{
- char *pt = &pImage[rowsiz*r];
- for( i=0 ; i<psrsiz ; i++ )
- {
- int iv_, iv = (int)pt[i]&0xFF;
- char c;
- if( swap )
- { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
- else
- iv_ = iv;
- c = iv_;
- PsOut_OutImageBytes(psOut, 1, &c);
- }
+ char tmp[4];
+ tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
- PsOut_EndImage(psOut);
+ else
+ PsOut_OutImageBytes(psOut, 3, &ipt[1]);
}
}
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==1 )
+ {
+ {
+ int rowsiz = BitmapBytePad(w);
+ int psrsiz = (w+7)/8;
+ PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel),
+ x, y, w, h, sw, sh, 1);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( i=0 ; i<psrsiz ; i++ )
+ {
+ int iv_, iv = (int)pt[i]&0xFF;
+ char c;
+ if( swap )
+ { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
+ else
+ iv_ = iv;
+ c = iv_;
+ PsOut_OutImageBytes(psOut, 1, &c);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+ }
#ifdef BM_CACHE
- PsOut_EndImageCache(psOut);
+ PsOut_EndImageCache(psOut);
}
PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel),
PsGetPixelColor(cMap, pGC->fgPixel));
diff --git a/Xprint/ps/PsAttVal.c b/Xprint/ps/PsAttVal.c
index 83133e53a..a6a375487 100644
--- a/Xprint/ps/PsAttVal.c
+++ b/Xprint/ps/PsAttVal.c
@@ -32,6 +32,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttVal.c,v 1.5 2001/12/19 21:28:44 dawes Exp $ */
#include "Ps.h"
#include "AttrValid.h"
@@ -142,6 +143,13 @@ static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
};
+/*
+** So filtered printers that accept other raw formats can be
+** used with this driver.
+**
+** Noah Roberts (jik-)
+*/
+#if 0
static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@@ -149,6 +157,7 @@ static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
static XpOidDocFmtList ValidRawFormatsSupported = {
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
};
+#endif
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@@ -196,7 +205,7 @@ XpValidatePoolsRec PsValidatePoolsRec = {
&ValidPrinterResolutions, &DefaultPrinterResolutions,
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
&ValidListfontsModes, &DefaultListfontsModes,
- &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
&ValidSetupProviso,
&DefaultDocumentFormat
};
diff --git a/Xprint/ps/PsAttr.c b/Xprint/ps/PsAttr.c
index 8a5bee9e3..13c4e1978 100644
--- a/Xprint/ps/PsAttr.c
+++ b/Xprint/ps/PsAttr.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttr.c,v 1.5 2001/12/14 19:59:15 dawes Exp $ */
/*******************************************************************
**
@@ -75,7 +76,6 @@ in this Software without prior written authorization from The Open Group.
********************************************************************/
#include "Ps.h"
-#include "attributes.h"
char *
PsGetAttributes(
diff --git a/Xprint/ps/PsCache.c b/Xprint/ps/PsCache.c
index 8c9f4a926..b688fbba1 100644
--- a/Xprint/ps/PsCache.c
+++ b/Xprint/ps/PsCache.c
@@ -79,21 +79,21 @@ in this Software without prior written authorization from The Open Group.
#include "fntfil.h"
#include "fntfilst.h"
-#define GET 0
-#define RESET 1
+#define GET 0
+#define RESET 1
struct bm_cache_list {
- struct bm_cache_list *next;
- struct bm_cache_list *prev;
+ struct bm_cache_list *next;
+ struct bm_cache_list *prev;
int height;
- long id;
+ long id;
char *pBuffer;
};
struct bm_cache_head {
- struct bm_cache_list *head;
- int width;
- struct bm_cache_head *next;
+ struct bm_cache_list *head;
+ int width;
+ struct bm_cache_head *next;
struct bm_cache_head *prev;
};
@@ -106,14 +106,14 @@ PsBmUniqueId(int func)
if(func == RESET)
{
- unique_id = 0;
- return 0;
+ unique_id = 0;
+ return 0;
}
else
- return ++unique_id;
+ return ++unique_id;
}
-int
+int
PsBmIsImageCached(
int gWidth,
int gHeight,
@@ -126,28 +126,28 @@ PsBmIsImageCached(
{
if(pList->width == gWidth)
{
- struct bm_cache_list *pItem = pList->head;
-
- while(pItem != NULL)
- {
- if(pItem->height == gHeight)
- {
- int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
-
- if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
- {
- return_val = pItem->id;
- break;
- }
- }
- else if(pItem->height > gHeight)
- break;
-
- pItem = pItem->next;
- }
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height == gHeight)
+ {
+ int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
+
+ if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
+ {
+ return_val = pItem->id;
+ break;
+ }
+ }
+ else if(pItem->height > gHeight)
+ break;
+
+ pItem = pItem->next;
+ }
}
- else if(pList->width > gWidth)
- break;
+ else if(pList->width > gWidth)
+ break;
pList = pList->next;
}
@@ -180,39 +180,39 @@ PsBmPutImageInCache(
while(pList != NULL)
{
if(pList->width == gWidth)
- {
- struct bm_cache_list *pItem = pList->head;
-
- while(pItem != NULL)
- {
- if(pItem->height >= gHeight)
- {
- pNew->next = pItem;
- pNew->prev = pItem->prev;
- if(pItem->prev != NULL)
- pItem->prev->next = pNew;
+ {
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height >= gHeight)
+ {
+ pNew->next = pItem;
+ pNew->prev = pItem->prev;
+ if(pItem->prev != NULL)
+ pItem->prev->next = pNew;
else
- pList->head = pNew;
+ pList->head = pNew;
pItem->prev = pNew;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
- else if(pItem->next == NULL)
- {
- pNew->prev = pItem;
- pItem->next = pNew;
+ break;
+ }
+ else if(pItem->next == NULL)
+ {
+ pNew->prev = pItem;
+ pItem->next = pNew;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
+ break;
+ }
- pItem = pItem->next;
- }
+ pItem = pItem->next;
+ }
- break;
+ break;
}
pList = pList->next;
@@ -223,50 +223,50 @@ PsBmPutImageInCache(
struct bm_cache_head *pNewList;
pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head));
-
+
pNewList->next = NULL;
pNewList->prev = NULL;
pNewList->width = gWidth;
pNewList->head = pNew;
-
+
if(bm_cache == NULL)
{
- bm_cache = pNewList;
- return_val = pNew->id;
+ bm_cache = pNewList;
+ return_val = pNew->id;
}
else
{
- pList = bm_cache;
+ pList = bm_cache;
- while(pList != NULL)
- {
- if(pList->width > gWidth)
- {
- pNewList->next = pList;
- pNewList->prev = pList->prev;
+ while(pList != NULL)
+ {
+ if(pList->width > gWidth)
+ {
+ pNewList->next = pList;
+ pNewList->prev = pList->prev;
- if(pList->prev != NULL)
- pList->prev->next = pNewList;
+ if(pList->prev != NULL)
+ pList->prev->next = pNewList;
else
- bm_cache = pNewList;
- pList->prev = pNewList;
+ bm_cache = pNewList;
+ pList->prev = pNewList;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
- else if(pList->next == NULL)
+ break;
+ }
+ else if(pList->next == NULL)
{
- pNewList->prev = pList;
- pList->next = pNewList;
+ pNewList->prev = pList;
+ pList->next = pNewList;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
+ break;
+ }
- pList = pList->next;
- }
+ pList = pList->next;
+ }
}
}
@@ -280,35 +280,35 @@ PsBmClearImageCacheItem(
{
if(pItem != NULL)
{
- if(pItem->pBuffer != NULL)
- free(pItem->pBuffer);
+ if(pItem->pBuffer != NULL)
+ free(pItem->pBuffer);
pItem->pBuffer = NULL;
- if(pItem->next)
- PsBmClearImageCacheItem(pItem->next);
+ if(pItem->next)
+ PsBmClearImageCacheItem(pItem->next);
pItem->next = NULL;
- free(pItem);
- pItem = NULL;
+ free(pItem);
+ pItem = NULL;
}
}
-static void
+static void
PsBmClearImageCacheList(
struct bm_cache_head *pList)
{
if(pList != NULL)
{
- if(pList->head)
- PsBmClearImageCacheItem(pList->head);
+ if(pList->head)
+ PsBmClearImageCacheItem(pList->head);
pList->head = NULL;
- if(pList->next)
- PsBmClearImageCacheList(pList->next);
+ if(pList->next)
+ PsBmClearImageCacheList(pList->next);
pList->next = NULL;
- free(pList);
- pList = NULL;
+ free(pList);
+ pList = NULL;
}
}
diff --git a/Xprint/ps/PsColor.c b/Xprint/ps/PsColor.c
index 9c76904d6..92082226f 100644
--- a/Xprint/ps/PsColor.c
+++ b/Xprint/ps/PsColor.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsColor.c,v 1.3 2001/12/14 19:59:15 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -85,7 +86,6 @@ PsCreateColormap(ColormapPtr pColor)
int i;
unsigned short rgb;
VisualPtr pVisual = pColor->pVisual;
- Pixel pix;
if( pVisual->class==TrueColor )
{
diff --git a/Xprint/ps/PsFonts.c b/Xprint/ps/PsFonts.c
index 1a4692692..15abc4b88 100644
--- a/Xprint/ps/PsFonts.c
+++ b/Xprint/ps/PsFonts.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsFonts.c,v 1.6 2001/12/19 21:55:59 dawes Exp $ */
/*******************************************************************
**
@@ -109,7 +110,7 @@ PsGetFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==name )
+ if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@@ -149,7 +150,7 @@ PsGetPSFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==name )
+ if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@@ -170,8 +171,8 @@ PsIsISOLatin1Encoding(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==reg ) rv = props[i].value;
- if( props[i].name==enc ) ev = props[i].value;
+ if( (Atom)props[i].name == reg ) rv = props[i].value;
+ if( (Atom)props[i].name == enc ) ev = props[i].value;
}
if( rv ) rp = NameForAtom(rv);
if( ev ) ep = NameForAtom(ev);
diff --git a/Xprint/ps/PsGC.c b/Xprint/ps/PsGC.c
index c6e352279..c1e12f57c 100644
--- a/Xprint/ps/PsGC.c
+++ b/Xprint/ps/PsGC.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsGC.c,v 1.6 2001/12/14 19:59:15 dawes Exp $ */
/*******************************************************************
**
@@ -144,7 +145,6 @@ PsGetDrawablePrivateStuff(
ColormapPtr *cMap)
{
XpContextPtr pCon;
- PsPixmapPrivPtr pPriv;
PsContextPrivPtr cPriv;
PsScreenPrivPtr sPriv;
@@ -229,7 +229,7 @@ PsUpdateDrawableGC(
}
}
- if( freeClip ) (*pGC->pScreen->RegionDestroy)(pReg);
+ if( freeClip ) REGION_DESTROY(pGC->pScreen, pReg);
PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
}
@@ -293,7 +293,7 @@ PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
clp->rects[i].w = (boxes[i].x2-boxes[i].x1)+1;
clp->rects[i].h = (boxes[i].y2-boxes[i].y1)+1;
}
- (*pGC->pScreen->RegionDestroy)((RegionPtr)pValue);
+ REGION_DESTROY(pGC->pScreen, (RegionPtr)pValue);
break;
case CT_UNSORTED:
case CT_YSORTED:
diff --git a/Xprint/ps/PsInit.c b/Xprint/ps/PsInit.c
index 72c83448e..fe2471185 100644
--- a/Xprint/ps/PsInit.c
+++ b/Xprint/ps/PsInit.c
@@ -71,33 +71,35 @@ in this Software without prior written authorization from The Open Group.
** * Copyright: Copyright 1996 The Open Group, Inc.
** *
** *********************************************************
-**
+**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsInit.c,v 1.13 2002/10/16 21:13:33 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "Ps.h"
+#include "mi.h"
#include "AttrValid.h"
#include "../../mfb/mfb.h"
#include "windowstr.h"
+#include "DiPrint.h"
static void AllocatePsPrivates(ScreenPtr pScreen);
static int PsInitContext(XpContextPtr pCon);
+static int PsDestroyContext(XpContextPtr pCon);
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
extern Bool cfbCreateDefColormap(ScreenPtr pScreen);
int PsScreenPrivateIndex;
int PsContextPrivateIndex;
int PsPixmapPrivateIndex;
int PsWindowPrivateIndex;
-int PsGCPrivateIndex;
Bool
InitializePsDriver(ndx, pScreen, argc, argv)
@@ -106,11 +108,7 @@ InitializePsDriver(ndx, pScreen, argc, argv)
int argc;
char **argv;
{
- int maxXres, maxYres, maxWidth, maxHeight;
- int maxRes, maxDim, numBytes;
PsScreenPrivPtr pPriv;
- char **printerNames;
- int numPrinters;
int nVisuals;
int nDepths;
VisualPtr visuals;
@@ -134,9 +132,9 @@ InitializePsDriver(ndx, pScreen, argc, argv)
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize;
- pScreen->SaveScreen = _XpBoolNoop;
- pScreen->GetImage = _XpVoidNoop;
- pScreen->GetSpans = _XpVoidNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PsCreateWindow;
pScreen->DestroyWindow = PsDestroyWindow;
pScreen->PositionWindow = PsPositionWindow;
@@ -207,18 +205,18 @@ InitializePsDriver(ndx, pScreen, argc, argv)
/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 24 BIT */
/* miScreenInit(pScreen, (pointer)0,
pScreen->width, pScreen->height,
- pScreen->width / (pScreen->mmWidth / 25.40),
+ pScreen->width / (pScreen->mmWidth / 25.40),
pScreen->height / (pScreen->mmHeight / 25.40),
0, 24, nDepths,
- depths, visuals[1].vid, nVisuals, visuals, (miBSFuncPtr)0); */
+ depths, visuals[1].vid, nVisuals, visuals); */
/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 8 BIT */
miScreenInit(pScreen, (pointer)0,
pScreen->width, pScreen->height,
- (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
+ (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
(int) (pScreen->height / (pScreen->mmHeight / 25.40)),
0, 8, nDepths,
- depths, visuals[1].vid, nVisuals, visuals, (miBSFuncPtr)0);
+ depths, visuals[1].vid, nVisuals, visuals);
if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE;
@@ -230,9 +228,9 @@ InitializePsDriver(ndx, pScreen, argc, argv)
static void
AllocatePsPrivates(ScreenPtr pScreen)
{
- static int PsGeneration = -1;
+ static unsigned long PsGeneration = 0;
- if(PsGeneration != serverGeneration)
+ if((unsigned long)PsGeneration != serverGeneration)
{
PsScreenPrivateIndex = AllocateScreenPrivateIndex();
@@ -241,13 +239,9 @@ AllocatePsPrivates(ScreenPtr pScreen)
sizeof(PsWindowPrivRec));
PsContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate(PsContextPrivateIndex,
+ XpAllocateContextPrivate(PsContextPrivateIndex,
sizeof(PsContextPrivRec));
- PsGCPrivateIndex = AllocateGCPrivateIndex();
- AllocateGCPrivate(pScreen, PsGCPrivateIndex,
- sizeof(PsGCPrivRec));
-
PsPixmapPrivateIndex = AllocatePixmapPrivateIndex();
AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex,
sizeof(PsPixmapPrivRec));
@@ -280,8 +274,7 @@ PsInitContext(pCon)
XpDriverFuncsPtr pFuncs;
PsContextPrivPtr pConPriv;
char *server, *attrStr;
- extern XpValidatePoolsRec PsValidatePoolsRec;
-
+
/*
* Initialize the attribute store for this printer.
*/
@@ -299,15 +292,15 @@ PsInitContext(pCon)
pFuncs->EndPage = PsEndPage;
pFuncs->PutDocumentData = PsDocumentData;
pFuncs->GetDocumentData = PsGetDocumentData;
- pFuncs->GetAttributes = (char *(*)())PsGetAttributes;
- pFuncs->SetAttributes = (int (*)())PsSetAttributes;
- pFuncs->AugmentAttributes = (int (*)())PsAugmentAttributes;
- pFuncs->GetOneAttribute = (char *(*)())PsGetOneAttribute;
+ pFuncs->GetAttributes = PsGetAttributes;
+ pFuncs->SetAttributes = PsSetAttributes;
+ pFuncs->AugmentAttributes = PsAugmentAttributes;
+ pFuncs->GetOneAttribute = PsGetOneAttribute;
pFuncs->DestroyContext = PsDestroyContext;
pFuncs->GetMediumDimensions = PsGetMediumDimensions;
pFuncs->GetReproducibleArea = PsGetReproducibleArea;
pFuncs->SetImageResolution = PsSetImageResolution;
-
+
/*
* Set up the context privates
*/
@@ -326,15 +319,15 @@ PsInitContext(pCon)
server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
if ((attrStr = (char *) xalloc(strlen(server) +
strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
- + strlen(PAGE_ATT_VAL) + 6)) == NULL)
+ + strlen(PAGE_ATT_VAL) + 6)) == NULL)
{
return BadAlloc;
}
- sprintf(attrStr, "*%s:\t%s %s %s",
+ sprintf(attrStr, "*%s:\t%s %s %s",
DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL);
XpAugmentAttributes( pCon, XPPrinterAttr, attrStr);
xfree(attrStr);
-
+
/*
* job-attributes-supported
*/
@@ -347,7 +340,7 @@ PsInitContext(pCon)
sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL);
XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
xfree(attrStr);
-
+
/*
* xp-page-attributes-supported
*/
@@ -378,7 +371,7 @@ PsDestroyContext(pCon)
{
PsContextPrivPtr pConPriv =
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
-
+
if( pConPriv->pJobFile!=(FILE *)NULL )
{
fclose(pConPriv->pJobFile);
diff --git a/Xprint/ps/PsLine.c b/Xprint/ps/PsLine.c
index 23e105804..ff4c6da80 100644
--- a/Xprint/ps/PsLine.c
+++ b/Xprint/ps/PsLine.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsLine.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
diff --git a/Xprint/ps/PsMisc.c b/Xprint/ps/PsMisc.c
index 86d862ce1..75f692d56 100644
--- a/Xprint/ps/PsMisc.c
+++ b/Xprint/ps/PsMisc.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsMisc.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
#include <stdio.h>
diff --git a/Xprint/ps/PsPixel.c b/Xprint/ps/PsPixel.c
index c2c360d2e..09a89fa2d 100644
--- a/Xprint/ps/PsPixel.c
+++ b/Xprint/ps/PsPixel.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixel.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include <stdio.h>
diff --git a/Xprint/ps/PsPixmap.c b/Xprint/ps/PsPixmap.c
index 2c3e43245..2e821aa1c 100644
--- a/Xprint/ps/PsPixmap.c
+++ b/Xprint/ps/PsPixmap.c
@@ -57,7 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
-
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixmap.c,v 1.5 2001/12/14 19:59:16 dawes Exp $ */
/*******************************************************************
**
** *********************************************************
@@ -79,10 +79,6 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
-#define BitsPerPixel(d) (\
- (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
- (PixmapWidthPaddingInfo[d].padRoundUp+1))
-
PixmapPtr
PsCreatePixmap(
ScreenPtr pScreen,
@@ -203,7 +199,7 @@ PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
return(disp);
}
-void
+static void
PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
{
switch(elm->type)
@@ -492,6 +488,8 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
case PolyFillArcCmd:
*nElms += elm->c.arcs.nArcs;
break;
+ default:
+ break;
}
}
}
@@ -554,6 +552,8 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
*nElms += 1;
}
break;
+ default:
+ break;
}
}
}
diff --git a/Xprint/ps/PsPolygon.c b/Xprint/ps/PsPolygon.c
index e1f0b9003..0cd826f43 100644
--- a/Xprint/ps/PsPolygon.c
+++ b/Xprint/ps/PsPolygon.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPolygon.c,v 1.7 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -175,7 +176,7 @@ PsFillPolygon(
}
else
{
- pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y;
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
for( i=1 ; i<nPoints ; i++ )
{
pts[i].x = pts[i-1].x+pPoints[i].x;
diff --git a/Xprint/ps/PsPrint.c b/Xprint/ps/PsPrint.c
index 49ed97583..8a06205e5 100644
--- a/Xprint/ps/PsPrint.c
+++ b/Xprint/ps/PsPrint.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPrint.c,v 1.11 2001/12/21 21:02:06 dawes Exp $ */
#include <stdio.h>
#include <string.h>
@@ -90,7 +91,6 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
#include "windowstr.h"
-#include "attributes.h"
#include "Oid.h"
/* static utility function to get document/page attributes */
@@ -268,7 +268,7 @@ PsEndJob(
#ifdef BM_CACHE
PsBmClearImageCache();
#endif
-
+
return r;
}
@@ -281,13 +281,10 @@ PsStartPage(
{
int iorient, iplex, icount, ires;
unsigned short iwd, iht;
- register WindowPtr pChild;
PsContextPrivPtr pConPriv =
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
PsWindowPrivPtr pWinPriv =
(PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
- char s[80];
- xEvent event;
/*
* Put a pointer to the context in the window private structure
diff --git a/Xprint/ps/PsSpans.c b/Xprint/ps/PsSpans.c
index 4d8fb3459..32ca58d20 100644
--- a/Xprint/ps/PsSpans.c
+++ b/Xprint/ps/PsSpans.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsSpans.c,v 1.9 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -87,11 +88,10 @@ PsFillSpans(
int *pWidths,
int fSorted)
{
- char t[80];
PsOutPtr psOut;
int xoffset, yoffset;
xRectangle *rects, *r;
- RegionPtr fillRegion, region;
+ RegionPtr fillRegion, region = 0;
int i;
int nbox;
BoxPtr pbox;
@@ -113,14 +113,14 @@ PsFillSpans(
r->width = pWidths[i];
r->height = 1;
}
- fillRegion = miRectsToRegion(nSpans, rects,
+ fillRegion = RECTS_TO_REGION(pGC->pScreen, nSpans, rects,
(fSorted)?CT_YSORTED:CT_UNSORTED);
/*
* Intersect this region with the clip region. Whatever's left,
* should be filled.
*/
-/*miIntersect(region, fillRegion, pGC->clientClip);*/
+/*REGION_INTERSECT(pGC->pScreen, region, fillRegion, pGC->clientClip);*/
pbox = REGION_RECTS(region);
nbox = REGION_NUM_RECTS(region);
@@ -144,8 +144,8 @@ PsFillSpans(
/*
* Clean up the temporary regions
*/
- miRegionDestroy(fillRegion);
- miRegionDestroy(region);
+ REGION_DESTROY(pGC->pScreen, fillRegion);
+ REGION_DESTROY(pGC->pScreen, region);
xfree(rects);
}
diff --git a/Xprint/ps/PsText.c b/Xprint/ps/PsText.c
index 618d0a163..41ba592f6 100644
--- a/Xprint/ps/PsText.c
+++ b/Xprint/ps/PsText.c
@@ -73,11 +73,11 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsText.c,v 1.12 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
#include "windowstr.h"
-#include "fntfil.h"
#include "fntfilst.h"
#include <sys/stat.h>
@@ -85,9 +85,8 @@ static int readFontName(char *fileName, char *file_name, char *dlfnam)
{
FILE *file;
struct stat statb;
- int count, i, status;
char buf[256];
- char *front, *end, *fn;
+ char *front, *fn;
file = fopen(fileName, "r");
if(file)
@@ -389,7 +388,7 @@ PsPolyGlyphBlt(
pointer pGlyphBase)
{
int width, height;
- PixmapPtr pPixmap;
+ PixmapPtr pPixmap = NullPixmap;
int nbyLine; /* bytes per line of padded pixmap */
FontPtr pfont;
GCPtr pGCtmp;
diff --git a/Xprint/ps/PsWindow.c b/Xprint/ps/PsWindow.c
index 3a9a7ed2a..87d8143aa 100644
--- a/Xprint/ps/PsWindow.c
+++ b/Xprint/ps/PsWindow.c
@@ -73,9 +73,11 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsWindow.c,v 1.12 2001/12/19 21:55:59 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "mistruct.h"
@@ -85,8 +87,7 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
-extern WindowPtr *WindowTable;
-
+#if 0
/*
* The following list of strings defines the properties which will be
* placed on the screen's root window if the property was defined in
@@ -103,7 +104,7 @@ static char *propStrings[] = {
DT_PRINT_PAGE_COMMAND,
(char *)NULL
};
-
+#endif
/*
* PsCreateWindow - watch for the creation of the root window.
@@ -218,7 +219,6 @@ PsPaintWindow(
RegionPtr pRegion,
int what)
{
- int status;
WindowPtr pRoot;
#define FUNCTION 0
@@ -377,14 +377,14 @@ PsPaintWindow(
}
break;
case GCClipMask:
- if( (pointer)pGC->clientClipType!=(pointer)CT_NONE )
+ if( (pointer)(long)pGC->clientClipType!=(pointer)CT_NONE )
{
gcmask |= index;
gcval[i++] = (pointer)CT_NONE;
}
break;
case GCSubwindowMode:
- if( (pointer)pGC->subWindowMode!=newValues[SUBWINDOW] )
+ if( (pointer)(long)pGC->subWindowMode!=newValues[SUBWINDOW] )
{
gcmask |= index;
gcval[i++] = newValues[SUBWINDOW];
@@ -398,7 +398,7 @@ PsPaintWindow(
}
break;
case GCFillStyle:
- if( (pointer)pGC->fillStyle!=newValues[FILLSTYLE] )
+ if( (pointer)(long)pGC->fillStyle!=newValues[FILLSTYLE] )
{
gcmask |= index;
gcval[i++] = newValues[FILLSTYLE];
diff --git a/Xprint/ps/psout.c b/Xprint/ps/psout.c
index d4a64eacb..f1507d849 100644
--- a/Xprint/ps/psout.c
+++ b/Xprint/ps/psout.c
@@ -73,13 +73,24 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.c,v 1.12 2001/12/21 21:02:06 dawes Exp $ */
+
+/*
+ * For XFree86 3.3.3:
+ *
+ * As a *quick* way of preventing some buffers overflowing onto the stack,
+ * they have been made static. There are potential problems with
+ * PsOutRec.Buf overflowing too which should be investigated as part of a
+ * review of this code, but that is at least always allocated with malloc
+ * and shouldn't pose an immediate stack trashing problem.
+ *
+ */
#include <stdlib.h>
#include "os.h"
+#include "Ps.h"
#include "psout.h"
-PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
-
typedef void *voidPtr;
typedef struct PsPatRec_
@@ -398,7 +409,7 @@ static void
S_OutNum(PsOutPtr self, float num)
{
int i;
- char buf[64];
+ static char buf[64];
sprintf(buf, "%.3f", num);
for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0';
@@ -411,7 +422,7 @@ static void
S_OutStr(PsOutPtr self, char *txt, int txtl)
{
int i, k;
- char buf[512];
+ static char buf[512];
for( i=0,k=0 ; i<txtl ; i++ )
{
if( (txt[i]>=' ' && txt[i]<='~') &&
@@ -948,7 +959,7 @@ void
PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
{
int i;
- char buf[256];
+ static char buf[256];
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
siz==self->FontSize ) return;
if( self->FontName ) xfree(self->FontName);
@@ -968,7 +979,7 @@ void
PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
{
int i;
- char buf[256];
+ static char buf[256];
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
@@ -1170,7 +1181,7 @@ PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
if( self->InFrame || self->InTile ) xo = yo = 0;
x += xo; y += yo;
- sprintf(cacheID, "c%di", cache_id);
+ sprintf(cacheID, "c%ldi", cache_id);
S_OutNum(self, (float)x);
S_OutNum(self, (float)y);
@@ -1203,7 +1214,7 @@ PsOut_BeginImageCache(PsOutPtr self, long cache_id)
{
char cacheID[10];
- sprintf(cacheID, "/c%di {", cache_id);
+ sprintf(cacheID, "/c%ldi {", cache_id);
S_OutTok(self, cacheID, 0);
} /* new */
@@ -1214,7 +1225,7 @@ PsOut_EndImageCache(PsOutPtr self)
S_OutTok(self, "}bd", 1);
} /* new */
#endif
-
+
void
PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
int w, int h, int sw, int sh, int format)
@@ -1477,11 +1488,13 @@ PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
}
self->Patterns[self->NPatterns].tag = tag;
self->Patterns[self->NPatterns].type = type;
- sprintf(key, "/ %d", (int)tag);
+ sprintf(key, "/ %ld", (long)tag);
switch(type) {
case PsTile: key[1] = 't'; break;
case PsStip: key[1] = 's'; break;
- case PsOpStip: key[1] = 'o'; break; }
+ case PsOpStip: key[1] = 'o'; break;
+ default: break;
+ }
S_OutTok(self, key, 0);
S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
@@ -1522,11 +1535,13 @@ PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
for( i=0 ; i<self->NPatterns ; i++ )
{ if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
if( i>=self->NPatterns ) return;
- sprintf(key, " %d", (int)tag);
+ sprintf(key, " %ld", (long)tag);
switch(type) {
case PsTile: key[0] = 't'; break;
case PsStip: key[0] = 's'; break;
- case PsOpStip: key[0] = 'o'; break; }
+ case PsOpStip: key[0] = 'o'; break;
+ default: break;
+ }
S_OutTok(self, key, 0);
S_OutTok(self, "spt", 1);
self->CurColor = 0xFFFFFFFF;
@@ -1546,7 +1561,7 @@ PsOut_DownloadType1(PsOutPtr self, char *name, char *fname)
{
int i;
int stt;
- char buf[256];
+ static char buf[256];
FILE *fp;
for( i=0 ; i<self->NDownloads ; i++ )
diff --git a/Xprint/ps/psout.h b/Xprint/ps/psout.h
index e8ca56458..2fe83ffc7 100644
--- a/Xprint/ps/psout.h
+++ b/Xprint/ps/psout.h
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.h,v 1.5 2001/12/21 21:02:06 dawes Exp $ */
/*******************************************************************
**
@@ -182,8 +183,10 @@ extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
int bclr);
-extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
+extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
int w, int h, int sw, int sh, int format);
+extern void PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
+ int w, int h, int sw, int sh, int format);
extern void PsOut_EndImage(PsOutPtr self);
extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
@@ -199,4 +202,14 @@ extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
extern void PsOut_RawData(PsOutPtr self, char *data, int len);
extern void PsOut_DownloadType1(PsOutPtr self, char *name, char *fname);
+#ifdef BM_CACHE
+extern void PsOut_BeginImageCache(PsOutPtr self, long cache_id);
+extern void PsOut_EndImageCache(PsOutPtr self);
+extern void PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id,
+ int bclr, int fclr);
+#endif
+
+extern FILE *PsOut_ChangeFile(PsOutPtr self, FILE *fp);
+
+
#endif
diff --git a/Xprint/raster/Raster.c b/Xprint/raster/Raster.c
index db72b9b32..c7264c39a 100644
--- a/Xprint/raster/Raster.c
+++ b/Xprint/raster/Raster.c
@@ -30,6 +30,9 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+
+/* $XFree86: xc/programs/Xserver/Xprint/raster/Raster.c,v 1.11 2001/12/21 21:02:06 dawes Exp $ */
+
/*******************************************************************
**
** *********************************************************
@@ -45,6 +48,7 @@ copyright holders.
**
********************************************************************/
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
@@ -66,14 +70,15 @@ copyright holders.
#include "windowstr.h"
#include "propertyst.h"
#include "servermd.h" /* needed for IMAGE_BUFSIZE */
+#include "mfb.h"
+#include "mi.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Print.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
#include "Raster.h"
#include "attributes.h"
#include "AttrValid.h"
+#include "DiPrint.h"
static void AllocateRasterPrivates(
ScreenPtr pScreen);
@@ -82,12 +87,14 @@ static Bool RasterChangeWindowAttributes(
unsigned long mask);
static int StartJob(
XpContextPtr pCon,
- Bool sendClientData);
+ Bool sendClientData,
+ ClientPtr client);
static int StartPage(
XpContextPtr pCon,
WindowPtr pWin);
static int StartDoc(
- XpContextPtr pCon);
+ XpContextPtr pCon,
+ XPDocumentType type);
static int EndDoc(
XpContextPtr pCon,
Bool cancel);
@@ -96,8 +103,7 @@ static int EndJob(
Bool cancel);
static int EndPage(
XpContextPtr pCon,
- WindowPtr pWin,
- Bool cancel);
+ WindowPtr pWin);
static int DocumentData(
XpContextPtr pCon,
DrawablePtr pDraw,
@@ -127,10 +133,10 @@ static char *RasterGetAttributes(
static char *RasterGetOneAttribute(XpContextPtr pCon,
XPAttributes class,
char *attribute);
-static void RasterSetAttributes(XpContextPtr pCon,
+static int RasterSetAttributes(XpContextPtr pCon,
XPAttributes class,
char *attributes);
-static void RasterAugmentAttributes(XpContextPtr pCon,
+static int RasterAugmentAttributes(XpContextPtr pCon,
XPAttributes class,
char *attributes);
static int RasterMediumDimensions(XpContextPtr pCon,
@@ -143,17 +149,6 @@ static int RasterReproducibleArea(XpContextPtr pCon,
#define DOC_PCL 1
#define DOC_RASTER 2
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
-extern void XpDestroyAttributes();
-extern char *ReplaceFileString(
- char *string,
- char *inFileName,
- char *outFileName);
-extern char *XpGetConfigDir();
-
-extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
-
static int RasterScreenPrivateIndex, RasterContextPrivateIndex;
static int RasterGeneration = 0;
static char RASTER_DRIV_NAME[] = "XP-RASTER";
@@ -189,13 +184,9 @@ InitializeRasterDriver(
int argc,
char **argv)
{
- char specifier[MAX_TOKEN_LEN];
- int xRes, yRes, maxWidth, maxHeight;
+ int xRes, yRes;
int maxRes, maxDim, numBytes;
RasterScreenPrivPtr pPriv;
- XpDriverFuncsPtr pFuncs;
- char **printerNames, *printDescFile;
- int numPrinters;
/*
* Register this driver's InitContext function with the print extension.
@@ -229,6 +220,7 @@ InitializeRasterDriver(
*/
mfbScreenInit(pScreen, pPriv->pBits, maxDim, maxDim, maxRes,
maxRes, maxDim);
+ miInitializeBackingStore(pScreen);
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
if(mfbCreateDefColormap(pScreen) == FALSE)
@@ -237,10 +229,11 @@ InitializeRasterDriver(
/*
cfbScreenInit(pScreen, pPriv->pBits, maxWidth, maxHeight, maxXres,
maxYres, maxWidth);
+ miInitializeBackingStore(pScreen);
scalingScreenInit(pScreen);
*/
- pScreen->SaveScreen = _XpBoolNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
pPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
pPriv->CloseScreen = pScreen->CloseScreen;
@@ -379,11 +372,11 @@ SetDocumentType(
static int
StartJob(
XpContextPtr pCon,
- Bool sendClientData)
+ Bool sendClientData,
+ ClientPtr client)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
pCon->devPrivates[RasterContextPrivateIndex].ptr;
- char *jobHeader;
SetDocumentType( pCon );
@@ -424,7 +417,8 @@ StartJob(
static int
StartDoc(
- XpContextPtr pCon)
+ XpContextPtr pCon,
+ XPDocumentType type)
{
return Success;
}
@@ -436,6 +430,10 @@ static int EndDoc(
return Success;
}
+#if 0
+
+/* XXX Not used. */
+
/*
* BuidArgVector takes a pointer to a comma-separated list of command
* options and splits it out into an array of argument pointers. The
@@ -453,7 +451,6 @@ BuildArgVector(
int argCount)
{
char *curArg, *lastChar, *endArg;
- int optionLen;
curArg = optionList;
lastChar = optionList + strlen(optionList); /* includes final NULL */
@@ -488,6 +485,7 @@ BuildArgVector(
return argVector;
}
+#endif
static int
EndJob(
@@ -555,11 +553,8 @@ StartPage(
XpContextPtr pCon,
WindowPtr pWin)
{
- register WindowPtr pChild;
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
pCon->devPrivates[RasterContextPrivateIndex].ptr;
- unsigned short width, height;
- xEvent event;
if(pConPriv->pPageFile != (FILE *)NULL)
{
@@ -652,7 +647,7 @@ Get_XWDColors(
return(colors);
}
-static
+static void
_swapshort (
register char *bp,
register unsigned n)
@@ -668,7 +663,7 @@ _swapshort (
}
}
-static
+static void
_swaplong (
register char *bp,
register unsigned n)
@@ -879,19 +874,14 @@ SendPage( XpContextPtr pCon )
static int
EndPage(
XpContextPtr pCon,
- WindowPtr pWin,
- Bool cancel)
+ WindowPtr pWin)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
pCon->devPrivates[RasterContextPrivateIndex].ptr;
struct stat statBuf;
- char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL,
- *pHeader = (char *)NULL, *pTrailer = (char *)NULL;
+ char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL;
FILE *pRasterFile = (FILE *)NULL;
- if( cancel == True )
- return Success;
-
if(pConPriv->pageFileName == (char *)NULL)
{
/*
@@ -1194,14 +1184,13 @@ RasterChangeWindowAttributes(
mask |= CWBackingStore;
}
- if(pScreenPriv->ChangeWindowAttributes != (Bool (*)())NULL)
+ if(pScreenPriv->ChangeWindowAttributes != NULL)
{
pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
status = pScreen->ChangeWindowAttributes(pWin, mask);
pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
}
- if(status != TRUE)
- return status;
+ return status;
}
/*
@@ -1275,12 +1264,12 @@ RasterInitContext(
pFuncs->PutDocumentData = DocumentData;
pFuncs->GetDocumentData = GetDocumentData;
pFuncs->DestroyContext = RasterDestroyContext;
- pFuncs->GetAttributes = (char *(*)())RasterGetAttributes;
- pFuncs->GetOneAttribute = (char *(*)())RasterGetOneAttribute;
- pFuncs->SetAttributes = (int(*)())RasterSetAttributes;
- pFuncs->AugmentAttributes = (int(*)())RasterAugmentAttributes;
- pFuncs->GetMediumDimensions = (int(*)())RasterMediumDimensions;
- pFuncs->GetReproducibleArea = (int(*)())RasterReproducibleArea;
+ pFuncs->GetAttributes = RasterGetAttributes;
+ pFuncs->GetOneAttribute = RasterGetOneAttribute;
+ pFuncs->SetAttributes = RasterSetAttributes;
+ pFuncs->AugmentAttributes = RasterAugmentAttributes;
+ pFuncs->GetMediumDimensions = RasterMediumDimensions;
+ pFuncs->GetReproducibleArea = RasterReproducibleArea;
/*
* Set up the context privates
@@ -1415,21 +1404,21 @@ RasterGetOneAttribute(
return XpGetOneAttribute( pContext, class, attr );
}
-static void
+static int
RasterSetAttributes(XpContextPtr pCon,
XPAttributes class,
char *attributes)
{
- XpSetAttributes( pCon, class, attributes );
+ return XpSetAttributes( pCon, class, attributes );
}
-static void
+static int
RasterAugmentAttributes(
XpContextPtr pCon,
XPAttributes class,
char *attributes)
{
- XpAugmentAttributes( pCon, class, attributes );
+ return XpAugmentAttributes( pCon, class, attributes );
}
static void
@@ -1498,7 +1487,7 @@ RasterCloseScreen(
/*
* Call any wrapped CloseScreen proc.
*/
- if(pScreenPriv->CloseScreen != (Bool (*)())NULL)
+ if(pScreenPriv->CloseScreen != NULL)
{
pScreen->CloseScreen = pScreenPriv->CloseScreen;
status = pScreen->CloseScreen(index, pScreen);
@@ -1517,6 +1506,7 @@ RasterCloseScreen(
static void SigchldHndlr (int dummy)
{
int status, w;
+ int olderrno = errno;
struct sigaction act;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
@@ -1528,6 +1518,7 @@ static void SigchldHndlr (int dummy)
* Is this really necessary?
*/
sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
}
/*
diff --git a/Xprint/raster/Raster.h b/Xprint/raster/Raster.h
index b793f89a0..0533cd5b2 100644
--- a/Xprint/raster/Raster.h
+++ b/Xprint/raster/Raster.h
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/raster/Raster.h,v 1.4 2001/12/21 21:02:06 dawes Exp $ */
+
/*******************************************************************
**
** *********************************************************
@@ -50,17 +52,18 @@ copyright holders.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
+#endif
#define Status int
#define True 1
#define False 0
#include "misc.h"
#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xresource.h>
+#include "attributes.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Printstr.h>
#define MAX_TOKEN_LEN 512
@@ -81,10 +84,10 @@ typedef char *XPointer;
typedef struct {
char *pBits;
- Bool (* CreateWindow)(); /* pWin */
- Bool (* ChangeWindowAttributes)(); /* pWin, mask */
- Bool (* DestroyWindow)(); /* pWin */
- Bool (* CloseScreen)(); /* index, pScreen */
+ CreateWindowProcPtr CreateWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
} RasterScreenPrivRec, *RasterScreenPrivPtr;
typedef struct {
@@ -103,4 +106,10 @@ typedef struct {
int getDocBufSize;
} RasterContextPrivRec, *RasterContextPrivPtr;
+
+extern XpValidatePoolsRec RasterValidatePoolsRec;
+
+extern Bool InitializeRasterDriver(int ndx, ScreenPtr pScreen, int argc,
+ char **argv);
+
#endif /* _RASTER_H_ */
diff --git a/Xprint/raster/RasterAttVal.c b/Xprint/raster/RasterAttVal.c
index f76a890d3..7cce3f22a 100644
--- a/Xprint/raster/RasterAttVal.c
+++ b/Xprint/raster/RasterAttVal.c
@@ -30,15 +30,15 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/raster/RasterAttVal.c,v 1.4 2001/12/21 21:02:06 dawes Exp $ */
+
#include <stdio.h>
#include "X.h"
#include "misc.h"
#include "dixstruct.h"
#include "scrnintstr.h"
#include "screenint.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Print.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
#include "Raster.h"
#include "attributes.h"
diff --git a/cfb/cfb.h b/cfb/cfb.h
index f8b48f66a..731b7684a 100644
--- a/cfb/cfb.h
+++ b/cfb/cfb.h
@@ -27,8 +27,12 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfb.h,v 3.27 2001/01/30 22:06:15 tsi Exp $ */
+
+#if !defined(__CFB_H__) || defined(CFB_PROTOTYPES_ONLY)
#include "X.h"
+#include "globals.h"
#include "pixmap.h"
#include "region.h"
#include "gc.h"
@@ -41,6 +45,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "cfbmap.h"
+#ifndef CfbBits
+#define CfbBits CARD32
+#endif
+
+#ifndef CFB_PROTOTYPES_ONLY
+#define __CFB_H__
/*
private filed of pixmap
pixmap.devPrivate = (unsigned int *)pointer_to_bits
@@ -57,11 +67,7 @@ typedef struct {
unsigned char ropOpStip; /* rop for opaque stipple */
/* this value is ropFillArea in mfb, usurped for cfb */
unsigned char oneRect; /* drawable has one clip rect */
- unsigned fExpose:1; /* callexposure handling ? */
- unsigned freeCompClip:1;
- PixmapPtr pRotatedPixmap;
- RegionPtr pCompositeClip; /* FREE_CC or REPLACE_CC */
- unsigned long xor, and; /* reduced rop values */
+ CfbBits xor, and; /* reduced rop values */
} cfbPrivGC;
typedef cfbPrivGC *cfbPrivGCPtr;
@@ -69,13 +75,12 @@ typedef cfbPrivGC *cfbPrivGCPtr;
#define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\
(pGC)->devPrivates[cfbGCPrivateIndex].ptr)
-#define cfbGetCompositeClip(pGC) (((cfbPrivGCPtr)\
- (pGC)->devPrivates[cfbGCPrivateIndex].ptr)->pCompositeClip)
+#define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
/* way to carry RROP info around */
typedef struct {
unsigned char rop;
- unsigned long xor, and;
+ CfbBits xor, and;
} cfbRRopRec, *cfbRRopPtr;
/* private field of window */
@@ -95,24 +100,19 @@ typedef struct {
/* cfb8bit.c */
extern int cfbSetStipple(
-#if NeedFunctionPrototypes
int /*alu*/,
- unsigned long /*fg*/,
- unsigned long /*planemask*/
-#endif
+ CfbBits /*fg*/,
+ CfbBits /*planemask*/
);
extern int cfbSetOpaqueStipple(
-#if NeedFunctionPrototypes
int /*alu*/,
- unsigned long /*fg*/,
- unsigned long /*bg*/,
- unsigned long /*planemask*/
-#endif
+ CfbBits /*fg*/,
+ CfbBits /*bg*/,
+ CfbBits /*planemask*/
);
extern int cfbComputeClipMasks32(
-#if NeedFunctionPrototypes
BoxPtr /*pBox*/,
int /*numRects*/,
int /*x*/,
@@ -120,23 +120,21 @@ extern int cfbComputeClipMasks32(
int /*w*/,
int /*h*/,
CARD32 * /*clips*/
-#endif
);
+#endif /* !CFB_PROTOTYPES_ONLY */
/* cfb8cppl.c */
extern void cfbCopyImagePlane(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
+#ifndef CFB_PROTOTYPES_ONLY
extern void cfbCopyPlane8to1(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
@@ -144,12 +142,42 @@ extern void cfbCopyPlane8to1(
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
unsigned long /*bitPlane*/
-#endif
);
+
+extern void cfbCopyPlane16to1(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+);
+
+extern void cfbCopyPlane24to1(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+);
+
+extern void cfbCopyPlane32to1(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+);
+#endif
+
/* cfb8lineCO.c */
extern int cfb8LineSS1RectCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -160,21 +188,17 @@ extern int cfb8LineSS1RectCopy(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-#endif
);
extern void cfb8LineSS1Rect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
-#endif
);
extern void cfb8ClippedLineCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x1*/,
@@ -183,12 +207,10 @@ extern void cfb8ClippedLineCopy(
int /*y2*/,
BoxPtr /*boxp*/,
Bool /*shorten*/
-#endif
);
/* cfb8lineCP.c */
extern int cfb8LineSS1RectPreviousCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -199,13 +221,10 @@ extern int cfb8LineSS1RectPreviousCopy(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-
-#endif
);
/* cfb8lineG.c */
extern int cfb8LineSS1RectGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -216,11 +235,9 @@ extern int cfb8LineSS1RectGeneral(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-#endif
);
extern void cfb8ClippedLineGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x1*/,
@@ -229,12 +246,10 @@ extern void cfb8ClippedLineGeneral(
int /*y2*/,
BoxPtr /*boxp*/,
Bool /*shorten*/
-#endif
);
/* cfb8lineX.c */
extern int cfb8LineSS1RectXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
@@ -245,11 +260,9 @@ extern int cfb8LineSS1RectXor(
int * /*y1p*/,
int * /*x2p*/,
int * /*y2p*/
-#endif
);
extern void cfb8ClippedLineXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x1*/,
@@ -258,70 +271,56 @@ extern void cfb8ClippedLineXor(
int /*y2*/,
BoxPtr /*boxp*/,
Bool /*shorten*/
-#endif
);
/* cfb8segC.c */
extern int cfb8SegmentSS1RectCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfb8segCS.c */
extern int cfb8SegmentSS1RectShiftCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
extern void cfb8SegmentSS1Rect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfb8segG.c */
extern int cfb8SegmentSS1RectGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfbsegX.c */
extern int cfb8SegmentSS1RectXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegInit*/
-#endif
);
/* cfballpriv.c */
extern Bool cfbAllocatePrivates(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int * /*window_index*/,
int * /*gc_index*/
-#endif
);
/* cfbbitblt.c */
extern RegionPtr cfbBitBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr/*pGC*/,
@@ -331,24 +330,28 @@ extern RegionPtr cfbBitBlt(
int /*height*/,
int /*dstx*/,
int /*dsty*/,
- void (* /*doBitBlt*/)(),
+ void (* /*doBitBlt*/)(
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+ ),
unsigned long /*bitPlane*/
-#endif
);
extern void cfbDoBitblt(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
extern RegionPtr cfbCopyArea(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr/*pGC*/,
@@ -358,11 +361,10 @@ extern RegionPtr cfbCopyArea(
int /*height*/,
int /*dstx*/,
int /*dsty*/
-#endif
);
+#ifndef CFB_PROTOTYPES_ONLY
extern void cfbCopyPlane1to8(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
int /*rop*/,
@@ -370,11 +372,10 @@ extern void cfbCopyPlane1to8(
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/,
unsigned long /*bitPlane*/
-#endif
);
+#endif
extern RegionPtr cfbCopyPlane(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -385,64 +386,54 @@ extern RegionPtr cfbCopyPlane(
int /*dstx*/,
int /*dsty*/,
unsigned long /*bitPlane*/
-#endif
);
/* cfbbltC.c */
extern void cfbDoBitbltCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbltG.c */
extern void cfbDoBitbltGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbltO.c */
extern void cfbDoBitbltOr(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbltX.c */
extern void cfbDoBitbltXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
int /*alu*/,
RegionPtr /*prgnDst*/,
DDXPointPtr /*pptSrc*/,
unsigned long /*planemask*/
-#endif
);
/* cfbbres.c */
extern void cfbBresS(
-#if NeedFunctionPrototypes
int /*rop*/,
- unsigned long /*and*/,
- unsigned long /*xor*/,
- unsigned long * /*addrl*/,
+ CfbBits /*and*/,
+ CfbBits /*xor*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*signdx*/,
int /*signdy*/,
@@ -453,19 +444,17 @@ extern void cfbBresS(
int /*e1*/,
int /*e2*/,
int /*len*/
-#endif
);
/* cfbbresd.c */
extern void cfbBresD(
-#if NeedFunctionPrototypes
cfbRRopPtr /*rrops*/,
int * /*pdashIndex*/,
unsigned char * /*pDash*/,
int /*numInDashList*/,
int * /*pdashOffset*/,
int /*isDoubleDash*/,
- unsigned long * /*addrl*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*signdx*/,
int /*signdy*/,
@@ -476,90 +465,71 @@ extern void cfbBresD(
int /*e1*/,
int /*e2*/,
int /*len*/
-#endif
);
/* cfbbstore.c */
extern void cfbSaveAreas(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnSave*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
-#endif
);
extern void cfbRestoreAreas(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnRestore*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
-#endif
);
/* cfbcmap.c */
+#ifndef CFB_PROTOTYPES_ONLY
extern int cfbListInstalledColormaps(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
Colormap * /*pmaps*/
-#endif
);
extern void cfbInstallColormap(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
-#endif
);
extern void cfbUninstallColormap(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
-#endif
);
extern void cfbResolveColor(
-#if NeedFunctionPrototypes
unsigned short * /*pred*/,
unsigned short * /*pgreen*/,
unsigned short * /*pblue*/,
VisualPtr /*pVisual*/
-#endif
);
extern Bool cfbInitializeColormap(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/
-#endif
);
extern int cfbExpandDirectColors(
-#if NeedFunctionPrototypes
ColormapPtr /*pmap*/,
int /*ndef*/,
xColorItem * /*indefs*/,
xColorItem * /*outdefs*/
-#endif
);
extern Bool cfbCreateDefColormap(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/
-#endif
);
extern Bool cfbSetVisualTypes(
-#if NeedFunctionPrototypes
int /*depth*/,
int /*visuals*/,
int /*bitsPerRGB*/
-#endif
);
+extern void cfbClearVisualTypes(void);
+
extern Bool cfbInitVisuals(
-#if NeedFunctionPrototypes
VisualPtr * /*visualp*/,
DepthPtr * /*depthp*/,
int * /*nvisualp*/,
@@ -568,142 +538,117 @@ extern Bool cfbInitVisuals(
VisualID * /*defaultVisp*/,
unsigned long /*sizes*/,
int /*bitsPerRGB*/
-#endif
);
+#endif
/* cfbfillarcC.c */
extern void cfbPolyFillArcSolidCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbfillarcG.c */
extern void cfbPolyFillArcSolidGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbfillrct.c */
extern void cfbFillBoxTileOdd(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
BoxPtr /*rects*/,
PixmapPtr /*tile*/,
int /*xrot*/,
int /*yrot*/
-#endif
);
extern void cfbFillRectTileOdd(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbPolyFillRect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nrectFill*/,
xRectangle * /*prectInit*/
-#endif
);
/* cfbfillsp.c */
extern void cfbUnnaturalTileFS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
extern void cfbUnnaturalStippleFS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
+#ifndef CFB_PROTOTYPES_ONLY
extern void cfb8Stipple32FS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
extern void cfb8OpaqueStipple32FS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
+#endif
/* cfbgc.c */
extern GCOpsPtr cfbMatchCommon(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
cfbPrivGCPtr /*devPriv*/
-#endif
);
extern Bool cfbCreateGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/
-#endif
);
extern void cfbValidateGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
unsigned long /*changes*/,
DrawablePtr /*pDrawable*/
-#endif
);
/* cfbgetsp.c */
extern void cfbGetSpans(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*wMax*/,
DDXPointPtr /*ppt*/,
int * /*pwidth*/,
int /*nspans*/,
char * /*pdstStart*/
-#endif
);
/* cfbglblt8.c */
extern void cfbPolyGlyphBlt8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -711,12 +656,10 @@ extern void cfbPolyGlyphBlt8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbglrop8.c */
extern void cfbPolyGlyphRop8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -724,39 +667,33 @@ extern void cfbPolyGlyphRop8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbhrzvert.c */
-extern int cfbHorzS(
-#if NeedFunctionPrototypes
+extern void cfbHorzS(
int /*rop*/,
- unsigned long /*and*/,
- unsigned long /*xor*/,
- unsigned long * /*addrl*/,
+ CfbBits /*and*/,
+ CfbBits /*xor*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*x1*/,
int /*y1*/,
int /*len*/
-#endif
);
-extern int cfbVertS(
-#if NeedFunctionPrototypes
+extern void cfbVertS(
int /*rop*/,
- unsigned long /*and*/,
- unsigned long /*xor*/,
- unsigned long * /*addrl*/,
+ CfbBits /*and*/,
+ CfbBits /*xor*/,
+ CfbBits * /*addrl*/,
int /*nlwidth*/,
int /*x1*/,
int /*y1*/,
int /*len*/
-#endif
);
/* cfbigblt8.c */
extern void cfbImageGlyphBlt8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -764,12 +701,10 @@ extern void cfbImageGlyphBlt8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbimage.c */
extern void cfbPutImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*depth*/,
@@ -780,11 +715,9 @@ extern void cfbPutImage(
int /*leftPad*/,
int /*format*/,
char * /*pImage*/
-#endif
);
extern void cfbGetImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*sx*/,
int /*sy*/,
@@ -793,147 +726,116 @@ extern void cfbGetImage(
unsigned int /*format*/,
unsigned long /*planeMask*/,
char * /*pdstLine*/
-#endif
);
/* cfbline.c */
extern void cfbLineSS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
-#endif
);
extern void cfbLineSD(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
-#endif
);
/* cfbmskbits.c */
/* cfbpixmap.c */
extern PixmapPtr cfbCreatePixmap(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int /*width*/,
int /*height*/,
int /*depth*/
-#endif
);
extern Bool cfbDestroyPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/
-#endif
);
extern PixmapPtr cfbCopyPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pSrc*/
-#endif
);
extern void cfbPadPixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/
-#endif
);
extern void cfbXRotatePixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPix*/,
int /*rw*/
-#endif
);
extern void cfbYRotatePixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*pPix*/,
int /*rh*/
-#endif
);
extern void cfbCopyRotatePixmap(
-#if NeedFunctionPrototypes
PixmapPtr /*psrcPix*/,
PixmapPtr * /*ppdstPix*/,
int /*xrot*/,
int /*yrot*/
-#endif
);
/* cfbply1rctC.c */
extern void cfbFillPoly1RectCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* cfbply1rctG.c */
extern void cfbFillPoly1RectGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* cfbpntwin.c */
extern void cfbPaintWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*pRegion*/,
int /*what*/
-#endif
);
extern void cfbFillBoxSolid(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
unsigned long /*pixel*/
-#endif
);
extern void cfbFillBoxTile32(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
PixmapPtr /*tile*/
-#endif
);
/* cfbpolypnt.c */
extern void cfbPolyPoint(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
xPoint * /*pptInit*/
-#endif
);
/* cfbpush8.c */
+#ifndef CFB_PROTOTYPES_ONLY
extern void cfbPushPixels8(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
PixmapPtr /*pBitmap*/,
DrawablePtr /*pDrawable*/,
@@ -941,58 +843,47 @@ extern void cfbPushPixels8(
int /*dy*/,
int /*xOrg*/,
int /*yOrg*/
-#endif
);
/* cfbrctstp8.c */
extern void cfb8FillRectOpaqueStippled32(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfb8FillRectTransparentStippled32(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfb8FillRectStippledUnnatural(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
+#endif
/* cfbrrop.c */
extern int cfbReduceRasterOp(
-#if NeedFunctionPrototypes
int /*rop*/,
- unsigned long /*fg*/,
- unsigned long /*pm*/,
- unsigned long * /*andp*/,
- unsigned long * /*xorp*/
-#endif
+ CfbBits /*fg*/,
+ CfbBits /*pm*/,
+ CfbBits * /*andp*/,
+ CfbBits * /*xorp*/
);
/* cfbscrinit.c */
extern Bool cfbCloseScreen(
-#if NeedFunctionPrototypes
int /*index*/,
ScreenPtr /*pScreen*/
-#endif
);
extern Bool cfbSetupScreen(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -1000,11 +891,9 @@ extern Bool cfbSetupScreen(
int /*dpix*/,
int /*dpiy*/,
int /*width*/
-#endif
);
-extern int cfbFinishScreenInit(
-#if NeedFunctionPrototypes
+extern Bool cfbFinishScreenInit(
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -1012,11 +901,9 @@ extern int cfbFinishScreenInit(
int /*dpix*/,
int /*dpiy*/,
int /*width*/
-#endif
);
extern Bool cfbScreenInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -1024,31 +911,34 @@ extern Bool cfbScreenInit(
int /*dpix*/,
int /*dpiy*/,
int /*width*/
-#endif
);
+
+extern PixmapPtr cfbGetScreenPixmap(
+ ScreenPtr /*pScreen*/
+);
+
+extern void cfbSetScreenPixmap(
+ PixmapPtr /*pPix*/
+);
+
/* cfbseg.c */
extern void cfbSegmentSS(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSeg*/
-#endif
);
extern void cfbSegmentSD(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSeg*/
-#endif
);
/* cfbsetsp.c */
-extern int cfbSetScanline(
-#if NeedFunctionPrototypes
+extern void cfbSetScanline(
int /*y*/,
int /*xOrigin*/,
int /*xStart*/,
@@ -1058,11 +948,9 @@ extern int cfbSetScanline(
int * /*pdstBase*/,
int /*widthDst*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbSetSpans(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
char * /*psrc*/,
@@ -1070,75 +958,62 @@ extern void cfbSetSpans(
int * /*pwidth*/,
int /*nspans*/,
int /*fSorted*/
-#endif
);
/* cfbsolidC.c */
extern void cfbFillRectSolidCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbSolidSpansCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbsolidG.c */
extern void cfbFillRectSolidGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbSolidSpansGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbsolidX.c */
extern void cfbFillRectSolidXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbSolidSpansXor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbteblt8.c */
+#ifndef CFB_PROTOTYPES_ONLY
extern void cfbTEGlyphBlt8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*xInit*/,
@@ -1146,12 +1021,11 @@ extern void cfbTEGlyphBlt8(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
+#endif
/* cfbtegblt.c */
extern void cfbTEGlyphBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr/*pGC*/,
int /*x*/,
@@ -1159,54 +1033,44 @@ extern void cfbTEGlyphBlt(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* cfbtile32C.c */
extern void cfbFillRectTile32Copy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbTile32FSCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbtile32G.c */
extern void cfbFillRectTile32General(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nBox*/,
BoxPtr /*pBox*/
-#endif
);
extern void cfbTile32FSGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
-#endif
);
/* cfbtileoddC.c */
extern void cfbFillBoxTileOddCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1215,11 +1079,9 @@ extern void cfbFillBoxTileOddCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTileOddCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1229,11 +1091,9 @@ extern void cfbFillSpanTileOddCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillBoxTile32sCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1242,11 +1102,9 @@ extern void cfbFillBoxTile32sCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTile32sCopy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1256,12 +1114,10 @@ extern void cfbFillSpanTile32sCopy(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
/* cfbtileoddG.c */
extern void cfbFillBoxTileOddGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1270,11 +1126,9 @@ extern void cfbFillBoxTileOddGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTileOddGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1284,11 +1138,9 @@ extern void cfbFillSpanTileOddGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillBoxTile32sGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*nBox*/,
BoxPtr /*pBox*/,
@@ -1297,11 +1149,9 @@ extern void cfbFillBoxTile32sGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
extern void cfbFillSpanTile32sGeneral(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
int /*n*/,
DDXPointPtr /*ppt*/,
@@ -1311,113 +1161,79 @@ extern void cfbFillSpanTile32sGeneral(
int /*yrot*/,
int /*alu*/,
unsigned long /*planemask*/
-#endif
);
/* cfbwindow.c */
extern Bool cfbCreateWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern Bool cfbDestroyWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern Bool cfbMapWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWindow*/
-#endif
);
extern Bool cfbPositionWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/
-#endif
);
extern Bool cfbUnmapWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWindow*/
-#endif
);
extern void cfbCopyWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
DDXPointRec /*ptOldOrg*/,
RegionPtr /*prgnSrc*/
-#endif
);
extern Bool cfbChangeWindowAttributes(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
unsigned long /*mask*/
-#endif
);
/* cfbzerarcC.c */
extern void cfbZeroPolyArcSS8Copy(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbzerarcG.c */
extern void cfbZeroPolyArcSS8General(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* cfbzerarcX.c */
extern void cfbZeroPolyArcSS8Xor(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
-/*
- * This is the only completely portable way to
- * compute this info
- */
-
-#define BitsPerPixel(d) (\
- (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
- (PixmapWidthPaddingInfo[d].padRoundUp+1))
-
-/* Common macros for extracting drawing information */
-
-#if !defined(SINGLEDEPTH) && PSZ != 8 || defined(FORCE_SEPARATE_PRIVATE)
+#if (!defined(SINGLEDEPTH) && PSZ != 8) || defined(FORCE_SEPARATE_PRIVATE)
#define CFB_NEED_SCREEN_PRIVATE
extern int cfbScreenPrivateIndex;
-#define cfbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivates[cfbScreenPrivateIndex].ptr)
-#else
-#define cfbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
#endif
-#ifdef PIXMAP_PER_WINDOW
-#define cfbGetWindowPixmap(d) ((PixmapPtr) ((WindowPtr) d)->devPrivates[frameWindowPrivateIndex].ptr)
-#else
-#define cfbGetWindowPixmap(d) cfbGetScreenPixmap((d)->pScreen)
-#endif
+#ifndef CFB_PROTOTYPES_ONLY
+
+/* Common macros for extracting drawing information */
+
+#define cfbGetWindowPixmap(d) \
+ ((* ((DrawablePtr)(d))->pScreen->GetWindowPixmap)((WindowPtr)(d)))
#define cfbGetTypedWidth(pDrawable,wtype) (\
(((pDrawable)->type != DRAWABLE_PIXMAP) ? \
@@ -1428,7 +1244,7 @@ extern int cfbScreenPrivateIndex;
#define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType)
-#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned long)
+#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, CfbBits)
#define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
PixmapPtr _pPix; \
@@ -1444,7 +1260,7 @@ extern int cfbScreenPrivateIndex;
cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
#define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \
- cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned long, unsigned long)
+ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, CfbBits, CfbBits)
#define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
@@ -1456,7 +1272,7 @@ extern int cfbScreenPrivateIndex;
}
#define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \
- cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned long, unsigned long)
+ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, CfbBits, CfbBits)
#define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char)
@@ -1464,31 +1280,26 @@ extern int cfbScreenPrivateIndex;
#define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \
cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
-/* Macros which handle a coordinate in a single register */
-
-/* Most compilers will convert divide by 65536 into a shift, if signed
- * shifts exist. If your machine does arithmetic shifts and your compiler
- * can't get it right, add to this line.
+/*
+ * XFree86 empties the root BorderClip when the VT is inactive,
+ * here's a macro which uses that to disable GetImage and GetSpans
*/
+#define cfbWindowEnabled(pWin) \
+ REGION_NOTEMPTY((pWin)->drawable.pScreen, \
+ &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
-/* mips compiler - what a joke - it CSEs the 65536 constant into a reg
- * forcing as to use div instead of shift. Let's be explicit.
- */
+#define cfbDrawableEnabled(pDrawable) \
+ ((pDrawable)->type == DRAWABLE_PIXMAP ? \
+ TRUE : cfbWindowEnabled((WindowPtr) pDrawable))
+
+#include "micoord.h"
-#if defined(mips) || defined(sparc) || defined(__alpha)
-#define GetHighWord(x) (((int) (x)) >> 16)
-#else
-#define GetHighWord(x) (((int) (x)) / 65536)
+/*
+ * if CFB is built as a module, it shouldn't call libc functions.
+ */
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
#endif
+#endif /* !CFB_PROTOTYPES_ONLY */
-#if IMAGE_BYTE_ORDER == MSBFirst
-#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
-#define coordToInt(x,y) (((x) << 16) | (y))
-#define intToX(i) (GetHighWord(i))
-#define intToY(i) ((int) ((short) i))
-#else
-#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
-#define coordToInt(x,y) (((y) << 16) | (x))
-#define intToX(i) ((int) ((short) (i)))
-#define intToY(i) (GetHighWord(i))
#endif
diff --git a/cfb/cfb8bit.c b/cfb/cfb8bit.c
index 080970e70..1dd742c60 100644
--- a/cfb/cfb8bit.c
+++ b/cfb/cfb8bit.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfb8bit.c,v 1.5 2001/12/14 19:59:20 dawes Exp $ */
/*
* cfb8bit.c
@@ -193,11 +194,11 @@ PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
int
cfb8SetStipple (alu, fg, planemask)
int alu;
-unsigned long fg, planemask;
+CfbBits fg, planemask;
{
- unsigned long and, xor, rrop;
+ CfbBits and, xor, rrop;
int s;
- unsigned long c;
+ CfbBits c;
cfb8StippleMode = FillStippled;
cfb8StippleAlu = alu;
@@ -222,11 +223,11 @@ unsigned long fg, planemask;
int
cfb8SetOpaqueStipple (alu, fg, bg, planemask)
int alu;
-unsigned long fg, bg, planemask;
+CfbBits fg, bg, planemask;
{
- unsigned long andfg, xorfg, andbg, xorbg, rropfg, rropbg;
+ CfbBits andfg, xorfg, andbg, xorbg, rropfg, rropbg;
int s;
- unsigned long c;
+ CfbBits c;
cfb8StippleMode = FillOpaqueStippled;
cfb8StippleAlu = alu;
@@ -371,7 +372,7 @@ cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips)
{
int yBand, yBandBot;
int ch;
- unsigned long clip;
+ CfbBits clip;
int partIN = FALSE, partOUT = FALSE;
int result;
diff --git a/cfb/cfb8bit.h b/cfb/cfb8bit.h
index 23853bf2d..a14402b83 100644
--- a/cfb/cfb8bit.h
+++ b/cfb/cfb8bit.h
@@ -7,6 +7,7 @@
* are used for depths other than 8. Perhaps the file should be
* renamed. dpw
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfb8bit.h,v 3.7 2001/12/14 19:59:20 dawes Exp $ */
/*
@@ -168,13 +169,11 @@ extern int cfb8StippleRRop;
#define RRopBitGroup(dst,bits) \
{ \
- register PixelGroup _bitsTmp = (bits); \
*(dst) = RRopPixels(*(dst),bits); \
}
#define MaskRRopBitGroup(dst,bits,mask) \
{ \
- register PixelGroup _bitsTmp = (bits); \
*(dst) = MaskRRopPixels(*(dst),bits,mask); \
}
#endif /* PSZ == 8 */
@@ -203,17 +202,39 @@ extern int cfb8StippleRRop;
#define SinglePixel1 2
#define SinglePixel2 1
#define SinglePixel3 0
+#define SinglePixel4 7
+#define SinglePixel5 6
+#define SinglePixel6 5
+#define SinglePixel7 4
+#define SinglePixel8 0xB
+#define SinglePixel9 0xA
#define DoublePixel0 1
#define DoublePixel1 0
+#define DoublePixel2 3
+#define DoublePixel3 2
+#define DoublePixel4 5
+#define DoublePixel5 4
#else
#define SinglePixel0 0
#define SinglePixel1 1
#define SinglePixel2 2
#define SinglePixel3 3
+#define SinglePixel4 4
+#define SinglePixel5 5
+#define SinglePixel6 6
+#define SinglePixel7 7
+#define SinglePixel8 8
+#define SinglePixel9 9
#define DoublePixel0 0
#define DoublePixel1 1
+#define DoublePixel2 2
+#define DoublePixel3 3
+#define DoublePixel4 4
+#define DoublePixel5 5
#endif
#define QuadPixel0 0
+#define QuadPixel1 1
+#define QuadPixel2 2
#else /* PGSZ == 64 */
#if (BITMAP_BIT_ORDER == MSBFirst)
#define SinglePixel0 7
@@ -393,7 +414,7 @@ extern int cfb8StippleRRop;
break; \
case 6: \
((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
break; \
case 7: \
((CARD16 *) (dst))[DoublePixel2] = (pixel); \
@@ -872,6 +893,363 @@ extern int cfb8StippleRRop;
#endif /* PSZ == 16 */
+#if PSZ == 24
+/* 32 000011112222*/
+/* 24 000111222333*/
+/* 16 001122334455*/
+/* 8 0123456789AB*/
+#if PGSZ == 32
+#define WriteBitGroup(dst,pixel,bits) \
+ { \
+ register CARD32 reg_pixel = (pixel); \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \
+ break; \
+ case 2: \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
+ ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
+ break; \
+ case 3: \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
+ ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \
+ break; \
+ case 4: \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \
+ break; \
+ case 5: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ reg_pixel >>= 16; \
+ ((CARD8 *) (dst))[SinglePixel2] = \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
+ break; \
+ case 6: \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
+ break; \
+ case 7: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
+ break; \
+ case 8: \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
+ ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \
+ break; \
+ case 9: \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \
+ break; \
+ case 10: \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ break; \
+ case 11: \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
+ break; \
+ case 12: \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
+ break; \
+ case 13: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
+ break; \
+ case 14: \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
+ break; \
+ case 15: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = \
+ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
+ break; \
+ } \
+ }
+#else /* PGSZ == 64 */
+#define WriteBitGroup(dst,pixel,bits) \
+ if ( bits == 0xff ) { \
+ ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
+ } \
+ else { \
+ switch (bits & 0x0f) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ } \
+ switch ((bits & 0xf0) >> 4) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ } \
+ }
+#endif /* PGSZ */
+
+#if PGSZ == 32
+#define SwitchBitGroup(dst,pixel,bits) { \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \
+ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ } \
+}
+#else /* PGSZ == 64 */
+#define SwitchBitGroup(dst,pixel,bits) { \
+ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
+#endif /* PGSZ */
+
+#endif /* PSZ == 24 */
#if PSZ == 32
@@ -1169,17 +1547,17 @@ extern PixelGroup cfb8BitLenMasks[PGSZ];
extern int cfb8SetStipple (
#if NeedFunctionPrototypes
int /*alu*/,
- unsigned long /*fg*/,
- unsigned long /*planemask*/
+ CfbBits /*fg*/,
+ CfbBits /*planemask*/
#endif
);
extern int cfb8SetOpaqueStipple (
#if NeedFunctionPrototypes
int /*alu*/,
- unsigned long /*fg*/,
- unsigned long /*bg*/,
- unsigned long /*planemask*/
+ CfbBits /*fg*/,
+ CfbBits /*bg*/,
+ CfbBits /*planemask*/
#endif
);
diff --git a/cfb/cfb8line.c b/cfb/cfb8line.c
index 7a5f1ac5d..f06abe084 100644
--- a/cfb/cfb8line.c
+++ b/cfb/cfb8line.c
@@ -24,6 +24,9 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
+ *
+ * $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.18 2002/09/18 17:11:47 tsi Exp $
+ * Jeff Anton'x fixes: cfb8line.c 97/02/07
*/
#include "X.h"
@@ -64,7 +67,8 @@ in this Software without prior written authorization from The Open Group.
#ifdef POLYSEGMENT
-# ifdef sun
+# if (defined(sun) || defined(__bsdi__)) && \
+ (defined(sparc) || defined(__sparc__))
# define WIDTH_FAST 1152
# endif
@@ -140,6 +144,119 @@ in this Software without prior written authorization from The Open Group.
# endif
#endif
+#if PSZ == 24
+#define PXL2ADR(x) ((x)*3 >> 2)
+
+#if RROP == GXcopy
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
+ *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
+ *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
+ break; \
+ }
+#endif
+#if RROP == GXxor
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp ^= piQxelXor[0] & 0xFFFFFF; \
+ break; \
+ case 1: \
+ *addrp ^= piQxelXor[2] & 0xFFFFFF00; \
+ break; \
+ case 3: \
+ *addrp ^= piQxelXor[0] & 0xFF000000; \
+ *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \
+ break; \
+ case 2: \
+ *addrp ^= piQxelXor[1] & 0xFFFF0000; \
+ *(addrp+1) ^= piQxelXor[2] & 0xFF; \
+ break; \
+ }
+#endif
+#if RROP == GXand
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp &= piQxelAnd[0] | 0xFF000000; \
+ break; \
+ case 1: \
+ *addrp &= piQxelAnd[2] | 0xFF; \
+ break; \
+ case 3: \
+ *addrp &= 0xFFFFFF | piQxelAnd[0]; \
+ *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \
+ break; \
+ case 2: \
+ *addrp &= 0xFFFF | piQxelAnd[1]; \
+ *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \
+ break; \
+ }
+#endif
+#if RROP == GXor
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp |= piQxelOr[0] & 0xFFFFFF; \
+ break; \
+ case 1: \
+ *addrp |= piQxelOr[2] & 0xFFFFFF00; \
+ break; \
+ case 3: \
+ *addrp |= piQxelOr[0] & 0xFF000000; \
+ *(addrp+1) |= piQxelOr[1] & 0xFFFF; \
+ break; \
+ case 2: \
+ *addrp |= piQxelOr[1] & 0xFFFF0000; \
+ *(addrp+1) |= piQxelOr[2] & 0xFF; \
+ break; \
+ }
+#endif
+#if RROP == GXset
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \
+ ^ (piQxelXor[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \
+ ^ (piQxelXor[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \
+ ^ (piQxelXor[0] & 0xFF000000); \
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \
+ ^ (piQxelXor[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \
+ ^ (piQxelXor[1] & 0xFFFF0000); \
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \
+ ^ (piQxelXor[2] & 0xFF); \
+ break; \
+ }
+#endif
+#endif /* PSZ == 24 */
+
+#define BUGFIX_clip
+
#ifdef INCLUDE_DRAW
int
@@ -158,7 +275,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
int npt; /* number of points */
DDXPointPtr pptInit, pptInitOrig;
int *x1p, *y1p, *x2p, *y2p;
-#endif /* POLYSEGEMENT */
+#endif /* POLYSEGMENT */
{
register long e;
register int y1_or_e1;
@@ -180,8 +297,8 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
#else
register int c2;
#endif
-#ifndef ORIGIN
- register int _x1, _y1, _x2, _y2; /* only used for CoordModePrevious */
+#if !defined(ORIGIN) && !defined(POLYSEGMENT)
+ register int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
int extents_x1, extents_y1, extents_x2, extents_y2;
#endif /* !ORIGIN */
#ifndef PREVIOUS
@@ -213,6 +330,16 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
cfbPrivGCPtr devPriv;
BoxPtr extents;
int *ppt;
+#if PSZ == 24
+ int xBase; /* x of addr */
+ int xOffset; /* x of addrp */
+ PixelType *addrLineEnd;
+ char *addrb;
+ int stepmajor3, stepminor3, majordx, minordx;
+#endif
+#ifdef BUGFIX_clip
+ int ex_x1, ex_y1, ex_x2, ex_y2;
+#endif
int octant;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
@@ -221,14 +348,25 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
#ifndef REARRANGE
RROP_FETCH_GCPRIV(devPriv);
#endif
- extents = &devPriv->pCompositeClip->extents;
+ extents = &pGC->pCompositeClip->extents;
#ifndef PREVIOUS
c2 = *((int *) &pDrawable->x);
c2 -= (c2 & 0x8000) << 1;
upperleft = *((int *) &extents->x1) - c2;
lowerright = *((int *) &extents->x2) - c2 - 0x00010001;
#endif /* !PREVIOUS */
+#ifdef BUGFIX_clip
+ ex_x1 = extents->x1 - pDrawable->x;
+ ex_y1 = extents->y1 - pDrawable->y;
+ ex_x2 = extents->x2 - pDrawable->x;
+ ex_y2 = extents->y2 - pDrawable->y;
+#endif
+#if PSZ == 24
+ xBase = pDrawable->x;
+ addr += WIDTH_MUL(pDrawable->y,nwidth);
+#else
addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x;
+#endif
#ifdef POLYSEGMENT
capStyle = pGC->capStyle - CapNotLast;
ppt = (int *) pSegInit;
@@ -256,7 +394,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
*y2p = _y1 + _y2;
return 1;
}
+#if PSZ == 24
+ addrLineEnd = addr + WIDTH_MUL(_y1, nwidth);
+ xOffset = xBase + _x1;
+ addrb = (char *)addrLineEnd + xOffset * 3;
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#else
addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1;
+#endif
_x2 = _x1;
_y2 = _y1;
}
@@ -275,7 +420,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
#ifdef SAVE_X2Y2
intToCoord(c2,x2,y2);
#endif
+#if PSZ == 24
+ addrLineEnd = addr + WIDTH_MUL(Y2, nwidth);
+ xOffset = xBase + X2;
+ addrb = (char *)addrLineEnd + xOffset * 3;
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#else
addrp = addr + WIDTH_MUL(Y2, nwidth) + X2;
+#endif
}
#endif /* !PREVIOUS */
while (--npt)
@@ -289,7 +441,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
break;
intToCoord(y1_or_e1,x1_or_len,y1_or_e1);
/* compute now to avoid needing x1, y1 later */
+#if PSZ == 24
+ addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth);
+ xOffset = xBase + x1_or_len;
+ addrb = (char *)addrLineEnd + xOffset * 3;
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#else
addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len;
+#endif
#else /* !POLYSEGMENT */
#ifdef EITHER_MODE
if (!mode)
@@ -304,8 +463,13 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
_x2 = _x1 + _x2;
_y2 = _y1 + _y2;
+#ifdef BUGFIX_clip
+ if (_x2 < ex_x1 || _x2 >= ex_x2 ||
+ _y2 < ex_y1 || _y2 >= ex_y2)
+#else
if (_x2 < extents_x1 || _x2 >= extents_x2 ||
_y2 < extents_y1 || _y2 >= extents_y2)
+#endif
{
break;
}
@@ -384,6 +548,32 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
FIXUP_ERROR(e, octant, bias);
+#if PSZ == 24
+ if (stepmajor == 1 || stepmajor == -1){
+ stepmajor3 = stepmajor * 3;
+ stepminor3 = stepminor * sizeof (CfbBits);
+ majordx = stepmajor; minordx = 0;
+ } else {
+ stepmajor3 = stepmajor * sizeof (CfbBits);
+ stepminor3 = stepminor * 3;
+ majordx = 0; minordx = stepminor;
+ }
+#endif
+
+#if PSZ == 24
+#define body {\
+ body_rop \
+ addrb += stepmajor3; \
+ xOffset += majordx; \
+ e += y1_or_e1; \
+ if (e >= 0){ \
+ addrb += stepminor3; \
+ xOffset += minordx; \
+ e += e3; \
+ } \
+ }
+#else /* PSZ == 24 */
+
#define body {\
RROP_SOLID(addrp); \
addrp += stepmajor; \
@@ -394,6 +584,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
e += e3; \
} \
}
+#endif /* PSZ == 24 */
#ifdef LARGE_INSTRUCTION_CACHE
@@ -447,13 +638,20 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
#endif /* LARGE_INSTRUCTION_CACHE */
#ifdef POLYSEGMENT
+#if PSZ == 24
+ body_rop
+#else
RROP_SOLID(addrp);
#endif
+#endif
+#if PSZ == 24
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#endif
}
#undef body
#ifdef POLYSEGMENT
}
- else
+ else /* Polysegment horizontal line optimization */
{
# ifdef REARRANGE
register int e3;
@@ -462,19 +660,40 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
# endif /* REARRANGE */
if (stepmajor < 0)
{
+#if PSZ == 24
+ xOffset -= x1_or_len;
+ addrp = addrLineEnd + PXL2ADR(xOffset);
+#else
addrp -= x1_or_len;
+#endif
if (capStyle)
x1_or_len++;
else
+#if PSZ == 24
+ xOffset++;
+ addrp = addrLineEnd + PXL2ADR(xOffset);
+#else
addrp++;
+#endif
}
else
{
+#if PSZ == 24
+ addrp = addrLineEnd + PXL2ADR(xOffset);
+#endif
if (capStyle)
x1_or_len++;
}
- y1_or_e1 = ((int) addrp) & PIM;
+# if PSZ == 24
+ y1_or_e1 = xOffset & 3;
+# else
+# if PGSZ == 64 /* PIM value from <cfbmskbits.h> is not it! (for 16/32 PSZ)*/
+ y1_or_e1 = ((long) addrp) & 0x7;
addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1);
+# else
+ y1_or_e1 = ((long) addrp) & PIM;
+ addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1);
+# endif
#if PGSZ == 32
# if PWSH != 2
y1_or_e1 >>= (2 - PWSH);
@@ -484,12 +703,219 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
y1_or_e1 >>= (3 - PWSH);
# endif
#endif /* PGSZ */
+# endif /* PSZ == 24 */
+#if PSZ == 24
+ {
+#if RROP == GXcopy
+ register int nlmiddle;
+ int leftIndex = xOffset & 3;
+ int rightIndex = (xOffset + x1_or_len) & 3;
+#else
+ register int pidx;
+#endif
+
+#if RROP == GXcopy
+ nlmiddle = x1_or_len;
+ if(leftIndex){
+ nlmiddle -= (4 - leftIndex);
+ }
+ if(rightIndex){
+ nlmiddle -= rightIndex;
+ }
+
+ nlmiddle >>= 2;
+ switch(leftIndex+x1_or_len){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp = piQxelXor[2];
+ break;
+ case 1:
+ *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ addrp++;
+ *addrp = piQxelXor[1];
+ addrp++;
+ *addrp = piQxelXor[2];
+ break;
+ case 2:
+ *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ addrp++;
+ *addrp = piQxelXor[2];
+ break;
+ case 3:
+ *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ case 1:
+ *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ addrp++;
+ *addrp = piQxelXor[1];
+ addrp++;
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ case 2:
+ *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ addrp++;
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ }
+ break;
+ case 2:
+ switch(leftIndex){
+/*
+ case 2:
+ *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ addrp++;
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+*/
+ case 1:
+ *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ addrp++;
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ case 0:
+ *addrp++ = piQxelXor[0];
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ if(x1_or_len){
+ *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ }
+/*
+ else{
+ *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ addrp++;
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ }
+*/
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+/*
+ maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len)
+*/
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ addrp++;
+ *addrp = piQxelXor[1];
+ addrp++;
+ *addrp = piQxelXor[2];
+ addrp++;
+ break;
+ case 2:
+ *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ addrp++;
+ *addrp = piQxelXor[2];
+ addrp++;
+ break;
+ case 3:
+ *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ addrp++;
+ break;
+ }
+ while(nlmiddle--){
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp++ = piQxelXor[2];
+ }
+ switch(rightIndex++){
+ case 0:
+ break;
+ case 1:
+ *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *addrp++ = piQxelXor[0];
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ case 3:
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ }
+/*
+ if (e3){
+ e3 &= 0xFFFFFF;
+ switch(rightIndex&3){
+ case 0:
+ *addrp = ((*addrp) & (0xFF000000 | ~e3))
+ | (piQxelXor[0] & 0xFFFFFF & e3);
+ break;
+ case 1:
+ *addrp = ((*addrp) & (0xFFFFFF | ~(e3<<24)))
+ + (piQxelXor[0] & 0xFF000000 & (e3<<24));
+ addrp++;
+ *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8)))
+ | (piQxelXor[1] & 0xFFFF & (e3 >> 8));
+ break;
+ case 2:
+ *addrp = ((*addrp) & (0xFFFF|~(e3 << 16)))
+ | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16));
+ addrp++;
+ *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16)))
+ | (piQxelXor[2] & 0xFF & (e3 >> 16));
+ break;
+ case 3:
+ *addrp = ((*addrp) & (0xFF|~(e3<<8)))
+ | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8));
+ addrp++;
+ break;
+ }
+ }
+*/
+ }
+ }
+#else /* GXcopy */
+ addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03));
+ if (x1_or_len <= 1){
+ if (x1_or_len)
+ RROP_SOLID24(addrp, xOffset);
+ } else {
+ maskbits(xOffset, x1_or_len, e, e3, x1_or_len);
+ pidx = xOffset & 3;
+ if (e){
+ RROP_SOLID_MASK(addrp, e, pidx-1);
+ addrp++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ while (--x1_or_len >= 0){
+ RROP_SOLID(addrp, pidx);
+ addrp++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (e3)
+ RROP_SOLID_MASK(addrp, e3, pidx);
+ }
+#endif /* GXcopy */
+ }
+#else /* PSZ == 24 */
if (y1_or_e1 + x1_or_len <= PPW)
{
if (x1_or_len)
{
maskpartialbits(y1_or_e1, x1_or_len, e)
- RROP_SOLID_MASK((unsigned long *) addrp, e);
+ RROP_SOLID_MASK((CfbBits *) addrp, e);
}
}
else
@@ -497,13 +923,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len)
if (e)
{
- RROP_SOLID_MASK((unsigned long *) addrp, e);
+ RROP_SOLID_MASK((CfbBits *) addrp, e);
addrp += PPW;
}
RROP_SPAN(addrp, x1_or_len)
if (e3)
- RROP_SOLID_MASK((unsigned long *) addrp, e3);
+ RROP_SOLID_MASK((CfbBits *) addrp, e3);
}
+#endif /* PSZ == 24 */
}
#endif /* POLYSEGMENT */
}
@@ -526,9 +953,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
#endif /* !ORIGIN */
return ((DDXPointPtr) ppt - pptInit) - 1;
}
-#endif /* POLYSEGMENT */
-#ifndef POLYSEGMENT
# ifndef ORIGIN
# define C2 c2
# else
@@ -558,7 +983,100 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
RROP_FETCH_GCPRIV(devPriv);
# endif
+#if PSZ == 24
+#if RROP == GXcopy
+ switch(xOffset & 3){
+ case 0:
+ *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 3:
+ *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00);
+ break;
+ case 1:
+ *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000);
+ *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000);
+ *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF);
+ break;
+ }
+#endif
+#if RROP == GXxor
+ switch(xOffset & 3){
+ case 0:
+ *addrp ^= (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 3:
+ *addrp ^= (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ case 1:
+ *addrp ^= (piQxelXor[0] & 0xFF000000);
+ *(addrp+1) ^= (piQxelXor[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp ^= (piQxelXor[1] & 0xFFFF0000);
+ *(addrp+1) ^= (piQxelXor[2] & 0xFF);
+ break;
+ }
+#endif
+#if RROP == GXand
+ switch(xOffset & 3){
+ case 0:
+ *addrp &= (piQxelAnd[0] | 0xFF000000);
+ break;
+ case 3:
+ *addrp &= (piQxelAnd[2] | 0xFF);
+ break;
+ case 1:
+ *addrp &= (0xFFFFFF|piQxelAnd[0]);
+ *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]);
+ break;
+ case 2:
+ *addrp &= (0xFFFF|piQxelAnd[1]);
+ *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]);
+ break;
+ }
+#endif
+#if RROP == GXor
+ switch(xOffset & 3){
+ case 0:
+ *addrp |= (piQxelOr[0] & 0xFFFFFF);
+ break;
+ case 3:
+ *addrp |= (piQxelOr[2] & 0xFFFFFF00);
+ break;
+ case 1:
+ *addrp |= (piQxelOr[0] & 0xFF000000);
+ *(addrp+1) |= (piQxelOr[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp |= (piQxelOr[1] & 0xFFFF0000);
+ *(addrp+1) |= (piQxelOr[2] & 0xFF);
+ break;
+ }
+#endif
+#if RROP == GXset
+ switch(xOffset & 3){
+ case 0:
+ *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF));
+ break;
+ case 3:
+ *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00));
+ break;
+ case 1:
+ *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000));
+ *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF));
+ break;
+ case 2:
+ *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000));
+ *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF));
+ break;
+ }
+#endif
+#else
RROP_SOLID (addrp);
+# endif
}
#endif /* !POLYSEGMENT */
return -1;
@@ -578,14 +1096,21 @@ cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit)
int nseg;
xSegment *pSegInit;
{
- int (*func)();
- void (*clip)();
+ int (*func)(DrawablePtr, GCPtr, int, xSegment *);
+ void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool);
int drawn;
cfbPrivGCPtr devPriv;
+#if defined(__arm32__) && PSZ != 8
+ /* XXX -JJK */
+ /* There is a painting bug when PSZ != 8; I need to track it down! */
+ cfbSegmentSS(pDrawable, pGC, nseg, pSegInit);
+ return;
+#endif
+
devPriv = cfbGetGCPrivate(pGC);
#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1)
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
{
cfbSegmentSS(pDrawable, pGC, nseg, pSegInit);
return;
@@ -618,7 +1143,7 @@ cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit)
(*clip) (pDrawable, pGC,
pSegInit[drawn-1].x1, pSegInit[drawn-1].y1,
pSegInit[drawn-1].x2, pSegInit[drawn-1].y2,
- &devPriv->pCompositeClip->extents,
+ &pGC->pCompositeClip->extents,
pGC->capStyle == CapNotLast);
pSegInit += drawn;
nseg -= drawn;
@@ -635,16 +1160,25 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit)
int npt;
DDXPointPtr pptInit;
{
- int (*func)();
- void (*clip)();
+ int (*func)(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr, DDXPointPtr,
+ int *, int *, int *, int *);
+ void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool);
int drawn;
cfbPrivGCPtr devPriv;
int x1, y1, x2, y2;
DDXPointPtr pptInitOrig = pptInit;
+#if defined(__arm32__) && PSZ != 8
+ /* XXX -JJK */
+ /* There is a painting bug when PSZ != 8; I need to track it down! */
+ cfbLineSS(pDrawable, pGC, mode, npt, pptInit);
+ return;
+#endif
+
devPriv = cfbGetGCPrivate(pGC);
#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1)
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
{
cfbLineSS(pDrawable, pGC, mode, npt, pptInit);
return;
@@ -678,7 +1212,7 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit)
if (drawn == -1)
break;
(*clip) (pDrawable, pGC, x1, y1, x2, y2,
- &devPriv->pCompositeClip->extents,
+ &pGC->pCompositeClip->extents,
drawn != npt - 1 || pGC->capStyle == CapNotLast);
pptInit += drawn;
npt -= drawn;
@@ -697,7 +1231,7 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit)
(*clip) (pDrawable, pGC,
pptInit[drawn-1].x, pptInit[drawn-1].y,
pptInit[drawn].x, pptInit[drawn].y,
- &devPriv->pCompositeClip->extents,
+ &pGC->pCompositeClip->extents,
drawn != npt - 1 || pGC->capStyle == CapNotLast);
pptInit += drawn;
npt -= drawn;
@@ -729,6 +1263,12 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
int new_x1, new_y1, new_x2, new_y2;
Bool pt1_clipped, pt2_clipped;
int changex, changey, result;
+#if PSZ == 24
+ int xOffset;
+ PixelType *addrLineEnd;
+ char *addrb;
+ int stepx3, stepy3;
+#endif
int octant;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
@@ -841,12 +1381,32 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
RROP_FETCH_GC(pGC);
+#if PSZ == 24
+ xOffset = x1;
+ addrLineEnd = addr + (y1 * nwidth);
+ addrb = (char *)addrLineEnd + x1 * 3;
+ if (stepx == 1 || stepx == -1){
+ stepx3 = stepx * 3;
+ stepy3 = stepy * sizeof (CfbBits);
+ } else {
+ stepx3 = stepx * sizeof (CfbBits);
+ stepy3 = stepy * 3;
+ }
+#else
addrp = addr + (y1 * nwidth) + x1;
+#endif
#ifndef REARRANGE
if (!ady)
{
+#if PSZ == 24
+#define body {\
+ body_rop \
+ addrb += stepx3; \
+ }
+#else
#define body { RROP_SOLID(addrp); addrp += stepx; }
+#endif
while (len >= PGSZB)
{
body body body body
@@ -867,6 +1427,18 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
else
#endif /* !REARRANGE */
{
+#if PSZ == 24
+#define body {\
+ body_rop \
+ addrb += stepx3; \
+ e += e1; \
+ if (e >= 0) \
+ { \
+ addrb += stepy3; \
+ e += e3; \
+ } \
+ }
+#else
#define body {\
RROP_SOLID(addrp); \
addrp += stepx; \
@@ -877,6 +1449,7 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
e += e3; \
} \
}
+#endif
#ifdef LARGE_INSTRUCTION_CACHE
while ((len -= PGSZB) >= 0)
@@ -906,7 +1479,11 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
IMPORTANT_END;
#endif /* LARGE_INSTRUCTION_CACHE */
}
+#if PSZ == 24
+ body_rop
+#else
RROP_SOLID(addrp);
+#endif
#undef body
}
}
diff --git a/cfb/cfballpriv.c b/cfb/cfballpriv.c
index abd634e2c..6c2fa30f3 100644
--- a/cfb/cfballpriv.c
+++ b/cfb/cfballpriv.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfballpriv.c,v 1.12 2001/12/14 19:59:21 dawes Exp $ */
#include "X.h"
#include "Xmd.h"
@@ -41,13 +42,15 @@ in this Software without prior written authorization from The Open Group.
#include "cfbmskbits.h"
#include "mibstore.h"
+#if PSZ==8
int cfbWindowPrivateIndex;
int cfbGCPrivateIndex;
+#endif
#ifdef CFB_NEED_SCREEN_PRIVATE
-int cfbScreenPrivateIndex;
+int cfbScreenPrivateIndex = -1;
+static unsigned long cfbGeneration = 0;
#endif
-extern RegionPtr (*cfbPuntCopyPlane)();
Bool
cfbAllocatePrivates(pScreen, window_index, gc_index)
@@ -55,7 +58,7 @@ cfbAllocatePrivates(pScreen, window_index, gc_index)
int *window_index, *gc_index;
{
if (!window_index || !gc_index ||
- *window_index == -1 && *gc_index == -1)
+ (*window_index == -1 && *gc_index == -1))
{
if (!mfbAllocatePrivates(pScreen,
&cfbWindowPrivateIndex, &cfbGCPrivateIndex))
@@ -74,9 +77,12 @@ cfbAllocatePrivates(pScreen, window_index, gc_index)
sizeof(cfbPrivWin)) ||
!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
return FALSE;
- cfbPuntCopyPlane = miCopyPlane;
#ifdef CFB_NEED_SCREEN_PRIVATE
- cfbScreenPrivateIndex = AllocateScreenPrivateIndex ();
+ if (cfbGeneration != serverGeneration)
+ {
+ cfbScreenPrivateIndex = AllocateScreenPrivateIndex ();
+ cfbGeneration = serverGeneration;
+ }
if (cfbScreenPrivateIndex == -1)
return FALSE;
#endif
diff --git a/cfb/cfbbitblt.c b/cfb/cfbbitblt.c
index 3afe4eb81..595d68c66 100644
--- a/cfb/cfbbitblt.c
+++ b/cfb/cfbbitblt.c
@@ -2,6 +2,8 @@
* cfb copy area
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.14 2001/12/14 19:59:21 dawes Exp $ */
+
/*
Copyright 1989, 1998 The Open Group
@@ -39,6 +41,7 @@ Author: Keith Packard
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
+#include "mi.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
@@ -46,6 +49,25 @@ Author: Keith Packard
#define MFB_CONSTS_ONLY
#include "maskbits.h"
+#if PSZ == 8
+#define cfbCopyPlane1toN cfbCopyPlane1to8
+#define cfbCopyPlaneNto1 cfbCopyPlane8to1
+#else
+static unsigned int FgPixel, BgPixel;
+# if PSZ == 16
+#define cfbCopyPlane1toN cfbCopyPlane1to16
+#define cfbCopyPlaneNto1 cfbCopyPlane16to1
+# endif
+# if PSZ == 24
+#define cfbCopyPlane1toN cfbCopyPlane1to24
+#define cfbCopyPlaneNto1 cfbCopyPlane24to1
+# endif
+# if PSZ == 32
+#define cfbCopyPlane1toN cfbCopyPlane1to32
+#define cfbCopyPlaneNto1 cfbCopyPlane32to1
+# endif
+#endif
+
RegionPtr
cfbBitBlt (pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane)
@@ -58,7 +80,7 @@ cfbBitBlt (pSrcDrawable, pDstDrawable,
void (*doBitBlt)();
unsigned long bitPlane;
{
- RegionPtr prgnSrcClip; /* may be a new region, or just a copy */
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
Bool freeSrcClip = FALSE;
RegionPtr prgnExposed;
@@ -110,7 +132,13 @@ cfbBitBlt (pSrcDrawable, pDstDrawable,
{
if (pGC->subWindowMode == IncludeInferiors)
{
- if (!((WindowPtr) pSrcDrawable)->parent)
+ /*
+ * XFree86 DDX empties the border clip when the
+ * VT is inactive
+ */
+ if (!((WindowPtr) pSrcDrawable)->parent &&
+ REGION_NOTEMPTY (pSrcDrawable->pScreen,
+ &((WindowPtr) pSrcDrawable)->borderClip))
{
/*
* special case bitblt from root window in
@@ -279,7 +307,7 @@ cfbBitBlt (pSrcDrawable, pDstDrawable,
}
prgnExposed = NULL;
- if ( cfbGetGCPrivate(pGC)->fExpose)
+ if (pGC->fExpose)
{
extern RegionPtr miHandleExposures();
@@ -376,22 +404,22 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
int width, height; /* in pixels, unpadded, of box being copied */
int xoffSrc; /* bit # in leftmost word of row from which copying starts */
int xoffDst; /* byte # in leftmost word of row from which copying starts */
- unsigned long *psrcBase, *pdstBase; /* start of drawable's pixel data */
+ CfbBits *psrcBase, *pdstBase; /* start of drawable's pixel data */
int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/
int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */
- unsigned long *psrcLine, *pdstLine; /* steps a row at a time thru src/dst;
+ CfbBits *psrcLine, *pdstLine; /* steps a row at a time thru src/dst;
* may point into middle of row */
- register unsigned long *psrc, *pdst; /* steps within the row */
- register unsigned long bits, tmp; /* bits from source */
+ register CfbBits *psrc, *pdst; /* steps within the row */
+ register CfbBits bits, tmp; /* bits from source */
register int leftShift;
register int rightShift;
- unsigned long startmask; /* left edge pixel mask */
- unsigned long endmask; /* right edge pixel mask */
+ CfbBits startmask; /* left edge pixel mask */
+ CfbBits endmask; /* right edge pixel mask */
register int nlMiddle; /* number of words in middle of the row to draw */
register int nl;
- int firstoff;
- int secondoff;
- unsigned long src;
+ int firstoff = 0;
+ int secondoff = 0;
+ CfbBits src;
int nbox; /* number of boxes in region to copy */
BoxPtr pbox; /* steps thru boxes in region */
int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after
@@ -529,11 +557,11 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
# define FirstStep(c) c = BitLeft (c, 8);
#else
/* 0x3c is 0xf << 2 (4 bits, long word) */
-# define StoreBits(o,c) StorePixels(pdst,o,*((unsigned long *)\
+# define StoreBits(o,c) StorePixels(pdst,o,*((CfbBits *)\
(((char *) cfb8Pixels) + (c & 0x3c))))
# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \
- *((unsigned long *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \
- *((unsigned long *) (((char *) cfb8StippleXor) + (c & 0x3c))))
+ *((CfbBits *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \
+ *((CfbBits *) (((char *) cfb8StippleXor) + (c & 0x3c))))
# define FirstStep(c) c = BitLeft (c, 2);
#endif /* PGSZ */
#endif /* BITMAP_BIT_ORDER */
@@ -662,10 +690,379 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, b
} /* end iteration over region boxes */
}
+#else /* PSZ == 8 */
+
+#define mfbmaskbits(x, w, startmask, endmask, nlw) \
+ startmask = starttab[(x)&0x1f]; \
+ endmask = endtab[((x)+(w)) & 0x1f]; \
+ if (startmask) \
+ nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
+ else \
+ nlw = (w) >> 5;
+
+#define mfbmaskpartialbits(x, w, mask) \
+ mask = partmasks[(x)&0x1f][(w)&0x1f];
+
+#define LeftMost 0
+#define StepBit(bit, inc) ((bit) += (inc))
+
+
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
+ StepBit (curBit, 1); \
+ } \
+}
+
+/******************************************************************/
+
+void
+#if PSZ == 16
+cfbCopyPlane1to16 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 24
+cfbCopyPlane1to24 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 32
+cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ unsigned long planemask;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long bitPlane;
+{
+ int srcx, srcy, dstx, dsty;
+ int width, height;
+ int xoffSrc;
+ CfbBits *psrcBase, *pdstBase;
+ int widthSrc, widthDst;
+ unsigned int *psrcLine;
+ register unsigned int *psrc;
+#if PSZ == 16
+ unsigned short *pdstLine;
+ register unsigned short *pdst;
+#endif
+#if PSZ == 32
+ unsigned int *pdstLine;
+ register unsigned int *pdst;
+#endif
+#if PSZ == 24
+ unsigned char *pdstLine;
+ register unsigned char *pdst;
+#endif
+ register unsigned int bits, tmp;
+ register unsigned int fgpixel, bgpixel;
+ register unsigned int src;
+#if PSZ == 24
+ register unsigned int dst;
+#endif
+ register int leftShift, rightShift;
+ register int i, nl;
+ int nbox;
+ BoxPtr pbox;
+ int result;
+
+#if PSZ == 16
+ unsigned int doublet[4]; /* Pixel values for 16bpp expansion. */
+#endif
+#if PSZ == 32
+ unsigned int doublet[8]; /* Pixel values for 32bpp expansion */
+#endif
+
+ fgpixel = FgPixel & planemask;
+ bgpixel = BgPixel & planemask;
+
+#if PSZ == 16
+ if (rop == GXcopy && (planemask & PMSK) == PMSK) {
+ doublet[0] = bgpixel | (bgpixel << 16);
+ doublet[1] = fgpixel | (bgpixel << 16);
+ doublet[2] = bgpixel | (fgpixel << 16);
+ doublet[3] = fgpixel | (fgpixel << 16);
+ }
+#endif
+#if PSZ == 32
+ if (rop == GXcopy && (planemask & PMSK) == PMSK) {
+ doublet[0] = bgpixel; doublet[1] = bgpixel;
+ doublet[2] = fgpixel; doublet[3] = bgpixel;
+ doublet[4] = bgpixel; doublet[5] = fgpixel;
+ doublet[6] = fgpixel; doublet[7] = fgpixel;
+ }
+#endif
+
+ /* must explicitly ask for "int" widths, as code below expects it */
+ /* on some machines (Alpha), "long" and "int" are not the same size */
+ cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits)
+ cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits)
+
+#if PSZ == 16
+ widthDst <<= 1;
+#endif
+#if PSZ == 24
+ widthDst <<= 2;
+#endif
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+ psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + (srcx >> 5);
+#if PSZ == 16
+ pdstLine = (unsigned short *)pdstBase + dsty * widthDst + dstx;
+#endif
+#if PSZ == 24
+ pdstLine = (unsigned char *)pdstBase + dsty * widthDst + dstx * 3;
+#endif
+#if PSZ == 32
+ pdstLine = (unsigned int *)pdstBase + dsty * widthDst + dstx;
+#endif
+ xoffSrc = srcx & 0x1f;
+
+ /*
+ * compute constants for the first four bits to be
+ * copied. This avoids troubles with partial first
+ * writes, and difficult shift computation
+ */
+ leftShift = xoffSrc;
+ rightShift = 32 - leftShift;
+
+ if (rop == GXcopy && (planemask & PMSK) == PMSK)
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ bits = *psrc++;
+ nl = width;
+ while (nl >= 32)
+ {
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ if (rightShift != 32)
+ tmp |= BitRight(bits, rightShift);
+ i = 0;
+#if PSZ == 16
+ /*
+ * I've thrown in some optimization to at least write
+ * some aligned 32-bit words instead of 16-bit shorts.
+ */
+ if ((unsigned long)psrc & 2) {
+ /* Write unaligned 16-bit word at left edge. */
+ if (tmp & 0x01)
+ *pdst = fgpixel;
+ else
+ *pdst = bgpixel;
+ pdst++;
+ i++;
+ }
+ while (i <= 24)
+ {
+ unsigned tmpbits = tmp >> i;
+ *(unsigned int *)pdst = doublet[tmpbits & 0x03];
+ *(unsigned int *)(pdst + 2) =
+ doublet[(tmpbits >> 2) & 0x03];
+ *(unsigned int *)(pdst + 4) =
+ doublet[(tmpbits >> 4) & 0x03];
+ *(unsigned int *)(pdst + 6) =
+ doublet[(tmpbits >> 6) & 0x03];
+ pdst += 8; /* Advance four 32-bit words. */
+ i += 8;
+ }
+ while (i <= 30)
+ {
+ *(unsigned int *)pdst =
+ doublet[(tmp >> i) & 0x03];
+ pdst += 2; /* Advance one 32-bit word. */
+ i += 2;
+ }
+ if (i == 31) {
+ if ((tmp >> 31) & 0x01)
+ *pdst = fgpixel;
+ else
+ *pdst = bgpixel;
+ pdst++;
+ }
+#endif
+#if PSZ == 24
+ while (i < 32) {
+ if ((tmp >> i) & 0x01) {
+ *pdst = fgpixel;
+ *(pdst + 1) = fgpixel >> 8;
+ *(pdst + 2) = fgpixel >> 16;
+ }
+ else {
+ *pdst = bgpixel;
+ *(pdst + 1) = bgpixel >> 8;
+ *(pdst + 2) = bgpixel >> 16;
+ }
+ pdst += 3;
+ i++;
+ }
+#endif
+#if PSZ == 32
+ while (i <= 28) {
+ int pair;
+ pair = (tmp >> i) & 0x03;
+ *pdst = doublet[pair * 2];
+ *(pdst + 1) = doublet[pair * 2 + 1];
+ pair = (tmp >> (i + 2)) & 0x03;
+ *(pdst + 2) = doublet[pair * 2];
+ *(pdst + 3) = doublet[pair * 2 + 1];
+ pdst += 4;
+ i += 4;
+ }
+ while (i < 32) {
+ *pdst = ((tmp >> i) & 0x01) ? fgpixel : bgpixel;
+ pdst++;
+ i++;
+ }
#endif
+ nl -= 32;
+ }
+
+ if (nl)
+ {
+ tmp = BitLeft(bits, leftShift);
+ /*
+ * better condition needed -- mustn't run
+ * off the end of the source...
+ */
+ if (rightShift != 32)
+ {
+ bits = *psrc++;
+ tmp |= BitRight (bits, rightShift);
+ }
+ i = 32;
+ while (nl--)
+ {
+ --i;
+#if PSZ == 24
+ if ((tmp >> (31 - i)) & 0x01) {
+ *pdst = fgpixel;
+ *(pdst + 1) = fgpixel >> 8;
+ *(pdst + 2) = fgpixel >> 16;
+ }
+ else {
+ *pdst = bgpixel;
+ *(pdst + 1) = bgpixel >> 8;
+ *(pdst + 2) = bgpixel >> 16;
+ }
+ pdst += 3;
+#else
+ *pdst = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
+ pdst++;
+#endif
+ }
+ }
+ }
+ }
+ else
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ bits = *psrc++;
+ nl = width;
+ while (nl >= 32)
+ {
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ if (rightShift != 32)
+ tmp |= BitRight(bits, rightShift);
+ i = 32;
+ while (i--)
+ {
+ src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
+#if PSZ == 24
+ dst = *pdst;
+ dst |= (*(pdst + 1)) << 8;
+ dst |= (*(pdst + 2)) << 16;
+ DoRop (result, rop, src, dst);
+ *pdst = (dst & ~planemask) |
+ (result & planemask);
+ *(pdst+1) = ((dst & ~planemask) >> 8) |
+ ((result & planemask) >> 8);
+ *(pdst+2) = ((dst & ~planemask) >> 16) |
+ ((result & planemask) >> 16);
+ pdst += 3;
+#else
+ DoRop (result, rop, src, *pdst);
+
+ *pdst = (*pdst & ~planemask) |
+ (result & planemask);
+ pdst++;
+#endif
+ }
+ nl -= 32;
+ }
+
+ if (nl)
+ {
+ tmp = BitLeft(bits, leftShift);
+ /*
+ * better condition needed -- mustn't run
+ * off the end of the source...
+ */
+ if (rightShift != 32)
+ {
+ bits = *psrc++;
+ tmp |= BitRight (bits, rightShift);
+ }
+ i = 32;
+ while (nl--)
+ {
+ --i;
+ src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
+#if PSZ == 24
+ dst = *pdst;
+ dst |= (*(pdst + 1)) << 8;
+ dst |= (*(pdst + 2)) << 16;
+ DoRop (result, rop, src, dst);
+ *pdst = (dst & ~planemask) |
+ (result & planemask);
+ *(pdst+1) = ((dst & ~planemask) >> 8) |
+ ((result & planemask) >> 8);
+ *(pdst+2) = ((dst & ~planemask) >> 16) |
+ ((result & planemask) >> 16);
+ pdst += 3;
+#else
+ DoRop (result, rop, src, *pdst);
+
+ *pdst = (*pdst & ~planemask) |
+ (result & planemask);
+ pdst++;
+#endif
+ }
+ }
+ }
+ }
+ }
+}
+
+#endif /* PSZ == 8 */
/* shared among all different cfb depths through linker magic */
-RegionPtr (*cfbPuntCopyPlane)();
RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)
@@ -678,19 +1075,24 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
unsigned long bitPlane;
{
RegionPtr ret;
- extern RegionPtr miHandleExposures();
- void (*doBitBlt)();
-#if PSZ == 8
+#if IMAGE_BYTE_ORDER == LSBFirst
+
+ void (*doBitBlt)();
- if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8)
+ if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == PSZ)
{
if (bitPlane == 1)
{
- doBitBlt = cfbCopyPlane1to8;
+ doBitBlt = cfbCopyPlane1toN;
+#if PSZ == 8
cfb8CheckOpaqueStipple (pGC->alu,
pGC->fgPixel, pGC->bgPixel,
pGC->planemask);
+#else
+ FgPixel = pGC->fgPixel;
+ BgPixel = pGC->bgPixel;
+#endif
ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane);
}
@@ -698,7 +1100,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
ret = miHandleExposures (pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
}
- else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 1)
+ else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == 1)
{
extern int InverseAlu[16];
int oldalu;
@@ -710,10 +1112,10 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty,
- cfbCopyPlane8to1, bitPlane);
+ cfbCopyPlaneNto1, bitPlane);
pGC->alu = oldalu;
}
- else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 8)
+ else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == PSZ)
{
PixmapPtr pBitmap;
ScreenPtr pScreen = pSrcDrawable->pScreen;
@@ -729,7 +1131,7 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
return NULL;
}
/*
- * don't need to set pGC->fgPixel,bgPixel as copyPlane8to1
+ * don't need to set pGC->fgPixel,bgPixel as copyPlaneNto1
* ignores pixel values, expecting the rop to "do the
* right thing", which GXcopy will.
*/
@@ -737,13 +1139,18 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
/* no exposures here, scratch GC's don't get graphics expose */
(void) cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap,
pGC1, srcx, srcy, width, height, 0, 0,
- cfbCopyPlane8to1, bitPlane);
+ cfbCopyPlaneNto1, bitPlane);
+#if PSZ == 8
cfb8CheckOpaqueStipple (pGC->alu,
pGC->fgPixel, pGC->bgPixel,
pGC->planemask);
+#else
+ FgPixel = pGC->fgPixel;
+ BgPixel = pGC->bgPixel;
+#endif
/* no exposures here, copy bits from inside a pixmap */
(void) cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC,
- 0, 0, width, height, dstx, dsty, cfbCopyPlane1to8, 1);
+ 0, 0, width, height, dstx, dsty, cfbCopyPlane1toN, 1);
FreeScratchGC (pGC1);
(*pScreen->DestroyPixmap) (pBitmap);
/* compute resultant exposures */
@@ -753,7 +1160,9 @@ RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
}
else
#endif
- ret = (*cfbPuntCopyPlane) (pSrcDrawable, pDstDrawable,
+ ret = miCopyPlane (pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
return ret;
}
+
+
diff --git a/cfb/cfbblt.c b/cfb/cfbblt.c
index f87acc03d..aafe44669 100644
--- a/cfb/cfbblt.c
+++ b/cfb/cfbblt.c
@@ -1,6 +1,7 @@
/*
* cfb copy area
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbblt.c,v 3.12 2001/12/14 19:59:21 dawes Exp $ */
/*
@@ -31,6 +32,8 @@ Author: Keith Packard
*/
/* $Xorg: cfbblt.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */
+/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */
+
#include "X.h"
#include "Xmd.h"
#include "Xproto.h"
@@ -55,6 +58,65 @@ Author: Keith Packard
#define DO_MEMCPY
#endif
+/* ................................................. */
+/* SPECIAL CODE FOR 24 BITS by Peter Wainwright */
+
+#if PSZ == 24 && (MROP) == 0
+
+/* The default macros are defined in mergerop.h, and none of them are
+ really appropriate for what we want to do.
+
+ There are two ways of fixing this: either define SLOW_24BIT_COPY
+ to copy pixel by pixel, or (by default) use the following macros
+ modified from mergerop.h
+
+ MROP_SOLID and MROP_MASK are defined for each of the operations,
+ i.e. each value of MROP.
+
+ There are special cases for Mcopy, McopyInverted, Mxor, and Mor.
+ There is a completely generic version for MROP=0, and a simplified
+ generic version which works for (Mcopy|Mxor|MandReverse|Mor).
+
+ However, the generic version does not work for the 24-bit case
+ because the pixels cannot be packed exactly into a machine word (32
+ bits).
+
+ Alternative macros MROP_SOLID24 and MROP_MASK24 are provided for
+ the 24-bit case. However, these each copy a single *pixel*, not a
+ single machine word. They take an rvalue source pixel, an lvalue
+ destination, and the pixel index. The latter is used to find the
+ position of the pixel data within the two words *dst and *(dst+1).
+
+ Further macros MROP_SOLID24P and MROP_MASK24P are used to copy from
+ an lvalue source to an lvalue destination. MROP_PIXEL24 is used to
+ assemble the source pixel from the adjacent words *src and
+ *(src+1), and this is then split between the destination words
+ using the non-P macros above.
+
+ But we want to copy entire words for the sake of efficiency.
+ Unfortunately if a plane mask is specified this must be shifted
+ from one word to the next. Fortunately the pattern repeats after 3
+ words, so we unroll the planemask here and redefine MROP_SOLID
+ and MROP_MASK. */
+
+
+#endif /* MROP == 0 && PSZ == 24 */
+
+/* ................................................. */
+
+#if PSZ == 24
+#define BYPP 3
+#if PGSZ == 32
+#define P3W 4 /* pixels in 3 machine words */
+#define PAM 3 /* pixel align mask; PAM = P3W -1 */
+#define P2WSH 2
+#else
+#define P3W 8 /* pixels in 3 machine words */
+#define PAM 7 /* pixel align mask; PAM = P3W -1 */
+#define P2WSH 3
+#endif
+#endif
+
void
MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
DrawablePtr pSrc, pDst;
@@ -63,7 +125,7 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
DDXPointPtr pptSrc;
unsigned long planemask;
{
- unsigned long *psrcBase, *pdstBase;
+ CfbBits *psrcBase, *pdstBase;
/* start of src and dst bitmaps */
int widthSrc, widthDst; /* add to get to same position in next line */
@@ -79,31 +141,42 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
int xdir; /* 1 = left right, -1 = right left/ */
int ydir; /* 1 = top down, -1 = bottom up */
- unsigned long *psrcLine, *pdstLine;
+ CfbBits *psrcLine, *pdstLine;
/* pointers to line with current src and dst */
- register unsigned long *psrc;/* pointer to current src longword */
- register unsigned long *pdst;/* pointer to current dst longword */
+ register CfbBits *psrc;/* pointer to current src longword */
+ register CfbBits *pdst;/* pointer to current dst longword */
MROP_DECLARE_REG()
/* following used for looping through a line */
- unsigned long startmask, endmask; /* masks for writing ends of dst */
+ CfbBits startmask, endmask; /* masks for writing ends of dst */
int nlMiddle; /* whole longwords in dst */
int xoffSrc, xoffDst;
- register int leftShift, rightShift;
- register unsigned long bits;
- register unsigned long bits1;
register int nl; /* temp copy of nlMiddle */
-
- /* place to store full source word */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
int careful;
- int tmpSrc;
- MROP_INITIALIZE(alu,planemask);
+#if (PSZ != 24) || (MROP != 0)
+ register int leftShift, rightShift;
+ register CfbBits bits;
+ register CfbBits bits1;
+#endif
+
+#if PSZ == 24
+#ifdef DO_MEMCPY
+ int w2;
+#endif
+
+#if MROP == 0
+ unsigned char *psrcBaseByte, *pdstBaseByte;
+ int widthSrcBytes, widthDstBytes;
+
+ cfbGetByteWidthAndPointer (pSrc, widthSrcBytes, psrcBaseByte)
+
+ cfbGetByteWidthAndPointer (pDst, widthDstBytes, pdstBaseByte)
+#endif
+#endif
+
+ MROP_INITIALIZE(alu,planemask)
cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase)
@@ -222,6 +295,11 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
w = pbox->x2 - pbox->x1;
h = pbox->y2 - pbox->y1;
+#if PSZ == 24
+#ifdef DO_MEMCPY
+ w2 = w * BYPP;
+#endif
+#endif
if (ydir == -1) /* start at last scanline of rectangle */
{
psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc);
@@ -232,7 +310,11 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
psrcLine = psrcBase + (pptSrc->y * widthSrc);
pdstLine = pdstBase + (pbox->y1 * widthDst);
}
+#if PSZ == 24
+ if (w == 1 && ((pbox->x1 & PAM) == 0 || (pbox->x1 & PAM) == PAM))
+#else
if ((pbox->x1 & PIM) + w <= PPW)
+#endif
{
maskpartialbits (pbox->x1, w, endmask);
startmask = 0;
@@ -243,58 +325,149 @@ MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
}
+#if PSZ == 24
+#if 0
+ nlMiddle = w - (pbox->x2 &PAM);;
+ if(pbox->x1 & PAM){
+ nlMiddle -= (PAM+1 - (pbox->x1 &PAM));
+ }
+ nlMiddle >>= P2WSH;
+ if(nlMiddle < 0)
+ nlMiddle = 0;
+#endif
+#endif
+
#ifdef DO_MEMCPY
/* If the src and dst scanline don't overlap, do forward case. */
if ((xdir == 1) || (pptSrc->y != pbox->y1)
|| (pptSrc->x + w <= pbox->x1))
{
+#if PSZ == 24
+ char *psrc = (char *) psrcLine + (pptSrc->x * BYPP);
+ char *pdst = (char *) pdstLine + (pbox->x1 * BYPP);
+#else
char *psrc = (char *) psrcLine + pptSrc->x;
char *pdst = (char *) pdstLine + pbox->x1;
+#endif
while (h--)
{
+#if PSZ == 24
+ memcpy(pdst, psrc, w2);
+#else
memcpy(pdst, psrc, w);
- pdst += widthDst << 2;
- psrc += widthSrc << 2;
+#endif
+ pdst += widthDst << PWSH;
+ psrc += widthSrc << PWSH;
}
}
#else /* ! DO_MEMCPY */
if (xdir == 1)
{
+#if PSZ == 24 && MROP == 0
+ /* Note: x is a pixel number; the byte offset is 3*x;
+ therefore the offset within a word is (3*x) & 3 ==
+ (4*x-x) & 3 == (-x) & 3. The offsets therefore
+ DECREASE by 1 for each pixel.
+ */
+ xoffSrc = ( - pptSrc->x) & PAM;
+ xoffDst = ( - pbox->x1) & PAM;
+#if 1
+ if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */
+ || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
+#else
+ if(1)
+#endif
+ /* Width also must be same, if hight > 1 */
+ {
+ /* ...otherwise, pixel by pixel operation */
+ while (h--)
+ {
+ register int i, si, sii, di;
+
+ for (i = 0, si = pptSrc->x, di = pbox->x1;
+ i < w;
+ i++, si++, di++) {
+ psrc = psrcLine + ((si * BYPP) >> P2WSH);
+ pdst = pdstLine + ((di * BYPP) >> P2WSH);
+ sii = (si & 3);
+ MROP_SOLID24P(psrc, pdst, sii, di);
+ }
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+ }
+ }
+ else
+#endif
+ {
+
+#if PSZ == 24
+
+#if MROP != 0
+ xoffSrc = ( - pptSrc->x) & PAM;
+ xoffDst = ( - pbox->x1) & PAM;
+#endif
+ pdstLine += (pbox->x1 * BYPP) >> P2WSH;
+ psrcLine += (pptSrc->x * BYPP) >> P2WSH;
+#else
xoffSrc = pptSrc->x & PIM;
xoffDst = pbox->x1 & PIM;
pdstLine += (pbox->x1 >> PWSH);
psrcLine += (pptSrc->x >> PWSH);
+#endif
#ifdef DO_UNALIGNED_BITBLT
nl = xoffSrc - xoffDst;
- psrcLine = (unsigned long *)
+ psrcLine = (CfbBits *)
(((unsigned char *) psrcLine) + nl);
#else
+#if PSZ == 24 && MROP == 0
+ /* alredy satisfied */
+#else
if (xoffSrc == xoffDst)
#endif
+#endif
{
while (h--)
{
+#if PSZ == 24 && MROP == 0
+ register int index;
+ register int im3;
+#endif /* PSZ == 24 && MROP == 0 */
psrc = psrcLine;
pdst = pdstLine;
pdstLine += widthDst;
psrcLine += widthSrc;
+#if PSZ == 24 && MROP == 0
+ index = (int)(pdst - pdstBase);
+ im3 = index % 3;
+#endif /* PSZ == 24 && MROP == 0 */
if (startmask)
{
+#if PSZ == 24 && MROP == 0
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, im3);
+ index++;
+ im3 = index % 3;
+#else /* PSZ != 24 || MROP != 0 */
*pdst = MROP_MASK(*psrc, *pdst, startmask);
+#endif /* PSZ == 24 && MROP == 0 */
psrc++;
pdst++;
}
- nl = nlMiddle;
+ nl = nlMiddle;
#ifdef LARGE_INSTRUCTION_CACHE
#ifdef FAST_CONSTANT_OFFSET_MODE
psrc += nl & (UNROLL-1);
pdst += nl & (UNROLL-1);
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
+#define BodyEven(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
+#else /* PSZ != 24 || MROP != 0 */
#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+#endif /* PSZ == 24 && MROP == 0 */
#define LoopReset \
pdst += UNROLL; \
@@ -302,8 +475,13 @@ psrc += UNROLL;
#else
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) *pdst = DoMergeRop24u(*psrc, *pdst, im3); pdst++; psrc++; index++; im3 = index % 3;
+#define BodyEven(n) BodyOdd(n)
+#else /* PSZ != 24 || MROP != 0 */
#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
#define BodyEven(n) BodyOdd(n)
+#endif /* PSZ == 24 && MROP == 0 */
#define LoopReset ;
@@ -333,34 +511,55 @@ psrc += UNROLL;
while (nl--)
*pdst++ = *psrc++;
#endif
+#if 0 /*PSZ == 24 && MROP == 0*/
+ DuffL(nl, label1,
+ *pdst = DoMergeRop24u(*psrc, *pdst, im3);
+ pdst++; psrc++; index++;im3 = index % 3;)
+#else /* !(PSZ == 24 && MROP == 0) */
DuffL(nl, label1,
*pdst = MROP_SOLID (*psrc, *pdst);
pdst++; psrc++;)
+#endif /* PSZ == 24 && MROP == 0 */
#endif
if (endmask)
+#if PSZ == 24 && MROP == 0
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, (int)(pdst - pdstBase) % 3);
+#else /* !(PSZ == 24 && MROP == 0) */
*pdst = MROP_MASK(*psrc, *pdst, endmask);
+#endif /* PSZ == 24 && MROP == 0 */
}
}
#ifndef DO_UNALIGNED_BITBLT
- else
+#if PSZ == 24 && MROP == 0
+ /* can not happen */
+#else /* !(PSZ == 24 && MROP == 0) */
+ else /* xoffSrc != xoffDst */
{
if (xoffSrc > xoffDst)
{
+#if PSZ == 24
+ leftShift = (xoffSrc - xoffDst) << 3;
+#else
#if PGSZ == 32
leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
#else /* PGSZ == 64 */
leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
#endif /* PGSZ */
+#endif
rightShift = PGSZ - leftShift;
}
else
{
+#if PSZ == 24
+ rightShift = (xoffDst - xoffSrc) << 3;
+#else
#if PGSZ == 32
rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
#else /* PGSZ == 64 */
rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
#endif /* PGSZ */
+#endif
leftShift = PGSZ - rightShift;
}
while (h--)
@@ -381,7 +580,6 @@ psrc += UNROLL;
pdst++;
}
nl = nlMiddle;
-
#ifdef LARGE_INSTRUCTION_CACHE
bits1 = bits;
@@ -445,43 +643,113 @@ pdst++;
}
}
}
+#endif /* (PSZ == 24 && MROP == 0) */
#endif /* DO_UNALIGNED_BITBLT */
+
+ }
}
#endif /* ! DO_MEMCPY */
else /* xdir == -1 */
{
+#if PSZ == 24 && MROP == 0
+ xoffSrc = (-(pptSrc->x + w)) & PAM;
+ xoffDst = (-pbox->x2) & PAM;
+#if 1
+ if(xoffSrc != xoffDst /* Alignments must be same. */
+ || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
+#else
+ if(1)
+#endif
+ /* Width also must be same, if hight > 1 */
+ {
+ /* ...otherwise, pixel by pixel operation */
+ while (h--)
+ {
+ register int i, si, sii, di;
+
+ for (i = 0, si = pptSrc->x + w - 1, di = pbox->x2 - 1;
+ i < w;
+ i++, si--, di--) {
+ psrc = psrcLine + ((si * BYPP) >> P2WSH);
+ pdst = pdstLine + ((di * BYPP) >> P2WSH);
+ sii = (si & PAM);
+ MROP_SOLID24P(psrc, pdst, sii, di);
+ }
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ }
+ }else
+#endif /* MROP == 0 && PSZ == 24 */
+ {
+
+#if PSZ == 24
+#if MROP == 0
+ /* already calculated */
+#else
+ xoffSrc = (pptSrc->x + w) & PAM;
+ xoffDst = pbox->x2 & PAM;
+#endif
+ pdstLine += ((pbox->x2 * BYPP - 1) >> P2WSH) + 1;
+ psrcLine += (((pptSrc->x+w) * BYPP - 1) >> P2WSH) + 1;
+#else
xoffSrc = (pptSrc->x + w - 1) & PIM;
xoffDst = (pbox->x2 - 1) & PIM;
pdstLine += ((pbox->x2-1) >> PWSH) + 1;
psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
+#endif
#ifdef DO_UNALIGNED_BITBLT
+#if PSZ == 24
+ nl = xoffDst - xoffSrc;
+#else
nl = xoffSrc - xoffDst;
- psrcLine = (unsigned long *)
+#endif
+ psrcLine = (CfbBits *)
(((unsigned char *) psrcLine) + nl);
#else
+#if PSZ == 24 && MROP == 0
+ /* already satisfied */
+#else
if (xoffSrc == xoffDst)
#endif
+#endif
{
while (h--)
{
+#if PSZ == 24 && MROP == 0
+ register int index;
+ register int im3;
+#endif /* PSZ == 24 && MROP == 0 */
psrc = psrcLine;
pdst = pdstLine;
pdstLine += widthDst;
psrcLine += widthSrc;
+#if PSZ == 24 && MROP == 0
+ index = (int)(pdst - pdstBase);
+#endif /* PSZ == 24 && MROP == 0 */
+
if (endmask)
{
pdst--;
psrc--;
+#if PSZ == 24 && MROP == 0
+ index--;
+ im3 = index % 3;
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, im3);
+#else /* !(PSZ == 24 && MROP == 0) */
*pdst = MROP_MASK (*psrc, *pdst, endmask);
+#endif /* PSZ == 24 && MROP == 0 */
}
nl = nlMiddle;
-
#ifdef LARGE_INSTRUCTION_CACHE
#ifdef FAST_CONSTANT_OFFSET_MODE
psrc -= nl & (UNROLL - 1);
pdst -= nl & (UNROLL - 1);
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) pdst[n-1] = DoMergeRop24u(psrc[n-1], pdst[n-1], ((int)(pdst - (n - 1) -pdstBase)) % 3);
+#else /* !(PSZ == 24 && MROP == 0) */
#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
+#endif /* PSZ == 24 && MROP == 0 */
#define BodyEven(n) BodyOdd(n)
@@ -491,7 +759,11 @@ psrc -= UNROLL;
#else
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) --pdst; --psrc; --index; im3 = index % 3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);
+#else /* !(PSZ == 24 && MROP == 0) */
#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
+#endif /* PSZ == 24 && MROP == 0 */
#define BodyEven(n) BodyOdd(n)
#define LoopReset ;
@@ -503,38 +775,60 @@ psrc -= UNROLL;
#undef LoopReset
#else
+#if PSZ == 24 && MROP == 0
+ DuffL(nl,label3,
+ --pdst; --psrc; --index; im3= index%3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);)
+#else /* !(PSZ == 24 && MROP == 0) */
DuffL(nl,label3,
--pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
+#endif /* PSZ == 24 && MROP == 0 */
#endif
if (startmask)
{
--pdst;
--psrc;
+#if PSZ == 24 && MROP == 0
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, (int)(pdst - pdstBase) % 3);
+#else /* !(PSZ == 24 && MROP == 0) */
*pdst = MROP_MASK(*psrc, *pdst, startmask);
+#endif /* PSZ == 24 && MROP == 0 */
}
}
}
#ifndef DO_UNALIGNED_BITBLT
+#if PSZ == 24 && MROP == 0
+ /* can not happen */
+#else /* !( PSZ == 24 && MROP == 0) */
else
{
if (xoffDst > xoffSrc)
{
+#if PSZ == 24
+ leftShift = (xoffDst - xoffSrc) << 3;
+ rightShift = PGSZ - leftShift;
+#else
#if PGSZ == 32
rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
#else /* PGSZ == 64 */
rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
#endif /* PGSZ */
leftShift = PGSZ - rightShift;
+#endif
}
else
{
+#if PSZ == 24
+ rightShift = (xoffSrc - xoffDst) << 3;
+ leftShift = PGSZ - rightShift;
+#else
#if PGSZ == 32
leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
#else /* PGSZ == 64 */
leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
#endif /* PGSZ */
rightShift = PGSZ - leftShift;
+#endif
}
while (h--)
{
@@ -543,7 +837,11 @@ psrc -= UNROLL;
pdstLine += widthDst;
psrcLine += widthSrc;
bits = 0;
+#if PSZ == 24
+ if (xoffSrc > xoffDst)
+#else
if (xoffDst > xoffSrc)
+#endif
bits = *--psrc;
if (endmask)
{
@@ -554,7 +852,6 @@ psrc -= UNROLL;
*pdst = MROP_MASK(bits1, *pdst, endmask);
}
nl = nlMiddle;
-
#ifdef LARGE_INSTRUCTION_CACHE
bits1 = bits;
#ifdef FAST_CONSTANT_OFFSET_MODE
@@ -615,7 +912,9 @@ bits1 = *--psrc; --pdst; \
}
}
}
+#endif /* PSZ == 24 && MROP == 0 */
#endif
+ }
}
pbox++;
pptSrc++;
diff --git a/cfb/cfbbres.c b/cfb/cfbbres.c
index 139a868b7..452259581 100644
--- a/cfb/cfbbres.c
+++ b/cfb/cfbbres.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbbres.c,v 3.5 2001/12/14 19:59:21 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -61,8 +62,8 @@ void
cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
e2, len)
int rop;
- unsigned long and, xor;
- unsigned long *addrl; /* pointer to base of bitmap */
+ CfbBits and, xor;
+ CfbBits *addrl; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
register int signdx;
int signdy; /* signs of directions */
@@ -74,6 +75,11 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
int len; /* length of line */
{
register int e3 = e2-e1;
+#if PSZ == 24
+ CfbBits piQxelXor[3],piQxelAnd[3];
+ char *addrb;
+ int nlwidth3, signdx3;
+#endif
#ifdef PIXEL_ADDR
register PixelType *addrp; /* Pixel pointer */
@@ -81,10 +87,26 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
return;
/* point to first point */
nlwidth <<= PWSH;
+#if PSZ == 24
+ addrp = (PixelType *)(addrl) + (y1 * nlwidth);
+ addrb = (char *)addrp + x1 * 3;
+
+ piQxelXor[0] = (xor << 24) | xor;
+ piQxelXor[1] = (xor << 16)| (xor >> 8);
+ piQxelXor[2] = (xor << 8) | (xor >> 16);
+ piQxelAnd[0] = (and << 24) | and;
+ piQxelAnd[1] = (and << 16)| (and >> 8);
+ piQxelAnd[2] = (and << 8) | (and >> 16);
+#else
addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
+#endif
if (signdy < 0)
nlwidth = -nlwidth;
e = e-e1; /* to make looping easier */
+#if PSZ == 24
+ nlwidth3 = nlwidth * sizeof (CfbBits);
+ signdx3 = signdx * 3;
+#endif
if (axis == Y_AXIS)
{
@@ -93,10 +115,45 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
t = nlwidth;
nlwidth = signdx;
signdx = t;
+#if PSZ == 24
+ t = nlwidth3;
+ nlwidth3 = signdx3;
+ signdx3 = t;
+#endif
}
if (rop == GXcopy)
{
--len;
+#if PSZ == 24
+#define body_copy \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
+ *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
+ *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
+ break; \
+ }
+#define body {\
+ body_copy \
+ addrb += signdx3; \
+ e += e1; \
+ if (e >= 0) \
+ { \
+ addrb += nlwidth3; \
+ e += e3; \
+ } \
+ }
+#else /* PSZ == 24 */
#define body {\
*addrp = xor; \
addrp += signdx; \
@@ -107,6 +164,7 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
e += e3; \
} \
}
+#endif /* PSZ == 24 */
while (len >= 4)
{
body body body body
@@ -117,12 +175,49 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
case 3: body case 2: body case 1: body
}
#undef body
+#if PSZ == 24
+ body_copy
+# undef body_copy
+#else
*addrp = xor;
+#endif
}
else /* not GXcopy */
{
while(len--)
{
+#if PSZ == 24
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+ switch((unsigned long)addrb & 3){
+ case 0:
+ *addrp = (*addrp & (piQxelAnd[0]|0xFF000000))
+ ^ (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 1:
+ *addrp = (*addrp & (piQxelAnd[2]|0xFF))
+ ^ (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ case 3:
+ *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF))
+ ^ (piQxelXor[0] & 0xFF000000);
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000))
+ ^ (piQxelXor[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp = (*addrp & (piQxelAnd[1]|0xFFFF))
+ ^ (piQxelXor[1] & 0xFFFF0000);
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00))
+ ^ (piQxelXor[2] & 0xFF);
+ break;
+ }
+ e += e1;
+ if (e >= 0)
+ {
+ addrb += nlwidth3;
+ e += e3;
+ }
+ addrb += signdx3;
+#else /* PSZ == 24 */
*addrp = DoRRop (*addrp, and, xor);
e += e1;
if (e >= 0)
@@ -131,21 +226,31 @@ cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
e += e3;
}
addrp += signdx;
+#endif /* PSZ == 24 */
}
}
#else /* !PIXEL_ADDR */
- register unsigned long tmp, bit;
- unsigned long leftbit, rightbit;
+ register CfbBits tmp, bit;
+ CfbBits leftbit, rightbit;
/* point to longword containing first point */
+#if PSZ == 24
+ addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2);
+#else
addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
+#endif
if (signdy < 0)
nlwidth = -nlwidth;
e = e-e1; /* to make looping easier */
leftbit = cfbmask[0];
+#if PSZ == 24
+ rightbit = cfbmask[(PPW-1)<<1];
+ bit = cfbmask[(x1 & 3)<<1];
+#else
rightbit = cfbmask[PPW-1];
bit = cfbmask[x1 & PIM];
+#endif
if (axis == X_AXIS)
{
diff --git a/cfb/cfbbresd.c b/cfb/cfbbresd.c
index 6612803ae..7fe71fa2f 100644
--- a/cfb/cfbbresd.c
+++ b/cfb/cfbbresd.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbbresd.c,v 3.6 2001/12/14 19:59:22 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -64,7 +65,7 @@ cfbBresD(rrops,
int numInDashList; /* total length of dash list */
int *pdashOffset; /* offset into current dash */
int isDoubleDash;
- unsigned long *addrl; /* pointer to base of bitmap */
+ CfbBits *addrl; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
int signdx, signdy; /* signs of directions */
int axis; /* major axis (Y_AXIS or X_AXIS) */
@@ -81,17 +82,41 @@ cfbBresD(rrops,
int dashIndex;
int dashOffset;
int dashRemaining;
- unsigned long xorFg, andFg, xorBg, andBg;
+ CfbBits xorFg, andFg, xorBg, andBg;
Bool isCopy;
int thisDash;
+#if PSZ == 24
+ CfbBits xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3];
+ char *addrb;
+ int signdx3, signdy3;
+#endif
dashOffset = *pdashOffset;
dashIndex = *pdashIndex;
isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy);
+#if PSZ == 24
+ xorFg = rrops[0].xor & 0xffffff;
+ andFg = rrops[0].and & 0xffffff;
+ xorBg = rrops[1].xor & 0xffffff;
+ andBg = rrops[1].and & 0xffffff;
+ xorPiQxlFg[0] = xorFg | (xorFg << 24);
+ xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16);
+ xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8);
+ andPiQxlFg[0] = andFg | (andFg << 24);
+ andPiQxlFg[1] = (andFg >> 8) | (andFg << 16);
+ andPiQxlFg[2] = (andFg >> 16) | (andFg << 8);
+ xorPiQxlBg[0] = xorBg | (xorBg << 24);
+ xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16);
+ xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8);
+ andPiQxlBg[0] = andBg | (andBg << 24);
+ andPiQxlBg[1] = (andBg >> 8) | (andBg << 16);
+ andPiQxlBg[2] = (andFg >> 16) | (andBg << 8);
+#else
xorFg = rrops[0].xor;
andFg = rrops[0].and;
xorBg = rrops[1].xor;
andBg = rrops[1].and;
+#endif
dashRemaining = pDash[dashIndex] - dashOffset;
if ((thisDash = dashRemaining) >= len)
{
@@ -116,6 +141,17 @@ cfbBresD(rrops,
#ifdef PIXEL_ADDR
+#if PSZ == 24
+#define Loop(store) while (thisDash--) {\
+ store; \
+ BresStep(addrb+=signdy3,addrb+=signdx3) \
+ }
+ /* point to first point */
+ nlwidth <<= PWSH;
+ addrp = (PixelType *)(addrl) + (y1 * nlwidth);
+ addrb = (char *)addrp + x1 * 3;
+
+#else
#define Loop(store) while (thisDash--) {\
store; \
BresStep(addrp+=signdy,addrp+=signdx) \
@@ -123,7 +159,12 @@ cfbBresD(rrops,
/* point to first point */
nlwidth <<= PWSH;
addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
+#endif
signdy *= nlwidth;
+#if PSZ == 24
+ signdx3 = signdx * 3;
+ signdy3 = signdy * sizeof (CfbBits);
+#endif
if (axis == Y_AXIS)
{
int t;
@@ -131,61 +172,136 @@ cfbBresD(rrops,
t = signdx;
signdx = signdy;
signdy = t;
+#if PSZ == 24
+ t = signdx3;
+ signdx3 = signdy3;
+ signdy3 = t;
+#endif
}
if (isCopy)
{
+#if PSZ == 24
+#define body_copy(pix) { \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \
+ *(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \
+ *(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \
+ break; \
+ } \
+}
+#endif /* PSZ == 24 */
+
for (;;)
{
len -= thisDash;
if (dashIndex & 1) {
if (isDoubleDash) {
+#if PSZ == 24
+ Loop(body_copy(xorPiQxlBg))
+#else
Loop(*addrp = xorBg)
+#endif
} else {
Loop(;)
}
} else {
+#if PSZ == 24
+ Loop(body_copy(xorPiQxlFg))
+#else
Loop(*addrp = xorFg)
+#endif
}
if (!len)
break;
NextDash
}
+#undef body_copy
}
else
{
+#define body_set(and, xor) { \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \
+ *(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \
+ *(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \
+ break; \
+ } \
+}
+
for (;;)
{
len -= thisDash;
if (dashIndex & 1) {
if (isDoubleDash) {
+#if PSZ == 24
+ Loop(body_set(andPiQxlBg, xorPiQxlBg))
+#else
Loop(*addrp = DoRRop(*addrp,andBg, xorBg))
+#endif
} else {
Loop(;)
}
} else {
+#if PSZ == 24
+ Loop(body_set(andPiQxlFg, xorPiQxlFg))
+#else
Loop(*addrp = DoRRop(*addrp,andFg, xorFg))
+#endif
}
if (!len)
break;
NextDash
}
+#undef body_set
}
#else /* !PIXEL_ADDR */
{
- register unsigned long tmp;
- unsigned long startbit, bit;
+ register CfbBits tmp;
+ CfbBits startbit, bit;
/* point to longword containing first point */
+#if PSZ == 24
+ addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2);
+#else
addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
+#endif
signdy = signdy * nlwidth;
if (signdx > 0)
startbit = cfbmask[0];
else
+#if PSZ == 24
+ startbit = cfbmask[(PPW-1)<<1];
+ bit = cfbmask[(x1 & 3)<<1];
+#else
startbit = cfbmask[PPW-1];
bit = cfbmask[x1 & PIM];
+#endif
+#if PSZ == 24
#define X_Loop(store) while(thisDash--) {\
store; \
BresStep(addrl += signdy, \
@@ -212,6 +328,34 @@ cfbBresD(rrops,
}, \
addrl += signdy) \
}
+#else
+#define X_Loop(store) while(thisDash--) {\
+ store; \
+ BresStep(addrl += signdy, \
+ if (signdx > 0) \
+ bit = SCRRIGHT(bit,1); \
+ else \
+ bit = SCRLEFT(bit,1); \
+ if (!bit) \
+ { \
+ bit = startbit; \
+ addrl += signdx; \
+ }) \
+ }
+#define Y_Loop(store) while(thisDash--) {\
+ store; \
+ BresStep(if (signdx > 0) \
+ bit = SCRRIGHT(bit,1); \
+ else \
+ bit = SCRLEFT(bit,1); \
+ if (!bit) \
+ { \
+ bit = startbit; \
+ addrl += signdx; \
+ }, \
+ addrl += signdy) \
+ }
+#endif
if (axis == X_AXIS)
{
diff --git a/cfb/cfbbstore.c b/cfb/cfbbstore.c
index ae0303dce..5e7b91471 100644
--- a/cfb/cfbbstore.c
+++ b/cfb/cfbbstore.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbbstore.c,v 1.5 2001/01/17 22:36:34 dawes Exp $ */
/*-
* cfbbstore.c --
* Functions required by the backing-store implementation in MI.
@@ -73,11 +74,8 @@ cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
pBox++;
}
-#ifdef CFB_NEED_SCREEN_PRIVATE
- pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
-#else
- pScrPix = (PixmapPtr) pScreen->devPrivate;
-#endif
+ pScrPix = (*pScreen->GetWindowPixmap)(pWin);
+
cfbDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
GXcopy, prgnSave, pPtsInit, ~0L);
@@ -134,11 +132,7 @@ cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
pBox++;
}
-#ifdef CFB_NEED_SCREEN_PRIVATE
- pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
-#else
- pScrPix = (PixmapPtr) pScreen->devPrivate;
-#endif
+ pScrPix = (*pScreen->GetWindowPixmap)(pWin);
cfbDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
GXcopy, prgnRestore, pPtsInit, ~0L);
diff --git a/cfb/cfbcmap.c b/cfb/cfbcmap.c
index 103860e86..1830ffa5e 100644
--- a/cfb/cfbcmap.c
+++ b/cfb/cfbcmap.c
@@ -27,6 +27,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbcmap.c,v 3.13 2001/01/17 22:36:34 dawes Exp $ */
#include "X.h"
@@ -34,403 +35,65 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "scrnintstr.h"
#include "colormapst.h"
#include "resource.h"
-
-#ifdef STATIC_COLOR
-
-static ColormapPtr InstalledMaps[MAXSCREENS];
+#include "micmap.h"
+#include "cfb.h"
int
-cfbListInstalledColormaps(pScreen, pmaps)
- ScreenPtr pScreen;
- Colormap *pmaps;
+cfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
- /* By the time we are processing requests, we can guarantee that there
- * is always a colormap installed */
- *pmaps = InstalledMaps[pScreen->myNum]->mid;
- return (1);
+ return miListInstalledColormaps(pScreen, pmaps);
}
-
void
-cfbInstallColormap(pmap)
- ColormapPtr pmap;
+cfbInstallColormap(ColormapPtr pmap)
{
- int index = pmap->pScreen->myNum;
- ColormapPtr oldpmap = InstalledMaps[index];
-
- if(pmap != oldpmap)
- {
- /* Uninstall pInstalledMap. No hardware changes required, just
- * notify all interested parties. */
- if(oldpmap != (ColormapPtr)None)
- WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
- /* Install pmap */
- InstalledMaps[index] = pmap;
- WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
-
- }
+ miInstallColormap(pmap);
}
void
-cfbUninstallColormap(pmap)
- ColormapPtr pmap;
+cfbUninstallColormap(ColormapPtr pmap)
{
- int index = pmap->pScreen->myNum;
- ColormapPtr curpmap = InstalledMaps[index];
-
- if(pmap == curpmap)
- {
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
- RT_COLORMAP);
- (*pmap->pScreen->InstallColormap)(curpmap);
- }
- }
+ miUninstallColormap(pmap);
}
-#endif
-
void
-cfbResolveColor(pred, pgreen, pblue, pVisual)
- unsigned short *pred, *pgreen, *pblue;
- register VisualPtr pVisual;
+cfbResolveColor(unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue,
+ VisualPtr pVisual)
{
- int shift = 16 - pVisual->bitsPerRGBValue;
- unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1;
-
- if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor))
- {
- /* rescale to rgb bits */
- *pred = ((*pred >> shift) * 65535) / lim;
- *pgreen = ((*pgreen >> shift) * 65535) / lim;
- *pblue = ((*pblue >> shift) * 65535) / lim;
- }
- else if (pVisual->class == GrayScale)
- {
- /* rescale to gray then rgb bits */
- *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
- *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
- }
- else if (pVisual->class == StaticGray)
- {
- unsigned limg = pVisual->ColormapEntries - 1;
- /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
- *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
- *pred = ((((*pred * (limg + 1))) >> 16) * 65535) / limg;
- *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
- }
- else
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- /* rescale to [0..limN] then [0..65535] then rgb bits */
- *pred = ((((((*pred * (limr + 1)) >> 16) *
- 65535) / limr) >> shift) * 65535) / lim;
- *pgreen = ((((((*pgreen * (limg + 1)) >> 16) *
- 65535) / limg) >> shift) * 65535) / lim;
- *pblue = ((((((*pblue * (limb + 1)) >> 16) *
- 65535) / limb) >> shift) * 65535) / lim;
- }
+ miResolveColor(pred, pgreen, pblue, pVisual);
}
Bool
-cfbInitializeColormap(pmap)
- register ColormapPtr pmap;
+cfbInitializeColormap(ColormapPtr pmap)
{
- register unsigned i;
- register VisualPtr pVisual;
- unsigned lim, maxent, shift;
-
- pVisual = pmap->pVisual;
- lim = (1 << pVisual->bitsPerRGBValue) - 1;
- shift = 16 - pVisual->bitsPerRGBValue;
- maxent = pVisual->ColormapEntries - 1;
- if (pVisual->class == TrueColor)
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red =
- ((((i * 65535) / limr) >> shift) * 65535) / lim;
- pmap->green[i].co.local.green =
- ((((i * 65535) / limg) >> shift) * 65535) / lim;
- pmap->blue[i].co.local.blue =
- ((((i * 65535) / limb) >> shift) * 65535) / lim;
- }
- }
- else if (pVisual->class == StaticColor)
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red =
- ((((((i & pVisual->redMask) >> pVisual->offsetRed)
- * 65535) / limr) >> shift) * 65535) / lim;
- pmap->red[i].co.local.green =
- ((((((i & pVisual->greenMask) >> pVisual->offsetGreen)
- * 65535) / limg) >> shift) * 65535) / lim;
- pmap->red[i].co.local.blue =
- ((((((i & pVisual->blueMask) >> pVisual->offsetBlue)
- * 65535) / limb) >> shift) * 65535) / lim;
- }
- }
- else if (pVisual->class == StaticGray)
- {
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift)
- * 65535) / lim;
- pmap->red[i].co.local.green = pmap->red[i].co.local.red;
- pmap->red[i].co.local.blue = pmap->red[i].co.local.red;
- }
- }
- return TRUE;
+ return miInitializeColormap(pmap);
}
-/* When simulating DirectColor on PseudoColor hardware, multiple
- entries of the colormap must be updated
- */
-
-#define AddElement(mask) { \
- pixel = red | green | blue; \
- for (i = 0; i < nresult; i++) \
- if (outdefs[i].pixel == pixel) \
- break; \
- if (i == nresult) \
- { \
- nresult++; \
- outdefs[i].pixel = pixel; \
- outdefs[i].flags = 0; \
- } \
- outdefs[i].flags |= (mask); \
- outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \
- outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \
- outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \
-}
-
-cfbExpandDirectColors (pmap, ndef, indefs, outdefs)
- ColormapPtr pmap;
- int ndef;
- xColorItem *indefs, *outdefs;
+int
+cfbExpandDirectColors (ColormapPtr pmap, int ndef,
+ xColorItem *indefs, xColorItem *outdefs)
{
- int minred, mingreen, minblue;
- register int red, green, blue;
- int maxred, maxgreen, maxblue;
- int stepred, stepgreen, stepblue;
- VisualPtr pVisual;
- register int pixel;
- register int nresult;
- register int i;
-
- pVisual = pmap->pVisual;
-
- stepred = 1 << pVisual->offsetRed;
- stepgreen = 1 << pVisual->offsetGreen;
- stepblue = 1 << pVisual->offsetBlue;
- maxred = pVisual->redMask;
- maxgreen = pVisual->greenMask;
- maxblue = pVisual->blueMask;
- nresult = 0;
- for (;ndef--; indefs++)
- {
- if (indefs->flags & DoRed)
- {
- red = indefs->pixel & pVisual->redMask;
- for (green = 0; green <= maxgreen; green += stepgreen)
- {
- for (blue = 0; blue <= maxblue; blue += stepblue)
- {
- AddElement (DoRed)
- }
- }
- }
- if (indefs->flags & DoGreen)
- {
- green = indefs->pixel & pVisual->greenMask;
- for (red = 0; red <= maxred; red += stepred)
- {
- for (blue = 0; blue <= maxblue; blue += stepblue)
- {
- AddElement (DoGreen)
- }
- }
- }
- if (indefs->flags & DoBlue)
- {
- blue = indefs->pixel & pVisual->blueMask;
- for (red = 0; red <= maxred; red += stepred)
- {
- for (green = 0; green <= maxgreen; green += stepgreen)
- {
- AddElement (DoBlue)
- }
- }
- }
- }
- return nresult;
+ return miExpandDirectColors(pmap, ndef, indefs, outdefs);
}
Bool
-cfbCreateDefColormap(pScreen)
- ScreenPtr pScreen;
+cfbCreateDefColormap(ScreenPtr pScreen)
{
-/*
- * In the following sources PC X server vendors may want to delete
- * "_not_tog" from "#ifdef WIN32_not_tog"
- */
-#ifdef WIN32_not_tog
- /*
- * these are the MS-Windows desktop colors, adjusted for X's 16-bit
- * color specifications.
- */
- static xColorItem citems[] = {
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0x8000, 0, 0, 0, 0 },
- { 2, 0, 0x8000, 0, 0, 0 },
- { 3, 0x8000, 0x8000, 0, 0, 0 },
- { 4, 0, 0, 0x8000, 0, 0 },
- { 5, 0x8000, 0, 0x8000, 0, 0 },
- { 6, 0, 0x8000, 0x8000, 0, 0 },
- { 7, 0xc000, 0xc000, 0xc000, 0, 0 },
- { 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
- { 9, 0xa600, 0xca00, 0xf000, 0, 0 },
- { 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
- { 247, 0xa000, 0xa000, 0xa400, 0, 0 },
- { 248, 0x8000, 0x8000, 0x8000, 0, 0 },
- { 249, 0xff00, 0, 0, 0, 0 },
- { 250, 0, 0xff00, 0, 0, 0 },
- { 251, 0xff00, 0xff00, 0, 0, 0 },
- { 252, 0, 0, 0xff00, 0, 0 },
- { 253, 0xff00, 0, 0xff00, 0, 0 },
- { 254, 0, 0xff00, 0xff00, 0, 0 },
- { 255, 0xff00, 0xff00, 0xff00, 0, 0 }
- };
-#define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0]
- int i;
-#else
- unsigned short zero = 0, ones = 0xFFFF;
-#endif
- Pixel wp, bp;
- VisualPtr pVisual;
- ColormapPtr cmap;
-
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++)
- ;
-
- if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap,
- (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
- 0)
- != Success)
- return FALSE;
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
-#ifdef WIN32_not_tog
- for (i = 0; i < NUM_DESKTOP_COLORS; i++) {
- if (AllocColor (cmap,
- &citems[i].red, &citems[i].green, &citems[i].blue,
- &citems[i].pixel, 0) != Success)
- return FALSE;
- }
-#else
- if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) !=
- Success) ||
- (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- return FALSE;
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
-#endif
- (*pScreen->InstallColormap)(cmap);
- return TRUE;
+ return miCreateDefColormap(pScreen);
}
-extern int defaultColorVisualClass;
-
-#define _RZ(d) ((d + 2) / 3)
-#define _RS(d) 0
-#define _RM(d) ((1 << _RZ(d)) - 1)
-#define _GZ(d) ((d - _RZ(d) + 1) / 2)
-#define _GS(d) _RZ(d)
-#define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d))
-#define _BZ(d) (d - _RZ(d) - _GZ(d))
-#define _BS(d) (_RZ(d) + _GZ(d))
-#define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d))
-#define _CE(d) (1 << _RZ(d))
-
-#define MAX_PSEUDO_DEPTH 10 /* largest DAC size I know */
-
-#define StaticGrayMask (1 << StaticGray)
-#define GrayScaleMask (1 << GrayScale)
-#define StaticColorMask (1 << StaticColor)
-#define PseudoColorMask (1 << PseudoColor)
-#define TrueColorMask (1 << TrueColor)
-#define DirectColorMask (1 << DirectColor)
-
-#define ALL_VISUALS (StaticGrayMask|\
- GrayScaleMask|\
- StaticColorMask|\
- PseudoColorMask|\
- TrueColorMask|\
- DirectColorMask)
-
-#define LARGE_VISUALS (TrueColorMask|\
- DirectColorMask)
-
-typedef struct _cfbVisuals {
- struct _cfbVisuals *next;
- int depth;
- int bitsPerRGB;
- int visuals;
- int count;
-} cfbVisualsRec, *cfbVisualsPtr;
-
-static int cfbVisualPriority[] = {
- PseudoColor, DirectColor, GrayScale, StaticColor, TrueColor, StaticGray
-};
-
-#define NUM_PRIORITY 6
-
-static cfbVisualsPtr cfbVisuals;
+void
+cfbClearVisualTypes(void)
+{
+ miClearVisualTypes();
+}
Bool
-cfbSetVisualTypes (depth, visuals, bitsPerRGB)
- int depth;
- int visuals;
+cfbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
{
- cfbVisualsPtr new, *prev, v;
- int count;
-
- new = (cfbVisualsPtr) xalloc (sizeof *new);
- if (!new)
- return FALSE;
- new->next = 0;
- new->depth = depth;
- new->visuals = visuals;
- new->bitsPerRGB = bitsPerRGB;
- count = (visuals >> 1) & 033333333333;
- count = visuals - count - ((count >> 1) & 033333333333);
- count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */
- new->count = count;
- for (prev = &cfbVisuals; v = *prev; prev = &v->next);
- *prev = new;
- return TRUE;
+ return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
}
/*
@@ -440,148 +103,15 @@ cfbSetVisualTypes (depth, visuals, bitsPerRGB)
*/
Bool
-cfbInitVisuals (visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB)
- VisualPtr *visualp;
- DepthPtr *depthp;
- int *nvisualp, *ndepthp;
- int *rootDepthp;
- VisualID *defaultVisp;
- unsigned long sizes;
- int bitsPerRGB;
+cfbInitVisuals (VisualPtr *visualp,
+ DepthPtr *depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID *defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB)
{
- int i, j, k;
- VisualPtr visual;
- DepthPtr depth;
- VisualID *vid;
- int d, b;
- int f;
- int ndepth, nvisual;
- int nvtype;
- int vtype;
- VisualID defaultVisual;
- cfbVisualsPtr visuals, nextVisuals;
-
- /* none specified, we'll guess from pixmap formats */
- if (!cfbVisuals)
- {
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- d = screenInfo.formats[f].depth;
- b = screenInfo.formats[f].bitsPerPixel;
- if (sizes & (1 << (b - 1)))
- {
- if (d > MAX_PSEUDO_DEPTH)
- vtype = LARGE_VISUALS;
- else if (d == 1)
- vtype = StaticGrayMask;
- else
- vtype = ALL_VISUALS;
- }
- else
- vtype = 0;
- if (!cfbSetVisualTypes (d, vtype, bitsPerRGB))
- return FALSE;
- }
- }
- nvisual = 0;
- ndepth = 0;
- for (visuals = cfbVisuals; visuals; visuals = nextVisuals)
- {
- nextVisuals = visuals->next;
- ndepth++;
- nvisual += visuals->count;
- }
- depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec));
- visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec));
- if (!depth || !visual)
- {
- xfree (depth);
- xfree (visual);
- return FALSE;
- }
- *depthp = depth;
- *visualp = visual;
- *ndepthp = ndepth;
- *nvisualp = nvisual;
- for (visuals = cfbVisuals; visuals; visuals = nextVisuals)
- {
- nextVisuals = visuals->next;
- d = visuals->depth;
- vtype = visuals->visuals;
- nvtype = visuals->count;
- vid = NULL;
- if (nvtype)
- {
- vid = (VisualID *) xalloc (nvtype * sizeof (VisualID));
- if (!vid)
- return FALSE;
- }
- depth->depth = d;
- depth->numVids = nvtype;
- depth->vids = vid;
- depth++;
- for (i = 0; i < NUM_PRIORITY; i++) {
- if (! (vtype & (1 << cfbVisualPriority[i])))
- continue;
- visual->class = cfbVisualPriority[i];
- visual->bitsPerRGBValue = visuals->bitsPerRGB;
- visual->ColormapEntries = 1 << d;
- visual->nplanes = d;
- visual->vid = *vid = FakeClientID (0);
- switch (visual->class) {
- case PseudoColor:
- case GrayScale:
- case StaticGray:
- visual->redMask = 0;
- visual->greenMask = 0;
- visual->blueMask = 0;
- visual->offsetRed = 0;
- visual->offsetGreen = 0;
- visual->offsetBlue = 0;
- break;
- case DirectColor:
- case TrueColor:
- visual->ColormapEntries = _CE(d);
- /* fall through */
- case StaticColor:
- visual->redMask = _RM(d);
- visual->greenMask = _GM(d);
- visual->blueMask = _BM(d);
- visual->offsetRed = _RS(d);
- visual->offsetGreen = _GS(d);
- visual->offsetBlue = _BS(d);
- }
- vid++;
- visual++;
- }
- xfree (visuals);
- }
- cfbVisuals = NULL;
- visual = *visualp;
- depth = *depthp;
- for (i = 0; i < ndepth; i++)
- {
- if (*rootDepthp && *rootDepthp != depth[i].depth)
- continue;
- for (j = 0; j < depth[i].numVids; j++)
- {
- for (k = 0; k < nvisual; k++)
- if (visual[k].vid == depth[i].vids[j])
- break;
- if (k == nvisual)
- continue;
- if (defaultColorVisualClass < 0 ||
- visual[k].class == defaultColorVisualClass)
- break;
- }
- if (j != depth[i].numVids)
- break;
- }
- if (i == ndepth) {
- i = 0;
- j = 0;
- }
- *rootDepthp = depth[i].depth;
- *defaultVisp = depth[i].vids[j];
- return TRUE;
+ return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
+ defaultVisp, sizes, bitsPerRGB, -1);
}
diff --git a/cfb/cfbfillarc.c b/cfb/cfbfillarc.c
index 89d184983..9dee99476 100644
--- a/cfb/cfbfillarc.c
+++ b/cfb/cfbfillarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillarc.c,v 3.5 2001/12/14 19:59:22 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -39,7 +40,7 @@ in this Software without prior written authorization from The Open Group.
#include "mi.h"
/* gcc 1.35 is stupid */
-#if defined(__GNUC__) && defined(mc68020)
+#if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020)
#define STUPID volatile
#else
#define STUPID
@@ -54,17 +55,29 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
STUPID int x, y, e;
STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg;
miFillArcRec info;
- unsigned long *addrlt, *addrlb;
- register unsigned long *addrl;
+#if PSZ == 24
+ unsigned char *addrlt, *addrlb;
+#else
+ CfbBits *addrlt, *addrlb;
+#endif
+ register CfbBits *addrl;
register int n;
int nlwidth;
RROP_DECLARE
register int xpos;
register int slw;
- unsigned long startmask, endmask;
+ CfbBits startmask, endmask;
int nlmiddle;
+#if PSZ == 24
+ register int pidx;
+ int xpos3;
+#endif
+#if PSZ == 24
+ cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
+#else
cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
+#endif
RROP_FETCH_GC(pGC);
miFillArcSetup(arc, &info);
@@ -82,6 +95,55 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
if (!slw)
continue;
xpos = xorg - x;
+#if PSZ == 24
+ xpos3 = (xpos * 3) & ~0x03;
+ addrl = (CfbBits *)((char *)addrlt + xpos3);
+ if (slw == 1){
+ RROP_SOLID24(addrl, xpos);
+ if (miFillArcLower(slw)){
+ addrl = (CfbBits *)((char *)addrlb + xpos3);
+ RROP_SOLID24(addrl, xpos);
+ }
+ continue;
+ }
+ maskbits(xpos, slw, startmask, endmask, nlmiddle);
+ xpos &= 3;
+ pidx = xpos;
+ if (startmask){
+ RROP_SOLID_MASK(addrl, startmask, pidx-1);
+ addrl++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ n = nlmiddle;
+ while (--n >= 0){
+ RROP_SOLID(addrl, pidx);
+ addrl++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addrl, endmask, pidx);
+ if (!miFillArcLower(slw))
+ continue;
+ addrl = (CfbBits *)((char *)addrlb + xpos3);
+ pidx = xpos;
+ if (startmask){
+ RROP_SOLID_MASK(addrl, startmask, pidx-1);
+ addrl++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ n = nlmiddle;
+ while (--n >= 0){
+ RROP_SOLID(addrl, pidx);
+ addrl++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addrl, endmask, pidx);
+#else /* PSZ == 24 */
addrl = addrlt + (xpos >> PWSH);
if (((xpos & PIM) + slw) <= PPW)
{
@@ -117,9 +179,38 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
RROP_SPAN(addrl, n);
if (endmask)
RROP_SOLID_MASK(addrl, endmask);
+#endif /* PSZ == 24 */
}
}
+#if PSZ == 24
+#define FILLSPAN(xl,xr,addr) \
+ if (xr >= xl){ \
+ n = xr - xl + 1; \
+ addrl = (CfbBits *)((char *)addr + ((xl * 3) & ~0x03)); \
+ if (n <= 1){ \
+ if (n) \
+ RROP_SOLID24(addrl, xl); \
+ } else { \
+ maskbits(xl, n, startmask, endmask, n); \
+ pidx = xl & 3; \
+ if (startmask){ \
+ RROP_SOLID_MASK(addrl, startmask, pidx-1); \
+ addrl++; \
+ if (pidx == 3) \
+ pidx = 0; \
+ } \
+ while (--n >= 0){ \
+ RROP_SOLID(addrl, pidx); \
+ addrl++; \
+ if (++pidx == 3) \
+ pidx = 0; \
+ } \
+ if (endmask) \
+ RROP_SOLID_MASK(addrl, endmask, pidx); \
+ } \
+ }
+#else /* PSZ == 24 */
#define FILLSPAN(xl,xr,addr) \
if (xr >= xl) \
{ \
@@ -147,6 +238,7 @@ RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
RROP_SOLID_MASK(addrl, endmask); \
} \
}
+#endif /* PSZ == 24 */
#define FILLSLICESPANS(flip,addr) \
if (!flip) \
@@ -172,14 +264,25 @@ RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc)
miFillArcRec info;
miArcSliceRec slice;
int xl, xr, xc;
- unsigned long *addrlt, *addrlb;
- register unsigned long *addrl;
+#if PSZ == 24
+ unsigned char *addrlt, *addrlb;
+#else
+ CfbBits *addrlt, *addrlb;
+#endif
+ register CfbBits *addrl;
register int n;
int nlwidth;
RROP_DECLARE
- unsigned long startmask, endmask;
+ CfbBits startmask, endmask;
+#if PSZ == 24
+ register int pidx;
+#endif /* PSZ == 24 */
+#if PSZ == 24
+ cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
+#else
cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
+#endif
RROP_FETCH_GC(pGC);
miFillArcSetup(arc, &info);
diff --git a/cfb/cfbfillrct.c b/cfb/cfbfillrct.c
index a0b72e7c4..c6a7270c2 100644
--- a/cfb/cfbfillrct.c
+++ b/cfb/cfbfillrct.c
@@ -1,6 +1,7 @@
/*
* Fill rectangles.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillrct.c,v 3.8 2001/12/14 19:59:22 dawes Exp $ */
/*
@@ -37,7 +38,7 @@ in this Software without prior written authorization from The Open Group.
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-
+#include "mi.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "mergerop.h"
@@ -51,7 +52,11 @@ cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot)
PixmapPtr tile;
int xrot, yrot;
{
+#if PSZ == 24
+ if (tile->drawable.width & 3)
+#else
if (tile->drawable.width & PIM)
+#endif
cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
else
cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
@@ -65,11 +70,15 @@ cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox)
BoxPtr pBox;
{
int xrot, yrot;
- void (*fill)();
+ void (*fill)(DrawablePtr, int, BoxPtr, PixmapPtr, int, int, int, unsigned long);
xrot = pDrawable->x + pGC->patOrg.x;
yrot = pDrawable->y + pGC->patOrg.y;
+#if PSZ == 24
+ if (pGC->tile.pixmap->drawable.width & 3)
+#else
if (pGC->tile.pixmap->drawable.width & PIM)
+#endif
{
fill = cfbFillBoxTileOddGeneral;
if ((pGC->planemask & PMSK) == PMSK)
@@ -108,12 +117,20 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
BoxRec stackRects[NUM_STACK_RECTS];
cfbPrivGC *priv;
int numRects;
- void (*BoxFill)();
+ void (*BoxFill)(DrawablePtr, GCPtr, int, BoxPtr);
int n;
int xorg, yorg;
+#if PSZ != 8
+ if ((pGC->fillStyle == FillStippled) ||
+ (pGC->fillStyle == FillOpaqueStippled)) {
+ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
+ return;
+ }
+#endif
+
priv = cfbGetGCPrivate(pGC);
- prgnClip = priv->pCompositeClip;
+ prgnClip = pGC->pCompositeClip;
BoxFill = 0;
switch (pGC->fillStyle)
@@ -132,7 +149,7 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
}
break;
case FillTiled:
- if (!cfbGetGCPrivate(pGC)->pRotatedPixmap)
+ if (!pGC->pRotatedPixmap)
BoxFill = cfbFillRectTileOdd;
else
{
@@ -144,13 +161,13 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
break;
#if PSZ == 8
case FillStippled:
- if (!cfbGetGCPrivate(pGC)->pRotatedPixmap)
+ if (!pGC->pRotatedPixmap)
BoxFill = cfb8FillRectStippledUnnatural;
else
BoxFill = cfb8FillRectTransparentStippled32;
break;
case FillOpaqueStippled:
- if (!cfbGetGCPrivate(pGC)->pRotatedPixmap)
+ if (!pGC->pRotatedPixmap)
BoxFill = cfb8FillRectStippledUnnatural;
else
BoxFill = cfb8FillRectOpaqueStippled32;
diff --git a/cfb/cfbfillsp.c b/cfb/cfbfillsp.c
index b0de9bd7d..9a75ac6c6 100644
--- a/cfb/cfbfillsp.c
+++ b/cfb/cfbfillsp.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillsp.c,v 3.7 2001/12/14 19:59:22 dawes Exp $ */
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
@@ -152,13 +153,17 @@ int fSorted;
int n; /* number of spans to fill */
register DDXPointPtr ppt; /* pointer to list of start points */
register int *pwidth; /* pointer to list of n widths */
- void (*fill)();
+ void (*fill)(DrawablePtr, int, DDXPointPtr, int *, PixmapPtr, int, int, int, unsigned long);
int xrot, yrot;
if (!(pGC->planemask))
return;
+#if PSZ == 24
+ if (pGC->tile.pixmap->drawable.width & 3)
+#else
if (pGC->tile.pixmap->drawable.width & PIM)
+#endif
{
fill = cfbFillSpanTileOddGeneral;
if ((pGC->planemask & PMSK) == PMSK)
@@ -217,21 +222,21 @@ int fSorted;
int *pwidth; /* pointer to list of n widths */
int *pwidthFree;/* copies of the pointers to free */
DDXPointPtr pptFree;
- unsigned long *pdstBase; /* pointer to start of bitmap */
+ CfbBits *pdstBase; /* pointer to start of bitmap */
int nlwDst; /* width in longwords of bitmap */
- register unsigned long *pdst; /* pointer to current word in bitmap */
+ register CfbBits *pdst; /* pointer to current word in bitmap */
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
int nlw;
int x, y, w, xrem, xSrc, ySrc;
int stwidth, stippleWidth;
int stippleHeight;
- register unsigned long bits, inputBits;
+ register CfbBits bits, inputBits;
register int partBitsLeft;
int nextPartBits;
int bitsLeft, bitsWhole;
- unsigned long *srcTemp, *srcStart;
- unsigned long *psrcBase;
- unsigned long startmask, endmask;
+ CfbBits *srcTemp, *srcStart;
+ CfbBits *psrcBase;
+ CfbBits startmask, endmask;
if (pGC->fillStyle == FillStippled)
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
@@ -274,7 +279,7 @@ int fSorted;
stwidth = pStipple->devKind >> PWSH;
stippleWidth = pStipple->drawable.width;
stippleHeight = pStipple->drawable.height;
- psrcBase = (unsigned long *) pStipple->devPrivate.ptr;
+ psrcBase = (CfbBits *) pStipple->devPrivate.ptr;
/*
* The Target:
@@ -406,20 +411,20 @@ int fSorted;
register DDXPointPtr ppt; /* pointer to list of start points */
register int *pwidth; /* pointer to list of n widths */
int iline; /* first line of tile to use */
- unsigned long *addrlBase; /* pointer to start of bitmap */
+ CfbBits *addrlBase; /* pointer to start of bitmap */
int nlwidth; /* width in longwords of bitmap */
- register unsigned long *pdst; /* pointer to current word in bitmap */
+ register CfbBits *pdst; /* pointer to current word in bitmap */
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
register int w;
int width, x, xrem, xSrc, ySrc;
- unsigned long tmpSrc, tmpDst1, tmpDst2;
+ CfbBits tmpSrc, tmpDst1, tmpDst2;
int stwidth, stippleWidth;
- unsigned long *psrcS;
- int rop, stiprop;
+ CfbBits *psrcS;
+ int rop, stiprop = 0;
int stippleHeight;
int *pwidthFree; /* copies of the pointers to free */
DDXPointPtr pptFree;
- unsigned long fgfill, bgfill;
+ CfbBits fgfill, bgfill;
if (!(pGC->planemask))
return;
@@ -497,7 +502,7 @@ int fSorted;
iline = (ppt->y - ySrc) % stippleHeight;
x = ppt->x;
pdst = addrlBase + (ppt->y * nlwidth);
- psrcS = (unsigned long *) pStipple->devPrivate.ptr + (iline * stwidth);
+ psrcS = (CfbBits *) pStipple->devPrivate.ptr + (iline * stwidth);
if (*pwidth)
{
@@ -505,8 +510,8 @@ int fSorted;
while(width > 0)
{
int xtemp, tmpx;
- register unsigned long *ptemp;
- register unsigned long *pdsttmp;
+ register CfbBits *ptemp;
+ register CfbBits *pdsttmp;
/*
* Do a stripe through the stipple & destination w pixels
* wide. w is not more than:
@@ -520,35 +525,66 @@ int fSorted;
/* width of dest/stipple */
xrem = (x - xSrc) % stippleWidth;
+#if PSZ == 24
+ w = 1;
+#else
w = min((stippleWidth - xrem), width);
/* dist to word bound in dest */
w = min(w, PPW - (x & PIM));
/* dist to word bound in stip */
w = min(w, MFB_PPW - (x & MFB_PIM));
+#endif
xtemp = (xrem & MFB_PIM);
- ptemp = (unsigned long *)(psrcS + (xrem >> MFB_PWSH));
+ ptemp = (CfbBits *)(psrcS + (xrem >> MFB_PWSH));
+#if PSZ == 24
+ tmpx = x & 3;
+ pdsttmp = pdst + ((x * 3)>>2);
+#else
tmpx = x & PIM;
pdsttmp = pdst + (x>>PWSH);
+#endif
switch ( pGC->fillStyle ) {
case FillOpaqueStippled:
+#if PSZ == 24
+ getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem);
+ getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem);
+#else
getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1);
getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2);
+#endif
break;
case FillStippled:
/* Fill tmpSrc with the source pixels */
+#if PSZ == 24
+ getbits24(pdsttmp, tmpSrc, x);
+ getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem);
+#else
getbits(pdsttmp, tmpx, w, tmpSrc);
getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1);
+#endif
if (rop != stiprop) {
+#if PSZ == 24
+ putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop);
+#else
putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop);
+#endif
} else {
tmpSrc = fgfill;
}
+#if PSZ == 24
+ getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem);
+#else
getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2);
+#endif
break;
}
tmpDst2 |= tmpDst1;
+#if PSZ == 24
+ putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop);
+#else
putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop);
+#endif
x += w;
width -= w;
}
@@ -577,23 +613,23 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
int n; /* number of spans to fill */
DDXPointPtr ppt; /* pointer to list of start points */
int *pwidth; /* pointer to list of n widths */
- unsigned long *src; /* pointer to bits in stipple, if needed */
+ CfbBits *src; /* pointer to bits in stipple, if needed */
int stippleHeight; /* height of the stipple */
PixmapPtr stipple;
int nlwDst; /* width in longwords of the dest pixmap */
int x,y,w; /* current span */
- unsigned long startmask;
- unsigned long endmask;
- register unsigned long *dst; /* pointer to bits we're writing */
+ CfbBits startmask;
+ CfbBits endmask;
+ register CfbBits *dst; /* pointer to bits we're writing */
register int nlw;
- unsigned long *dstTmp;
+ CfbBits *dstTmp;
int nlwTmp;
- unsigned long *pbits; /* pointer to start of pixmap */
- register unsigned long xor;
- register unsigned long mask;
- register unsigned long bits; /* bits from stipple */
+ CfbBits *pbits; /* pointer to start of pixmap */
+ register CfbBits xor;
+ register CfbBits mask;
+ register CfbBits bits; /* bits from stipple */
int wEnd;
int *pwidthFree; /* copies of the pointers to free */
@@ -602,7 +638,7 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
devPriv = cfbGetGCPrivate(pGC);
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
- n = nInit * miFindMaxBand(devPriv->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
if ( n == 0 )
return;
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
@@ -615,12 +651,11 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(devPriv->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
- stipple = devPriv->pRotatedPixmap;
- src = (unsigned long *)stipple->devPrivate.ptr;
+ stipple = pGC->pRotatedPixmap;
+ src = (CfbBits *)stipple->devPrivate.ptr;
stippleHeight = stipple->drawable.height;
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
@@ -644,6 +679,7 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
bits = src[y % stippleHeight];
RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
+#if PPW == 4
if (cfb8StippleRRop == GXcopy)
{
xor = devPriv->xor;
@@ -751,6 +787,7 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
}
else
+#endif /* PPW == 4 */
{
if (startmask)
{
@@ -789,23 +826,22 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
int n; /* number of spans to fill */
DDXPointPtr ppt; /* pointer to list of start points */
int *pwidth; /* pointer to list of n widths */
- unsigned long *src; /* pointer to bits in stipple, if needed */
+ CfbBits *src; /* pointer to bits in stipple, if needed */
int stippleHeight; /* height of the stipple */
PixmapPtr stipple;
int nlwDst; /* width in longwords of the dest pixmap */
int x,y,w; /* current span */
- unsigned long startmask;
- unsigned long endmask;
- register unsigned long *dst; /* pointer to bits we're writing */
+ CfbBits startmask;
+ CfbBits endmask;
+ register CfbBits *dst; /* pointer to bits we're writing */
register int nlw;
- unsigned long *dstTmp;
+ CfbBits *dstTmp;
int nlwTmp;
- unsigned long *pbits; /* pointer to start of pixmap */
- register unsigned long xor;
- register unsigned long mask;
- register unsigned long bits; /* bits from stipple */
+ CfbBits *pbits; /* pointer to start of pixmap */
+ register CfbBits xor;
+ register CfbBits bits; /* bits from stipple */
int wEnd;
int *pwidthFree; /* copies of the pointers to free */
@@ -816,7 +852,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
- n = nInit * miFindMaxBand(devPriv->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
if ( n == 0 )
return;
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
@@ -829,12 +865,11 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(devPriv->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
- stipple = devPriv->pRotatedPixmap;
- src = (unsigned long *)stipple->devPrivate.ptr;
+ stipple = pGC->pRotatedPixmap;
+ src = (CfbBits *)stipple->devPrivate.ptr;
stippleHeight = stipple->drawable.height;
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
@@ -858,6 +893,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
bits = src[y % stippleHeight];
RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
+#if PPW == 4
if (cfb8StippleRRop == GXcopy)
{
xor = devPriv->xor;
@@ -865,8 +901,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
{
if (startmask)
{
- *dst = *dst & ~startmask |
- GetPixelGroup (bits) & startmask;
+ *dst = (*dst & ~startmask) |
+ (GetPixelGroup (bits) & startmask);
dst++;
RotBitsLeft (bits, PGSZB);
}
@@ -877,8 +913,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
if (endmask)
{
- *dst = *dst & ~endmask |
- GetPixelGroup (bits) & endmask;
+ *dst = (*dst & ~endmask) |
+ (GetPixelGroup (bits) & endmask);
}
}
else
@@ -889,8 +925,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
nlwTmp = nlw;
if (startmask)
{
- *dstTmp = *dstTmp & ~startmask |
- GetPixelGroup (bits) & startmask;
+ *dstTmp = (*dstTmp & ~startmask) |
+ (GetPixelGroup (bits) & startmask);
dstTmp++;
RotBitsLeft (bits, PGSZB);
}
@@ -914,7 +950,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
{
dst = dstTmp + (nlwTmp << 3);
*dst = (*dst & ~endmask) |
- GetPixelGroup (bits) & endmask;
+ (GetPixelGroup (bits) & endmask);
}
while (w--)
{
@@ -932,6 +968,7 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
}
else
+#endif /* PPW == 4 */
{
if (startmask)
{
diff --git a/cfb/cfbgc.c b/cfb/cfbgc.c
index 62e0cbd76..c2e7a5965 100644
--- a/cfb/cfbgc.c
+++ b/cfb/cfbgc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbgc.c,v 1.6 2001/12/14 19:59:22 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -299,9 +300,9 @@ cfbCreateGC(pGC)
pPriv = cfbGetGCPrivate(pGC);
pPriv->rop = pGC->alu;
pPriv->oneRect = FALSE;
- pPriv->fExpose = TRUE;
- pPriv->freeCompClip = FALSE;
- pPriv->pRotatedPixmap = (PixmapPtr) NULL;
+ pGC->fExpose = TRUE;
+ pGC->freeCompClip = FALSE;
+ pGC->pRotatedPixmap = (PixmapPtr) NULL;
return TRUE;
}
@@ -358,7 +359,7 @@ cfbValidateGC(pGC, changes, pDrawable)
#ifdef NO_ONE_RECT
devPriv->oneRect = FALSE;
#else
- oneRect = REGION_NUM_RECTS(devPriv->pCompositeClip) == 1;
+ oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
if (oneRect != devPriv->oneRect)
new_line = TRUE;
devPriv->oneRect = oneRect;
@@ -483,8 +484,7 @@ cfbValidateGC(pGC, changes, pDrawable)
if ((width <= PGSZ) && !(width & (width - 1)))
{
- cfbCopyRotatePixmap(pGC->tile.pixmap,
- &devPriv->pRotatedPixmap,
+ cfbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
xrot, yrot);
new_pix = TRUE;
}
@@ -498,18 +498,18 @@ cfbValidateGC(pGC, changes, pDrawable)
if ((width <= PGSZ) && !(width & (width - 1)))
{
- mfbCopyRotatePixmap(pGC->stipple,
- &devPriv->pRotatedPixmap, xrot, yrot);
+ mfbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
+ xrot, yrot);
new_pix = TRUE;
}
}
break;
#endif
}
- if (!new_pix && devPriv->pRotatedPixmap)
+ if (!new_pix && pGC->pRotatedPixmap)
{
- (*pGC->pScreen->DestroyPixmap)(devPriv->pRotatedPixmap);
- devPriv->pRotatedPixmap = (PixmapPtr) NULL;
+ (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
+ pGC->pRotatedPixmap = (PixmapPtr) NULL;
}
}
@@ -540,7 +540,7 @@ cfbValidateGC(pGC, changes, pDrawable)
{
GCOps *newops;
- if (newops = cfbMatchCommon (pGC, devPriv))
+ if ((newops = cfbMatchCommon (pGC, devPriv)))
{
if (pGC->ops->devPrivate.val)
miDestroyGCOps (pGC->ops);
@@ -726,7 +726,7 @@ cfbValidateGC(pGC, changes, pDrawable)
}
break;
case FillTiled:
- if (devPriv->pRotatedPixmap)
+ if (pGC->pRotatedPixmap)
{
if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
pGC->ops->FillSpans = cfbTile32FSCopy;
@@ -738,7 +738,7 @@ cfbValidateGC(pGC, changes, pDrawable)
break;
case FillStippled:
#ifdef FOUR_BIT_CODE
- if (devPriv->pRotatedPixmap)
+ if (pGC->pRotatedPixmap)
pGC->ops->FillSpans = cfb8Stipple32FS;
else
#endif
@@ -746,7 +746,7 @@ cfbValidateGC(pGC, changes, pDrawable)
break;
case FillOpaqueStippled:
#ifdef FOUR_BIT_CODE
- if (devPriv->pRotatedPixmap)
+ if (pGC->pRotatedPixmap)
pGC->ops->FillSpans = cfb8OpaqueStipple32FS;
else
#endif
diff --git a/cfb/cfbgetsp.c b/cfb/cfbgetsp.c
index a2c9966df..e5c55f389 100644
--- a/cfb/cfbgetsp.c
+++ b/cfb/cfbgetsp.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbgetsp.c,v 3.9 2001/12/14 19:59:22 dawes Exp $ */
#include "X.h"
#include "Xmd.h"
@@ -82,12 +83,18 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
int widthSrc; /* width of pixmap in bytes */
register DDXPointPtr pptLast; /* one past last point to get */
int xEnd; /* last pixel to copy from */
+ int nl, srcBit;
+ int w;
+ PixelGroup *pdstNext;
+#if PSZ == 24
+ register char *psrcb, *pdstb;
+ register int xIndex = 0;
+#else
register int nstart;
int nend;
PixelGroup startmask, endmask;
- int nlMiddle, nl, srcBit;
- int w;
- PixelGroup *pdstNext;
+ int nlMiddle;
+#endif
switch (pDrawable->bitsPerPixel) {
case 1:
@@ -99,35 +106,70 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
FatalError("cfbGetSpans: invalid depth\n");
}
+ /*
+ * XFree86 DDX empties the root borderClip when the VT is
+ * switched away; this checks for that case
+ */
+ if (!cfbDrawableEnabled(pDrawable))
+ return;
cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase)
#ifdef PIXEL_ADDR
+# if PSZ != 24
if ((nspans == 1) && (*pwidth == 1))
{
tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc))
+ ppt->x);
#if BITMAP_BIT_ORDER == MSBFirst
- tmpSrc <<= (sizeof (unsigned long) - sizeof (PixelType)) * 8;
+ tmpSrc <<= (sizeof (CfbBits) - sizeof (PixelType)) * 8;
#endif
*pdstStart = tmpSrc;
return;
}
+# endif /* PSZ != 24 */
#endif
pdst = pdstStart;
pptLast = ppt + nspans;
while(ppt < pptLast)
{
+#if PSZ == 24
+ xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(CfbBits) / 3);
+ w = xEnd - ppt->x;
+ psrc = psrcBase + ppt->y * widthSrc;
+ srcBit = ppt->x;
+ psrcb = (char *)psrc + (ppt->x * 3);
+ xIndex = 0;
+ pdstb = (char *)pdst;
+ pdstNext = pdst + ((w * 3 + 3) >> 2);
+#else
xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
- psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH);
w = xEnd - ppt->x;
+ psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH);
srcBit = ppt->x & PIM;
pdstNext = pdst + ((w + PPW - 1) >> PWSH);
+#endif
+#if PSZ == 24
+ if (w < 0)
+ FatalError("cfb24GetSpans: Internal error (w < 0)\n");
+ nl = w;
+ while (nl--){
+ psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03);
+ getbits24(psrc, tmpSrc, srcBit);
+ pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03);
+ putbits24(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0), xIndex);
+ srcBit++;
+ psrcb += 3;
+ xIndex++;
+ pdstb += 3;
+ }
+ pdst = pdstNext;
+#else /* PSZ == 24 */
if (srcBit + w <= PPW)
{
getbits(psrc, srcBit, w, tmpSrc);
- putbits(tmpSrc, 0, w, pdst, ~((unsigned long)0));
+ putbits(tmpSrc, 0, w, pdst, ~((CfbBits)0));
pdst++;
}
else
@@ -138,7 +180,7 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
{
nstart = PPW - srcBit;
getbits(psrc, srcBit, nstart, tmpSrc);
- putbits(tmpSrc, 0, nstart, pdst, ~((unsigned long)0));
+ putbits(tmpSrc, 0, nstart, pdst, ~((CfbBits)0));
if(srcBit + nstart >= PPW)
psrc++;
}
@@ -146,7 +188,7 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
while (nl--)
{
tmpSrc = *psrc;
- putbits(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0));
+ putbits(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0));
psrc++;
pdst++;
}
@@ -154,10 +196,11 @@ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
{
nend = xEnd & PIM;
getbits(psrc, 0, nend, tmpSrc);
- putbits(tmpSrc, nstart, nend, pdst, ~((unsigned long)0));
+ putbits(tmpSrc, nstart, nend, pdst, ~((CfbBits)0));
}
pdst = pdstNext;
}
+#endif /* PSZ == 24 */
ppt++;
pwidth++;
}
diff --git a/cfb/cfbglblt8.c b/cfb/cfbglblt8.c
index b87bc8513..5db5c1f01 100644
--- a/cfb/cfbglblt8.c
+++ b/cfb/cfbglblt8.c
@@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbglblt8.c,v 3.6 2001/12/14 19:59:23 dawes Exp $ */
/*
* Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode
@@ -63,7 +64,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef USE_LEFTBITS
typedef unsigned char *glyphPointer;
-extern unsigned long endtab[];
+extern CfbBits endtab[];
#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \
(dst) &= widthMask; \
@@ -92,13 +93,18 @@ static void cfbPolyGlyphBlt8Clipped();
#define USE_STIPPLE_CODE
#endif
-#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && !defined(USE_LEFTBITS)
+#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS)
#ifdef USE_STIPPLE_CODE
#undef USE_STIPPLE_CODE
#endif
+#include "stip68kgnu.h"
#endif
+#if PSZ == 24
+#define DST_INC 3
+#else
#define DST_INC (PGSZB >> PWSH)
+#endif
/* cfbStippleStack/cfbStippleStackTE are coded in assembly language.
* They are only provided on some architecures.
@@ -116,31 +122,31 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
- register unsigned long c;
#ifndef GLYPHROP
- register unsigned long pixel;
+ register CfbBits pixel;
+#endif
+#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
+ register CfbBits c;
+ register CfbBits *dst;
#endif
- register unsigned long *dst;
register glyphPointer glyphBits;
register int xoff;
FontPtr pfont = pGC->font;
CharInfoPtr pci;
- unsigned long *dstLine;
- unsigned long *pdstBase;
+ CfbBits *dstLine;
+ CfbBits *pdstBase;
int hTmp;
int bwidthDst;
int widthDst;
int h;
- int ew;
BoxRec bbox; /* for clipping */
- int widthDiff;
int w;
RegionPtr clip;
BoxPtr extents;
#ifdef USE_LEFTBITS
int widthGlyph;
- unsigned long widthMask;
+ CfbBits widthMask;
#endif
#ifndef STIPPLE
#ifdef USE_STIPPLE_CODE
@@ -207,7 +213,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pixel = cfbGetGCPrivate(pGC)->xor;
#endif
- cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long)
+ cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
widthDst = bwidthDst / PGSZB;
while (nglyph--)
@@ -215,12 +221,20 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pci = *ppci++;
glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
xoff = x + pci->metrics.leftSideBearing;
+#if PSZ == 24
+ dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3);
+#else
dstLine = pdstBase +
(y - pci->metrics.ascent) * widthDst + (xoff >> PWSH);
+#endif
x += pci->metrics.characterWidth;
- if (hTmp = pci->metrics.descent + pci->metrics.ascent)
+ if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
{
+#if PSZ == 24
+ xoff &= 0x03;
+#else
xoff &= PIM;
+#endif /* PSZ == 24 */
#ifdef STIPPLE
STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
#else
@@ -234,7 +248,7 @@ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
#endif
do {
dst = dstLine;
- dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
dst += DST_INC;
@@ -261,39 +275,43 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
CharInfoPtr *ppci; /* array of character info */
unsigned char *pglyphBase; /* start of array of glyphs */
{
- register unsigned long c;
#ifndef GLYPHROP
- register unsigned long pixel;
+ register CfbBits pixel;
+#endif
+#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
+ register CfbBits c;
#endif
- register unsigned long *dst;
register glyphPointer glyphBits;
- register int xoff;
- unsigned long c1;
+ register int xoff;
+#if defined(USE_LEFT_BITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE))
+ register CfbBits *dst;
+#endif
CharInfoPtr pci;
FontPtr pfont = pGC->font;
- unsigned long *dstLine;
- unsigned long *pdstBase;
- CARD32 *cTmp, *clips;
+ CfbBits *dstLine;
+ CfbBits *pdstBase;
+#ifdef USE_LEFT_BITS
+ CARD32 *cTmp;
+#endif
+ CARD32 *clips;
int maxAscent, maxDescent;
int minLeftBearing;
int hTmp;
int widthDst;
int bwidthDst;
- int ew;
int xG, yG;
BoxPtr pBox;
int numRects;
- int widthDiff;
int w;
RegionPtr pRegion;
int yBand;
#ifdef GLYPHROP
- unsigned long bits;
+ CfbBits bits;
#endif
#ifdef USE_LEFTBITS
int widthGlyph;
- unsigned long widthMask;
+ CfbBits widthMask;
#endif
#ifdef GLYPHROP
@@ -302,7 +320,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pixel = cfbGetGCPrivate(pGC)->xor;
#endif
- cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long)
+ cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
widthDst = bwidthDst / PGSZB;
maxAscent = FONTMAXBOUNDS(pfont,ascent);
@@ -338,10 +356,19 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
xG = x + pci->metrics.leftSideBearing;
yG = y - pci->metrics.ascent;
x += pci->metrics.characterWidth;
- if (hTmp = pci->metrics.descent + pci->metrics.ascent)
+ if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
{
+#if PSZ == 24
+ dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3);
+ /* never use (xG*3)>>2 */
+#else
dstLine = pdstBase + yG * widthDst + (xG >> PWSH);
+#endif
+#if PSZ == 24
+ xoff = xG & 3;
+#else
xoff = xG & PIM;
+#endif
#ifdef USE_LEFTBITS
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
widthGlyph = PADGLYPHWIDTHBYTES(w);
@@ -354,7 +381,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
cTmp = clips;
do {
dst = dstLine;
- dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
c &= *cTmp++;
if (c)
@@ -394,7 +421,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
#else
do {
dst = dstLine;
- dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
if (c)
{
@@ -410,7 +437,7 @@ cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
#else /* GLYPHROP */
- if (bits = GetBitGroup(BitRight(c,xoff)))
+ if ((bits = GetBitGroup(BitRight(c,xoff))))
WriteBitGroup(dst, pixel, bits);
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
diff --git a/cfb/cfbhrzvert.c b/cfb/cfbhrzvert.c
index 3fe9262ad..6f4f7abe6 100644
--- a/cfb/cfbhrzvert.c
+++ b/cfb/cfbhrzvert.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbhrzvert.c,v 3.8 2002/09/16 18:05:30 eich Exp $ */
/***********************************************************
Copyright 1987,1998 The Open Group
@@ -58,19 +59,256 @@ SOFTWARE.
/* horizontal solid line
abs(len) > 1
*/
+void
cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len)
register int rop;
-register unsigned long and;
-register unsigned long xor;
-register unsigned long *addrl; /* pointer to base of bitmap */
+register CfbBits and;
+register CfbBits xor;
+register CfbBits *addrl; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
int x1; /* initial point */
int y1;
int len; /* length of line */
{
register int nlmiddle;
- register unsigned long startmask;
- register unsigned long endmask;
+
+#if PSZ == 24
+
+ int leftIndex, rightIndex;
+ CfbBits piQxelAnd[3], piQxelXor[3];
+ piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000);
+ piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000);
+ piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF);
+
+ piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000);
+ piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000);
+ piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF);
+
+ leftIndex = x1 & 3;
+ rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3;
+ nlmiddle = len;
+ if(leftIndex){
+ nlmiddle -= (4 - leftIndex);
+ }
+ if(rightIndex){
+ nlmiddle -= rightIndex;
+ }
+ if (nlmiddle < 0)
+ nlmiddle = 0;
+
+ nlmiddle >>= 2;
+
+ addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0);
+
+ switch(leftIndex+len){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 1:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 2:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 3:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ case 1:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ case 2:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ addrl++;
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ }
+ break;
+ case 2:
+ if(leftIndex){
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ addrl++;
+ }
+ else{
+ *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ addrl++;
+ }
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ if (rop == GXcopy){
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ addrl++;
+ *addrl++ = piQxelXor[1];
+ *addrl++ = piQxelXor[2];
+ break;
+ case 2:
+ *addrl = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ addrl++;
+ *addrl++ = piQxelXor[2];
+ break;
+ case 3:
+ *addrl = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ addrl++;
+ break;
+ }
+ while(nlmiddle--){
+ *addrl++ = piQxelXor[0];
+ *addrl++ = piQxelXor[1];
+ *addrl++ = piQxelXor[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *addrl++ = piQxelXor[0];
+ *addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ case 3:
+ *addrl++ = piQxelXor[0];
+ *addrl++ = piQxelXor[1];
+ *addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ }
+ }
+ else{
+ if(rop == GXxor){
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl++ ^= (piQxelXor[0]&0xFF000000);
+ *addrl++ ^= piQxelXor[1];
+ *addrl++ ^= piQxelXor[2];
+ break;
+ case 2:
+ *addrl++ ^= (piQxelXor[1]& 0xFFFF0000);
+ *addrl++ ^= piQxelXor[2];
+ break;
+ case 3:
+ *addrl++ ^= (piQxelXor[2]& 0xFFFFFF00);
+ break;
+ }
+ while(nlmiddle--){
+ *addrl++ ^= piQxelXor[0];
+ *addrl++ ^= piQxelXor[1];
+ *addrl++ ^= piQxelXor[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl ^= (piQxelXor[0]& 0xFFFFFF);
+ break;
+ case 2:
+ *addrl++ ^= piQxelXor[0];
+ *addrl ^= (piQxelXor[1]&0xFFFF);
+ break;
+ case 3:
+ *addrl++ ^= piQxelXor[0];
+ *addrl++ ^= piQxelXor[1];
+ *addrl ^= (piQxelXor[2]&0xFF);
+ break;
+ }
+ }
+ else{
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ addrl++;
+ break;
+ case 2:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ addrl++;
+ break;
+ case 3:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ addrl++;
+ break;
+ }
+ while(nlmiddle--){
+ *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ addrl++;
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+ addrl++;
+ break;
+ case 2:
+ *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ addrl++;
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ break;
+ case 3:
+ *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ addrl++;
+ *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ addrl++;
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ }
+
+ }
+ }
+ }
+ }
+#else
+ register CfbBits startmask;
+ register CfbBits endmask;
addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
@@ -119,56 +357,191 @@ int len; /* length of line */
*addrl = DoMaskRRop (*addrl, and, xor, endmask);
}
}
+#endif
}
/* vertical solid line */
+void
cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len)
int rop;
-register unsigned long and, xor;
-register unsigned long *addrl; /* pointer to base of bitmap */
+register CfbBits and, xor;
+register CfbBits *addrl; /* pointer to base of bitmap */
register int nlwidth; /* width in longwords of bitmap */
int x1, y1; /* initial point */
register int len; /* length of line */
{
+#if PSZ == 24
+ int xIdx;
+ CfbBits and2 = 0, xor2 = 0, mask = 0, mask2;
+#endif
#ifdef PIXEL_ADDR
register PixelType *bits = (PixelType *) addrl;
+#if PSZ == 24
+ nlwidth <<= PWSH;
+ xIdx = x1 & 3;
+ bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2));
+#else
nlwidth <<= PWSH;
bits = bits + (y1 * nlwidth) + x1;
+#endif
+#if PSZ == 24
+ mask2 = 0;
+ switch(xIdx){
+ case 0:
+ mask = 0xFF000000;
+ xor &= 0xFFFFFF;
+ and |= 0xFF000000;
+ break;
+ case 3:
+ mask = 0xFF;
+ xor &= 0xFFFFFF;
+ xor <<= 8;
+ and <<= 8;
+ and |= 0xFF;
+ break;
+ case 1:
+ mask = 0xFFFFFF;
+ mask2 = 0xFFFF0000;
+ xor2 = (xor>>8) & 0xFFFF;
+ xor &= 0xFF;
+ xor <<= 24;
+ and2 = (and >> 8 ) | 0xFFFF0000;
+ and <<= 24;
+ and |= 0xFFFFFF;
+ break;
+ case 2:
+ mask = 0x0000FFFF;
+ mask2 = 0xFFFFFF00;
+ xor2 = (xor >> 16) & 0xFF;
+ xor <<= 16;
+ xor &= 0xFFFF0000;
+ and2 = (and >> 16) | 0xFFFFFF00;
+ and <<= 16;
+ and |= 0xFFFF;
+ break;
+ }
+#endif
/*
* special case copy and xor to avoid a test per pixel
*/
if (rop == GXcopy)
{
+#if PSZ == 24
+ switch(xIdx){
+ case 0:
+ case 3:
+ while (len--){
+ *bits = (*bits & mask)| xor;
+ bits += nlwidth;
+ }
+ break;
+ case 1:
+ case 2:
+ while (len--){
+ *bits = (*bits & mask)| xor;
+ bits++;
+ *bits = (*bits & mask2)| xor2;
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ }
+#else
while (len--)
{
*bits = xor;
bits += nlwidth;
}
+#endif
}
else if (rop == GXxor)
{
+#if PSZ == 24
+ switch(xIdx){
+ case 0:
+ case 3:
+ while (len--){
+ *bits ^= xor;
+ bits += nlwidth;
+ }
+ break;
+ case 1:
+ case 2:
+ while (len--){
+ *bits ^= xor;
+ bits++;
+ *bits ^= xor2;
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ }
+#else
while (len--)
{
*bits ^= xor;
bits += nlwidth;
}
+#endif
}
else
{
+#if PSZ == 24
+ switch(xIdx){
+ case 0:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF);
+ bits += nlwidth;
+ }
+ break;
+ case 3:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00);
+ bits += nlwidth;
+ }
+ break;
+ case 1:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0xFF000000);
+ bits++;
+ *bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF);
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ case 2:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000);
+ bits++;
+ *bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF);
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ }
+#else
while (len--)
{
*bits = DoRRop(*bits, and, xor);
bits += nlwidth;
}
+#endif
}
#else /* !PIXEL_ADDR */
+#if PSZ == 24
+ addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2);
+
+ and |= ~cfbmask[(x1 & 3)<<1];
+ xor &= cfbmask[(x1 & 3)<<1];
+#else
addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
and |= ~cfbmask[x1 & PIM];
xor &= cfbmask[x1 & PIM];
+#endif
while (len--)
{
diff --git a/cfb/cfbigblt8.c b/cfb/cfbigblt8.c
index 7e20e2578..aa1060240 100644
--- a/cfb/cfbigblt8.c
+++ b/cfb/cfbigblt8.c
@@ -26,9 +26,12 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbigblt8.c,v 1.6 2001/12/14 19:59:23 dawes Exp $ */
+
#include "X.h"
#include "Xmd.h"
#include "Xproto.h"
+#include "mi.h"
#include "cfb.h"
#include "fontstruct.h"
#include "dixfontstr.h"
@@ -51,14 +54,18 @@ cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
xRectangle backrect;
- int fillStyle;
- int alu;
int fgPixel;
- int rop;
- int xor;
- int and;
- int pm;
- cfbPrivGC *priv;
+ cfbPrivGC *priv;
+
+ /*
+ * We can't avoid GC validations if calling mi functions.
+ */
+ if ((pGC->ops->PolyFillRect == miPolyFillRect) ||
+ (pGC->ops->PolyGlyphBlt == miPolyGlyphBlt))
+ {
+ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ return;
+ }
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
diff --git a/cfb/cfbimage.c b/cfb/cfbimage.c
index af0fcc11d..1983ae48a 100644
--- a/cfb/cfbimage.c
+++ b/cfb/cfbimage.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbimage.c,v 1.13 2001/12/14 19:59:23 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -54,10 +55,7 @@ SOFTWARE.
#include "cfb.h"
#include "cfbmskbits.h"
#include "servermd.h"
-
-#ifdef LOWMEMFTPT
#include "mi.h"
-#endif /* ifdef LOWMEMFTPT */
void
cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
@@ -68,7 +66,6 @@ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
int format;
char *pImage;
{
- int bitsPerPixel;
PixmapPtr pPixmap;
if ((w == 0) || (h == 0))
@@ -82,21 +79,21 @@ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
if (!pPixmap)
return;
- cfbGetGCPrivate(pGC)->fExpose = FALSE;
+ pGC->fExpose = FALSE;
if (format == ZPixmap)
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC,
leftPad, 0, w, h, x, y);
else
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC,
leftPad, 0, w, h, x, y, 1);
- cfbGetGCPrivate(pGC)->fExpose = TRUE;
+ pGC->fExpose = TRUE;
FreeScratchPixmapHeader(pPixmap);
}
else
{
- unsigned long oldFg, oldBg;
+ CfbBits oldFg, oldBg;
XID gcv[3];
- unsigned long oldPlanemask;
+ CfbBits oldPlanemask;
unsigned long i;
long bytesPer;
@@ -124,6 +121,7 @@ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
gcv[1] = oldFg;
gcv[2] = oldBg;
DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
+ ValidateGC(pDraw, pGC);
}
}
@@ -153,6 +151,12 @@ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
return;
}
pScreen = pDrawable->pScreen;
+ /*
+ * XFree86 DDX empties the root borderClip when the VT is
+ * switched away; this checks for that case
+ */
+ if (!cfbDrawableEnabled (pDrawable))
+ return;
if (format == ZPixmap)
{
pPixmap = GetScratchPixmapHeader(pScreen, w, h,
@@ -176,7 +180,9 @@ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
}
else
{
-#if PSZ == 8
+
+#if IMAGE_BYTE_ORDER == LSBFirst
+
pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1,
/*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine);
if (!pPixmap)
diff --git a/cfb/cfbline.c b/cfb/cfbline.c
index 019d93720..432cb62d9 100644
--- a/cfb/cfbline.c
+++ b/cfb/cfbline.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbline.c,v 3.6 2001/12/14 19:59:23 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -114,7 +115,7 @@ cfbLineSS (pDrawable, pGC, mode, npt, pptInit)
unsigned int oc1; /* outcode of point 1 */
unsigned int oc2; /* outcode of point 2 */
- unsigned long *addrl; /* address of destination pixmap */
+ CfbBits *addrl; /* address of destination pixmap */
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
@@ -134,11 +135,11 @@ cfbLineSS (pDrawable, pGC, mode, npt, pptInit)
register int x1, x2;
RegionPtr cclip;
cfbPrivGCPtr devPriv;
- unsigned long xor, and;
+ CfbBits xor, and;
int alu;
devPriv = cfbGetGCPrivate(pGC);
- cclip = devPriv->pCompositeClip;
+ cclip = pGC->pCompositeClip;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
@@ -428,11 +429,16 @@ cfbLineSS (pDrawable, pGC, mode, npt, pptInit)
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
- unsigned long mask;
- unsigned long scrbits;
+ CfbBits mask;
+ CfbBits scrbits;
+#if PSZ == 24
+ mask = cfbmask[(x2 & 3)<<1];
+ addrl += (y2 * nlwidth) + ((x2*3) >> 2);
+#else
mask = cfbmask[x2 & PIM];
addrl += (y2 * nlwidth) + (x2 >> PWSH);
+#endif
scrbits = *addrl;
*addrl = (scrbits & ~mask) |
(DoRRop (scrbits, and, xor) & mask);
@@ -476,7 +482,7 @@ cfbLineSD( pDrawable, pGC, mode, npt, pptInit)
register unsigned int oc1; /* outcode of point 1 */
register unsigned int oc2; /* outcode of point 2 */
- unsigned long *addrl; /* address of destination pixmap */
+ CfbBits *addrl; /* address of destination pixmap */
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
@@ -502,7 +508,7 @@ cfbLineSD( pDrawable, pGC, mode, npt, pptInit)
cfbPrivGCPtr devPriv;
devPriv = cfbGetGCPrivate(pGC);
- cclip = devPriv->pCompositeClip;
+ cclip = pGC->pCompositeClip;
rrops[0].rop = devPriv->rop;
rrops[0].and = devPriv->and;
rrops[0].xor = devPriv->xor;
@@ -632,7 +638,6 @@ cfbLineSD( pDrawable, pGC, mode, npt, pptInit)
int clip1 = 0, clip2 = 0;
int clipdx, clipdy;
int err;
- int dashIndexTmp, dashOffsetTmp;
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
pbox->y2-1,
@@ -724,14 +729,19 @@ dontStep: ;
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
- unsigned long mask;
+ CfbBits mask;
int pix;
pix = 0;
if (dashIndex & 1)
pix = 1;
+#if PSZ == 24
+ mask = cfbmask[(x2 & 3)<<1];
+ addrl += (y2 * nlwidth) + ((x2 *3)>> 2);
+#else
mask = cfbmask[x2 & PIM];
addrl += (y2 * nlwidth) + (x2 >> PWSH);
+#endif
*addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask);
break;
}
diff --git a/cfb/cfbmap.h b/cfb/cfbmap.h
index 75a79eb1e..c02ddfb96 100644
--- a/cfb/cfbmap.h
+++ b/cfb/cfbmap.h
@@ -26,162 +26,298 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbmap.h,v 3.11 2001/12/14 19:59:23 dawes Exp $ */
+
/*
* Map names around so that multiple depths can be supported simultaneously
*/
-/* a losing vendor cpp dumps core if we define NAME in terms of CATNAME */
+#if 0
+#undef QuartetBitsTable
+#undef QuartetPixelMaskTable
+#undef cfb8ClippedLineCopy
+#undef cfb8ClippedLineGeneral
+#undef cfb8ClippedLineXor
+#undef cfb8LineSS1Rect
+#undef cfb8LineSS1RectCopy
+#undef cfb8LineSS1RectGeneral
+#undef cfb8LineSS1RectPreviousCopy
+#undef cfb8LineSS1RectXor
+#undef cfb8SegmentSS1Rect
+#undef cfb8SegmentSS1RectCopy
+#undef cfb8SegmentSS1RectGeneral
+#undef cfb8SegmentSS1RectShiftCopy
+#undef cfb8SegmentSS1RectXor
+#undef cfbAllocatePrivates
+#undef cfbBSFuncRec
+#undef cfbBitBlt
+#undef cfbBresD
+#undef cfbBresS
+#undef cfbChangeWindowAttributes
+#undef cfbCloseScreen
+#undef cfbCopyArea
+#undef cfbCopyImagePlane
+#undef cfbCopyPixmap
+#undef cfbCopyPlane
+#undef cfbCopyRotatePixmap
+#undef cfbCopyWindow
+#undef cfbCreateGC
+#undef cfbCreatePixmap
+#undef cfbCreateScreenResources
+#undef cfbCreateWindow
+#undef cfbDestroyPixmap
+#undef cfbDestroyWindow
+#undef cfbDoBitblt
+#undef cfbDoBitbltCopy
+#undef cfbDoBitbltGeneral
+#undef cfbDoBitbltOr
+#undef cfbDoBitbltXor
+#undef cfbFillBoxSolid
+#undef cfbFillBoxTile32
+#undef cfbFillBoxTile32sCopy
+#undef cfbFillBoxTile32sGeneral
+#undef cfbFillBoxTileOdd
+#undef cfbFillBoxTileOddCopy
+#undef cfbFillBoxTileOddGeneral
+#undef cfbFillPoly1RectCopy
+#undef cfbFillPoly1RectGeneral
+#undef cfbFillRectSolidCopy
+#undef cfbFillRectSolidGeneral
+#undef cfbFillRectSolidXor
+#undef cfbFillRectTile32Copy
+#undef cfbFillRectTile32General
+#undef cfbFillRectTileOdd
+#undef cfbFillSpanTile32sCopy
+#undef cfbFillSpanTile32sGeneral
+#undef cfbFillSpanTileOddCopy
+#undef cfbFillSpanTileOddGeneral
+#undef cfbFinishScreenInit
+#undef cfbGCFuncs
+#undef cfbGetImage
+#undef cfbGetScreenPixmap
+#undef cfbGetSpans
+#undef cfbHorzS
+#undef cfbImageGlyphBlt8
+#undef cfbLineSD
+#undef cfbLineSS
+#undef cfbMapWindow
+#undef cfbMatchCommon
+#undef cfbNonTEOps
+#undef cfbNonTEOps1Rect
+#undef cfbPadPixmap
+#undef cfbPaintWindow
+#undef cfbPolyFillArcSolidCopy
+#undef cfbPolyFillArcSolidGeneral
+#undef cfbPolyFillRect
+#undef cfbPolyGlyphBlt8
+#undef cfbPolyGlyphRop8
+#undef cfbPolyPoint
+#undef cfbPositionWindow
+#undef cfbPutImage
+#undef cfbReduceRasterOp
+#undef cfbRestoreAreas
+#undef cfbSaveAreas
+#undef cfbScreenInit
+#undef cfbScreenPrivateIndex
+#undef cfbSegmentSD
+#undef cfbSegmentSS
+#undef cfbSetScanline
+#undef cfbSetScreenPixmap
+#undef cfbSetSpans
+#undef cfbSetupScreen
+#undef cfbSolidSpansCopy
+#undef cfbSolidSpansGeneral
+#undef cfbSolidSpansXor
+#undef cfbStippleStack
+#undef cfbStippleStackTE
+#undef cfbTEGlyphBlt
+#undef cfbTEOps
+#undef cfbTEOps1Rect
+#undef cfbTile32FSCopy
+#undef cfbTile32FSGeneral
+#undef cfbUnmapWindow
+#undef cfbUnnaturalStippleFS
+#undef cfbUnnaturalTileFS
+#undef cfbValidateGC
+#undef cfbVertS
+#undef cfbXRotatePixmap
+#undef cfbYRotatePixmap
+#undef cfbZeroPolyArcSS8Copy
+#undef cfbZeroPolyArcSS8General
+#undef cfbZeroPolyArcSS8Xor
+#undef cfbendpartial
+#undef cfbendtab
+#undef cfbmask
+#undef cfbrmask
+#undef cfbstartpartial
+#undef cfbstarttab
+#endif
+
+/* a losing vendor cpp dumps core if we define CFBNAME in terms of CATNAME */
#if PSZ != 8
+
#if PSZ == 32
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb32##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb32##subname
#else
-#define NAME(subname) cfb32/**/subname
+#define CFBNAME(subname) cfb32/**/subname
+#endif
+#endif
+
+#if PSZ == 24
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb24##subname
+#else
+#define CFBNAME(subname) cfb24/**/subname
#endif
#endif
#if PSZ == 16
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb16##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb16##subname
#else
-#define NAME(subname) cfb16/**/subname
+#define CFBNAME(subname) cfb16/**/subname
#endif
#endif
#if PSZ == 4
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) cfb4##subname
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define CFBNAME(subname) cfb4##subname
#else
-#define NAME(subname) cfb4/**/subname
+#define CFBNAME(subname) cfb4/**/subname
#endif
#endif
-#ifndef NAME
+#ifndef CFBNAME
cfb can not hack PSZ yet
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#undef CATNAME
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define CATNAME(prefix,subname) prefix##subname
#else
#define CATNAME(prefix,subname) prefix/**/subname
#endif
-#define cfbScreenPrivateIndex NAME(ScreenPrivateIndex)
-#define QuartetBitsTable NAME(QuartetBitsTable)
-#define QuartetPixelMaskTable NAME(QuartetPixelMaskTable)
-#define cfbAllocatePrivates NAME(AllocatePrivates)
-#define cfbBSFuncRec NAME(BSFuncRec)
-#define cfbBitBlt NAME(BitBlt)
-#define cfbBresD NAME(BresD)
-#define cfbBresS NAME(BresS)
-#define cfbChangeWindowAttributes NAME(ChangeWindowAttributes)
-#define cfbCloseScreen NAME(CloseScreen)
-#define cfbCopyArea NAME(CopyArea)
-#define cfbCopyImagePlane NAME(CopyImagePlane)
-#define cfbCopyPixmap NAME(CopyPixmap)
-#define cfbCopyPlane NAME(CopyPlane)
-#define cfbCopyRotatePixmap NAME(CopyRotatePixmap)
-#define cfbCopyWindow NAME(CopyWindow)
-#define cfbCreateGC NAME(CreateGC)
-#define cfbCreatePixmap NAME(CreatePixmap)
-#define cfbCreateWindow NAME(CreateWindow)
-#define cfbCreateScreenResources NAME(CreateScreenResources)
-#define cfbDestroyPixmap NAME(DestroyPixmap)
-#define cfbDestroyWindow NAME(DestroyWindow)
-#define cfbDoBitblt NAME(DoBitblt)
-#define cfbDoBitbltCopy NAME(DoBitbltCopy)
-#define cfbDoBitbltGeneral NAME(DoBitbltGeneral)
-#define cfbDoBitbltOr NAME(DoBitbltOr)
-#define cfbDoBitbltXor NAME(DoBitbltXor)
-#define cfbFillBoxSolid NAME(FillBoxSolid)
-#define cfbFillBoxTile32 NAME(FillBoxTile32)
-#define cfbFillBoxTile32sCopy NAME(FillBoxTile32sCopy)
-#define cfbFillBoxTile32sGeneral NAME(FillBoxTile32sGeneral)
-#define cfbFillBoxTileOdd NAME(FillBoxTileOdd)
-#define cfbFillBoxTileOddCopy NAME(FillBoxTileOddCopy)
-#define cfbFillBoxTileOddGeneral NAME(FillBoxTileOddGeneral)
-#define cfbFillPoly1RectCopy NAME(FillPoly1RectCopy)
-#define cfbFillPoly1RectGeneral NAME(FillPoly1RectGeneral)
-#define cfbFillRectSolidCopy NAME(FillRectSolidCopy)
-#define cfbFillRectSolidGeneral NAME(FillRectSolidGeneral)
-#define cfbFillRectSolidXor NAME(FillRectSolidXor)
-#define cfbFillRectTile32Copy NAME(FillRectTile32Copy)
-#define cfbFillRectTile32General NAME(FillRectTile32General)
-#define cfbFillRectTileOdd NAME(FillRectTileOdd)
-#define cfbFillSpanTile32sCopy NAME(FillSpanTile32sCopy)
-#define cfbFillSpanTile32sGeneral NAME(FillSpanTile32sGeneral)
-#define cfbFillSpanTileOddCopy NAME(FillSpanTileOddCopy)
-#define cfbFillSpanTileOddGeneral NAME(FillSpanTileOddGeneral)
-#define cfbFinishScreenInit NAME(FinishScreenInit)
-#define cfbGCFuncs NAME(GCFuncs)
-#define cfbGetImage NAME(GetImage)
-#define cfbGetSpans NAME(GetSpans)
-#define cfbHorzS NAME(HorzS)
-#define cfbImageGlyphBlt8 NAME(ImageGlyphBlt8)
-#define cfbLineSD NAME(LineSD)
-#define cfbLineSS NAME(LineSS)
-#define cfbMapWindow NAME(MapWindow)
-#define cfbMatchCommon NAME(MatchCommon)
-#define cfbNonTEOps NAME(NonTEOps)
-#define cfbNonTEOps1Rect NAME(NonTEOps1Rect)
-#define cfbPadPixmap NAME(PadPixmap)
-#define cfbPaintWindow NAME(PaintWindow)
-#define cfbPolyGlyphBlt8 NAME(PolyGlyphBlt8)
-#define cfbPolyGlyphRop8 NAME(PolyGlyphRop8)
-#define cfbPolyFillArcSolidCopy NAME(PolyFillArcSolidCopy)
-#define cfbPolyFillArcSolidGeneral NAME(PolyFillArcSolidGeneral)
-#define cfbPolyFillRect NAME(PolyFillRect)
-#define cfbPolyPoint NAME(PolyPoint)
-#define cfbPositionWindow NAME(PositionWindow)
-#define cfbPutImage NAME(PutImage)
-#define cfbReduceRasterOp NAME(ReduceRasterOp)
-#define cfbRestoreAreas NAME(RestoreAreas)
-#define cfbSaveAreas NAME(SaveAreas)
-#define cfbScreenInit NAME(ScreenInit)
-#define cfbSegmentSD NAME(SegmentSD)
-#define cfbSegmentSS NAME(SegmentSS)
-#define cfbSetScanline NAME(SetScanline)
-#define cfbSetSpans NAME(SetSpans)
-#define cfbSetupScreen NAME(SetupScreen)
-#define cfbSolidSpansCopy NAME(SolidSpansCopy)
-#define cfbSolidSpansGeneral NAME(SolidSpansGeneral)
-#define cfbSolidSpansXor NAME(SolidSpansXor)
-#define cfbStippleStack NAME(StippleStack)
-#define cfbStippleStackTE NAME(StippleStackTE)
-#define cfbTEGlyphBlt NAME(TEGlyphBlt)
-#define cfbTEOps NAME(TEOps)
-#define cfbTEOps1Rect NAME(TEOps1Rect)
-#define cfbTile32FSCopy NAME(Tile32FSCopy)
-#define cfbTile32FSGeneral NAME(Tile32FSGeneral)
-#define cfbUnmapWindow NAME(UnmapWindow)
-#define cfbUnnaturalStippleFS NAME(UnnaturalStippleFS)
-#define cfbUnnaturalTileFS NAME(UnnaturalTileFS)
-#define cfbValidateGC NAME(ValidateGC)
-#define cfbVertS NAME(VertS)
-#define cfbXRotatePixmap NAME(XRotatePixmap)
-#define cfbYRotatePixmap NAME(YRotatePixmap)
-#define cfbendpartial NAME(endpartial)
-#define cfbendtab NAME(endtab)
-#define cfbmask NAME(mask)
-#define cfbrmask NAME(rmask)
-#define cfbstartpartial NAME(startpartial)
-#define cfbstarttab NAME(starttab)
-#define cfb8LineSS1Rect NAME(LineSS1Rect)
-#define cfb8SegmentSS1Rect NAME(SegmentSS1Rect)
-#define cfb8ClippedLineCopy NAME(ClippedLineCopy)
-#define cfb8ClippedLineXor NAME(ClippedLineXor)
-#define cfb8ClippedLineGeneral NAME(ClippedLineGeneral )
-#define cfb8SegmentSS1RectCopy NAME(SegmentSS1RectCopy)
-#define cfb8SegmentSS1RectXor NAME(SegmentSS1RectXor)
-#define cfb8SegmentSS1RectGeneral NAME(SegmentSS1RectGeneral )
-#define cfb8SegmentSS1RectShiftCopy NAME(SegmentSS1RectShiftCopy)
-#define cfb8LineSS1RectCopy NAME(LineSS1RectCopy)
-#define cfb8LineSS1RectXor NAME(LineSS1RectXor)
-#define cfb8LineSS1RectGeneral NAME(LineSS1RectGeneral )
-#define cfb8LineSS1RectPreviousCopy NAME(LineSS1RectPreviousCopy)
-#define cfbZeroPolyArcSS8Copy NAME(ZeroPolyArcSSCopy)
-#define cfbZeroPolyArcSS8Xor NAME(ZeroPolyArcSSXor)
-#define cfbZeroPolyArcSS8General NAME(ZeroPolyArcSSGeneral)
+#define QuartetBitsTable CFBNAME(QuartetBitsTable)
+#define QuartetPixelMaskTable CFBNAME(QuartetPixelMaskTable)
+#define cfb8ClippedLineCopy CFBNAME(ClippedLineCopy)
+#define cfb8ClippedLineGeneral CFBNAME(ClippedLineGeneral )
+#define cfb8ClippedLineXor CFBNAME(ClippedLineXor)
+#define cfb8LineSS1Rect CFBNAME(LineSS1Rect)
+#define cfb8LineSS1RectCopy CFBNAME(LineSS1RectCopy)
+#define cfb8LineSS1RectGeneral CFBNAME(LineSS1RectGeneral )
+#define cfb8LineSS1RectPreviousCopy CFBNAME(LineSS1RectPreviousCopy)
+#define cfb8LineSS1RectXor CFBNAME(LineSS1RectXor)
+#define cfb8SegmentSS1Rect CFBNAME(SegmentSS1Rect)
+#define cfb8SegmentSS1RectCopy CFBNAME(SegmentSS1RectCopy)
+#define cfb8SegmentSS1RectGeneral CFBNAME(SegmentSS1RectGeneral )
+#define cfb8SegmentSS1RectShiftCopy CFBNAME(SegmentSS1RectShiftCopy)
+#define cfb8SegmentSS1RectXor CFBNAME(SegmentSS1RectXor)
+#define cfbAllocatePrivates CFBNAME(AllocatePrivates)
+#define cfbBSFuncRec CFBNAME(BSFuncRec)
+#define cfbBitBlt CFBNAME(BitBlt)
+#define cfbBresD CFBNAME(BresD)
+#define cfbBresS CFBNAME(BresS)
+#define cfbChangeWindowAttributes CFBNAME(ChangeWindowAttributes)
+#define cfbCloseScreen CFBNAME(CloseScreen)
+#define cfbCopyArea CFBNAME(CopyArea)
+#define cfbCopyImagePlane CFBNAME(CopyImagePlane)
+#define cfbCopyPixmap CFBNAME(CopyPixmap)
+#define cfbCopyPlane CFBNAME(CopyPlane)
+#define cfbCopyRotatePixmap CFBNAME(CopyRotatePixmap)
+#define cfbCopyWindow CFBNAME(CopyWindow)
+#define cfbCreateGC CFBNAME(CreateGC)
+#define cfbCreatePixmap CFBNAME(CreatePixmap)
+#define cfbCreateScreenResources CFBNAME(CreateScreenResources)
+#define cfbCreateWindow CFBNAME(CreateWindow)
+#define cfbDestroyPixmap CFBNAME(DestroyPixmap)
+#define cfbDestroyWindow CFBNAME(DestroyWindow)
+#define cfbDoBitblt CFBNAME(DoBitblt)
+#define cfbDoBitbltCopy CFBNAME(DoBitbltCopy)
+#define cfbDoBitbltGeneral CFBNAME(DoBitbltGeneral)
+#define cfbDoBitbltOr CFBNAME(DoBitbltOr)
+#define cfbDoBitbltXor CFBNAME(DoBitbltXor)
+#define cfbFillBoxSolid CFBNAME(FillBoxSolid)
+#define cfbFillBoxTile32 CFBNAME(FillBoxTile32)
+#define cfbFillBoxTile32sCopy CFBNAME(FillBoxTile32sCopy)
+#define cfbFillBoxTile32sGeneral CFBNAME(FillBoxTile32sGeneral)
+#define cfbFillBoxTileOdd CFBNAME(FillBoxTileOdd)
+#define cfbFillBoxTileOddCopy CFBNAME(FillBoxTileOddCopy)
+#define cfbFillBoxTileOddGeneral CFBNAME(FillBoxTileOddGeneral)
+#define cfbFillPoly1RectCopy CFBNAME(FillPoly1RectCopy)
+#define cfbFillPoly1RectGeneral CFBNAME(FillPoly1RectGeneral)
+#define cfbFillRectSolidCopy CFBNAME(FillRectSolidCopy)
+#define cfbFillRectSolidGeneral CFBNAME(FillRectSolidGeneral)
+#define cfbFillRectSolidXor CFBNAME(FillRectSolidXor)
+#define cfbFillRectTile32Copy CFBNAME(FillRectTile32Copy)
+#define cfbFillRectTile32General CFBNAME(FillRectTile32General)
+#define cfbFillRectTileOdd CFBNAME(FillRectTileOdd)
+#define cfbFillSpanTile32sCopy CFBNAME(FillSpanTile32sCopy)
+#define cfbFillSpanTile32sGeneral CFBNAME(FillSpanTile32sGeneral)
+#define cfbFillSpanTileOddCopy CFBNAME(FillSpanTileOddCopy)
+#define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral)
+#define cfbFinishScreenInit CFBNAME(FinishScreenInit)
+#define cfbGCFuncs CFBNAME(GCFuncs)
+#define cfbGetImage CFBNAME(GetImage)
+#define cfbGetScreenPixmap CFBNAME(GetScreenPixmap)
+#define cfbGetSpans CFBNAME(GetSpans)
+#define cfbHorzS CFBNAME(HorzS)
+#define cfbImageGlyphBlt8 CFBNAME(ImageGlyphBlt8)
+#define cfbLineSD CFBNAME(LineSD)
+#define cfbLineSS CFBNAME(LineSS)
+#define cfbMapWindow CFBNAME(MapWindow)
+#define cfbMatchCommon CFBNAME(MatchCommon)
+#define cfbNonTEOps CFBNAME(NonTEOps)
+#define cfbNonTEOps1Rect CFBNAME(NonTEOps1Rect)
+#define cfbPadPixmap CFBNAME(PadPixmap)
+#define cfbPaintWindow CFBNAME(PaintWindow)
+#define cfbPolyFillArcSolidCopy CFBNAME(PolyFillArcSolidCopy)
+#define cfbPolyFillArcSolidGeneral CFBNAME(PolyFillArcSolidGeneral)
+#define cfbPolyFillRect CFBNAME(PolyFillRect)
+#define cfbPolyGlyphBlt8 CFBNAME(PolyGlyphBlt8)
+#define cfbPolyGlyphRop8 CFBNAME(PolyGlyphRop8)
+#define cfbPolyPoint CFBNAME(PolyPoint)
+#define cfbPositionWindow CFBNAME(PositionWindow)
+#define cfbPutImage CFBNAME(PutImage)
+#define cfbReduceRasterOp CFBNAME(ReduceRasterOp)
+#define cfbRestoreAreas CFBNAME(RestoreAreas)
+#define cfbSaveAreas CFBNAME(SaveAreas)
+#define cfbScreenInit CFBNAME(ScreenInit)
+#define cfbScreenPrivateIndex CFBNAME(ScreenPrivateIndex)
+#define cfbSegmentSD CFBNAME(SegmentSD)
+#define cfbSegmentSS CFBNAME(SegmentSS)
+#define cfbSetScanline CFBNAME(SetScanline)
+#define cfbSetScreenPixmap CFBNAME(SetScreenPixmap)
+#define cfbSetSpans CFBNAME(SetSpans)
+#define cfbSetupScreen CFBNAME(SetupScreen)
+#define cfbSolidSpansCopy CFBNAME(SolidSpansCopy)
+#define cfbSolidSpansGeneral CFBNAME(SolidSpansGeneral)
+#define cfbSolidSpansXor CFBNAME(SolidSpansXor)
+#define cfbStippleStack CFBNAME(StippleStack)
+#define cfbStippleStackTE CFBNAME(StippleStackTE)
+#define cfbTEGlyphBlt CFBNAME(TEGlyphBlt)
+#define cfbTEOps CFBNAME(TEOps)
+#define cfbTEOps1Rect CFBNAME(TEOps1Rect)
+#define cfbTile32FSCopy CFBNAME(Tile32FSCopy)
+#define cfbTile32FSGeneral CFBNAME(Tile32FSGeneral)
+#define cfbUnmapWindow CFBNAME(UnmapWindow)
+#define cfbUnnaturalStippleFS CFBNAME(UnnaturalStippleFS)
+#define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS)
+#define cfbValidateGC CFBNAME(ValidateGC)
+#define cfbVertS CFBNAME(VertS)
+#define cfbXRotatePixmap CFBNAME(XRotatePixmap)
+#define cfbYRotatePixmap CFBNAME(YRotatePixmap)
+#define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy)
+#define cfbZeroPolyArcSS8General CFBNAME(ZeroPolyArcSSGeneral)
+#define cfbZeroPolyArcSS8Xor CFBNAME(ZeroPolyArcSSXor)
+#define cfbendpartial CFBNAME(endpartial)
+#define cfbendtab CFBNAME(endtab)
+#define cfbmask CFBNAME(mask)
+#define cfbrmask CFBNAME(rmask)
+#define cfbstartpartial CFBNAME(startpartial)
+#define cfbstarttab CFBNAME(starttab)
#endif /* PSZ != 8 */
diff --git a/cfb/cfbmskbits.c b/cfb/cfbmskbits.c
index 4c26e3576..cbf364770 100644
--- a/cfb/cfbmskbits.c
+++ b/cfb/cfbmskbits.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.c,v 3.2 2001/01/17 22:36:35 dawes Exp $ */
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
@@ -215,6 +216,38 @@ PixelGroup cfbendtab[] =
#endif /* PGSZ */
#endif
+#if PSZ == 24
+#if PGSZ == 32
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0x000000FF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x00FFFFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFF000000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x000000000000FFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFF000000000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 24 */
+
#if PSZ == 32
#if PGSZ == 32
PixelGroup cfbstarttab[] =
@@ -388,6 +421,48 @@ PixelGroup cfbendpartial[] =
#endif /* PGSZ */
#endif /* PSZ == 16 */
+#if PSZ == 24
+#if PGSZ == 32
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0x000000FF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x00FFFFFF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFF000000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x0000000000FFFFFF),
+ cfbBits(0x000000000000FFFF),
+ cfbBits(0x00000000000000FF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFF00000000000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 24 */
+
#if PSZ == 32
#if PGSZ == 32
PixelGroup cfbstartpartial[] =
@@ -559,6 +634,58 @@ PixelGroup cfbrmask[] =
#endif /* PGSZ */
#endif /* PSZ == 16 */
+#if PSZ == 24
+#if PGSZ == 32
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFFFF00),
+ cfbBits(0x00000000),
+ cfbBits(0x000000FF),
+ cfbBits(0xFFFF0000),
+ cfbBits(0x0000FFFF),
+ cfbBits(0xFF000000),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0x00000000),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x000000FF),
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0x0000FFFF),
+ cfbBits(0xFFFF0000),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0xFF000000),
+ cfbBits(0xFFFFFFFF),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0x000000FFFFFF0000),
+ cfbBits(0x000000000000FFFF),
+ };
+PixelGroup cfbmask2[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFF00000000000000),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0xFFFFFF000000FFFF),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ };
+PixelGroup cfbrmask2[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x0000000000000000),
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 24 */
+
#if PSZ == 32
#if PGSZ == 32
PixelGroup cfbmask[] =
@@ -726,6 +853,30 @@ PixelGroup QuartetBitsTable[] = {
};
#endif /* PSZ == 16 */
+#if PSZ == 24
+PixelGroup QuartetBitsTable[] = {
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 0 */
+ 0x00000001, /* 1 - 1 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 0 */
+ 0x00000001, /* 1 - 1 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 00 */
+ 0x00000002, /* 1 - 10 */
+ 0x00000003, /* 2 - 11*/
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 00 */
+ 0x00000001, /* 1 - 01 */
+ 0x00000003, /* 2 - 11 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif /* PGSZ */
+};
+#endif /* PSZ == 24 */
+
#if PSZ == 32
PixelGroup QuartetBitsTable[] = {
#if PGSZ == 32
@@ -1195,6 +1346,34 @@ PixelGroup QuartetPixelMaskTable[] = {
};
#endif /* PSZ == 16 */
+#if PSZ == 24
+PixelGroup QuartetPixelMaskTable[] = {
+#if PGSZ == 32
+/* Four pixels consist three pixel groups....*/
+ 0x00000000, 0x00FFFFFF, /*0x00000000, *//*0*/
+/* 0x00000000, 0x00000000, 0x00000000,*/ /*0*/
+/* 0x00FFFFFF, 0x00000000, 0x00000000,*/ /*1*/
+/* 0xFF000000, 0x0000FFFF, 0x00000000,*/ /*2*/
+/* 0xFFFFFFFF, 0x0000FFFF, 0x00000000,*/ /*3*/
+/* 0x00000000, 0xFFFF0000, 0x000000FF,*/ /*4*/
+/* 0x00FFFFFF, 0xFFFF0000, 0x000000FF,*/ /*5*/
+/* 0xFF000000, 0xFFFFFFFF, 0x000000FF,*/ /*6*/
+/* 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,*/ /*7*/
+/* 0x00000000, 0x00000000, 0xFFFFFF00,*/ /*8*/
+/* 0x00FFFFFF, 0x00000000, 0xFFFFFF00,*/ /*9*/
+/* 0xFF000000, 0x0000FFFF, 0xFFFFFF00,*/ /*10*/
+/* 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFF00,*/ /*11*/
+/* 0x00000000, 0xFFFF0000, 0xFFFFFFFF,*/ /*12*/
+/* 0x00FFFFFF, 0xFFFF0000, 0xFFFFFFFF,*/ /*13*/
+/* 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*14*/
+/* 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*15*/
+#else /* PGSZ == 64 */
+ 0x0000000000000000, 0x0000000000FFFFFF,
+ 0x0000FFFFFF000000, 0xFFFFFFFFFFFFFFFF
+#endif /* PGSZ */
+};
+#endif /* PSZ == 24 */
+
#if PSZ == 32
PixelGroup QuartetPixelMaskTable[] = {
#if PGSZ == 32
@@ -1208,3 +1387,12 @@ PixelGroup QuartetPixelMaskTable[] = {
#endif /* PGSZ */
};
#endif /* PSZ == 32 */
+
+#if PSZ == 24
+int cfb24Shift[] =
+#if (BITMAP_BIT_ORDER == MSBFirst)
+{8,0,16,16,8,24,0,0};
+#else /* (BITMAP_BIT_ORDER == LSBFirst) */
+{0,0,24,8,16,16,8,0};
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif
diff --git a/cfb/cfbmskbits.h b/cfb/cfbmskbits.h
index 7de664157..dac519001 100644
--- a/cfb/cfbmskbits.h
+++ b/cfb/cfbmskbits.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.h,v 3.13 2001/10/28 03:33:01 tsi Exp $ */
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
@@ -33,6 +34,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "X.h"
#include "Xmd.h"
#include "servermd.h"
+#if defined(XFREE86) || ( defined(__OpenBSD__) && defined(__alpha__) ) \
+ || (defined(__bsdi__))
+#include "xf86_ansic.h"
+#include "compiler.h"
+#endif
/*
* ==========================================================================
@@ -68,18 +74,18 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
* B is PGSZB. All the other values are derived from these
* two. This table does not show all combinations!
*
- * name cfb8,4 cfb32,4 cfb8,8 cfb32,8
- * ---- ------ ------- ------ -------
- * PSZ 8 32 8 32
- * PGSZ 32 32 64 64
- * PGSZB 4 4 8 8
- * PGSZBMSK 0xF 0xF 0xFF 0xFF
- * PPW 4 1 8 2
- * PPWMSK 0xF 0x1 0xFF 0x3
- * PLST 3 0 7 1
- * PIM 0x3 0x0 0x7 0x1
- * PWSH 2 0 3 1
- * PMSK 0xFF 0xFFFFFFFF 0xFF 0xFFFFFFFF
+ * name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8
+ * ---- ------ ------- ------ ------ ------ -------
+ * PSZ 8 24 32 8 24 32
+ * PGSZ 32 32 32 64 64 64
+ * PGSZB 4 4 4 8 8 8
+ * PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF
+ * PPW 4 1 1 8 2 2
+ * PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3
+ * PLST 3 0 0 7 1 1
+ * PIM 0x3 0x0 0x0 0x7 0x1? 0x1
+ * PWSH 2 0 0 3 1 1
+ * PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF
*
*
* I have also added a new macro, PFILL, that takes one pixel and
@@ -95,6 +101,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
* parameter to the putbits and putbitsrop macros that is the plane
* mask.
* ==========================================================================
+ *
+ * Keith Packard (keithp@suse.com)
+ * 64bit code is no longer supported; it requires DIX support
+ * for repadding images which significantly impacts performance
*/
/*
@@ -102,22 +112,26 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
* -DPSZ=foo on the compilation command line.
*/
+#ifndef PSZ
+#define PSZ 8
+#endif
+
/*
* PixelGroup is the data type used to operate on groups of pixels.
- * We typedef it here to unsigned long with the assumption that you
- * want to manipulate as many pixels at a time as you can. If unsigned
- * long is not appropriate for your server, define it to something else
+ * We typedef it here to CARD32 with the assumption that you
+ * want to manipulate 32 bits worth of pixels at a time as you can. If CARD32
+ * is not appropriate for your server, define it to something else
* before including this file. In this case you will also have to define
* PGSZB to the size in bytes of PixelGroup.
*/
#ifndef PixelGroup
-typedef unsigned long PixelGroup;
-#ifdef LONG64
-#define PGSZB 8
-#else
+#define PixelGroup CARD32
#define PGSZB 4
-#endif /* LONG64 */
#endif /* PixelGroup */
+
+#ifndef CfbBits
+#define CfbBits CARD32
+#endif
#define PGSZ (PGSZB << 3)
#define PPW (PGSZ/PSZ)
@@ -171,6 +185,15 @@ typedef CARD8 PixelType;
typedef CARD16 PixelType;
#endif
+#if PSZ == 24
+#undef PMSK
+#define PMSK 0xFFFFFF
+/*#undef PIM
+#define PIM 3*/
+#define PIXEL_ADDR
+typedef CARD32 PixelType;
+#endif
+
#if PSZ == 32
#undef PMSK
#define PMSK 0xFFFFFFFF
@@ -385,6 +408,109 @@ getleftbits(psrc, w, dst)
#if PSZ != 32 || PPW != 1
+# if (PSZ == 24 && PPW == 1)
+#define maskbits(x, w, startmask, endmask, nlw) {\
+ startmask = cfbstarttab[(x)&3]; \
+ endmask = cfbendtab[((x)+(w)) & 3]; \
+ nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \
+}
+
+#define mask32bits(x, w, startmask, endmask) \
+ startmask = cfbstarttab[(x)&3]; \
+ endmask = cfbendtab[((x)+(w)) & 3];
+
+#define maskpartialbits(x, w, mask) \
+ mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3];
+
+#define maskbits24(x, w, startmask, endmask, nlw) \
+ startmask = cfbstarttab24[(x) & 3]; \
+ endmask = cfbendtab24[((x)+(w)) & 3]; \
+ if (startmask){ \
+ nlw = (((w) - (4 - ((x) & 3))) >> 2); \
+ } else { \
+ nlw = (w) >> 2; \
+ }
+
+#define getbits24(psrc, dst, index) {\
+ register int idx; \
+ switch(idx = ((index)&3)<<1){ \
+ case 0: \
+ dst = (*(psrc) &cfbmask[idx]); \
+ break; \
+ case 6: \
+ dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \
+ break; \
+ default: \
+ dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \
+ BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
+ }; \
+}
+
+#define putbits24(src, x, w, pdst, planemask, index) {\
+ register PixelGroup dstpixel; \
+ register unsigned int idx; \
+ switch(idx = ((index)&3)<<1){ \
+ case 0: \
+ dstpixel = (*(pdst) &cfbmask[idx]); \
+ break; \
+ case 6: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
+ break; \
+ default: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
+ BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
+ }; \
+ dstpixel &= ~(planemask); \
+ dstpixel |= (src & planemask); \
+ *(pdst) &= cfbrmask[idx]; \
+ switch(idx){ \
+ case 0: \
+ *(pdst) |= (dstpixel & cfbmask[idx]); \
+ break; \
+ case 2: \
+ case 4: \
+ pdst++;idx++; \
+ *(pdst) = ((*(pdst)) & cfbrmask[idx]) | \
+ (BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
+ pdst--;idx--; \
+ case 6: \
+ *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
+ break; \
+ }; \
+}
+
+#define putbitsrop24(src, x, pdst, planemask, rop) \
+{ \
+ register PixelGroup t1, dstpixel; \
+ register unsigned int idx; \
+ switch(idx = (x)<<1){ \
+ case 0: \
+ dstpixel = (*(pdst) &cfbmask[idx]); \
+ break; \
+ case 6: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
+ break; \
+ default: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
+ BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
+ }; \
+ DoRop(t1, rop, (src), dstpixel); \
+ dstpixel &= ~planemask; \
+ dstpixel |= (t1 & planemask); \
+ *(pdst) &= cfbrmask[idx]; \
+ switch(idx){ \
+ case 0: \
+ *(pdst) |= (dstpixel & cfbmask[idx]); \
+ break; \
+ case 2: \
+ case 4: \
+ *((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \
+ (BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \
+ case 6: \
+ *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
+ }; \
+}
+# else /* PSZ == 24 && PPW == 1 */
#define maskbits(x, w, startmask, endmask, nlw) \
startmask = cfbstarttab[(x)&PIM]; \
endmask = cfbendtab[((x)+(w)) & PIM]; \
@@ -400,6 +526,17 @@ getleftbits(psrc, w, dst)
startmask = cfbstarttab[(x)&PIM]; \
endmask = cfbendtab[((x)+(w)) & PIM];
+/* FIXME */
+#define maskbits24(x, w, startmask, endmask, nlw) \
+ abort()
+#define getbits24(psrc, dst, index) \
+ abort()
+#define putbits24(src, x, w, pdst, planemask, index) \
+ abort()
+#define putbitsrop24(src, x, pdst, planemask, rop) \
+ abort()
+
+#endif /* PSZ == 24 && PPW == 1 */
#define getbits(psrc, x, w, dst) \
if ( ((x) + (w)) <= PPW) \
@@ -425,8 +562,8 @@ if ( ((x)+(w)) <= PPW) \
} \
else \
{ \
- unsigned long m; \
- unsigned long n; \
+ unsigned int m; \
+ unsigned int n; \
PixelGroup pm = PFILL(planemask); \
m = PPW-(x); \
n = (w) - m; \
@@ -484,8 +621,8 @@ if ( ((x)+(w)) <= PPW) \
} \
else \
{ \
- unsigned long m; \
- unsigned long n; \
+ CfbBits m; \
+ CfbBits n; \
PixelGroup t1, t2; \
PixelGroup pm; \
PFILL2(planemask, pm); \
@@ -552,6 +689,15 @@ else \
*/
/* useful only when not spanning destination longwords */
+#if PSZ == 24
+#define putbitsmropshort24(src,x,w,pdst,index) {\
+ PixelGroup _tmpmask; \
+ PixelGroup _t1; \
+ maskpartialbits ((x), (w), _tmpmask); \
+ _t1 = SCRRIGHT((src), (x)); \
+ DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \
+}
+#endif
#define putbitsmropshort(src,x,w,pdst) {\
PixelGroup _tmpmask; \
PixelGroup _t1; \
@@ -583,6 +729,22 @@ if ((x) + (w) <= PPW) {\
#if GETLEFTBITS_ALIGNMENT == 1
#define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc)
+#define getleftbits24(psrc, w, dst, idx){ \
+ regiseter int index; \
+ switch(index = ((idx)&3)<<1){ \
+ case 0: \
+ dst = (*((unsigned int *) psrc))&cfbmask[index]; \
+ break; \
+ case 2: \
+ case 4: \
+ dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \
+ dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \
+ break; \
+ case 6: \
+ dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \
+ break; \
+ }; \
+}
#endif /* GETLEFTBITS_ALIGNMENT == 1 */
#define getglyphbits(psrc, x, w, dst) \
@@ -650,16 +812,76 @@ if ((x) + (w) <= PPW) {\
q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
*(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
}
+/* I just copied this to get the linker satisfied on PowerPC,
+ * so this may not be correct at all.
+ */
+#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
+{ \
+ PixelGroup q; \
+ q = *(psrcstip) >> (xt); \
+ q = ((ones) ? q : ~q) & 1; \
+ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
+}
#else /* BITMAP_BIT_ORDER == LSB */
+
+/* this must load 32 bits worth; for most machines, thats an int */
+#define CfbFetchUnaligned(x) ldl_u(x)
+
#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \
{ \
PixelGroup q; \
- q = *(psrcstip) >> (xt); \
+ q = CfbFetchUnaligned(psrcstip) >> (xt); \
if ( ((xt)+(w)) > (PPW*PSZ) ) \
- q |= (*((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \
+ q |= (CfbFetchUnaligned((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \
q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
*(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
}
+#if PSZ == 24
+# if 0
+#define getstipplepixels24(psrcstip,xt,w,ones,psrcpix,destpix,stipindex,srcindex,dstindex) \
+{ \
+ PixelGroup q; \
+ CfbBits src; \
+ register unsigned int sidx; \
+ register unsigned int didx; \
+ sidx = ((srcindex) & 3)<<1; \
+ didx = ((dstindex) & 3)<<1; \
+ q = *(psrcstip) >> (xt); \
+/* if((srcindex)!=0)*/ \
+/* src = (((*(psrcpix)) << cfb24Shift[sidx]) & (cfbmask[sidx])) |*/ \
+/* (((*((psrcpix)+1)) << cfb24Shift[sidx+1]) & (cfbmask[sidx+1])); */\
+/* else */\
+ src = (*(psrcpix))&0xFFFFFF; \
+ if ( ((xt)+(w)) > PGSZ ) \
+ q |= (*((psrcstip)+1)) << (PGSZ -(xt)); \
+ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
+ src &= QuartetPixelMaskTable[q]; \
+ *(destpix) &= cfbrmask[didx]; \
+ switch(didx) {\
+ case 0: \
+ *(destpix) |= (src &cfbmask[didx]); \
+ break; \
+ case 2: \
+ case 4: \
+ destpix++;didx++; \
+ *(destpix) = ((*(destpix)) & (cfbrmask[didx]))| \
+ (BitLeft(src, cfb24Shift[didx]) & (cfbmask[didx])); \
+ destpix--; didx--;\
+ case 6: \
+ *(destpix) |= (BitRight(src, cfb24Shift[didx]) & cfbmask[didx]); \
+ break; \
+ }; \
+}
+# else
+#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
+{ \
+ PixelGroup q; \
+ q = *(psrcstip) >> (xt); \
+ q = ((ones) ? q : ~q) & 1; \
+ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
+}
+# endif
+#endif /* PSZ == 24 */
#endif
extern PixelGroup cfbstarttab[];
@@ -670,3 +892,6 @@ extern PixelGroup cfbrmask[];
extern PixelGroup cfbmask[];
extern PixelGroup QuartetBitsTable[];
extern PixelGroup QuartetPixelMaskTable[];
+#if PSZ == 24
+extern int cfb24Shift[];
+#endif
diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c
index 37cec5c7d..bd2e1b6f1 100644
--- a/cfb/cfbpixmap.c
+++ b/cfb/cfbpixmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbpixmap.c,v 1.5 2001/12/14 19:59:23 dawes Exp $ */
/* pixmap management
written by drewry, september 1986
@@ -59,7 +60,7 @@ SOFTWARE.
#include "cfb.h"
#include "cfbmskbits.h"
-extern unsigned long endtab[];
+extern CfbBits endtab[];
PixmapPtr
cfbCreatePixmap (pScreen, width, height, depth)
@@ -146,9 +147,9 @@ cfbPadPixmap(pPixmap)
{
register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel);
register int h;
- register unsigned long mask;
- register unsigned long *p;
- register unsigned long bits; /* real pattern bits */
+ register CfbBits mask;
+ register CfbBits *p;
+ register CfbBits bits; /* real pattern bits */
register int i;
int rep; /* repeat count for pattern */
@@ -161,7 +162,7 @@ cfbPadPixmap(pPixmap)
mask = endtab[width];
- p = (unsigned long *)(pPixmap->devPrivate.ptr);
+ p = (CfbBits *)(pPixmap->devPrivate.ptr);
for (h=0; h < pPixmap->drawable.height; h++)
{
*p &= mask;
@@ -230,8 +231,8 @@ cfbXRotatePixmap(pPix, rw)
PixmapPtr pPix;
register int rw;
{
- register unsigned long *pw, *pwFinal;
- register unsigned long t;
+ register CfbBits *pw, *pwFinal;
+ register CfbBits t;
int rot;
if (pPix == NullPixmap)
@@ -247,7 +248,7 @@ cfbXRotatePixmap(pPix, rw)
ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
return;
}
- pw = (unsigned long *)pPix->devPrivate.ptr;
+ pw = (CfbBits *)pPix->devPrivate.ptr;
modulus (rw, (int) pPix->drawable.width, rot);
if(pPix->drawable.width == PPW)
{
@@ -263,25 +264,25 @@ cfbXRotatePixmap(pPix, rw)
{
ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n");
#ifdef notdef
- register unsigned long *pwTmp;
+ register CfbBits *pwTmp;
int size, tsize;
tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth);
- pwTmp = (unsigned long *) ALLOCATE_LOCAL(pPix->drawable.height * tsize);
+ pwTmp = (CfbBits *) ALLOCATE_LOCAL(pPix->drawable.height * tsize);
if (!pwTmp)
return;
/* divide pw (the pixmap) in two vertically at (w - rot) and swap */
tsize >>= 2;
size = pPix->devKind >> SIZE0F(PixelGroup);
- cfbQuickBlt((long *)pw, (long *)pwTmp,
+ cfbQuickBlt((CfbBits *)pw, (CfbBits *)pwTmp,
0, 0, 0, 0,
(int)pPix->drawable.width - rot, (int)pPix->drawable.height,
size, tsize);
- cfbQuickBlt((long *)pw, (long *)pw,
+ cfbQuickBlt((CfbBits *)pw, (CfbBits *)pw,
(int)pPix->drawable.width - rot, 0, 0, 0,
rot, (int)pPix->drawable.height,
size, size);
- cfbQuickBlt((long *)pwTmp, (long *)pw,
+ cfbQuickBlt((CfbBits *)pwTmp, (CfbBits *)pw,
0, 0, rot, 0,
(int)pPix->drawable.width - rot, (int)pPix->drawable.height,
tsize, size);
diff --git a/cfb/cfbply1rct.c b/cfb/cfbply1rct.c
index b1e5c8ff1..e75708b96 100644
--- a/cfb/cfbply1rct.c
+++ b/cfb/cfbply1rct.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbply1rct.c,v 3.9 2001/12/14 19:59:24 dawes Exp $ */
#include "X.h"
@@ -50,25 +51,32 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
{
cfbPrivGCPtr devPriv;
int nwidth;
- unsigned long *addrl, *addr;
+ CfbBits *addrl, *addr;
+#if PSZ == 24
+ CfbBits startmask, endmask;
+ register int pidx;
+#else
+#if PPW > 1
+ CfbBits mask, bits = ~((CfbBits)0);
+#endif
+#endif
int maxy;
int origin;
register int vertex1, vertex2;
- int c;
+ int c = 0;
BoxPtr extents;
int clip;
int y;
- int *vertex1p, *vertex2p;
+ int *vertex1p = NULL, *vertex2p;
int *endp;
- int x1, x2;
- int dx1, dx2;
- int dy1, dy2;
- int e1, e2;
- int step1, step2;
- int sign1, sign2;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0;
+ int dy1 = 0, dy2 = 0;
+ int e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0;
+ int sign1 = 0, sign2 = 0;
int h;
int l, r;
- unsigned long mask, bits = ~((unsigned long)0);
int nmiddle;
RROP_DECLARE
@@ -80,7 +88,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
devPriv = cfbGetGCPrivate(pGC);
#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1)
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
{
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
return;
@@ -88,7 +96,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
#endif
origin = *((int *) &pDrawable->x);
vertex2 = origin - ((origin & 0x8000) << 1);
- extents = &devPriv->pCompositeClip->extents;
+ extents = &pGC->pCompositeClip->extents;
RROP_FETCH_GCPRIV(devPriv);
vertex1 = *((int *) &extents->x1) - vertex2;
vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
@@ -167,9 +175,9 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
return;
}
-#define AddrYPlus(a,y) (unsigned long *) (((unsigned char *) (a)) + (y) * nwidth)
+#define AddrYPlus(a,y) (CfbBits *) (((unsigned char *) (a)) + (y) * nwidth)
- cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, unsigned long);
+ cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, CfbBits);
addrl = AddrYPlus(addrl,y + pDrawable->y);
origin = intToX(origin);
vertex2p = vertex1p;
@@ -178,7 +186,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
vertex2p = (int *) ptsIn;
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
x = intToX(vertex); \
- if (dy = intToY(c) - y) { \
+ if ((dy = intToY(c) - y)) { \
dx = intToX(c) - x; \
step = 0; \
if (dx >= 0) \
@@ -273,13 +281,40 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
#define LWRD_SHIFT 3
#endif /* PGSZ */
+#if PSZ == 24
+ addr = (CfbBits *)((char *)addrl + ((l * 3) & ~0x03));
+#else /* PSZ == 24 */
#if PWSH > LWRD_SHIFT
l = l >> (PWSH - LWRD_SHIFT);
#endif
#if PWSH < LWRD_SHIFT
l = l << (LWRD_SHIFT - PWSH);
#endif
- addr = (unsigned long *) (((char *) addrl) + l);
+ addr = (CfbBits *) (((char *) addrl) + l);
+#endif /* PSZ == 24 */
+#if PSZ == 24
+ if (nmiddle <= 1){
+ if (nmiddle)
+ RROP_SOLID24(addr, l);
+ } else {
+ maskbits(l, nmiddle, startmask, endmask, nmiddle);
+ pidx = l & 3;
+ if (startmask){
+ RROP_SOLID_MASK(addr, startmask, pidx-1);
+ addr++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ while (--nmiddle >= 0){
+ RROP_SOLID(addr, pidx);
+ addr++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addr, endmask, pidx);
+ }
+#else /* PSZ == 24 */
#if PPW > 1
if (c + nmiddle < PPW)
{
@@ -301,10 +336,11 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
RROP_SOLID(addr); addr++;
}
#if PPW > 1
- if (mask = ~SCRRIGHT(bits, r & PIM))
+ if ((mask = ~SCRRIGHT(bits, r & PIM)))
RROP_SOLID_MASK(addr,mask);
}
#endif
+#endif /* PSZ == 24 */
if (!--h)
break;
addrl = AddrYPlus (addrl, 1);
diff --git a/cfb/cfbpntwin.c b/cfb/cfbpntwin.c
index bf53cb3f9..d21544b37 100644
--- a/cfb/cfbpntwin.c
+++ b/cfb/cfbpntwin.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbpntwin.c,v 3.7 2002/09/16 18:05:31 eich Exp $ */
#include "X.h"
@@ -57,6 +58,11 @@ SOFTWARE.
#include "cfbmskbits.h"
#include "mi.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
void
cfbPaintWindow(pWin, pRegion, what)
WindowPtr pWin;
@@ -68,6 +74,7 @@ cfbPaintWindow(pWin, pRegion, what)
pPrivWin = cfbGetWindowPrivate(pWin);
+
switch (what) {
case PW_BACKGROUND:
switch (pWin->backgroundState) {
@@ -90,11 +97,22 @@ cfbPaintWindow(pWin, pRegion, what)
}
else
{
+ int xorg = pWin->drawable.x;
+ int yorg = pWin->drawable.y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ int index = pWin->drawable.pScreen->myNum;
+ if(WindowTable[index] == pWin) {
+ xorg -= panoramiXdataPtr[index].x;
+ yorg -= panoramiXdataPtr[index].y;
+ }
+ }
+#endif
cfbFillBoxTileOdd ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion),
REGION_RECTS(pRegion),
pWin->background.pixmap,
- (int) pWin->drawable.x, (int) pWin->drawable.y);
+ xorg, yorg);
}
break;
case BackgroundPixel:
@@ -122,16 +140,30 @@ cfbPaintWindow(pWin, pRegion, what)
}
else
{
+ int xorg, yorg;
+
for (pBgWin = pWin;
pBgWin->backgroundState == ParentRelative;
pBgWin = pBgWin->parent);
+ xorg = pBgWin->drawable.x;
+ yorg = pBgWin->drawable.y;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ int index = pWin->drawable.pScreen->myNum;
+ if(WindowTable[index] == pBgWin) {
+ xorg -= panoramiXdataPtr[index].x;
+ yorg -= panoramiXdataPtr[index].y;
+ }
+ }
+#endif
+
cfbFillBoxTileOdd ((DrawablePtr)pWin,
(int)REGION_NUM_RECTS(pRegion),
REGION_RECTS(pRegion),
pWin->border.pixmap,
- (int) pBgWin->drawable.x,
- (int) pBgWin->drawable.y);
+ xorg, yorg);
}
break;
}
@@ -191,15 +223,24 @@ cfbFillBoxSolid (pDrawable, nBox, pBox, pixel)
BoxPtr pBox;
unsigned long pixel;
{
- unsigned long *pdstBase;
+ CfbBits *pdstBase;
int widthDst;
register int h;
- register unsigned long rrop_xor;
- register unsigned long *pdst;
- register unsigned long leftMask, rightMask;
+ register CfbBits rrop_xor;
+ register CfbBits *pdst;
int nmiddle;
- register int m;
int w;
+#if PSZ == 24
+ int leftIndex, rightIndex;
+ CfbBits piQxelArray[3], *pdstULC; /*upper left corner*/
+
+ piQxelArray[0] = (pixel&0xFFFFFF) | ((pixel&0xFF)<<24);
+ piQxelArray[1] = ((pixel&0xFFFF00)>>8) | ((pixel&0xFFFF)<<16);
+ piQxelArray[2] = ((pixel&0xFFFFFF)<<8) | ((pixel&0xFF0000)>>16);
+#else
+ register CfbBits leftMask, rightMask;
+ register int m;
+#endif
cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase);
@@ -224,6 +265,168 @@ cfbFillBoxSolid (pDrawable, nBox, pBox, pixel)
else
{
#endif
+#if PSZ == 24
+/* _Box has x1, y1, x2, y2*/
+ leftIndex = pBox->x1 & 3;
+ rightIndex = ((leftIndex+w)<5)?0:(pBox->x2 &3);
+ nmiddle = w - rightIndex;
+ if(leftIndex){
+ nmiddle -= (4 - leftIndex);
+ }
+ nmiddle >>= 2;
+ if(nmiddle < 0)
+ nmiddle = 0;
+
+ pdst = pdstBase + pBox->y1 * widthDst + ((pBox->x1*3) >> 2);
+
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst -=2;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst -=2;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ pdst++;
+ *pdst-- = piQxelArray[2];
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 2:
+ while(h--){
+ if(leftIndex){
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ }
+ else{
+ *pdst++ = piQxelArray[0];
+ }
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ while(h--){
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ w = nmiddle;
+ pdstULC = pdst;
+/* maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);*/
+ while(h--){
+ nmiddle = w;
+ pdst = pdstULC;
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ break;
+ case 2:
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ pdst++;
+ *pdst++ = piQxelArray[2];
+ break;
+ case 3:
+ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ pdst++;
+ break;
+ }
+ while(nmiddle--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *pdst++ = piQxelArray[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ break;
+ case 3:
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ break;
+ }
+ pdstULC += widthDst;
+ }
+
+ }
+ }
+#else
pdst += (pBox->x1 >> PWSH);
if ((pBox->x1 & PIM) + w <= PPW)
{
@@ -267,6 +470,7 @@ cfbFillBoxSolid (pDrawable, nBox, pBox, pixel)
}
}
}
+#endif
#if PSZ == 8
}
#endif
@@ -280,30 +484,219 @@ cfbFillBoxTile32 (pDrawable, nBox, pBox, tile)
BoxPtr pBox; /* pointer to list of boxes to fill */
PixmapPtr tile; /* rotated, expanded tile */
{
- register unsigned long rrop_xor;
- register unsigned long *pdst;
- register int m;
- unsigned long *psrc;
+ register CfbBits *pdst;
+ CfbBits *psrc;
int tileHeight;
int widthDst;
int w;
int h;
- register unsigned long leftMask;
- register unsigned long rightMask;
int nmiddle;
int y;
int srcy;
- unsigned long *pdstBase;
+ CfbBits *pdstBase;
+#if PSZ == 24
+ int leftIndex, rightIndex;
+ CfbBits piQxelArray[3], *pdstULC;
+#else
+ register CfbBits rrop_xor;
+ register CfbBits leftMask;
+ register CfbBits rightMask;
+ register int m;
+#endif
tileHeight = tile->drawable.height;
- psrc = (unsigned long *)tile->devPrivate.ptr;
+ psrc = (CfbBits *)tile->devPrivate.ptr;
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase);
while (nBox--)
{
+#if PSZ == 24
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+ y = pBox->y1;
+ leftIndex = pBox->x1 & 3;
+/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/
+ rightIndex = pBox->x2 &3;
+ nmiddle = w - rightIndex;
+ if(leftIndex){
+ nmiddle -= (4 - leftIndex);
+ }
+ nmiddle >>= 2;
+ if(nmiddle < 0)
+ nmiddle = 0;
+
+ pdst = pdstBase + ((pBox->x1 *3)>> 2) + pBox->y1 * widthDst;
+ srcy = y % tileHeight;
+
+#define StepTile piQxelArray[0] = (psrc[srcy] & 0xFFFFFF) | ((psrc[srcy] & 0xFF)<<24); \
+ piQxelArray[1] = (psrc[srcy] & 0xFFFF00) | ((psrc[srcy] & 0xFFFF)<<16); \
+ piQxelArray[2] = ((psrc[srcy] & 0xFF0000)>>16) | \
+ ((psrc[srcy] & 0xFFFFFF)<<8); \
+ /*rrop_xor = psrc[srcy];*/ \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0;
+
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ StepTile
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst-=2;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst-=2;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ pdst++;
+ *pdst-- = piQxelArray[2];
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ StepTile
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 2:
+ while(h--){
+ StepTile
+ if(leftIndex){
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ }
+ else{
+ *pdst++ = piQxelArray[0];
+ }
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ w = nmiddle;
+ pdstULC = pdst;
+
+ while(h--){
+ StepTile
+ nmiddle = w;
+ pdst = pdstULC;
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ break;
+ case 2:
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ pdst++;
+ *pdst++ = piQxelArray[2];
+ break;
+ case 3:
+ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ pdst++;
+ break;
+ }
+ while(nmiddle--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *pdst++ = piQxelArray[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ break;
+ case 3:
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ break;
+ }
+ pdstULC += widthDst;
+ }
+ }
+ }
+#else
w = pBox->x2 - pBox->x1;
h = pBox->y2 - pBox->y1;
y = pBox->y1;
@@ -365,6 +758,7 @@ cfbFillBoxTile32 (pDrawable, nBox, pBox, tile)
}
}
}
+#endif
pBox++;
}
}
diff --git a/cfb/cfbpolypnt.c b/cfb/cfbpolypnt.c
index bf2217fb1..d8b781397 100644
--- a/cfb/cfbpolypnt.c
+++ b/cfb/cfbpolypnt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbpolypnt.c,v 3.6 2001/12/14 19:59:24 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -58,6 +59,10 @@ in this Software without prior written authorization from The Open Group.
} \
}
+#if PSZ == 24
+# include "cfbrrop24.h"
+#endif
+
void
cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
@@ -68,24 +73,31 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
{
register INT32 pt;
register INT32 c1, c2;
- register unsigned long ClipMask = 0x80008000;
- register unsigned long xor;
+ register CARD32 ClipMask = 0x80008000;
+ register CfbBits xor;
#ifdef PIXEL_ADDR
register PixelType *addrp;
register int npwidth;
+#if PSZ != 24
PixelType *addrpt;
+#endif
#else
- register unsigned long *addrl;
+ register CfbBits *addrl;
register int nlwidth;
register int xoffset;
- unsigned long *addrlt;
+ CfbBits *addrlt;
+#endif
+#if PSZ == 24
+ RROP_DECLARE
+ register int xtmp;
+ register PixelType *p;
#endif
register INT32 *ppt;
RegionPtr cclip;
int nbox;
register int i;
register BoxPtr pbox;
- unsigned long and;
+ CfbBits and;
int rop = pGC->alu;
int off;
cfbPrivGCPtr devPriv;
@@ -95,7 +107,7 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
rop = devPriv->rop;
if (rop == GXnoop)
return;
- cclip = devPriv->pCompositeClip;
+ cclip = pGC->pCompositeClip;
xor = devPriv->xor;
if ((mode == CoordModePrevious) && (npt > 1))
{
@@ -109,13 +121,27 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
off -= (off & 0x8000) << 1;
#ifdef PIXEL_ADDR
cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp);
+#if PSZ == 24
+ addrp = addrp + pDrawable->y * npwidth;
+#else
addrp = addrp + pDrawable->y * npwidth + pDrawable->x;
+#endif
if (rop == GXcopy)
{
+#if PSZ == 24
+ RROP_COPY_SETUP(xor)
+#endif
if (!(npwidth & (npwidth - 1)))
{
npwidth = ffs(npwidth) - 1;
+#if PSZ == 24
+ PointLoop(
+ xtmp = pDrawable->x + intToX(pt);
+ p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2);
+ RROP_SOLID24_COPY(p, xtmp))
+#else
PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;)
+#endif
}
#ifdef sun
else if (npwidth == 1152)
@@ -126,25 +152,49 @@ cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
#endif
else
{
+#if PSZ == 24
+ PointLoop(
+ xtmp = pDrawable->x + intToX(pt);
+ p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
+ RROP_SOLID24_COPY(p, xtmp))
+#else
PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;)
+#endif
}
}
else
{
and = devPriv->and;
+#if PSZ == 24
+ RROP_SET_SETUP(xor, and)
+ PointLoop(
+ xtmp = pDrawable->x + intToX(pt);
+ p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
+ RROP_SOLID24_SET(p, xtmp))
+#else
PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt);
*addrpt = DoRRop (*addrpt, and, xor);)
+#endif
}
#else /* !PIXEL_ADDR */
cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl);
addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH);
xoffset = pDrawable->x & PIM;
and = devPriv->and;
+#if PSZ == 24
PointLoop( addrlt = addrl + intToY(pt) * nlwidth
+ ((intToX(pt) + xoffset) >> PWSH);
*addrlt = DoRRop (*addrlt,
and | ~cfbmask[(intToX(pt) + xoffset) & PIM],
xor & cfbmask[(intToX(pt) + xoffset) & PIM]);
)
+#else
+ PointLoop( addrlt = addrl + intToY(pt) * nlwidth
+ + ((intToX(pt) + xoffset) >> PWSH);
+ *addrlt = DoRRop (*addrlt,
+ and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1],
+ xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]);
+ )
+#endif
#endif /* PIXEL_ADDR */
}
diff --git a/cfb/cfbpush8.c b/cfb/cfbpush8.c
index 850de518d..0de172f03 100644
--- a/cfb/cfbpush8.c
+++ b/cfb/cfbpush8.c
@@ -2,6 +2,8 @@
* Push Pixels for 8 bit displays.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbpush8.c,v 1.6 2001/12/14 19:59:24 dawes Exp $ */
+
/*
Copyright 1989, 1998 The Open Group
@@ -51,17 +53,17 @@ cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
DrawablePtr pDrawable;
int dx, dy, xOrg, yOrg;
{
- register unsigned long *src, *dst;
- register unsigned long pixel;
- register unsigned long c, bits;
- unsigned long *pdstLine, *psrcLine;
- unsigned long *pdstBase;
+ register CfbBits *src, *dst;
+ register CfbBits pixel;
+ register CfbBits c, bits;
+ CfbBits *pdstLine, *psrcLine;
+ CfbBits *pdstBase;
int srcWidth;
int dstWidth;
int xoff;
int nBitmapLongs, nPixmapLongs;
int nBitmapTmp, nPixmapTmp;
- unsigned long rightMask;
+ CfbBits rightMask;
BoxRec bbox;
cfbPrivGCPtr devPriv;
@@ -71,7 +73,7 @@ cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
bbox.y2 = bbox.y1 + dy;
devPriv = cfbGetGCPrivate(pGC);
- switch (RECT_IN_REGION(pGC->pScreen, devPriv->pCompositeClip, &bbox))
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
{
case rgnPART:
#ifndef LOWMEMFTPT
@@ -85,7 +87,7 @@ cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase)
- psrcLine = (unsigned long *) pBitmap->devPrivate.ptr;
+ psrcLine = (CfbBits *) pBitmap->devPrivate.ptr;
srcWidth = (int) pBitmap->devKind >> PWSH;
pixel = devPriv->xor;
diff --git a/cfb/cfbrctstp8.c b/cfb/cfbrctstp8.c
index 9b9db7462..7f6e93919 100644
--- a/cfb/cfbrctstp8.c
+++ b/cfb/cfbrctstp8.c
@@ -1,6 +1,7 @@
/*
* Fill 32 bit stippled rectangles for 8 bit frame buffers
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbrctstp8.c,v 3.6 2001/12/14 19:59:24 dawes Exp $ */
/*
Copyright 1989, 1998 The Open Group
@@ -56,36 +57,34 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
int nBox; /* number of boxes to fill */
register BoxPtr pBox; /* pointer to list of boxes to fill */
{
- unsigned long *src;
+ CfbBits *src;
int stippleHeight;
int nlwDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
register int h; /* height of current box */
- unsigned long startmask;
- unsigned long endmask; /* masks for reggedy bits at either end of line */
+ CfbBits startmask;
+ CfbBits endmask; /* masks for reggedy bits at either end of line */
int nlwMiddle; /* number of longwords between sides of boxes */
register int nlw; /* loop version of nlwMiddle */
- unsigned long *dstLine;
- register unsigned long *dst; /* pointer to bits we're writing */
- unsigned long *dstTmp;
+ CfbBits *dstLine;
+ register CfbBits *dst; /* pointer to bits we're writing */
+ CfbBits *dstTmp;
int y; /* current scan line */
- unsigned long *pbits;/* pointer to start of pixmap */
- register unsigned long bits; /* bits from stipple */
- int rot, lastStop, i;
- register unsigned long xor, and;
- cfbPrivGCPtr devPriv;
+ CfbBits *pbits;/* pointer to start of pixmap */
+ register CfbBits bits; /* bits from stipple */
+ int rot;
+ register CfbBits xor;
PixmapPtr stipple;
int wEnd;
- devPriv = cfbGetGCPrivate(pGC);
- stipple = devPriv->pRotatedPixmap;
+ stipple = pGC->pRotatedPixmap;
cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
stippleHeight = stipple->drawable.height;
- src = (unsigned long *)stipple->devPrivate.ptr;
+ src = (CfbBits *)stipple->devPrivate.ptr;
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
@@ -108,6 +107,7 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
rot = (pBox->x1 & ((PGSZ-1) & ~PIM));
pBox++;
y = y % stippleHeight;
+#if PPW == 4
if (cfb8StippleRRop == GXcopy)
{
if (w < PGSZ*2)
@@ -124,8 +124,8 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
dstLine += nlwDst;
if (startmask)
{
- *dst = *dst & ~startmask |
- GetPixelGroup (bits) & startmask;
+ *dst = (*dst & ~startmask) |
+ (GetPixelGroup (bits) & startmask);
dst++;
RotBitsLeft (bits, PGSZB);
}
@@ -137,8 +137,8 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
}
if (endmask)
{
- *dst = *dst & ~endmask |
- GetPixelGroup (bits) & endmask;
+ *dst = (*dst & ~endmask) |
+ (GetPixelGroup (bits) & endmask);
}
}
}
@@ -158,8 +158,8 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
dstLine += nlwDst;
if (startmask)
{
- *dstTmp = *dstTmp & ~startmask |
- GetPixelGroup (bits) & startmask;
+ *dstTmp = (*dstTmp & ~startmask) |
+ (GetPixelGroup (bits) & startmask);
dstTmp++;
RotBitsLeft (bits, PGSZB);
}
@@ -183,7 +183,7 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
{
dst = dstTmp + (nlwMiddle << 3);
*dst = (*dst & ~endmask) |
- GetPixelGroup (bits) & endmask;
+ (GetPixelGroup(bits) & endmask);
}
while (w--)
{
@@ -203,6 +203,7 @@ cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
}
}
else
+#endif /* PPW == 4 */
{
while (h--)
{
@@ -246,13 +247,13 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
BoxPtr pBox; /* pointer to list of boxes to fill */
{
int x, y, w, h;
- int nlwMiddle, nlwDst, nlwTmp;
- unsigned long startmask, endmask;
- register unsigned long *dst;
- unsigned long *dstLine, *pbits, *dstTmp;
- unsigned long *src;
- register unsigned long xor;
- register unsigned long bits, mask;
+ int nlwMiddle, nlwDst;
+ CfbBits startmask, endmask;
+ register CfbBits *dst;
+ CfbBits *dstLine, *pbits, *dstTmp;
+ CfbBits *src;
+ register CfbBits xor;
+ register CfbBits bits, mask;
int rot;
int wEnd;
cfbPrivGCPtr devPriv;
@@ -261,8 +262,8 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
register int nlw;
devPriv = cfbGetGCPrivate(pGC);
- stipple = devPriv->pRotatedPixmap;
- src = (unsigned long *)stipple->devPrivate.ptr;
+ stipple = pGC->pRotatedPixmap;
+ src = (CfbBits *)stipple->devPrivate.ptr;
stippleHeight = stipple->drawable.height;
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
@@ -289,6 +290,7 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
h = pBox->y2 - y;
pBox++;
y %= stippleHeight;
+#if PPW == 4
if (cfb8StippleRRop == GXcopy)
{
xor = devPriv->xor;
@@ -418,6 +420,7 @@ cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
}
}
else
+#endif /* PPW == 4 */
{
while (h--)
{
@@ -461,8 +464,8 @@ cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox)
int nBox;
register BoxPtr pBox;
{
- unsigned long *pdstBase; /* pointer to start of bitmap */
- unsigned long *pdstLine; /* current destination line */
+ CfbBits *pdstBase; /* pointer to start of bitmap */
+ CfbBits *pdstLine; /* current destination line */
int nlwDst; /* width in longwords of bitmap */
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
int nlwMiddle;
@@ -470,14 +473,14 @@ cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox)
int x, y, w, h, xrem, xSrc, ySrc;
int stwidth, stippleWidth;
int stippleHeight;
- register unsigned long bits, inputBits;
+ register CfbBits bits, inputBits;
register int partBitsLeft;
int nextPartBits;
int bitsLeft, bitsWhole;
- register unsigned long *pdst; /* pointer to current word in bitmap */
- unsigned long *srcTemp, *srcStart;
- unsigned long *psrcBase;
- unsigned long startmask, endmask;
+ register CfbBits *pdst; /* pointer to current word in bitmap */
+ CfbBits *srcTemp, *srcStart;
+ CfbBits *psrcBase;
+ CfbBits startmask, endmask;
if (pGC->fillStyle == FillStippled)
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
@@ -502,7 +505,7 @@ cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox)
stwidth = pStipple->devKind >> PWSH;
stippleWidth = pStipple->drawable.width;
stippleHeight = pStipple->drawable.height;
- psrcBase = (unsigned long *) pStipple->devPrivate.ptr;
+ psrcBase = (CfbBits *) pStipple->devPrivate.ptr;
/*
* The Target:
diff --git a/cfb/cfbrrop.c b/cfb/cfbrrop.c
index 69ec0278d..1ee6771e0 100644
--- a/cfb/cfbrrop.c
+++ b/cfb/cfbrrop.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.c,v 1.6 2001/12/14 19:59:24 dawes Exp $ */
/* cfb reduced rasterop computations */
@@ -123,10 +124,10 @@ in this Software without prior written authorization from The Open Group.
int
cfbReduceRasterOp (rop, fg, pm, andp, xorp)
int rop;
- unsigned long fg, pm;
- unsigned long *andp, *xorp;
+ CfbBits fg, pm;
+ CfbBits *andp, *xorp;
{
- unsigned long and, xor;
+ CfbBits and, xor;
int rrop;
fg = PFILL (fg);
@@ -197,6 +198,9 @@ cfbReduceRasterOp (rop, fg, pm, andp, xorp)
and = 0;
xor = ~0;
break;
+ default:
+ and = xor = 0;
+ break;
}
and |= ~pm;
xor &= pm;
diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h
index 4423e040d..d6f095e6b 100644
--- a/cfb/cfbrrop.h
+++ b/cfb/cfbrrop.h
@@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.h,v 3.10 2001/12/14 19:59:24 dawes Exp $ */
+
#ifndef GXcopy
#include "X.h"
#endif
@@ -38,34 +40,162 @@ in this Software without prior written authorization from The Open Group.
#endif
#if RROP == GXcopy
-#define RROP_DECLARE register unsigned long rrop_xor;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_xor; \
+ CfbBits piQxelXor[3], spiQxelXor[8];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[2] = rrop_xor << 24; \
+ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = rrop_xor << 16; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelXor[6] = rrop_xor << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0; \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
+ if (idx == 2 || idx == 4){ \
+ idx++; \
+ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
+ } \
+ }
+#define RROP_SOLID(dst, idx) \
+ (*(dst) = piQxelXor[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask)))
+#else
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
+#define RROP_DECLARE register CfbBits rrop_xor;
#define RROP_SOLID(dst) (*(dst) = (rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy)
#endif /* GXcopy */
#if RROP == GXxor
-#define RROP_DECLARE register unsigned long rrop_xor;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_xor; \
+ CfbBits piQxelXor[3], spiQxelXor[8];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[2] = rrop_xor << 24; \
+ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = rrop_xor << 16; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelXor[6] = rrop_xor << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0; \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) ^= spiQxelXor[idx]; \
+ if (idx == 2 || idx == 4) \
+ *((dst)+1) ^= spiQxelXor[idx+1]; \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) ^= piQxelXor[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) ^= (piQxelXor[(idx)] & (mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_xor;
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor)
#endif /* GXxor */
#if RROP == GXand
-#define RROP_DECLARE register unsigned long rrop_and;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_and; \
+ CfbBits piQxelAnd[3], spiQxelAnd[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \
+ spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
+ spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \
+ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
+ spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \
+ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
+ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
+ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) &= spiQxelAnd[0]; \
+ break; \
+ case 3: \
+ *(dst) &= spiQxelAnd[1]; \
+ break; \
+ case 1: \
+ *(dst) &= spiQxelAnd[2]; \
+ *((dst)+1) &= spiQxelAnd[3]; \
+ break; \
+ case 2: \
+ *(dst) &= spiQxelAnd[4]; \
+ *((dst)+1) &= spiQxelAnd[5]; \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) &= piQxelAnd[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) &= (piQxelAnd[(idx)] | ~(mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_and;
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and;
#define RROP_SOLID(dst) (*(dst) &= (rrop_and))
#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And)
#endif /* GXand */
#if RROP == GXor
-#define RROP_DECLARE register unsigned long rrop_or;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_or; \
+ CfbBits piQxelOr[3], spiQxelOr[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \
+ spiQxelOr[0] = rrop_or & 0xFFFFFF; \
+ spiQxelOr[1] = rrop_or << 24; \
+ spiQxelOr[2] = rrop_or << 16; \
+ spiQxelOr[3] = rrop_or << 8; \
+ spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \
+ spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \
+ piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \
+ piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \
+ piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) |= spiQxelOr[0]; \
+ break; \
+ case 3: \
+ *(dst) |= spiQxelOr[3]; \
+ break; \
+ case 1: \
+ *(dst) |= spiQxelOr[1]; \
+ *((dst)+1) |= spiQxelOr[4]; \
+ break; \
+ case 2: \
+ *(dst) |= spiQxelOr[2]; \
+ *((dst)+1) |= spiQxelOr[5]; \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) |= piQxelOr[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) |= (piQxelOr[(idx)] & (mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_or;
#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) |= (rrop_or))
#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or)
#endif /* GXor */
@@ -78,11 +208,58 @@ in this Software without prior written authorization from The Open Group.
#endif /* GXnoop */
#if RROP == GXset
-#define RROP_DECLARE register unsigned long rrop_and, rrop_xor;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \
+ CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[1] = rrop_xor << 24; \
+ spiQxelXor[2] = rrop_xor << 16; \
+ spiQxelXor[3] = rrop_xor << 8; \
+ spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \
+ spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \
+ spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \
+ spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
+ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
+ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
+ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
+ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
+ break; \
+ case 3: \
+ *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
+ break; \
+ case 1: \
+ *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
+ break; \
+ case 2: \
+ *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)]))
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_and, rrop_xor;
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
rrop_xor = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General)
#endif /* GXset */
@@ -126,24 +303,24 @@ in this Software without prior written authorization from The Open Group.
#define RROP_SPAN(pdst,nmiddle) {\
int part = (nmiddle) & RROP_UNROLL_MASK; \
(nmiddle) >>= RROP_UNROLL_SHIFT; \
- (pdst) += part * (sizeof (unsigned long) / sizeof (*pdst)); \
+ (pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \
switch (part) {\
- RROP_UNROLL_CASE((unsigned long *) (pdst)) \
+ RROP_UNROLL_CASE((CfbBits *) (pdst)) \
} \
while (--(nmiddle) >= 0) { \
- (pdst) += RROP_UNROLL * (sizeof (unsigned long) / sizeof (*pdst)); \
- RROP_UNROLL_LOOP((unsigned long *) (pdst)) \
+ (pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \
+ RROP_UNROLL_LOOP((CfbBits *) (pdst)) \
} \
}
#else
#define RROP_SPAN(pdst,nmiddle) \
while (--(nmiddle) >= 0) { \
- RROP_SOLID((unsigned long *) (pdst)); \
- (pdst) += sizeof (unsigned long) / sizeof (*pdst); \
+ RROP_SOLID((CfbBits *) (pdst)); \
+ (pdst) += sizeof (CfbBits) / sizeof (*pdst); \
}
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define RROP_NAME_CAT(prefix,suffix) prefix##suffix
#else
#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix
diff --git a/cfb/cfbscrinit.c b/cfb/cfbscrinit.c
index ad8bee4f5..dae88ff5c 100644
--- a/cfb/cfbscrinit.c
+++ b/cfb/cfbscrinit.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbscrinit.c,v 1.19 2001/01/17 22:36:36 dawes Exp $ */
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
@@ -43,13 +44,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "cfbmskbits.h"
#include "mibstore.h"
-
-miBSFuncRec cfbBSFuncRec = {
+BSFuncRec cfbBSFuncRec = {
cfbSaveAreas,
cfbRestoreAreas,
- (void (*)()) 0,
- (PixmapPtr (*)()) 0,
- (PixmapPtr (*)()) 0,
+ (BackingStoreSetClipmaskRgnProcPtr) 0,
+ (BackingStoreGetImagePixmapProcPtr) 0,
+ (BackingStoreGetSpansPixmapProcPtr) 0,
};
Bool
@@ -80,9 +80,6 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
- int i;
- extern RegionPtr (*cfbPuntCopyPlane)();
-
if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0))
return FALSE;
pScreen->defColormap = FakeClientID(0);
@@ -108,12 +105,10 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
pScreen->CreateGC = cfbCreateGC;
pScreen->CreateColormap = cfbInitializeColormap;
pScreen->DestroyColormap = (void (*)())NoopDDA;
-#ifdef STATIC_COLOR
pScreen->InstallColormap = cfbInstallColormap;
pScreen->UninstallColormap = cfbUninstallColormap;
pScreen->ListInstalledColormaps = cfbListInstalledColormaps;
pScreen->StoreColors = (void (*)())NoopDDA;
-#endif
pScreen->ResolveColor = cfbResolveColor;
pScreen->BitmapToRegion = mfbPixmapToRegion;
@@ -137,6 +132,7 @@ cfbCreateScreenResources(pScreen)
}
#endif
+Bool
cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
register ScreenPtr pScreen;
pointer pbits; /* pointer to screen bitmap */
@@ -144,7 +140,6 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
- int i, j;
#ifdef CFB_NEED_SCREEN_PRIVATE
pointer oldDevPrivate;
#endif
@@ -164,19 +159,18 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
#endif
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
rootdepth, ndepths, depths,
- defaultVisual, nvisuals, visuals,
- (miBSFuncPtr) 0))
+ defaultVisual, nvisuals, visuals))
return FALSE;
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = cfbCloseScreen;
- /* init backing store here so we can overwrite CloseScreen without stepping
- * on the backing store wrapped version */
- miInitializeBackingStore (pScreen, &cfbBSFuncRec);
#ifdef CFB_NEED_SCREEN_PRIVATE
pScreen->CreateScreenResources = cfbCreateScreenResources;
pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate;
pScreen->devPrivate = oldDevPrivate;
#endif
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ pScreen->GetScreenPixmap = cfbGetScreenPixmap;
+ pScreen->SetScreenPixmap = cfbSetScreenPixmap;
return TRUE;
}
@@ -193,3 +187,28 @@ cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
return FALSE;
return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
}
+
+PixmapPtr
+cfbGetScreenPixmap(pScreen)
+ ScreenPtr pScreen;
+{
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ return (PixmapPtr)pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
+#else
+ return (PixmapPtr)pScreen->devPrivate;
+#endif
+}
+
+void
+cfbSetScreenPixmap(pPix)
+ PixmapPtr pPix;
+{
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ if (pPix)
+ pPix->drawable.pScreen->devPrivates[cfbScreenPrivateIndex].ptr =
+ (pointer)pPix;
+#else
+ if (pPix)
+ pPix->drawable.pScreen->devPrivate = (pointer)pPix;
+#endif
+}
diff --git a/cfb/cfbsetsp.c b/cfb/cfbsetsp.c
index 4a3d2fbfe..2096d4e34 100644
--- a/cfb/cfbsetsp.c
+++ b/cfb/cfbsetsp.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbsetsp.c,v 3.5 2001/12/14 19:59:24 dawes Exp $ */
#include "X.h"
#include "Xmd.h"
@@ -67,6 +68,7 @@ SOFTWARE.
* boxes, we may not want to start grabbing bits at psrc but at some offset
* further on.)
*/
+void
cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask)
int y;
int xOrigin; /* where this scanline starts */
@@ -83,19 +85,46 @@ cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemas
register int tmpSrc; /* scratch buffer to collect bits in */
int dstBit; /* offset in bits from beginning of
* word */
+ int offSrc;
+ int nl;
+#if PSZ == 24
+ register char *psrcb, *pdstb;
+ register int xIndex;
+#else
register int nstart; /* number of bits from first partial */
register int nend; /* " " last partial word */
- int offSrc;
- int startmask, endmask, nlMiddle, nl;
+ int startmask, endmask, nlMiddle;
+#endif
DeclareMergeRop()
InitializeMergeRop(alu,planemask);
+#if PSZ == 24
+ pdst = pdstBase + (y * widthDst);
+ xIndex = xStart;
+ pdstb = (char *)pdst + (xStart * 3);
+ offSrc = xStart - xOrigin;
+ psrcb = (char *)psrc + (offSrc * 3);
+#else
pdst = pdstBase + (y * widthDst) + (xStart >> PWSH);
psrc += (xStart - xOrigin) >> PWSH;
offSrc = (xStart - xOrigin) & PIM;
+#endif
w = xEnd - xStart;
dstBit = xStart & PIM;
+#if PSZ == 24
+ nl = w;
+ while (nl--){
+ psrc = (unsigned int *)((unsigned long)psrcb & ~0x03);
+ getbits24(psrc, tmpSrc, offSrc);
+ pdst = (int *)((unsigned long)pdstb & ~0x03);
+ DoMergeRop24(tmpSrc, pdst, xIndex);
+ offSrc++;
+ psrcb += 3;
+ xIndex++;
+ pdstb += 3;
+ }
+#else /* PSZ == 24 */
if (dstBit + w <= PPW)
{
maskpartialbits(dstBit, w, startmask);
@@ -139,6 +168,7 @@ cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemas
getbits(psrc, offSrc, nend, tmpSrc);
putbitsmropshort(tmpSrc, 0, nend, pdst);
}
+#endif /* PSZ == 24 */
}
@@ -160,7 +190,7 @@ cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
int fSorted;
{
unsigned int *psrc = (unsigned int *)pcharsrc;
- unsigned long *pdstBase; /* start of dst bitmap */
+ CfbBits *pdstBase; /* start of dst bitmap */
int widthDst; /* width of bitmap in words */
register BoxPtr pbox, pboxLast, pboxTest;
register DDXPointPtr pptLast;
diff --git a/cfb/cfbsolid.c b/cfb/cfbsolid.c
index ead63a757..6d8a95692 100644
--- a/cfb/cfbsolid.c
+++ b/cfb/cfbsolid.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbsolid.c,v 3.8 2002/09/16 18:05:31 eich Exp $ */
#include "X.h"
@@ -117,17 +118,18 @@ RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox)
BoxPtr pBox;
{
register int m;
- register unsigned long *pdst;
+ register CfbBits *pdst;
RROP_DECLARE
- register unsigned long leftMask, rightMask;
- unsigned long *pdstBase, *pdstRect;
+ CfbBits *pdstBase, *pdstRect;
int nmiddle;
int h;
int w;
int widthDst;
- cfbPrivGCPtr devPriv;
-
- devPriv = cfbGetGCPrivate(pGC);
+#if PSZ == 24
+ int leftIndex, rightIndex;
+#else
+ register CfbBits leftMask, rightMask;
+#endif
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
@@ -153,6 +155,577 @@ RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox)
else
{
#endif
+#if PSZ == 24
+ leftIndex = pBox->x1 &3;
+/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/
+ rightIndex = pBox->x2 &3;
+
+ nmiddle = w - rightIndex;
+ if(leftIndex){
+ nmiddle -= (4 - leftIndex);
+ }
+ nmiddle >>= 2;
+ if(nmiddle < 0)
+ nmiddle = 0;
+
+ pdstRect += (pBox->x1 * 3) >> 2;
+ pdst = pdstRect;
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ pdst++;
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+#endif
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxeAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelXor[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+#endif
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 2: /* leftIndex + w = 2*/
+ switch(leftIndex){
+ case 2:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
+ *pdst-- &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*case 2 leftIndex == 0 */
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[0] | 0xFF000000);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ while(h--){
+ pdst = pdstRect;
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000));
+ pdst++;
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^=(piQxelXor[1] & 0xFFFF0000);
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ pdst++;
+#endif
+ break;
+ }
+ m = nmiddle;
+ while(m--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+ pdst++;
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst++;
+#endif
+ break;
+ }
+ pdstRect += widthDst;
+ }
+ }
+ }
+#else /* PSZ != 24 */
pdstRect += (pBox->x1 >> PWSH);
if ((pBox->x1 & PIM) + w <= PPW)
{
@@ -193,6 +766,7 @@ RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox)
}
}
}
+#endif
#if PSZ == 8
}
#endif
@@ -208,14 +782,13 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
int *pwidthInit; /* pointer to list of n widths */
int fSorted;
{
- unsigned long *pdstBase;
+ CfbBits *pdstBase;
int widthDst;
RROP_DECLARE
- register unsigned long *pdst;
+ register CfbBits *pdst;
register int nlmiddle;
- register unsigned long startmask, endmask;
register int w;
int x;
@@ -226,10 +799,15 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
DDXPointPtr pptFree;
int *pwidth;
cfbPrivGCPtr devPriv;
+#if PSZ == 24
+ int leftIndex, rightIndex;
+#else
+ register CfbBits startmask, endmask;
+#endif
devPriv = cfbGetGCPrivate(pGC);
RROP_FETCH_GCPRIV(devPriv)
- n = nInit * miFindMaxBand(devPriv->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -240,8 +818,7 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(devPriv->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
@@ -254,6 +831,493 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
w = *pwidth++;
if (!w)
continue;
+#if PSZ == 24
+ leftIndex = x &3;
+/* rightIndex = ((leftIndex+w)<5)?0:(x+w)&3;*/
+ rightIndex = (x+w)&3;
+
+ nlmiddle = w - rightIndex;
+ if(leftIndex){
+ nlmiddle -= (4 - leftIndex);
+ }
+/* nlmiddle += 3;*/
+ nlmiddle >>= 2;
+ if(nlmiddle < 0)
+ nlmiddle = 0;
+
+ pdst += (x >> 2)*3;
+ pdst += leftIndex? (leftIndex -1):0;
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ pdst++;
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+#endif
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelXor[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 2:
+/* pdst++;*/
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ break;
+ }
+ break;
+ case 2: /* leftIndex + w = 2*/
+ if(leftIndex){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ }
+ else{ /*case 2 leftIndex === 0 */
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ pdst--;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[0] | 0xFF000000);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ pdst++;
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000));
+ pdst++;
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^=(piQxelXor[1] & 0xFFFF0000);
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ pdst++;
+#endif
+ break;
+ }
+ while(nlmiddle--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ pdst++;
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst++;
+#endif
+ break;
+ }
+ }
+}
+#else
#if PSZ == 8
if (w <= PGSZB)
{
@@ -290,6 +1354,7 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
RROP_SOLID_MASK (pdst, endmask);
}
}
+#endif
}
DEALLOCATE_LOCAL(pptFree);
DEALLOCATE_LOCAL(pwidthFree);
diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c
index 7653e770b..0cdbddc7a 100644
--- a/cfb/cfbteblt8.c
+++ b/cfb/cfbteblt8.c
@@ -3,6 +3,7 @@
* 8 bit displays, in Copy mode with no clipping.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbteblt8.c,v 1.6 2001/12/14 19:59:25 dawes Exp $ */
/*
Copyright 1989, 1998 The Open Group
@@ -159,7 +160,7 @@ typedef unsigned int *glyphPointer;
#endif
#ifdef USE_LEFTBITS
-extern unsigned long endtab[];
+extern CfbBits endtab[];
#define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes))
@@ -313,7 +314,7 @@ extern unsigned long endtab[];
#define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]);
#define FirstStep Step
#else /* PGSZ == 32 */
-#define StoreBits(o) StorePixels(o,*((unsigned long *) (((char *) cfb8Pixels) + (c & 0x3c))));
+#define StoreBits(o) StorePixels(o,*((CfbBits *) (((char *) cfb8Pixels) + (c & 0x3c))));
#define FirstStep c = BitLeft (c, 2);
#endif /* PGSZ */
#endif /* BITMAP_BIT_ORDER */
@@ -328,9 +329,9 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
- register unsigned long c;
- register unsigned long *dst;
- register unsigned long leftMask, rightMask;
+ register CfbBits c;
+ register CfbBits *dst;
+ register CfbBits leftMask, rightMask;
register int hTmp;
register int xoff1;
register glyphPointer char1;
@@ -349,11 +350,14 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
#endif
FontPtr pfont = pGC->font;
- unsigned long *dstLine;
+ CfbBits *dstLine;
glyphPointer oldRightChar;
- unsigned long *pdstBase;
+ CfbBits *pdstBase;
glyphPointer leftChar;
- int widthDst, widthLeft;
+ int widthDst;
+#ifndef FAST_CONSTANT_OFFSET_MODE
+ int widthLeft;
+#endif
int widthGlyph;
int h;
int ew;
@@ -362,8 +366,8 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
int lshift;
int widthGlyphs;
#ifdef USE_LEFTBITS
- register unsigned long glyphMask;
- register unsigned long tmpSrc;
+ register CfbBits glyphMask;
+ register CfbBits tmpSrc;
register int glyphBytes;
#endif
@@ -454,8 +458,8 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
leftMask = cfbendtab[xoff1];
rightMask = cfbstarttab[xoff1];
-#define StoreBits0 StorePixels (0,dst[0] & leftMask | \
- GetPixelGroup(c) & rightMask);
+#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \
+ (GetPixelGroup(c) & rightMask));
#define GetBits GetBitsNS
SwitchEm
@@ -520,7 +524,8 @@ CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
leftMask = cfbendtab[xoff1];
rightMask = cfbstarttab[xoff1];
-#define StoreBits0 StorePixels (0,dst[0] & leftMask | GetPixelGroup(c) & rightMask);
+#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \
+ (GetPixelGroup(c) & rightMask));
#define GetBits WGetBits1S
SwitchEm
diff --git a/cfb/cfbtegblt.c b/cfb/cfbtegblt.c
index 383926619..0cba03575 100644
--- a/cfb/cfbtegblt.c
+++ b/cfb/cfbtegblt.c
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbtegblt.c,v 3.6 2001/12/14 19:59:25 dawes Exp $ */
+
#include "X.h"
#include "Xmd.h"
#include "Xproto.h"
@@ -91,7 +93,7 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
{
FontPtr pfont = pGC->font;
int widthDst;
- unsigned long *pdstBase; /* pointer to longword with top row
+ CfbBits *pdstBase; /* pointer to longword with top row
of current glyph */
int w; /* width of glyph and char */
@@ -101,12 +103,12 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
register unsigned char *pglyph;
int widthGlyph;
- register unsigned long *pdst;/* pointer to current longword in dst */
+ register CfbBits *pdst;/* pointer to current longword in dst */
int hTmp; /* counter for height */
BoxRec bbox; /* for clipping */
register int wtmp,xtemp,width;
- unsigned long bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp;
+ CfbBits bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp;
int tmpx;
xpos += pDrawable->x;
@@ -154,7 +156,7 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
one day...
*/
- miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
break;
case rgnIN:
@@ -174,18 +176,37 @@ cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
while (width > 0)
{
+#if PSZ == 24
+ tmpx = x & 3;
+ w = 1;
+#else
tmpx = x & PIM;
w = min(width, PPW - tmpx);
w = min(w, (PGSZ - xtemp));
-
- ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH));
+#endif
+
+#if PSZ == 24
+ ptemp = (CfbBits *)(pglyph + ((xtemp *3)>> 2));
+#else
+ ptemp = (CfbBits *)(pglyph + (xtemp >> MFB_PWSH));
+#endif
+#if PSZ == 24
+ getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp);
+ getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp);
+#else
getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1);
getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2);
+#endif
{
- unsigned long tmpDst = tmpDst1 | tmpDst2;
- unsigned long *pdsttmp = pdst + (x >> PWSH);
+ CfbBits tmpDst = tmpDst1 | tmpDst2;
+#if PSZ == 24
+ CfbBits *pdsttmp = pdst + ((x*3) >> 2);
+ putbits24(tmpDst,tmpx,w,pdsttmp,pGC->planemask,x);
+#else
+ CfbBits *pdsttmp = pdst + (x >> PWSH);
putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask);
+#endif
}
x += w;
xtemp += w;
diff --git a/cfb/cfbtile32.c b/cfb/cfbtile32.c
index 544857a25..cfa3bd503 100644
--- a/cfb/cfbtile32.c
+++ b/cfb/cfbtile32.c
@@ -2,6 +2,7 @@
* Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow.
* no depth dependencies.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbtile32.c,v 3.6 2001/12/14 19:59:25 dawes Exp $ */
/*
@@ -52,6 +53,93 @@ in this Software without prior written authorization from The Open Group.
#define SHARED_IDCACHE
#endif
+#if PSZ == 24
+#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
+/*#define STORE24(p,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<<cfb24Shift[idx])&cfbmask[idx])| \
+ (*(p)&cfbrmask[idx])); \
+ idx++; \
+ (p)++; \
+ *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))>>cfb24Shift[idx])&cfbmask[idx])| \
+ (*(p)&cfbrmask[idx])); \
+ (p)--; \
+ }*/
+#define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index)
+
+#define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask)))
+#define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \
+ (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \
+ (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
+
+#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
+# define Expand(left,right) {\
+ int part = nlwMiddle & ((PGSZB*2)-1); \
+ nlwMiddle *= 3; \
+ nlwMiddle >>= PWSH + 3; \
+ while (h--) { \
+ srcpix = psrc[srcy]; \
+ MROP_PREBUILD(srcpix); \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0; \
+ left \
+ p += part; \
+ switch (part) { \
+ case 7: \
+ STORE24(p - 7, xtmp - 7); \
+ case 6: \
+ STORE24(p - 6, xtmp - 6); \
+ case 5: \
+ STORE24(p - 5, xtmp - 5); \
+ case 4: \
+ STORE24(p - 4, xtmp - 4); \
+ case 3: \
+ STORE24(p - 3, xtmp - 3); \
+ case 2: \
+ STORE24(p - 2, xtmp - 2); \
+ case 1: \
+ STORE24(p - 1, xtmp - 1); \
+ } \
+ nlw = nlwMiddle; \
+ while (nlw) { \
+ STORE24 (p + 0, xtmp + 0); \
+ STORE24 (p + 1, xtmp + 1); \
+ STORE24 (p + 2, xtmp + 2); \
+ STORE24 (p + 3, xtmp + 3); \
+ STORE24 (p + 4, xtmp + 4); \
+ STORE24 (p + 5, xtmp + 5); \
+ STORE24 (p + 6, xtmp + 6); \
+ STORE24 (p + 7, xtmp + 7); \
+ p += 8; \
+ xtmp += 8; \
+ nlw--; \
+ } \
+ right \
+ p += nlwExtra; \
+ } \
+}
+#else
+#define Expand(left,right) {\
+ while (h--) { \
+ srcpix = psrc[srcy]; \
+ MROP_PREBUILD(srcpix); \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0; \
+ left \
+ while (nlw--) \
+ { \
+ STORE24(p,xtmp); \
+ if(xtmp&3) p++; \
+ xtmp++; \
+ } \
+ right \
+ p += nlwExtra; \
+ } \
+}
+#endif
+#else /*PSZ != 24*/
#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
@@ -119,6 +207,7 @@ in this Software without prior written authorization from The Open Group.
} \
}
#endif
+#endif /*PSZ == 24*/
void
MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox)
@@ -127,30 +216,33 @@ MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox)
int nBox; /* number of boxes to fill */
BoxPtr pBox; /* pointer to list of boxes to fill */
{
- register unsigned long srcpix;
- unsigned long *psrc; /* pointer to bits in tile, if needed */
+ register CfbBits srcpix;
+ CfbBits *psrc; /* pointer to bits in tile, if needed */
int tileHeight; /* height of the tile */
int nlwDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
register int h; /* height of current box */
- register unsigned long startmask;
- register unsigned long endmask; /* masks for reggedy bits at either end of line */
+ register CfbBits startmask;
+ register CfbBits endmask; /* masks for reggedy bits at either end of line */
int nlwMiddle; /* number of longwords between sides of boxes */
int nlwExtra; /* to get from right of box to left of next span */
- register int nlw; /* loop version of nlwMiddle */
- register unsigned long *p; /* pointer to bits we're writing */
+ register int nlw = 0; /* loop version of nlwMiddle */
+ register CfbBits *p; /* pointer to bits we're writing */
int y; /* current scan line */
int srcy; /* current tile position */
- unsigned long *pbits;/* pointer to start of pixmap */
+ CfbBits *pbits;/* pointer to start of pixmap */
PixmapPtr tile; /* rotated, expanded tile */
MROP_DECLARE_REG()
MROP_PREBUILT_DECLARE()
+#if PSZ == 24
+ CfbBits xtmp;
+#endif
- tile = cfbGetGCPrivate(pGC)->pRotatedPixmap;
+ tile = pGC->pRotatedPixmap;
tileHeight = tile->drawable.height;
- psrc = (unsigned long *)tile->devPrivate.ptr;
+ psrc = (CfbBits *)tile->devPrivate.ptr;
MROP_INITIALIZE(pGC->alu, pGC->planemask);
@@ -161,10 +253,20 @@ MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox)
w = pBox->x2 - pBox->x1;
h = pBox->y2 - pBox->y1;
y = pBox->y1;
+#if PSZ == 24
+ xtmp = pBox->x1;
+ p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2);
+/* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/
+#else
p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH);
+#endif
srcy = y % tileHeight;
+#if PSZ == 24
+ if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3))
+#else
if ( ((pBox->x1 & PIM) + w) <= PPW)
+#endif
{
maskpartialbits(pBox->x1, w, startmask);
nlwExtra = nlwDst;
@@ -229,23 +331,26 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
int n; /* number of spans to fill */
DDXPointPtr ppt; /* pointer to list of start points */
int *pwidth;/* pointer to list of n widths */
- unsigned long *pbits; /* pointer to start of bitmap */
+ CfbBits *pbits; /* pointer to start of bitmap */
int nlwDst; /* width in longwords of bitmap */
- register unsigned long *p; /* pointer to current longword in bitmap */
+ register CfbBits *p; /* pointer to current longword in bitmap */
register int w; /* current span width */
register int nlw;
register int x;
- register unsigned long startmask;
- register unsigned long endmask;
- register unsigned long srcpix;
+ register CfbBits startmask;
+ register CfbBits endmask;
+ register CfbBits srcpix;
int y;
int *pwidthFree;/* copies of the pointers to free */
DDXPointPtr pptFree;
PixmapPtr tile;
- unsigned long *psrc; /* pointer to bits in tile */
+ CfbBits *psrc; /* pointer to bits in tile */
int tileHeight;/* height of the tile */
MROP_DECLARE_REG ()
MROP_PREBUILT_DECLARE()
+#if PSZ == 24
+ CfbBits xtmp;
+#endif
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
@@ -262,9 +367,9 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
- tile = cfbGetGCPrivate(pGC)->pRotatedPixmap;
+ tile = pGC->pRotatedPixmap;
tileHeight = tile->drawable.height;
- psrc = (unsigned long *)tile->devPrivate.ptr;
+ psrc = (CfbBits *)tile->devPrivate.ptr;
MROP_INITIALIZE(pGC->alu, pGC->planemask);
@@ -280,11 +385,21 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
y = ppt->y;
++ppt;
w = *pwidth++;
+#if PSZ == 24
+/* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/
+ xtmp = x;
+ p = pbits + (y * nlwDst) + ((x >> 2)*3);
+#else
p = pbits + (y * nlwDst) + (x >> PWSH);
+#endif
srcpix = psrc[y & tileHeight];
MROP_PREBUILD(srcpix);
+#if PSZ == 24
+ if ((x & 3) + w < 5)
+#else
if ((x & PIM) + w < PPW)
+#endif
{
maskpartialbits(x, w, startmask);
*p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
@@ -295,12 +410,23 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (startmask)
{
*p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
+#if PSZ == 24
+ if(xtmp&3) p++;
+ xtmp++;
+#else
p++;
+#endif
}
while (nlw--)
{
+#if PSZ == 24
+ STORE24(p,xtmp);
+ if(xtmp&3) p++;
+ ++xtmp;
+#else
STORE(p);
++p;
+#endif
}
if (endmask)
{
@@ -318,11 +444,21 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
y = ppt->y;
++ppt;
w = *pwidth++;
+#if PSZ == 24
+/* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/
+ p = pbits + (y * nlwDst) + ((x >> 2)*3);
+ xtmp = x;
+#else
p = pbits + (y * nlwDst) + (x >> PWSH);
+#endif
srcpix = psrc[y % tileHeight];
MROP_PREBUILD(srcpix);
+#if PSZ == 24
+ if ((x & 3) + w < 5)
+#else
if ((x & PIM) + w < PPW)
+#endif
{
maskpartialbits(x, w, startmask);
*p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
@@ -333,12 +469,23 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (startmask)
{
*p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
+#if PSZ == 24
+ if(xtmp&3)p++;
+ xtmp++;
+#else
p++;
+#endif
}
while (nlw--)
{
+#if PSZ == 24
+ STORE24(p,xtmp);
+ if(xtmp&3)p++;
+ xtmp++;
+#else
STORE(p);
++p;
+#endif
}
if (endmask)
{
diff --git a/cfb/cfbtileodd.c b/cfb/cfbtileodd.c
index 2307f6b55..85efd614e 100644
--- a/cfb/cfbtileodd.c
+++ b/cfb/cfbtileodd.c
@@ -2,6 +2,7 @@
* Fill odd tiled rectangles and spans.
* no depth dependencies.
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbtileodd.c,v 3.6 2001/12/14 19:59:25 dawes Exp $ */
/*
@@ -45,11 +46,11 @@ in this Software without prior written authorization from The Open Group.
#include "mergerop.h"
-#if PGSZ == 32
+#if PSZ == 24
+#define LEFTSHIFT_AMT (3)
+#else /* PSZ != 24 */
#define LEFTSHIFT_AMT (5 - PWSH)
-#else /* PGSZ == 64 */
-#define LEFTSHIFT_AMT (6 - PWSH)
-#endif /* PGSZ */
+#endif /* PSZ == 24*/
#define LastTileBits {\
tmp = bits; \
@@ -59,6 +60,23 @@ in this Software without prior written authorization from The Open Group.
bits = *pSrc; \
}
+#if PSZ == 24
+#define ResetTileBits {\
+ pSrc = pSrcLine; \
+ nlwSrc = widthSrc;\
+ if (tileEndPart) { \
+ if (4 - xoff + tileEndPart <= 4) {\
+ bits = *pSrc++; \
+ nlwSrc--; \
+ } else \
+ bits = BitLeft(tmp, tileEndLeftShift) | \
+ BitRight(bits, tileEndRightShift); \
+ xoff = (xoff + xoffStep) & 3; \
+ leftShift = xoff << LEFTSHIFT_AMT; \
+ rightShift = PGSZ - leftShift; \
+ }\
+}
+#else
#define ResetTileBits {\
pSrc = pSrcLine; \
nlwSrc = widthSrc;\
@@ -74,6 +92,7 @@ in this Software without prior written authorization from The Open Group.
rightShift = PGSZ - leftShift; \
}\
}
+#endif
#define NextTileBits {\
if (nlwSrc == 1) {\
@@ -109,8 +128,8 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
int widthDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
int h; /* height of current box */
- unsigned long startmask;
- unsigned long endmask;/* masks for reggedy bits at either end of line */
+ CfbBits startmask;
+ CfbBits endmask;/* masks for reggedy bits at either end of line */
int nlwMiddle; /* number of longwords between sides of boxes */
int nlwSrc; /* number of whole longwords in source */
@@ -122,24 +141,23 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
MROP_DECLARE_REG()
- unsigned long *pDstBase; /* pointer to start of dest */
- unsigned long *pDstLine; /* poitner to start of dest box */
- unsigned long *pSrcBase; /* pointer to start of source */
- unsigned long *pSrcLine; /* pointer to start of source line */
- register unsigned long *pDst;
- register unsigned long *pSrc;
- register unsigned long bits, tmp;
- register int nlwPart;
+ CfbBits *pdstBase; /* pointer to start of dest */
+ CfbBits *pDstLine; /* poitner to start of dest box */
+ CfbBits *pSrcBase; /* pointer to start of source */
+ CfbBits *pSrcLine; /* pointer to start of source line */
+ register CfbBits *pDst;
+ register CfbBits *pSrc;
+ register CfbBits bits, tmp = 0;
int xoffStart, xoff;
int leftShiftStart, rightShiftStart, nlwSrcStart;
- unsigned long tileEndMask;
+ CfbBits tileEndMask;
int tileEndLeftShift, tileEndRightShift;
int xoffStep;
int tileEndPart;
int needFirst;
- unsigned long narrow[2];
- unsigned long narrowMask;
- int narrowShift;
+ CfbBits narrow[2];
+ CfbBits narrowMask = 0;
+ int narrowShift = 0;
Bool narrowTile;
MROP_INITIALIZE (alu, planemask)
@@ -156,15 +174,24 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
widthSrc = 2;
narrowTile = TRUE;
}
- pSrcBase = (unsigned long *)tile->devPrivate.ptr;
+ pSrcBase = (CfbBits *)tile->devPrivate.ptr;
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase)
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+#if PSZ == 24
+ tileEndPart = (4 - tileWidth) & 3;
+ tileEndMask = cfbendpartial[tileWidth & 3];
+#else
tileEndPart = tileWidth & PIM;
tileEndMask = cfbendpartial[tileEndPart];
+#endif /* PSZ == 24 */
tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
tileEndRightShift = PGSZ - tileEndLeftShift;
+#if PSZ == 24
+ xoffStep = 4 - tileEndPart;
+#else
xoffStep = PPW - tileEndPart;
+#endif /* PSZ == 24 */
/*
* current assumptions: tile > 32 bits wide.
*/
@@ -174,8 +201,13 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
h = pBox->y2 - pBox->y1;
modulus (pBox->x1 - xrot, tileWidth, srcx);
modulus (pBox->y1 - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffDst = (4 - pBox->x1) & 3;
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
xoffDst = pBox->x1 & PIM;
if (xoffDst + w < PPW)
+#endif
{
maskpartialbits(pBox->x1, w, startmask);
endmask = 0;
@@ -185,9 +217,17 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
{
maskbits (pBox->x1, w, startmask, endmask, nlwMiddle)
}
- pDstLine = pDstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
+#if PSZ == 24
+ pDstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);
+#else
+ pDstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
+#endif
pSrcLine = pSrcBase + (srcy * widthSrc);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+#else
xoffSrc = srcx & PIM;
+#endif
if (xoffSrc >= xoffDst)
{
xoffStart = xoffSrc - xoffDst;
@@ -195,12 +235,20 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
}
else
{
+#if PSZ == 24
+ xoffStart = 4 - (xoffDst - xoffSrc);
+#else
xoffStart = PPW - (xoffDst - xoffSrc);
+#endif
needFirst = 0;
}
leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
rightShiftStart = PGSZ - leftShiftStart;
+#if PSZ == 24
+ nlwSrcStart = widthSrc - ((srcx*3) >> 2);
+#else
nlwSrcStart = widthSrc - (srcx >> PWSH);
+#endif
while (h--)
{
/* XXX only works when narrowShift >= PPW/2 */
@@ -208,15 +256,24 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
{
tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */
narrow[0] = tmp | SCRRIGHT (tmp, narrowShift);
+#if PSZ == 24
+ narrow[1] = BitLeft (tmp, 8) |
+ BitRight(tmp, 16);
+#else
narrow[1] = SCRLEFT (tmp, PPW - narrowShift) |
SCRRIGHT(tmp, 2 * narrowShift - PPW);
+#endif
pSrcLine = narrow;
}
xoff = xoffStart;
leftShift = leftShiftStart;
rightShift = rightShiftStart;
nlwSrc = nlwSrcStart;
+#if PSZ == 24
+ pSrc = pSrcLine + ((srcx * 3) >> 2);
+#else
pSrc = pSrcLine + (srcx >> PWSH);
+#endif
pDst = pDstLine;
bits = 0;
if (needFirst)
@@ -238,7 +295,8 @@ MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
#if MROP == Mcopy
if (nlwSrc > 1)
{
- nlwPart = nlw;
+ int nlwPart = nlw;
+
if (nlwPart >= nlwSrc)
nlwPart = nlwSrc - 1;
nlw -= nlwPart;
@@ -327,8 +385,8 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
int widthDst; /* width in longwords of the dest pixmap */
int w; /* width of current span */
- unsigned long startmask;
- unsigned long endmask; /* masks for reggedy bits at either end of line */
+ CfbBits startmask;
+ CfbBits endmask; /* masks for reggedy bits at either end of line */
int nlwSrc; /* number of whole longwords in source */
register int nlw; /* loop version of nlwMiddle */
@@ -339,24 +397,23 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
MROP_DECLARE_REG()
- unsigned long *pDstBase; /* pointer to start of dest */
- unsigned long *pDstLine; /* poitner to start of dest box */
- unsigned long *pSrcBase; /* pointer to start of source */
- unsigned long *pSrcLine; /* pointer to start of source line */
- register unsigned long *pDst;
- register unsigned long *pSrc;
- register unsigned long bits, tmp;
- register int nlwPart;
+ CfbBits *pdstBase; /* pointer to start of dest */
+ CfbBits *pDstLine; /* poitner to start of dest box */
+ CfbBits *pSrcBase; /* pointer to start of source */
+ CfbBits *pSrcLine; /* pointer to start of source line */
+ register CfbBits *pDst;
+ register CfbBits *pSrc;
+ register CfbBits bits, tmp = 0;
int xoffStart, xoff;
int leftShiftStart, rightShiftStart, nlwSrcStart;
- unsigned long tileEndMask;
+ CfbBits tileEndMask;
int tileEndLeftShift, tileEndRightShift;
int xoffStep;
int tileEndPart;
int needFirst;
- unsigned long narrow[2];
- unsigned long narrowMask;
- int narrowShift;
+ CfbBits narrow[2];
+ CfbBits narrowMask = 0;
+ int narrowShift = 0;
Bool narrowTile;
MROP_INITIALIZE (alu, planemask)
@@ -373,22 +430,36 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
widthSrc = 2;
narrowTile = TRUE;
}
- pSrcBase = (unsigned long *)tile->devPrivate.ptr;
+ pSrcBase = (CfbBits *)tile->devPrivate.ptr;
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase)
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+#if PSZ == 24
+ tileEndPart = (4 - tileWidth) & 3;
+ tileEndMask = cfbendpartial[tileWidth & 3];
+#else
tileEndPart = tileWidth & PIM;
tileEndMask = cfbendpartial[tileEndPart];
+#endif
tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
tileEndRightShift = PGSZ - tileEndLeftShift;
+#if PSZ == 24
+ xoffStep = 4 - tileEndPart;
+#else
xoffStep = PPW - tileEndPart;
+#endif
while (n--)
{
w = *pwidth++;
modulus (ppt->x - xrot, tileWidth, srcx);
modulus (ppt->y - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffDst = (4 - ppt->x) & 3;
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
xoffDst = ppt->x & PIM;
if (xoffDst + w < PPW)
+#endif
{
maskpartialbits(ppt->x, w, startmask);
endmask = 0;
@@ -398,9 +469,17 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
{
maskbits (ppt->x, w, startmask, endmask, nlw)
}
- pDstLine = pDstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
+#if PSZ == 24
+ pDstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3)>> 2);
+#else
+ pDstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
+#endif
pSrcLine = pSrcBase + (srcy * widthSrc);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+#else
xoffSrc = srcx & PIM;
+#endif
if (xoffSrc >= xoffDst)
{
xoffStart = xoffSrc - xoffDst;
@@ -408,26 +487,43 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
}
else
{
+#if PSZ == 24
+ xoffStart = 4 - (xoffDst - xoffSrc);
+#else
xoffStart = PPW - (xoffDst - xoffSrc);
+#endif
needFirst = 0;
}
leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
rightShiftStart = PGSZ - leftShiftStart;
+#if PSZ == 24
+ nlwSrcStart = widthSrc - ((srcx*3) >> 2);
+#else
nlwSrcStart = widthSrc - (srcx >> PWSH);
+#endif
/* XXX only works when narrowShift >= PPW/2 */
if (narrowTile)
{
tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */
narrow[0] = tmp | SCRRIGHT (tmp, narrowShift);
+#if PSZ == 24
+ narrow[1] = BitLeft (tmp, 8) |
+ BitRight(tmp, 16);
+#else
narrow[1] = SCRLEFT (tmp, PPW - narrowShift) |
SCRRIGHT(tmp, 2 * narrowShift - PPW);
+#endif
pSrcLine = narrow;
}
xoff = xoffStart;
leftShift = leftShiftStart;
rightShift = rightShiftStart;
nlwSrc = nlwSrcStart;
+#if PSZ == 24
+ pSrc = pSrcLine + ((srcx * 3) >> 2);
+#else
pSrc = pSrcLine + (srcx >> PWSH);
+#endif
pDst = pDstLine;
bits = 0;
if (needFirst)
@@ -448,7 +544,8 @@ MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
#if MROP == Mcopy
if (nlwSrc > 1)
{
- nlwPart = nlw;
+ int nlwPart = nlw;
+
if (nlwPart >= nlwSrc)
nlwPart = nlwSrc - 1;
nlw -= nlwPart;
@@ -534,8 +631,8 @@ MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
int widthDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
int h; /* height of current box */
- unsigned long startmask;
- unsigned long endmask;/* masks for reggedy bits at either end of line */
+ CfbBits startmask;
+ CfbBits endmask;/* masks for reggedy bits at either end of line */
int nlMiddle; /* number of longwords between sides of boxes */
register int nl; /* loop version of nlMiddle */
@@ -548,22 +645,26 @@ MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
MROP_DECLARE_REG()
- unsigned long *pdstBase; /* pointer to start of dest */
- unsigned long *pdstLine; /* poitner to start of dest box */
- unsigned long *psrcBase; /* pointer to start of source */
- unsigned long *psrcLine; /* pointer to fetch point of source */
- unsigned long *psrcStart; /* pointer to start of source line */
- register unsigned long *pdst;
- register unsigned long *psrc;
- register unsigned long bits, bits1;
+ CfbBits *pdstBase; /* pointer to start of dest */
+ CfbBits *pdstLine; /* poitner to start of dest box */
+ CfbBits *psrcBase; /* pointer to start of source */
+ CfbBits *psrcLine; /* pointer to fetch point of source */
+ CfbBits *psrcStart; /* pointer to start of source line */
+ register CfbBits *pdst;
+ register CfbBits *psrc;
+ register CfbBits bits, bits1;
register int nlTemp;
MROP_INITIALIZE (alu, planemask)
- psrcBase = (unsigned long *)tile->devPrivate.ptr;
+ psrcBase = (CfbBits *)tile->devPrivate.ptr;
tileHeight = tile->drawable.height;
tileWidth = tile->drawable.width;
+#if PSZ == 24
+ widthSrc = tile->devKind / PGSZB;
+#else
widthSrc = tileWidth >> PWSH;
+#endif
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
@@ -575,16 +676,30 @@ MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, plan
/* set up source */
modulus (pBox->x1 - xrot, tileWidth, srcx);
modulus (pBox->y1 - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+ srcStart = (srcx * 3) >> 2;
+#else
xoffSrc = srcx & PIM;
srcStart = (srcx >> PWSH);
+#endif
psrcStart = psrcBase + (srcy * widthSrc);
psrcLine = psrcStart + srcStart;
/* set up dest */
+#if PSZ == 24
+ xoffDst = (4 - pBox->x1) & 3;
+ pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);
+#else
xoffDst = pBox->x1 & PIM;
pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
+#endif
/* set up masks */
+#if PSZ == 24
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
if (xoffDst + w < PPW)
+#endif
{
maskpartialbits(pBox->x1, w, startmask);
endmask = 0;
@@ -827,8 +942,8 @@ MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
int widthDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
- unsigned long startmask;
- unsigned long endmask;/* masks for reggedy bits at either end of line */
+ CfbBits startmask;
+ CfbBits endmask;/* masks for reggedy bits at either end of line */
int nlMiddle; /* number of longwords between sides of boxes */
register int nl; /* loop version of nlMiddle */
@@ -841,22 +956,26 @@ MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
MROP_DECLARE_REG()
- unsigned long *pdstBase; /* pointer to start of dest */
- unsigned long *pdstLine; /* poitner to start of dest box */
- unsigned long *psrcBase; /* pointer to start of source */
- unsigned long *psrcLine; /* pointer to fetch point of source */
- unsigned long *psrcStart; /* pointer to start of source line */
- register unsigned long *pdst;
- register unsigned long *psrc;
- register unsigned long bits, bits1;
+ CfbBits *pdstBase; /* pointer to start of dest */
+ CfbBits *pdstLine; /* poitner to start of dest box */
+ CfbBits *psrcBase; /* pointer to start of source */
+ CfbBits *psrcLine; /* pointer to fetch point of source */
+ CfbBits *psrcStart; /* pointer to start of source line */
+ register CfbBits *pdst;
+ register CfbBits *psrc;
+ register CfbBits bits, bits1;
register int nlTemp;
MROP_INITIALIZE (alu, planemask)
- psrcBase = (unsigned long *)tile->devPrivate.ptr;
+ psrcBase = (CfbBits *)tile->devPrivate.ptr;
tileHeight = tile->drawable.height;
tileWidth = tile->drawable.width;
+#if PSZ == 24
+ widthSrc = tile->devKind / PGSZB;
+#else
widthSrc = tileWidth >> PWSH;
+#endif
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
@@ -867,16 +986,28 @@ MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu,
/* set up source */
modulus (ppt->x - xrot, tileWidth, srcx);
modulus (ppt->y - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+ srcStart = (srcx * 3) >> 2;
+#else
xoffSrc = srcx & PIM;
srcStart = (srcx >> PWSH);
+#endif
psrcStart = psrcBase + (srcy * widthSrc);
psrcLine = psrcStart + srcStart;
/* set up dest */
+#if PSZ == 24
+ xoffDst = (4 - ppt->x) & 3;
+ pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2);
+ /* set up masks */
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
xoffDst = ppt->x & PIM;
pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
/* set up masks */
if (xoffDst + w < PPW)
+#endif
{
maskpartialbits(ppt->x, w, startmask);
endmask = 0;
diff --git a/cfb/cfbzerarc.c b/cfb/cfbzerarc.c
index 37b7023d5..c13e37739 100644
--- a/cfb/cfbzerarc.c
+++ b/cfb/cfbzerarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbzerarc.c,v 3.3 2001/12/14 19:59:25 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -57,6 +58,10 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
register int x;
PixelType *addrp;
register PixelType *yorgp, *yorgop;
+#if PSZ == 24
+ int xorg, xorg3, xorgo, xorgo3;
+ register int xtmp;
+#endif
RROP_DECLARE
register int yoffset;
int npwidth, dyoffset;
@@ -71,16 +76,31 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth);
info.xorg += pDraw->x;
info.xorgo += pDraw->x;
+#if PSZ == 24
+ xorg = info.xorg;
+ xorg3 = xorg * 3;
+ info.xorg = (info.xorg * 3) >> 2;
+ xorgo = info.xorgo;
+ xorgo3 = xorgo * 3;
+ info.xorgo = (info.xorgo * 3) >> 2;
+#endif
MIARCSETUP();
yoffset = y ? npwidth : 0;
dyoffset = 0;
mask = info.initialMask;
if (!(arc->width & 1))
{
+#if PSZ == 24
+ if (mask & 2)
+ RROP_SOLID24((yorgp + info.xorgo), xorgo);
+ if (mask & 8)
+ RROP_SOLID24((yorgop + info.xorgo), xorgo);
+#else
if (mask & 2)
RROP_SOLID((yorgp + info.xorgo));
if (mask & 8)
RROP_SOLID((yorgop + info.xorgo));
+#endif /* PSZ == 24 */
}
if (!info.end.x || !info.end.y)
{
@@ -90,6 +110,34 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
if (do360 && (arc->width == arc->height) && !(arc->width & 1))
{
register int xoffset = npwidth;
+#if PSZ == 24
+ PixelType *yorghb = yorgp + (info.h * npwidth);
+ register int tmp1, tmp2, tmp1_3, tmp2_3;
+
+ tmp1 = xorg + info.h;
+ tmp1_3 = tmp1 * 3;
+ tmp2 = xorg - info.h;
+ tmp2_3 = tmp2 * 3;
+ while (1)
+ {
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ xtmp = (xorg3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x);
+ if (a < 0)
+ break;
+ xtmp = (tmp1_3 - y * 3) >> 2;
+ RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y);
+ RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y);
+ xtmp = (tmp2_3 + y * 3) >> 2;
+ RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y);
+ RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y);
+ xoffset += npwidth;
+ MIARCCIRCLESTEP(yoffset += npwidth;);
+ }
+#else
PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg;
PixelType *yorgohb = yorghb - info.h;
@@ -113,6 +161,7 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
}
yorgp -= info.xorg;
yorgop -= info.xorg;
+#endif /* PSZ == 24 */
x = info.w;
yoffset = info.h * npwidth;
}
@@ -121,10 +170,19 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
while (y < info.h || x < info.w)
{
MIARCOCTANTSHIFT(dyoffset = npwidth;);
+#if PSZ == 24
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
+#else
RROP_SOLID(yorgp + yoffset + info.xorg + x);
RROP_SOLID(yorgp + yoffset + info.xorgo - x);
RROP_SOLID(yorgop - yoffset + info.xorgo - x);
RROP_SOLID(yorgop - yoffset + info.xorg + x);
+#endif
MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
}
}
@@ -138,6 +196,24 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
mask = info.start.mask;
info.start = info.altstart;
}
+#if PSZ == 24
+ if (mask & 1){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ }
+ if (mask & 2){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
+ }
+ if (mask & 4){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
+ }
+ if (mask & 8){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ }
+#else
if (mask & 1)
RROP_SOLID(yorgp + yoffset + info.xorg + x);
if (mask & 2)
@@ -146,6 +222,7 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
RROP_SOLID(yorgop - yoffset + info.xorgo - x);
if (mask & 8)
RROP_SOLID(yorgop - yoffset + info.xorg + x);
+#endif /* PSZ == 24 */
if ((x == info.end.x) || (y == info.end.y))
{
mask = info.end.mask;
@@ -156,16 +233,38 @@ RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
}
if ((x == info.start.x) || (y == info.start.y))
mask = info.start.mask;
+#if PSZ == 24
+ if (mask & 1){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ }
+ if (mask & 4){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
+ }
+#else
if (mask & 1)
RROP_SOLID(yorgp + yoffset + info.xorg + x);
if (mask & 4)
RROP_SOLID(yorgop - yoffset + info.xorgo - x);
+#endif /* PSZ == 24 */
if (arc->height & 1)
{
+#if PSZ == 24
+ if (mask & 2){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
+ }
+ if (mask & 8){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ }
+#else
if (mask & 2)
RROP_SOLID(yorgp + yoffset + info.xorgo - x);
if (mask & 8)
RROP_SOLID(yorgop - yoffset + info.xorg + x);
+#endif /* PSZ == 24 */
}
}
diff --git a/cfb/stip68kgnu.h b/cfb/stip68kgnu.h
index 9b2c7a1b3..9a2bac720 100644
--- a/cfb/stip68kgnu.h
+++ b/cfb/stip68kgnu.h
@@ -25,101 +25,96 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/stip68kgnu.h,v 3.4 2001/12/14 19:59:25 dawes Exp $ */
/*
* Stipple stack macro for 68k GCC
- *
- * Note - this macro can nott describe the full extent of the
- * modifications made to the arguments (GCC does not allow enough
- * arguments to __asm statements). Therefore, it is possible
- * (though unlikely) that future magic versions of GCC may
- * miscompile this somehow. In particular, (stipple) is modified
- * by the macro, yet not listed as an output value.
*/
#define STIPPLE(addr,stipple,value,width,count,shift) \
__asm volatile ( \
- "subqw #1,%1\n\
- lea 0f,a1\n\
- movew #28,d2\n\
- addl %7,d2\n\
- movew #28,d3\n\
- subql #4,%7\n\
- negl %7\n\
+ "lea 5f,%/a1\n\
+ moveq #28,%/d2\n\
+ addl %2,%/d2\n\
+ moveq #28,%/d3\n\
+ subql #4,%2\n\
+ negl %2\n\
1:\n\
- movel %0,a0\n\
- addl %5,%0\n\
- movel %3@+,d1\n\
- beq 3f\n\
- movel d1,d0\n\
- lsrl d2,d0\n\
- lsll #5,d0\n\
- lsll %7,d1\n\
- jmp a1@(d0:l)\n\
+ movel %0,%/a0\n\
+ addl %6,%0\n\
+ movel %3@+,%/d1\n\
+ jeq 3f\n\
+ movel %/d1,%/d0\n\
+ lsrl %/d2,%/d0\n\
+ lsll #5,%/d0\n\
+ lsll %2,%/d1\n\
+ jmp %/a1@(%/d0:l)\n\
2:\n\
- addl #4,a0\n\
- movel d1,d0\n\
- lsrl d3,d0\n\
- lsll #5,d0\n\
- lsll #4,d1\n\
- jmp a1@(d0:l)\n\
-0:\n\
- bne 2b ; dbra %1,1b ; bra 4f\n\
- . = 0b + 0x20\n\
- moveb %4,a0@(3)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\
- . = 0b + 0x40\n\
- moveb %4,a0@(2)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\
- . = 0b + 0x60\n\
- movew %4,a0@(2)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\
- . = 0b + 0x80\n\
- moveb %4,a0@(1)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0xa0\n\
- moveb %4,a0@(3) ; moveb %4,a0@(1)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0xc0\n\
- movew %4,a0@(1)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0xe0\n\
- movew %4,a0@(2) ; moveb %4,a0@(1)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x100\n\
- moveb %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x120\n\
- moveb %4,a0@(3) ; moveb %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x140\n\
- moveb %4,a0@(2) ; moveb %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x160\n\
- movew %4,a0@(2) ; moveb %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x180\n\
- movew %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x1a0\n\
- moveb %4,a0@(3) ; movew %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x1c0\n\
- moveb %4,a0@(2) ; movew %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
- . = 0b + 0x1e0\n\
- movel %4,a0@(0)\n\
- andl d1,d1 ; bne 2b ; \n\
+ addl #4,%/a0\n\
+ movel %/d1,%/d0\n\
+ lsrl %/d3,%/d0\n\
+ lsll #5,%/d0\n\
+ lsll #4,%/d1\n\
+ jmp %/a1@(%/d0:l)\n\
+5:\n\
+ jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x20\n\
+ moveb %5,%/a0@(3)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x40\n\
+ moveb %5,%/a0@(2)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x60\n\
+ movew %5,%/a0@(2)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x80\n\
+ moveb %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0xa0\n\
+ moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0xc0\n\
+ movew %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0xe0\n\
+ movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x100\n\
+ moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x120\n\
+ moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x140\n\
+ moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x160\n\
+ movew %5,%/a0@(2) ; moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x180\n\
+ movew %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x1a0\n\
+ moveb %5,%/a0@(3) ; movew %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x1c0\n\
+ moveb %5,%/a0@(2) ; movew %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x1e0\n\
+ movel %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; \n\
3: dbra %1,1b ; \n\
4:\n"\
: "=a" (addr), /* %0 */ \
- "=d" (count) /* %1 */ \
- : "0" (addr), /* %2 */ \
- "a" (stipple), /* %3 */ \
- "d" (value), /* %4 */ \
- "a" (width), /* %5 */ \
- "1" (count), /* %6 */ \
- "d" (shift) /* %7 */ \
+ "=d" (count), /* %1 */ \
+ "=d" (shift), /* %2 */ \
+ "=a" (stipple) /* %3 */ \
+ : "0" (addr), /* %4 */ \
+ "d" (value), /* %5 */ \
+ "a" (width), /* %6 */ \
+ "1" (count-1), /* %7 */ \
+ "2" (shift), /* %8 */ \
+ "3" (stipple) /* %9 */ \
: /* ctemp */ "d0", \
/* c */ "d1", \
/* lshift */ "d2", \
diff --git a/cfb/stipsparc.s b/cfb/stipsparc.s
index 2c417599e..185795605 100644
--- a/cfb/stipsparc.s
+++ b/cfb/stipsparc.s
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.5 2001/12/14 19:59:26 dawes Exp $ */
/*
* SPARC assembly code for optimized text rendering.
@@ -84,7 +85,7 @@ in this Software without prior written authorization from The Open Group.
#define ForEachBits LY4
#define NextBits LY5
-#ifdef SVR4
+#if defined(SVR4) || defined(__ELF__)
#ifdef TETEXT
#define _cfbStippleStack cfbStippleStackTE
#else
diff --git a/cfb/stipsprc32.s b/cfb/stipsprc32.s
index ce2b949b2..f878fbf80 100644
--- a/cfb/stipsprc32.s
+++ b/cfb/stipsprc32.s
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/stipsprc32.s,v 1.5 2001/12/14 19:59:26 dawes Exp $ */
/*
* SPARC assembly code for optimized text rendering.
@@ -80,7 +81,7 @@ in this Software without prior written authorization from The Open Group.
#define ForEachBits LY4
#define NextBits LY5
-#ifdef SVR4
+#if defined(SVR4) || defined(__ELF__)
#ifdef TETEXT
#define _cfb32StippleStack cfb32StippleStackTE
#else
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 96fdac409..6b92baac7 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -30,10 +30,12 @@
* DIX DBE code
*
*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/dbe/dbe.c,v 3.11 2001/10/28 03:33:04 tsi Exp $ */
/* INCLUDES */
+#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "scrnintstr.h"
@@ -44,6 +46,9 @@
#include "dbestruct.h"
#include "midbe.h"
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+#endif
/* GLOBALS */
@@ -172,7 +177,7 @@ DbeAllocWinPriv(pScreen)
ptr = (char *)(ppriv + pDbeScreenPriv->winPrivPrivLen);
for (i = pDbeScreenPriv->winPrivPrivLen; --i >= 0; ppriv++, sizes++)
{
- if (size = *sizes)
+ if ((size = *sizes))
{
ppriv->ptr = (pointer)ptr;
ptr += size;
@@ -197,13 +202,14 @@ DbeAllocWinPriv(pScreen)
*
*****************************************************************************/
+#if 0 /* NOT USED */
static DbeWindowPrivPtr
DbeFallbackAllocWinPriv(pScreen)
ScreenPtr pScreen;
{
return (NULL);
-
} /* DbeFallbackAllocWinPriv() */
+#endif
/******************************************************************************
@@ -345,7 +351,7 @@ static int
ProcDbeGetVersion(client)
ClientPtr client;
{
- REQUEST(xDbeGetVersionReq);
+ /* REQUEST(xDbeGetVersionReq); */
xDbeGetVersionReply rep;
register int n;
@@ -829,7 +835,7 @@ static int
ProcDbeBeginIdiom(client)
ClientPtr client;
{
- REQUEST(xDbeBeginIdiomReq);
+ /* REQUEST(xDbeBeginIdiomReq); */
DbeScreenPrivPtr pDbeScreenPriv;
register int i;
@@ -957,7 +963,7 @@ ProcDbeGetVisualInfo(client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = length;
+ rep.length = length >> 2;
rep.m = count;
if (client->swapped)
@@ -1499,8 +1505,8 @@ DbeSetupBackgroundPainter(pWin, pGC)
case BackgroundPixmap:
gcvalues[0] = (pointer)FillTiled;
gcvalues[1] = (pointer)background.pixmap;
- gcvalues[2] = (pointer)ts_x_origin;
- gcvalues[3] = (pointer)ts_y_origin;
+ gcvalues[2] = (pointer)(long)ts_x_origin;
+ gcvalues[3] = (pointer)(long)ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
@@ -1750,7 +1756,7 @@ DbeDestroyWindow(pWin)
**************************************************************************
*/
- if (pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))
+ if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
{
while (pDbeWindowPriv)
{
@@ -1809,11 +1815,14 @@ DbeExtensionInit()
{
ExtensionEntry *extEntry;
register int i, j;
- ScreenPtr pScreen;
+ ScreenPtr pScreen = NULL;
DbeScreenPrivPtr pDbeScreenPriv;
int nStubbedScreens = 0;
Bool ddxInitSuccess;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) return;
+#endif
/* Allocate private pointers in windows and screens. */
@@ -1974,4 +1983,3 @@ DbeExtensionInit()
} /* DbeExtensionInit() */
-
diff --git a/dbe/midbe.c b/dbe/midbe.c
index 5f6a48b32..e7617e728 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -30,13 +30,13 @@
* Machine-independent DBE code
*
*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/dbe/midbe.c,v 3.5 2001/08/23 14:19:24 alanh Exp $ */
/* INCLUDES */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -54,6 +54,11 @@
#include "gcstruct.h"
#include "inputstr.h"
+#ifndef IN_MODULE
+#include <stdio.h>
+#else
+#include "xf86_ansic.h"
+#endif
/* DEFINES */
@@ -65,7 +70,6 @@
static int miDbePrivPrivGeneration = 0;
static int miDbeWindowPrivPrivIndex = -1;
-static int miDbeScreenPrivPrivIndex = -1;
RESTYPE dbeDrawableResType;
RESTYPE dbeWindowPrivResType;
int dbeScreenPrivIndex = -1;
@@ -303,7 +307,6 @@ miDbeSwapBuffers(client, pNumWindows, swapInfo)
DbeScreenPrivPtr pDbeScreenPriv;
GCPtr pGC;
WindowPtr pWin;
- register int i;
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
PixmapPtr pTmpBuffer;
xRectangle clearRect;
@@ -816,17 +819,17 @@ miDbeInit(pScreen, pDbeScreenPriv)
miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)();
- if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen,
- miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec)))
- {
- return(FALSE);
- }
-
/* Make sure we only do this code once. */
miDbePrivPrivGeneration = serverGeneration;
} /* if -- Reset priv privs. */
+ if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen,
+ miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec)))
+ {
+ return(FALSE);
+ }
+
/* Wrap functions. */
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
diff --git a/dix/atom.c b/dix/atom.c
index d5c53d2e2..66c045583 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/atom.c,v 3.4 2002/02/19 11:09:21 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,6 +52,7 @@ SOFTWARE.
#include "Xatom.h"
#include "misc.h"
#include "resource.h"
+#include "dix.h"
#define InitialTableSize 100
@@ -66,6 +68,8 @@ static NodePtr atomRoot = (NodePtr)NULL;
static unsigned long tableLength;
static NodePtr *nodeTable;
+void FreeAtom(NodePtr patom);
+
Atom
MakeAtom(string, len, makeit)
char *string;
@@ -170,8 +174,7 @@ AtomError()
}
void
-FreeAtom(patom)
- NodePtr patom;
+FreeAtom(NodePtr patom)
{
if(patom->left)
FreeAtom(patom->left);
diff --git a/dix/buildatoms b/dix/buildatoms
index bedec5886..dfbbca8a9 100644
--- a/dix/buildatoms
+++ b/dix/buildatoms
@@ -1,5 +1,5 @@
#!/bin/sh
-hfile=../../X11/Xatom.h
+hfile=../../../include/Xatom.h
cfile=initatoms.c
rm -f $hfile $cfile
umask 222
@@ -21,8 +21,9 @@ BEGIN {
printf(" */\n\n") > cfile;
printf("#include \"X.h\"\n") > cfile;
printf("#include \"Xatom.h\"\n") > cfile;
- printf("extern Atom MakeAtom();\n") > cfile;
- printf("MakePredeclaredAtoms()\n") > cfile;
+ printf("#include \"misc.h\"\n") > cfile;
+ printf("#include \"dix.h\"\n") > cfile;
+ printf("void MakePredeclaredAtoms()\n") > cfile;
printf("{\n") > cfile;
}
diff --git a/dix/colormap.c b/dix/colormap.c
index 610ea01ca..b3d8d1347 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.10 2002/04/14 00:45:54 mvojkovi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -57,8 +58,12 @@ SOFTWARE.
#include "scrnintstr.h"
#include "resource.h"
#include "windowstr.h"
+#ifdef LBX
+#include "lbxserve.h"
+#endif
extern XID clientErrorValue;
+extern int colormapPrivateCount;
static Pixel FindBestPixel(
#if NeedFunctionPrototypes
@@ -280,7 +285,6 @@ CreateColormap (mid, pScreen, pVisual, ppcmap, alloc, client)
register EntryPtr pent;
int i;
register Pixel *ppix, **pptr;
- extern int colormapPrivateCount;
class = pVisual->class;
if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID))
@@ -499,6 +503,7 @@ TellNoMap (pwin, pmid)
Colormap *pmid;
{
xEvent xE;
+
if (wColormap(pwin) == *pmid)
{
/* This should be call to DeliverEvent */
@@ -507,7 +512,10 @@ TellNoMap (pwin, pmid)
xE.u.colormap.colormap = None;
xE.u.colormap.new = TRUE;
xE.u.colormap.state = ColormapUninstalled;
- DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+#ifdef PANORAMIX
+ if(noPanoramiXExtension || !pwin->drawable.pScreen->myNum)
+#endif
+ DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
if (pwin->optional) {
pwin->optional->colormap = None;
CheckWindowOptionalNeed (pwin);
@@ -525,6 +533,11 @@ TellLostMap (pwin, value)
{
Colormap *pmid = (Colormap *)value;
xEvent xE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
+ return WT_STOPWALKING;
+#endif
if (wColormap(pwin) == *pmid)
{
/* This should be call to DeliverEvent */
@@ -547,6 +560,11 @@ TellGainedMap (pwin, value)
{
Colormap *pmid = (Colormap *)value;
xEvent xE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
+ return WT_STOPWALKING;
+#endif
if (wColormap (pwin) == *pmid)
{
/* This should be call to DeliverEvent */
@@ -625,6 +643,7 @@ CopyFree (channel, client, pmapSrc, pmapDst)
switch(channel)
{
+ default: /* so compiler can see that everything gets initialized */
case REDMAP:
ppix = (pmapSrc->clientPixelsRed)[client];
npix = (pmapSrc->numPixelsRed)[client];
@@ -715,6 +734,7 @@ FreeCell (pmap, i, channel)
switch (channel)
{
+ default: /* so compiler can see that everything gets initialized */
case PSEUDOMAP:
case REDMAP:
pent = (EntryPtr) &pmap->red[i];
@@ -1116,8 +1136,8 @@ typedef struct _bignum {
BigNumLower lower;
} BigNumRec, *BigNumPtr;
-#define BigNumGreater(x,y) ((x)->upper > (y)->upper ||\
- (x)->upper == (y)->upper && (x)->lower > (y)->lower)
+#define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\
+ ((x)->upper == (y)->upper && (x)->lower > (y)->lower))
#define UnsignedToBigNum(u,r) (((r)->upper = UPPERPART(u)), \
((r)->lower = LOWERPART(u)))
@@ -1126,8 +1146,12 @@ typedef struct _bignum {
((r)->lower = BIGNUMLOWER-1))
static void
+#if NeedFunctionPrototypes
+BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r)
+#else
BigNumAdd (x, y, r)
BigNumPtr x, y, r;
+#endif
{
BigNumLower lower, carry = 0;
@@ -1248,9 +1272,9 @@ FindColor (pmap, pentFirst, size, prgb, pPixel, channel, client, comp)
{
EntryPtr pent;
Bool foundFree;
- Pixel pixel, Free;
- int npix, count, *nump;
- Pixel **pixp, *ppix;
+ Pixel pixel, Free = 0;
+ int npix, count, *nump = NULL;
+ Pixel **pixp = NULL, *ppix;
xColorItem def;
foundFree = FALSE;
@@ -1844,7 +1868,7 @@ AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask)
Pixel *ppix, *pDst, *p;
int npix, npixR, npixG, npixB;
Bool okR, okG, okB;
- Pixel *rpix, *gpix, *bpix;
+ Pixel *rpix = 0, *gpix = 0, *bpix = 0;
npixR = c << r;
npixG = c << g;
@@ -2426,6 +2450,7 @@ FreeCo (pmap, client, color, npixIn, ppixIn, mask)
ppixClient = pmap->clientPixelsBlue[client];
npixClient = pmap->numPixelsBlue[client];
break;
+ default: /* so compiler can see that everything gets initialized */
case PSEUDOMAP:
cmask = ~((Pixel)0);
rgbbad = 0;
diff --git a/dix/cursor.c b/dix/cursor.c
index fe0ceabe0..29a429f34 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/cursor.c,v 3.8 2003/01/12 02:44:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -68,13 +69,20 @@ typedef struct _GlyphShare {
static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
static void
+#if NeedFunctionPrototypes
+FreeCursorBits(CursorBitsPtr bits)
+#else
FreeCursorBits(bits)
CursorBitsPtr bits;
+#endif
{
if (--bits->refcnt > 0)
return;
xfree(bits->source);
xfree(bits->mask);
+#ifdef ARGB_CURSOR
+ xfree(bits->argb);
+#endif
if (bits->refcnt == 0)
{
register GlyphSharePtr *prev, this;
@@ -120,15 +128,41 @@ FreeCursor(value, cid)
return(Success);
}
+
+/*
+ * We check for empty cursors so that we won't have to display them
+ */
+static void
+CheckForEmptyMask(CursorBitsPtr bits)
+{
+ register unsigned char *msk = bits->mask;
+ int n = BitmapBytePad(bits->width) * bits->height;
+
+ bits->emptyMask = FALSE;
+ while(n--)
+ if(*(msk++) != 0) return;
+#ifdef ARGB_CURSOR
+ if (bits->argb)
+ {
+ CARD32 *argb = bits->argb;
+ int n = bits->width * bits->height;
+ while (n--)
+ if (*argb++ & 0xff000000) return;
+ }
+#endif
+ bits->emptyMask = TRUE;
+}
+
/*
* does nothing about the resource table, just creates the data structure.
* does not copy the src and mask bits
*/
CursorPtr
-AllocCursor(psrcbits, pmaskbits, cm,
+AllocCursorARGB(psrcbits, pmaskbits, argb, cm,
foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue)
unsigned char * psrcbits; /* server-defined padding */
unsigned char * pmaskbits; /* server-defined padding */
+ CARD32 * argb; /* no padding */
CursorMetricPtr cm;
unsigned foreRed, foreGreen, foreBlue;
unsigned backRed, backGreen, backBlue;
@@ -148,11 +182,15 @@ AllocCursor(psrcbits, pmaskbits, cm,
bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
bits->source = psrcbits;
bits->mask = pmaskbits;
+#ifdef ARGB_CURSOR
+ bits->argb = argb;
+#endif
bits->width = cm->width;
bits->height = cm->height;
bits->xhot = cm->xhot;
bits->yhot = cm->yhot;
bits->refcnt = -1;
+ CheckForEmptyMask(bits);
pCurs->bits = bits;
pCurs->refcnt = 1;
@@ -186,6 +224,20 @@ AllocCursor(psrcbits, pmaskbits, cm,
return pCurs;
}
+CursorPtr
+AllocCursor(psrcbits, pmaskbits, cm,
+ foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue)
+ unsigned char * psrcbits; /* server-defined padding */
+ unsigned char * pmaskbits; /* server-defined padding */
+ CursorMetricPtr cm;
+ unsigned foreRed, foreGreen, foreBlue;
+ unsigned backRed, backGreen, backBlue;
+{
+ return AllocCursorARGB (psrcbits, pmaskbits, (CARD32 *) 0, cm,
+ foreRed, foreGreen, foreBlue,
+ backRed, backGreen, backBlue);
+}
+
int
AllocGlyphCursor(source, sourceChar, mask, maskChar,
foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue,
@@ -253,14 +305,14 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
if (!maskfont)
{
register long n;
- register unsigned char *bits;
+ register unsigned char *mskptr;
n = BitmapBytePad(cm.width)*(long)cm.height;
- bits = mskbits = (unsigned char *)xalloc(n);
- if (!bits)
+ mskptr = mskbits = (unsigned char *)xalloc(n);
+ if (!mskptr)
return BadAlloc;
while (--n >= 0)
- *bits++ = ~0;
+ *mskptr++ = ~0;
}
else
{
@@ -269,10 +321,10 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
client->errorValue = maskChar;
return BadValue;
}
- if (res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits))
+ if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0)
return res;
}
- if (res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))
+ if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0)
{
xfree(mskbits);
return res;
@@ -302,6 +354,9 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
}
bits->source = srcbits;
bits->mask = mskbits;
+#ifdef ARGB_CURSOR
+ bits->argb = 0;
+#endif
bits->width = cm.width;
bits->height = cm.height;
bits->xhot = cm.xhot;
@@ -326,6 +381,7 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
sharedGlyphs = pShare;
}
}
+ CheckForEmptyMask(bits);
pCurs->bits = bits;
pCurs->refcnt = 1;
diff --git a/dix/devices.c b/dix/devices.c
index 3a9d56522..7028cd279 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/devices.c,v 3.20 2001/12/14 19:59:30 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -66,27 +67,28 @@ SOFTWARE.
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
#endif
-extern void CopySwap32Write(), SwapTimeCoordWrite();
-extern void ActivatePointerGrab(), DeactivatePointerGrab();
-extern void ActivateKeyboardGrab(), DeactivateKeyboardGrab();
-extern Mask EventMaskForClient();
-extern void EnqueueEvent();
+#include "dispatch.h"
+#include "swaprep.h"
+#include "dixevents.h"
-DevicePtr
-AddInputDevice(deviceProc, autoStart)
+DeviceIntPtr
+_AddInputDevice(deviceProc, autoStart)
DeviceProc deviceProc;
Bool autoStart;
{
register DeviceIntPtr dev;
if (inputInfo.numDevices >= MAX_DEVICES)
- return (DevicePtr)NULL;
+ return (DeviceIntPtr)NULL;
dev = (DeviceIntPtr) xalloc(sizeof(DeviceIntRec));
if (!dev)
- return (DevicePtr)NULL;
+ return (DeviceIntPtr)NULL;
dev->name = (char *)NULL;
dev->type = 0;
dev->id = inputInfo.numDevices;
@@ -121,7 +123,7 @@ AddInputDevice(deviceProc, autoStart)
dev->xkb_interest= NULL;
#endif
inputInfo.off_devices = dev;
- return &dev->public;
+ return dev;
}
Bool
@@ -179,20 +181,28 @@ InitAndStartDevices()
dev && (dev != inputInfo.keyboard);
dev = dev->next)
;
- if (!dev || (dev != inputInfo.keyboard))
+ if (!dev || (dev != inputInfo.keyboard)) {
+ ErrorF("No core keyboard\n");
return BadImplementation;
+ }
for (dev = inputInfo.devices;
dev && (dev != inputInfo.pointer);
dev = dev->next)
;
- if (!dev || (dev != inputInfo.pointer))
+ if (!dev || (dev != inputInfo.pointer)) {
+ ErrorF("No core pointer\n");
return BadImplementation;
+ }
return Success;
}
static void
+#if NeedFunctionPrototypes
+CloseDevice(register DeviceIntPtr dev)
+#else
CloseDevice(dev)
register DeviceIntPtr dev;
+#endif
{
KbdFeedbackPtr k, knext;
PtrFeedbackPtr p, pnext;
@@ -290,6 +300,10 @@ CloseDownDevices()
next = dev->next;
CloseDevice(dev);
}
+ inputInfo.devices = NULL;
+ inputInfo.off_devices = NULL;
+ inputInfo.keyboard = NULL;
+ inputInfo.pointer = NULL;
}
void
@@ -308,6 +322,10 @@ RemoveDevice(dev)
else
prev->next = next;
inputInfo.numDevices--;
+ if (inputInfo.keyboard == tmp)
+ inputInfo.keyboard = NULL;
+ else if (inputInfo.pointer == tmp)
+ inputInfo.pointer = NULL;
return;
}
}
@@ -322,6 +340,10 @@ RemoveDevice(dev)
else
prev->next = next;
inputInfo.numDevices--;
+ if (inputInfo.keyboard == tmp)
+ inputInfo.keyboard = NULL;
+ else if (inputInfo.pointer == tmp)
+ inputInfo.pointer = NULL;
return;
}
}
@@ -336,71 +358,69 @@ NumMotionEvents()
}
void
-RegisterPointerDevice(device)
- DevicePtr device;
+_RegisterPointerDevice(device)
+ DeviceIntPtr device;
{
- DeviceIntPtr dev = (DeviceIntPtr)device;
- inputInfo.pointer = dev;
+ inputInfo.pointer = device;
#ifdef XKB
if (noXkbExtension) {
- device->processInputProc = CoreProcessPointerEvent;
- device->realInputProc = CoreProcessPointerEvent;
+ device->public.processInputProc = CoreProcessPointerEvent;
+ device->public.realInputProc = CoreProcessPointerEvent;
} else {
- device->processInputProc = ProcessPointerEvent;
- device->realInputProc = ProcessPointerEvent;
+ device->public.processInputProc = ProcessPointerEvent;
+ device->public.realInputProc = ProcessPointerEvent;
}
#else
- device->processInputProc = ProcessPointerEvent;
- device->realInputProc = ProcessPointerEvent;
+ device->public.processInputProc = ProcessPointerEvent;
+ device->public.realInputProc = ProcessPointerEvent;
#endif
- dev->ActivateGrab = ActivatePointerGrab;
- dev->DeactivateGrab = DeactivatePointerGrab;
- if (!dev->name)
+ device->ActivateGrab = ActivatePointerGrab;
+ device->DeactivateGrab = DeactivatePointerGrab;
+ if (!device->name)
{
char *p = "pointer";
- dev->name = (char *)xalloc(strlen(p) + 1);
- strcpy(dev->name, p);
+ device->name = (char *)xalloc(strlen(p) + 1);
+ strcpy(device->name, p);
}
}
void
-RegisterKeyboardDevice(device)
- DevicePtr device;
+_RegisterKeyboardDevice(device)
+ DeviceIntPtr device;
{
- DeviceIntPtr dev = (DeviceIntPtr)device;
- inputInfo.keyboard = dev;
+ inputInfo.keyboard = device;
#ifdef XKB
if (noXkbExtension) {
- device->processInputProc = CoreProcessKeyboardEvent;
- device->realInputProc = CoreProcessKeyboardEvent;
+ device->public.processInputProc = CoreProcessKeyboardEvent;
+ device->public.realInputProc = CoreProcessKeyboardEvent;
} else {
- device->processInputProc = ProcessKeyboardEvent;
- device->realInputProc = ProcessKeyboardEvent;
+ device->public.processInputProc = ProcessKeyboardEvent;
+ device->public.realInputProc = ProcessKeyboardEvent;
}
#else
- device->processInputProc = ProcessKeyboardEvent;
- device->realInputProc = ProcessKeyboardEvent;
+ device->public.processInputProc = ProcessKeyboardEvent;
+ device->public.realInputProc = ProcessKeyboardEvent;
#endif
- dev->ActivateGrab = ActivateKeyboardGrab;
- dev->DeactivateGrab = DeactivateKeyboardGrab;
- if (!dev->name)
+ device->ActivateGrab = ActivateKeyboardGrab;
+ device->DeactivateGrab = DeactivateKeyboardGrab;
+ if (!device->name)
{
char *k = "keyboard";
- dev->name = (char *)xalloc(strlen(k) + 1);
- strcpy(dev->name, k);
+ device->name = (char *)xalloc(strlen(k) + 1);
+ strcpy(device->name, k);
}
}
DevicePtr
LookupKeyboardDevice()
{
- return &inputInfo.keyboard->public;
+ return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL;
}
DevicePtr
LookupPointerDevice()
{
- return &inputInfo.pointer->public;
+ return inputInfo.pointer ? &inputInfo.pointer->public : NULL;
}
DevicePtr
@@ -481,8 +501,12 @@ SetKeySymsMap(dst, src)
}
static Bool
+#if NeedFunctionPrototypes
+InitModMap(register KeyClassPtr keyc)
+#else
InitModMap(keyc)
register KeyClassPtr keyc;
+#endif
{
int i, j;
CARD8 keysPerModifier[8];
@@ -656,7 +680,7 @@ InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc)
#endif
feedc->ctrl = defaultKeyboardControl;
feedc->ctrl.id = 0;
- if (feedc->next = dev->kbdfeed)
+ if ((feedc->next = dev->kbdfeed) != 0)
feedc->ctrl.id = dev->kbdfeed->ctrl.id + 1;
dev->kbdfeed = feedc;
#ifdef XKB
@@ -1068,7 +1092,6 @@ ProcGetModifierMapping(client)
ClientPtr client;
{
xGetModifierMappingReply rep;
- REQUEST(xReq);
register KeyClassPtr keyc = inputInfo.keyboard->key;
REQUEST_SIZE_MATCH(xReq);
@@ -1201,7 +1224,7 @@ ProcGetKeyboardMapping(client)
/* length is a count of 4 byte quantities and KeySyms are 4 bytes */
rep.length = (curKeySyms->mapWidth * stuff->count);
WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
- client->pSwapReplyFunc = CopySwap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(
client,
curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
@@ -1216,7 +1239,6 @@ ProcGetPointerMapping(client)
ClientPtr client;
{
xGetPointerMappingReply rep;
- REQUEST(xReq);
ButtonClassPtr butc = inputInfo.pointer->button;
REQUEST_SIZE_MATCH(xReq);
@@ -1264,7 +1286,7 @@ ProcChangeKeyboardControl (client)
int t;
int led = DO_ALL;
int key = DO_ALL;
- BITS32 vmask, index;
+ BITS32 vmask, index2;
int mask, i;
REQUEST(xChangeKeyboardControlReq);
@@ -1280,9 +1302,9 @@ ProcChangeKeyboardControl (client)
ctrl = keybd->kbdfeed->ctrl;
while (vmask)
{
- index = (BITS32) lowbit (vmask);
- vmask &= ~index;
- switch (index)
+ index2 = (BITS32) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
{
case KBKeyClickPercent:
t = (INT8)*vlist;
@@ -1369,9 +1391,9 @@ ProcChangeKeyboardControl (client)
if (!noXkbExtension) {
XkbEventCauseRec cause;
XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
- keybd->kbdfeed->ctrl.leds = ctrl.leds;
XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
ctrl.leds, &cause);
+ ctrl.leds = keybd->kbdfeed->ctrl.leds;
}
#endif
break;
@@ -1451,7 +1473,6 @@ ProcGetKeyboardControl (client)
int i;
register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl;
xGetKeyboardControlReply rep;
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
@@ -1559,7 +1580,6 @@ ProcGetPointerControl(client)
ClientPtr client;
{
register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
- REQUEST(xReq);
xGetPointerControlReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -1650,7 +1670,7 @@ ProcGetMotionEvents(client)
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
if (nEvents)
{
- client->pSwapReplyFunc = SwapTimeCoordWrite;
+ client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
(char *)coords);
}
@@ -1663,7 +1683,6 @@ int
ProcQueryKeymap(client)
ClientPtr client;
{
- REQUEST(xReq);
xQueryKeymapReply rep;
int i;
CARD8 *down = inputInfo.keyboard->key->down;
@@ -1685,3 +1704,58 @@ ProcQueryKeymap(client)
return Success;
}
+/******************************************************************************
+ * The following entrypoints are provided for binary compatibility with
+ * previous versions (they make casts, where the current version changes types
+ * for more stringent prototype checking).
+ ******************************************************************************/
+#ifdef AddInputDevice
+#undef AddInputDevice
+
+#if NeedFunctionPrototypes
+DevicePtr
+AddInputDevice(
+ DeviceProc deviceProc,
+ Bool autoStart)
+#else
+DevicePtr
+AddInputDevice(deviceProc, autoStart)
+ DeviceProc deviceProc;
+ Bool autoStart;
+#endif
+{
+ return (DevicePtr)_AddInputDevice(deviceProc, autoStart);
+}
+#endif /* AddInputDevice */
+
+#ifdef RegisterPointerDevice
+#undef RegisterPointerDevice
+
+#if NeedFunctionPrototypes
+void
+RegisterPointerDevice(DevicePtr device)
+#else
+void
+RegisterPointerDevice(device)
+ DevicePtr device;
+#endif
+{
+ _RegisterPointerDevice((DeviceIntPtr)device);
+}
+#endif /* RegisterPointerDevice */
+
+#ifdef RegisterKeyboardDevice
+#undef RegisterKeyboardDevice
+
+#if NeedFunctionPrototypes
+void
+RegisterKeyboardDevice(DevicePtr device)
+#else
+void
+RegisterKeyboardDevice(device)
+ DevicePtr device;
+#endif
+{
+ _RegisterKeyboardDevice((DeviceIntPtr)device);
+}
+#endif /* RegisterKeyboardDevice */
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 68cd8e549..24b825e41 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -46,6 +46,35 @@ SOFTWARE.
********************************************************/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.29 2003/01/12 02:44:26 dawes Exp $ */
+
+#ifdef PANORAMIX_DEBUG
+#include <stdio.h>
+int ProcInitialConnection();
+#endif
+
#include "windowstr.h"
#include "fontstruct.h"
#include "dixfontstr.h"
@@ -59,40 +88,43 @@ SOFTWARE.
#include "servermd.h"
#include "extnsionst.h"
#include "dixfont.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#include "swapreq.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
#ifdef XAPPGROUP
-#include "extensions/Xagsrv.h"
+#include "Xagsrv.h"
+#endif
+#ifdef XKB
+#define XKB_IN_SERVER
+#include "inputstr.h"
+#include "XKBsrv.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
-#define BITMASK(i) (1 << ((i) & 31))
+#define BITMASK(i) (1U << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
#define MASKWORD(buf, i) buf[MASKIDX(i)]
#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
-extern WindowPtr *WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
-extern void ReleaseActiveGrabs();
-extern void NotImplemented();
-extern void SwapConnClientPrefix(
-#if NeedFunctionPrototypes
- xConnClientPrefix *
-#endif
-);
Selection *CurrentSelections;
int NumCurrentSelections;
-extern CARD32 defaultScreenSaverTime;
-extern CARD32 defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultScreenSaverAllowExposures;
static ClientPtr grabClient;
#define GrabNone 0
#define GrabActive 1
@@ -103,13 +135,6 @@ CallbackListPtr ServerGrabCallback = NULL;
HWEventQueuePtr checkForInput[2];
extern int connBlockScreenStart;
-#ifdef XKB
-extern Bool noXkbExtension;
-#endif
-
-extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(), WriteSConnectionInfo();
-extern void WriteSConnSetupPrefix();
-
static void KillAllClients(
#if NeedFunctionPrototypes
void
@@ -122,10 +147,6 @@ static void DeleteClientFromAnySelections(
#endif
);
-#ifdef LBX
-extern unsigned long StandardRequestLength();
-#endif
-
static int nextFreeClientID; /* always MIN free client ID */
static int nClients; /* number of authorized clients */
@@ -221,17 +242,123 @@ FlushClientCaches(id)
}
}
}
+#ifdef SMART_SCHEDULE
+
+#undef SMART_DEBUG
+
+#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
+#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+
+Bool SmartScheduleDisable;
+long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
+long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
+long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
+long SmartScheduleTime;
+ClientPtr SmartLastClient;
+int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
+int SmartScheduleClient(int *clientReady, int nready);
+
+#ifdef SMART_DEBUG
+long SmartLastPrint;
+#endif
+
+void Dispatch(void);
+void InitProcVectors(void);
+
+int
+SmartScheduleClient (int *clientReady, int nready)
+{
+ ClientPtr pClient;
+ int i;
+ int client;
+ int bestPrio, best = 0;
+ int bestRobin, robin;
+ long now = SmartScheduleTime;
+ long idle;
+
+ bestPrio = -0x7fffffff;
+ bestRobin = 0;
+ idle = 2 * SmartScheduleSlice;
+ for (i = 0; i < nready; i++)
+ {
+ client = clientReady[i];
+ pClient = clients[client];
+ /* Praise clients which are idle */
+ if ((now - pClient->smart_check_tick) >= idle)
+ {
+ if (pClient->smart_priority < 0)
+ pClient->smart_priority++;
+ }
+ pClient->smart_check_tick = now;
+
+ /* check priority to select best client */
+ robin = (pClient->index - SmartLastIndex[pClient->smart_priority-SMART_MIN_PRIORITY]) & 0xff;
+ if (pClient->smart_priority > bestPrio ||
+ (pClient->smart_priority == bestPrio && robin > bestRobin))
+ {
+ bestPrio = pClient->smart_priority;
+ bestRobin = robin;
+ best = client;
+ }
+#ifdef SMART_DEBUG
+ if ((now - SmartLastPrint) >= 5000)
+ fprintf (stderr, " %2d: %3d", client, pClient->smart_priority);
+#endif
+ }
+#ifdef SMART_DEBUG
+ if ((now - SmartLastPrint) >= 5000)
+ {
+ fprintf (stderr, " use %2d\n", best);
+ SmartLastPrint = now;
+ }
+#endif
+ pClient = clients[best];
+ SmartLastIndex[bestPrio-SMART_MIN_PRIORITY] = pClient->index;
+ /*
+ * Set current client pointer
+ */
+ if (SmartLastClient != pClient)
+ {
+ pClient->smart_start_tick = now;
+ SmartLastClient = pClient;
+ }
+ /*
+ * Adjust slice
+ */
+ if (nready == 1)
+ {
+ /*
+ * If it's been a long time since another client
+ * has run, bump the slice up to get maximal
+ * performance from a single client
+ */
+ if ((now - pClient->smart_start_tick) > 1000 &&
+ SmartScheduleSlice < SmartScheduleMaxSlice)
+ {
+ SmartScheduleSlice += SmartScheduleInterval;
+ }
+ }
+ else
+ {
+ SmartScheduleSlice = SmartScheduleInterval;
+ }
+ return best;
+}
+#endif
#define MAJOROP ((xReq *)client->requestBuffer)->reqType
void
-Dispatch()
+Dispatch(void)
{
register int *clientReady; /* array of request ready clients */
register int result;
register ClientPtr client;
register int nready;
register HWEventQueuePtr* icheck = checkForInput;
+#ifdef SMART_SCHEDULE
+ int start_tick;
+#endif
nextFreeClientID = 1;
InitSelections();
@@ -251,6 +378,13 @@ Dispatch()
nready = WaitForSomething(clientReady);
+#ifdef SMART_SCHEDULE
+ if (nready && !SmartScheduleDisable)
+ {
+ clientReady[0] = SmartScheduleClient (clientReady, nready);
+ nready = 1;
+ }
+#endif
/*****************
* Handle events in round robin fashion, doing input between
* each round
@@ -273,6 +407,9 @@ Dispatch()
isItTimeToYield = FALSE;
requestingClient = client;
+#ifdef SMART_SCHEDULE
+ start_tick = SmartScheduleTime;
+#endif
while (!isItTimeToYield)
{
if (*icheck[0] != *icheck[1])
@@ -280,7 +417,16 @@ Dispatch()
ProcessInputEvents();
FlushIfCriticalOutputPending();
}
-
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable &&
+ (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
+ {
+ /* Penalize clients which consume ticks */
+ if (client->smart_priority > SMART_MIN_PRIORITY)
+ client->smart_priority--;
+ break;
+ }
+#endif
/* now, finally, deal with client requests */
result = ReadRequestFromClient(client);
@@ -315,7 +461,11 @@ Dispatch()
}
}
FlushAllOutput();
-
+#ifdef SMART_SCHEDULE
+ client = clients[clientReady[nready]];
+ if (client)
+ client->smart_stop_tick = SmartScheduleTime;
+#endif
requestingClient = NULL;
}
dispatchException &= ~DE_PRIORITYCHANGE;
@@ -699,7 +849,6 @@ int
ProcQueryTree(client)
register ClientPtr client;
{
-
xQueryTreeReply reply;
int numChildren = 0;
register WindowPtr pChild, pWin, pHead;
@@ -718,7 +867,6 @@ ProcQueryTree(client)
reply.parent = pWin->parent->drawable.id;
else
reply.parent = (Window)None;
-
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
numChildren++;
@@ -739,7 +887,7 @@ ProcQueryTree(client)
WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
if (numChildren)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
DEALLOCATE_LOCAL(childIDs);
}
@@ -999,7 +1147,6 @@ int
ProcGrabServer(client)
register ClientPtr client;
{
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
if (grabState != GrabNone && client != grabClient)
{
@@ -1025,8 +1172,12 @@ ProcGrabServer(client)
}
static void
+#if NeedFunctionPrototypes
+UngrabServer(ClientPtr client)
+#else
UngrabServer(client)
ClientPtr client;
+#endif
{
int i;
@@ -1056,7 +1207,6 @@ int
ProcUngrabServer(client)
register ClientPtr client;
{
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
UngrabServer(client);
return(client->noClientException);
@@ -1429,6 +1579,7 @@ ProcChangeGC(client)
len = client->req_len - (sizeof(xChangeGCReq) >> 2);
if (len != Ones(stuff->mask))
return BadLength;
+
result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0);
if (client->noClientException != Success)
return(client->noClientException);
@@ -1808,6 +1959,7 @@ ProcPolyFillRectangle(client)
if (things & 4)
return(BadLength);
things >>= 3;
+
if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
(xRectangle *) &stuff[1]);
@@ -1834,6 +1986,49 @@ ProcPolyFillArc(client)
return (client->noClientException);
}
+#ifdef MATCH_CLIENT_ENDIAN
+
+int
+ServerOrder (void)
+{
+ int whichbyte = 1;
+
+ if (*((char *) &whichbyte))
+ return LSBFirst;
+ return MSBFirst;
+}
+
+#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
+
+void
+ReformatImage (char *base, int nbytes, int bpp, int order)
+{
+ switch (bpp) {
+ case 1: /* yuck */
+ if (BITMAP_BIT_ORDER != order)
+ BitOrderInvert ((unsigned char *) base, nbytes);
+#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
+ ReformatImage (base, nbytes, BITMAP_SCANLINE_UNIT, order);
+#endif
+ break;
+ case 4:
+ break; /* yuck */
+ case 8:
+ break;
+ case 16:
+ if (IMAGE_BYTE_ORDER != order)
+ TwoByteSwap ((unsigned char *) base, nbytes);
+ break;
+ case 32:
+ if (IMAGE_BYTE_ORDER != order)
+ FourByteSwap ((unsigned char *) base, nbytes);
+ break;
+ }
+}
+#else
+#define ReformatImage(b,n,bpp,o)
+#endif
+
/* 64-bit server notes: the protocol restricts padding of images to
* 8-, 16-, or 32-bits. We would like to have 64-bits for the server
* to use internally. Removes need for internal alignment checking.
@@ -1864,9 +2059,6 @@ ProcPutImage(client)
(stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
return BadMatch;
length = BitmapBytePad(stuff->width + stuff->leftPad);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
-#endif
}
else if (stuff->format == XYPixmap)
{
@@ -1875,19 +2067,12 @@ ProcPutImage(client)
return BadMatch;
length = BitmapBytePad(stuff->width + stuff->leftPad);
length *= stuff->depth;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
- lengthProto *= stuff->depth;
-#endif
}
else if (stuff->format == ZPixmap)
{
if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
return BadMatch;
length = PixmapBytePad(stuff->width, stuff->depth);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->width, stuff->depth);
-#endif
}
else
{
@@ -1895,65 +2080,21 @@ ProcPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* handle 64 bit case where protocol may pad to 32 and we want 64 */
- if ( length != lengthProto ) {
- register int i;
- char * stuffptr, /* pointer into protocol data */
- * tmpptr; /* new location to copy to */
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
- return (BadAlloc);
-
- bzero(tmpImage,length*stuff->height);
-
- if ( stuff->format == XYPixmap ) {
- int lineBytes = BitmapBytePad(stuff->width + stuff->leftPad);
- int lineBytesProto =
- BitmapBytePadProto(stuff->width + stuff->leftPad);
- int depth = stuff->depth;
-
- stuffptr = (char *)&stuff[1];
- tmpptr = tmpImage;
- for ( i = 0; i < stuff->height*stuff->depth;
- stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
- memmove(tmpptr,stuffptr,lineBytesProto);
- }
- else {
- for ( i = 0,stuffptr = (char *)&stuff[1],tmpptr=tmpImage;
- i < stuff->height;
- stuffptr += lengthProto,tmpptr += length, i++)
- memmove(tmpptr,stuffptr,lengthProto);
- }
- }
-
- /* handle 64-bit case where stuff is not 64-bit aligned */
- else if ((unsigned long)&stuff[1] & (sizeof(long)-1)) {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
- return (BadAlloc);
- memmove(tmpImage,(char *)&stuff[1],length*stuff->height);
- }
- else
- tmpImage = (char *)&stuff[1];
-#else
tmpImage = (char *)&stuff[1];
lengthProto = length;
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) +
(sizeof(xPutImageReq) >> 2)) != client->req_len)
return BadLength;
+ ReformatImage (tmpImage, lengthProto * stuff->height,
+ stuff->format == ZPixmap ? BitsPerPixel (stuff->depth) : 1,
+ ClientOrder(client));
+
(*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
stuff->width, stuff->height,
stuff->leftPad, stuff->format, tmpImage);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* free up our temporary space if used */
- if (tmpImage != (char *)&stuff[1])
- DEALLOCATE_LOCAL(tmpImage);
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
-
return (client->noClientException);
}
@@ -1971,10 +2112,7 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
int nlines, linesPerBuf;
register int linesDone;
long widthBytesLine, length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLineProto, lengthProto;
-#endif
- Mask plane;
+ Mask plane = 0;
char *pBuf;
xGetImageReply xgi;
RegionPtr pVisibleRegion = NULL;
@@ -2024,10 +2162,6 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
widthBytesLine = PixmapBytePad(width, pDraw->depth);
length = widthBytesLine * height;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = PixmapBytePadProto(width, pDraw->depth);
- lengthProto = widthBytesLineProto * height;
-#endif
}
else
{
@@ -2037,18 +2171,9 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
length = widthBytesLine * height *
Ones(planemask & (plane | (plane - 1)));
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = BitmapBytePadProto(width);
- lengthProto = widthBytesLineProto * height *
- Ones(planemask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- xgi.length = lengthProto;
-#else
xgi.length = length;
-#endif
if (im_return) {
pBuf = (char *)xalloc(sz_xGetImageReply + length);
@@ -2078,12 +2203,12 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
{
/* we have to make sure intermediate buffers don't need padding */
while ((linesPerBuf > 1) &&
- (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
+ (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
{
linesPerBuf--;
length -= widthBytesLine;
}
- while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))
+ while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1))
{
linesPerBuf++;
length += widthBytesLine;
@@ -2131,35 +2256,19 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
nlines, format, pBuf);
#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* for 64-bit server, convert image to pad to 32 bits */
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- for (i = 1,
- bufPtr = pBuf + widthBytesLine,
- protoPtr = pBuf + widthBytesLineProto;
- i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr, bufPtr, widthBytesLineProto);
- }
-#endif
/* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (!im_return)
+ {
+ ReformatImage (pBuf, (int)(nlines * widthBytesLine),
+ BitsPerPixel (pDraw->depth),
+ ClientOrder(client));
+
/* Don't split me, gcc pukes when you do */
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto),
- pBuf);
-#else
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
-#endif
+ }
linesDone += nlines;
}
}
@@ -2189,41 +2298,21 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
nlines, format, pBuf);
#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* for 64-bit server, convert image to pad to 32 bits */
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- for (i = 1,
- bufPtr = pBuf + widthBytesLine,
- protoPtr = pBuf + widthBytesLineProto;
- i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr, bufPtr, widthBytesLineProto);
- }
-#endif
/* Note: NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (im_return) {
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- pBuf += nlines * widthBytesLineProto;
-#else
pBuf += nlines * widthBytesLine;
-#endif
- } else
+ } else {
+ ReformatImage (pBuf,
+ (int)(nlines * widthBytesLine),
+ 1,
+ ClientOrder (client));
+
/* Don't split me, gcc pukes when you do */
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto),
- pBuf);
-#else
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
-#endif
+ }
linesDone += nlines;
}
}
@@ -2517,7 +2606,7 @@ ProcListInstalledColormaps(client)
preply->nColormaps = nummaps;
preply->length = nummaps;
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
DEALLOCATE_LOCAL(preply);
return(client->noClientException);
@@ -2561,6 +2650,9 @@ ProcAllocColor(client)
else
return (retval);
}
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pmap->pScreen->myNum)
+#endif
WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
return (client->noClientException);
@@ -2617,6 +2709,9 @@ ProcAllocNamedColor (client)
else
return(retval);
}
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr);
return (client->noClientException);
}
@@ -2684,14 +2779,19 @@ ProcAllocColorCells (client)
else
return(retval);
}
- accr.type = X_Reply;
- accr.length = length >> 2;
- accr.sequenceNumber = client->sequence;
- accr.nPixels = npixels;
- accr.nMasks = nmasks;
- WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
- client->pSwapReplyFunc = Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
+ {
+ accr.type = X_Reply;
+ accr.length = length >> 2;
+ accr.sequenceNumber = client->sequence;
+ accr.nPixels = npixels;
+ accr.nMasks = nmasks;
+ WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
DEALLOCATE_LOCAL(ppixels);
return (client->noClientException);
}
@@ -2758,9 +2858,14 @@ ProcAllocColorPlanes(client)
return(retval);
}
acpr.length = length >> 2;
- WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
- client->pSwapReplyFunc = Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
+ {
+ WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
DEALLOCATE_LOCAL(ppixels);
return (client->noClientException);
}
@@ -2915,7 +3020,7 @@ ProcQueryColors(client)
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count)
{
- client->pSwapReplyFunc = SQColorsExtend;
+ client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
if (prgbs) DEALLOCATE_LOCAL(prgbs);
@@ -3199,7 +3304,6 @@ int
ProcGetScreenSaver(client)
register ClientPtr client;
{
- REQUEST(xReq);
xGetScreenSaverReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -3243,11 +3347,10 @@ int
ProcListHosts(client)
register ClientPtr client;
{
-extern int GetHosts();
xListHostsReply reply;
int len, nHosts, result;
pointer pdata;
- REQUEST(xListHostsReq);
+ /* REQUEST(xListHostsReq); */
REQUEST_SIZE_MATCH(xListHostsReq);
#ifdef XCSECURITY
@@ -3268,7 +3371,7 @@ extern int GetHosts();
WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
if (nHosts)
{
- client->pSwapReplyFunc = SLHostsExtend;
+ client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
WriteSwappedDataToClient(client, len, pdata);
}
xfree(pdata);
@@ -3372,7 +3475,7 @@ ProcGetFontPath(client)
xGetFontPathReply reply;
int stringLens, numpaths;
unsigned char *bufferStart;
- REQUEST (xReq);
+ /* REQUEST (xReq); */
REQUEST_SIZE_MATCH(xReq);
bufferStart = GetFontPath(&numpaths, &stringLens);
@@ -3429,8 +3532,6 @@ int ProcForceScreenSaver(client)
int ProcNoOperation(client)
register ClientPtr client;
{
- REQUEST(xReq);
-
REQUEST_AT_LEAST_SIZE(xReq);
/* noop -- don't do anything */
@@ -3438,7 +3539,7 @@ int ProcNoOperation(client)
}
void
-InitProcVectors()
+InitProcVectors(void)
{
int i;
for (i = 0; i<256; i++)
@@ -3446,7 +3547,7 @@ InitProcVectors()
if(!ProcVector[i])
{
ProcVector[i] = SwappedProcVector[i] = ProcBadRequest;
- ReplySwapVector[i] = NotImplemented;
+ ReplySwapVector[i] = ReplyNotSwappd;
}
#ifdef K5AUTH
if (!k5_Vector[i])
@@ -3469,7 +3570,7 @@ InitProcVectors()
* then killed again, the client is really destroyed.
*********************/
-Bool terminateAtReset = FALSE;
+char dispatchExceptionAtReset = DE_RESET;
void
CloseDownClient(client)
@@ -3535,12 +3636,8 @@ CloseDownClient(client)
if (really_close_down)
{
if (client->clientState == ClientStateRunning && nClients == 0)
- {
- if (terminateAtReset)
- dispatchException |= DE_TERMINATE;
- else
- dispatchException |= DE_RESET;
- }
+ dispatchException |= dispatchExceptionAtReset;
+
client->clientState = ClientStateGone;
if (ClientStateCallback)
{
@@ -3555,6 +3652,9 @@ CloseDownClient(client)
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
+#ifdef SMART_SCHEDULE
+ SmartLastClient = NullClient;
+#endif
xfree(client);
while (!clients[currentMaxClients-1])
@@ -3651,6 +3751,12 @@ void InitClient(client, i, ospriv)
client->appgroup = NULL;
#endif
client->fontResFunc = NULL;
+#ifdef SMART_SCHEDULE
+ client->smart_priority = 0;
+ client->smart_start_tick = SmartScheduleTime;
+ client->smart_stop_tick = SmartScheduleTime;
+ client->smart_check_tick = SmartScheduleTime;
+#endif
}
extern int clientPrivateLen;
@@ -3795,7 +3901,6 @@ SendConnSetup(client, reason)
if (reason)
{
xConnSetupPrefix csp;
- char pad[3];
csp.success = xFalse;
csp.lengthReason = strlen(reason);
@@ -3828,8 +3933,19 @@ SendConnSetup(client, reason)
#endif
((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
+#ifdef MATCH_CLIENT_ENDIAN
+ ((xConnSetup *)lConnectionInfo)->imageByteOrder = ClientOrder (client);
+ ((xConnSetup *)lConnectionInfo)->bitmapBitOrder = ClientOrder (client);
+#endif
/* fill in the "currentInputMask" */
root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
+#endif
+
for (i=0; i<numScreens; i++)
{
register unsigned int j;
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 83ef68b96..5386c908b 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.27 2003/02/15 03:47:05 dawes Exp $ */
/************************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -40,47 +41,27 @@ SOFTWARE.
#include <stdio.h>
#endif
-#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics
-
-static Mask FontFormat =
-#if IMAGE_BYTE_ORDER == LSBFirst
- BitmapFormatByteOrderLSB |
-#else
- BitmapFormatByteOrderMSB |
-#endif
-
-#if BITMAP_BIT_ORDER == LSBFirst
- BitmapFormatBitOrderLSB |
-#else
- BitmapFormatBitOrderMSB |
-#endif
-
- BitmapFormatImageRectMin |
-
-#if GLYPHPADBYTES == 1
- BitmapFormatScanlinePad8 |
-#endif
-
-#if GLYPHPADBYTES == 2
- BitmapFormatScanlinePad16 |
+#ifdef PANORAMIX
+#include "panoramiX.h"
#endif
-#if GLYPHPADBYTES == 4
- BitmapFormatScanlinePad32 |
+#ifdef LBX
+#include "lbxserve.h"
#endif
-#if GLYPHPADBYTES == 8
- BitmapFormatScanlinePad64 |
+#ifdef XF86BIGFONT
+#define _XF86BIGFONT_SERVER_
+#include "xf86bigfont.h"
#endif
- BitmapFormatScanlineUnit8;
+#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics
extern pointer fosNaturalParams;
extern FontPtr defaultFont;
static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
static int num_fpes = 0;
-static FPEFunctions *fpe_functions = (FPEFunctions *) 0;
+FPEFunctions *fpe_functions = (FPEFunctions *) 0;
static int num_fpe_types = 0;
static unsigned char *font_path_string;
@@ -100,8 +81,8 @@ FontToXError(err)
case AllocError:
return BadAlloc;
case BadFontName:
- case BadFontPath:
return BadName;
+ case BadFontPath:
case BadFontFormat: /* is there something better? */
case BadCharRange:
return BadValue;
@@ -212,15 +193,23 @@ FontWakeup(data, count, LastSelectMask)
/* XXX -- these two funcs may want to be broken into macros */
static void
+#if NeedFunctionPrototypes
+UseFPE(FontPathElementPtr fpe)
+#else
UseFPE(fpe)
FontPathElementPtr fpe;
+#endif
{
fpe->refcount++;
}
static void
+#if NeedFunctionPrototypes
+FreeFPE (FontPathElementPtr fpe)
+#else
FreeFPE (fpe)
FontPathElementPtr fpe;
+#endif
{
fpe->refcount--;
if (fpe->refcount == 0) {
@@ -231,12 +220,16 @@ FreeFPE (fpe)
}
static Bool
+#if NeedFunctionPrototypes
+doOpenFont(ClientPtr client, OFclosurePtr c)
+#else
doOpenFont(client, c)
ClientPtr client;
OFclosurePtr c;
+#endif
{
FontPtr pfont = NullFont;
- FontPathElementPtr fpe;
+ FontPathElementPtr fpe = NULL;
ScreenPtr pScr;
int err = Successful;
int i;
@@ -244,6 +237,36 @@ doOpenFont(client, c)
*newname;
int newlen;
int aliascount = 20;
+ /*
+ * Decide at runtime what FontFormat to use.
+ */
+ Mask FontFormat =
+
+ ((screenInfo.imageByteOrder == LSBFirst) ?
+ BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) |
+
+ ((screenInfo.bitmapBitOrder == LSBFirst) ?
+ BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) |
+
+ BitmapFormatImageRectMin |
+
+#if GLYPHPADBYTES == 1
+ BitmapFormatScanlinePad8 |
+#endif
+
+#if GLYPHPADBYTES == 2
+ BitmapFormatScanlinePad16 |
+#endif
+
+#if GLYPHPADBYTES == 4
+ BitmapFormatScanlinePad32 |
+#endif
+
+#if GLYPHPADBYTES == 8
+ BitmapFormatScanlinePad64 |
+#endif
+
+ BitmapFormatScanlineUnit8;
if (client->clientGone)
{
@@ -292,7 +315,7 @@ doOpenFont(client, c)
if (err == Suspended) {
if (!c->slept) {
c->slept = TRUE;
- ClientSleep(client, doOpenFont, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (pointer) c);
}
return TRUE;
}
@@ -358,6 +381,14 @@ OpenFont(client, fid, flags, lenfname, pfontname)
int i;
FontPtr cached = (FontPtr)0;
+#ifdef FONTDEBUG
+ char *f;
+ f = (char *)xalloc(lenfname + 1);
+ memmove(f, pfontname, lenfname);
+ f[lenfname] = '\0';
+ ErrorF("OpenFont: fontname is \"%s\"\n", f);
+ xfree(f);
+#endif
if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
return BadName;
if (patternCache)
@@ -461,6 +492,9 @@ CloseFont(value, fid)
#ifdef LBX
LbxFreeFontTag(pfont);
#endif
+#ifdef XF86BIGFONT
+ XF86BigfontFreeFontShm(pfont);
+#endif
fpe = pfont->fpe;
(*fpe_functions[fpe->type].close_font) (fpe, pfont);
FreeFPE(fpe);
@@ -489,7 +523,7 @@ QueryFont(pFont, pReply, nProtoCCIStructs)
xFontProp *prFP;
xCharInfo *prCI;
xCharInfo *charInfos[256];
- char chars[512];
+ unsigned char chars[512];
int ninfos;
unsigned long ncols;
unsigned long count;
@@ -529,8 +563,8 @@ QueryFont(pFont, pReply, nProtoCCIStructs)
chars[i++] = r;
chars[i++] = c;
}
- (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit,
- &count, charInfos);
+ (*pFont->get_metrics) (pFont, ncols, chars,
+ TwoD16Bit, &count, charInfos);
i = 0;
for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) {
*prCI = *charInfos[i];
@@ -542,14 +576,18 @@ QueryFont(pFont, pReply, nProtoCCIStructs)
}
static Bool
+#if NeedFunctionPrototypes
+doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
+#else
doListFontsAndAliases(client, c)
ClientPtr client;
LFclosurePtr c;
+#endif
{
FontPathElementPtr fpe;
int err = Successful;
FontNamesPtr names = NULL;
- char *name, *resolved;
+ char *name, *resolved=NULL;
int namelen, resolvedlen;
int nnames;
int stringLens;
@@ -557,7 +595,7 @@ doListFontsAndAliases(client, c)
xListFontsReply reply;
char *bufptr;
char *bufferStart;
- int aliascount;
+ int aliascount = 0;
if (client->clientGone)
{
@@ -589,7 +627,9 @@ doListFontsAndAliases(client, c)
if (err == Suspended) {
if (!c->slept) {
c->slept = TRUE;
- ClientSleep(client, doListFontsAndAliases, (pointer) c);
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
+ (pointer) c);
}
return TRUE;
}
@@ -614,7 +654,8 @@ doListFontsAndAliases(client, c)
&c->current.private);
if (err == Suspended) {
if (!c->slept) {
- ClientSleep(client, doListFontsAndAliases,
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
(pointer) c);
c->slept = TRUE;
}
@@ -624,18 +665,26 @@ doListFontsAndAliases(client, c)
c->current.list_started = TRUE;
}
if (err == Successful) {
+ char *tmpname;
name = 0;
err = (*fpe_functions[fpe->type].list_next_font_or_alias)
- ((pointer) c->client, fpe, &name, &namelen, &resolved,
+ ((pointer) c->client, fpe, &name, &namelen, &tmpname,
&resolvedlen, c->current.private);
if (err == Suspended) {
if (!c->slept) {
- ClientSleep(client, doListFontsAndAliases,
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
(pointer) c);
c->slept = TRUE;
}
return TRUE;
}
+ if (err == FontNameAlias) {
+ if (resolved) xfree(resolved);
+ resolved = (char *) xalloc(resolvedlen + 1);
+ if (resolved)
+ memmove(resolved, tmpname, resolvedlen + 1);
+ }
}
if (err == Successful)
@@ -784,6 +833,7 @@ bail:
if (c->savedName) xfree(c->savedName);
FreeFontNames(names);
xfree(c);
+ if (resolved) xfree(resolved);
return TRUE;
}
@@ -856,7 +906,7 @@ doListFontsWithInfo(client, c)
int length;
xFontProp *pFP;
int i;
- int aliascount;
+ int aliascount = 0;
xListFontsWithInfoReply finalReply;
if (client->clientGone)
@@ -885,7 +935,7 @@ doListFontsWithInfo(client, c)
{
if (!c->slept)
{
- ClientSleep(client, doListFontsWithInfo, c);
+ ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c);
c->slept = TRUE;
}
return TRUE;
@@ -904,7 +954,9 @@ doListFontsWithInfo(client, c)
{
if (!c->slept)
{
- ClientSleep(client, doListFontsWithInfo, c);
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsWithInfo,
+ c);
c->slept = TRUE;
}
return TRUE;
@@ -1122,9 +1174,9 @@ doPolyText(client, c)
register FontPtr pFont = c->pGC->font, oldpFont;
Font fid, oldfid;
int err = Success, lgerr; /* err is in X error, not font error, space */
- enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state;
+ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
FontPathElementPtr fpe;
- GC *origGC;
+ GC *origGC = NULL;
if (client->clientGone)
{
@@ -1211,9 +1263,9 @@ doPolyText(client, c)
ChangeGC( c->pGC, GCFont, &fid);
ValidateGC(c->pDraw, c->pGC);
if (c->reqType == X_PolyText8)
- c->polyText = c->pGC->ops->PolyText8;
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
else
- c->polyText = c->pGC->ops->PolyText16;
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16;
}
/* Undo the refcnt++ we performed when going to sleep */
@@ -1319,7 +1371,9 @@ doPolyText(client, c)
ValidateGC(c->pDraw, c->pGC);
c->slept = TRUE;
- ClientSleep(client, doPolyText, (pointer) c);
+ ClientSleep(client,
+ (ClientSleepProcPtr)doPolyText,
+ (pointer) c);
/* Set up to perform steps 3 and 4 */
client_state = START_SLEEP;
@@ -1360,7 +1414,10 @@ bail:
if (c->err != Success) err = c->err;
if (err != Success && c->client != serverClient) {
- SendErrorToClient(c->client, c->reqType, 0, 0, err);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !c->pGC->pScreen->myNum)
+#endif
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
}
if (c->slept)
{
@@ -1400,12 +1457,12 @@ PolyText(client, pDraw, pGC, pElt, endReq, xorg, yorg, reqType, did)
local_closure.yorg = yorg;
if ((local_closure.reqType = reqType) == X_PolyText8)
{
- local_closure.polyText = pGC->ops->PolyText8;
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8;
local_closure.itemSize = 1;
}
else
{
- local_closure.polyText = pGC->ops->PolyText16;
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16;
local_closure.itemSize = 2;
}
local_closure.pGC = pGC;
@@ -1508,7 +1565,7 @@ doImageText(client, c)
ValidateGC(c->pDraw, c->pGC);
c->slept = TRUE;
- ClientSleep(client, doImageText, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)doImageText, (pointer) c);
}
return TRUE;
}
@@ -1567,12 +1624,12 @@ ImageText(client, pDraw, pGC, nChars, data, xorg, yorg, reqType, did)
local_closure.yorg = yorg;
if ((local_closure.reqType = reqType) == X_ImageText8)
{
- local_closure.imageText = pGC->ops->ImageText8;
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8;
local_closure.itemSize = 1;
}
else
{
- local_closure.imageText = pGC->ops->ImageText16;
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16;
local_closure.itemSize = 2;
}
local_closure.did = did;
@@ -1585,8 +1642,12 @@ ImageText(client, pDraw, pGC, nChars, data, xorg, yorg, reqType, did)
/* does the necessary magic to figure out the fpe type */
static int
+#if NeedFunctionPrototypes
+DetermineFPEType(char *pathname)
+#else
DetermineFPEType(pathname)
char *pathname;
+#endif
{
int i;
@@ -1599,10 +1660,14 @@ DetermineFPEType(pathname)
static void
+#if NeedFunctionPrototypes
+FreeFontPath(FontPathElementPtr *list, int n, Bool force)
+#else
FreeFontPath(list, n, force)
FontPathElementPtr *list;
Bool force;
int n;
+#endif
{
int i;
@@ -1628,12 +1693,16 @@ FreeFontPath(list, n, force)
xfree((char *) list);
}
-static FontPathElementPtr
+static FontPathElementPtr
+#if NeedFunctionPrototypes
+find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len)
+#else
find_existing_fpe(list, num, name, len)
FontPathElementPtr *list;
int num;
unsigned char *name;
int len;
+#endif
{
FontPathElementPtr fpe;
int i;
@@ -1648,18 +1717,21 @@ find_existing_fpe(list, num, name, len)
static int
-SetFontPathElements(npaths, paths, bad)
+#if NeedFunctionPrototypes
+SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
+#else
+SetFontPathElements(npaths, paths, bad, persist)
int npaths;
unsigned char *paths;
int *bad;
+ Bool persist;
+#endif
{
- int i,
- err;
+ int i, err = 0;
int valid_paths = 0;
unsigned int len;
unsigned char *cp = paths;
- FontPathElementPtr fpe,
- *fplist;
+ FontPathElementPtr fpe = NULL, *fplist;
fplist = (FontPathElementPtr *)
xalloc(sizeof(FontPathElementPtr) * npaths);
@@ -1671,63 +1743,83 @@ SetFontPathElements(npaths, paths, bad)
if (fpe_functions[i].set_path_hook)
(*fpe_functions[i].set_path_hook) ();
}
- for (i = 0; i < npaths; i++) {
+ for (i = 0; i < npaths; i++)
+ {
len = (unsigned int) (*cp++);
- if (len) {
+ if (len == 0)
+ {
+ if (persist)
+ ErrorF ("Removing empty element from the valid list of fontpaths\n");
+ err = BadValue;
+ }
+ else
+ {
/* if it's already in our active list, just reset it */
/*
* note that this can miss FPE's in limbo -- may be worth catching
* them, though it'd muck up refcounting
*/
fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
- if (fpe) {
+ if (fpe)
+ {
err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
- if (err == Successful) {
+ if (err == Successful)
+ {
UseFPE(fpe);/* since it'll be decref'd later when freed
* from the old list */
- fplist[valid_paths++] = fpe;
- cp += len;
- continue;
}
- /* if error or can't do it, act like it's a new one */
- }
- fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
- if (!fpe) {
- err = BadAlloc;
- goto bail;
- }
- fpe->name = (char *) xalloc(len + 1);
- if (!fpe->name) {
- xfree(fpe);
- err = BadAlloc;
- goto bail;
+ else
+ fpe = 0;
}
- fpe->refcount = 1;
-
- strncpy(fpe->name, (char *) cp, (int) len);
- cp += len;
- fpe->name[len] = '\0';
- fpe->name_length = len;
- fpe->type = DetermineFPEType(fpe->name);
- if (fpe->type == -1) {
- xfree(fpe->name);
- xfree(fpe);
- err = BadValue;
- goto bail;
+ /* if error or can't do it, act like it's a new one */
+ if (!fpe)
+ {
+ fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
+ if (!fpe)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->name = (char *) xalloc(len + 1);
+ if (!fpe->name)
+ {
+ xfree(fpe);
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->refcount = 1;
+
+ strncpy(fpe->name, (char *) cp, (int) len);
+ fpe->name[len] = '\0';
+ fpe->name_length = len;
+ fpe->type = DetermineFPEType(fpe->name);
+ if (fpe->type == -1)
+ err = BadValue;
+ else
+ err = (*fpe_functions[fpe->type].init_fpe) (fpe);
+ if (err != Successful)
+ {
+ if (persist)
+ {
+ ErrorF("Could not init font path element %s, removing from list!\n",
+ fpe->name);
+ }
+ xfree (fpe->name);
+ xfree (fpe);
+ }
}
- err = (*fpe_functions[fpe->type].init_fpe) (fpe);
- if (err != Successful) {
- xfree(fpe->name);
- xfree(fpe);
- err = BadValue;
+ }
+ if (err != Successful)
+ {
+ if (!persist)
goto bail;
- }
+ }
+ else
+ {
fplist[valid_paths++] = fpe;
- } else {
- err = BadValue;
- goto bail;
}
+ cp += len;
}
FreeFontPath(font_path_elements, num_fpes, FALSE);
@@ -1739,10 +1831,10 @@ SetFontPathElements(npaths, paths, bad)
return Success;
bail:
*bad = i;
- while (--i >= 0)
- FreeFPE(fplist[i]);
+ while (--valid_paths >= 0)
+ FreeFPE(fplist[valid_paths]);
xfree(fplist);
- return err;
+ return FontToXError(err);
}
/* XXX -- do we need to pass error down to each renderer? */
@@ -1757,9 +1849,9 @@ SetFontPath(client, npaths, paths, error)
if (npaths == 0) {
if (SetDefaultFontPath(defaultFontPath) != Success)
- return BadName;
+ return BadValue;
} else {
- err = SetFontPathElements(npaths, paths, error);
+ err = SetFontPathElements(npaths, paths, error, FALSE);
}
return err;
}
@@ -1799,7 +1891,7 @@ SetDefaultFontPath(path)
}
*nump = (unsigned char) size;
- err = SetFontPathElements(num, newpath, &bad);
+ err = SetFontPathElements(num, newpath, &bad, TRUE);
DEALLOCATE_LOCAL(newpath);
@@ -1873,13 +1965,21 @@ InitFonts ()
{
patternCache = MakeFontPatternCache();
+#ifndef KDRIVESERVER
if (screenInfo.numScreens > screenInfo.numVideoScreens) {
PrinterFontRegisterFpeFunctions();
FontFileCheckRegisterFpeFunctions();
check_fs_register_fpe_functions();
- } else {
+ } else
+#endif
+ {
+#ifdef KDRIVESERVER
+ BuiltinRegisterFpeFunctions();
+#endif
FontFileRegisterFpeFunctions();
+#ifndef NOFONTSERVERACCESS
fs_register_fpe_functions();
+#endif
}
}
@@ -1931,26 +2031,21 @@ GetClientResolutions (num)
*/
int
-RegisterFPEFunctions(name_func, init_func, free_func, reset_func,
- open_func, close_func, list_func, start_lfwi_func, next_lfwi_func,
- wakeup_func, client_died, load_glyphs,
- start_list_alias_func, next_list_alias_func,
- set_path_func)
- Bool (*name_func) ();
- int (*init_func) ();
- int (*free_func) ();
- int (*reset_func) ();
- int (*open_func) ();
- int (*close_func) ();
- int (*list_func) ();
- int (*start_lfwi_func) ();
- int (*next_lfwi_func) ();
- int (*wakeup_func) ();
- int (*client_died) ();
- int (*load_glyphs) ();
- int (*start_list_alias_func) ();
- int (*next_list_alias_func) ();
- void (*set_path_func) ();
+RegisterFPEFunctions(NameCheckFunc name_func,
+ InitFpeFunc init_func,
+ FreeFpeFunc free_func,
+ ResetFpeFunc reset_func,
+ OpenFontFunc open_func,
+ CloseFontFunc close_func,
+ ListFontsFunc list_func,
+ StartLfwiFunc start_lfwi_func,
+ NextLfwiFunc next_lfwi_func,
+ WakeupFpeFunc wakeup_func,
+ ClientDiedFunc client_died,
+ LoadGlyphsFunc load_glyphs,
+ StartLaFunc start_list_alias_func,
+ NextLaFunc next_list_alias_func,
+ SetPathFunc set_path_func)
{
FPEFunctions *new;
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 3b16c6a13..7e9bfa4bf 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/dixutils.c,v 3.13 2003/01/12 02:44:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -94,7 +95,7 @@ Author: Adobe Systems Incorporated
#include "keysymdef.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
/*
@@ -326,7 +327,7 @@ AlterSaveSetForClient(client, pWin, mode)
unsigned mode;
{
int numnow;
- pointer *pTmp;
+ pointer *pTmp = NULL;
int j;
numnow = client->numSaved;
@@ -397,11 +398,7 @@ DeleteWindowFromAnySaveSet(pWin)
* procedure to call than to check if there's a procedure
*/
void
-NoopDDA(
-#if NeedVarargsPrototypes
- void* f, ...
-#endif
-)
+NoopDDA(void)
{
}
@@ -556,7 +553,7 @@ WorkQueuePtr workQueue;
static WorkQueuePtr *workQueueLast = &workQueue;
void
-ProcessWorkQueue()
+ProcessWorkQueue(void)
{
WorkQueuePtr q, *p;
@@ -567,7 +564,7 @@ ProcessWorkQueue()
* they will be called again. This must be reentrant with
* QueueWorkProc.
*/
- while (q = *p)
+ while ((q = *p))
{
if ((*q->function) (q->client, q->closure))
{
@@ -584,12 +581,12 @@ ProcessWorkQueue()
}
void
-ProcessWorkQueueZombies()
+ProcessWorkQueueZombies(void)
{
WorkQueuePtr q, *p;
p = &workQueue;
- while (q = *p)
+ while ((q = *p))
{
if (q->client && q->client->clientGone)
{
@@ -607,10 +604,22 @@ ProcessWorkQueueZombies()
}
Bool
+#if NeedFunctionPrototypes
+QueueWorkProc (
+ Bool (*function)(
+#if NeedNestedPrototypes
+ ClientPtr /* pClient */,
+ pointer /* closure */
+#endif
+ ),
+ ClientPtr client,
+ pointer closure)
+#else
QueueWorkProc (function, client, closure)
Bool (*function)();
ClientPtr client;
pointer closure;
+#endif
{
WorkQueuePtr q;
@@ -637,7 +646,7 @@ QueueWorkProc (function, client, closure)
typedef struct _SleepQueue {
struct _SleepQueue *next;
ClientPtr client;
- Bool (*function)();
+ ClientSleepProcPtr function;
pointer closure;
} SleepQueueRec, *SleepQueuePtr;
@@ -646,7 +655,7 @@ static SleepQueuePtr sleepQueue = NULL;
Bool
ClientSleep (client, function, closure)
ClientPtr client;
- Bool (*function)();
+ ClientSleepProcPtr function;
pointer closure;
{
SleepQueuePtr q;
@@ -692,7 +701,11 @@ ClientWakeup (client)
*prev = q->next;
xfree (q);
if (client->clientGone)
- CloseDownClient(client);
+ /* Oops -- new zombie cleanup code ensures this only
+ * happens from inside CloseDownClient; don't want to
+ * recurse here...
+ */
+ /* CloseDownClient(client) */;
else
AttendClient (client);
break;
@@ -723,10 +736,17 @@ static int numCallbackListsToCleanup = 0;
static CallbackListPtr **listsToCleanup = NULL;
static Bool
+#if NeedFunctionPrototypes
+_AddCallback(
+ CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ pointer data)
+#else
_AddCallback(pcbl, callback, data)
CallbackListPtr *pcbl;
CallbackProcPtr callback;
pointer data;
+#endif
{
CallbackPtr cbr;
@@ -742,14 +762,20 @@ _AddCallback(pcbl, callback, data)
}
static Bool
+#if NeedFunctionPrototypes
+_DeleteCallback(
+ CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ pointer data)
+#else
_DeleteCallback(pcbl, callback, data)
CallbackListPtr *pcbl;
CallbackProcPtr callback;
pointer data;
+#endif
{
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, pcbr;
- int i;
for (pcbr = NULL, cbr = cbl->list;
cbr != NULL;
@@ -779,9 +805,15 @@ _DeleteCallback(pcbl, callback, data)
}
static void
+#if NeedFunctionPrototypes
+_CallCallbacks(
+ CallbackListPtr *pcbl,
+ pointer call_data)
+#else
_CallCallbacks(pcbl, call_data)
CallbackListPtr *pcbl;
pointer call_data;
+#endif
{
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, pcbr;
@@ -836,8 +868,13 @@ _CallCallbacks(pcbl, call_data)
}
static void
+#if NeedFunctionPrototypes
+_DeleteCallbackList(
+ CallbackListPtr *pcbl)
+#else
_DeleteCallbackList(pcbl)
CallbackListPtr *pcbl;
+#endif
{
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, nextcbr;
@@ -851,7 +888,7 @@ _DeleteCallbackList(pcbl)
for (i = 0; i < numCallbackListsToCleanup; i++)
{
- if (listsToCleanup[i] = pcbl)
+ if ((listsToCleanup[i] = pcbl) != 0)
{
listsToCleanup[i] = NULL;
break;
diff --git a/dix/events.c b/dix/events.c
index afadfe6a3..ce8e53f92 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.46 2002/09/17 01:15:09 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -45,6 +46,27 @@ SOFTWARE.
********************************************************/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
/* $Xorg: events.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
@@ -60,19 +82,33 @@ SOFTWARE.
#include "cursorstr.h"
#include "dixstruct.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "globals.h"
#ifdef XKB
#include "XKBsrv.h"
+#if NeedFunctionPrototypes
+extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
+#else
+extern Bool XkbFilterEvents();
+#endif
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
-extern WindowPtr *WindowTable;
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
-extern void (* EventSwapVector[128]) ();
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "dispatch.h"
#define EXTENSION_EVENT_BASE 64
@@ -106,6 +142,9 @@ extern void (* EventSwapVector[128]) ();
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
+#define XE_KBPTR (xE->u.keyButtonPointer)
+
+
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
CallbackListPtr EventCallback;
@@ -148,13 +187,20 @@ static struct {
CursorPtr current;
BoxRec hotLimits; /* logical constraints of hot spot */
Bool confined; /* confined to screen */
-#ifdef SHAPE
+#if defined(SHAPE) || defined(PANORAMIX)
RegionPtr hotShape; /* additional logical shape constraint */
#endif
BoxRec physLimits; /* physical constraints of hot spot */
WindowPtr win; /* window of logical position */
HotSpot hot; /* logical pointer position */
HotSpot hotPhys; /* physical pointer position */
+#ifdef PANORAMIX
+ ScreenPtr screen; /* all others are in Screen 0 coordinates */
+ RegionRec Reg1; /* Region 1 for confining motion */
+ RegionRec Reg2; /* Region 2 for confining virtual motion */
+ WindowPtr windows[MAXSCREENS];
+ WindowPtr confineWin; /* confine window */
+#endif
} sprite; /* info about the cursor sprite */
static void DoEnterLeaveEvents(
@@ -172,27 +218,14 @@ static WindowPtr XYToWindow(
#endif
);
-void DeliverFocusedEvent();
-int DeliverDeviceEvents();
-void DoFocusEvents();
-Mask EventMaskForClient();
-Bool CheckDeviceGrabs();
-void EnqueueEvent();
+extern int lastEvent;
-extern GrabPtr CreateGrab(); /* Defined in grabs.c */
-extern Bool GrabMatchesSecond();
-extern Bool DeletePassiveGrabFromList();
-extern int AddPassiveGrabToList();
+static Mask lastEventMask;
-extern Bool permitOldBugs;
-extern Bool Must_have_memory;
-extern int lastEvent;
#ifdef XINPUT
-extern int DeviceMotionNotify, DeviceButtonPress, DeviceKeyPress;
+extern int DeviceMotionNotify;
#endif
-static Mask lastEventMask;
-
#define CantBeFiltered NoEventMask
static Mask filters[128] =
{
@@ -235,16 +268,331 @@ static Mask filters[128] =
static CARD8 criticalEvents[32] =
{
- 0x3c /* key and button events */
+ 0x7c /* key and button events */
};
-Mask
-GetNextEventMask()
+#ifdef PANORAMIX
+
+static void ConfineToShape(RegionPtr shape, int *px, int *py);
+static void SyntheticMotion(int x, int y);
+static void PostNewCursor(void);
+
+static Bool
+XineramaSetCursorPosition(
+ int x,
+ int y,
+ Bool generateEvent
+){
+ ScreenPtr pScreen;
+ BoxRec box;
+ int i;
+
+ /* x,y are in Screen 0 coordinates. We need to decide what Screen
+ to send the message too and what the coordinates relative to
+ that screen are. */
+
+ pScreen = sprite.screen;
+ x += panoramiXdataPtr[0].x;
+ y += panoramiXdataPtr[0].y;
+
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ x, y, &box))
+ {
+ FOR_NSCREENS(i)
+ {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box))
+ {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+
+ sprite.screen = pScreen;
+ sprite.hotPhys.x = x - panoramiXdataPtr[0].x;
+ sprite.hotPhys.y = y - panoramiXdataPtr[0].y;
+ x -= panoramiXdataPtr[pScreen->myNum].x;
+ y -= panoramiXdataPtr[pScreen->myNum].y;
+
+ return (*pScreen->SetCursorPosition)(pScreen, x, y, generateEvent);
+}
+
+
+static void
+XineramaConstrainCursor(void)
{
- lastEventMask <<= 1;
- return lastEventMask;
+ ScreenPtr pScreen = sprite.screen;
+ BoxRec newBox = sprite.physLimits;
+
+ /* Translate the constraining box to the screen
+ the sprite is actually on */
+ newBox.x1 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ newBox.x2 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
+ newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
+
+ (* pScreen->ConstrainCursor)(pScreen, &newBox);
}
+static void
+XineramaCheckPhysLimits(
+ CursorPtr cursor,
+ Bool generateEvents
+){
+ HotSpot new;
+
+ if (!cursor)
+ return;
+
+ new = sprite.hotPhys;
+
+ /* I don't care what the DDX has to say about it */
+ sprite.physLimits = sprite.hotLimits;
+
+ /* constrain the pointer to those limits */
+ if (new.x < sprite.physLimits.x1)
+ new.x = sprite.physLimits.x1;
+ else
+ if (new.x >= sprite.physLimits.x2)
+ new.x = sprite.physLimits.x2 - 1;
+ if (new.y < sprite.physLimits.y1)
+ new.y = sprite.physLimits.y1;
+ else
+ if (new.y >= sprite.physLimits.y2)
+ new.y = sprite.physLimits.y2 - 1;
+
+ if (sprite.hotShape) /* more work if the shape is a mess */
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
+
+ if((new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
+ {
+ XineramaSetCursorPosition (new.x, new.y, generateEvents);
+ if (!generateEvents)
+ SyntheticMotion(new.x, new.y);
+ }
+
+ /* Tell DDX what the limits are */
+ XineramaConstrainCursor();
+}
+
+
+static Bool
+XineramaSetWindowPntrs(WindowPtr pWin)
+{
+ if(pWin == WindowTable[0]) {
+ memcpy(sprite.windows, WindowTable,
+ PanoramiXNumScreens*sizeof(WindowPtr));
+ } else {
+ PanoramiXRes *win;
+ int i;
+
+ win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW);
+
+ if(!win)
+ return FALSE;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ sprite.windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW);
+ if(!sprite.windows[i]) /* window is being unmapped */
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static void
+XineramaCheckVirtualMotion(
+ QdEventPtr qe,
+ WindowPtr pWin
+){
+
+ if (qe)
+ {
+ sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */
+ sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
+ sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
+ pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
+ NullWindow;
+ }
+ if (pWin)
+ {
+ int x, y, off_x, off_y, i;
+ BoxRec lims;
+
+ if(!XineramaSetWindowPntrs(pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(sprite.screen, &sprite.Reg2,
+ &sprite.windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(sprite.screen, &sprite.Reg2, x, y);
+
+ REGION_UNION(sprite.screen, &sprite.Reg2, &sprite.Reg2,
+ &sprite.windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+
+ lims = *REGION_EXTENTS(sprite.screen, &sprite.Reg2);
+
+ if (sprite.hot.x < lims.x1)
+ sprite.hot.x = lims.x1;
+ else if (sprite.hot.x >= lims.x2)
+ sprite.hot.x = lims.x2 - 1;
+ if (sprite.hot.y < lims.y1)
+ sprite.hot.y = lims.y1;
+ else if (sprite.hot.y >= lims.y2)
+ sprite.hot.y = lims.y2 - 1;
+
+ if (REGION_NUM_RECTS(&sprite.Reg2) > 1)
+ ConfineToShape(&sprite.Reg2, &sprite.hot.x, &sprite.hot.y);
+
+ if (qe)
+ {
+ qe->pScreen = sprite.hot.pScreen;
+ qe->event->u.keyButtonPointer.rootX = sprite.hot.x;
+ qe->event->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ }
+}
+
+
+static Bool
+XineramaCheckMotion(xEvent *xE)
+{
+ WindowPtr prevSpriteWin = sprite.win;
+
+ if (xE && !syncEvents.playingEvents)
+ {
+ /* Motion events entering DIX get translated to Screen 0
+ coordinates. Replayed events have already been
+ translated since they've entered DIX before */
+ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x -
+ panoramiXdataPtr[0].x;
+ XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
+ panoramiXdataPtr[0].y;
+
+ sprite.hot.x = XE_KBPTR.rootX;
+ sprite.hot.y = XE_KBPTR.rootY;
+ if (sprite.hot.x < sprite.physLimits.x1)
+ sprite.hot.x = sprite.physLimits.x1;
+ else if (sprite.hot.x >= sprite.physLimits.x2)
+ sprite.hot.x = sprite.physLimits.x2 - 1;
+ if (sprite.hot.y < sprite.physLimits.y1)
+ sprite.hot.y = sprite.physLimits.y1;
+ else if (sprite.hot.y >= sprite.physLimits.y2)
+ sprite.hot.y = sprite.physLimits.y2 - 1;
+
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
+
+ sprite.hotPhys = sprite.hot;
+ if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ (sprite.hotPhys.y != XE_KBPTR.rootY))
+ {
+ XineramaSetCursorPosition(
+ sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
+ }
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
+ }
+
+ sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
+
+ if (sprite.win != prevSpriteWin)
+ {
+ if (prevSpriteWin != NullWindow) {
+ if (!xE)
+ UpdateCurrentTimeIf();
+ DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal);
+ }
+ PostNewCursor();
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+static void
+XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents)
+{
+
+ if (syncEvents.playingEvents)
+ {
+ XineramaCheckVirtualMotion((QdEventPtr)NULL, pWin);
+ SyntheticMotion(sprite.hot.x, sprite.hot.y);
+ }
+ else
+ {
+ int x, y, off_x, off_y, i;
+
+ if(!XineramaSetWindowPntrs(pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(sprite.screen, &sprite.Reg1,
+ &sprite.windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(sprite.screen, &sprite.Reg1, x, y);
+
+ REGION_UNION(sprite.screen, &sprite.Reg1, &sprite.Reg1,
+ &sprite.windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+
+ sprite.hotLimits = *REGION_EXTENTS(sprite.screen, &sprite.Reg1);
+
+ if(REGION_NUM_RECTS(&sprite.Reg1) > 1)
+ sprite.hotShape = &sprite.Reg1;
+ else
+ sprite.hotShape = NullRegion;
+
+ sprite.confined = FALSE;
+ sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
+
+ XineramaCheckPhysLimits(sprite.current, generateEvents);
+ }
+}
+
+
+static void
+XineramaChangeToCursor(CursorPtr cursor)
+{
+ if (cursor != sprite.current)
+ {
+ if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
+ (sprite.current->bits->yhot != cursor->bits->yhot))
+ XineramaCheckPhysLimits(cursor, FALSE);
+ (*sprite.screen->DisplayCursor)(sprite.screen, cursor);
+ sprite.current = cursor;
+ }
+}
+
+
+#endif /* PANORAMIX */
+
void
SetMaskForEvent(mask, event)
Mask mask;
@@ -265,11 +613,24 @@ SetCriticalEvent(event)
}
static void
+#if NeedFunctionPrototypes
+SyntheticMotion(int x, int y)
+#else
SyntheticMotion(x, y)
int x, y;
+#endif
{
xEvent xE;
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if(!noPanoramiXExtension) {
+ x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x;
+ y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
+ }
+#endif
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
if (syncEvents.playingEvents)
@@ -282,9 +643,13 @@ SyntheticMotion(x, y)
#ifdef SHAPE
static void
+#if NeedFunctionPrototypes
+ConfineToShape(RegionPtr shape, int *px, int *py)
+#else
ConfineToShape(shape, px, py)
RegionPtr shape;
int *px, *py;
+#endif
{
BoxRec box;
int x = *px, y = *py;
@@ -321,11 +686,19 @@ ConfineToShape(shape, px, py)
#endif
static void
+#if NeedFunctionPrototypes
+CheckPhysLimits(
+ CursorPtr cursor,
+ Bool generateEvents,
+ Bool confineToScreen,
+ ScreenPtr pScreen)
+#else
CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
CursorPtr cursor;
Bool generateEvents;
Bool confineToScreen;
ScreenPtr pScreen;
+#endif
{
HotSpot new;
@@ -352,7 +725,7 @@ CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
new.y = sprite.physLimits.y2 - 1;
#ifdef SHAPE
if (sprite.hotShape)
- ConfineToShape(sprite.hotShape, &new.x, &new.y);
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
#endif
if ((pScreen != sprite.hotPhys.pScreen) ||
(new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
@@ -366,11 +739,22 @@ CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
}
static void
+#if NeedFunctionPrototypes
+CheckVirtualMotion(
+ register QdEventPtr qe,
+ register WindowPtr pWin)
+#else
CheckVirtualMotion(qe, pWin)
register QdEventPtr qe;
register WindowPtr pWin;
+#endif
{
-
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaCheckVirtualMotion(qe, pWin);
+ return;
+ }
+#endif
if (qe)
{
sprite.hot.pScreen = qe->pScreen;
@@ -411,14 +795,18 @@ CheckVirtualMotion(qe, pWin)
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
-void
-ConfineCursorToWindow(pWin, generateEvents, confineToScreen)
- WindowPtr pWin;
- Bool generateEvents;
- Bool confineToScreen;
+static void
+ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaConfineCursorToWindow(pWin, generateEvents);
+ return;
+ }
+#endif
+
if (syncEvents.playingEvents)
{
CheckVirtualMotion((QdEventPtr)NULL, pWin);
@@ -443,14 +831,25 @@ PointerConfinedToScreen()
}
static void
+#if NeedFunctionPrototypes
+ChangeToCursor(CursorPtr cursor)
+#else
ChangeToCursor(cursor)
CursorPtr cursor;
+#endif
{
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaChangeToCursor(cursor);
+ return;
+ }
+#endif
+
if (cursor != sprite.current)
{
if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
(sprite.current->bits->yhot != cursor->bits->yhot))
- CheckPhysLimits(cursor, FALSE, PointerConfinedToScreen(),
+ CheckPhysLimits(cursor, FALSE, sprite.confined,
(ScreenPtr)NULL);
(*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
cursor);
@@ -469,7 +868,11 @@ IsParent(a, b)
}
static void
+#if NeedFunctionPrototypes
+PostNewCursor(void)
+#else
PostNewCursor()
+#endif
{
register WindowPtr win;
register GrabPtr grab = inputInfo.pointer->grab;
@@ -524,20 +927,36 @@ GetSpritePosition(px, py)
*py = sprite.hotPhys.y;
}
+#ifdef PANORAMIX
+int
+XineramaGetCursorScreen()
+{
+ if(!noPanoramiXExtension) {
+ return sprite.screen->myNum;
+ } else {
+ return 0;
+ }
+}
+#endif /* PANORAMIX */
+
#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
static void
+#if NeedFunctionPrototypes
+MonthChangedOrBadTime(register xEvent *xE)
+#else
MonthChangedOrBadTime(xE)
register xEvent *xE;
+#endif
{
/* If the ddx/OS is careless about not processing timestamped events from
* different sources in sorted order, then it's possible for time to go
* backwards when it should not. Here we ensure a decent time.
*/
- if ((currentTime.milliseconds - xE->u.keyButtonPointer.time) > TIMESLOP)
+ if ((currentTime.milliseconds - XE_KBPTR.time) > TIMESLOP)
currentTime.months++;
else
- xE->u.keyButtonPointer.time = currentTime.milliseconds;
+ XE_KBPTR.time = currentTime.milliseconds;
}
#define NoticeTime(xE) { \
@@ -582,7 +1001,7 @@ EnqueueEvent(xE, device, count)
* updated yet.
*/
if (xE->u.u.type == MotionNotify)
- xE->u.keyButtonPointer.root =
+ XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
@@ -590,8 +1009,16 @@ EnqueueEvent(xE, device, count)
}
if (xE->u.u.type == MotionNotify)
{
- sprite.hotPhys.x = xE->u.keyButtonPointer.rootX;
- sprite.hotPhys.y = xE->u.keyButtonPointer.rootY;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x -
+ panoramiXdataPtr[0].x;
+ XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
+ panoramiXdataPtr[0].y;
+ }
+#endif
+ sprite.hotPhys.x = XE_KBPTR.rootX;
+ sprite.hotPhys.y = XE_KBPTR.rootY;
/* do motion compression */
if (tail &&
(tail->event->u.u.type == MotionNotify) &&
@@ -599,7 +1026,7 @@ EnqueueEvent(xE, device, count)
{
tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x;
tail->event->u.keyButtonPointer.rootY = sprite.hotPhys.y;
- tail->event->u.keyButtonPointer.time = xE->u.keyButtonPointer.time;
+ tail->event->u.keyButtonPointer.time = XE_KBPTR.time;
tail->months = currentTime.months;
return;
}
@@ -621,7 +1048,11 @@ EnqueueEvent(xE, device, count)
}
static void
+#if NeedFunctionPrototypes
+PlayReleasedEvents(void)
+#else
PlayReleasedEvents()
+#endif
{
register QdEventPtr *prev, qe;
register DeviceIntPtr dev;
@@ -638,6 +1069,19 @@ PlayReleasedEvents()
CheckVirtualMotion(qe, NullWindow);
syncEvents.time.months = qe->months;
syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time;
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if(!noPanoramiXExtension) {
+ qe->event->u.keyButtonPointer.rootX +=
+ panoramiXdataPtr[0].x -
+ panoramiXdataPtr[sprite.screen->myNum].x;
+ qe->event->u.keyButtonPointer.rootY +=
+ panoramiXdataPtr[0].y -
+ panoramiXdataPtr[sprite.screen->myNum].y;
+ }
+#endif
(*qe->device->public.processInputProc)(qe->event, qe->device,
qe->evcount);
xfree(qe);
@@ -655,9 +1099,13 @@ PlayReleasedEvents()
}
static void
+#if NeedFunctionPrototypes
+FreezeThaw(register DeviceIntPtr dev, Bool frozen)
+#else
FreezeThaw(dev, frozen)
register DeviceIntPtr dev;
Bool frozen;
+#endif
{
dev->sync.frozen = frozen;
if (frozen)
@@ -687,19 +1135,22 @@ ComputeFreezes()
xE = replayDev->sync.event;
count = replayDev->sync.evcount;
syncEvents.replayDev = (DeviceIntPtr)NULL;
- w = XYToWindow(
- xE->u.keyButtonPointer.rootX, xE->u.keyButtonPointer.rootY);
+
+ w = XYToWindow( XE_KBPTR.rootX, XE_KBPTR.rootY);
for (i = 0; i < spriteTraceGood; i++)
+ {
if (syncEvents.replayWin == spriteTrace[i])
{
- if (!CheckDeviceGrabs(replayDev, xE, i+1, count))
+ if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) {
if (replayDev->focus)
DeliverFocusedEvent(replayDev, xE, w, count);
else
DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
- replayDev, count);
+ replayDev, count);
+ }
goto playmore;
}
+ }
/* must not still be in the same stack */
if (replayDev->focus)
DeliverFocusedEvent(replayDev, xE, w, count);
@@ -729,6 +1180,24 @@ playmore:
PostNewCursor();
}
+#ifdef RANDR
+void
+ScreenRestructured (ScreenPtr pScreen)
+{
+ GrabPtr grab;
+
+ if ((grab = inputInfo.pointer->grab) && grab->confineTo)
+ {
+ if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen)
+ sprite.hotPhys.x = sprite.hotPhys.y = 0;
+ ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
+ }
+ else
+ ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum],
+ TRUE, FALSE);
+}
+#endif
+
void
CheckGrabForSyncs(thisDev, thisMode, otherMode)
register DeviceIntPtr thisDev;
@@ -793,8 +1262,7 @@ ActivatePointerGrab(mouse, grab, time, autoGrab)
mouse->grab = &mouse->activeGrab;
mouse->fromPassiveGrab = autoGrab;
PostNewCursor();
- CheckGrabForSyncs(mouse,
- (Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+ CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
}
void
@@ -849,8 +1317,7 @@ ActivateKeyboardGrab(keybd, grab, time, passive)
keybd->activeGrab = *grab;
keybd->grab = &keybd->activeGrab;
keybd->fromPassiveGrab = passive;
- CheckGrabForSyncs(keybd,
- (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
+ CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
}
void
@@ -1092,6 +1559,7 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
{
#ifdef DEBUG
if (debug_events) ErrorF("\n");
+ fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
#endif
return 1; /* don't send, but pretend we did */
}
@@ -1106,7 +1574,8 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
else
{
if ((type == DeviceMotionNotify) &&
- MaybeSendDeviceMotionNotifyHint (pEvents, mask) != 0)
+ MaybeSendDeviceMotionNotifyHint
+ ((deviceKeyButtonPointer*)pEvents, mask) != 0)
return 1;
}
#endif
@@ -1119,7 +1588,13 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
}
if (BitIsOn(criticalEvents, type))
+ {
+#ifdef SMART_SCHEDULE
+ if (client->smart_priority < SMART_MAX_PRIORITY)
+ client->smart_priority++;
+#endif
SetCriticalOutputPending();
+ }
WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG
@@ -1149,7 +1624,7 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
int attempt;
register InputClients *other;
ClientPtr client = NullClient;
- Mask deliveryMask; /* If a grab occurs due to a button press, then
+ Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
this mask is the mask of the grab. */
int type = pEvents->u.u.type;
@@ -1224,8 +1699,9 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
{
if (((type == DeviceMotionNotify) || (type == DeviceButtonPress)) &&
deliveries)
- CheckDeviceGrabAndHintWindow (pWin, type, pEvents, grab, client,
- deliveryMask);
+ CheckDeviceGrabAndHintWindow (pWin, type,
+ (deviceKeyButtonPointer*) pEvents,
+ grab, client, deliveryMask);
}
#endif
if (deliveries)
@@ -1238,6 +1714,24 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
Only works for core events.
*/
+#ifdef PANORAMIX
+static int
+XineramaTryClientEventsResult(
+ ClientPtr client,
+ GrabPtr grab,
+ Mask mask,
+ Mask filter
+){
+ if ((client) && (client != serverClient) && (!client->clientGone) &&
+ ((filter == CantBeFiltered) || (mask & filter)))
+ {
+ if (grab && !SameClient(grab, client)) return -1;
+ else return 1;
+ }
+ return 0;
+}
+#endif
+
int
MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
register WindowPtr pWin;
@@ -1248,10 +1742,16 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
{
register OtherClients *other;
+
if (pWin->eventMask & filter)
{
if (wClient(pWin) == dontClient)
return 0;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(
+ wClient(pWin), NullGrab, pWin->eventMask, filter);
+#endif
return TryClientEvents(wClient(pWin), pEvents, count,
pWin->eventMask, filter, NullGrab);
}
@@ -1261,6 +1761,11 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
{
if (SameClient(other, dontClient))
return 0;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(
+ rClient(other), NullGrab, other->mask, filter);
+#endif
return TryClientEvents(rClient(other), pEvents, count,
other->mask, filter, NullGrab);
}
@@ -1269,16 +1774,23 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
}
static void
+#if NeedFunctionPrototypes
+FixUpEventFromWindow(
+ xEvent *xE,
+ WindowPtr pWin,
+ Window child,
+ Bool calcChild)
+#else
FixUpEventFromWindow(xE, pWin, child, calcChild)
xEvent *xE;
WindowPtr pWin;
Window child;
Bool calcChild;
+#endif
{
if (calcChild)
{
WindowPtr w=spriteTrace[spriteTraceGood-1];
-
/* If the search ends up past the root should the child field be
set to none or should the value in the argument be passed
through. It probably doesn't matter since everyone calls
@@ -1303,23 +1815,23 @@ FixUpEventFromWindow(xE, pWin, child, calcChild)
w = w->parent;
}
}
- xE->u.keyButtonPointer.root = ROOT->drawable.id;
- xE->u.keyButtonPointer.event = pWin->drawable.id;
+ XE_KBPTR.root = ROOT->drawable.id;
+ XE_KBPTR.event = pWin->drawable.id;
if (sprite.hot.pScreen == pWin->drawable.pScreen)
{
- xE->u.keyButtonPointer.sameScreen = xTrue;
- xE->u.keyButtonPointer.child = child;
- xE->u.keyButtonPointer.eventX =
- xE->u.keyButtonPointer.rootX - pWin->drawable.x;
- xE->u.keyButtonPointer.eventY =
- xE->u.keyButtonPointer.rootY - pWin->drawable.y;
+ XE_KBPTR.sameScreen = xTrue;
+ XE_KBPTR.child = child;
+ XE_KBPTR.eventX =
+ XE_KBPTR.rootX - pWin->drawable.x;
+ XE_KBPTR.eventY =
+ XE_KBPTR.rootY - pWin->drawable.y;
}
else
{
- xE->u.keyButtonPointer.sameScreen = xFalse;
- xE->u.keyButtonPointer.child = None;
- xE->u.keyButtonPointer.eventX = 0;
- xE->u.keyButtonPointer.eventY = 0;
+ XE_KBPTR.sameScreen = xFalse;
+ XE_KBPTR.child = None;
+ XE_KBPTR.eventX = 0;
+ XE_KBPTR.eventY = 0;
}
}
@@ -1400,6 +1912,11 @@ DeliverEvents(pWin, xE, count, otherParent)
Mask filter;
int deliveries;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return count;
+#endif
+
if (!count)
return 0;
filter = filters[xE->u.u.type];
@@ -1426,14 +1943,41 @@ DeliverEvents(pWin, xE, count, otherParent)
return deliveries;
}
+
+static Bool
+PointInBorderSize(WindowPtr pWin, int x, int y)
+{
+ BoxRec box;
+
+ if(POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box))
+ return TRUE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) {
+ int i;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ if(POINT_IN_REGION(sprite.screen,
+ &sprite.windows[i]->borderSize,
+ x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x,
+ y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y,
+ &box))
+ return TRUE;
+ }
+ }
+#endif
+ return FALSE;
+}
+
static WindowPtr
+#if NeedFunctionPrototypes
+XYToWindow(int x, int y)
+#else
XYToWindow(x, y)
int x, y;
+#endif
{
register WindowPtr pWin;
-#ifdef SHAPE
- BoxRec box;
-#endif
spriteTraceGood = 1; /* root window still there */
pWin = ROOT->firstChild;
@@ -1451,9 +1995,7 @@ XYToWindow(x, y)
* is made to see if the point is inside
* borderSize
*/
- && (!wBoundingShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- &pWin->borderSize, x, y, &box))
+ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
#endif
)
{
@@ -1475,11 +2017,20 @@ XYToWindow(x, y)
}
static Bool
+#if NeedFunctionPrototypes
+CheckMotion(xEvent *xE)
+#else
CheckMotion(xE)
xEvent *xE;
+#endif
{
WindowPtr prevSpriteWin = sprite.win;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ return XineramaCheckMotion(xE);
+#endif
+
if (xE && !syncEvents.playingEvents)
{
if (sprite.hot.pScreen != sprite.hotPhys.pScreen)
@@ -1487,8 +2038,8 @@ CheckMotion(xE)
sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
- sprite.hot.x = xE->u.keyButtonPointer.rootX;
- sprite.hot.y = xE->u.keyButtonPointer.rootY;
+ sprite.hot.x = XE_KBPTR.rootX;
+ sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
@@ -1502,13 +2053,15 @@ CheckMotion(xE)
ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
#endif
sprite.hotPhys = sprite.hot;
- if ((sprite.hotPhys.x != xE->u.keyButtonPointer.rootX) ||
- (sprite.hotPhys.y != xE->u.keyButtonPointer.rootY))
+ if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ (sprite.hotPhys.y != XE_KBPTR.rootY))
+ {
(*sprite.hotPhys.pScreen->SetCursorPosition)(
sprite.hotPhys.pScreen,
sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
}
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
@@ -1561,6 +2114,21 @@ DefineInitialRootWindow(win)
(*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits);
(*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE);
(*pScreen->DisplayCursor) (pScreen, sprite.current);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ sprite.hotLimits.x1 = -panoramiXdataPtr[0].x;
+ sprite.hotLimits.y1 = -panoramiXdataPtr[0].y;
+ sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
+ sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
+ sprite.physLimits = sprite.hotLimits;
+ sprite.confineWin = NullWindow;
+ sprite.screen = pScreen;
+ /* gotta UNINIT these someplace */
+ REGION_INIT(pScreen, &sprite.Reg1, NullBox, 1);
+ REGION_INIT(pScreen, &sprite.Reg2, NullBox, 1);
+ }
+#endif
}
/*
@@ -1585,10 +2153,144 @@ NewCurrentScreen(newScreen, x, y)
{
sprite.hotPhys.x = x;
sprite.hotPhys.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ sprite.hotPhys.x += panoramiXdataPtr[newScreen->myNum].x -
+ panoramiXdataPtr[0].x;
+ sprite.hotPhys.y += panoramiXdataPtr[newScreen->myNum].y -
+ panoramiXdataPtr[0].y;
+ if (newScreen != sprite.screen) {
+ sprite.screen = newScreen;
+ /* Make sure we tell the DDX to update its copy of the screen */
+ if(sprite.confineWin)
+ XineramaConfineCursorToWindow(sprite.confineWin, TRUE);
+ else
+ XineramaConfineCursorToWindow(WindowTable[0], TRUE);
+ /* if the pointer wasn't confined, the DDX won't get
+ told of the pointer warp so we reposition it here */
+ if(!syncEvents.playingEvents)
+ (*sprite.screen->SetCursorPosition)(sprite.screen,
+ sprite.hotPhys.x + panoramiXdataPtr[0].x -
+ panoramiXdataPtr[sprite.screen->myNum].x,
+ sprite.hotPhys.y + panoramiXdataPtr[0].y -
+ panoramiXdataPtr[sprite.screen->myNum].y, FALSE);
+ }
+ } else
+#endif
if (newScreen != sprite.hotPhys.pScreen)
ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE);
}
+#ifdef PANORAMIX
+
+static Bool
+XineramaPointInWindowIsVisible(
+ WindowPtr pWin,
+ int x,
+ int y
+)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ BoxRec box;
+ int i, xoff, yoff;
+
+ if (!pWin->realized) return FALSE;
+
+ if (POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
+ return TRUE;
+
+ if(!XineramaSetWindowPntrs(pWin)) return FALSE;
+
+ xoff = x + panoramiXdataPtr[0].x;
+ yoff = y + panoramiXdataPtr[0].y;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ pWin = sprite.windows[i];
+ pScreen = pWin->drawable.pScreen;
+ x = xoff - panoramiXdataPtr[i].x;
+ y = yoff - panoramiXdataPtr[i].y;
+
+ if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
+ return TRUE;
+
+ }
+
+ return FALSE;
+}
+
+static int
+XineramaWarpPointer(ClientPtr client)
+{
+ WindowPtr dest = NULL;
+ int x, y;
+
+ REQUEST(xWarpPointerReq);
+
+
+ if (stuff->dstWid != None)
+ {
+ dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
+ if (!dest)
+ return BadWindow;
+ }
+ x = sprite.hotPhys.x;
+ y = sprite.hotPhys.y;
+
+ if (stuff->srcWid != None)
+ {
+ int winX, winY;
+ XID winID = stuff->srcWid;
+ WindowPtr source;
+
+ source = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!source) return BadWindow;
+
+ winX = source->drawable.x;
+ winY = source->drawable.y;
+ if(source == WindowTable[0]) {
+ winX -= panoramiXdataPtr[0].x;
+ winY -= panoramiXdataPtr[0].y;
+ }
+ if (x < winX + stuff->srcX ||
+ y < winY + stuff->srcY ||
+ (stuff->srcWidth != 0 &&
+ winX + stuff->srcX + (int)stuff->srcWidth < x) ||
+ (stuff->srcHeight != 0 &&
+ winY + stuff->srcY + (int)stuff->srcHeight < y) ||
+ !XineramaPointInWindowIsVisible(source, x, y))
+ return Success;
+ }
+ if (dest) {
+ x = dest->drawable.x;
+ y = dest->drawable.y;
+ if(dest == WindowTable[0]) {
+ x -= panoramiXdataPtr[0].x;
+ y -= panoramiXdataPtr[0].y;
+ }
+ }
+
+ x += stuff->dstX;
+ y += stuff->dstY;
+
+ if (x < sprite.physLimits.x1)
+ x = sprite.physLimits.x1;
+ else if (x >= sprite.physLimits.x2)
+ x = sprite.physLimits.x2 - 1;
+ if (y < sprite.physLimits.y1)
+ y = sprite.physLimits.y1;
+ else if (y >= sprite.physLimits.y2)
+ y = sprite.physLimits.y2 - 1;
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &x, &y);
+
+ XineramaSetCursorPosition(x, y, TRUE);
+
+ return Success;
+}
+
+#endif
+
+
int
ProcWarpPointer(client)
ClientPtr client;
@@ -1600,6 +2302,12 @@ ProcWarpPointer(client)
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ return XineramaWarpPointer(client);
+#endif
+
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
@@ -1608,13 +2316,16 @@ ProcWarpPointer(client)
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
+
if (stuff->srcWid != None)
{
int winX, winY;
- WindowPtr source = SecurityLookupWindow(stuff->srcWid, client,
- SecurityReadAccess);
- if (!source)
- return BadWindow;
+ XID winID = stuff->srcWid;
+ WindowPtr source;
+
+ source = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!source) return BadWindow;
+
winX = source->drawable.x;
winY = source->drawable.y;
if (source->drawable.pScreen != sprite.hotPhys.pScreen ||
@@ -1627,16 +2338,17 @@ ProcWarpPointer(client)
!PointInWindowIsVisible(source, x, y))
return Success;
}
- if (dest)
+ if (dest)
{
x = dest->drawable.x;
y = dest->drawable.y;
newScreen = dest->drawable.pScreen;
- }
- else
+ } else
newScreen = sprite.hotPhys.pScreen;
+
x += stuff->dstX;
y += stuff->dstY;
+
if (x < 0)
x = 0;
else if (x >= newScreen->width)
@@ -1656,7 +2368,7 @@ ProcWarpPointer(client)
y = sprite.physLimits.y1;
else if (y >= sprite.physLimits.y2)
y = sprite.physLimits.y2 - 1;
-#ifdef SHAPE
+#if defined(SHAPE)
if (sprite.hotShape)
ConfineToShape(sprite.hotShape, &x, &y);
#endif
@@ -1669,15 +2381,42 @@ ProcWarpPointer(client)
return Success;
}
+static Bool
+BorderSizeNotEmpty(WindowPtr pWin)
+{
+ if(REGION_NOTEMPTY(sprite.hotPhys.pScreen, &pWin->borderSize))
+ return TRUE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) {
+ int i;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ if(REGION_NOTEMPTY(sprite.screen, &sprite.windows[i]->borderSize))
+ return TRUE;
+ }
+ }
+#endif
+ return FALSE;
+}
+
/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
passive grab set on the window to be activated. */
static Bool
+#if NeedFunctionPrototypes
+CheckPassiveGrabsOnWindow(
+ WindowPtr pWin,
+ register DeviceIntPtr device,
+ register xEvent *xE,
+ int count)
+#else
CheckPassiveGrabsOnWindow(pWin, device, xE, count)
WindowPtr pWin;
register DeviceIntPtr device;
register xEvent *xE;
int count;
+#endif
{
register GrabPtr grab = wPassiveGrabs(pWin);
GrabRec tempGrab;
@@ -1722,9 +2461,8 @@ CheckPassiveGrabsOnWindow(pWin, device, xE, count)
#endif
if (GrabMatchesSecond(&tempGrab, grab) &&
(!grab->confineTo ||
- (grab->confineTo->realized &&
- REGION_NOTEMPTY( grab->confineTo->drawable.pScreen,
- &grab->confineTo->borderSize))))
+ (grab->confineTo->realized &&
+ BorderSizeNotEmpty(grab->confineTo))))
{
#ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE))
@@ -1732,8 +2470,8 @@ CheckPassiveGrabsOnWindow(pWin, device, xE, count)
#endif
#ifdef XKB
if (!noXkbExtension) {
- xE->u.keyButtonPointer.state &= 0x1f00;
- xE->u.keyButtonPointer.state |=
+ XE_KBPTR.state &= 0x1f00;
+ XE_KBPTR.state |=
tempGrab.modifiersDetail.exact&(~0x1f00);
}
#endif
@@ -1787,7 +2525,7 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
int count;
{
register int i;
- register WindowPtr pWin;
+ register WindowPtr pWin = NULL;
register FocusClassPtr focus = device->focus;
if ((xE->u.u.type == ButtonPress
@@ -1814,7 +2552,7 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
((i > checkFirst) && (pWin != spriteTrace[i-1])))
return FALSE;
}
-
+
for (; i < spriteTraceGood; i++)
{
pWin = spriteTrace[i];
@@ -1973,10 +2711,9 @@ ProcessKeyboardEvent (xE, keybd, count)
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
}
- xE->u.keyButtonPointer.state = (keyc->state |
- inputInfo.pointer->button->state);
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
@@ -2053,6 +2790,44 @@ ProcessKeyboardEvent (xE, keybd, count)
(*keybd->DeactivateGrab)(keybd);
}
+#ifdef XKB
+/* This function is used to set the key pressed or key released state -
+ this is only used when the pressing of keys does not cause
+ CoreProcessKeyEvent to be called, as in for example Mouse Keys.
+*/
+void
+FixKeyState (xE, keybd)
+ register xEvent *xE;
+ register DeviceIntPtr keybd;
+{
+ int key, bit;
+ register BYTE *kptr;
+ register KeyClassPtr keyc = keybd->key;
+
+ key = xE->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+#ifdef DEBUG
+ if ((xkbDebugFlags&0x4)&&
+ ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
+ ErrorF("FixKeyState: Key %d %s\n",key,
+ (xE->u.u.type==KeyPress?"down":"up"));
+ }
+#endif
+ switch (xE->u.u.type)
+ {
+ case KeyPress:
+ *kptr |= bit;
+ break;
+ case KeyRelease:
+ *kptr &= ~bit;
+ break;
+ default:
+ FatalError("Impossible keyboard event");
+ }
+}
+#endif
+
void
#ifdef XKB
CoreProcessPointerEvent (xE, mouse, count)
@@ -2072,7 +2847,7 @@ ProcessPointerEvent (xE, mouse, count)
if (!syncEvents.playingEvents)
NoticeTime(xE)
- xE->u.keyButtonPointer.state = (butc->state | (
+ XE_KBPTR.state = (butc->state | (
#ifdef XKB
(noXkbExtension ?
inputInfo.keyboard->key->state :
@@ -2088,7 +2863,7 @@ ProcessPointerEvent (xE, mouse, count)
DeviceEventInfoRec eventinfo;
/* see comment in EnqueueEvents regarding the next three lines */
if (xE->u.u.type == MotionNotify)
- xE->u.keyButtonPointer.root =
+ XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
@@ -2101,8 +2876,9 @@ ProcessPointerEvent (xE, mouse, count)
register BYTE *kptr;
int bit;
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
+
key = xE->u.u.detail;
kptr = &butc->down[key >> 3];
bit = 1 << (key & 7);
@@ -2110,10 +2886,13 @@ ProcessPointerEvent (xE, mouse, count)
{
case ButtonPress:
mouse->valuator->motionHintWindow = NullWindow;
- butc->buttonsDown++;
+ if (!(*kptr & bit))
+ butc->buttonsDown++;
butc->motionMask = ButtonMotionMask;
*kptr |= bit;
+#if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key];
+#endif
if (xE->u.u.detail == 0)
return;
if (xE->u.u.detail <= 5)
@@ -2125,10 +2904,14 @@ ProcessPointerEvent (xE, mouse, count)
break;
case ButtonRelease:
mouse->valuator->motionHintWindow = NullWindow;
- if (!--butc->buttonsDown)
+ if (*kptr & bit)
+ --butc->buttonsDown;
+ if (!butc->buttonsDown)
butc->motionMask = 0;
*kptr &= ~bit;
+#if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key];
+#endif
if (xE->u.u.detail == 0)
return;
if (xE->u.u.detail <= 5)
@@ -2256,7 +3039,7 @@ EventSelectForWindow(pWin, client, mask)
if (wClient (pWin) == client)
{
check = pWin->eventMask;
-#if SGIMISC
+#ifdef SGIMISC
pWin->eventMask =
(mask & ~SGIMiscSpecialDestroyMask) | (pWin->eventMask & SGIMiscSpecialDestroyMask);
#else
@@ -2270,7 +3053,7 @@ EventSelectForWindow(pWin, client, mask)
if (SameClient(others, client))
{
check = others->mask;
-#if SGIMISC
+#ifdef SGIMISC
mask = (mask & ~SGIMiscSpecialDestroyMask) | (others->mask & SGIMiscSpecialDestroyMask);
#endif
if (mask == 0)
@@ -2367,8 +3150,14 @@ EventSuppressForWindow(pWin, client, mask, checkOptional)
}
static WindowPtr
+#if NeedFunctionPrototypes
+CommonAncestor(
+ register WindowPtr a,
+ register WindowPtr b)
+#else
CommonAncestor(a, b)
register WindowPtr a, b;
+#endif
{
for (b = b->parent; b; b = b->parent)
if (IsParent(b, a)) return b;
@@ -2376,10 +3165,19 @@ CommonAncestor(a, b)
}
static void
+#if NeedFunctionPrototypes
+EnterLeaveEvent(
+ int type,
+ int mode,
+ int detail,
+ register WindowPtr pWin,
+ Window child)
+#else
EnterLeaveEvent(type, mode, detail, pWin, child)
int type, mode, detail;
register WindowPtr pWin;
Window child;
+#endif
{
xEvent event;
register DeviceIntPtr keybd = inputInfo.keyboard;
@@ -2460,9 +3258,13 @@ EnterLeaveEvent(type, mode, detail, pWin, child)
}
static void
+#if NeedFunctionPrototypes
+EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
+#else
EnterNotifies(ancestor, child, mode, detail)
WindowPtr ancestor, child;
int mode, detail;
+#endif
{
WindowPtr parent = child->parent;
@@ -2473,9 +3275,13 @@ EnterNotifies(ancestor, child, mode, detail)
}
static void
+#if NeedFunctionPrototypes
+LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
+#else
LeaveNotifies(child, ancestor, mode, detail)
WindowPtr child, ancestor;
int detail, mode;
+#endif
{
register WindowPtr pWin;
@@ -2489,9 +3295,13 @@ LeaveNotifies(child, ancestor, mode, detail)
}
static void
+#if NeedFunctionPrototypes
+DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
+#else
DoEnterLeaveEvents(fromWin, toWin, mode)
WindowPtr fromWin, toWin;
int mode;
+#endif
{
if (fromWin == toWin)
return;
@@ -2519,10 +3329,14 @@ DoEnterLeaveEvents(fromWin, toWin, mode)
}
static void
+#if NeedFunctionPrototypes
+FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin)
+#else
FocusEvent(dev, type, mode, detail, pWin)
DeviceIntPtr dev;
int type, mode, detail;
register WindowPtr pWin;
+#endif
{
xEvent event;
@@ -2563,11 +3377,19 @@ FocusEvent(dev, type, mode, detail, pWin)
* no-op if child not descended from ancestor
*/
static Bool
+#if NeedFunctionPrototypes
+FocusInEvents(
+ DeviceIntPtr dev,
+ WindowPtr ancestor, WindowPtr child, WindowPtr skipChild,
+ int mode, int detail,
+ Bool doAncestor)
+#else
FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor)
DeviceIntPtr dev;
WindowPtr ancestor, child, skipChild;
int mode, detail;
Bool doAncestor;
+#endif
{
if (child == NullWindow)
return ancestor == NullWindow;
@@ -2589,12 +3411,20 @@ FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor)
/* dies horribly if ancestor is not an ancestor of child */
static void
+#if NeedFunctionPrototypes
+FocusOutEvents(
+ DeviceIntPtr dev,
+ WindowPtr child, WindowPtr ancestor,
+ int mode, int detail,
+ Bool doAncestor)
+#else
FocusOutEvents(dev, child, ancestor, mode, detail, doAncestor)
DeviceIntPtr dev;
WindowPtr child, ancestor;
int mode;
int detail;
Bool doAncestor;
+#endif
{
register WindowPtr pWin;
@@ -2628,8 +3458,13 @@ DoFocusEvents(dev, fromWin, toWin, mode)
FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer,
TRUE);
/* Notify all the roots */
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[0]);
+ else
+#endif
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
}
else
{
@@ -2642,8 +3477,13 @@ DoFocusEvents(dev, fromWin, toWin, mode)
NotifyNonlinearVirtual, FALSE);
}
/* Notify all the roots */
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[0]);
+ else
+#endif
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
if (toWin == PointerRootWin)
(void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode,
NotifyPointer, TRUE);
@@ -2655,8 +3495,13 @@ DoFocusEvents(dev, fromWin, toWin, mode)
if (fromWin == PointerRootWin)
FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer,
TRUE);
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[0]);
+ else
+#endif
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
if (toWin->parent != NullWindow)
(void)FocusInEvents(dev, ROOT, toWin, toWin, mode,
NotifyNonlinearVirtual, TRUE);
@@ -2719,6 +3564,15 @@ DoFocusEvents(dev, fromWin, toWin, mode)
}
int
+#if NeedFunctionPrototypes
+SetInputFocus(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ Window focusID,
+ CARD8 revertTo,
+ Time ctime,
+ Bool followOK)
+#else
SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
ClientPtr client;
DeviceIntPtr dev;
@@ -2726,6 +3580,7 @@ SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
CARD8 revertTo;
Time ctime;
Bool followOK;
+#endif
{
register FocusClassPtr focus;
register WindowPtr focusWin;
@@ -2743,7 +3598,7 @@ SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
}
time = ClientTimeToServerTime(ctime);
if ((focusID == None) || (focusID == PointerRoot))
- focusWin = (WindowPtr)focusID;
+ focusWin = (WindowPtr)(long)focusID;
else if ((focusID == FollowKeyboard) && followOK)
focusWin = inputInfo.keyboard->focus->win;
else if (!(focusWin = SecurityLookupWindow(focusID, client,
@@ -2816,7 +3671,7 @@ ProcGetInputFocus(client)
ClientPtr client;
{
xGetInputFocusReply rep;
- REQUEST(xReq);
+ /* REQUEST(xReq); */
FocusClassPtr focus = inputInfo.keyboard->focus;
REQUEST_SIZE_MATCH(xReq);
@@ -2874,7 +3729,7 @@ ProcGrabPointer(client)
return BadWindow;
if (stuff->confineTo == None)
confineTo = NullWindow;
- else
+ else
{
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
@@ -2902,10 +3757,8 @@ ProcGrabPointer(client)
if ((grab) && !SameClient(grab, client))
rep.status = AlreadyGrabbed;
else if ((!pWin->realized) ||
- (confineTo &&
- !(confineTo->realized &&
- REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))))
+ (confineTo &&
+ !(confineTo->realized && BorderSizeNotEmpty(confineTo))))
rep.status = GrabNotViewable;
else if (device->sync.frozen &&
device->sync.other && !SameClient(device->sync.other, client))
@@ -3165,6 +4018,18 @@ ProcQueryPointer(client)
rep.winX = 0;
rep.winY = 0;
}
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ rep.rootX += panoramiXdataPtr[0].x;
+ rep.rootY += panoramiXdataPtr[0].y;
+ if(stuff->id == rep.root) {
+ rep.winX += panoramiXdataPtr[0].x;
+ rep.winY += panoramiXdataPtr[0].y;
+ }
+ }
+#endif
+
WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep);
return(Success);
@@ -3220,6 +4085,14 @@ InitEvents()
}
}
+void
+CloseDownEvents(void)
+{
+ xfree(spriteTrace);
+ spriteTrace = NULL;
+ spriteTraceSize = 0;
+}
+
int
ProcSendEvent(client)
ClientPtr client;
@@ -3322,6 +4195,7 @@ ProcUngrabKey(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
+
if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
(stuff->key < keybd->key->curKeySyms.minKeyCode))
&& (stuff->key != AnyKey))
@@ -3335,7 +4209,6 @@ ProcUngrabKey(client)
client->errorValue = stuff->modifiers;
return BadValue;
}
-
tempGrab.resource = client->clientAsMask;
tempGrab.device = keybd;
tempGrab.window = pWin;
@@ -3398,12 +4271,14 @@ ProcGrabKey(client)
grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
(Bool)stuff->keyboardMode, (Bool)stuff->pointerMode,
- keybd, stuff->modifiers, KeyPress, stuff->key, NullWindow, NullCursor);
+ keybd, stuff->modifiers, KeyPress, stuff->key,
+ NullWindow, NullCursor);
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
}
+
int
ProcGrabButton(client)
ClientPtr client;
@@ -3446,9 +4321,8 @@ ProcGrabButton(client)
if (!pWin)
return BadWindow;
if (stuff->confineTo == None)
- confineTo = NullWindow;
- else
- {
+ confineTo = NullWindow;
+ else {
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
if (!confineTo)
@@ -3467,8 +4341,9 @@ ProcGrabButton(client)
}
}
+
grab = CreateGrab(client->index, inputInfo.pointer, pWin,
- permitOldBugs ? (Mask)(stuff->eventMask |
+ permitOldBugs ? (Mask)(stuff->eventMask |
ButtonPressMask | ButtonReleaseMask) :
(Mask)stuff->eventMask,
(Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode,
@@ -3497,7 +4372,6 @@ ProcUngrabButton(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
-
tempGrab.resource = client->clientAsMask;
tempGrab.device = inputInfo.pointer;
tempGrab.window = pWin;
@@ -3613,10 +4487,13 @@ CheckCursorConfinement(pWin)
GrabPtr grab = inputInfo.pointer->grab;
WindowPtr confineTo;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return;
+#endif
+
if (grab && (confineTo = grab->confineTo))
{
- if (!REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))
+ if (!BorderSizeNotEmpty(confineTo))
(*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer);
else if ((pWin == confineTo) || IsParent(pWin, confineTo))
ConfineCursorToWindow(confineTo, TRUE, TRUE);
@@ -3647,6 +4524,7 @@ ProcRecolorCursor(client)
CursorPtr pCursor;
int nscr;
ScreenPtr pscr;
+ Bool displayed;
REQUEST(xRecolorCursorReq);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
@@ -3669,9 +4547,14 @@ ProcRecolorCursor(client)
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
{
pscr = screenInfo.screens[nscr];
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ displayed = (pscr == sprite.screen);
+ else
+#endif
+ displayed = (pscr == sprite.hotPhys.pScreen);
( *pscr->RecolorCursor)(pscr, pCursor,
- (pCursor == sprite.current) &&
- (pscr == sprite.hotPhys.pScreen));
+ (pCursor == sprite.current) && displayed);
}
return (Success);
}
@@ -3682,6 +4565,9 @@ WriteEventsToClient(pClient, count, events)
int count;
xEvent *events;
{
+#ifdef PANORAMIX
+ xEvent eventCopy;
+#endif
xEvent eventTo, *eventFrom;
int i;
@@ -3690,6 +4576,40 @@ WriteEventsToClient(pClient, count, events)
return;
#endif
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension &&
+ (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y))
+ {
+ switch(events->u.u.type) {
+ case MotionNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ case KeyPress:
+ case KeyRelease:
+ case EnterNotify:
+ case LeaveNotify:
+ /*
+ When multiple clients want the same event DeliverEventsToWindow
+ passes the same event structure multiple times so we can't
+ modify the one passed to us
+ */
+ count = 1; /* should always be 1 */
+ memcpy(&eventCopy, events, sizeof(xEvent));
+ eventCopy.u.keyButtonPointer.rootX += panoramiXdataPtr[0].x;
+ eventCopy.u.keyButtonPointer.rootY += panoramiXdataPtr[0].y;
+ if(eventCopy.u.keyButtonPointer.event ==
+ eventCopy.u.keyButtonPointer.root)
+ {
+ eventCopy.u.keyButtonPointer.eventX += panoramiXdataPtr[0].x;
+ eventCopy.u.keyButtonPointer.eventY += panoramiXdataPtr[0].y;
+ }
+ events = &eventCopy;
+ break;
+ default: break;
+ }
+ }
+#endif
+
if (EventCallback)
{
EventInfoRec eventinfo;
diff --git a/dix/extension.c b/dix/extension.c
index 00c6b158d..36f053f02 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.12 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -47,6 +48,7 @@ SOFTWARE.
/* $Xorg: extension.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include "X.h"
+#define NEED_EVENTS
#define NEED_REPLIES
#include "Xproto.h"
#include "misc.h"
@@ -54,9 +56,13 @@ SOFTWARE.
#include "extnsionst.h"
#include "gcstruct.h"
#include "scrnintstr.h"
+#include "dispatch.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
#endif
#define EXTENSION_BASE 128
@@ -72,15 +78,12 @@ int lastEvent = EXTENSION_EVENT_BASE;
static int lastError = FirstExtensionError;
static unsigned int NumExtensions = 0;
-ExtensionEntry *AddExtension(name, NumEvents, NumErrors, MainProc,
- SwappedMainProc, CloseDownProc, MinorOpcodeProc)
- char *name;
- int NumEvents;
- int NumErrors;
- int (* MainProc)();
- int (* SwappedMainProc)();
- void (* CloseDownProc)();
- unsigned short (* MinorOpcodeProc)();
+ExtensionEntry *
+AddExtension(char *name, int NumEvents, int NumErrors,
+ int (*MainProc)(ClientPtr c1),
+ int (*SwappedMainProc)(ClientPtr c2),
+ void (*CloseDownProc)(ExtensionEntry *e),
+ unsigned short (*MinorOpcodeProc)(ClientPtr c3))
{
int i;
register ExtensionEntry *ext, **newexts;
@@ -179,9 +182,7 @@ Bool AddExtensionAlias(alias, ext)
}
static int
-FindExtension(extname, len)
- char *extname;
- int len;
+FindExtension(char *extname, int len)
{
int i, j;
@@ -201,6 +202,22 @@ FindExtension(extname, len)
return ((i == NumExtensions) ? -1 : i);
}
+/*
+ * CheckExtension returns the extensions[] entry for the requested
+ * extension name. Maybe this could just return a Bool instead?
+ */
+ExtensionEntry *
+CheckExtension(const char *extname)
+{
+ int n;
+
+ n = FindExtension((char*)extname, strlen(extname));
+ if (n != -1)
+ return extensions[n];
+ else
+ return NULL;
+}
+
void
DeclareExtensionSecurity(extname, secure)
char *extname;
@@ -337,7 +354,6 @@ ProcListExtensions(client)
char *bufptr, *buffer;
int total_length = 0;
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
reply.type = X_Reply;
diff --git a/dix/gc.c b/dix/gc.c
index e8ce161e8..6ab685d6c 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/gc.c,v 3.9 2001/12/14 19:59:32 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -62,6 +63,7 @@ SOFTWARE.
#include <assert.h>
extern XID clientErrorValue;
+extern FontPtr defaultFont;
static Bool CreateDefaultTile(
#if NeedFunctionPrototypes
@@ -97,14 +99,16 @@ ValidateGC(pDraw, pGC)
* or pUnion, but not both; one of them must be NULL. If you don't need
* to pass any pointers, you can use either one:
*
- * /* example calling dixChangeGC using pC32 parameter
+ * example calling dixChangeGC using pC32 parameter
+ *
* CARD32 v[2];
* v[0] = foreground;
* v[1] = background;
* dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL);
*
- * /* example calling dixChangeGC using pUnion parameter;
- * /* same effect as above
+ * example calling dixChangeGC using pUnion parameter;
+ * same effect as above
+ *
* ChangeGCVal v[2];
* v[0].val = foreground;
* v[1].val = background;
@@ -113,10 +117,12 @@ ValidateGC(pDraw, pGC)
* However, if you need to pass a pointer to a pixmap or font, you MUST
* use the pUnion parameter.
*
- * /* example calling dixChangeGC passing pointers in the value list
+ * example calling dixChangeGC passing pointers in the value list
+ * v[1].ptr is a pointer to a pixmap
+ *
* ChangeGCVal v[2];
* v[0].val = FillTiled;
- * v[1].ptr = pPixmap; /* pointer to a pixmap
+ * v[1].ptr = pPixmap;
* dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v);
*
* Note: we could have gotten by with just the pUnion parameter, but on
@@ -149,7 +155,7 @@ dixChangeGC(client, pGC, mask, pC32, pUnion)
CARD32 *pC32;
ChangeGCValPtr pUnion;
{
- register BITS32 index;
+ register BITS32 index2;
register int error = 0;
PixmapPtr pPixmap;
BITS32 maskQ;
@@ -160,10 +166,10 @@ dixChangeGC(client, pGC, mask, pC32, pUnion)
maskQ = mask; /* save these for when we walk the GCque */
while (mask && !error)
{
- index = (BITS32) lowbit (mask);
- mask &= ~index;
- pGC->stateChanges |= index;
- switch (index)
+ index2 = (BITS32) lowbit (mask);
+ mask &= ~index2;
+ pGC->stateChanges |= index2;
+ switch (index2)
{
case GCFunction:
{
@@ -402,8 +408,8 @@ dixChangeGC(client, pGC, mask, pC32, pUnion)
break;
case GCClipMask:
{
- Pixmap pid;
- int clipType;
+ Pixmap pid = 0;
+ int clipType = 0;
if (pUnion)
{
@@ -562,9 +568,9 @@ DoChangeGC(pGC, mask, pval, fPointer)
{
if (fPointer)
/* XXX might be a problem on 64 bit big-endian servers */
- dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
+ return dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
else
- dixChangeGC(NullClient, pGC, mask, pval, NULL);
+ return dixChangeGC(NullClient, pGC, mask, pval, NULL);
}
@@ -579,8 +585,12 @@ BUG:
*/
static GCPtr
+#if NeedFunctionPrototypes
+AllocateGC(ScreenPtr pScreen)
+#else
AllocateGC(pScreen)
ScreenPtr pScreen;
+#endif
{
GCPtr pGC;
register char *ptr;
@@ -618,7 +628,6 @@ CreateGC(pDrawable, mask, pval, pStatus)
int *pStatus;
{
register GCPtr pGC;
- extern FontPtr defaultFont;
pGC = AllocateGC(pDrawable->pScreen);
if (!pGC)
@@ -678,7 +687,7 @@ CreateGC(pDrawable, mask, pval, pStatus)
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
pGC->stipple->refcnt++;
- pGC->stateChanges = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
if (!(*pGC->pScreen->CreateGC)(pGC))
*pStatus = BadAlloc;
else if (mask)
@@ -746,7 +755,7 @@ CopyGC(pgcSrc, pgcDst, mask)
register GC *pgcDst;
register BITS32 mask;
{
- register BITS32 index;
+ register BITS32 index2;
BITS32 maskQ;
int error = 0;
@@ -757,9 +766,9 @@ CopyGC(pgcSrc, pgcDst, mask)
maskQ = mask;
while (mask)
{
- index = (BITS32) lowbit (mask);
- mask &= ~index;
- switch (index)
+ index2 = (BITS32) lowbit (mask);
+ mask &= ~index2;
+ switch (index2)
{
case GCFunction:
pgcDst->alu = pgcSrc->alu;
@@ -963,7 +972,6 @@ CreateScratchGC(pScreen, depth)
unsigned depth;
{
register GCPtr pGC;
- extern FontPtr defaultFont;
pGC = AllocateGC(pScreen);
if (!pGC)
@@ -1003,7 +1011,7 @@ CreateScratchGC(pScreen, depth)
pGC->lastWinOrg.x = 0;
pGC->lastWinOrg.y = 0;
- pGC->stateChanges = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
if (!(*pScreen->CreateGC)(pGC))
{
FreeGC(pGC, (XID)0);
@@ -1296,7 +1304,7 @@ GetScratchGC(depth, pScreen)
pGC->clipOrg.y = 0;
if (pGC->clientClipType != CT_NONE)
(*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
- pGC->stateChanges = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
return pGC;
}
/* if we make it this far, need to roll our own */
diff --git a/dix/globals.c b/dix/globals.c
index fe45f64cd..3051ebbbb 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/globals.c,v 1.10 2002/10/08 23:55:18 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -90,18 +91,22 @@ CARD32 ScreenSaverInterval;
int ScreenSaverBlanking;
int ScreenSaverAllowExposures;
+#ifdef DPMSExtension
#define DEFAULT_STANDBY_TIME DEFAULT_SCREEN_SAVER_TIME * 2
#define DEFAULT_SUSPEND_TIME DEFAULT_SCREEN_SAVER_TIME * 3
#define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4
-#ifdef DPMSExtension
-CARD32 DPMSStandbyTime = DEFAULT_STANDBY_TIME;
-CARD32 DPMSSuspendTime = DEFAULT_SUSPEND_TIME;
-CARD32 DPMSOffTime = DEFAULT_OFF_TIME;
+CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME;
+CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME;
+CARD32 defaultDPMSOffTime = DEFAULT_OFF_TIME;
CARD16 DPMSPowerLevel = 0;
-BOOL DPMSEnabled = FALSE;
-BOOL DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */
-BOOL DPMSDisabledSwitch = FALSE; /* switch states */
-BOOL DPMSCapableFlag = FALSE;
+Bool defaultDPMSEnabled = FALSE;
+Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */
+Bool DPMSDisabledSwitch = FALSE; /* switch states */
+Bool DPMSCapableFlag = FALSE;
+CARD32 DPMSStandbyTime;
+CARD32 DPMSSuspendTime;
+CARD32 DPMSOffTime;
+Bool DPMSEnabled;
#endif
CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
@@ -119,7 +124,9 @@ char *rgbPath = RGB_DB;
char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
every compilation of dix code */
+Bool loadableFonts = FALSE;
CursorPtr rootCursor;
+Bool blackRoot=FALSE;
ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
TimeStamp currentTime;
@@ -137,3 +144,5 @@ char *display;
CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
int argcGlobal;
char **argvGlobal;
+
+DDXPointRec dixScreenOrigins[MAXSCREENS];
diff --git a/dix/grabs.c b/dix/grabs.c
index 80422f53f..bebbd3bec 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -46,6 +46,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
*/
+/* $XFree86: xc/programs/Xserver/dix/grabs.c,v 3.4 2002/02/19 11:09:22 alanh Exp $ */
#include "X.h"
#include "misc.h"
@@ -54,8 +55,7 @@ SOFTWARE.
#include "windowstr.h"
#include "inputstr.h"
#include "cursorstr.h"
-
-extern InputInfo inputInfo;
+#include "dixgrabs.h"
#define BITMASK(i) (((Mask)1) << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
@@ -65,6 +65,20 @@ extern InputInfo inputInfo;
#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
GrabPtr
+#if NeedFunctionPrototypes
+CreateGrab(
+ int client,
+ DeviceIntPtr device,
+ WindowPtr window,
+ Mask eventMask,
+ Bool ownerEvents, Bool keyboardMode, Bool pointerMode,
+ DeviceIntPtr modDevice,
+ unsigned short modifiers,
+ int type,
+ KeyCode keybut, /* key or button */
+ WindowPtr confineTo,
+ CursorPtr cursor)
+#else
CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
pointerMode, modDevice, modifiers, type, keybut, confineTo, cursor)
int client;
@@ -78,6 +92,7 @@ CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
KeyCode keybut; /* key or button */
WindowPtr confineTo;
CursorPtr cursor;
+#endif
{
GrabPtr grab;
@@ -110,8 +125,12 @@ CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
}
static void
+#if NeedFunctionPrototypes
+FreeGrab(GrabPtr pGrab)
+#else
FreeGrab(pGrab)
GrabPtr pGrab;
+#endif
{
if (pGrab->modifiersDetail.pMask != NULL)
xfree(pGrab->modifiersDetail.pMask);
@@ -154,9 +173,13 @@ DeletePassiveGrab(value, id)
}
static Mask *
+#if NeedFunctionPrototypes
+DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail)
+#else
DeleteDetailFromMask(pDetailMask, detail)
Mask *pDetailMask;
unsigned short detail;
+#endif
{
register Mask *mask;
register int i;
@@ -176,9 +199,16 @@ DeleteDetailFromMask(pDetailMask, detail)
}
static Bool
+#if NeedFunctionPrototypes
+IsInGrabMask(
+ DetailRec firstDetail,
+ DetailRec secondDetail,
+ unsigned short exception)
+#else
IsInGrabMask(firstDetail, secondDetail, exception)
DetailRec firstDetail, secondDetail;
unsigned short exception;
+#endif
{
if (firstDetail.exact == exception)
{
@@ -197,8 +227,15 @@ IsInGrabMask(firstDetail, secondDetail, exception)
}
static Bool
+#if NeedFunctionPrototypes
+IdenticalExactDetails(
+ unsigned short firstExact,
+ unsigned short secondExact,
+ unsigned short exception)
+#else
IdenticalExactDetails(firstExact, secondExact, exception)
unsigned short firstExact, secondExact, exception;
+#endif
{
if ((firstExact == exception) || (secondExact == exception))
return FALSE;
@@ -210,9 +247,16 @@ IdenticalExactDetails(firstExact, secondExact, exception)
}
static Bool
+#if NeedFunctionPrototypes
+DetailSupersedesSecond(
+ DetailRec firstDetail,
+ DetailRec secondDetail,
+ unsigned short exception)
+#else
DetailSupersedesSecond(firstDetail, secondDetail, exception)
DetailRec firstDetail, secondDetail;
unsigned short exception;
+#endif
{
if (IsInGrabMask(firstDetail, secondDetail, exception))
return TRUE;
@@ -225,8 +269,12 @@ DetailSupersedesSecond(firstDetail, secondDetail, exception)
}
static Bool
+#if NeedFunctionPrototypes
+GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
+#else
GrabSupersedesSecond(pFirstGrab, pSecondGrab)
GrabPtr pFirstGrab, pSecondGrab;
+#endif
{
if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail,
pSecondGrab->modifiersDetail,
diff --git a/dix/initatoms.c b/dix/initatoms.c
index f1734a734..7aadd909a 100644
--- a/dix/initatoms.c
+++ b/dix/initatoms.c
@@ -5,8 +5,9 @@
#include "X.h"
#include "Xatom.h"
-extern Atom MakeAtom();
-MakePredeclaredAtoms()
+#include "misc.h"
+#include "dix.h"
+void MakePredeclaredAtoms()
{
if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();
diff --git a/dix/main.c b/dix/main.c
index 5b50ea94f..a31f33d8a 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.40 2003/02/17 16:55:31 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -46,6 +47,31 @@ SOFTWARE.
******************************************************************/
/* $Xorg: main.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $TOG: main.c /main/86 1998/02/09 14:20:03 kaleb $ */
+
+#define NEED_EVENTS
#include "X.h"
#include "Xos.h" /* for unistd.h */
#include "Xproto.h"
@@ -65,20 +91,20 @@ SOFTWARE.
#include "servermd.h"
#include "site.h"
#include "dixfont.h"
-
-extern CARD32 defaultScreenSaverTime;
-extern CARD32 defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultScreenSaverAllowExposures;
+#include "extnsionst.h"
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#else
+#include "dixevents.h" /* InitEvents() */
+#include "dispatch.h" /* InitProcVectors() */
+#endif
#ifdef DPMSExtension
+#define DPMS_SERVER
#include "dpms.h"
-extern BOOL DPMSCapableFlag;
-extern BOOL DPMSEnabled;
+#include "dpmsproc.h"
#endif
-void ddxGiveUp();
-
extern int InitClientPrivates(
#if NeedFunctionPrototypes
ClientPtr /*client*/
@@ -91,47 +117,46 @@ extern void Dispatch(
#endif
);
-extern char *display;
char *ConnectionInfo;
xConnSetupPrefix connSetupPrefix;
-extern WindowPtr *WindowTable;
extern FontPtr defaultFont;
extern int screenPrivateCount;
-extern void InitProcVectors();
-extern void InitEvents();
-extern void DefineInitialRootWindow();
-extern Bool CreateGCperDepthArray();
+extern void InitProcVectors(void);
+extern Bool CreateGCperDepthArray(void);
-static Bool CreateConnectionBlock(
-#if NeedFunctionPrototypes
- void
+#ifndef PANORAMIX
+static
#endif
-);
+Bool CreateConnectionBlock(void);
-static void FreeScreen(
-#if NeedFunctionPrototypes
- ScreenPtr /*pScreen*/
-#endif
-);
+static void FreeScreen(ScreenPtr);
PaddingInfo PixmapWidthPaddingInfo[33];
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
-/* add padding info for 32-bit interface. PutImage and GetImage will
- * work on 32-bit padding while the rest of the server will work
- * on 64-bit padding (Alpha).
- */
-PaddingInfo PixmapWidthPaddingInfoProto[33];
-#endif
-
int connBlockScreenStart;
static int restart = 0;
void
-NotImplemented()
+NotImplemented(xEvent *from, xEvent *to)
+{
+ FatalError("Not implemented");
+}
+
+/*
+ * Dummy entry for ReplySwapVector[]
+ */
+/*ARGSUSED*/
+void
+ReplyNotSwappd(
+#if NeedNestedPrototypes
+ ClientPtr pClient ,
+ int size ,
+ void * pbuf
+#endif
+ )
{
FatalError("Not implemented");
}
@@ -171,6 +196,22 @@ static int indexForBitsPerPixel[ 33 ] = {
};
/*
+ * This array gives the bytesperPixel value for cases where the number
+ * of bits per pixel is a multiple of 8 but not a power of 2.
+ */
+static int answerBytesPerPixel[ 33 ] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 0, ~0, ~0, ~0, /* 4 bits per pixel */
+ 0, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0 /* 32 bits per pixel */
+};
+
+/*
* This array gives the answer to the question "what is the second index for
* the answer array above given the number of bits per scanline pad unit?"
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
@@ -200,37 +241,47 @@ static int indexForScanlinePad[ 65 ] = {
#endif
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[], char *envp[])
{
- int i, j, k;
+ int i, j, k, error;
+ char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
- /* Notice if we're restart. Probably this is because we jumped through
- * uninitialized pointer */
+ display = "0";
+
+ /* Quartz support on Mac OS X requires that the Cocoa event loop be in
+ * the main thread. This allows the X server main to be called again
+ * from another thread. */
+#if defined(__DARWIN__) && defined(DARWIN_WITH_QUARTZ)
+ DarwinHandleGUI(argc, argv, envp);
+#endif
+
+ /* Notice if we're restarted. Probably this is because we jumped through
+ * an uninitialized pointer */
if (restart)
FatalError("server restarted. Jumped through uninitialized pointer?\n");
else
restart = 1;
+ CheckUserParameters(argc, argv, envp);
+
+ CheckUserAuthorization();
+
#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
ExpandCommandLine(&argc, &argv);
#endif
-#ifdef _SC_OPEN_MAX
- /* if sysconf(_SC_OPEN_MAX) is supported, at runtime MaxClients will be
- * reassigned instead of using MAXSOCKS */
- if (MaxClients == 0)
- MaxClients = MIN(MAXCLIENTS, sysconf(_SC_OPEN_MAX));
-#endif
+ InitConnectionLimits();
/* These are needed by some routines which are called from interrupt
* handlers, thus have no direct calling path back to main and thus
* can't be passed argc, argv as parameters */
argcGlobal = argc;
argvGlobal = argv;
- display = "0";
+ /* prep X authority file from environment; this can be overriden by a
+ * command line option */
+ xauthfile = getenv("XAUTHORITY");
+ if (xauthfile) InitAuthorization (xauthfile);
ProcessCommandLine(argc, argv);
alwaysCheckForInput[0] = 0;
@@ -238,10 +289,17 @@ main(argc, argv)
while(1)
{
serverGeneration++;
- ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverTime = defaultScreenSaverTime;
ScreenSaverInterval = defaultScreenSaverInterval;
ScreenSaverBlanking = defaultScreenSaverBlanking;
ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+#ifdef DPMSExtension
+ DPMSStandbyTime = defaultDPMSStandbyTime;
+ DPMSSuspendTime = defaultDPMSSuspendTime;
+ DPMSOffTime = defaultDPMSOffTime;
+ DPMSEnabled = defaultDPMSEnabled;
+ DPMSPowerLevel = 0;
+#endif
InitBlockAndWakeupHandlers();
/* Perform any operating system dependent initializations you'd like */
OsInit();
@@ -284,18 +342,7 @@ main(argc, argv)
PixmapWidthPaddingInfo[1].padPixelsLog2 = answer[j][k];
j = indexForBitsPerPixel[8]; /* bits per byte */
PixmapWidthPaddingInfo[1].padBytesLog2 = answer[j][k];
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* Fake out protocol interface to make them believe we support
- * a different padding than the actual internal padding.
- */
- j = indexForBitsPerPixel[ 1 ];
- k = indexForScanlinePad[ BITMAP_SCANLINE_PAD_PROTO ];
- PixmapWidthPaddingInfoProto[1].padRoundUp = BITMAP_SCANLINE_PAD_PROTO-1;
- PixmapWidthPaddingInfoProto[1].padPixelsLog2 = answer[j][k];
- j = indexForBitsPerPixel[8]; /* bits per byte */
- PixmapWidthPaddingInfoProto[1].padBytesLog2 = answer[j][k];
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+ PixmapWidthPaddingInfo[1].bitsPerPixel = 1;
InitAtoms();
InitEvents();
@@ -310,6 +357,7 @@ main(argc, argv)
ResetColormapPrivates();
ResetFontPrivateIndex();
InitCallbackManager();
+ InitVisualWrap();
InitOutput(&screenInfo, argc, argv);
if (screenInfo.numScreens < 1)
FatalError("no screens found");
@@ -341,8 +389,13 @@ main(argc, argv)
FatalError("failed to initialize core devices");
InitFonts();
- if (SetDefaultFontPath(defaultFontPath) != Success)
- ErrorF("failed to set default font path '%s'", defaultFontPath);
+ if (loadableFonts) {
+ SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
+ } else {
+ if (SetDefaultFontPath(defaultFontPath) != Success)
+ ErrorF("failed to set default font path '%s'",
+ defaultFontPath);
+ }
if (!SetDefaultFont(defaultTextFont))
FatalError("could not open default font '%s'", defaultTextFont);
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
@@ -354,12 +407,30 @@ main(argc, argv)
if (!DPMSCapableFlag)
DPMSEnabled = FALSE;
#endif
+
+#ifdef PANORAMIX
+ /*
+ * Consolidate window and colourmap information for each screen
+ */
+ if (!noPanoramiXExtension)
+ PanoramiXConsolidate();
+#endif
+
for (i = 0; i < screenInfo.numScreens; i++)
InitRootWindow(WindowTable[i]);
DefineInitialRootWindow(WindowTable[0]);
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
- if (!CreateConnectionBlock())
- FatalError("could not create connection block info");
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXCreateConnectionBlock())
+ FatalError("could not create connection block info");
+ } else
+#endif
+ {
+ if (!CreateConnectionBlock())
+ FatalError("could not create connection block info");
+ }
Dispatch();
@@ -367,7 +438,18 @@ main(argc, argv)
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
CloseDownExtensions();
+
+#ifdef PANORAMIX
+ {
+ Bool remember_it = noPanoramiXExtension;
+ noPanoramiXExtension = TRUE;
+ FreeAllResources();
+ noPanoramiXExtension = remember_it;
+ }
+#else
FreeAllResources();
+#endif
+
CloseDownDevices();
for (i = screenInfo.numScreens - 1; i >= 0; i--)
{
@@ -378,24 +460,34 @@ main(argc, argv)
FreeScreen(screenInfo.screens[i]);
screenInfo.numScreens = i;
}
+ CloseDownEvents();
xfree(WindowTable);
+ WindowTable = NULL;
FreeFonts ();
+
xfree(serverClient->devPrivates);
+ serverClient->devPrivates = NULL;
if (dispatchException & DE_TERMINATE)
{
+ CloseWellKnownConnections();
+ OsCleanup();
ddxGiveUp();
break;
}
xfree(ConnectionInfo);
+ ConnectionInfo = NULL;
}
return(0);
}
static int padlength[4] = {0, 3, 2, 1};
-static Bool
+#ifndef PANORAMIX
+static
+#endif
+Bool
CreateConnectionBlock()
{
xConnSetup setup;
@@ -419,18 +511,8 @@ CreateConnectionBlock()
*/
setup.imageByteOrder = screenInfo.imageByteOrder;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ( screenInfo.bitmapScanlineUnit > 32 )
- setup.bitmapScanlineUnit = 32;
- else
-#endif
- setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ( screenInfo.bitmapScanlinePad > 32 )
- setup.bitmapScanlinePad = 32;
- else
-#endif
- setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
+ setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
+ setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
setup.bitmapBitOrder = screenInfo.bitmapBitOrder;
setup.motionBufferSize = NumMotionEvents();
@@ -464,12 +546,7 @@ CreateConnectionBlock()
{
format.depth = screenInfo.formats[i].depth;
format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ( screenInfo.formats[i].scanlinePad > 32 )
- format.scanLinePad = 32;
- else
-#endif
- format.scanLinePad = screenInfo.formats[i].scanlinePad;
+ format.scanLinePad = screenInfo.formats[i].scanlinePad;
memmove(pBuf, (char *)&format, sizeof(xPixmapFormat));
pBuf += sizeof(xPixmapFormat);
sizesofar += sizeof(xPixmapFormat);
@@ -557,10 +634,24 @@ with its screen number, a pointer to its ScreenRec, argc, and argv.
*/
int
+#if NeedFunctionPrototypes
+AddScreen(
+ Bool (* pfnInit)(
+#if NeedNestedPrototypes
+ int /*index*/,
+ ScreenPtr /*pScreen*/,
+ int /*argc*/,
+ char ** /*argv*/
+#endif
+ ),
+ int argc,
+ char **argv)
+#else
AddScreen(pfnInit, argc, argv)
Bool (* pfnInit)();
int argc;
char **argv;
+#endif
{
int i;
@@ -578,8 +669,8 @@ AddScreen(pfnInit, argc, argv)
if (!pScreen)
return -1;
- pScreen->devPrivates = (DevUnion *)xalloc(screenPrivateCount *
- sizeof(DevUnion));
+ pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion),
+ screenPrivateCount);
if (!pScreen->devPrivates && screenPrivateCount)
{
xfree(pScreen);
@@ -588,17 +679,19 @@ AddScreen(pfnInit, argc, argv)
pScreen->myNum = i;
pScreen->WindowPrivateLen = 0;
pScreen->WindowPrivateSizes = (unsigned *)NULL;
- pScreen->totalWindowSize = sizeof(WindowRec);
+ pScreen->totalWindowSize =
+ ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
pScreen->GCPrivateLen = 0;
pScreen->GCPrivateSizes = (unsigned *)NULL;
- pScreen->totalGCSize = sizeof(GC);
+ pScreen->totalGCSize =
+ ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
#ifdef PIXPRIV
pScreen->PixmapPrivateLen = 0;
pScreen->PixmapPrivateSizes = (unsigned *)NULL;
- pScreen->totalPixmapSize = sizeof(PixmapRec);
+ pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
#endif
- pScreen->ClipNotify = (void (*)())NULL; /* for R4 ddx compatibility */
- pScreen->CreateScreenResources = (Bool (*)())NULL;
+ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
+ pScreen->CreateScreenResources = 0;
#ifdef DEBUG
for (jNI = &pScreen->QueryBestSize;
@@ -628,19 +721,17 @@ AddScreen(pfnInit, argc, argv)
(scanlinepad/bitsPerPixel) - 1;
j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
PixmapWidthPaddingInfo[ depth ].padBytesLog2 = answer[j][k];
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* Fake out protocol interface to make them believe we support
- * a different padding than the actual internal padding.
- */
- j = indexForBitsPerPixel[ bitsPerPixel ];
- k = indexForScanlinePad[ BITMAP_SCANLINE_PAD_PROTO ];
- PixmapWidthPaddingInfoProto[ depth ].padPixelsLog2 = answer[j][k];
- PixmapWidthPaddingInfoProto[ depth ].padRoundUp =
- (BITMAP_SCANLINE_PAD_PROTO/bitsPerPixel) - 1;
- j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
- PixmapWidthPaddingInfoProto[ depth ].padBytesLog2 = answer[j][k];
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+ PixmapWidthPaddingInfo[ depth ].bitsPerPixel = bitsPerPixel;
+ if (answerBytesPerPixel[bitsPerPixel])
+ {
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 1;
+ PixmapWidthPaddingInfo[ depth ].bytesPerPixel =
+ answerBytesPerPixel[bitsPerPixel];
+ }
+ else
+ {
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 0;
+ }
}
/* This is where screen specific stuff gets initialized. Load the
diff --git a/dix/pixmap.c b/dix/pixmap.c
index b65559f6e..fda07801c 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/dix/pixmap.c,v 3.5 2001/12/14 19:59:32 dawes Exp $ */
#include "X.h"
#include "scrnintstr.h"
@@ -65,10 +66,12 @@ GetScratchPixmapHeader(pScreen, width, height, depth, bitsPerPixel, devKind,
/* width and height of 0 means don't allocate any pixmap data */
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth);
- if (pPixmap)
+ if (pPixmap) {
if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
bitsPerPixel, devKind, pPixData))
return pPixmap;
+ (*pScreen->DestroyPixmap)(pPixmap);
+ }
return NullPixmap;
}
@@ -132,7 +135,7 @@ AllocatePixmap(pScreen, pixDataSize)
ptr = (char *)(ppriv + pScreen->PixmapPrivateLen);
for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++)
{
- if (size = *sizes)
+ if ((size = *sizes) != 0)
{
ppriv->ptr = (pointer)ptr;
ptr += size;
diff --git a/dix/privates.c b/dix/privates.c
index a252dbce9..2d0885846 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/dix/privates.c,v 3.8 2001/12/14 19:59:32 dawes Exp $ */
#include "X.h"
#include "scrnintstr.h"
@@ -61,8 +62,8 @@ ResetClientPrivates()
clientPrivateLen = 0;
xfree(clientPrivateSizes);
clientPrivateSizes = (unsigned *)NULL;
- totalClientSize = sizeof(ClientRec);
-
+ totalClientSize =
+ ((sizeof(ClientRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
}
int
@@ -72,30 +73,33 @@ AllocateClientPrivateIndex()
}
Bool
-AllocateClientPrivate(index, amount)
- int index;
+AllocateClientPrivate(index2, amount)
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= clientPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= clientPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(clientPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (clientPrivateLen <= index)
+ while (clientPrivateLen <= index2)
{
nsizes[clientPrivateLen++] = 0;
totalClientSize += sizeof(DevUnion);
}
clientPrivateSizes = nsizes;
}
- oldamount = clientPrivateSizes[index];
+ oldamount = clientPrivateSizes[index2];
if (amount > oldamount)
{
- clientPrivateSizes[index] = amount;
+ clientPrivateSizes[index2] = amount;
totalClientSize += (amount - oldamount);
}
return TRUE;
@@ -119,12 +123,12 @@ ResetScreenPrivates()
int
AllocateScreenPrivateIndex()
{
- int index;
+ int idx;
int i;
ScreenPtr pScreen;
DevUnion *nprivs;
- index = screenPrivateCount++;
+ idx = screenPrivateCount++;
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
@@ -135,9 +139,11 @@ AllocateScreenPrivateIndex()
screenPrivateCount--;
return -1;
}
+ /* Zero the new private */
+ bzero(&nprivs[idx], sizeof(DevUnion));
pScreen->devPrivates = nprivs;
}
- return index;
+ return idx;
}
@@ -160,31 +166,34 @@ AllocateWindowPrivateIndex()
}
Bool
-AllocateWindowPrivate(pScreen, index, amount)
+AllocateWindowPrivate(pScreen, index2, amount)
register ScreenPtr pScreen;
- int index;
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= pScreen->WindowPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->WindowPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (pScreen->WindowPrivateLen <= index)
+ while (pScreen->WindowPrivateLen <= index2)
{
nsizes[pScreen->WindowPrivateLen++] = 0;
pScreen->totalWindowSize += sizeof(DevUnion);
}
pScreen->WindowPrivateSizes = nsizes;
}
- oldamount = pScreen->WindowPrivateSizes[index];
+ oldamount = pScreen->WindowPrivateSizes[index2];
if (amount > oldamount)
{
- pScreen->WindowPrivateSizes[index] = amount;
+ pScreen->WindowPrivateSizes[index2] = amount;
pScreen->totalWindowSize += (amount - oldamount);
}
return TRUE;
@@ -210,31 +219,34 @@ AllocateGCPrivateIndex()
}
Bool
-AllocateGCPrivate(pScreen, index, amount)
+AllocateGCPrivate(pScreen, index2, amount)
register ScreenPtr pScreen;
- int index;
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= pScreen->GCPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->GCPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (pScreen->GCPrivateLen <= index)
+ while (pScreen->GCPrivateLen <= index2)
{
nsizes[pScreen->GCPrivateLen++] = 0;
pScreen->totalGCSize += sizeof(DevUnion);
}
pScreen->GCPrivateSizes = nsizes;
}
- oldamount = pScreen->GCPrivateSizes[index];
+ oldamount = pScreen->GCPrivateSizes[index2];
if (amount > oldamount)
{
- pScreen->GCPrivateSizes[index] = amount;
+ pScreen->GCPrivateSizes[index2] = amount;
pScreen->totalGCSize += (amount - oldamount);
}
return TRUE;
@@ -260,33 +272,37 @@ AllocatePixmapPrivateIndex()
}
Bool
-AllocatePixmapPrivate(pScreen, index, amount)
+AllocatePixmapPrivate(pScreen, index2, amount)
register ScreenPtr pScreen;
- int index;
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= pScreen->PixmapPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->PixmapPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (pScreen->PixmapPrivateLen <= index)
+ while (pScreen->PixmapPrivateLen <= index2)
{
nsizes[pScreen->PixmapPrivateLen++] = 0;
pScreen->totalPixmapSize += sizeof(DevUnion);
}
pScreen->PixmapPrivateSizes = nsizes;
}
- oldamount = pScreen->PixmapPrivateSizes[index];
+ oldamount = pScreen->PixmapPrivateSizes[index2];
if (amount > oldamount)
{
- pScreen->PixmapPrivateSizes[index] = amount;
+ pScreen->PixmapPrivateSizes[index2] = amount;
pScreen->totalPixmapSize += (amount - oldamount);
}
+ pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
return TRUE;
}
#endif
@@ -335,15 +351,18 @@ InitCmapPrivFunc initPrivFunc;
pColormap = (ColormapPtr) LookupIDByType (
pScreen->defColormap, RT_COLORMAP);
- privs = (DevUnion *) xrealloc (pColormap->devPrivates,
- colormapPrivateCount * sizeof(DevUnion));
-
- pColormap->devPrivates = privs;
-
- if (!privs || !(*initPrivFunc)(pColormap))
+ if (pColormap)
{
- colormapPrivateCount--;
- return -1;
+ privs = (DevUnion *) xrealloc (pColormap->devPrivates,
+ colormapPrivateCount * sizeof(DevUnion));
+
+ pColormap->devPrivates = privs;
+
+ if (!privs || !(*initPrivFunc)(pColormap))
+ {
+ colormapPrivateCount--;
+ return -1;
+ }
}
}
diff --git a/dix/property.c b/dix/property.c
index 1b92dfa35..ba12faffe 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.12 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -53,12 +54,23 @@ SOFTWARE.
#include "windowstr.h"
#include "propertyst.h"
#include "dixstruct.h"
+#include "dispatch.h"
+#include "swaprep.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
+#include "lbxtags.h"
#endif
-extern void CopySwap16Write(), CopySwap32Write(), Swap32Write();
+#if defined(LBX) || defined(LBX_COMPAT)
+int fWriteToClient(ClientPtr client, int len, char *buf)
+{
+ return WriteToClient(client, len, buf);
+}
+#endif
/*****************************************************************
* Property Stuff
@@ -609,9 +621,9 @@ ProcGetProperty(client)
if (len)
{
switch (reply.format) {
- case 32: client->pSwapReplyFunc = CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = CopySwap16Write; break;
- default: client->pSwapReplyFunc = (void (*) ())WriteToClient; break;
+ case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
+ case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
+ default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
}
WriteSwappedDataToClient(client, len,
(char *)pProp->data + ind);
@@ -640,7 +652,7 @@ int
ProcListProperties(client)
ClientPtr client;
{
- Atom *pAtoms, *temppAtoms;
+ Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
int numProps = 0;
WindowPtr pWin;
@@ -677,7 +689,7 @@ ProcListProperties(client)
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
if (numProps)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
DEALLOCATE_LOCAL(pAtoms);
}
diff --git a/dix/resource.c b/dix/resource.c
index 76f9ef191..d17586a77 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -47,6 +47,9 @@ SOFTWARE.
/* $Xorg: resource.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
+
+/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
+
/* Routines to manage various kinds of resources:
*
* CreateNewResourceType, CreateNewResourceClass, InitClientResources,
@@ -69,7 +72,9 @@ SOFTWARE.
* 1, and an otherwise arbitrary ID in the low 22 bits, we can create a
* resource "owned" by the client.
*/
+/* $XFree86: xc/programs/Xserver/dix/resource.c,v 3.12 2002/03/06 21:13:38 mvojkovi Exp $ */
+#define NEED_EVENTS
#include "X.h"
#include "misc.h"
#include "os.h"
@@ -77,10 +82,18 @@ SOFTWARE.
#include "dixstruct.h"
#include "opaque.h"
#include "windowstr.h"
+#include "dixfont.h"
+#include "colormap.h"
+#include "inputstr.h"
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "cursor.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
#include <assert.h>
-extern WindowPtr *WindowTable;
-
static void RebuildTable(
#if NeedFunctionPrototypes
int /*client*/
@@ -111,12 +124,23 @@ typedef struct _ClientResource {
XID expectID;
} ClientResourceRec;
-static RESTYPE lastResourceType;
+RESTYPE lastResourceType;
static RESTYPE lastResourceClass;
-static RESTYPE TypeMask;
+RESTYPE TypeMask;
static DeleteType *DeleteFuncs = (DeleteType *)NULL;
+#ifdef XResExtension
+
+Atom * ResourceNames = NULL;
+
+void RegisterResourceName (RESTYPE type, char *name)
+{
+ ResourceNames[type & TypeMask] = MakeAtom(name, strlen(name), TRUE);
+}
+
+#endif
+
RESTYPE
CreateNewResourceType(deleteFunc)
DeleteType deleteFunc;
@@ -130,6 +154,18 @@ CreateNewResourceType(deleteFunc)
(next + 1) * sizeof(DeleteType));
if (!funcs)
return 0;
+
+#ifdef XResExtension
+ {
+ Atom *newnames;
+ newnames = xrealloc(ResourceNames, (next + 1) * sizeof(Atom));
+ if(!newnames)
+ return 0;
+ ResourceNames = newnames;
+ ResourceNames[next] = 0;
+ }
+#endif
+
lastResourceType = next;
DeleteFuncs = funcs;
DeleteFuncs[next] = deleteFunc;
@@ -164,11 +200,6 @@ InitClientResources(client)
if (client == serverClient)
{
- extern int DeleteWindow(), dixDestroyPixmap(), FreeGC();
- extern int CloseFont(), FreeCursor();
- extern int FreeColormap(), FreeClientPixels();
- extern int OtherClientGone(), DeletePassiveGrab();
-
lastResourceType = RT_LASTPREDEF;
lastResourceClass = RC_LASTPREDEF;
TypeMask = RC_LASTPREDEF - 1;
@@ -188,6 +219,14 @@ InitClientResources(client)
DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels;
DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone;
DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab;
+
+#ifdef XResExtension
+ if(ResourceNames)
+ xfree(ResourceNames);
+ ResourceNames = xalloc((lastResourceType + 1) * sizeof(Atom));
+ if(!ResourceNames)
+ return FALSE;
+#endif
}
clientTable[i = client->index].resources =
(ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr));
@@ -212,10 +251,15 @@ InitClientResources(client)
return TRUE;
}
+
static int
+#if NeedFunctionPrototypes
+Hash(int client, register XID id)
+#else
Hash(client, id)
int client;
register XID id;
+#endif
{
id &= RESOURCE_ID_MASK;
switch (clientTable[client].hashsize)
@@ -237,9 +281,17 @@ Hash(client, id)
}
static XID
+#if NeedFunctionPrototypes
+AvailableID(
+ register int client,
+ register XID id,
+ register XID maxid,
+ register XID goodid)
+#else
AvailableID(client, id, maxid, goodid)
register int client;
register XID id, maxid, goodid;
+#endif
{
register ResourcePtr res;
@@ -507,7 +559,6 @@ FreeResourceByType(id, type, skipFree)
int cid;
register ResourcePtr res;
register ResourcePtr *prev, *head;
-
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
{
head = &clientTable[cid].resources[Hash(cid, id)];
@@ -574,12 +625,12 @@ ChangeResourceValue (id, rtype, value)
*/
void
-FindClientResourcesByType(client, type, func, cdata)
- ClientPtr client;
- RESTYPE type;
- FindResType func;
- pointer cdata;
-{
+FindClientResourcesByType(
+ ClientPtr client,
+ RESTYPE type,
+ FindResType func,
+ pointer cdata
+){
register ResourcePtr *resources;
register ResourcePtr this, next;
int i, elements;
@@ -606,8 +657,64 @@ FindClientResourcesByType(client, type, func, cdata)
}
void
-FreeClientNeverRetainResources(client)
- ClientPtr client;
+FindAllClientResources(
+ ClientPtr client,
+ FindAllRes func,
+ pointer cdata
+){
+ register ResourcePtr *resources;
+ register ResourcePtr this, next;
+ int i, elements;
+ register int *eltptr;
+
+ if (!client)
+ client = serverClient;
+
+ resources = clientTable[client->index].resources;
+ eltptr = &clientTable[client->index].elements;
+ for (i = 0; i < clientTable[client->index].buckets; i++)
+ {
+ for (this = resources[i]; this; this = next)
+ {
+ next = this->next;
+ elements = *eltptr;
+ (*func)(this->value, this->id, this->type, cdata);
+ if (*eltptr != elements)
+ next = resources[i]; /* start over */
+ }
+ }
+}
+
+
+pointer
+LookupClientResourceComplex(
+ ClientPtr client,
+ RESTYPE type,
+ FindComplexResType func,
+ pointer cdata
+){
+ ResourcePtr *resources;
+ ResourcePtr this;
+ int i;
+
+ if (!client)
+ client = serverClient;
+
+ resources = clientTable[client->index].resources;
+ for (i = 0; i < clientTable[client->index].buckets; i++) {
+ for (this = resources[i]; this; this = this->next) {
+ if (!type || this->type == type) {
+ if((*func)(this->value, this->id, cdata))
+ return this->value;
+ }
+ }
+ }
+ return NULL;
+}
+
+
+void
+FreeClientNeverRetainResources(ClientPtr client)
{
ResourcePtr *resources;
ResourcePtr this;
@@ -681,6 +788,7 @@ FreeClientResources(client)
}
}
xfree(clientTable[client->index].resources);
+ clientTable[client->index].resources = NULL;
clientTable[client->index].buckets = 0;
}
@@ -701,7 +809,19 @@ LegalNewID(id, client)
XID id;
register ClientPtr client;
{
- return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) &&
+
+#ifdef PANORAMIX
+ XID minid, maxid;
+
+ if (!noPanoramiXExtension) {
+ minid = client->clientAsMask | (client->index ?
+ SERVER_BIT : SERVER_MINID);
+ maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
+ if ((id >= minid) && (id <= maxid))
+ return TRUE;
+ }
+#endif /* PANORAMIX */
+ return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) &&
((clientTable[client->index].expectID <= id) ||
!LookupIDByClass(id, RC_ANY)));
}
@@ -757,7 +877,7 @@ SecurityLookupIDByClass(client, id, classes, mode)
Mask mode;
{
int cid;
- register ResourcePtr res;
+ register ResourcePtr res = NULL;
pointer retval = NULL;
assert(client == NullClient ||
diff --git a/dix/swaprep.c b/dix/swaprep.c
index ffce75ac4..e16f7c53f 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/swaprep.c,v 3.7 2001/12/14 19:59:33 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -55,8 +56,29 @@ SOFTWARE.
#include "dixstruct.h"
#include "fontstruct.h"
#include "scrnintstr.h"
+#include "swaprep.h"
+#include "globals.h"
-void SwapVisual(), SwapConnSetup(), SwapWinRoot();
+static void SwapFontInfo(
+#if NeedFunctionPrototypes
+ xQueryFontReply * /* pr */
+#endif
+);
+
+#ifndef LBX
+static void SwapCharInfo(
+#if NeedFunctionPrototypes
+ xCharInfo * /* pInfo */
+#endif
+ );
+
+static void SwapFont(
+#if NeedFunctionPrototypes
+ xQueryFontReply * /* pr */,
+ Bool /* hasGlyphs */
+#endif
+ );
+#endif
/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
void
@@ -1294,47 +1316,47 @@ SKeymapNotifyEvent(from, to)
}
void
-SwapConnSetupInfo(pInfo, pInfoTBase)
- char *pInfo;
- char *pInfoTBase;
+SwapConnSetupInfo(
+ char *pInfo,
+ char *pInfoT
+)
{
int i, j, k;
- ScreenPtr pScreen;
- DepthPtr pDepth;
- char *pInfoT;
xConnSetup *pConnSetup = (xConnSetup *)pInfo;
+ xDepth *depth;
+ xWindowRoot *root;
- pInfoT = pInfoTBase;
SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
pInfo += sizeof(xConnSetup);
pInfoT += sizeof(xConnSetup);
/* Copy the vendor string */
i = (pConnSetup->nbytesVendor + 3) & ~3;
- memmove(pInfoT, pInfo, i);
+ memcpy(pInfoT, pInfo, i);
pInfo += i;
pInfoT += i;
/* The Pixmap formats don't need to be swapped, just copied. */
- i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats;
- memmove(pInfoT, pInfo, i);
+ i = sizeof(xPixmapFormat) * pConnSetup->numFormats;
+ memcpy(pInfoT, pInfo, i);
pInfo += i;
pInfoT += i;
- for(i = 0; i < screenInfo.numScreens; i++)
+ for(i = 0; i < pConnSetup->numRoots; i++)
{
- pScreen = screenInfo.screens[i];
- SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT);
+ root = (xWindowRoot*)pInfo;
+ SwapWinRoot(root, (xWindowRoot *)pInfoT);
pInfo += sizeof(xWindowRoot);
pInfoT += sizeof(xWindowRoot);
- pDepth = pScreen->allowedDepths;
- for(j = 0; j < pScreen->numDepths; j++, pDepth++)
+
+ for(j = 0; j < root->nDepths; j++)
{
- ((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
- cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
+ depth = (xDepth*)pInfo;
+ ((xDepth *)pInfoT)->depth = depth->depth;
+ cpswaps(depth->nVisuals, ((xDepth *)pInfoT)->nVisuals);
pInfo += sizeof(xDepth);
pInfoT += sizeof(xDepth);
- for(k = 0; k < pDepth->numVids; k++)
+ for(k = 0; k < depth->nVisuals; k++)
{
SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
pInfo += sizeof(xVisualType);
diff --git a/dix/swapreq.c b/dix/swapreq.c
index d0b1a2525..358ec8139 100644
--- a/dix/swapreq.c
+++ b/dix/swapreq.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/swapreq.c,v 3.5 2002/02/19 11:09:22 alanh Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -53,9 +54,8 @@ SOFTWARE.
#include "Xprotostr.h"
#include "misc.h"
#include "dixstruct.h"
-
-extern int (* ProcVector[256]) ();
-extern void (* EventSwapVector[128]) (); /* for SendEvent */
+#include "extnsionst.h" /* for SendEvent */
+#include "swapreq.h"
/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
@@ -326,7 +326,7 @@ SProcSendEvent(client)
{
register char n;
xEvent eventT;
- void (*proc)(), NotImplemented();
+ EventSwapPtr proc;
REQUEST(xSendEventReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xSendEventReq);
@@ -335,7 +335,7 @@ SProcSendEvent(client)
/* Swap event */
proc = EventSwapVector[stuff->event.u.u.type & 0177];
- if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) /* no swapping proc; invalid event type? */
+ if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
return (BadValue);
(*proc)(&stuff->event, &eventT);
stuff->event = eventT;
diff --git a/dix/tables.c b/dix/tables.c
index 7c84bdc96..7f42c005d 100644
--- a/dix/tables.c
+++ b/dix/tables.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/tables.c,v 3.5 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -46,128 +47,39 @@ SOFTWARE.
******************************************************************/
/* $Xorg: tables.c,v 1.4 2001/02/09 02:04:41 xorgcvs Exp $ */
-extern int ProcInitialConnection(), ProcEstablishConnection();
-
-extern int ProcBadRequest(), ProcCreateWindow(),
- ProcChangeWindowAttributes(), ProcGetWindowAttributes(),
- ProcDestroyWindow(), ProcDestroySubwindows(), ProcChangeSaveSet(),
- ProcReparentWindow(), ProcMapWindow(), ProcMapSubwindows(),
- ProcUnmapWindow(), ProcUnmapSubwindows(), ProcConfigureWindow(),
- ProcCirculateWindow(), ProcGetGeometry(), ProcQueryTree(),
- ProcInternAtom(), ProcGetAtomName(), ProcChangeProperty(),
- ProcDeleteProperty(), ProcGetProperty(), ProcListProperties(),
- ProcSetSelectionOwner(), ProcGetSelectionOwner(), ProcConvertSelection(),
- ProcSendEvent(), ProcGrabPointer(), ProcUngrabPointer(),
- ProcGrabButton(), ProcUngrabButton(), ProcChangeActivePointerGrab(),
- ProcGrabKeyboard(), ProcUngrabKeyboard(), ProcGrabKey(),
- ProcUngrabKey(), ProcAllowEvents(), ProcGrabServer(),
- ProcUngrabServer(), ProcQueryPointer(), ProcGetMotionEvents(),
- ProcTranslateCoords(), ProcWarpPointer(), ProcSetInputFocus(),
- ProcGetInputFocus(), ProcQueryKeymap(), ProcOpenFont(),
- ProcCloseFont(), ProcQueryFont(), ProcQueryTextExtents(),
- ProcListFonts(), ProcListFontsWithInfo(), ProcSetFontPath(),
- ProcGetFontPath(), ProcCreatePixmap(), ProcFreePixmap(),
- ProcCreateGC(), ProcChangeGC(), ProcCopyGC(),
- ProcSetDashes(), ProcSetClipRectangles(), ProcFreeGC(),
- ProcClearToBackground(), ProcCopyArea(), ProcCopyPlane(),
- ProcPolyPoint(), ProcPolyLine(), ProcPolySegment(),
- ProcPolyRectangle(), ProcPolyArc(), ProcFillPoly(),
- ProcPolyFillRectangle(), ProcPolyFillArc(), ProcPutImage(),
- ProcGetImage(), ProcPolyText(),
- ProcImageText8(), ProcImageText16(), ProcCreateColormap(),
- ProcFreeColormap(), ProcCopyColormapAndFree(), ProcInstallColormap(),
- ProcUninstallColormap(), ProcListInstalledColormaps(), ProcAllocColor(),
- ProcAllocNamedColor(), ProcAllocColorCells(), ProcAllocColorPlanes(),
- ProcFreeColors(), ProcStoreColors(), ProcStoreNamedColor(),
- ProcQueryColors(), ProcLookupColor(), ProcCreateCursor(),
- ProcCreateGlyphCursor(), ProcFreeCursor(), ProcRecolorCursor(),
- ProcQueryBestSize(), ProcQueryExtension(), ProcListExtensions(),
- ProcChangeKeyboardMapping(), ProcSetPointerMapping(),
- ProcGetKeyboardMapping(), ProcGetPointerMapping(),
- ProcChangeKeyboardControl(),
- ProcGetKeyboardControl(), ProcBell(), ProcChangePointerControl(),
- ProcGetPointerControl(), ProcSetScreenSaver(), ProcGetScreenSaver(),
- ProcChangeHosts(), ProcListHosts(), ProcChangeAccessControl(),
- ProcChangeCloseDownMode(), ProcKillClient(),
- ProcRotateProperties(), ProcForceScreenSaver(),
- ProcSetModifierMapping(), ProcGetModifierMapping(),
- ProcNoOperation();
-
-extern int SProcSProcBadRequest(), SProcCreateWindow(),
- SProcChangeWindowAttributes(),
- SProcReparentWindow(), SProcConfigureWindow(),
- SProcInternAtom(), SProcChangeProperty(),
- SProcDeleteProperty(), SProcGetProperty(),
- SProcSetSelectionOwner(),
- SProcConvertSelection(),
- SProcSendEvent(), SProcGrabPointer(),
- SProcGrabButton(), SProcUngrabButton(), SProcChangeActivePointerGrab(),
- SProcGrabKeyboard(), SProcGrabKey(),
- SProcUngrabKey(), SProcGetMotionEvents(),
- SProcTranslateCoords(), SProcWarpPointer(), SProcSetInputFocus(),
- SProcOpenFont(),
- SProcListFonts(), SProcListFontsWithInfo(), SProcSetFontPath(),
- SProcCreatePixmap(),
- SProcCreateGC(), SProcChangeGC(), SProcCopyGC(),
- SProcSetDashes(), SProcSetClipRectangles(),
- SProcClearToBackground(), SProcCopyArea(), SProcCopyPlane(),
- SProcPoly(), SProcFillPoly(), SProcPutImage(),
- SProcGetImage(), SProcPolyText(),
- SProcImageText(), SProcCreateColormap(),
- SProcCopyColormapAndFree(), SProcAllocColor(),
- SProcAllocNamedColor(), SProcAllocColorCells(), SProcAllocColorPlanes(),
- SProcFreeColors(), SProcStoreColors(), SProcStoreNamedColor(),
- SProcQueryColors(), SProcLookupColor(), SProcCreateCursor(),
- SProcCreateGlyphCursor(), SProcRecolorCursor(),
- SProcQueryBestSize(), SProcQueryExtension(),
- SProcChangeKeyboardMapping(), SProcChangeKeyboardControl(),
- SProcChangePointerControl(),
- SProcSetScreenSaver(),
- SProcChangeHosts(),
- SProcRotateProperties(),
- SProcNoOperation(), SProcResourceReq(), SProcSimpleReq();
-
-extern void
- SErrorEvent(), NotImplemented(), SKeyButtonPtrEvent(), SEnterLeaveEvent(),
- SFocusEvent(), SKeymapNotifyEvent(), SExposeEvent(),
- SGraphicsExposureEvent(), SNoExposureEvent(), SVisibilityEvent(),
- SCreateNotifyEvent(), SDestroyNotifyEvent(), SUnmapNotifyEvent(),
- SMapNotifyEvent(), SMapRequestEvent(), SReparentEvent(),
- SConfigureNotifyEvent(), SConfigureRequestEvent(), SGravityEvent(),
- SResizeRequestEvent(), SCirculateEvent(),
- SPropertyEvent(), SSelectionClearEvent(), SSelectionRequestEvent(),
- SSelectionNotifyEvent(), SColormapEvent(), SClientMessageEvent(), SMappingEvent();
-
-extern void
- SGetWindowAttributesReply(), SGetGeometryReply(), SQueryTreeReply(),
- SInternAtomReply(), SGetAtomNameReply(), SGetPropertyReply(),
- SListPropertiesReply(),
- SGetSelectionOwnerReply(),
- SQueryPointerReply(), SGetMotionEventsReply(), STranslateCoordsReply(),
- SGetInputFocusReply(), SQueryKeymapReply(), SQueryFontReply(),
- SQueryTextExtentsReply(), SListFontsReply(), SListFontsWithInfoReply(),
- SGetFontPathReply(), SGetImageReply(), SListInstalledColormapsReply(),
- SAllocColorReply(), SAllocNamedColorReply(), SAllocColorCellsReply(),
- SAllocColorPlanesReply(), SQueryColorsReply(), SLookupColorReply(),
- SQueryBestSizeReply(), SListExtensionsReply(),
- SGetKeyboardMappingReply(), SGetKeyboardControlReply(),
- SGetPointerControlReply(), SGetScreenSaverReply(),
- SListHostsReply(), SGetPointerMappingReply(),
- SGetModifierMappingReply(), SGenericReply();
+#include "X.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "windowstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "dixevents.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#include "swapreq.h"
#ifdef K5AUTH
extern int
k5_stage1(), k5_stage2(), k5_stage3(), k5_bad();
#endif
-int (* InitialVector[3]) () =
+int (* InitialVector[3]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
{
0,
ProcInitialConnection,
ProcEstablishConnection
};
-int (* ProcVector[256]) () =
+int (* ProcVector[256]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
{
ProcBadRequest,
ProcCreateWindow,
@@ -299,7 +211,11 @@ int (* ProcVector[256]) () =
ProcNoOperation
};
-int (* SwappedProcVector[256]) () =
+int (* SwappedProcVector[256]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
{
ProcBadRequest,
SProcCreateWindow,
@@ -431,9 +347,9 @@ int (* SwappedProcVector[256]) () =
SProcNoOperation
};
-void (* EventSwapVector[128]) () =
+EventSwapPtr EventSwapVector[128] =
{
- SErrorEvent,
+ (EventSwapPtr)SErrorEvent,
NotImplemented,
SKeyButtonPtrEvent,
SKeyButtonPtrEvent,
@@ -471,137 +387,137 @@ void (* EventSwapVector[128]) () =
};
-void (* ReplySwapVector[256]) () =
+ReplySwapPtr ReplySwapVector[256] =
{
- NotImplemented,
- NotImplemented,
- NotImplemented,
- SGetWindowAttributesReply,
- NotImplemented,
- NotImplemented, /* 5 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 10 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- SGetGeometryReply,
- SQueryTreeReply, /* 15 */
- SInternAtomReply,
- SGetAtomNameReply,
- NotImplemented,
- NotImplemented,
- SGetPropertyReply, /* 20 */
- SListPropertiesReply,
- NotImplemented,
- SGetSelectionOwnerReply,
- NotImplemented,
- NotImplemented, /* 25 */
- SGenericReply, /* SGrabPointerReply, */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 30 */
- SGenericReply, /* SGrabKeyboardReply, */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 35 */
- NotImplemented,
- NotImplemented,
- SQueryPointerReply,
- SGetMotionEventsReply,
- STranslateCoordsReply, /* 40 */
- NotImplemented,
- NotImplemented,
- SGetInputFocusReply,
- SQueryKeymapReply,
- NotImplemented, /* 45 */
- NotImplemented,
- SQueryFontReply,
- SQueryTextExtentsReply,
- SListFontsReply,
- SListFontsWithInfoReply, /* 50 */
- NotImplemented,
- SGetFontPathReply,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 55 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 60 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 65 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 70 */
- NotImplemented,
- NotImplemented,
- SGetImageReply,
- NotImplemented,
- NotImplemented, /* 75 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 80 */
- NotImplemented,
- NotImplemented,
- SListInstalledColormapsReply,
- SAllocColorReply,
- SAllocNamedColorReply, /* 85 */
- SAllocColorCellsReply,
- SAllocColorPlanesReply,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 90 */
- SQueryColorsReply,
- SLookupColorReply,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 95 */
- NotImplemented,
- SQueryBestSizeReply,
- SGenericReply, /* SQueryExtensionReply, */
- SListExtensionsReply,
- NotImplemented, /* 100 */
- SGetKeyboardMappingReply,
- NotImplemented,
- SGetKeyboardControlReply,
- NotImplemented,
- NotImplemented, /* 105 */
- SGetPointerControlReply,
- NotImplemented,
- SGetScreenSaverReply,
- NotImplemented,
- SListHostsReply, /* 110 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 115 */
- SGenericReply, /* SetPointerMapping */
- SGetPointerMappingReply,
- SGenericReply, /* SetModifierMapping */
- SGetModifierMappingReply, /* 119 */
- NotImplemented, /* 120 */
- NotImplemented, /* 121 */
- NotImplemented, /* 122 */
- NotImplemented, /* 123 */
- NotImplemented, /* 124 */
- NotImplemented, /* 125 */
- NotImplemented, /* 126 */
- NotImplemented, /* NoOperation */
- NotImplemented
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetWindowAttributesReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 5 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 10 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetGeometryReply,
+ (ReplySwapPtr)SQueryTreeReply, /* 15 */
+ (ReplySwapPtr)SInternAtomReply,
+ (ReplySwapPtr)SGetAtomNameReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetPropertyReply, /* 20 */
+ (ReplySwapPtr)SListPropertiesReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetSelectionOwnerReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 25 */
+ (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 30 */
+ (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 35 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryPointerReply,
+ (ReplySwapPtr)SGetMotionEventsReply,
+ (ReplySwapPtr)STranslateCoordsReply, /* 40 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetInputFocusReply,
+ (ReplySwapPtr)SQueryKeymapReply,
+ ReplyNotSwappd, /* 45 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryFontReply,
+ (ReplySwapPtr)SQueryTextExtentsReply,
+ (ReplySwapPtr)SListFontsReply,
+ (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetFontPathReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 55 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 60 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 65 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 70 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetImageReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 75 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 80 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SListInstalledColormapsReply,
+ (ReplySwapPtr)SAllocColorReply,
+ (ReplySwapPtr)SAllocNamedColorReply, /* 85 */
+ (ReplySwapPtr)SAllocColorCellsReply,
+ (ReplySwapPtr)SAllocColorPlanesReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 90 */
+ (ReplySwapPtr)SQueryColorsReply,
+ (ReplySwapPtr)SLookupColorReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 95 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryBestSizeReply,
+ (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */
+ (ReplySwapPtr)SListExtensionsReply,
+ ReplyNotSwappd, /* 100 */
+ (ReplySwapPtr)SGetKeyboardMappingReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetKeyboardControlReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 105 */
+ (ReplySwapPtr)SGetPointerControlReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetScreenSaverReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SListHostsReply, /* 110 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 115 */
+ (ReplySwapPtr)SGenericReply, /* SetPointerMapping */
+ (ReplySwapPtr)SGetPointerMappingReply,
+ (ReplySwapPtr)SGenericReply, /* SetModifierMapping */
+ (ReplySwapPtr)SGetModifierMappingReply, /* 119 */
+ ReplyNotSwappd, /* 120 */
+ ReplyNotSwappd, /* 121 */
+ ReplyNotSwappd, /* 122 */
+ ReplyNotSwappd, /* 123 */
+ ReplyNotSwappd, /* 124 */
+ ReplyNotSwappd, /* 125 */
+ ReplyNotSwappd, /* 126 */
+ ReplyNotSwappd, /* NoOperation */
+ ReplyNotSwappd
};
#ifdef K5AUTH
diff --git a/dix/window.c b/dix/window.c
index b24c48376..30c0df032 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -48,6 +48,30 @@ SOFTWARE.
*/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/dix/window.c,v 3.32 2003/01/12 02:44:26 dawes Exp $ */
+
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
@@ -61,15 +85,27 @@ SOFTWARE.
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "dixevents.h"
+#include "globals.h"
+
#ifdef XAPPGROUP
-#include "extensions/Xagsrv.h"
+#include "Xagsrv.h"
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
-extern Bool permitOldBugs;
+#if defined(NEED_SCREEN_REGIONS)
+#define REGION_PTR(pScreen,pWin) \
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+#else
+#define REGION_PTR(pScreen,pWin) /* nothing */
+#endif
/******
* Window stuff for server
@@ -88,13 +124,12 @@ int screenIsSaved = SCREEN_SAVER_OFF;
ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
-extern WindowPtr *WindowTable;
-
+#if 0
extern void DeleteWindowFromAnyEvents();
extern Mask EventMaskForClient();
extern void WindowHasNewCursor();
extern void RecalculateDeliverableEvents();
-extern int rand();
+#endif
static Bool TileScreenSaver(
#if NeedFunctionPrototypes
@@ -220,12 +255,17 @@ WalkTree(pScreen, func, data)
int defaultBackingStore = NotUseful;
/* hack to force no backing store */
Bool disableBackingStore = FALSE;
+Bool enableBackingStore = FALSE;
/* hack to force no save unders */
Bool disableSaveUnders = FALSE;
static void
+#if NeedFunctionPrototypes
+SetWindowToDefaults(register WindowPtr pWin)
+#else
SetWindowToDefaults(pWin)
register WindowPtr pWin;
+#endif
{
pWin->prevSib = NullWindow;
pWin->firstChild = NullWindow;
@@ -260,8 +300,12 @@ SetWindowToDefaults(pWin)
}
static void
+#if NeedFunctionPrototypes
+MakeRootTile(WindowPtr pWin)
+#else
MakeRootTile(pWin)
WindowPtr pWin;
+#endif
{
ScreenPtr pScreen = pWin->drawable.pScreen;
GCPtr pGC;
@@ -270,13 +314,13 @@ MakeRootTile(pWin)
register unsigned char *from, *to;
register int i, j;
- pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, len, 4,
+ pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
pScreen->rootDepth);
pWin->backgroundState = BackgroundPixmap;
pGC = GetScratchGC(pScreen->rootDepth, pScreen);
if (!pWin->background.pixmap || !pGC)
- FatalError("cound not create root tile");
+ FatalError("could not create root tile");
{
CARD32 attributes[2];
@@ -296,6 +340,9 @@ MakeRootTile(pWin)
for (j = len; j > 0; j--)
*to++ = *from;
+ if (blackRoot)
+ bzero(back, sizeof(back));
+
(*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
0, 0, len, 4, 0, XYBitmap, (char *)back);
@@ -428,6 +475,8 @@ CreateRootWindow(pScreen)
if (disableBackingStore)
pScreen->backingStoreSupport = NotUseful;
+ if (enableBackingStore)
+ pScreen->backingStoreSupport = Always;
#ifdef DO_SAVE_UNDERS
if ((pScreen->backingStoreSupport != NotUseful) &&
@@ -483,7 +532,7 @@ ClippedRegionFromBox(pWin, Rgn, x, y, w, h)
register int x, y;
int w, h;
{
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
BoxRec box;
box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
@@ -571,9 +620,8 @@ CreateWindow(wid, pParent, x, y, w, h, bw, class, vmask, vlist,
}
pScreen = pParent->drawable.pScreen;
-
if ((class == InputOutput) && (depth == 0))
- depth = pParent->drawable.depth;
+ depth = pParent->drawable.depth;
ancwopt = pParent->optional;
if (!ancwopt)
ancwopt = FindWindowWithOptional(pParent)->optional;
@@ -768,17 +816,18 @@ CreateWindow(wid, pParent, x, y, w, h, bw, class, vmask, vlist,
event.u.createNotify.override = pWin->overrideRedirect;
DeliverEvents(pParent, &event, 1, NullWindow);
}
-
return pWin;
}
static void
+#if NeedFunctionPrototypes
+FreeWindowResources(register WindowPtr pWin)
+#else
FreeWindowResources(pWin)
register WindowPtr pWin;
+#endif
{
- register ScreenPtr pScreen;
-
- pScreen = pWin->drawable.pScreen;
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
DeleteWindowFromAnySaveSet(pWin);
DeleteWindowFromAnySelections(pWin);
@@ -805,11 +854,15 @@ FreeWindowResources(pWin)
}
static void
+#if NeedFunctionPrototypes
+CrushTree(WindowPtr pWin)
+#else
CrushTree(pWin)
WindowPtr pWin;
+#endif
{
register WindowPtr pChild, pSib, pParent;
- Bool (* UnrealizeWindow)();
+ UnrealizeWindowProcPtr UnrealizeWindow;
xEvent event;
if (!(pChild = pWin->firstChild))
@@ -937,7 +990,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
XID *vlist;
ClientPtr client;
{
- register Mask index;
+ register Mask index2;
register XID *pVlist;
PixmapPtr pPixmap;
Pixmap pixID;
@@ -966,9 +1019,9 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
tmask = vmask;
while (tmask)
{
- index = (Mask) lowbit (tmask);
- tmask &= ~index;
- switch (index)
+ index2 = (Mask) lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
{
case CWBackPixmap:
pixID = (Pixmap )*pVlist;
@@ -992,7 +1045,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
}
else
{ /* didn't change the background to None, so don't tell ddx */
- index = 0;
+ index2 = 0;
}
#endif
}
@@ -1068,7 +1121,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
pWin->border = pWin->parent->border;
if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE)
{
- index = CWBorderPixel;
+ index2 = CWBorderPixel;
}
else
{
@@ -1146,14 +1199,14 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
pWin->forcedBS = FALSE;
break;
case CWBackingPlanes:
- if (pWin->optional || ((CARD32)*pVlist != ~0L)) {
+ if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {
if (!pWin->optional && !MakeWindowOptional (pWin))
{
error = BadAlloc;
goto PatchUp;
}
pWin->optional->backingBitPlanes = (CARD32) *pVlist;
- if ((CARD32)*pVlist == ~0L)
+ if ((CARD32)*pVlist == (CARD32)~0L)
checkOptional = TRUE;
}
pVlist++;
@@ -1267,7 +1320,8 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
*/
win_owner = clients[CLIENT_ID(pWin->drawable.id)];
- if (win_owner->appgroup && !pWin->parent->parent &&
+ if ( win_owner && win_owner->appgroup &&
+ !pWin->parent->parent &&
(ag_colormap = XagDefaultColormap (win_owner)))
cmap = ag_colormap;
else
@@ -1338,7 +1392,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
if (pChild->optional->colormap == cmap)
CheckWindowOptionalNeed (pChild);
}
-
+
xE.u.u.type = ColormapNotify;
xE.u.colormap.window = pWin->drawable.id;
xE.u.colormap.colormap = cmap;
@@ -1440,7 +1494,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
client->errorValue = vmask;
goto PatchUp;
}
- vmaskCopy |= index;
+ vmaskCopy |= index2;
}
PatchUp:
if (checkOptional)
@@ -1521,6 +1575,8 @@ MoveWindowInStack(pWin, pNextSib)
if (pWin->nextSib != pNextSib)
{
+ WindowPtr pOldNextSib = pWin->nextSib;
+
if (!pNextSib) /* move to bottom */
{
if (pParent->firstChild == pWin)
@@ -1577,6 +1633,8 @@ MoveWindowInStack(pWin, pNextSib)
pFirstChange = pFirstChange->nextSib;
}
}
+ if(pWin->drawable.pScreen->RestackWindow)
+ (*pWin->drawable.pScreen->RestackWindow)(pWin, pOldNextSib);
}
return( pFirstChange );
@@ -1596,7 +1654,7 @@ CreateUnclippedWinSize (pWin)
pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x,
- pWin->drawable.y);
@@ -1620,7 +1678,7 @@ SetWinSize (pWin)
(int)pWin->drawable.height);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
- pWin->drawable.y);
@@ -1650,7 +1708,7 @@ SetBorderSize (pWin)
(int)(pWin->drawable.height + (bw<<1)));
#ifdef SHAPE
if (wBoundingShape (pWin)) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
- pWin->drawable.y);
@@ -1760,6 +1818,7 @@ ResizeChildrenWinSize(pWin, dx, dy, dw, dh)
SetWinSize (pSib);
SetBorderSize (pSib);
(*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
+
if ( (pChild = pSib->firstChild) )
{
while (1)
@@ -1817,8 +1876,14 @@ ResizeChildrenWinSize(pWin, dx, dy, dw, dh)
*/
static int
+#if NeedFunctionPrototypes
+IsSiblingAboveMe(
+ register WindowPtr pMe,
+ register WindowPtr pSib)
+#else
IsSiblingAboveMe(pMe, pSib)
register WindowPtr pMe, pSib;
+#endif
{
register WindowPtr pWin;
@@ -1835,9 +1900,15 @@ IsSiblingAboveMe(pMe, pSib)
}
static BoxPtr
+#if NeedFunctionPrototypes
+WindowExtents(
+ register WindowPtr pWin,
+ register BoxPtr pBox)
+#else
WindowExtents(pWin, pBox)
register WindowPtr pWin;
register BoxPtr pBox;
+#endif
{
pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
@@ -1852,12 +1923,18 @@ WindowExtents(pWin, pBox)
#define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL)
static RegionPtr
+#if NeedFunctionPrototypes
+MakeBoundingRegion (
+ register WindowPtr pWin,
+ BoxPtr pBox)
+#else
MakeBoundingRegion (pWin, pBox)
register WindowPtr pWin;
BoxPtr pBox;
+#endif
{
RegionPtr pRgn;
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
pRgn = REGION_CREATE(pScreen, pBox, 1);
if (wBoundingShape (pWin)) {
@@ -1871,9 +1948,17 @@ MakeBoundingRegion (pWin, pBox)
}
static Bool
+#if NeedFunctionPrototypes
+ShapeOverlap (
+ WindowPtr pWin,
+ BoxPtr pWinBox,
+ WindowPtr pSib,
+ BoxPtr pSibBox)
+#else
ShapeOverlap (pWin, pWinBox, pSib, pSibBox)
WindowPtr pWin, pSib;
BoxPtr pWinBox, pSibBox;
+#endif
{
RegionPtr pWinRgn, pSibRgn;
register ScreenPtr pScreen;
@@ -1893,9 +1978,16 @@ ShapeOverlap (pWin, pWinBox, pSib, pSibBox)
#endif
static Bool
+#if NeedFunctionPrototypes
+AnyWindowOverlapsMe(
+ WindowPtr pWin,
+ WindowPtr pHead,
+ register BoxPtr box)
+#else
AnyWindowOverlapsMe(pWin, pHead, box)
WindowPtr pWin, pHead;
register BoxPtr box;
+#endif
{
register WindowPtr pSib;
BoxRec sboxrec;
@@ -1918,9 +2010,15 @@ AnyWindowOverlapsMe(pWin, pHead, box)
}
static Bool
+#if NeedFunctionPrototypes
+IOverlapAnyWindow(
+ WindowPtr pWin,
+ register BoxPtr box)
+#else
IOverlapAnyWindow(pWin, box)
WindowPtr pWin;
register BoxPtr box;
+#endif
{
register WindowPtr pSib;
BoxRec sboxrec;
@@ -1971,11 +2069,22 @@ IOverlapAnyWindow(pWin, box)
*/
static WindowPtr
+#if NeedFunctionPrototypes
+WhereDoIGoInTheStack(
+ register WindowPtr pWin,
+ register WindowPtr pSib,
+ short x,
+ short y,
+ unsigned short w,
+ unsigned short h,
+ int smode)
+#else
WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode)
register WindowPtr pWin, pSib;
short x, y;
unsigned short w, h;
int smode;
+#endif
{
BoxRec box;
register ScreenPtr pScreen;
@@ -2074,9 +2183,16 @@ WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode)
}
static void
+#if NeedFunctionPrototypes
+ReflectStackChange(
+ register WindowPtr pWin,
+ register WindowPtr pSib,
+ VTKind kind)
+#else
ReflectStackChange(pWin, pSib, kind)
register WindowPtr pWin, pSib;
VTKind kind;
+#endif
{
/* Note that pSib might be NULL */
@@ -2140,8 +2256,8 @@ ConfigureWindow(pWin, mask, vlist, client)
#define REBORDER_WIN 3
register WindowPtr pSib = NullWindow;
register WindowPtr pParent = pWin->parent;
- Window sibwid;
- Mask index, tmask;
+ Window sibwid = 0;
+ Mask index2, tmask;
register XID *pVlist;
short x, y, beforeX, beforeY;
unsigned short w = pWin->drawable.width,
@@ -2198,9 +2314,9 @@ ConfigureWindow(pWin, mask, vlist, client)
tmask = mask & ~ChangeMask;
while (tmask)
{
- index = (Mask)lowbit (tmask);
- tmask &= ~index;
- switch (index)
+ index2 = (Mask)lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
{
case CWBorderWidth:
GET_CARD16(CWBorderWidth, bw);
@@ -2273,6 +2389,12 @@ ConfigureWindow(pWin, mask, vlist, client)
event.u.u.detail = Above;
event.u.configureRequest.x = x;
event.u.configureRequest.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureRequest.x += panoramiXdataPtr[0].x;
+ event.u.configureRequest.y += panoramiXdataPtr[0].y;
+ }
+#endif
event.u.configureRequest.width = w;
event.u.configureRequest.height = h;
event.u.configureRequest.borderWidth = bw;
@@ -2350,6 +2472,12 @@ ActuallyDoSomething:
event.u.configureNotify.aboveSibling = None;
event.u.configureNotify.x = x;
event.u.configureNotify.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureNotify.x += panoramiXdataPtr[0].x;
+ event.u.configureNotify.y += panoramiXdataPtr[0].y;
+ }
+#endif
event.u.configureNotify.width = w;
event.u.configureNotify.height = h;
event.u.configureNotify.borderWidth = bw;
@@ -2383,7 +2511,6 @@ ActuallyDoSomething:
if (action != RESTACK_WIN)
CheckCursorConfinement(pWin);
-
return(Success);
#undef RESTACK_WIN
#undef MOVE_WIN
@@ -2461,9 +2588,15 @@ CirculateWindow(pParent, direction, client)
}
static int
+#if NeedFunctionPrototypes
+CompareWIDs(
+ WindowPtr pWin,
+ pointer value) /* must conform to VisitWindowProcPtr */
+#else
CompareWIDs(pWin, value)
WindowPtr pWin;
pointer value; /* must conform to VisitWindowProcPtr */
+#endif
{
Window *wid = (Window *)value;
@@ -2503,6 +2636,12 @@ ReparentWindow(pWin, pParent, x, y, client)
event.u.reparent.parent = pParent->drawable.id;
event.u.reparent.x = x;
event.u.reparent.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && !pParent->parent) {
+ event.u.reparent.x += panoramiXdataPtr[0].x;
+ event.u.reparent.y += panoramiXdataPtr[0].y;
+ }
+#endif
event.u.reparent.override = pWin->overrideRedirect;
DeliverEvents(pWin, &event, 1, pParent);
@@ -2566,11 +2705,15 @@ ReparentWindow(pWin, pParent, x, y, client)
}
static void
+#if NeedFunctionPrototypes
+RealizeTree(WindowPtr pWin)
+#else
RealizeTree(pWin)
WindowPtr pWin;
+#endif
{
register WindowPtr pChild;
- Bool (* Realize)();
+ RealizeWindowProcPtr Realize;
Realize = pWin->drawable.pScreen->RealizeWindow;
pChild = pWin;
@@ -2854,9 +2997,15 @@ MapSubwindows(pParent, client)
}
static void
+#if NeedFunctionPrototypes
+UnrealizeTree(
+ WindowPtr pWin,
+ Bool fromConfigure)
+#else
UnrealizeTree(pWin, fromConfigure)
WindowPtr pWin;
Bool fromConfigure;
+#endif
{
register WindowPtr pChild;
UnrealizeWindowProcPtr Unrealize;
@@ -2871,6 +3020,15 @@ UnrealizeTree(pWin, fromConfigure)
{
pChild->realized = FALSE;
pChild->visibility = VisibilityNotViewable;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
+ PanoramiXRes *win;
+ win = (PanoramiXRes*)LookupIDByType(pChild->drawable.id,
+ XRT_WINDOW);
+ if(win)
+ win->u.win.visibility = VisibilityNotViewable;
+ }
+#endif
(* Unrealize)(pChild);
DeleteWindowFromAnyEvents(pChild, FALSE);
if (pChild->viewable)
@@ -2978,7 +3136,7 @@ UnmapSubwindows(pWin)
Bool wasViewable = (Bool)pWin->viewable;
Bool anyMarked = FALSE;
Mask parentNotify;
- WindowPtr pLayerWin;
+ WindowPtr pLayerWin = NULL;
ScreenPtr pScreen = pWin->drawable.pScreen;
if (!pWin->firstChild)
@@ -3139,15 +3297,71 @@ NotClippedByChildren(pWin)
return(pReg);
}
-
void
SendVisibilityNotify(pWin)
WindowPtr pWin;
{
xEvent event;
+ unsigned int visibility = pWin->visibility;
+
+#ifdef PANORAMIX
+ /* This is not quite correct yet, but it's close */
+ if(!noPanoramiXExtension) {
+ PanoramiXRes *win;
+ WindowPtr pWin2;
+ int i, Scrnum;
+
+ Scrnum = pWin->drawable.pScreen->myNum;
+
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum);
+
+ if(!win || (win->u.win.visibility == visibility))
+ return;
+
+ switch(visibility) {
+ case VisibilityUnobscured:
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ if(i == Scrnum) continue;
+
+ pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW);
+
+ if (pWin2) {
+ if(pWin2->visibility == VisibilityPartiallyObscured)
+ return;
+
+ if(!i) pWin = pWin2;
+ }
+ }
+ break;
+ case VisibilityPartiallyObscured:
+ if(Scrnum) {
+ pWin2 = (WindowPtr)LookupIDByType(win->info[0].id, RT_WINDOW);
+ if (pWin2) pWin = pWin2;
+ }
+ break;
+ case VisibilityFullyObscured:
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ if(i == Scrnum) continue;
+
+ pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW);
+
+ if (pWin2) {
+ if(pWin2->visibility != VisibilityFullyObscured)
+ return;
+
+ if(!i) pWin = pWin2;
+ }
+ }
+ break;
+ }
+
+ win->u.win.visibility = visibility;
+ }
+#endif
+
event.u.u.type = VisibilityNotify;
event.u.visibility.window = pWin->drawable.id;
- event.u.visibility.state = pWin->visibility;
+ event.u.visibility.state = visibility;
DeliverEvents(pWin, &event, 1, NullWindow);
}
@@ -3155,7 +3369,6 @@ SendVisibilityNotify(pWin)
#define RANDOM_WIDTH 32
#ifndef NOLOGOHACK
-extern int logoScreenSaver;
static void DrawLogo(
#if NeedFunctionPrototypes
WindowPtr /*pWin*/
@@ -3237,6 +3450,15 @@ SaveScreens(on, mode)
#endif
screenIsSaved = SCREEN_SAVER_ON;
}
+ /*
+ * Call the DDX saver in case it wants to do something
+ * at cycle time
+ */
+ else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ {
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
+ type);
+ }
break;
case SCREEN_SAVER_ON:
if (ScreenSaverBlanking != DontPreferBlanking)
@@ -3268,9 +3490,13 @@ SaveScreens(on, mode)
}
static Bool
+#if NeedFunctionPrototypes
+TileScreenSaver(int i, int kind)
+#else
TileScreenSaver(i, kind)
int i;
int kind;
+#endif
{
int j;
int result;
@@ -3280,7 +3506,7 @@ TileScreenSaver(i, kind)
CursorMetricRec cm;
unsigned char *srcbits, *mskbits;
CursorPtr cursor;
- XID cursorID;
+ XID cursorID = 0;
int attri;
mask = 0;
@@ -3510,17 +3736,40 @@ DisposeWindowOptional (pWin)
* everything is peachy. Delete the optional record
* and clean up
*/
- if (pWin->cursorIsNone == FALSE)
+ /*
+ * TOG changed this code to:
+ *
+ * if (pWin->cursorIsNone == FALSE)
+ * FreeCursor (pWin->optional->cursor, (Cursor)0);
+ * pWin->cursorIsNone = TRUE;
+ *
+ * This is blatently wrong; windows without optionals can have
+ * two different cursor values, either None or sharing their
+ * parents cursor. This difference is controlled by the
+ * cursorIsNone value; when TRUE, the window has no cursor,
+ * when false, it shares its cursor with its parent; TOG
+ * made it impossible for a window to have a cursor without
+ * an optional record.
+ */
+ if (pWin->optional->cursor)
+ {
FreeCursor (pWin->optional->cursor, (Cursor)0);
- pWin->cursorIsNone = TRUE;
+ pWin->cursorIsNone = FALSE;
+ }
+ else
+ pWin->cursorIsNone = TRUE;
xfree (pWin->optional);
pWin->optional = NULL;
}
#ifndef NOLOGOHACK
static void
+#if NeedFunctionPrototypes
+DrawLogo(WindowPtr pWin)
+#else
DrawLogo(pWin)
WindowPtr pWin;
+#endif
{
DrawablePtr pDraw;
ScreenPtr pScreen;
diff --git a/dix/xpstubs.c b/dix/xpstubs.c
index 2702b453d..a48a81402 100644
--- a/dix/xpstubs.c
+++ b/dix/xpstubs.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/xpstubs.c,v 1.4 2001/12/20 19:41:00 tsi Exp $ */
/*
Copyright 1996, 1998 The Open Group
@@ -43,7 +44,6 @@ XpClientIsPrintClient(client, fpe)
{
return FALSE;
}
-
int
XprintOptions(argc, argv, i)
int argc;
diff --git a/doc/Xserver.man.pre b/doc/Xserver.man.pre
index 75cc34c4c..d57fde80e 100644
--- a/doc/Xserver.man.pre
+++ b/doc/Xserver.man.pre
@@ -1,15 +1,15 @@
.\" $Xorg: Xserver.man,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $
.\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group
-.\"
+.\"
.\" 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.
-.\"
+.\"
.\" 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.
@@ -17,12 +17,13 @@
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
-.\"
+.\"
.\" Except as contained in this notice, the name of The Open Group 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 Open Group.
-.TH XSERVER 1 "Release 6.4" "X Version 11"
+.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.21 2002/11/19 23:18:09 dawes Exp $
+.TH XSERVER 1 __xorgversion__
.SH NAME
Xserver \- X Window System display server
.SH SYNOPSIS
@@ -34,13 +35,13 @@ is the generic name for the X Window System display server. It is
frequently a link or a copy of the appropriate server binary for
driving the most frequently used server on a given machine.
.SH "STARTING THE SERVER"
-The X server is usually started from the X Display Manager program \fIxdm(1)\fP.
+The X server is usually started from the X Display Manager program \fIxdm\fP(1).
This utility is run from the system boot files and takes care of keeping
the server running, prompting for usernames and passwords, and starting up
the user sessions.
.PP
Installations that run more than one window system may need to use the
-\fIxinit(1)\fP utility instead of \fIxdm\fP. However, \fIxinit\fP is
+\fIxinit\fP(1) utility instead of \fIxdm\fP. However, \fIxinit\fP is
to be considered a tool for building startup scripts and is not
intended for use by end users. Site administrators are \fBstrongly\fP
urged to use \fIxdm\fP, or build other interfaces for novice users.
@@ -49,20 +50,24 @@ The X server may also be started directly by the user, though this
method is usually reserved for testing and is not recommended for
normal operation. On some platforms, the user must have special
permission to start the X server, often because access to certain
-devices (e.g. /dev/mouse) is restricted.
+devices (e.g. \fI/dev/mouse\fP) is restricted.
.PP
When the X server starts up, it typically takes over the display. If
you are running on a workstation whose console is the display, you may
not be able to log into the console while the server is running.
.SH OPTIONS
+Many X servers have device-specific command line options. See the manual
+pages for the individual servers for more details; a list of
+server-specific manual pages is provided in the SEE ALSO section below.
+.PP
All of the X servers accept the following command line options:
.TP 8
.B :\fIdisplaynumber\fP
-the X server runs as the given \fIdisplaynumber\fP, which by default is 0.
+The X server runs as the given \fIdisplaynumber\fP, which by default is 0.
If multiple X servers are to run simultaneously on a host, each must have
a unique display number. See the DISPLAY
-NAMES section of the \fIX(1)\fP manual page to learn how to specify
-which display number clients should try to use.
+NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to
+specify which display number clients should try to use.
.TP 8
.B \-a \fInumber\fP
sets pointer acceleration (i.e. the ratio of how much is reported to how much
@@ -75,7 +80,7 @@ Use with extreme caution.
This option exists primarily for running test suites remotely.
.TP 8
.B \-audit \fIlevel\fP
-Sets the audit trail level. The default level is 1, meaning only connection
+sets the audit trail level. The default level is 1, meaning only connection
rejections are reported. Level 2 additionally reports all successful
connections and disconnects. Level 4 enables messages from the
SECURITY extension, if present, including generation and revocation of
@@ -84,7 +89,7 @@ Level 0 turns off the audit trail.
Audit lines are sent as standard error output.
.TP 8
.B \-auth \fIauthorization-file\fP
-Specifies a file which contains a collection of authorization records used
+specifies a file which contains a collection of authorization records used
to authenticate access. See also the \fIxdm\fP and \fIXsecurity\fP manual
pages.
.TP 8
@@ -96,6 +101,10 @@ Deprecated.
.B \-bs
disables backing store support on all screens.
.TP 8
+.B \-br
+sets the default root window to solid black instead of the standard root weave
+pattern.
+.TP 8
.B \-c
turns off key-click.
.TP 8
@@ -108,14 +117,19 @@ The class numbers are as specified in the X protocol.
Not obeyed by all servers.
.TP 8
.B \-co \fIfilename\fP
-sets name of RGB color database. The default is <XRoot>/lib/X11/rgb,
-where <XRoot> refers to the root of the X11 install tree.
+sets name of RGB color database. The default is
+\fI__projectroot__/lib/X11/rgb\fP.
+.ig
.TP 8
.B \-config \fIfilename\fP
reads more options from the given file. Options in the file may be separated
by newlines if desired. If a '#' character appears on a line, all characters
between it and the next newline are ignored, providing a simple commenting
facility. The \fB\-config\fP option itself may appear in the file.
+.BR NOTE :
+This option is disabled when the Xserver is run with an effective uid
+different from the user's real uid.
+..
.TP 8
.B \-core
causes the server to generate a core dump on fatal errors.
@@ -148,8 +162,16 @@ prints a usage message.
.B \-I
causes all remaining command line arguments to be ignored.
.TP 8
-.B \-kb
-disables the XKEYBOARD extension if present.
+.B \-nolisten \fItrans-type\fP
+disables a transport type. For example, TCP/IP connections can be disabled
+with
+.BR "\-nolisten tcp" .
+.TP 8
+.B \-noreset
+prevents a server reset when the last client connection is closed. This
+overrides a previous
+.B \-terminate
+command line option.
.TP 8
.B \-p \fIminutes\fP
sets screen-saver pattern cycle time in minutes.
@@ -177,6 +199,9 @@ pointer acceleration should take effect).
.TP 8
.B \-terminate
causes the server to terminate at server reset, instead of continuing to run.
+This overrides a previous
+.B \-noreset
+command line option.
.TP 8
.B \-to \fIseconds\fP
sets default connection timeout in seconds.
@@ -209,7 +234,8 @@ loads the specified extension at init.
This is a no-op for most implementations.
.TP 8
.B [+-]xinerama
-enable(+) or disable(-) XINERAMA extension. Default is disabled.
+enables(+) or disables(-) the XINERAMA extension. The default state is
+disabled.
.SH SERVER DEPENDENT OPTIONS
Some X servers accept the following options:
.TP 8
@@ -240,23 +266,36 @@ X servers that support XDMCP have the following options.
See the \fIX Display Manager Control Protocol\fP specification for more
information.
.TP 8
-.B \-query \fIhost-name\fP
-Enable XDMCP and send Query packets to the specified host.
+.B \-query \fIhostname\fP
+enables XDMCP and sends Query packets to the specified
+.IR hostname .
.TP 8
.B \-broadcast
-Enable XDMCP and broadcast BroadcastQuery packets to the network. The
+enable XDMCP and broadcasts BroadcastQuery packets to the network. The
first responding display manager will be chosen for the session.
.TP 8
-.B \-indirect \fIhost-name\fP
-Enable XDMCP and send IndirectQuery packets to the specified host.
+.B \-indirect \fIhostname\fP
+enables XDMCP and send IndirectQuery packets to the specified
+.IR hostname .
+.TP 8
+.B \-port \fIport-number\fP
+uses the specified \fIport-number\fP for XDMCP packets, instead of the
+default. This option must be specified before any \-query, \-broadcast or
+\-indirect options.
.TP 8
-.B \-port \fIport-num\fP
-Use an alternate port number for XDMCP packets. Must be specified before
-any \-query, \-broadcast or \-indirect options.
+.B \-from \fIlocal-address\fP
+specifies the local address to connect from (useful if the connecting host
+has multiple network interfaces). The \fIlocal-address\fP may be expressed
+in any form acceptable to the host platform's \fIgethostbyname\fP(3)
+implementation.
+.TP 8
+.B \-once
+causes the server to terminate (rather than reset) when the XDMCP session
+ends.
.TP 8
.B \-class \fIdisplay-class\fP
XDMCP has an additional display qualifier used in resource lookup for
-display-specific options. This option sets that value, by default it
+display-specific options. This option sets that value, by default it
is "MIT-Unspecified" (not a very useful value).
.TP 8
.B \-cookie \fIxdm-auth-bits\fP
@@ -268,35 +307,43 @@ data (not that it is very private, being on the command line!).
Yet another XDMCP specific value, this one allows the display manager to
identify each display so that it can locate the shared key.
.SH XKEYBOARD OPTIONS
-X servers that support the XKEYBOARD extension accept the following options:
+X servers that support the XKEYBOARD (a.k.a. \(oqXKB\(cq) extension accept the
+following options:
.TP 8
-.B \-xkbdir \fIdirectory\fP
-base directory for keyboard layout files
+.B [+-]kb
+enables(+) or disables(-) the XKEYBOARD extension.
.TP 8
-.B \-xkbmap \fIfilename\fP
-keyboard description to load on startup
+.BR [+-]accessx " [ \fItimeout\fP [ \fItimeout_mask\fP [ \fIfeedback\fP [ \fIoptions_mask\fP ] ] ] ]"
+enables(+) or disables(-) AccessX key sequences.
.TP 8
-.B [+-]accessx
-enable(+) or disable(-) AccessX key sequences
+.B \-xkbdir \fIdirectory\fP
+base directory for keyboard layout files. This option is not available
+for setuid X servers (i.e., when the X server's real and effective uids
+are different).
.TP 8
.B \-ar1 \fImilliseconds\fP
-sets the length of time in milliseconds that a key must be depressed before
-autorepeat starts
+sets the autorepeat delay (length of time in milliseconds that a key must
+be depressed before autorepeat starts).
.TP 8
.B \-ar2 \fImilliseconds\fP
-sets the length of time in milliseconds that should elapse between
-autorepeat-generated keystrokes
-.PP
-Many servers also have device-specific command line options. See the
-manual pages for the individual servers for more details.
+sets the autorepeat interval (length of time in milliseconds that should
+elapse between autorepeat-generated keystrokes).
+.TP 8
+.B \-noloadxkb
+disables loading of an XKB keymap description on server startup.
+.TP 8
+.B \-xkbdb \fIfilename\fP
+uses \fIfilename\fP for default keyboard keymaps.
+.TP 8
+.B \-xkbmap \fIfilename\fP
+loads keyboard description in \fIfilename\fP on server startup.
.SH SECURITY EXTENSION OPTIONS
X servers that support the SECURITY extension accept the following option:
.TP 8
.B \-sp \fIfilename\fP
-causes
-the server to attempt to read and interpret filename as a security policy
-file with the format described below. The file is read at
-server startup and reread at each server reset.
+causes the server to attempt to read and interpret filename as a security
+policy file with the format described below. The file is read at server
+startup and reread at each server reset.
.PP
The syntax of the security policy file is as follows.
Notation: "*" means zero or more occurrences of the preceding element,
@@ -442,14 +489,14 @@ Here is an example security policy file.
.PP
.ta 3i 4i
.nf
-version-1
+version-1
-# Allow reading of application resources, but not writing.
+XCOMM Allow reading of application resources, but not writing.
property RESOURCE_MANAGER root ar iw
property SCREEN_RESOURCES root ar iw
-# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
-# and allowing access may give away too much information.
+XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
+XCOMM and allowing access may give away too much information.
property CUT_BUFFER0 root irw
property CUT_BUFFER1 root irw
property CUT_BUFFER2 root irw
@@ -459,31 +506,31 @@ property CUT_BUFFER5 root irw
property CUT_BUFFER6 root irw
property CUT_BUFFER7 root irw
-# If you are using Motif, you probably want these.
+XCOMM If you are using Motif, you probably want these.
property _MOTIF_DEFAULT_BINDINGS root ar iw
property _MOTIF_DRAG_WINDOW root ar iw
property _MOTIF_DRAG_TARGETS any ar iw
property _MOTIF_DRAG_ATOMS any ar iw
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
-# The next two rules let xwininfo -tree work when untrusted.
+XCOMM The next two rules let xwininfo -tree work when untrusted.
property WM_NAME any ar
-# Allow read of WM_CLASS, but only for windows with WM_NAME.
-# This might be more restrictive than necessary, but demonstrates
-# the <required property> facility, and is also an attempt to
-# say "top level windows only."
+XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
+XCOMM This might be more restrictive than necessary, but demonstrates
+XCOMM the <required property> facility, and is also an attempt to
+XCOMM say "top level windows only."
property WM_CLASS WM_NAME ar
-# These next three let xlsclients work untrusted. Think carefully
-# before including these; giving away the client machine name and command
-# may be exposing too much.
+XCOMM These next three let xlsclients work untrusted. Think carefully
+XCOMM before including these; giving away the client machine name and command
+XCOMM may be exposing too much.
property WM_STATE WM_NAME ar
property WM_CLIENT_MACHINE WM_NAME ar
property WM_COMMAND WM_NAME ar
-# To let untrusted clients use the standard colormaps created by
-# xstdcmap, include these lines.
+XCOMM To let untrusted clients use the standard colormaps created by
+XCOMM xstdcmap, include these lines.
property RGB_DEFAULT_MAP root ar
property RGB_BEST_MAP root ar
property RGB_RED_MAP root ar
@@ -491,24 +538,24 @@ property RGB_GREEN_MAP root ar
property RGB_BLUE_MAP root ar
property RGB_GRAY_MAP root ar
-# To let untrusted clients use the color management database created
-# by xcmsdb, include these lines.
+XCOMM To let untrusted clients use the color management database created
+XCOMM by xcmsdb, include these lines.
property XDCCC_LINEAR_RGB_CORRECTION root ar
property XDCCC_LINEAR_RGB_MATRICES root ar
property XDCCC_GRAY_SCREENWHITEPOINT root ar
property XDCCC_GRAY_CORRECTION root ar
-# To let untrusted clients use the overlay visuals that many vendors
-# support, include this line.
+XCOMM To let untrusted clients use the overlay visuals that many vendors
+XCOMM support, include this line.
property SERVER_OVERLAY_VISUALS root ar
-# Dumb examples to show other capabilities.
+XCOMM Dumb examples to show other capabilities.
-# oddball property names and explicit specification of error conditions
+XCOMM oddball property names and explicit specification of error conditions
property "property with spaces" 'property with "' aw er ed
-# Allow deletion of Woo-Hoo if window also has property OhBoy with value
-# ending in "son". Reads and writes will cause an error.
+XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
+XCOMM ending in "son". Reads and writes will cause an error.
property Woo-Hoo OhBoy = "*son" ad
.fi
@@ -516,13 +563,13 @@ property Woo-Hoo OhBoy = "*son" ad
The X server supports client connections via a platform-dependent subset of
the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
and several varieties of SVR4 local connections. See the DISPLAY
-NAMES section of the \fIX(1)\fP manual page to learn how to specify
-which transport type clients should try to use.
+NAMES section of the \fIX(__miscmansuffix__)\fP manual page to learn how to
+specify which transport type clients should try to use.
.SH GRANTING ACCESS
The X server implements a platform-dependent subset of the following
authorization protocols: MIT-MAGIC-COOKIE-1, XDM-AUTHORIZATION-1,
-SUN-DES-1, and MIT-KERBEROS-5. See the \fIXsecurity(1)\fP manual page
-for information on the operation of these protocols.
+SUN-DES-1, and MIT-KERBEROS-5. See the \fIXsecurity\fP(__miscmansuffix__)
+manual page for information on the operation of these protocols.
.PP
Authorization data required by the above protocols is passed to the
server in a private file named with the \fB\-auth\fP command line
@@ -533,7 +580,7 @@ automatically allowed access to the server, and only clients which
send one of the authorization records contained in the file in the
connection setup information will be allowed access. See the
\fIXau\fP manual page for a description of the binary format of this
-file. See \fIxauth(1)\fP for maintenance of this file, and distribution
+file. See \fIxauth\fP(1) for maintenance of this file, and distribution
of its contents to remote hosts.
.PP
The X server also uses a host-based access control list for deciding
@@ -547,7 +594,7 @@ hostname in double colon format (e.g. hydra::). There should be no leading
or trailing spaces on any lines. For example:
.sp
.in +8
-.nf
+.nf
joesworkstation
corporate.company.com
star::
@@ -559,20 +606,20 @@ Users can add or remove hosts from this list and enable or disable access
control using the \fIxhost\fP command from the same machine as the server.
.PP
If the X FireWall Proxy (\fIxfwp\fP) is being used without a sitepolicy,
-host-based authorization must be turned on for clients to be able to
-connect to the X server via the \fIxfwp\fP. If \fIxfwp\fP is run without
-a configuration file and thus no sitepolicy is defined, if \fIxfwp\fP
-is using an X server where xhost + has been run to turn off host-based
-authorization checks, when a client tries to connect to this X server
-via \fIxfwp\fP, the X server will deny the connection. See \fIxfwp(1)\fP
+host-based authorization must be turned on for clients to be able to
+connect to the X server via the \fIxfwp\fP. If \fIxfwp\fP is run without
+a configuration file and thus no sitepolicy is defined, if \fIxfwp\fP
+is using an X server where xhost + has been run to turn off host-based
+authorization checks, when a client tries to connect to this X server
+via \fIxfwp\fP, the X server will deny the connection. See \fIxfwp\fP(1)
for more information about this proxy.
.PP
The X protocol intrinsically does not have any notion of window operation
permissions or place any restrictions on what a client can do; if a program can
-connect to a display, it has full run of the screen.
+connect to a display, it has full run of the screen.
X servers that support the SECURITY extension fare better because clients
can be designated untrusted via the authorization they use to connect; see
-the \fIxauth(1)\fP manual page for details. Restrictions are imposed
+the \fIxauth\fP(1) manual page for details. Restrictions are imposed
on untrusted clients that curtail the mischief they can do. See the SECURITY
extension specification for a complete list of these restrictions.
.PP
@@ -608,66 +655,66 @@ the X server uses when trying to open a font is controlled
by the \fIfont path\fP.
.LP
The default font path is
-"<XRoot>/lib/X11/fonts/misc/,
-<XRoot>/lib/X11/fonts/Speedo/,
-<XRoot>/lib/X11/fonts/Type1/,
-<XRoot>/lib/X11/fonts/75dpi/,
-<XRoot>/lib/X11/fonts/100dpi/" .
-where <XRoot> refers to the root of the X11 install tree.
+__projectroot__/lib/X11/fonts/misc/,
+__projectroot__/lib/X11/fonts/Speedo/,
+__projectroot__/lib/X11/fonts/Type1/,
+__projectroot__/lib/X11/fonts/75dpi/,
+__projectroot__/lib/X11/fonts/100dpi/" .
.LP
-The font path can be set with the \fB\-fp\fP option or by \fIxset(1)\fP
+The font path can be set with the \fB\-fp\fP option or by \fIxset\fP(1)
after the server has started.
.SH FILES
.TP 30
-/etc/X\fBn\fP.hosts
+.I /etc/X\fBn\fP.hosts
Initial access control list for display number \fBn\fP
.TP 30
-<XRoot>/lib/X11/fonts/misc, <XRoot>/lib/X11/fonts/75dpi, <XRoot>/lib/X11/fonts/100dpi
+.IR __projectroot__/lib/X11/fonts/misc , __projectroot__/lib/X11/fonts/75dpi , __projectroot__/lib/X11/fonts/100dpi
Bitmap font directories
.TP 30
-<XRoot>/lib/X11/fonts/Speedo, <XRoot>/lib/X11/fonts/Type1
+.IR __projectroot__/lib/X11/fonts/Speedo , __projectroot__/lib/X11/fonts/Type1
Outline font directories
+.\" .TP 30
+.\" __projectroot__/lib/X11/fonts/PEX
+.\" PEX font directories
.TP 30
-<XRoot>/lib/X11/fonts/PEX
-PEX font directories
-.TP 30
-<XRoot>/lib/X11/rgb.txt
+.I __projectroot__/lib/X11/rgb.txt
Color database
.TP 30
-/tmp/.X11-unix/X\fBn\fP
+.I /tmp/.X11-unix/X\fBn\fP
Unix domain socket for display number \fBn\fP
.TP 30
-/tmp/rcX\fBn\fP
+.IR /tmp/rcX\fBn\fP
Kerberos 5 replay cache for display number \fBn\fP
.TP 30
-/usr/adm/X\fBn\fPmsgs
-Error log file for display number \fBn\fP if run from \fIinit(8)\fP
+.I /usr/adm/X\fBn\fPmsgs
+Error log file for display number \fBn\fP if run from \fIinit\fP(8)
.TP 30
-<XRoot>/lib/X11/xdm/xdm-errors
-Default error log file if the server is run from \fIxdm(1)\fP
-.LP
-Note: <XRoot> refers to the root of the X11 install tree.
+.I __projectroot__/lib/X11/xdm/xdm-errors
+Default error log file if the server is run from \fIxdm\fP(1)
.SH "SEE ALSO"
-General information: X(1)
+General information: \fIX\fP(__miscmansuffix__)
.PP
Protocols:
.I "X Window System Protocol,"
.I "The X Font Service Protocol,"
.I "X Display Manager Control Protocol"
.PP
-Fonts: bdftopcf(1), mkfontdir(1), xfs(1), xlsfonts(1), xfontsel(1), xfd(1),
+Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fIxfs\fP(1),
+\FIxlsfonts\fP(1), \fIxfontsel\fP(1), \fIxfd\fP(1),
.I "X Logical Font Description Conventions"
.PP
-Security: Xsecurity(1), xauth(1), Xau(1), xdm(1), xhost(1), xfwp(1)
+Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1),
+\fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1)
.I "Security Extension Specification"
.PP
-Starting the server: xdm(1), xinit(1)
+Starting the server: \fIxdm(1)\fP, \fIxinit\fP(1)
.PP
-Controlling the server once started: xset(1), xsetroot(1), xhost(1)
+Controlling the server once started: \fIxset\fP(1), \fIxsetroot\fP(1),
+\fIxhost\fP(1)
.PP
-Server-specific man pages:
-Xdec(1), XmacII(1), Xsun(1), Xnest(1), Xvfb(1),
-XF86_Accel(1), XF86_Mono(1), XF86_SVGA(1), XF86_VGA16(1), XFree86(1)
+Server-specific man pages:
+\fIXdec\fP(1), \fIXmacII\fP(1), \fIXsun\fP(1), \fIXnest\fP(1),
+\fIXvfb\fP(1), \fIXFree86\fP(1), \fIXDarwin\fP(1).
.PP
Server internal documentation:
.I "Definition of the Porting Layer for the X v11 Sample Server"
diff --git a/hw/kdrive/Imakefile b/hw/kdrive/Imakefile
deleted file mode 100644
index 2ff182c38..000000000
--- a/hw/kdrive/Imakefile
+++ /dev/null
@@ -1,34 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.7 2001/05/23 08:56:08 alanh Exp $
-KDRIVE=.
-#include "Kdrive.tmpl"
-
-#if BuildRender
-RENDERSRCS=kpict.c
-RENDEROBJS=kpict.o
-#endif
-
-#if BuildXvExt
-XVSRCS=kxv.c
-XVOBJS=kxv.o
-#endif
-
-#if XipaqServer
-DEFINES = -DXIPAQ
-#endif
-
-SRCS = kaa.c kcmap.c kcolor.c kdrive.c kinfo.c kinput.c kmap.c knoop.c ktest.c \
- vga.c kasync.c kmode.c kcurscol.c kshadow.c $(RENDERSRCS) $(XVSRCS)
-
-OBJS = kaa.o kcmap.o kcolor.o kdrive.o kinfo.o kinput.o kmap.o knoop.o ktest.o \
- vga.o kasync.o kmode.o kcurscol.o kshadow.o $(RENDEROBJS) $(XVOBJS)
-
-INCLUDES = $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(kdrive,$(OBJS))
-
-SpecialCObjectRule(kdrive,,$(EXT_DEFINES))
-
-InstallManPage(Xkdrive,$(MANDIR))
-DependTarget()
diff --git a/hw/kdrive/Kdrive.tmpl b/hw/kdrive/Kdrive.tmpl
deleted file mode 100644
index e259b59a2..000000000
--- a/hw/kdrive/Kdrive.tmpl
+++ /dev/null
@@ -1,17 +0,0 @@
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $
-
-#include <Server.tmpl>
-
-#if BuildRender
-RENDERINCS=-I$(KDRIVE)/../../render
-#endif
-
-#if BuildRandR
-RANDRINCS=-I$(KDRIVE)/../../randr
-#endif
-
-KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
- -I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \
- -I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \
- -I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \
- -I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS)
diff --git a/hw/kdrive/Makefile.am b/hw/kdrive/Makefile.am
deleted file mode 100644
index eb185616d..000000000
--- a/hw/kdrive/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-if KDRIVEVESA
-VESA_SUBDIRS = vesa mach64 mga nvidia r128 smi
-endif
-
-SUBDIRS = \
- src \
- linux \
- fbdev \
- $(VESA_SUBDIRS)
-
diff --git a/hw/kdrive/Xkdrive.man b/hw/kdrive/Xkdrive.man
deleted file mode 100644
index b4f1a977d..000000000
--- a/hw/kdrive/Xkdrive.man
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $
-.\"
-.TH Xkdrive 1 __vendorversion__
-.SH NAME
-Xkdrive \- tiny X server
-.SH SYNOPSIS
-.B Xvesa
-.RI [ :display ]
-.RI [ option ...]
-
-.B Xfbdev
-.RI [ :display ]
-.RI [ option ...]
-
-.B Xigs
-.RI [ :display ]
-.RI [ option ...]
-
-.B Xtrident
-.RI [ :display ]
-.RI [ option ...]
-
-.B Xsis530
-.RI [ :display ]
-.RI [ option ...]
-
-.B Xtrio
-.RI [ :display ]
-.RI [ option ...]
-
-.B Xitsy
-.RI [ :display ]
-.RI [ option ...]
-.SH DESCRIPTION
-.B Xkdrive
-is a family of X servers designed to be particularly small. This
-manual page describes the common functionality of the
-.B Xkdrive
-servers; for information on a specific X server, please refer to the
-relevant manual page.
-.SH OPTIONS
-In addition to the standard options accepted by all X servers (see
-Xserver(1)), all the
-.B Xkdrive
-servers accept the following options:
-.TP 8
-.B -card \fIpcmcia\fP
-use pcmcia card as additional screen.
-.TP 8
-.B -dumb
-disable hardware acceleration.
-.TP 8
-.B -origin \fIX\fP,\fIY\fP
-Locates the next screen in the Xinerama virtual screen.
-.TP 8
-.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB
-use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values).
-.TP 8
-.B -softCursor
-disable the hardware cursor.
-.TP 8
-.B -videoTest
-start the server, pause momentarily, and exit.
-.TP 8
-.B -zaphod
-disable switching screens by moving the pointer across a screen boundary.
-.TP 8
-.B -2button
-enable emulation of a middle mouse button by chording.
-.TP 8
-.B -3button
-disable emulation of a middle mouse button by chording.
-.SH SEE ALSO
-X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1).
-.SH AUTHORS
-The Xkdrive common core was written by Keith Packard,
-and is based on the Sample Implementation of X.
diff --git a/hw/kdrive/chips/Imakefile b/hw/kdrive/chips/Imakefile
deleted file mode 100644
index 72970d837..000000000
--- a/hw/kdrive/chips/Imakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/chips/Imakefile,v 1.6 2000/10/20 00:19:51 keithp Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = chips.c chipsdraw.c chipsstub.c
-
-OBJS = chips.o chipsdraw.o chipsstub.o
-
-INCLUDES = -I. $(KDINCS) -I$(KDRIVE)/vesa
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(chips,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/chips/chips.c b/hw/kdrive/chips/chips.c
deleted file mode 100644
index c0b0bb6a8..000000000
--- a/hw/kdrive/chips/chips.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.18 2001/06/04 09:45:42 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "chips.h"
-#include <sys/io.h>
-
-#undef CHIPS_DEBUG
-
-Bool
-chipsCardInit (KdCardInfo *card)
-{
- int k;
- char *pixels;
- ChipsCardInfo *chipsc;
- CARD8 r00, r01, r02;
- CARD8 r39;
-
- chipsc = (ChipsCardInfo *) xalloc (sizeof (ChipsCardInfo));
- if (!chipsc)
- return FALSE;
-
- iopl (3);
-
- if (!vesaInitialize (card, &chipsc->vesa))
- {
- xfree (chipsc);
- return FALSE;
- }
-
-#ifdef USE_PCI
- chipsc->window = (CARD32 *) (chipsc->cop_base + 0x10000);
-#else
- chipsc->window = 0;
-#endif
- card->driver = chipsc;
-
- return TRUE;
-}
-
-Bool
-chipsScreenInit (KdScreenInfo *screen)
-{
- ChipsCardInfo *chipsc = screen->card->driver;
- ChipsScreenInfo *chipss;
- int screen_size, memory;
- CARD32 mmio_base;
- CARD32 mmio_size;
-
- chipss = (ChipsScreenInfo *) xalloc (sizeof (ChipsScreenInfo));
- if (!chipss)
- return FALSE;
- memset (chipss, '\0', sizeof (ChipsScreenInfo));
- if (!vesaScreenInitialize (screen, &chipss->vesa))
- {
- xfree (chipss);
- return FALSE;
- }
-
- if (chipss->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
- if (!screen->dumb)
- {
- chipss->mmio_base = (CARD8 *) KdMapDevice (CHIPS_MMIO_BASE(chipss),
- CHIPS_MMIO_SIZE(chipss));
-
- if (chipss->mmio_base)
- {
- KdSetMappedMode (CHIPS_MMIO_BASE(chipss),
- CHIPS_MMIO_SIZE(chipss),
- KD_MAPPED_MODE_REGISTERS);
- }
- else
- screen->dumb = TRUE;
- }
- else
- chipss->mmio_base = 0;
-
- chipss->screen = chipss->vesa.fb;
- memory = chipss->vesa.fb_size;
-
- screen_size = screen->fb[0].byteStride * screen->height;
-
- if (chipss->screen && memory >= screen_size + 2048)
- {
- memory -= 2048;
- chipss->cursor_base = chipss->screen + memory - 2048;
- }
- else
- chipss->cursor_base = 0;
- memory -= screen_size;
- if (memory > screen->fb[0].byteStride)
- {
- chipss->off_screen = chipss->screen + screen_size;
- chipss->off_screen_size = memory;
- }
- else
- {
- chipss->off_screen = 0;
- chipss->off_screen_size = 0;
- }
- screen->driver = chipss;
- return TRUE;
-}
-
-Bool
-chipsInitScreen (ScreenPtr pScreen)
-{
- return vesaInitScreen (pScreen);
-}
-
-Bool
-chipsFinishInitScreen (ScreenPtr pScreen)
-{
- return vesaFinishInitScreen (pScreen);
-}
-
-CARD8
-chipsReadXR (ChipsScreenInfo *chipss, CARD8 index)
-{
- CARD8 value;
- outb (index, 0x3d6);
- value = inb (0x3d7);
- return value;
-}
-
-void
-chipsWriteXR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
-{
- outb (index, 0x3d6);
- outb (value, 0x3d7);
-}
-
-CARD8
-chipsReadFR (ChipsScreenInfo *chipss, CARD8 index)
-{
- CARD8 value;
- outb (index, 0x3d0);
- value = inb (0x3d1);
- return value;
-}
-
-void
-chipsWriteFR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
-{
- outb (index, 0x3d0);
- outb (value, 0x3d1);
-}
-
-CARD8
-chipsReadSeq (ChipsScreenInfo *chipss, CARD8 index)
-{
- CARD8 value;
- outb (index, 0x3c4);
- value = inb (0x3c5);
- return value;
-}
-
-void
-chipsWriteSeq (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
-{
- outb (index, 0x3c4);
- outb (value, 0x3c5);
-}
-
-void
-chipsPreserve (KdCardInfo *card)
-{
- ChipsCardInfo *chipss = card->driver;
- vesaPreserve(card);
-}
-
-void
-chipsSetMMIO (ChipsCardInfo *chipsc)
-{
-}
-
-void
-chipsResetMMIO (ChipsCardInfo *chipsc)
-{
-}
-
-Bool
-chipsEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- ChipsCardInfo *chipsc = pScreenPriv->card->driver;
-
- if (!vesaEnable (pScreen))
- return FALSE;
- chipsSetMMIO (chipsc);
- return TRUE;
-}
-
-Bool
-chipsDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- chipsScreenInfo(pScreenPriv);
-
- ErrorF ("seqreg 0x01 0x%x\n", chipsReadSeq (chipss, 0x1));
- ErrorF ("dpmsreg XR61 0x%x\n", chipsReadXR (chipss, 0x61));
- ErrorF ("dpmsreg XR73 0x%x\n", chipsReadXR (chipss, 0x73));
-
- ErrorF ("flat panel FR05 0x%x\n", chipsReadFR (chipss, 0x5));
- ErrorF ("flat panel XR52 0x%x\n", chipsReadXR (chipss, 0x52));
- return TRUE;
-}
-
-void
-chipsDisable (ScreenPtr pScreen)
-{
- vesaDisable (pScreen);
-}
-
-void
-chipsRestore (KdCardInfo *card)
-{
- ChipsCardInfo *chipsc = card->driver;
-
- chipsResetMMIO (chipsc);
- vesaRestore (card);
-}
-
-void
-chipsScreenFini (KdScreenInfo *screen)
-{
- ChipsScreenInfo *chipss = (ChipsScreenInfo *) screen->driver;
-
- if (chipss->mmio_base)
- {
- KdUnmapDevice ((void *) chipss->mmio_base, CHIPS_MMIO_SIZE(chipss));
- KdResetMappedMode (CHIPS_MMIO_BASE(chipss),
- CHIPS_MMIO_SIZE(chipss),
- KD_MAPPED_MODE_REGISTERS);
- }
- vesaScreenFini (screen);
- xfree (chipss);
- screen->driver = 0;
-}
-
-void
-chipsCardFini (KdCardInfo *card)
-{
- ChipsCardInfo *chipsc = card->driver;
-
- vesaCardFini (card);
-}
-
-#define chipsCursorInit (void *) 0
-#define chipsCursorEnable (void *) 0
-#define chipsCursorDisable (void *) 0
-#define chipsCursorFini (void *) 0
-#define chipsRecolorCursor (void *) 0
-
-KdCardFuncs chipsFuncs = {
- chipsCardInit, /* cardinit */
- chipsScreenInit, /* scrinit */
- chipsInitScreen, /* initScreen */
- chipsPreserve, /* preserve */
- chipsEnable, /* enable */
- vesaDPMS, /* dpms */
- chipsDisable, /* disable */
- chipsRestore, /* restore */
- chipsScreenFini, /* scrfini */
- chipsCardFini, /* cardfini */
-
- chipsCursorInit, /* initCursor */
- chipsCursorEnable, /* enableCursor */
- chipsCursorDisable, /* disableCursor */
- chipsCursorFini, /* finiCursor */
- chipsRecolorCursor, /* recolorCursor */
-
- chipsDrawInit, /* initAccel */
- chipsDrawEnable, /* enableAccel */
- chipsDrawSync, /* syncAccel */
- chipsDrawDisable, /* disableAccel */
- chipsDrawFini, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
- chipsFinishInitScreen /* finishInitScreen */
-};
diff --git a/hw/kdrive/chips/chips.h b/hw/kdrive/chips/chips.h
deleted file mode 100644
index 869a0717c..000000000
--- a/hw/kdrive/chips/chips.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Id: chips.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/chips/chips.h,v 1.9 2000/11/29 08:42:25 keithp Exp $ */
-
-#ifndef _CHIPS_H_
-#define _CHIPS_H_
-#include <vesa.h>
-
-/*
- * offset from ioport beginning
- */
-
-#define HIQV
-#ifdef HIQV
-#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x400000)
-#else
-#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x200000)
-#endif
-#define CHIPS_MMIO_SIZE(c) (0x20000)
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _chipsSave {
- int dummy;
-} ChipsSave;
-
-typedef struct _chipsCardInfo {
- VesaCardPrivRec vesa;
- CARD32 *window;
- Bool mmio;
- ChipsSave save;
-} ChipsCardInfo;
-
-#define getChipsCardInfo(kd) ((ChipsCardInfo *) ((kd)->card->driver))
-#define chipsCardInfo(kd) ChipsCardInfo *chipsc = getChipsCardInfo(kd)
-
-typedef struct _chipsCursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} ChipsCursor;
-
-#define CHIPS_CURSOR_WIDTH 64
-#define CHIPS_CURSOR_HEIGHT 64
-
-typedef struct _chipsScreenInfo {
- VesaScreenPrivRec vesa;
- CARD8 *mmio_base;
- CARD8 *cursor_base;
- CARD8 *screen;
- CARD8 *off_screen;
- int off_screen_size;
- ChipsCursor cursor;
-} ChipsScreenInfo;
-
-#define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver))
-#define chipsScreenInfo(kd) ChipsScreenInfo *chipss = getChipsScreenInfo(kd)
-
-Bool
-chipsDrawInit (ScreenPtr pScreen);
-
-void
-chipsDrawEnable (ScreenPtr pScreen);
-
-void
-chipsDrawSync (ScreenPtr pScreen);
-
-void
-chipsDrawDisable (ScreenPtr pScreen);
-
-void
-chipsDrawFini (ScreenPtr pScreen);
-
-CARD8
-chipsReadXR (ChipsScreenInfo *chipsc, CARD8 index);
-
-void
-chipsWriteXR (ChipsScreenInfo *chipsc, CARD8 index, CARD8 value);
-
-Bool
-chipsCursorInit (ScreenPtr pScreen);
-
-void
-chipsCursorEnable (ScreenPtr pScreen);
-
-void
-chipsCursorDisable (ScreenPtr pScreen);
-
-void
-chipsCursorFini (ScreenPtr pScreen);
-
-void
-chipsRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
-
-extern KdCardFuncs chipsFuncs;
-
-#endif /* _CHIPS_H_ */
diff --git a/hw/kdrive/chips/chipsdraw.c b/hw/kdrive/chips/chipsdraw.c
deleted file mode 100644
index 4fc210597..000000000
--- a/hw/kdrive/chips/chipsdraw.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * Id: tridentdraw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.c,v 1.10 2001/06/03 18:48:19 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "chips.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-
-CARD8 chipsBltRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0x88, /* src AND dst */
- /* GXandReverse */ 0x44, /* src AND NOT dst */
- /* GXcopy */ 0xcc, /* src */
- /* GXandInverted*/ 0x22, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x66, /* src XOR dst */
- /* GXor */ 0xee, /* src OR dst */
- /* GXnor */ 0x11, /* NOT src AND NOT dst */
- /* GXequiv */ 0x99, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xdd, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x33, /* NOT src */
- /* GXorInverted */ 0xbb, /* NOT src OR dst */
- /* GXnand */ 0x77, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-CARD8 chipsSolidRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0xa0, /* src AND dst */
- /* GXandReverse */ 0x50, /* src AND NOT dst */
- /* GXcopy */ 0xf0, /* src */
- /* GXandInverted*/ 0x0a, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x5a, /* src XOR dst */
- /* GXor */ 0xfa, /* src OR dst */
- /* GXnor */ 0x05, /* NOT src AND NOT dst */
- /* GXequiv */ 0xa5, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xf5, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x0f, /* NOT src */
- /* GXorInverted */ 0xaf, /* NOT src OR dst */
- /* GXnand */ 0x5f, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-/* Definitions for the Chips and Technology BitBLT engine communication. */
-/* These are done using Memory Mapped IO, of the registers */
-/* BitBLT modes for register 93D0. */
-
-#ifdef HIQV
-#define ctPATCOPY 0xF0
-#define ctLEFT2RIGHT 0x000
-#define ctRIGHT2LEFT 0x100
-#define ctTOP2BOTTOM 0x000
-#define ctBOTTOM2TOP 0x200
-#define ctSRCSYSTEM 0x400
-#define ctDSTSYSTEM 0x800
-#define ctSRCMONO 0x1000
-#define ctBGTRANSPARENT 0x22000
-#define ctCOLORTRANSENABLE 0x4000
-#define ctCOLORTRANSDISABLE 0x0
-#define ctCOLORTRANSDST 0x8000
-#define ctCOLORTRANSROP 0x0
-#define ctCOLORTRANSEQUAL 0x10000L
-#define ctCOLORTRANSNEQUAL 0x0
-#define ctPATMONO 0x40000L
-#define ctPATSOLID 0x80000L
-#define ctPATSTART0 0x000000L
-#define ctPATSTART1 0x100000L
-#define ctPATSTART2 0x200000L
-#define ctPATSTART3 0x300000L
-#define ctPATSTART4 0x400000L
-#define ctPATSTART5 0x500000L
-#define ctPATSTART6 0x600000L
-#define ctPATSTART7 0x700000L
-#define ctSRCFG 0x000000L /* Where is this for the 65550?? */
-#else
-#define ctPATCOPY 0xF0
-#define ctTOP2BOTTOM 0x100
-#define ctBOTTOM2TOP 0x000
-#define ctLEFT2RIGHT 0x200
-#define ctRIGHT2LEFT 0x000
-#define ctSRCFG 0x400
-#define ctSRCMONO 0x800
-#define ctPATMONO 0x1000
-#define ctBGTRANSPARENT 0x2000
-#define ctSRCSYSTEM 0x4000
-#define ctPATSOLID 0x80000L
-#define ctPATSTART0 0x00000L
-#define ctPATSTART1 0x10000L
-#define ctPATSTART2 0x20000L
-#define ctPATSTART3 0x30000L
-#define ctPATSTART4 0x40000L
-#define ctPATSTART5 0x50000L
-#define ctPATSTART6 0x60000L
-#define ctPATSTART7 0x70000L
-#endif
-
-#define chipsFillPix(bpp,pixel) {\
- if (bpp == 8) \
- { \
- pixel = pixel & 0xff; \
- } \
- else if (bpp == 16) \
- { \
- pixel = pixel & 0xffff; \
- } \
-}
-
-static VOL8 *mmio;
-static CARD32 byteStride;
-static CARD32 bytesPerPixel;
-static CARD32 pixelStride;
-
-void
-chipsSet (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- chipsScreenInfo(pScreenPriv);
-
- mmio = chipss->mmio_base;
- byteStride = pScreenPriv->screen->fb[0].byteStride;
- bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3;
- pixelStride = pScreenPriv->screen->fb[0].pixelStride;
-}
-
-#ifdef HIQV
-#define CHIPS_BR0 0x00 /* offset */
-#define CHIPS_BR1 0x04 /* bg */
-#define CHIPS_BR2 0x08 /* fg */
-#define CHIPS_BR3 0x0c /* monochrome */
-#define CHIPS_BR4 0x10 /* bitblt */
-#define CHIPS_BR5 0x14 /* pattern addr */
-#define CHIPS_BR6 0x18 /* source addr */
-#define CHIPS_BR7 0x1c /* dst addr */
-#define CHIPS_BR8 0x20 /* dst w/h */
-#else
-#define CHIPS_DR0 0x83d0
-#define CHIPS_DR1 0x87d0
-#define CHIPS_DR2 0x8bd0
-#define CHIPS_DR3 0x8fd0
-#define CHIPS_DR4 0x93d0
-#define CHIPS_DR5 0x97d0
-#define CHIPS_DR6 0x9bd0
-#define CHIPS_DR7 0x9fd0
-#endif
-
-#define DBG(x)
-
-void
-chipsPitch (int src, int dst)
-{
- CARD32 p;
-
- p = ((dst & 0xffff) << 16) | (src & 0xffff);
- DBG(ErrorF ("\tpitch 0x%x\n", p));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR0) = p;
-#else
- *(VOL32 *) (mmio + CHIPS_DR0) = p;
-#endif
-}
-
-void
-chipsBg (Pixel bg)
-{
- DBG(ErrorF ("\tbg 0x%x\n", bg));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR1) = bg & 0xffff;
-#else
- *(VOL32 *) (mmio + CHIPS_DR2) = bg;
-#endif
-}
-
-void
-chipsFg (Pixel fg)
-{
- DBG(ErrorF ("\tfg 0x%x\n", fg));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR2) = fg;
-#else
- *(VOL32 *) (mmio + CHIPS_DR3) = fg;
-#endif
-}
-
-void
-chipsOp (CARD32 op)
-{
- DBG(ErrorF ("\top 0x%x\n", op));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR4) = op;
-#else
- *(VOL32 *) (mmio + CHIPS_DR4) = op;
-#endif
-}
-
-void
-chipsRopSolid (int rop)
-{
- CARD32 op;
-
- op = chipsSolidRop[rop] | ctTOP2BOTTOM | ctLEFT2RIGHT | ctPATSOLID | ctPATMONO;
- chipsOp (op);
-}
-
-void
-chipsSrc (int addr)
-{
- DBG(ErrorF ("\tsrc 0x%x\n", addr));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR6) = addr;
-#else
- *(VOL32 *) (mmio + CHIPS_DR5) = addr;
-#endif
-}
-
-void
-chipsDst (int addr)
-{
- DBG(ErrorF ("\tdst 0x%x\n", addr));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR7) = addr;
-#else
- *(VOL32 *) (mmio + CHIPS_DR6) = addr;
-#endif
-}
-
-void
-chipsWidthHeightGo (int w, int h)
-{
- DBG(ErrorF ("\twidth height %d/%d\n", w, h));
-#ifdef HIQV
- *(VOL32 *) (mmio + CHIPS_BR8) = ((h & 0xffff) << 16) | (w & 0xffff);
-#else
- *(VOL32 *) (mmio + CHIPS_DR7) = ((h & 0xffff) << 16) | (w & 0xffff);
-#endif
-}
-
-void
-chipsWaitIdle ()
-{
-#ifdef HIQV
- int timeout = 0;
- CARD8 tmp;
- VOL32 *br4 = (VOL32 *) (mmio + CHIPS_BR4);
-
- DBG(ErrorF ("\tBR4 0x%x 0x%x\n", mmio + CHIPS_BR4, *br4));
- DBG(ErrorF ("\tXR20 0x%x\n", chipsReadXR (0, 0x20)));
- for (;;)
- {
- if ((*br4 & 0x80000000) == 0)
- break;
- tmp = chipsReadXR (0, 0x20);
- if ((tmp & 1) == 0)
- break;
- if (++timeout > 1000000)
- {
- ErrorF ("timeout\n");
- tmp = chipsReadXR (0, 0x20);
- chipsWriteXR (0, 0x20, tmp | 2);
- sleep (1);
- chipsWriteXR (0, 0x20, tmp);
- sleep (1);
- }
- }
-#else
- while (*(VOL32 *) (mmio + CHIPS_DR4) & 0x00100000)
- ;
-#endif
-}
-
-Bool
-chipsPrepareSolid (DrawablePtr pDrawable,
- int alu,
- Pixel pm,
- Pixel fg)
-{
- FbBits depthMask;
-
- DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
- depthMask = FbFullMask(pDrawable->depth);
- if ((pm & depthMask) != depthMask)
- return FALSE;
- else
- {
- chipsSet (pDrawable->pScreen);
- chipsWaitIdle ();
- chipsFillPix(pDrawable->bitsPerPixel,fg);
- chipsFg (fg);
- chipsBg (fg);
- chipsRopSolid (alu);
- chipsPitch (byteStride, byteStride);
- return TRUE;
- }
-}
-
-void
-chipsSolid (int x1, int y1, int x2, int y2)
-{
- CARD32 dst;
- int w, h;
-
- DBG(ErrorF (" Solid %dx%d %dx%d\n", x1, y1, x2, y2));
- dst = y1 * byteStride + x1 * bytesPerPixel;
- w = (x2 - x1) * bytesPerPixel;
- h = (y2 - y1);
- chipsWaitIdle ();
- chipsDst (dst);
- chipsWidthHeightGo (w, h);
-}
-
-void
-chipsDoneSolid (void)
-{
-}
-
-static CARD32 copyOp;
-Bool
-chipsPrepareCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- int dx,
- int dy,
- int alu,
- Pixel pm)
-{
- FbBits depthMask;
-
- DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
- depthMask = FbFullMask(pDstDrawable->depth);
- if ((pm & depthMask) != depthMask)
- return FALSE;
- else
- {
- copyOp = chipsBltRop[alu];
- if (dy >= 0)
- copyOp |= ctTOP2BOTTOM;
- else
- copyOp |= ctBOTTOM2TOP;
- if (dx >= 0)
- copyOp |= ctLEFT2RIGHT;
- else
- copyOp |= ctRIGHT2LEFT;
- chipsSet (pDstDrawable->pScreen);
- chipsWaitIdle ();
- chipsOp (copyOp);
- chipsPitch (byteStride, byteStride);
- return TRUE;
- }
-}
-
-void
-chipsCopy (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int w,
- int h)
-{
- int src, dst;
- if ((copyOp & (ctTOP2BOTTOM|ctBOTTOM2TOP)) == ctBOTTOM2TOP)
- {
- src = (srcY + h - 1) * byteStride;
- dst = (dstY + h - 1) * byteStride;
- }
- else
- {
- src = srcY * byteStride;
- dst = dstY * byteStride;
- }
- if ((copyOp & (ctLEFT2RIGHT|ctRIGHT2LEFT)) == ctRIGHT2LEFT)
- {
- src = src + (srcX + w) * bytesPerPixel - 1;
- dst = dst + (dstX + w) * bytesPerPixel - 1;
- }
- else
- {
- src = src + srcX * bytesPerPixel;
- dst = dst + dstX * bytesPerPixel;
- }
- chipsWaitIdle ();
- chipsSrc (src);
- chipsDst (dst);
- chipsWidthHeightGo (w * bytesPerPixel, h);
-}
-
-void
-chipsDoneCopy (void)
-{
-}
-
-KaaScreenPrivRec chipsKaa = {
- chipsPrepareSolid,
- chipsSolid,
- chipsDoneSolid,
-
- chipsPrepareCopy,
- chipsCopy,
- chipsDoneCopy,
-};
-
-Bool
-chipsDrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- chipsScreenInfo(pScreenPriv);
-
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 8:
- case 16:
- break;
- default:
- return FALSE;
- }
-
- if (!kaaDrawInit (pScreen, &chipsKaa))
- return FALSE;
-
- return TRUE;
-}
-
-void
-chipsDrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- chipsScreenInfo(pScreenPriv);
- CARD8 mode;
-
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 8:
- mode = 0x00;
- break;
- case 16:
- mode = 0x10;
- break;
- }
- chipsSet (pScreen);
- chipsWaitIdle ();
- chipsWriteXR (chipss, 0x20, mode);
-
- KdMarkSync (pScreen);
-}
-
-void
-chipsDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-chipsDrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-chipsDrawSync (ScreenPtr pScreen)
-{
- chipsSet (pScreen);
- chipsWaitIdle ();
-}
diff --git a/hw/kdrive/chips/chipsstub.c b/hw/kdrive/chips/chipsstub.c
deleted file mode 100644
index e46df972e..000000000
--- a/hw/kdrive/chips/chipsstub.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Id: chipsstub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/chips/chipsstub.c,v 1.1 2001/09/05 07:12:42 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "chips.h"
-
-extern int chips_clk, chips_mclk;
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- KdCardInfoAdd (&chipsFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/fbdev/Imakefile b/hw/kdrive/fbdev/Imakefile
deleted file mode 100644
index 6f9650937..000000000
--- a/hw/kdrive/fbdev/Imakefile
+++ /dev/null
@@ -1,19 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Imakefile,v 1.4 2001/05/23 08:56:08 alanh Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-#if XipaqServer
-DEFINES = -DXIPAQ
-#endif
-
-SRCS = fbdev.c fbinit.c
-
-OBJS = fbdev.o fbinit.o
-
-INCLUDES = $(KDINCS) -I.
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(fbdev,$(OBJS))
-InstallManPage(Xfbdev,$(MANDIR))
-DependTarget()
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am
deleted file mode 100644
index 3a8131cfb..000000000
--- a/hw/kdrive/fbdev/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- @XSERVER_CFLAGS@
-
-noinst_LIBRARIES = libfbdev.a
-
-bin_PROGRAMS = Xfbdev
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-libfbdev_a_SOURCES = \
- fbdev.c \
- fbdev.h
-
-Xfbdev_SOURCES = \
- fbinit.c
-
-Xfbdev_LDADD = \
- libfbdev.a \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-Xfbdev_DEPENDENCIES = \
- libfbdev.a \
- @KDRIVE_LIBS@
-
diff --git a/hw/kdrive/fbdev/Xfbdev.man b/hw/kdrive/fbdev/Xfbdev.man
deleted file mode 100644
index bfdae168f..000000000
--- a/hw/kdrive/fbdev/Xfbdev.man
+++ /dev/null
@@ -1,28 +0,0 @@
-.\" $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man,v 1.4 2001/01/27 18:20:40 dawes Exp $
-.\"
-.TH Xfbdev 1 __vendorversion__
-.SH NAME
-Xfbdev \- Linux framebuffer device tiny X server
-.SH SYNOPSIS
-.B Xfbdev
-.RI [ :display ]
-.RI [ option ...]
-.SH DESCRIPTION
-.B Xfbdev
-is a generic X server for Linux.
-.B Xfbdev
-doesn't know about any particular hardware, and uses the framebuffer
-provided by the Linux framebuffer device.
-.SH OPTIONS
-.B Xfbdev
-accepts the common options of the Xkdrive family of servers. Please
-see Xkdrive(1).
-.SH KEYBOARD
-To be written.
-.SH SEE ALSO
-X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1).
-.SH AUTHORS
-The
-.B Xfbdev
-server was written by Keith Packard.
-
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
deleted file mode 100644
index 113584070..000000000
--- a/hw/kdrive/fbdev/fbdev.c
+++ /dev/null
@@ -1,693 +0,0 @@
-/*
- * Id: fbdev.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.31 2002/10/14 18:01:40 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "fbdev.h"
-#include <sys/ioctl.h>
-
-extern int KdTsPhyScreen;
-
-Bool
-fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
-{
- int k;
- unsigned long off;
- if ((priv->fd = open("/dev/fb0", O_RDWR)) < 0) {
- perror("Error opening /dev/fb0\n");
- return FALSE;
- }
- /* quiet valgrind */
- memset (&priv->fix, '\0', sizeof (priv->fix));
- if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) {
- perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
- close (priv->fd);
- return FALSE;
- }
- /* quiet valgrind */
- memset (&priv->var, '\0', sizeof (priv->var));
- if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) {
- perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
- close (priv->fd);
- return FALSE;
- }
-
- priv->fb_base = (unsigned char *) mmap ((caddr_t) NULL,
- priv->fix.smem_len,
- PROT_READ|PROT_WRITE,
- MAP_SHARED,
- priv->fd, 0);
-
- if (priv->fb_base == (char *)-1)
- {
- perror("ERROR: mmap framebuffer fails!");
- close (priv->fd);
- return FALSE;
- }
- off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize();
- priv->fb = priv->fb_base + off;
- return TRUE;
-}
-
-Bool
-fbdevCardInit (KdCardInfo *card)
-{
- FbdevPriv *priv;
-
- priv = (FbdevPriv *) xalloc (sizeof (FbdevPriv));
- if (!priv)
- return FALSE;
-
- if (!fbdevInitialize (card, priv))
- {
- xfree (priv);
- return FALSE;
- }
- card->driver = priv;
-
- return TRUE;
-}
-
-#define FBDEV_KLUDGE_FORMAT
-#ifdef FBDEV_KLUDGE_FORMAT
-static Pixel
-fbdevMakeContig (Pixel orig, Pixel others)
-{
- Pixel low;
-
- low = lowbit (orig) >> 1;
- while (low && (others & low) == 0)
- {
- orig |= low;
- low >>= 1;
- }
- return orig;
-}
-#endif
-
-Bool
-fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
-{
- FbdevPriv *priv = screen->card->driver;
- Pixel allbits;
- int depth;
- Bool gray;
-
- depth = priv->var.bits_per_pixel;
- gray = priv->var.grayscale;
-
- switch (priv->fix.visual) {
- case FB_VISUAL_PSEUDOCOLOR:
- if (gray)
- {
- screen->fb[0].visuals = (1 << StaticGray);
- /* could also support GrayScale, but what's the point? */
- }
- else
- {
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- }
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case FB_VISUAL_STATIC_PSEUDOCOLOR:
- if (gray)
- {
- screen->fb[0].visuals = (1 << StaticGray);
- }
- else
- {
- screen->fb[0].visuals = (1 << StaticColor);
- }
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case FB_VISUAL_TRUECOLOR:
- case FB_VISUAL_DIRECTCOLOR:
- screen->fb[0].visuals = (1 << TrueColor);
-#define Mask(o,l) (((1 << l) - 1) << o)
- screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
- screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
- screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
-#ifdef FBDEV_KLUDGE_FORMAT
- /*
- * This is a kludge so that Render will work -- fill in the gaps
- * in the pixel
- */
- screen->fb[0].redMask = fbdevMakeContig (screen->fb[0].redMask,
- screen->fb[0].greenMask|
- screen->fb[0].blueMask);
-
- screen->fb[0].greenMask = fbdevMakeContig (screen->fb[0].greenMask,
- screen->fb[0].redMask|
- screen->fb[0].blueMask);
-
- screen->fb[0].blueMask = fbdevMakeContig (screen->fb[0].blueMask,
- screen->fb[0].redMask|
- screen->fb[0].greenMask);
-
-#endif
- allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
- depth = 32;
- while (depth && !(allbits & (1 << (depth - 1))))
- depth--;
- break;
- default:
- return FALSE;
- break;
- }
- screen->rate = 72;
- scrpriv->randr = screen->randr;
-
- return fbdevMapFramebuffer (screen);
-}
-
-Bool
-fbdevScreenInit (KdScreenInfo *screen)
-{
- FbdevScrPriv *scrpriv;
-
- scrpriv = xalloc (sizeof (FbdevScrPriv));
- if (!scrpriv)
- return FALSE;
- memset (scrpriv, '\0', sizeof (FbdevScrPriv));
- screen->driver = scrpriv;
- if (!fbdevScreenInitialize (screen, scrpriv))
- {
- screen->driver = 0;
- xfree (scrpriv);
- return FALSE;
- }
- return TRUE;
-}
-
-void *
-fbdevWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
-
- if (!pScreenPriv->enabled)
- return 0;
- *size = priv->fix.line_length;
- return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
-}
-
-Bool
-fbdevMapFramebuffer (KdScreenInfo *screen)
-{
- FbdevScrPriv *scrpriv = screen->driver;
- KdMouseMatrix m;
- FbdevPriv *priv = screen->card->driver;
-
- if (scrpriv->randr != RR_Rotate_0)
- scrpriv->shadow = TRUE;
- else
- scrpriv->shadow = FALSE;
-
- KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
-
- KdSetMouseMatrix (&m);
-
- screen->width = priv->var.xres;
- screen->height = priv->var.yres;
- screen->memory_base = (CARD8 *) (priv->fb);
- screen->memory_size = 0;
- screen->off_screen_base = 0;
- screen->fb[0].depth = priv->var.bits_per_pixel;
- screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
-
- if (scrpriv->shadow)
- {
- if (!KdShadowFbAlloc (screen, 0,
- scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
- return FALSE;
- }
- else
- {
- screen->fb[0].byteStride = priv->fix.line_length;
- screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
- priv->var.bits_per_pixel);
- screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
- }
-
- return TRUE;
-}
-
-void
-fbdevSetScreenSizes (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- FbdevPriv *priv = screen->card->driver;
-
- if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- pScreen->width = priv->var.xres;
- pScreen->height = priv->var.yres;
- pScreen->mmWidth = screen->width_mm;
- pScreen->mmHeight = screen->height_mm;
- }
- else
- {
- pScreen->width = priv->var.yres;
- pScreen->height = priv->var.xres;
- pScreen->mmWidth = screen->height_mm;
- pScreen->mmHeight = screen->width_mm;
- }
-}
-
-Bool
-fbdevUnmapFramebuffer (KdScreenInfo *screen)
-{
- KdShadowFbFree (screen, 0);
- return TRUE;
-}
-
-Bool
-fbdevSetShadow (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- ShadowUpdateProc update;
- ShadowWindowProc window;
-
- window = fbdevWindowLinear;
- update = 0;
- if (scrpriv->randr)
- update = shadowUpdateRotatePacked;
- else
- update = shadowUpdatePacked;
- return KdShadowSet (pScreen, scrpriv->randr, update, window);
-}
-
-
-#ifdef RANDR
-Bool
-fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- RRScreenSizePtr pSize;
- Rotation randr;
- int n;
-
- *rotations = RR_Rotate_All|RR_Reflect_All;
-
- for (n = 0; n < pScreen->numDepths; n++)
- if (pScreen->allowedDepths[n].numVids)
- break;
- if (n == pScreen->numDepths)
- return FALSE;
-
- pSize = RRRegisterSize (pScreen,
- screen->width,
- screen->height,
- screen->width_mm,
- screen->height_mm);
-
- randr = KdSubRotation (scrpriv->randr, screen->randr);
-
- RRSetCurrentConfig (pScreen, randr, 0, pSize);
-
- return TRUE;
-}
-
-Bool
-fbdevRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- Bool wasEnabled = pScreenPriv->enabled;
- FbdevScrPriv oldscr;
- int oldwidth;
- int oldheight;
- int oldmmwidth;
- int oldmmheight;
- int newwidth, newheight;
-
- if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- newwidth = pSize->width;
- newheight = pSize->height;
- }
- else
- {
- newwidth = pSize->height;
- newheight = pSize->width;
- }
-
- if (wasEnabled)
- KdDisableScreen (pScreen);
-
- oldscr = *scrpriv;
-
- oldwidth = screen->width;
- oldheight = screen->height;
- oldmmwidth = pScreen->mmWidth;
- oldmmheight = pScreen->mmHeight;
-
- /*
- * Set new configuration
- */
-
- scrpriv->randr = KdAddRotation (screen->randr, randr);
-
- KdOffscreenSwapOut (screen->pScreen);
-
- fbdevUnmapFramebuffer (screen);
-
- if (!fbdevMapFramebuffer (screen))
- goto bail4;
-
- if (!fbdevSetShadow (screen->pScreen))
- goto bail4;
-
- fbdevSetScreenSizes (screen->pScreen);
-
- /*
- * Set frame buffer mapping
- */
- (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
- pScreen->width,
- pScreen->height,
- screen->fb[0].depth,
- screen->fb[0].bitsPerPixel,
- screen->fb[0].byteStride,
- screen->fb[0].frameBuffer);
-
- /* set the subpixel order */
-
- KdSetSubpixelOrder (pScreen, scrpriv->randr);
- if (wasEnabled)
- KdEnableScreen (pScreen);
-
- return TRUE;
-
-bail4:
- fbdevUnmapFramebuffer (screen);
- *scrpriv = oldscr;
- (void) fbdevMapFramebuffer (screen);
- pScreen->width = oldwidth;
- pScreen->height = oldheight;
- pScreen->mmWidth = oldmmwidth;
- pScreen->mmHeight = oldmmheight;
-
- if (wasEnabled)
- KdEnableScreen (pScreen);
- return FALSE;
-}
-
-Bool
-fbdevRandRInit (ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen))
- return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = fbdevRandRGetInfo;
- pScrPriv->rrSetConfig = fbdevRandRSetConfig;
- return TRUE;
-}
-#endif
-
-Bool
-fbdevCreateColormap (ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- VisualPtr pVisual;
- int i;
- int nent;
- xColorItem *pdefs;
-
- switch (priv->fix.visual) {
- case FB_VISUAL_STATIC_PSEUDOCOLOR:
- pVisual = pmap->pVisual;
- nent = pVisual->ColormapEntries;
- pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem));
- if (!pdefs)
- return FALSE;
- for (i = 0; i < nent; i++)
- pdefs[i].pixel = i;
- fbdevGetColors (pScreen, 0, nent, pdefs);
- for (i = 0; i < nent; i++)
- {
- pmap->red[i].co.local.red = pdefs[i].red;
- pmap->red[i].co.local.green = pdefs[i].green;
- pmap->red[i].co.local.blue = pdefs[i].blue;
- }
- DEALLOCATE_LOCAL (pdefs);
- return TRUE;
- default:
- return fbInitializeColormap (pmap);
- }
-}
-
-Bool
-fbdevInitScreen (ScreenPtr pScreen)
-{
-#ifdef TOUCHSCREEN
- KdTsPhyScreen = pScreen->myNum;
-#endif
-
- pScreen->CreateColormap = fbdevCreateColormap;
- return TRUE;
-}
-
-Bool
-fbdevFinishInitScreen (ScreenPtr pScreen)
-{
- if (!shadowSetup (pScreen))
- return FALSE;
-
-#ifdef RANDR
- if (!fbdevRandRInit (pScreen))
- return FALSE;
-#endif
-
- return TRUE;
-}
-
-
-Bool
-fbdevCreateResources (ScreenPtr pScreen)
-{
- return fbdevSetShadow (pScreen);
-}
-
-void
-fbdevPreserve (KdCardInfo *card)
-{
-}
-
-Bool
-fbdevEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- int k;
-
- priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL;
-
- /* display it on the LCD */
- k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
- if (k < 0)
- {
- perror ("FBIOPUT_VSCREENINFO");
- return FALSE;
- }
-
- if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR)
- {
- struct fb_cmap cmap;
- int i;
-
- for (i = 0;
- i < (1 << priv->var.red.length) ||
- i < (1 << priv->var.green.length) ||
- i < (1 << priv->var.blue.length); i++)
- {
- priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1);
- priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
- priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
- }
- cmap.start = 0;
- cmap.len = i;
- cmap.red = &priv->red[0];
- cmap.green = &priv->green[0];
- cmap.blue = &priv->blue[0];
- cmap.transp = 0;
- ioctl (priv->fd, FBIOPUTCMAP, &cmap);
- }
- return TRUE;
-}
-
-Bool
-fbdevDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- static int oldmode = -1;
-
- if (mode == oldmode)
- return TRUE;
-#ifdef FBIOPUT_POWERMODE
- if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0)
- {
- oldmode = mode;
- return TRUE;
- }
-#endif
-#ifdef FBIOBLANK
- if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0)
- {
- oldmode = mode;
- return TRUE;
- }
-#endif
- return FALSE;
-}
-
-void
-fbdevDisable (ScreenPtr pScreen)
-{
-}
-
-void
-fbdevRestore (KdCardInfo *card)
-{
-}
-
-void
-fbdevScreenFini (KdScreenInfo *screen)
-{
-}
-
-void
-fbdevCardFini (KdCardInfo *card)
-{
- FbdevPriv *priv = card->driver;
-
- munmap (priv->fb_base, priv->fix.smem_len);
- close (priv->fd);
- xfree (priv);
-}
-
-void
-fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- struct fb_cmap cmap;
- int p;
- int k;
- int min, max;
-
- min = 256;
- max = 0;
- for (k = 0; k < n; k++)
- {
- if (pdefs[k].pixel < min)
- min = pdefs[k].pixel;
- if (pdefs[k].pixel > max)
- max = pdefs[k].pixel;
- }
- cmap.start = min;
- cmap.len = max - min + 1;
- cmap.red = &priv->red[min];
- cmap.green = &priv->green[min];;
- cmap.blue = &priv->blue[min];
- cmap.transp = 0;
- k = ioctl (priv->fd, FBIOGETCMAP, &cmap);
- if (k < 0)
- {
- perror ("can't get colormap");
- return;
- }
- while (n--)
- {
- p = pdefs->pixel;
- pdefs->red = priv->red[p];
- pdefs->green = priv->green[p];
- pdefs->blue = priv->blue[p];
- pdefs++;
- }
-}
-
-void
-fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- struct fb_cmap cmap;
- int p;
- int min, max;
-
- min = 256;
- max = 0;
- while (n--)
- {
- p = pdefs->pixel;
- priv->red[p] = pdefs->red;
- priv->green[p] = pdefs->green;
- priv->blue[p] = pdefs->blue;
- if (p < min)
- min = p;
- if (p > max)
- max = p;
- pdefs++;
- }
- cmap.start = min;
- cmap.len = max - min + 1;
- cmap.red = &priv->red[min];
- cmap.green = &priv->green[min];
- cmap.blue = &priv->blue[min];
- cmap.transp = 0;
- ioctl (priv->fd, FBIOPUTCMAP, &cmap);
-}
diff --git a/hw/kdrive/fbdev/fbdev.h b/hw/kdrive/fbdev/fbdev.h
deleted file mode 100644
index d37b99597..000000000
--- a/hw/kdrive/fbdev/fbdev.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Id: fbdev.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.h,v 1.11 2001/06/03 21:52:45 keithp Exp $ */
-
-#ifndef _FBDEV_H_
-#define _FBDEV_H_
-#include <stdio.h>
-#include <linux/fb.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include "kdrive.h"
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-typedef struct _fbdevPriv {
- struct fb_var_screeninfo var;
- struct fb_fix_screeninfo fix;
- __u16 red[256];
- __u16 green[256];
- __u16 blue[256];
- int fd;
- char *fb;
- char *fb_base;
-} FbdevPriv;
-
-typedef struct _fbdevScrPriv {
- Rotation randr;
- Bool shadow;
- PixmapPtr pShadow;
-} FbdevScrPriv;
-
-extern KdCardFuncs fbdevFuncs;
-
-Bool
-fbdevInitialize (KdCardInfo *card, FbdevPriv *priv);
-
-Bool
-fbdevCardInit (KdCardInfo *card);
-
-Bool
-fbdevScreenInit (KdScreenInfo *screen);
-
-Bool
-fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv);
-
-Bool
-fbdevInitScreen (ScreenPtr pScreen);
-
-Bool
-fbdevFinishInitScreen (ScreenPtr pScreen);
-
-Bool
-fbdevCreateResources (ScreenPtr pScreen);
-
-void
-fbdevPreserve (KdCardInfo *card);
-
-Bool
-fbdevEnable (ScreenPtr pScreen);
-
-Bool
-fbdevDPMS (ScreenPtr pScreen, int mode);
-
-void
-fbdevDisable (ScreenPtr pScreen);
-
-void
-fbdevRestore (KdCardInfo *card);
-
-void
-fbdevScreenFini (KdScreenInfo *screen);
-
-void
-fbdevCardFini (KdCardInfo *card);
-
-void
-fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-
-void
-fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-
-Bool
-fbdevMapFramebuffer (KdScreenInfo *screen);
-
-void *
-fbdevWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
-
-void
-fbdevSetScreenSizes (ScreenPtr pScreen);
-
-Bool
-fbdevUnmapFramebuffer (KdScreenInfo *screen);
-
-Bool
-fbdevSetShadow (ScreenPtr pScreen);
-
-Bool
-fbdevCreateColormap (ColormapPtr pmap);
-
-#ifdef RANDR
-Bool
-fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
-
-Bool
-fbdevRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize);
-Bool
-fbdevRandRInit (ScreenPtr pScreen);
-
-#endif
-
-#endif /* _FBDEV_H_ */
diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c
deleted file mode 100644
index 533aa9bf8..000000000
--- a/hw/kdrive/fbdev/fbinit.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Id: fbinit.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/fbinit.c,v 1.8 2001/05/29 17:47:55 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <fbdev.h>
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- KdCardInfoAdd (&fbdevFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdInitTouchScreen (&TsFuncs);
-#endif
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
-
-
-
-KdCardFuncs fbdevFuncs = {
- fbdevCardInit, /* cardinit */
- fbdevScreenInit, /* scrinit */
- fbdevInitScreen, /* initScreen */
- fbdevFinishInitScreen, /* finishInitScreen */
- fbdevCreateResources, /* createRes */
- fbdevPreserve, /* preserve */
- fbdevEnable, /* enable */
- fbdevDPMS, /* dpms */
- fbdevDisable, /* disable */
- fbdevRestore, /* restore */
- fbdevScreenFini, /* scrfini */
- fbdevCardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- 0, /* initAccel */
- 0, /* enableAccel */
- 0, /* syncAccel */
- 0, /* disableAccel */
- 0, /* finiAccel */
-
- fbdevGetColors, /* getColors */
- fbdevPutColors, /* putColors */
-};
diff --git a/hw/kdrive/i810/Imakefile b/hw/kdrive/i810/Imakefile
deleted file mode 100644
index 32850275d..000000000
--- a/hw/kdrive/i810/Imakefile
+++ /dev/null
@@ -1,21 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/i810/Imakefile,v 1.6 2000/10/20 00:19:51 keithp Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-#if BuildXvExt
-XVSRCS = i810_video.c
-XVOBJS = i810_video.o
-#endif
-
-SRCS = i810.c i810stub.c i810draw.c i810_cursor.c $(XVSRCS)
-
-OBJS = i810.o i810stub.o i810draw.o i810_cursor.o $(XVOBJS)
-
-DEFINES = XvExtensionDefines /* -DI810CFG_SHOW_OVERSCAN */
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(i810,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/i810/i810.c b/hw/kdrive/i810/i810.c
deleted file mode 100644
index e36ea816e..000000000
--- a/hw/kdrive/i810/i810.c
+++ /dev/null
@@ -1,2104 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-
-/* $RCSId: xc/programs/Xserver/hw/kdrive/i810/i810.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
-
-/*
- * i810.c - KDrive driver for the i810 chipset
- *
- * Authors:
- * Pontus Lidman <pontus.lidman@nokia.com>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kxv.h"
-
-#include "i810.h"
-#include "linux/agp.h"
-
-#include "i810draw.h"
-
-Bool i810InitVideo(ScreenPtr pScreen);
-
-#ifndef I810_DEBUG
-int I810_DEBUG = (0
-/* | DEBUG_ALWAYS_SYNC */
-/* | DEBUG_VERBOSE_ACCEL */
-/* | DEBUG_VERBOSE_SYNC */
-/* | DEBUG_VERBOSE_VGA */
-/* | DEBUG_VERBOSE_RING */
-/* | DEBUG_VERBOSE_OUTREG */
-/* | DEBUG_VERBOSE_MEMORY */
-/* | DEBUG_VERBOSE_CURSOR */
- );
-#endif
-
-
-static Bool
-i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t);
-
-static void
-i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode );
-
-Bool
-i810CardInit (KdCardInfo *card)
-{
- int i;
-
- I810CardInfo *i810c;
-
-/* fprintf(stderr,"i810CardInit\n"); */
-
- i810c = (I810CardInfo *) xalloc (sizeof (I810CardInfo));
-
- if (!i810c)
- return FALSE;
-
- /* 2MB Video RAM */
- i810c->videoRam=2048;
-
- /* Find FB address */
-
- if (card->attr.address[1] != 0) {
- i810c->LinearAddr = card->attr.address[0] & 0xFF000000;
-
- if (!i810c->LinearAddr) {
- fprintf(stderr,"No valid FB address in PCI config space(1)\n");
- xfree(i810c);
- return FALSE;
- } else {
-/* fprintf(stderr,"Linear framebuffer at %lx\n",i810c->LinearAddr); */
- }
- } else {
- fprintf(stderr,"No valid FB address in PCI config space(2)\n");
- xfree(i810c);
- return FALSE;
- }
-
- if (card->attr.address[1]) {
-
- i810c->MMIOAddr = card->attr.address[1] & 0xFFF80000;
-
- i810c->MMIOBase =
- KdMapDevice (i810c->MMIOAddr, I810_REG_SIZE);
- if (!i810c->MMIOBase) {
- fprintf(stderr,"No valid MMIO address in PCI config space(1)\n");
- xfree(i810c);
- return FALSE;
- } else {
-
- }
- } else {
- fprintf(stderr,"No valid MMIO address in PCI config space(2)\n");
- xfree(i810c);
- return FALSE;
- }
-
-/* fprintf(stderr,"Mapped 0x%x bytes of MMIO regs at phys 0x%lx virt %p\n", */
-/* I810_REG_SIZE,i810c->MMIOAddr,i810c->MMIOBase); */
-
- /* Find out memory bus frequency.
- */
-
- {
- unsigned long *p;
- unsigned char *LinuxGetPciCfg(KdCardAttr *attr);
-
-
- if (!(p= (unsigned long *) LinuxGetPciCfg(&card->attr)))
- return FALSE;
-
-/* fprintf(stderr,"Frequency long %lx\n",p[WHTCFG_PAMR_DRP]); */
-
- if ( (p[WHTCFG_PAMR_DRP] & LM_FREQ_MASK) == LM_FREQ_133 )
- i810c->LmFreqSel = 133;
- else
- i810c->LmFreqSel = 100;
-
- xfree(p);
-
-/* fprintf(stderr,"Selected frequency %d\n",i810c->LmFreqSel); */
- }
-
-/* fprintf(stderr,"Will alloc AGP framebuffer: %d kByte\n",i810c->videoRam); */
-
- /* Since we always want write combining on first 32 mb of framebuffer
- * we pass a mapsize of 32 mb */
- i810c->FbMapSize = 32*1024*1024;
-
- for (i = 2 ; i < i810c->FbMapSize ; i <<= 1);
- i810c->FbMapSize = i;
-
- i810c->FbBase =
- KdMapDevice (i810c->LinearAddr, i810c->FbMapSize);
-
- if (!i810c->FbBase) return FALSE;
-/* fprintf(stderr,"Mapped 0x%lx bytes of framebuffer at %p\n", */
-/* i810c->FbMapSize,i810c->FbBase); */
-
- card->driver=i810c;
-
- return TRUE;
-}
-
-void
-i810ScreenFini (KdScreenInfo *screen)
-{
- I810ScreenInfo *i810s = (I810ScreenInfo *) screen->driver;
-
- xfree (i810s);
- screen->driver = 0;
-}
-
-Bool
-i810InitScreen (ScreenPtr pScreen) {
-
-#ifdef XV
- i810InitVideo(pScreen);
-#endif
- return TRUE;
-}
-
-void
-i810CardFini (KdCardInfo *card)
-{
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- KdUnmapDevice (i810c->FbBase, i810c->FbMapSize);
- KdUnmapDevice (i810c->MMIOBase, I810_REG_SIZE);
- xfree (i810c);
- card->driver = 0;
-}
-
-struct wm_info {
- double freq;
- unsigned int wm;
-};
-
-struct wm_info i810_wm_8_100[] = {
- { 0, 0x22003000 },
- { 25.2, 0x22003000 },
- { 28.0, 0x22003000 },
- { 31.5, 0x22003000 },
- { 36.0, 0x22007000 },
- { 40.0, 0x22007000 },
- { 45.0, 0x22007000 },
- { 49.5, 0x22008000 },
- { 50.0, 0x22008000 },
- { 56.3, 0x22008000 },
- { 65.0, 0x22008000 },
- { 75.0, 0x22008000 },
- { 78.8, 0x22008000 },
- { 80.0, 0x22008000 },
- { 94.0, 0x22008000 },
- { 96.0, 0x22107000 },
- { 99.0, 0x22107000 },
- { 108.0, 0x22107000 },
- { 121.0, 0x22107000 },
- { 128.9, 0x22107000 },
- { 132.0, 0x22109000 },
- { 135.0, 0x22109000 },
- { 157.5, 0x2210b000 },
- { 162.0, 0x2210b000 },
- { 175.5, 0x2210b000 },
- { 189.0, 0x2220e000 },
- { 202.5, 0x2220e000 }
-};
-
-struct wm_info i810_wm_16_100[] = {
- { 0, 0x22004000 },
- { 25.2, 0x22006000 },
- { 28.0, 0x22006000 },
- { 31.5, 0x22007000 },
- { 36.0, 0x22007000 },
- { 40.0, 0x22007000 },
- { 45.0, 0x22007000 },
- { 49.5, 0x22009000 },
- { 50.0, 0x22009000 },
- { 56.3, 0x22108000 },
- { 65.0, 0x2210e000 },
- { 75.0, 0x2210e000 },
- { 78.8, 0x2210e000 },
- { 80.0, 0x22210000 },
- { 94.5, 0x22210000 },
- { 96.0, 0x22210000 },
- { 99.0, 0x22210000 },
- { 108.0, 0x22210000 },
- { 121.0, 0x22210000 },
- { 128.9, 0x22210000 },
- { 132.0, 0x22314000 },
- { 135.0, 0x22314000 },
- { 157.5, 0x22415000 },
- { 162.0, 0x22416000 },
- { 175.5, 0x22416000 },
- { 189.0, 0x22416000 },
- { 195.0, 0x22416000 },
- { 202.5, 0x22416000 }
-};
-
-
-struct wm_info i810_wm_24_100[] = {
- { 0, 0x22006000 },
- { 25.2, 0x22009000 },
- { 28.0, 0x22009000 },
- { 31.5, 0x2200a000 },
- { 36.0, 0x2210c000 },
- { 40.0, 0x2210c000 },
- { 45.0, 0x2210c000 },
- { 49.5, 0x22111000 },
- { 50.0, 0x22111000 },
- { 56.3, 0x22111000 },
- { 65.0, 0x22214000 },
- { 75.0, 0x22214000 },
- { 78.8, 0x22215000 },
- { 80.0, 0x22216000 },
- { 94.5, 0x22218000 },
- { 96.0, 0x22418000 },
- { 99.0, 0x22418000 },
- { 108.0, 0x22418000 },
- { 121.0, 0x22418000 },
- { 128.9, 0x22419000 },
- { 132.0, 0x22519000 },
- { 135.0, 0x4441d000 },
- { 157.5, 0x44419000 },
- { 162.0, 0x44419000 },
- { 175.5, 0x44419000 },
- { 189.0, 0x44419000 },
- { 195.0, 0x44419000 },
- { 202.5, 0x44419000 }
-};
-
-struct wm_info i810_wm_32_100[] = {
- { 0, 0x2210b000 },
- { 60, 0x22415000 }, /* 0x314000 works too */
- { 80, 0x22419000 } /* 0x518000 works too */
-};
-
-
-struct wm_info i810_wm_8_133[] = {
- { 0, 0x22003000 },
- { 25.2, 0x22003000 },
- { 28.0, 0x22003000 },
- { 31.5, 0x22003000 },
- { 36.0, 0x22007000 },
- { 40.0, 0x22007000 },
- { 45.0, 0x22007000 },
- { 49.5, 0x22008000 },
- { 50.0, 0x22008000 },
- { 56.3, 0x22008000 },
- { 65.0, 0x22008000 },
- { 75.0, 0x22008000 },
- { 78.8, 0x22008000 },
- { 80.0, 0x22008000 },
- { 94.0, 0x22008000 },
- { 96.0, 0x22107000 },
- { 99.0, 0x22107000 },
- { 108.0, 0x22107000 },
- { 121.0, 0x22107000 },
- { 128.9, 0x22107000 },
- { 132.0, 0x22109000 },
- { 135.0, 0x22109000 },
- { 157.5, 0x2210b000 },
- { 162.0, 0x2210b000 },
- { 175.5, 0x2210b000 },
- { 189.0, 0x2220e000 },
- { 202.5, 0x2220e000 }
-};
-
-
-struct wm_info i810_wm_16_133[] = {
- { 0, 0x22004000 },
- { 25.2, 0x22006000 },
- { 28.0, 0x22006000 },
- { 31.5, 0x22007000 },
- { 36.0, 0x22007000 },
- { 40.0, 0x22007000 },
- { 45.0, 0x22007000 },
- { 49.5, 0x22009000 },
- { 50.0, 0x22009000 },
- { 56.3, 0x22108000 },
- { 65.0, 0x2210e000 },
- { 75.0, 0x2210e000 },
- { 78.8, 0x2210e000 },
- { 80.0, 0x22210000 },
- { 94.5, 0x22210000 },
- { 96.0, 0x22210000 },
- { 99.0, 0x22210000 },
- { 108.0, 0x22210000 },
- { 121.0, 0x22210000 },
- { 128.9, 0x22210000 },
- { 132.0, 0x22314000 },
- { 135.0, 0x22314000 },
- { 157.5, 0x22415000 },
- { 162.0, 0x22416000 },
- { 175.5, 0x22416000 },
- { 189.0, 0x22416000 },
- { 195.0, 0x22416000 },
- { 202.5, 0x22416000 }
-};
-
-struct wm_info i810_wm_24_133[] = {
- { 0, 0x22006000 },
- { 25.2, 0x22009000 },
- { 28.0, 0x22009000 },
- { 31.5, 0x2200a000 },
- { 36.0, 0x2210c000 },
- { 40.0, 0x2210c000 },
- { 45.0, 0x2210c000 },
- { 49.5, 0x22111000 },
- { 50.0, 0x22111000 },
- { 56.3, 0x22111000 },
- { 65.0, 0x22214000 },
- { 75.0, 0x22214000 },
- { 78.8, 0x22215000 },
- { 80.0, 0x22216000 },
- { 94.5, 0x22218000 },
- { 96.0, 0x22418000 },
- { 99.0, 0x22418000 },
- { 108.0, 0x22418000 },
- { 121.0, 0x22418000 },
- { 128.9, 0x22419000 },
- { 132.0, 0x22519000 },
- { 135.0, 0x4441d000 },
- { 157.5, 0x44419000 },
- { 162.0, 0x44419000 },
- { 175.5, 0x44419000 },
- { 189.0, 0x44419000 },
- { 195.0, 0x44419000 },
- { 202.5, 0x44419000 }
-};
-
-static void
-i810WriteControlMMIO(I810CardInfo *i810c, int addr, CARD8 index, CARD8 val) {
- moutb(addr, index);
- moutb(addr+1, val);
-}
-
-static CARD8
-i810ReadControlMMIO(I810CardInfo *i810c, int addr, CARD8 index) {
- moutb(addr, index);
- return minb(addr+1);
-}
-
-Bool
-i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t)
-{
- /* This is just a guess. */
- if (t->horizontal > 1600 || t->horizontal < 640) return FALSE;
- if (t->vertical > 1200 || t->horizontal < 350) return FALSE;
- return TRUE;
-}
-
-Bool
-i810ModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- int byte_width, pixel_width, screen_size;
-
-/* fprintf(stderr,"i810ModeUsable\n"); */
-
- if (screen->fb[0].depth >= 24)
- {
- screen->fb[0].depth = 24;
- screen->fb[0].bitsPerPixel = 24;
- screen->dumb = TRUE;
- }
- else if (screen->fb[0].depth >= 16)
- {
- screen->fb[0].depth = 16;
- screen->fb[0].bitsPerPixel = 16;
- }
- else if (screen->fb[0].depth >= 15)
- {
- screen->fb[0].depth = 15;
- screen->fb[0].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[0].depth = 8;
- screen->fb[0].bitsPerPixel = 8;
- }
- byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
- pixel_width = screen->width;
-
- screen->fb[0].pixelStride = pixel_width;
- screen->fb[0].byteStride = byte_width;
-
- screen_size = byte_width * screen->height;
-
- return screen_size <= (i810c->videoRam * 1024);
-}
-
-int i810AllocateGARTMemory( KdScreenInfo *screen )
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- unsigned long size = i810c->videoRam * 1024;
-
- int key;
- long tom = 0;
- unsigned long physical;
-
- if (!KdAgpGARTSupported())
- return FALSE;
-
- if (!KdAcquireGART(screen->mynum))
- return FALSE;
-
- /* This allows the 2d only Xserver to regen */
- i810c->agpAcquired2d = TRUE;
-
- /* Treat the gart like video memory - we assume we own all that is
- * there, so ignore EBUSY errors. Don't try to remove it on
- * failure, either, as other X server may be using it.
- */
-
- if ((key = KdAllocateGARTMemory(screen->mynum, size, 0, NULL)) == -1)
- return FALSE;
-
- i810c->VramOffset = 0;
- i810c->VramKey = key;
-
- if (!KdBindGARTMemory(screen->mynum, key, 0))
- return FALSE;
-
-
- i810c->SysMem.Start = 0;
- i810c->SysMem.Size = size;
- i810c->SysMem.End = size;
- i810c->SavedSysMem = i810c->SysMem;
-
- tom = i810c->SysMem.End;
-
- i810c->DcacheMem.Start = 0;
- i810c->DcacheMem.End = 0;
- i810c->DcacheMem.Size = 0;
- i810c->CursorPhysical = 0;
-
- /* Dcache - half the speed of normal ram, so not really useful for
- * a 2d server. Don't bother reporting its presence. This is
- * mapped in addition to the requested amount of system ram.
- */
- size = 1024 * 4096;
-
- /* Keep it 512K aligned for the sake of tiled regions.
- */
- tom += 0x7ffff;
- tom &= ~0x7ffff;
-
- if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_DCACHE_MEMORY, NULL)) != -1) {
- i810c->DcacheOffset= tom;
- i810c->DcacheKey = key;
- if (!KdBindGARTMemory(screen->mynum, key, tom)) {
- fprintf(stderr,"Allocation of %ld bytes for DCACHE failed\n", size);
- i810c->DcacheKey = -1;
- } else {
- i810c->DcacheMem.Start = tom;
- i810c->DcacheMem.Size = size;
- i810c->DcacheMem.End = i810c->DcacheMem.Start + i810c->DcacheMem.Size;
- tom = i810c->DcacheMem.End;
- }
- } else {
- fprintf(stderr,
- "No physical memory available for %ld bytes of DCACHE\n",
- size);
- i810c->DcacheKey = -1;
- }
-
- /* Mouse cursor -- The i810 (crazy) needs a physical address in
- * system memory from which to upload the cursor. We get this from
- * the agpgart module using a special memory type.
- */
-
- /* 4k for the cursor is excessive, I'm going to steal 3k for
- * overlay registers later
- */
-
- size = 4096;
-
- if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_PHYS_MEMORY,
- &physical)) == -1) {
- fprintf(stderr,
- "No physical memory available for HW cursor\n");
- i810c->HwcursKey = -1;
- } else {
- i810c->HwcursOffset= tom;
- i810c->HwcursKey = key;
- if (!KdBindGARTMemory(screen->mynum, key, tom)) {
- fprintf(stderr,
- "Allocation of %ld bytes for HW cursor failed\n",
- size);
- i810c->HwcursKey = -1;
- } else {
- i810c->CursorPhysical = physical;
- i810c->CursorStart = tom;
- tom += size;
- }
- }
-
- /* Overlay register buffer -- Just like the cursor, the i810 needs a
- * physical address in system memory from which to upload the overlay
- * registers.
- */
- if (i810c->CursorStart != 0) {
- i810c->OverlayPhysical = i810c->CursorPhysical + 1024;
- i810c->OverlayStart = i810c->CursorStart + 1024;
- }
-
-
- i810c->GttBound = 1;
-
- return TRUE;
-}
-
-/* Allocate from a memrange, returns success */
-
-int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size )
-{
- if (size > pool->Size) return FALSE;
-
- pool->Size -= size;
- result->Size = size;
- result->Start = pool->Start;
- result->End = pool->Start += size;
- return TRUE;
-}
-
-int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size )
-{
- if (size > pool->Size) return 0;
-
- pool->Size -= size;
- result->Size = size;
- result->End = pool->End;
- result->Start = pool->End -= size;
- return 1;
-}
-
-Bool
-i810AllocateFront(KdScreenInfo *screen) {
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- int cache_lines = -1;
-
- if(i810c->DoneFrontAlloc)
- return TRUE;
-
- memset(&(i810c->FbMemBox), 0, sizeof(BoxRec));
- /* Alloc FrontBuffer/Ring/Accel memory */
- i810c->FbMemBox.x1=0;
- i810c->FbMemBox.x2=screen->width;
- i810c->FbMemBox.y1=0;
- i810c->FbMemBox.y2=screen->height;
-
- /* This could be made a command line option */
- cache_lines = 0;
-
- if(cache_lines >= 0)
- i810c->FbMemBox.y2 += cache_lines;
- else {
- /* make sure there is enough for two DVD sized YUV buffers */
- i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384;
- if (screen->width <= 1024)
- i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384;
- cache_lines = i810c->FbMemBox.y2 - screen->height;
- }
-
- if (I810_DEBUG)
- ErrorF("Adding %i scanlines for pixmap caching\n", cache_lines);
-
- /* Reserve room for the framebuffer and pixcache. Put at the top
- * of memory so we can have nice alignment for the tiled regions at
- * the start of memory.
- */
- i810AllocLow( &(i810c->FrontBuffer),
- &(i810c->SysMem),
- ((i810c->FbMemBox.x2 *
- i810c->FbMemBox.y2 *
- i810c->cpp) + 4095) & ~4095);
-
- memset( &(i810c->LpRing), 0, sizeof( I810RingBuffer ) );
- if(i810AllocLow( &(i810c->LpRing.mem), &(i810c->SysMem), 16*4096 )) {
- if (I810_DEBUG & DEBUG_VERBOSE_MEMORY)
- ErrorF( "ring buffer at local %lx\n",
- i810c->LpRing.mem.Start);
-
- i810c->LpRing.tail_mask = i810c->LpRing.mem.Size - 1;
- i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start;
- i810c->LpRing.head = 0;
- i810c->LpRing.tail = 0;
- i810c->LpRing.space = 0;
- }
-
- if ( i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 64*1024 ) ||
- i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 16*1024 ) ) {
- if (I810_DEBUG & DEBUG_VERBOSE_MEMORY)
- ErrorF("Allocated Scratch Memory\n");
- }
-
-#ifdef XV
- /* 720x720 is just how much memory the mpeg player needs for overlays */
-
- if ( i810AllocHigh( &i810c->XvMem, &(i810c->SysMem), 720*720*2 )) {
- if (I810_DEBUG & DEBUG_VERBOSE_MEMORY)
- ErrorF("Allocated overlay Memory\n");
- }
-#endif
-
- i810c->DoneFrontAlloc = TRUE;
- return TRUE;
-}
-
-static Bool
-i810MapMem(KdScreenInfo *screen)
-{
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start;
-
- return TRUE;
-}
-
-
-Bool
-i810ScreenInit (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810ScreenInfo *i810s;
-
- int i;
-
- const KdMonitorTiming *t;
-
-/* fprintf(stderr,"i810ScreenInit\n"); */
-
- i810s = (I810ScreenInfo *) xalloc (sizeof (I810ScreenInfo));
- if (!i810s)
- return FALSE;
-
- memset (i810s, '\0', sizeof (I810ScreenInfo));
-
- /* Default dimensions */
- if (!screen->width || !screen->height)
- {
- screen->width = 720;
- screen->height = 576;
- screen->rate = 52;
-#if 0
- screen->width = 1024;
- screen->height = 768;
- screen->rate = 72;
-#endif
- }
-
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 16;
-
- t = KdFindMode (screen, i810ModeSupported);
-
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
-
- if (!KdTuneMode (screen, i810ModeUsable, i810ModeSupported))
- {
- xfree (i810c);
- return FALSE;
- }
-
-/* fprintf(stderr,"Screen rate %d horiz %d vert %d\n",t->rate,t->horizontal,t->vertical); */
-
- switch (screen->fb[0].depth) {
- case 8:
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case 15:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x03e0;
- screen->fb[0].redMask = 0x7c00;
-
- i810c->colorKey = 0x043f;
-
- break;
- case 16:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x07e0;
- screen->fb[0].redMask = 0xf800;
-
- i810c->colorKey = 0x083f;
-
- break;
- case 24:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x0000ff;
- screen->fb[0].greenMask = 0x00ff00;
- screen->fb[0].redMask = 0xff0000;
-
- i810c->colorKey = 0x0101ff;
-
- break;
- default:
- fprintf(stderr,"Unsupported depth %d\n",screen->fb[0].depth);
- return FALSE;
- }
-
-
-
- /* Set all colours to black */
- for (i=0; i<768; i++) i810c->vga.ModeReg.DAC[i] = 0x00;
-
- /* ... and the overscan */
- if (screen->fb[0].depth >= 4)
- i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF;
-
- /* Could be made a command-line option */
-
-#ifdef I810CFG_SHOW_OVERSCAN
- i810c->vga.ModeReg.DAC[765] = 0x3F;
- i810c->vga.ModeReg.DAC[766] = 0x00;
- i810c->vga.ModeReg.DAC[767] = 0x3F;
- i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF;
- i810c->vga.ShowOverscan = TRUE;
-#else
- i810c->vga.ShowOverscan = FALSE;
-#endif
-
- i810c->vga.paletteEnabled = FALSE;
- i810c->vga.cmapSaved = FALSE;
- i810c->vga.MMIOBase = i810c->MMIOBase;
-
- i810c->cpp = screen->fb[0].bitsPerPixel/8;
-
- /* move to initscreen? */
-
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- i810c->MaxClock = 203000;
- break;
- case 16:
- i810c->MaxClock = 163000;
- break;
- case 24:
- i810c->MaxClock = 136000;
- break;
- case 32: /* not supported */
- i810c->MaxClock = 86000;
- default:
- fprintf(stderr,"Unsupported bpp %d\n",screen->fb[0].bitsPerPixel);
- return FALSE;
- }
-
- if (!i810AllocateGARTMemory( screen )) {
- return FALSE;
- }
-
- i810AllocateFront(screen);
-
- /* Map LpRing memory */
- if (!i810MapMem(screen)) return FALSE;
-
- screen->fb[0].frameBuffer = i810c->FbBase;
-
- screen->driver = i810s;
-
- return TRUE;
-}
-
-/*
- * I810Save --
- *
- * This function saves the video state. It reads all of the SVGA registers
- * into the vgaI810Rec data structure. There is in general no need to
- * mask out bits here - just read the registers.
- */
-static void
-DoSave(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts)
-{
-
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
-
- int i;
-
- /* Save VGA registers */
-
- vgaReg->MiscOutReg = mmioReadMiscOut(vgap);
- if (vgaReg->MiscOutReg & 0x01)
- vgap->IOBase = VGA_IOBASE_COLOR;
- else
- vgap->IOBase = VGA_IOBASE_MONO;
-
- for (i = 0; i < VGA_NUM_CRTC; i++) {
- vgaReg->CRTC[i] = mmioReadCrtc(vgap, i);
- }
-
- mmioEnablePalette(vgap);
- for (i = 0; i < VGA_NUM_ATTR; i++) {
- vgaReg->Attribute[i] = mmioReadAttr(vgap, i);
- }
- mmioDisablePalette(vgap);
-
- for (i = 0; i < VGA_NUM_GFX; i++) {
- vgaReg->Graphics[i] = mmioReadGr(vgap, i);
- }
-
- for (i = 1; i < VGA_NUM_SEQ; i++) {
- vgaReg->Sequencer[i] = mmioReadSeq(vgap, i);
- }
-
- /*
- * The port I/O code necessary to read in the extended registers
- * into the fields of the I810Rec structure goes here.
- */
- i810Reg->IOControl = mmioReadCrtc(vgap, IO_CTNL);
- i810Reg->AddressMapping = i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING);
- i810Reg->BitBLTControl = INREG8(BITBLT_CNTL);
- i810Reg->VideoClk2_M = INREG16(VCLK2_VCO_M);
- i810Reg->VideoClk2_N = INREG16(VCLK2_VCO_N);
- i810Reg->VideoClk2_DivisorSel = INREG8(VCLK2_VCO_DIV_SEL);
-
- i810Reg->ExtVertTotal=mmioReadCrtc(vgap, EXT_VERT_TOTAL);
- i810Reg->ExtVertDispEnd=mmioReadCrtc(vgap, EXT_VERT_DISPLAY);
- i810Reg->ExtVertSyncStart=mmioReadCrtc(vgap, EXT_VERT_SYNC_START);
- i810Reg->ExtVertBlankStart=mmioReadCrtc(vgap, EXT_VERT_BLANK_START);
- i810Reg->ExtHorizTotal=mmioReadCrtc(vgap, EXT_HORIZ_TOTAL);
- i810Reg->ExtHorizBlank=mmioReadCrtc(vgap, EXT_HORIZ_BLANK);
- i810Reg->ExtOffset=mmioReadCrtc(vgap, EXT_OFFSET);
- i810Reg->InterlaceControl=mmioReadCrtc(vgap, INTERLACE_CNTL);
-
- i810Reg->PixelPipeCfg0 = INREG8(PIXPIPE_CONFIG_0);
- i810Reg->PixelPipeCfg1 = INREG8(PIXPIPE_CONFIG_1);
- i810Reg->PixelPipeCfg2 = INREG8(PIXPIPE_CONFIG_2);
- i810Reg->DisplayControl = INREG8(DISPLAY_CNTL);
- i810Reg->LMI_FIFO_Watermark = INREG(FWATER_BLC);
-
- for (i = 0 ; i < 8 ; i++)
- i810Reg->Fence[i] = INREG(FENCE+i*4);
-
- i810Reg->LprbTail = INREG(LP_RING + RING_TAIL);
- i810Reg->LprbHead = INREG(LP_RING + RING_HEAD);
- i810Reg->LprbStart = INREG(LP_RING + RING_START);
- i810Reg->LprbLen = INREG(LP_RING + RING_LEN);
-
- if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) &&
- i810Reg->LprbLen & RING_VALID) {
- i810PrintErrorState( card );
- FatalError( "Active ring not flushed\n");
- }
-
- if (I810_DEBUG) {
- fprintf(stderr,"Got mode in I810Save:\n");
- i810PrintMode( vgaReg, i810Reg );
- }
-}
-
-void i810Preserve(KdCardInfo *card) {
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
-
-/* fprintf(stderr,"i810Preserve\n"); */
- DoSave(card, &vgap->SavedReg, &i810c->SavedReg, TRUE);
-}
-
-/* Famous last words
- */
-void
-i810PrintErrorState(KdCardInfo *card)
-{
-
- I810CardInfo *i810c = card->driver;
-
- fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n",
- INREG(PGETBL_CTL),
- INREG(PGE_ERR));
-
- fprintf(stderr, "ipeir: %lx iphdr: %lx\n",
- INREG(IPEIR),
- INREG(IPEHR));
-
- fprintf(stderr, "LP ring tail: %lx head: %lx len: %lx start %lx\n",
- INREG(LP_RING + RING_TAIL),
- INREG(LP_RING + RING_HEAD) & HEAD_ADDR,
- INREG(LP_RING + RING_LEN),
- INREG(LP_RING + RING_START));
-
- fprintf(stderr, "eir: %x esr: %x emr: %x\n",
- INREG16(EIR),
- INREG16(ESR),
- INREG16(EMR));
-
- fprintf(stderr, "instdone: %x instpm: %x\n",
- INREG16(INST_DONE),
- INREG8(INST_PM));
-
- fprintf(stderr, "memmode: %lx instps: %lx\n",
- INREG(MEMMODE),
- INREG(INST_PS));
-
- fprintf(stderr, "hwstam: %x ier: %x imr: %x iir: %x\n",
- INREG16(HWSTAM),
- INREG16(IER),
- INREG16(IMR),
- INREG16(IIR));
-}
-
-Bool
-i810BindGARTMemory( KdScreenInfo *screen )
-{
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
-
- if (!i810c->GttBound) {
- if (!KdAcquireGART(screen->mynum))
- return FALSE;
- if (!KdBindGARTMemory(screen->mynum, i810c->VramKey,
- i810c->VramOffset))
-
- return FALSE;
- if (i810c->DcacheKey != -1) {
- if (!KdBindGARTMemory(screen->mynum, i810c->DcacheKey,
- i810c->DcacheOffset))
- return FALSE;
- }
- if (i810c->HwcursKey != -1) {
- if (!KdBindGARTMemory(screen->mynum, i810c->HwcursKey,
- i810c->HwcursOffset))
- return FALSE;
- }
- i810c->GttBound = 1;
- }
- return TRUE;
-}
-
-Bool
-i810UnbindGARTMemory(KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
-
-
- if (KdAgpGARTSupported() && i810c->GttBound) {
- if (!KdUnbindGARTMemory(screen->mynum, i810c->VramKey))
- return FALSE;
- if (i810c->DcacheKey != -1) {
- if (!KdUnbindGARTMemory(screen->mynum, i810c->DcacheKey))
- return FALSE;
- }
- if (i810c->HwcursKey != -1) {
- if (!KdUnbindGARTMemory(screen->mynum, i810c->HwcursKey))
- return FALSE;
- }
- if (!KdReleaseGART(screen->mynum))
- return FALSE;
- i810c->GttBound = 0;
- }
- return TRUE;
-}
-
-/*
- * I810CalcVCLK --
- *
- * Determine the closest clock frequency to the one requested.
- */
-
-#define MAX_VCO_FREQ 600.0
-#define TARGET_MAX_N 30
-#define REF_FREQ 24.0
-
-#define CALC_VCLK(m,n,p) \
- (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ
-
-static void
-i810CalcVCLK( KdScreenInfo *screen, double freq )
-{
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
- I810RegPtr i810Reg = &i810c->ModeReg;
-
- int m, n, p;
- double f_out, f_best;
- double f_err;
- double f_vco;
- int m_best = 0, n_best = 0, p_best = 0;
- double f_target = freq;
- double err_max = 0.005;
- double err_target = 0.001;
- double err_best = 999999.0;
-
- p_best = p = log(MAX_VCO_FREQ/f_target)/log((double)2);
- f_vco = f_target * (1 << p);
-
- n = 2;
- do {
- n++;
- m = f_vco / (REF_FREQ / (double)n) / (double)4.0 + 0.5;
- if (m < 3) m = 3;
- f_out = CALC_VCLK(m,n,p);
- f_err = 1.0 - (f_target/f_out);
- if (fabs(f_err) < err_max) {
- m_best = m;
- n_best = n;
- f_best = f_out;
- err_best = f_err;
- }
- } while ((fabs(f_err) >= err_target) &&
- ((n <= TARGET_MAX_N) || (fabs(err_best) > err_max)));
-
- if (fabs(f_err) < err_target) {
- m_best = m;
- n_best = n;
- }
-
- i810Reg->VideoClk2_M = (m_best-2) & 0x3FF;
- i810Reg->VideoClk2_N = (n_best-2) & 0x3FF;
- i810Reg->VideoClk2_DivisorSel = (p_best << 4);
-
-/* fprintf(stderr, "Setting dot clock to %.1f MHz " */
-/* "[ 0x%x 0x%x 0x%x ] " */
-/* "[ %d %d %d ]\n", */
-/* CALC_VCLK(m_best,n_best,p_best), */
-/* i810Reg->VideoClk2_M, */
-/* i810Reg->VideoClk2_N, */
-/* i810Reg->VideoClk2_DivisorSel, */
-/* m_best, n_best, p_best); */
-}
-
-/*
- * I810CalcFIFO --
- *
- * Calculate burst length and FIFO watermark.
- */
-
-#define Elements(x) (sizeof(x)/sizeof(*x))
-
-unsigned int
-i810CalcWatermark( KdScreenInfo *screen, double freq, Bool dcache )
-{
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
-
-
- struct wm_info *tab;
- int nr;
- int i;
-
- if (i810c->LmFreqSel == 100) {
- switch(screen->fb[0].bitsPerPixel) {
- case 8:
- tab = i810_wm_8_100;
- nr = Elements(i810_wm_8_100);
- break;
- case 16:
- tab = i810_wm_16_100;
- nr = Elements(i810_wm_16_100);
- break;
- case 24:
- tab = i810_wm_24_100;
- nr = Elements(i810_wm_24_100);
- break;
- default:
- return 0;
- }
- } else {
- switch(screen->fb[0].bitsPerPixel) {
- case 8:
- tab = i810_wm_8_133;
- nr = Elements(i810_wm_8_133);
- break;
- case 16:
- tab = i810_wm_16_133;
- nr = Elements(i810_wm_16_133);
- break;
- case 24:
- tab = i810_wm_24_133;
- nr = Elements(i810_wm_24_133);
- break;
- default:
- return 0;
- }
- }
-
- for (i = 0 ; i < nr && tab[i].freq < freq ; i++);
-
- if (i == nr)
- i--;
-
-/* fprintf(stderr,"chose watermark 0x%x: (tab.freq %.1f)\n", */
-/* tab[i].wm, tab[i].freq); */
-
- /* None of these values (sourced from intel) have watermarks for
- * the dcache memory. Fake it for now by using the same watermark
- * for both...
- *
- * Update: this is probably because dcache isn't real useful as
- * framebuffer memory, so intel's drivers don't need watermarks
- * for that memory because they never use it to feed the ramdacs.
- * We do use it in the fallback mode, so keep the watermarks for
- * now.
- */
- if (dcache)
- return (tab[i].wm & ~0xffffff) | ((tab[i].wm>>12) & 0xfff);
- else
- return tab[i].wm;
-}
-
-static void i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode )
-{
- int i;
-
- fprintf(stderr," MiscOut: %x\n", vgaReg->MiscOutReg);
-
-
- fprintf(stderr,"SEQ: ");
- for (i = 0 ; i < VGA_NUM_SEQ ; i++) {
- if ((i&7)==0) fprintf(stderr,"\n");
- fprintf(stderr," %d: %x", i, vgaReg->Sequencer[i]);
- }
- fprintf(stderr,"\n");
-
- fprintf(stderr,"CRTC: ");
- for (i = 0 ; i < VGA_NUM_CRTC ; i++) {
- if ((i&3)==0) fprintf(stderr,"\n");
- fprintf(stderr," CR%02x: %2x", i, vgaReg->CRTC[i]);
- }
- fprintf(stderr,"\n");
-
- fprintf(stderr,"GFX: ");
- for (i = 0 ; i < VGA_NUM_GFX ; i++) {
- if ((i&3)==0) fprintf(stderr,"\n");
- fprintf(stderr," GR%02x: %02x", i, vgaReg->Graphics[i]);
- }
- fprintf(stderr,"\n");
-
- fprintf(stderr,"ATTR: ");
- for (i = 0 ; i < VGA_NUM_ATTR ; i++) {
- if ((i&7)==0) fprintf(stderr,"\n");
- fprintf(stderr," %d: %x", i, vgaReg->Attribute[i]);
- }
- fprintf(stderr,"\n");
-
-
- fprintf(stderr," DisplayControl: %x\n", mode->DisplayControl);
- fprintf(stderr," PixelPipeCfg0: %x\n", mode->PixelPipeCfg0);
- fprintf(stderr," PixelPipeCfg1: %x\n", mode->PixelPipeCfg1);
- fprintf(stderr," PixelPipeCfg2: %x\n", mode->PixelPipeCfg2);
- fprintf(stderr," VideoClk2_M: %x\n", mode->VideoClk2_M);
- fprintf(stderr," VideoClk2_N: %x\n", mode->VideoClk2_N);
- fprintf(stderr," VideoClk2_DivisorSel: %x\n", mode->VideoClk2_DivisorSel);
- fprintf(stderr," AddressMapping: %x\n", mode->AddressMapping);
- fprintf(stderr," IOControl: %x\n", mode->IOControl);
- fprintf(stderr," BitBLTControl: %x\n", mode->BitBLTControl);
- fprintf(stderr," ExtVertTotal: %x\n", mode->ExtVertTotal);
- fprintf(stderr," ExtVertDispEnd: %x\n", mode->ExtVertDispEnd);
- fprintf(stderr," ExtVertSyncStart: %x\n", mode->ExtVertSyncStart);
- fprintf(stderr," ExtVertBlankStart: %x\n", mode->ExtVertBlankStart);
- fprintf(stderr," ExtHorizTotal: %x\n", mode->ExtHorizTotal);
- fprintf(stderr," ExtHorizBlank: %x\n", mode->ExtHorizBlank);
- fprintf(stderr," ExtOffset: %x\n", mode->ExtOffset);
- fprintf(stderr," InterlaceControl: %x\n", mode->InterlaceControl);
- fprintf(stderr," LMI_FIFO_Watermark: %x\n", mode->LMI_FIFO_Watermark);
- fprintf(stderr," LprbTail: %x\n", mode->LprbTail);
- fprintf(stderr," LprbHead: %x\n", mode->LprbHead);
- fprintf(stderr," LprbStart: %x\n", mode->LprbStart);
- fprintf(stderr," LprbLen: %x\n", mode->LprbLen);
- fprintf(stderr," OverlayActiveStart: %x\n", mode->OverlayActiveStart);
- fprintf(stderr," OverlayActiveEnd: %x\n", mode->OverlayActiveEnd);
-}
-
-
-/*
- * i810VGASeqReset
- * perform a sequencer reset.
- *
- * The i815 documentation states that these bits are not used by the
- * HW, but still warns about not programming them...
- */
-
-void
-i810VGASeqReset(i810VGAPtr vgap, Bool start)
-{
- if (start)
- {
- mmioWriteSeq(vgap, 0x00, 0x01); /* Synchronous Reset */
- }
- else
- {
- mmioWriteSeq(vgap, 0x00, 0x03); /* End Reset */
- }
-}
-
-void
-i810VGAProtect(KdCardInfo *card, Bool on)
-{
-
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
-
- unsigned char tmp;
-
- if (on) {
- /*
- * Turn off screen and disable sequencer.
- */
- tmp = mmioReadSeq(vgap, 0x01);
-
- i810VGASeqReset(vgap, TRUE); /* start synchronous reset */
- mmioWriteSeq(vgap, 0x01, tmp | 0x20); /* disable the display */
-
- mmioEnablePalette(vgap);
- } else {
- /*
- * Reenable sequencer, then turn on screen.
- */
-
- tmp = mmioReadSeq(vgap, 0x01);
-
- mmioWriteSeq(vgap, 0x01, tmp & ~0x20); /* reenable display */
- i810VGASeqReset(vgap, FALSE); /* clear synchronousreset */
-
- mmioDisablePalette(vgap);
- }
-}
-
-/*
- * i810VGABlankScreen -- blank the screen.
- */
-
-void
-i810VGABlankScreen(KdCardInfo *card, Bool on)
-{
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
-
- unsigned char scrn;
-
- scrn = mmioReadSeq(vgap, 0x01);
-
- if (on) {
- scrn &= ~0x20; /* enable screen */
- } else {
- scrn |= 0x20; /* blank screen */
- }
-
- mmioWriteSeq(vgap,0x00,0x01);
- mmioWriteSeq(vgap, 0x01, scrn); /* change mode */
- mmioWriteSeq(vgap,0x00,0x03);
-}
-
-/* Restore hardware state */
-
-static void
-DoRestore(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg,
- Bool restoreFonts) {
-
-
- I810CardInfo *i810c = card->driver;
-
- i810VGAPtr vgap = &i810c->vga;
-
- unsigned char temp;
- unsigned int itemp;
- int i;
-
- if (I810_DEBUG & DEBUG_VERBOSE_VGA) {
- fprintf(stderr,"Setting mode in DoRestore:\n");
- i810PrintMode( vgaReg, i810Reg );
- }
-
- /* Blank screen (i810vgaprotect) */
- i810VGAProtect(card, TRUE);
-
- /* Should wait for at least two hsync and no more than two vsync
- before writing PIXCONF and turning the display on (?) */
- usleep(50000);
-
- /* Turn off DRAM Refresh */
- temp = INREG8( DRAM_ROW_CNTL_HI );
- temp &= ~DRAM_REFRESH_RATE;
- temp |= DRAM_REFRESH_DISABLE;
- OUTREG8( DRAM_ROW_CNTL_HI, temp );
-
- usleep(1000); /* Wait 1 ms */
-
- /* Write the M, N and P values */
- OUTREG16( VCLK2_VCO_M, i810Reg->VideoClk2_M);
- OUTREG16( VCLK2_VCO_N, i810Reg->VideoClk2_N);
- OUTREG8( VCLK2_VCO_DIV_SEL, i810Reg->VideoClk2_DivisorSel);
-
- /*
- * Turn on 8 bit dac mode, if requested. This is needed to make
- * sure that vgaHWRestore writes the values into the DAC properly.
- * The problem occurs if 8 bit dac mode is requested and the HW is
- * in 6 bit dac mode. If this happens, all the values are
- * automatically shifted left twice by the HW and incorrect colors
- * will be displayed on the screen. The only time this can happen
- * is at server startup time and when switching back from a VT.
- */
- temp = INREG8(PIXPIPE_CONFIG_0);
- temp &= 0x7F; /* Save all but the 8 bit dac mode bit */
- temp |= (i810Reg->PixelPipeCfg0 & DAC_8_BIT);
- OUTREG8( PIXPIPE_CONFIG_0, temp );
-
- /*
- * Code to restore any SVGA registers that have been saved/modified
- * goes here. Note that it is allowable, and often correct, to
- * only modify certain bits in a register by a read/modify/write cycle.
- *
- * A special case - when using an external clock-setting program,
- * this function must not change bits associated with the clock
- * selection. This condition can be checked by the condition:
- *
- * if (i810Reg->std.NoClock >= 0)
- * restore clock-select bits.
- */
-
- /* VGA restore */
- if (vgaReg->MiscOutReg & 0x01)
- vgap->IOBase = VGA_IOBASE_COLOR;
- else
- vgap->IOBase = VGA_IOBASE_MONO;
-
- mmioWriteMiscOut(vgap, vgaReg->MiscOutReg);
-
- for (i = 1; i < VGA_NUM_SEQ; i++)
- mmioWriteSeq(vgap, i, vgaReg->Sequencer[i]);
-
- /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or CRTC[17] */
- /* = CR11 */
- mmioWriteCrtc(vgap, 17, vgaReg->CRTC[17] & ~0x80);
-
- for (i = 0; i < VGA_NUM_CRTC; i++) {
- mmioWriteCrtc(vgap, i, vgaReg->CRTC[i]);
- }
-
- for (i = 0; i < VGA_NUM_GFX; i++)
- mmioWriteGr(vgap, i, vgaReg->Graphics[i]);
-
- mmioEnablePalette(vgap);
- for (i = 0; i < VGA_NUM_ATTR; i++)
- mmioWriteAttr(vgap, i, vgaReg->Attribute[i]);
- mmioDisablePalette(vgap);
-
-
- mmioWriteCrtc(vgap, EXT_VERT_TOTAL, i810Reg->ExtVertTotal);
- mmioWriteCrtc(vgap, EXT_VERT_DISPLAY, i810Reg->ExtVertDispEnd);
- mmioWriteCrtc(vgap, EXT_VERT_SYNC_START, i810Reg->ExtVertSyncStart);
- mmioWriteCrtc(vgap, EXT_VERT_BLANK_START, i810Reg->ExtVertBlankStart);
- mmioWriteCrtc(vgap, EXT_HORIZ_TOTAL, i810Reg->ExtHorizTotal);
- mmioWriteCrtc(vgap, EXT_HORIZ_BLANK, i810Reg->ExtHorizBlank);
-
- /* write CR40, CR42 first etc to get CR13 written as described in PRM */
-
- mmioWriteCrtc(vgap, EXT_START_ADDR_HI, 0);
- mmioWriteCrtc(vgap, EXT_START_ADDR, EXT_START_ADDR_ENABLE);
-
- mmioWriteCrtc(vgap, EXT_OFFSET, i810Reg->ExtOffset);
- mmioWriteCrtc(vgap, 0x13, vgaReg->CRTC[0x13]);
-
- temp=mmioReadCrtc(vgap, INTERLACE_CNTL);
- temp &= ~INTERLACE_ENABLE;
- temp |= i810Reg->InterlaceControl;
- mmioWriteCrtc(vgap, INTERLACE_CNTL, temp);
-
- temp=i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING);
- temp &= 0xE0; /* Save reserved bits 7:5 */
- temp |= i810Reg->AddressMapping;
- i810WriteControlMMIO(i810c, GRX, ADDRESS_MAPPING, temp);
-
- /* Setting the OVRACT Register for video overlay*/
- OUTREG(0x6001C, (i810Reg->OverlayActiveEnd << 16) | i810Reg->OverlayActiveStart);
-
- /* Turn on DRAM Refresh */
- temp = INREG8( DRAM_ROW_CNTL_HI );
- temp &= ~DRAM_REFRESH_RATE;
- temp |= DRAM_REFRESH_60HZ;
- OUTREG8( DRAM_ROW_CNTL_HI, temp );
-
- temp = INREG8( BITBLT_CNTL );
- temp &= ~COLEXP_MODE;
- temp |= i810Reg->BitBLTControl;
- OUTREG8( BITBLT_CNTL, temp );
-
- temp = INREG8( DISPLAY_CNTL );
- temp &= ~(VGA_WRAP_MODE | GUI_MODE);
- temp |= i810Reg->DisplayControl;
- OUTREG8( DISPLAY_CNTL, temp );
-
-
- temp = INREG8( PIXPIPE_CONFIG_0 );
- temp &= 0x64; /* Save reserved bits 6:5,2 */
- temp |= i810Reg->PixelPipeCfg0;
- OUTREG8( PIXPIPE_CONFIG_0, temp );
-
- temp = INREG8( PIXPIPE_CONFIG_2 );
- temp &= 0xF3; /* Save reserved bits 7:4,1:0 */
- temp |= i810Reg->PixelPipeCfg2;
- OUTREG8( PIXPIPE_CONFIG_2, temp );
-
- temp = INREG8( PIXPIPE_CONFIG_1 );
- temp &= ~DISPLAY_COLOR_MODE;
- temp &= 0xEF; /* Restore the CRT control bit */
- temp |= i810Reg->PixelPipeCfg1;
- OUTREG8( PIXPIPE_CONFIG_1, temp );
-
- OUTREG16(EIR, 0);
-
- itemp = INREG(FWATER_BLC);
- itemp &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK |
- MM_BURST_LENGTH | MM_FIFO_WATERMARK );
- itemp |= i810Reg->LMI_FIFO_Watermark;
- OUTREG(FWATER_BLC, itemp);
-
-
- for (i = 0 ; i < 8 ; i++) {
- OUTREG( FENCE+i*4, i810Reg->Fence[i] );
- if (I810_DEBUG & DEBUG_VERBOSE_VGA)
- fprintf(stderr,"Fence Register : %x\n", i810Reg->Fence[i]);
- }
-
- /* First disable the ring buffer (Need to wait for empty first?, if so
- * should probably do it before entering this section)
- */
- itemp = INREG(LP_RING + RING_LEN);
- itemp &= ~RING_VALID_MASK;
- OUTREG(LP_RING + RING_LEN, itemp );
-
- /* Set up the low priority ring buffer.
- */
- OUTREG(LP_RING + RING_TAIL, 0 );
- OUTREG(LP_RING + RING_HEAD, 0 );
-
- i810c->LpRing.head = 0;
- i810c->LpRing.tail = 0;
-
- itemp = INREG(LP_RING + RING_START);
- itemp &= ~(START_ADDR);
- itemp |= i810Reg->LprbStart;
- OUTREG(LP_RING + RING_START, itemp );
-
- itemp = INREG(LP_RING + RING_LEN);
- itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK);
- itemp |= i810Reg->LprbLen;
- OUTREG(LP_RING + RING_LEN, itemp );
-
- i810VGAProtect(card, FALSE);
-
- temp=mmioReadCrtc(vgap, IO_CTNL);
- temp &= ~(EXTENDED_ATTR_CNTL | EXTENDED_CRTC_CNTL);
- temp |= i810Reg->IOControl;
- mmioWriteCrtc(vgap, IO_CTNL, temp);
- /* Protect CRTC[0-7] */
- mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80);
-}
-
-
-static Bool
-i810SetMode(KdScreenInfo *screen, const KdMonitorTiming *t)
-{
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
-
- I810RegPtr i810Reg = &i810c->ModeReg;
- vgaRegPtr pVga = &vgap->ModeReg;
-
- double dclk = t->clock/1000.0;
-
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- pVga->CRTC[0x13] = screen->width >> 3;
- i810Reg->ExtOffset = screen->width >> 11;
- i810Reg->PixelPipeCfg1 = DISPLAY_8BPP_MODE;
- i810Reg->BitBLTControl = COLEXP_8BPP;
- break;
- case 16:
- i810Reg->PixelPipeCfg1 = DISPLAY_16BPP_MODE;
- pVga->CRTC[0x13] = screen->width >> 2;
- i810Reg->ExtOffset = screen->width >> 10;
- i810Reg->BitBLTControl = COLEXP_16BPP;
- break;
- case 24:
- pVga->CRTC[0x13] = (screen->width * 3) >> 3;
- i810Reg->ExtOffset = (screen->width * 3) >> 11;
-
- i810Reg->PixelPipeCfg1 = DISPLAY_24BPP_MODE;
- i810Reg->BitBLTControl = COLEXP_24BPP;
- break;
- default:
- break;
- }
-
- i810Reg->PixelPipeCfg0 = DAC_8_BIT;
-
- /* Do not delay CRT Blank: needed for video overlay */
- i810Reg->PixelPipeCfg1 |= 0x10;
-
- /* Turn on Extended VGA Interpretation */
- i810Reg->IOControl = EXTENDED_CRTC_CNTL;
-
- /* Turn on linear and page mapping */
- i810Reg->AddressMapping = (LINEAR_MODE_ENABLE |
- GTT_MEM_MAP_ENABLE);
-
- /* Turn on GUI mode */
- i810Reg->DisplayControl = HIRES_MODE;
-
- i810Reg->OverlayActiveStart = t->horizontal + t->hblank - 32;
- i810Reg->OverlayActiveEnd = t->horizontal - 32;
-
- /* Turn on interlaced mode if necessary (it's not) */
- i810Reg->InterlaceControl = INTERLACE_DISABLE;
-
- /*
- * Set the overscan color to 0.
- * NOTE: This only affects >8bpp mode.
- */
- pVga->Attribute[0x11] = 0;
-
- /*
- * Calculate the VCLK that most closely matches the requested dot
- * clock.
- */
- i810CalcVCLK(screen, dclk);
-
- /* Since we program the clocks ourselves, always use VCLK2. */
- pVga->MiscOutReg |= 0x0C;
-
- /* Calculate the FIFO Watermark and Burst Length. */
- i810Reg->LMI_FIFO_Watermark = i810CalcWatermark(screen, dclk, FALSE);
-
- /* Setup the ring buffer */
- i810Reg->LprbTail = 0;
- i810Reg->LprbHead = 0;
- i810Reg->LprbStart = i810c->LpRing.mem.Start;
-
- if (i810Reg->LprbStart)
- i810Reg->LprbLen = ((i810c->LpRing.mem.Size-4096) |
- RING_NO_REPORT | RING_VALID);
- else
- i810Reg->LprbLen = RING_INVALID;
-
- return TRUE;
-}
-
-static Bool
-i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t)
-{
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
- vgaRegPtr pVga;
-
-/* fprintf(stderr,"i810ModeInit\n"); */
-
- i810VGAUnlock(vgap);
-
- if (!i810VGAInit(screen, t)) return FALSE;
- pVga = &vgap->ModeReg;
-
- if (!i810SetMode(screen, t)) return FALSE;
-
- DoRestore(screen->card, &vgap->ModeReg, &i810c->ModeReg, FALSE);
-
- return TRUE;
-}
-
-Bool
-i810VGAInit(KdScreenInfo *screen, const KdMonitorTiming *t)
-{
- unsigned int i;
-
- int hactive, hblank, hbp, hfp;
- int vactive, vblank, vbp, vfp;
- int h_screen_off, h_adjust, h_total, h_display_end, h_blank_start;
- int h_blank_end, h_sync_start, h_sync_end, v_total, v_retrace_start;
- int v_retrace_end, v_display_end, v_blank_start, v_blank_end;
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
-
- i810VGAPtr vgap = &i810c->vga;
- I810RegPtr ireg = &i810c->ModeReg;
-
-
- vgaRegPtr regp;
- int depth = screen->fb[0].depth;
-
- regp = &vgap->ModeReg;
-
- /*
- * compute correct Hsync & Vsync polarity
- */
-
- regp->MiscOutReg = 0x23;
- if (t->vpol == KdSyncNegative) regp->MiscOutReg |= 0x40;
- if (t->hpol == KdSyncNegative) regp->MiscOutReg |= 0x80;
-
- /*
- * Time Sequencer
- */
- if (depth == 4)
- regp->Sequencer[0] = 0x02;
- else
- regp->Sequencer[0] = 0x00;
- /* No support for 320 or 360 x resolution */
- regp->Sequencer[1] = 0x01;
-
- if (depth == 1)
- regp->Sequencer[2] = 1 << BIT_PLANE;
- else
- regp->Sequencer[2] = 0x0F;
-
- regp->Sequencer[3] = 0x00; /* Font select */
-
- if (depth < 8)
- regp->Sequencer[4] = 0x06; /* Misc */
- else
- regp->Sequencer[4] = 0x0E; /* Misc */
-
- hactive = t->horizontal;
- hblank = t->hblank;
- hbp = t->hbp;
- hfp = t->hfp;
-
- vactive = t->vertical;
- vblank = t->vblank;
- vbp = t->vbp;
- vfp = t->vfp;
-
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- h_screen_off = hactive;
- h_adjust = 1;
- break;
- case 16:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- h_screen_off = hactive * 2;
- h_adjust = 1;
- break;
- case 24:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- h_screen_off = hactive * 3;
- h_adjust = 1;
- break;
- case 32:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- h_screen_off = hactive * 4;
- h_adjust = 1;
- break;
- }
-
- /*
- * Compute horizontal register values from timings
- */
- h_total = hactive + hblank - 5;
- h_display_end = hactive - 1;
- h_blank_start = h_display_end;
- h_blank_end = h_blank_start + hblank;
-
- h_sync_start = hactive + hfp + h_adjust;
- h_sync_end = h_sync_start + hblank - hbp - hfp;
-
- /* Set CRTC regs for horizontal timings */
- regp->CRTC[0x0] = h_total;
- ireg->ExtHorizTotal=(h_total & 0x100) >> 8;
-
- regp->CRTC[0x1] = h_display_end;
-
- regp->CRTC[0x2] = h_blank_start;
-
- regp->CRTC[0x3] = 0x80 | (h_blank_end & 0x1f);
- regp->CRTC[0x5] = (h_blank_end & 0x20) << 2;
-
- regp->CRTC[0x4] = h_sync_start;
-
- regp->CRTC[0x5] |= h_sync_end & 0x1f;
-
- regp->CRTC[0x13] = h_screen_off;
- ireg->ExtOffset = h_screen_off >> 8;
-
- /* Compute vertical timings */
- v_total = vactive + vblank - 2;
- v_retrace_start = vactive + vfp - 1;
- v_retrace_end = v_retrace_start + vblank - vbp - vfp;
- v_display_end = vactive - 1;
- v_blank_start = vactive - 1;
- v_blank_end = v_blank_start + vblank /* - 1 */;
-
- regp->CRTC[0x6] = v_total;
- ireg->ExtVertTotal = v_total >> 8;
-
- regp->CRTC[0x10] = v_retrace_start;
- ireg->ExtVertSyncStart = v_retrace_start >> 8;
-
- regp->CRTC[0x11] = v_retrace_end;
-
- regp->CRTC[0x12] = v_display_end;
- ireg->ExtVertDispEnd = v_display_end >> 8;
-
- regp->CRTC[0x15] = v_blank_start;
- ireg->ExtVertBlankStart = v_blank_start >> 8;
-
- regp->CRTC[0x16] = v_blank_end;
-
- if (depth < 8)
- regp->CRTC[23] = 0xE3;
- else
- regp->CRTC[23] = 0xC3;
- regp->CRTC[24] = 0xFF;
-
- /*
- * Graphics Display Controller
- */
- regp->Graphics[0] = 0x00;
- regp->Graphics[1] = 0x00;
- regp->Graphics[2] = 0x00;
- regp->Graphics[3] = 0x00;
- if (depth == 1) {
- regp->Graphics[4] = BIT_PLANE;
- regp->Graphics[5] = 0x00;
- } else {
- regp->Graphics[4] = 0x00;
- if (depth == 4)
- regp->Graphics[5] = 0x02;
- else
- regp->Graphics[5] = 0x40;
- }
- regp->Graphics[6] = 0x05;
- regp->Graphics[7] = 0x0F;
- regp->Graphics[8] = 0xFF;
-
- if (depth == 1) {
- /* Initialise the Mono map according to which bit-plane gets used */
-
- Bool flipPixels = FALSE; /* maybe support this in the future? */
-
- for (i=0; i<16; i++)
- if (((i & (1 << BIT_PLANE)) != 0) != flipPixels)
- regp->Attribute[i] = WHITE_VALUE;
- else
- regp->Attribute[i] = BLACK_VALUE;
-
- regp->Attribute[16] = 0x01; /* -VGA2- */
- if (!vgap->ShowOverscan)
- regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */
- } else {
- regp->Attribute[0] = 0x00; /* standard colormap translation */
- regp->Attribute[1] = 0x01;
- regp->Attribute[2] = 0x02;
- regp->Attribute[3] = 0x03;
- regp->Attribute[4] = 0x04;
- regp->Attribute[5] = 0x05;
- regp->Attribute[6] = 0x06;
- regp->Attribute[7] = 0x07;
- regp->Attribute[8] = 0x08;
- regp->Attribute[9] = 0x09;
- regp->Attribute[10] = 0x0A;
- regp->Attribute[11] = 0x0B;
- regp->Attribute[12] = 0x0C;
- regp->Attribute[13] = 0x0D;
- regp->Attribute[14] = 0x0E;
- regp->Attribute[15] = 0x0F;
- if (depth == 4)
- regp->Attribute[16] = 0x81;
- else
- regp->Attribute[16] = 0x41;
- /* Attribute[17] (overscan) was initialised earlier */
- }
- regp->Attribute[18] = 0x0F;
- regp->Attribute[19] = 0x00;
- regp->Attribute[20] = 0x00;
-
- return(TRUE);
-}
-
-void
-i810VGALock(i810VGAPtr vgap)
-{
- /* Protect CRTC[0-7] */
- mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) & ~0x80);
-}
-
-void
-i810VGAUnlock(i810VGAPtr vgap)
-{
- /* Unprotect CRTC[0-7] */
- mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80);
-}
-
-static void
-i810Restore(KdCardInfo *card) {
-
- I810CardInfo *i810c = card->driver;
-
- i810VGAPtr vgap = &i810c->vga;
-
- if (I810_DEBUG)
- fprintf(stderr,"i810Restore\n");
-
- DoRestore(card, &vgap->SavedReg, &i810c->SavedReg, TRUE);
-}
-
-Bool
-i810Enable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- I810CardInfo *i810c = card->driver;
- i810VGAPtr vgap = &i810c->vga;
- const KdMonitorTiming *t;
-
- if (I810_DEBUG)
- fprintf(stderr,"i810Enable\n");
-
- vgap->IOBase = (mmioReadMiscOut(vgap) & 0x01) ?
- VGA_IOBASE_COLOR : VGA_IOBASE_MONO;
-
- {
- I810RegPtr i810Reg = &i810c->ModeReg;
- int i;
-
- for (i = 0 ; i < 8 ; i++)
- i810Reg->Fence[i] = 0;
- }
-
- t = KdFindMode (screen, i810ModeSupported);
-
- if (!i810BindGARTMemory(screen))
- return FALSE;
-
- if (!i810ModeInit(screen, t)) return FALSE;
-
- {
- /* DPMS power on state */
-
- unsigned char SEQ01=0;
- int DPMSSyncSelect=0;
-
- SEQ01 = 0x00;
- DPMSSyncSelect = HSYNC_ON | VSYNC_ON;
-
- SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20;
- i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01);
-
- /* Set the DPMS mode */
- OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect);
- }
-#ifdef XV
- KdXVEnable (pScreen);
-#endif
- return TRUE;
-}
-
-
-void
-i810Disable(ScreenPtr pScreen) {
-
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- I810CardInfo *i810c = card->driver;
-
- i810VGAPtr vgap = &i810c->vga;
-
- if (I810_DEBUG)
- fprintf(stderr,"i810Disable\n");
-
-#ifdef XV
- KdXVDisable (pScreen);
-#endif
- i810Restore(screen->card);
-
- if (!i810UnbindGARTMemory(screen))
- return;
-
- i810VGALock(vgap);
-}
-
-
-static Bool
-i810DPMS(ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- I810CardInfo *i810c = card->driver;
-
- unsigned char SEQ01=0;
- int DPMSSyncSelect=0;
-
- if (I810_DEBUG)
- fprintf(stderr,"i810DPMS: %d\n",mode);
-
- switch (mode) {
- case KD_DPMS_NORMAL:
- /* Screen: On; HSync: On, VSync: On */
- SEQ01 = 0x00;
- DPMSSyncSelect = HSYNC_ON | VSYNC_ON;
- break;
- case KD_DPMS_STANDBY:
- /* Screen: Off; HSync: Off, VSync: On */
- SEQ01 = 0x20;
- DPMSSyncSelect = HSYNC_OFF | VSYNC_ON;
- break;
- case KD_DPMS_SUSPEND:
- /* Screen: Off; HSync: On, VSync: Off */
- SEQ01 = 0x20;
- DPMSSyncSelect = HSYNC_ON | VSYNC_OFF;
- break;
- case KD_DPMS_POWERDOWN:
- /* Screen: Off; HSync: Off, VSync: Off */
- SEQ01 = 0x20;
- DPMSSyncSelect = HSYNC_OFF | VSYNC_OFF;
- break;
- }
-
- /* Turn the screen on/off */
- SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20;
- i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01);
-
- /* Set the DPMS mode */
- OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect);
- return TRUE;
-}
-
-
-void i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c) {
-
- if (I810_DEBUG)
- fprintf(stderr,"i810GetColors (NOT IMPLEMENTED)\n");
-}
-
-#define DACDelay(hw) \
- do { \
- unsigned char temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
- temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
- } while (0)
-
-void i810PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) {
-
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- i810VGAPtr vgap = &i810c->vga;
-
- if (I810_DEBUG)
- fprintf(stderr,"i810PutColors\n");
-
- while (ndef--)
- {
- mmioWriteDacWriteAddr(vgap, pdefs->pixel);
- DACDelay(vgap);
- mmioWriteDacData(vgap, pdefs->red);
- DACDelay(vgap);
- mmioWriteDacData(vgap, pdefs->green);
- DACDelay(vgap);
- mmioWriteDacData(vgap, pdefs->blue);
- DACDelay(vgap);
-
- pdefs++;
- }
-}
-
-
-KdCardFuncs i810Funcs = {
- i810CardInit, /* cardinit */
- i810ScreenInit, /* scrinit */
- i810InitScreen, /* initScreen */
- i810Preserve, /* preserve */
- i810Enable, /* enable */
- i810DPMS, /* dpms */
- i810Disable, /* disable */
- i810Restore, /* restore */
- i810ScreenFini, /* scrfini */
- i810CardFini, /* cardfini */
-
- i810CursorInit, /* initCursor */
- i810CursorEnable, /* enableCursor */
- i810CursorDisable, /* disableCursor */
- i810CursorFini, /* finiCursor */
- NULL, /* recolorCursor */
-
- i810InitAccel, /* initAccel */
- i810EnableAccel, /* enableAccel */
- i810SyncAccel, /* syncAccel */
- i810DisableAccel, /* disableAccel */
- i810FiniAccel, /* finiAccel */
-
- i810GetColors, /* getColors */
- i810PutColors, /* putColors */
-};
diff --git a/hw/kdrive/i810/i810.h b/hw/kdrive/i810/i810.h
deleted file mode 100644
index bb8091fe4..000000000
--- a/hw/kdrive/i810/i810.h
+++ /dev/null
@@ -1,503 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/* $RCSId: $ */
-
-/*
- * Author:
- * Pontus Lidman <pontus.lidman@nokia.com>
- */
-
-#ifndef _I810_H_
-#define _I810_H_
-
-#include "i810_reg.h"
-
-/* Globals */
-
-typedef struct _I810Rec *I810Ptr;
-
-/* Linear region allocated in framebuffer.
- */
-typedef struct {
- unsigned long Start;
- unsigned long End;
- unsigned long Size;
-} I810MemRange;
-
-typedef struct {
- int tail_mask;
- I810MemRange mem;
- unsigned char *virtual_start;
- int head;
- int tail;
- int space;
-} I810RingBuffer;
-
-typedef struct {
- unsigned char DisplayControl;
- unsigned char PixelPipeCfg0;
- unsigned char PixelPipeCfg1;
- unsigned char PixelPipeCfg2;
- unsigned short VideoClk2_M;
- unsigned short VideoClk2_N;
- unsigned char VideoClk2_DivisorSel;
- unsigned char AddressMapping;
- unsigned char IOControl;
- unsigned char BitBLTControl;
- unsigned char ExtVertTotal;
- unsigned char ExtVertDispEnd;
- unsigned char ExtVertSyncStart;
- unsigned char ExtVertBlankStart;
- unsigned char ExtHorizTotal;
- unsigned char ExtHorizBlank;
- unsigned char ExtOffset;
- unsigned char InterlaceControl;
- unsigned int LMI_FIFO_Watermark;
-
- unsigned int LprbTail;
- unsigned int LprbHead;
- unsigned int LprbStart;
- unsigned int LprbLen;
-
- unsigned int Fence[8];
-
- unsigned short OverlayActiveStart;
- unsigned short OverlayActiveEnd;
-
-
-} I810RegRec, *I810RegPtr;
-
-#define minb(p) *(volatile CARD8 *)(i810c->MMIOBase + (p))
-#define moutb(p,v) *(volatile CARD8 *)(i810c->MMIOBase + (p)) = (v)
-
-#define OUT_RING(n) { \
- if (I810_DEBUG & DEBUG_VERBOSE_RING) \
- ErrorF( "OUT_RING %x: %x\n", outring, n); \
- *(volatile unsigned int *)(virt + outring) = n; \
- outring += 4; \
- outring &= ringmask; \
-}
-
-#define ADVANCE_LP_RING() { \
- i810c->LpRing.tail = outring; \
- OUTREG(LP_RING + RING_TAIL, outring); \
-}
-
-#ifdef __GNUC__
-#define LP_RING_MESSAGE(n) \
- ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__)
-#else
-#define LP_RING_MESSAGE(n) \
- ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__)
-#endif
-
-#define BEGIN_LP_RING(n) \
- unsigned int outring, ringmask; \
- volatile unsigned char *virt; \
- if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) i810Sync( screen ); \
- if (i810c->LpRing.space < n*4) i810WaitLpRing( screen, n*4, 0); \
- i810c->LpRing.space -= n*4; \
- if (I810_DEBUG & DEBUG_VERBOSE_RING) \
- LP_RING_MESSAGE(n); \
- outring = i810c->LpRing.tail; \
- ringmask = i810c->LpRing.tail_mask; \
- virt = i810c->LpRing.virtual_start;
-
-/* Memory mapped register access macros */
-#define INREG8(addr) *(volatile CARD8 *)(i810c->MMIOBase + (addr))
-#define INREG16(addr) *(volatile CARD16 *)(i810c->MMIOBase + (addr))
-#define INREG(addr) *(volatile CARD32 *)(i810c->MMIOBase + (addr))
-
-#define OUTREG8(addr, val) do { \
- *(volatile CARD8 *)(i810c->MMIOBase + (addr)) = (val); \
- if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
- ErrorF( "OUTREG8(%x, %x)\n", addr, val); \
-} while (0)
-
-#define OUTREG16(addr, val) do { \
- *(volatile CARD16 *)(i810c->MMIOBase + (addr)) = (val); \
- if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
- ErrorF( "OUTREG16(%x, %x)\n", addr, val); \
-} while (0)
-
-#define OUTREG(addr, val) do { \
- *(volatile CARD32 *)(i810c->MMIOBase + (addr)) = (val); \
- if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
- ErrorF( "OUTREG(%x, %x)\n", addr, val); \
-} while (0)
-
-/* To remove all debugging, make sure I810_DEBUG is defined as a
- * preprocessor symbol, and equal to zero.
- */
-
-#define I810_DEBUG 0
-
-#ifndef I810_DEBUG
-#warning "Debugging enabled - expect reduced performance"
-extern int I810_DEBUG;
-#endif
-
-#define DEBUG_VERBOSE_ACCEL 0x1
-#define DEBUG_VERBOSE_SYNC 0x2
-#define DEBUG_VERBOSE_VGA 0x4
-#define DEBUG_VERBOSE_RING 0x8
-#define DEBUG_VERBOSE_OUTREG 0x10
-#define DEBUG_VERBOSE_MEMORY 0x20
-#define DEBUG_VERBOSE_CURSOR 0x40
-#define DEBUG_ALWAYS_SYNC 0x80
-#define DEBUG_VERBOSE_DRI 0x100
-
-
-/* Size of the mmio region.
- */
-#define I810_REG_SIZE 0x80000
-
-/* PCI identifiers */
-#ifndef PCI_CHIP_I810
-#define PCI_CHIP_I810 0x7121
-#define PCI_CHIP_I810_DC100 0x7123
-#define PCI_CHIP_I810_E 0x7125
-#define PCI_CHIP_I815 0x1132
-#define PCI_CHIP_I810_BRIDGE 0x7120
-#define PCI_CHIP_I810_DC100_BRIDGE 0x7122
-#define PCI_CHIP_I810_E_BRIDGE 0x7124
-#define PCI_CHIP_I815_BRIDGE 0x1130
-#endif
-
-
-#define IS_I810(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I810 || \
- i810c->PciInfo->chipType == PCI_CHIP_I810_DC100 || \
- i810c->PciInfo->chipType == PCI_CHIP_I810_E)
-#define IS_I815(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I815)
-
-
-/* default number of VGA registers stored internally */
-#define VGA_NUM_CRTC 25 /* 0x19 */
-#define VGA_NUM_SEQ 5
-#define VGA_NUM_GFX 9
-#define VGA_NUM_ATTR 21
-
-/*
- * Settings of standard VGA registers.
- */
-typedef struct {
- unsigned char MiscOutReg; /* */
- unsigned char CRTC[VGA_NUM_CRTC]; /* Crtc Controller */
- unsigned char Sequencer[VGA_NUM_SEQ]; /* Video Sequencer */
- unsigned char Graphics[VGA_NUM_GFX]; /* Video Graphics */
- unsigned char Attribute[VGA_NUM_ATTR]; /* Video Atribute */
- unsigned char DAC[768]; /* Internal Colorlookuptable */
-} vgaRegRec, *vgaRegPtr;
-
-
-typedef struct _i810VGARec *i810VGAPtr;
-
-/* VGA registers */
-typedef struct _i810VGARec {
- int IOBase; /* I/O Base address */
- CARD8 * MMIOBase; /* Pointer to MMIO start */
- vgaRegRec SavedReg; /* saved registers */
- vgaRegRec ModeReg; /* register settings for
- current mode */
- Bool ShowOverscan;
- Bool paletteEnabled;
- Bool cmapSaved;
-} i810VGARec;
-
-typedef struct _i810CardInfo {
- int videoRam;
- int MaxClock;
- long FbMapSize;
- int cpp; /* chars per pixel */
-
- unsigned long LinearAddr;
- unsigned long MMIOAddr;
-
- unsigned char *MMIOBase;
- unsigned char *FbBase;
-
- Bool GttBound;
- Bool agpAcquired2d;
- int VramKey;
- unsigned long VramOffset;
- int DcacheKey;
- unsigned long DcacheOffset;
- int HwcursKey;
- unsigned long HwcursOffset;
-
- I810MemRange DcacheMem;
- I810MemRange SysMem;
-
- I810MemRange SavedDcacheMem;
- I810MemRange SavedSysMem;
-
- unsigned int bufferOffset; /* for I810SelectBuffer */
- Bool DoneFrontAlloc;
- BoxRec FbMemBox;
- I810MemRange FrontBuffer;
- I810MemRange Scratch;
- I810MemRange XvMem;
-
- int LmFreqSel;
-
- i810VGARec vga;
-
- I810RegRec SavedReg;
- I810RegRec ModeReg;
- I810RingBuffer LpRing;
-
- unsigned int BR[20];
-
- int CursorOffset;
- unsigned long CursorPhysical;
- unsigned long CursorStart;
- unsigned long OverlayPhysical;
- unsigned long OverlayStart;
- int colorKey;
-
- Bool NeedToSync; /* Need to sync accel stuff */
-
- int nextColorExpandBuf;
-
- ScreenBlockHandlerProcPtr BlockHandler;
-
-#ifdef XV
- KdVideoAdaptorPtr adaptor;
-#endif
-
-} I810CardInfo;
-
-#define getI810CardInfo(kd) ((I810CardInfo *) ((kd)->card->driver))
-#define i810CardInfo(kd) I810CardInfo *i810c = getI810CardInfo(kd)
-
-#define getI810ScreenInfo(kd) ((I810ScreenInfo *) ((kd)->screen->driver))
-#define i810ScreenInfo(kd) I810ScreenInfo *i810s = getI810ScreenInfo(kd)
-
-typedef struct _i810Cursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
-} i810Cursor, *i810CursorPtr;
-
-typedef struct _i810ScreenInfo {
- i810Cursor cursor;
-} I810ScreenInfo;
-
-#define I810_CURSOR_HEIGHT 64
-#define I810_CURSOR_WIDTH 64
-
-/* init functions (i810.c) */
-
-Bool
-i810CardInit (KdCardInfo *card);
-
-Bool
-i810ScreenInit (KdScreenInfo *screen);
-
-/* The cursor functions (i810_cursor.c) */
-
-Bool
-i810CursorInit(ScreenPtr pScreen);
-
-void
-i810CursorEnable (ScreenPtr pScreen);
-
-void
-i810CursorDisable (ScreenPtr pScreen);
-
-void
-i810CursorFini (ScreenPtr pScreen);
-
-/* Accel functions (i810draw.c) */
-
-Bool
-i810InitAccel(ScreenPtr);
-
-void
-i810EnableAccel (ScreenPtr);
-
-void
-i810SyncAccel (ScreenPtr);
-
-void
-i810DisableAccel (ScreenPtr);
-
-void
-i810FiniAccel (ScreenPtr);
-
-void
-i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask);
-
-
-extern KdCardFuncs i810Funcs;
-
-/* Standard VGA registers */
-
-#define VGA_ATTR_INDEX 0x3C0
-#define VGA_ATTR_DATA_W 0x3C0
-#define VGA_ATTR_DATA_R 0x3C1
-#define VGA_IN_STAT_0 0x3C2 /* read */
-#define VGA_MISC_OUT_W 0x3C2 /* write */
-#define VGA_ENABLE 0x3C3
-#define VGA_SEQ_INDEX 0x3C4
-#define VGA_SEQ_DATA 0x3C5
-#define VGA_DAC_MASK 0x3C6
-#define VGA_DAC_READ_ADDR 0x3C7
-#define VGA_DAC_WRITE_ADDR 0x3C8
-#define VGA_DAC_DATA 0x3C9
-#define VGA_FEATURE_R 0x3CA /* read */
-#define VGA_MISC_OUT_R 0x3CC /* read */
-#define VGA_GRAPH_INDEX 0x3CE
-#define VGA_GRAPH_DATA 0x3CF
-
-#define VGA_IOBASE_MONO 0x3B0
-#define VGA_IOBASE_COLOR 0x3D0
-
-#define VGA_CRTC_INDEX_OFFSET 0x04
-#define VGA_CRTC_DATA_OFFSET 0x05
-#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
-#define VGA_FEATURE_W_OFFSET 0x0A /* write */
-
-/* VGA stuff */
-#define BIT_PLANE 3 /* Which plane we write to in mono mode */
-
-/* DAC indices for white and black */
-#define WHITE_VALUE 0x3F
-#define BLACK_VALUE 0x00
-#define OVERSCAN_VALUE 0x01
-
-#define OVERSCAN 0x11 /* Index of OverScan register */
-
-void
-i810VGAUnlock(i810VGAPtr vgap);
-
-void
-i810VGALock(i810VGAPtr vgap);
-
-Bool
-i810VGAInit(KdScreenInfo *scrninfp, const KdMonitorTiming *t);
-
-void
-i810VGABlankScreen(KdCardInfo *card, Bool on);
-
-void
-i810AdjustFrame(KdScreenInfo *screen, int x, int y, int flags);
-
-Bool
-i810VGAMapMem(KdCardInfo *card);
-
-void
-i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags);
-
-void
-i810PrintErrorState(KdCardInfo *card);
-
-void
-i810VGAGetIOBase(i810VGAPtr vgap);
-
-/*
- * MMIO versions of the register access functions. These require
- * hwp->MemBase to be set in such a way that when the standard VGA port
- * address is added the correct memory address results.
- */
-
-#define Vminb(p) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)))
-#define Vmoutb(p,v) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)) = (v))
-
-#define mmioWriteCrtc(vgap, index, value) { \
- Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index); \
- Vmoutb(vgap->IOBase + VGA_CRTC_DATA_OFFSET, value); \
-}
-
-#define mmioReadCrtc(vgap, index) ( \
- Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index), \
- Vminb(vgap->IOBase + VGA_CRTC_DATA_OFFSET) \
-)
-
-#define mmioWriteGr(vgap, index, value) { \
- Vmoutb(VGA_GRAPH_INDEX, index); \
- Vmoutb(VGA_GRAPH_DATA, value); \
-}
-
-#define mmioReadGr(vgap, index) ( \
- Vmoutb(VGA_GRAPH_INDEX, index), \
- Vminb(VGA_GRAPH_DATA) \
-)
-
-#define mmioWriteSeq(vgap, index, value) {\
- Vmoutb(VGA_SEQ_INDEX, index); \
- Vmoutb(VGA_SEQ_DATA, value); \
-}
-
-#define mmioReadSeq(vgap, index) ( \
- Vmoutb(VGA_SEQ_INDEX, index), \
- Vminb(VGA_SEQ_DATA) \
-)
-
-#define mmioWriteAttr(vgap, index, value) { \
- (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
- Vmoutb(VGA_ATTR_INDEX, index); \
- Vmoutb(VGA_ATTR_DATA_W, value); \
-}
-
-#define mmioReadAttr(vgap, index) ( \
- (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET), \
- Vmoutb(VGA_ATTR_INDEX, index), \
- Vminb(VGA_ATTR_DATA_R) \
-)
-
-#define mmioWriteMiscOut(vgap, value) Vmoutb(VGA_MISC_OUT_W, value)
-
-
-#define mmioReadMiscOut(vgap) Vminb(VGA_MISC_OUT_R)
-
-#define mmioEnablePalette(vgap) { \
- (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
- Vmoutb(VGA_ATTR_INDEX, 0x00); \
- vgap->paletteEnabled = TRUE; \
-}
-
-#define mmioDisablePalette(vgap) { \
- (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
- Vmoutb(VGA_ATTR_INDEX, 0x20); \
- vgap->paletteEnabled = FALSE; \
-}
-
-#define mmioWriteDacWriteAddr(vgap, value) Vmoutb(VGA_DAC_WRITE_ADDR, value)
-
-#define mmioWriteDacData(vgap, value) Vmoutb(VGA_DAC_DATA, value)
-
-#endif /* _I810_H_ */
diff --git a/hw/kdrive/i810/i810_cursor.c b/hw/kdrive/i810/i810_cursor.c
deleted file mode 100644
index c448f3471..000000000
--- a/hw/kdrive/i810/i810_cursor.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/**************************************************************************
-
-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.
-
-**************************************************************************/
-
-
-
-/* $RCSId: xc/programs/Xserver/hw/kdrive/i810/i810_cursor.c,v 1.2 2001/12/10 16:34:20 keithp Exp $ */
-
-/* i810_cursor.c: KDrive hardware cursor routines for the i810 chipset */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Pontus Lidman <pontus.lidman@nokia.com>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kxv.h"
-#include "i810.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- i810CardInfo(pScreenPriv); \
- i810ScreenInfo(pScreenPriv); \
- i810Cursor *pCurPriv = &i810s->cursor
-
-
-static void
-writeStandardMMIO(I810CardInfo *i810c, int addr, CARD8 val) {
- moutb(addr, val);
-}
-
-void
-_i810MoveCursor(ScreenPtr pScreen, int x, int y) {
- SetupCursor(pScreen);
- int flag;
-
- if (I810_DEBUG & DEBUG_VERBOSE_CURSOR)
- ErrorF( "I810SetCursorPosition %d %d\n", x, y);
-
- x += i810c->CursorOffset;
-
- if (x >= 0) flag = CURSOR_X_POS;
- else {
- flag = CURSOR_X_NEG;
- x=-x;
- }
-
- OUTREG8( CURSOR_X_LO, x&0xFF);
- OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag));
-
- if (y >= 0) flag = CURSOR_Y_POS;
- else {
- flag = CURSOR_Y_NEG;
- y=-y;
- }
- OUTREG8( CURSOR_Y_LO, y&0xFF);
- OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag));
-
- /* Enable cursor */
- OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical);
- OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C);
-
-}
-
-static void i810LoadCursor(ScreenPtr pScreen, int x, int y);
-
-static void
-i810MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _i810MoveCursor (pScreen, x, y);
-
- i810LoadCursor(pScreen, x, y);
-}
-
-static void
-_i810SetCursorColors(ScreenPtr pScreen) { /* int bg, int fg */
-
- SetupCursor(pScreen);
- int tmp;
-
- int bg = 0xffffff;
- int fg = 0x000000;
-
- tmp=INREG8(PIXPIPE_CONFIG_0);
- tmp |= EXTENDED_PALETTE;
- OUTREG8( PIXPIPE_CONFIG_0, tmp);
-
- writeStandardMMIO(i810c, DACMASK, 0xFF);
- writeStandardMMIO(i810c, DACWX, 0x04);
-
- writeStandardMMIO(i810c, DACDATA, (bg & 0x00FF0000) >> 16);
- writeStandardMMIO(i810c, DACDATA, (bg & 0x0000FF00) >> 8);
- writeStandardMMIO(i810c, DACDATA, (bg & 0x000000FF));
-
- writeStandardMMIO(i810c, DACDATA, (fg & 0x00FF0000) >> 16);
- writeStandardMMIO(i810c, DACDATA, (fg & 0x0000FF00) >> 8);
- writeStandardMMIO(i810c, DACDATA, (fg & 0x000000FF));
-
- tmp=INREG8( PIXPIPE_CONFIG_0 );
- tmp &= ~EXTENDED_PALETTE;
- OUTREG8( PIXPIPE_CONFIG_0, tmp );
-}
-
-#define InvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-static void i810LoadCursor(ScreenPtr pScreen, int x, int y) {
-
- SetupCursor(pScreen);
-
- int w, h;
- unsigned short r;
- unsigned int *msk, *mskLine, *src, *srcLine;
-
- int i, j;
- int src_stride, src_width;
-
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- CARD8 tmp;
- unsigned int *ram, *ramLine;
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- ramLine = (unsigned int *) (i810c->FbBase + i810c->CursorStart);
- mskLine = (unsigned int *) (bits->mask);
- srcLine = (unsigned int *) (bits->source);
-
- h = bits->height;
- if (h > I810_CURSOR_HEIGHT)
- h = I810_CURSOR_HEIGHT;
-
- src_stride = BitmapBytePad(bits->width); /* bytes per line */
- src_stride = (src_stride +3) >> 2;
- src_width = (bits->width + 31) >> 5;
-
- for (i = 0; i < I810_CURSOR_HEIGHT; i++) {
-
- msk = mskLine;
- src = srcLine;
- ram = ramLine;
- mskLine += src_stride;
- srcLine += src_stride;
- ramLine += I810_CURSOR_WIDTH / 16;
-
- for (j = 0; j < I810_CURSOR_WIDTH / 32; j++) {
-
- unsigned long m, s, b1, b2;
-
- if (i < h && j < src_width)
- {
- m = *msk++;
- s = *src++ & m;
- m = ~m;
- /* mask off right side */
- if (j == src_width - 1 && (bits->width & 31))
- {
- m |= 0xffffffff << (bits->width & 31);
- }
- }
- else
- {
- m = 0xffffffff;
- s = 0x00000000;
- }
-
- InvertBits32(s);
- InvertBits32(m);
-
- ram[2+j]=s;
- ram[0+j]=m;
- }
- }
- /* Set new color */
- _i810SetCursorColors (pScreen);
-
- /* Move to new position */
- _i810MoveCursor (pScreen, x, y);
-
- /* Enable cursor */
- OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical);
- OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C);
-
- tmp = INREG8( PIXPIPE_CONFIG_0 );
- tmp |= HW_CURSOR_ENABLE;
- OUTREG8( PIXPIPE_CONFIG_0, tmp);
-}
-
-static void
-i810UnloadCursor(ScreenPtr pScreen) {
-
- SetupCursor(pScreen);
-
- unsigned char tmp;
-
- tmp=INREG8( PIXPIPE_CONFIG_0 );
- tmp &= ~HW_CURSOR_ENABLE;
- OUTREG8( PIXPIPE_CONFIG_0, tmp);
-}
-
-
-static Bool
-i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- i810LoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-i810UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-i810SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- i810LoadCursor (pScreen, x, y);
- else
- i810UnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec i810PointerSpriteFuncs = {
- i810RealizeCursor,
- i810UnrealizeCursor,
- i810SetCursor,
- i810MoveCursor,
-};
-
-static void
-i810QueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-i810CursorInit(ScreenPtr pScreen)
-{
-
- SetupCursor(pScreen);
-
- if (!i810c->CursorStart) {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = I810_CURSOR_WIDTH;
- pCurPriv->height= I810_CURSOR_HEIGHT;
- pScreen->QueryBestSize = i810QueryBestSize;
- miPointerInitialize (pScreen,
- &i810PointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-i810CursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- i810LoadCursor (pScreen, x, y);
- }
- else
- i810UnloadCursor (pScreen);
- }
-}
-
-void
-i810CursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- i810UnloadCursor (pScreen);
- }
- }
-}
-
-void
-i810CursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
-
diff --git a/hw/kdrive/i810/i810_reg.h b/hw/kdrive/i810/i810_reg.h
deleted file mode 100644
index e6648a1de..000000000
--- a/hw/kdrive/i810/i810_reg.h
+++ /dev/null
@@ -1,696 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/**************************************************************************
-
-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.
-
-**************************************************************************/
-/* $RCSId: xc/programs/Xserver/hw/kdrive/i810/i810_reg.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Pontus Lidman <pontus.lidman@nokia.com>
- *
- * based on the i740 driver by
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- *
- */
-
-/* I/O register offsets
- */
-#define SRX 0x3C4 /* p208 */
-#define GRX 0x3CE /* p213 */
-#define ARX 0x3C0 /* p224 */
-
-/* VGA Color Palette Registers */
-#define DACMASK 0x3C6 /* p232 */
-#define DACSTATE 0x3C7 /* p232 */
-#define DACRX 0x3C7 /* p233 */
-#define DACWX 0x3C8 /* p233 */
-#define DACDATA 0x3C9 /* p233 */
-
-/* CRT Controller Registers (CRX) */
-#define START_ADDR_HI 0x0C /* p246 */
-#define START_ADDR_LO 0x0D /* p247 */
-#define VERT_SYNC_END 0x11 /* p249 */
-#define EXT_VERT_TOTAL 0x30 /* p257 */
-#define EXT_VERT_DISPLAY 0x31 /* p258 */
-#define EXT_VERT_SYNC_START 0x32 /* p259 */
-#define EXT_VERT_BLANK_START 0x33 /* p260 */
-#define EXT_HORIZ_TOTAL 0x35 /* p261 */
-#define EXT_HORIZ_BLANK 0x39 /* p261 */
-#define EXT_START_ADDR 0x40 /* p262 */
-#define EXT_START_ADDR_ENABLE 0x80
-#define EXT_OFFSET 0x41 /* p263 */
-#define EXT_START_ADDR_HI 0x42 /* p263 */
-#define INTERLACE_CNTL 0x70 /* p264 */
-#define INTERLACE_ENABLE 0x80
-#define INTERLACE_DISABLE 0x00
-
-/* Miscellaneous Output Register
- */
-#define MSR_R 0x3CC /* p207 */
-#define MSR_W 0x3C2 /* p207 */
-#define IO_ADDR_SELECT 0x01
-
-#define MDA_BASE 0x3B0 /* p207 */
-#define CGA_BASE 0x3D0 /* p207 */
-
-/* CR80 - IO Control, p264
- */
-#define IO_CTNL 0x80
-#define EXTENDED_ATTR_CNTL 0x02
-#define EXTENDED_CRTC_CNTL 0x01
-
-/* GR10 - Address mapping, p221
- */
-#define ADDRESS_MAPPING 0x10
-#define PAGE_TO_LOCAL_MEM_ENABLE 0x10
-#define GTT_MEM_MAP_ENABLE 0x08
-#define PACKED_MODE_ENABLE 0x04
-#define LINEAR_MODE_ENABLE 0x02
-#define PAGE_MAPPING_ENABLE 0x01
-
-/* Blitter control, p378
- */
-#define BITBLT_CNTL 0x7000c
-#define COLEXP_MODE 0x30
-#define COLEXP_8BPP 0x00
-#define COLEXP_16BPP 0x10
-#define COLEXP_24BPP 0x20
-#define COLEXP_RESERVED 0x30
-#define BITBLT_STATUS 0x01
-
-/* p375.
- */
-#define DISPLAY_CNTL 0x70008
-#define VGA_WRAP_MODE 0x02
-#define VGA_WRAP_AT_256KB 0x00
-#define VGA_NO_WRAP 0x02
-#define GUI_MODE 0x01
-#define STANDARD_VGA_MODE 0x00
-#define HIRES_MODE 0x01
-
-/* p375
- */
-#define PIXPIPE_CONFIG_0 0x70009
-#define DAC_8_BIT 0x80
-#define DAC_6_BIT 0x00
-#define HW_CURSOR_ENABLE 0x10
-#define EXTENDED_PALETTE 0x01
-
-/* p375
- */
-#define PIXPIPE_CONFIG_1 0x7000a
-#define DISPLAY_COLOR_MODE 0x0F
-#define DISPLAY_VGA_MODE 0x00
-#define DISPLAY_8BPP_MODE 0x02
-#define DISPLAY_15BPP_MODE 0x04
-#define DISPLAY_16BPP_MODE 0x05
-#define DISPLAY_24BPP_MODE 0x06
-#define DISPLAY_32BPP_MODE 0x07
-
-/* p375
- */
-#define PIXPIPE_CONFIG_2 0x7000b
-#define DISPLAY_GAMMA_ENABLE 0x08
-#define DISPLAY_GAMMA_DISABLE 0x00
-#define OVERLAY_GAMMA_ENABLE 0x04
-#define OVERLAY_GAMMA_DISABLE 0x00
-
-
-/* p380
- */
-#define DISPLAY_BASE 0x70020
-#define DISPLAY_BASE_MASK 0x03fffffc
-
-
-/* Cursor control registers, pp383-384
- */
-#define CURSOR_CONTROL 0x70080
-#define CURSOR_ORIGIN_SCREEN 0x00
-#define CURSOR_ORIGIN_DISPLAY 0x10
-#define CURSOR_MODE 0x07
-#define CURSOR_MODE_DISABLE 0x00
-#define CURSOR_MODE_32_4C_AX 0x01
-#define CURSOR_MODE_64_3C 0x04
-#define CURSOR_MODE_64_4C_AX 0x05
-#define CURSOR_MODE_64_4C 0x06
-#define CURSOR_MODE_RESERVED 0x07
-#define CURSOR_BASEADDR 0x70084
-#define CURSOR_BASEADDR_MASK 0x1FFFFF00
-#define CURSOR_X_LO 0x70088
-#define CURSOR_X_HI 0x70089
-#define CURSOR_X_POS 0x00
-#define CURSOR_X_NEG 0x80
-#define CURSOR_Y_LO 0x7008A
-#define CURSOR_Y_HI 0x7008B
-#define CURSOR_Y_POS 0x00
-#define CURSOR_Y_NEG 0x80
-
-
-
-/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
- * not sure they refer to local (graphics) memory.
- *
- * These details are for the local memory control registers,
- * (pp301-310). The test machines are not equiped with local memory,
- * so nothing is tested. Only a single row seems to be supported.
- */
-#define DRAM_ROW_TYPE 0x3000
-#define DRAM_ROW_0 0x01
-#define DRAM_ROW_0_SDRAM 0x01
-#define DRAM_ROW_0_EMPTY 0x00
-#define DRAM_ROW_CNTL_LO 0x3001
-#define DRAM_PAGE_MODE_CTRL 0x10
-#define DRAM_RAS_TO_CAS_OVRIDE 0x08
-#define DRAM_CAS_LATENCY 0x04
-#define DRAM_RAS_TIMING 0x02
-#define DRAM_RAS_PRECHARGE 0x01
-#define DRAM_ROW_CNTL_HI 0x3002
-#define DRAM_REFRESH_RATE 0x18
-#define DRAM_REFRESH_DISABLE 0x00
-#define DRAM_REFRESH_60HZ 0x08
-#define DRAM_REFRESH_FAST_TEST 0x10
-#define DRAM_REFRESH_RESERVED 0x18
-#define DRAM_SMS 0x07
-#define DRAM_SMS_NORMAL 0x00
-#define DRAM_SMS_NOP_ENABLE 0x01
-#define DRAM_SMS_ABPCE 0x02
-#define DRAM_SMS_MRCE 0x03
-#define DRAM_SMS_CBRCE 0x04
-
-/* p307
- */
-#define DPMS_SYNC_SELECT 0x5002
-#define VSYNC_CNTL 0x08
-#define VSYNC_ON 0x00
-#define VSYNC_OFF 0x08
-#define HSYNC_CNTL 0x02
-#define HSYNC_ON 0x00
-#define HSYNC_OFF 0x02
-
-
-
-/* p317, 319
- */
-#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
-#define VCLK2_VCO_N 0x600a
-#define VCLK2_VCO_DIV_SEL 0x6012
-#define POST_DIV_SELECT 0x70
-#define POST_DIV_1 0x00
-#define POST_DIV_2 0x10
-#define POST_DIV_4 0x20
-#define POST_DIV_8 0x30
-#define POST_DIV_16 0x40
-#define POST_DIV_32 0x50
-#define VCO_LOOP_DIV_BY_4M 0x00
-#define VCO_LOOP_DIV_BY_16M 0x04
-
-
-/* Instruction Parser Mode Register
- * - p281
- * - 2 new bits.
- */
-#define INST_PM 0x20c0
-#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
-#define SYNC_PACKET_FLUSH_ENABLE 0x10
-#define TWO_D_INST_DISABLE 0x08
-#define THREE_D_INST_DISABLE 0x04
-#define STATE_VAR_UPDATE_DISABLE 0x02
-#define PAL_STIP_DISABLE 0x01
-
-#define INST_DONE 0x2090
-#define INST_PS 0x20c4
-
-#define MEMMODE 0x20dc
-
-
-/* Instruction parser error register. p279
- */
-#define IPEIR 0x2088
-#define IPEHR 0x208C
-
-
-/* General error reporting regs, p296
- */
-#define EIR 0x20B0
-#define EMR 0x20B4
-#define ESR 0x20B8
-#define IP_ERR 0x0001
-#define ERROR_RESERVED 0xffc6
-
-
-/* Interrupt Control Registers
- * - new bits for i810
- * - new register hwstam (mask)
- */
-#define HWSTAM 0x2098 /* p290 */
-#define IER 0x20a0 /* p291 */
-#define IIR 0x20a4 /* p292 */
-#define IMR 0x20a8 /* p293 */
-#define ISR 0x20ac /* p294 */
-#define HW_ERROR 0x8000
-#define SYNC_STATUS_TOGGLE 0x1000
-#define DPY_0_FLIP_PENDING 0x0800
-#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
-#define OVL_0_FLIP_PENDING 0x0200
-#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
-#define DPY_0_VBLANK 0x0080
-#define DPY_0_EVENT 0x0040
-#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
-#define DPY_1_EVENT 0x0010 /* not implemented on i810 */
-#define HOST_PORT_EVENT 0x0008 /* */
-#define CAPTURE_EVENT 0x0004 /* */
-#define USER_DEFINED 0x0002
-#define BREAKPOINT 0x0001
-
-
-#define INTR_RESERVED (0x6000 | \
- DPY_1_FLIP_PENDING | \
- OVL_1_FLIP_PENDING | \
- DPY_1_VBLANK | \
- DPY_1_EVENT | \
- HOST_PORT_EVENT | \
- CAPTURE_EVENT )
-
-/* FIFO Watermark and Burst Length Control Register
- *
- * - different offset and contents on i810 (p299) (fewer bits per field)
- * - some overlay fields added
- * - what does it all mean?
- */
-#define FWATER_BLC 0x20d8
-#define MM_BURST_LENGTH 0x00700000
-#define MM_FIFO_WATERMARK 0x0001F000
-#define LM_BURST_LENGTH 0x00000700
-#define LM_FIFO_WATERMARK 0x0000001F
-
-
-/* Fence/Tiling ranges [0..7]
- */
-#define FENCE 0x2000
-#define FENCE_NR 8
-
-#define FENCE_START_MASK 0x03F80000
-#define FENCE_X_MAJOR 0x00000000
-#define FENCE_Y_MAJOR 0x00001000
-#define FENCE_SIZE_MASK 0x00000700
-#define FENCE_SIZE_512K 0x00000000
-#define FENCE_SIZE_1M 0x00000100
-#define FENCE_SIZE_2M 0x00000200
-#define FENCE_SIZE_4M 0x00000300
-#define FENCE_SIZE_8M 0x00000400
-#define FENCE_SIZE_16M 0x00000500
-#define FENCE_SIZE_32M 0x00000600
-#define FENCE_PITCH_MASK 0x00000070
-#define FENCE_PITCH_1 0x00000000
-#define FENCE_PITCH_2 0x00000010
-#define FENCE_PITCH_4 0x00000020
-#define FENCE_PITCH_8 0x00000030
-#define FENCE_PITCH_16 0x00000040
-#define FENCE_PITCH_32 0x00000050
-#define FENCE_VALID 0x00000001
-
-
-/* Registers to control page table, p274
- */
-#define PGETBL_CTL 0x2020
-#define PGETBL_ADDR_MASK 0xFFFFF000
-#define PGETBL_ENABLE_MASK 0x00000001
-#define PGETBL_ENABLED 0x00000001
-
-/* Register containing pge table error results, p276
- */
-#define PGE_ERR 0x2024
-#define PGE_ERR_ADDR_MASK 0xFFFFF000
-#define PGE_ERR_ID_MASK 0x00000038
-#define PGE_ERR_CAPTURE 0x00000000
-#define PGE_ERR_OVERLAY 0x00000008
-#define PGE_ERR_DISPLAY 0x00000010
-#define PGE_ERR_HOST 0x00000018
-#define PGE_ERR_RENDER 0x00000020
-#define PGE_ERR_BLITTER 0x00000028
-#define PGE_ERR_MAPPING 0x00000030
-#define PGE_ERR_CMD_PARSER 0x00000038
-#define PGE_ERR_TYPE_MASK 0x00000007
-#define PGE_ERR_INV_TABLE 0x00000000
-#define PGE_ERR_INV_PTE 0x00000001
-#define PGE_ERR_MIXED_TYPES 0x00000002
-#define PGE_ERR_PAGE_MISS 0x00000003
-#define PGE_ERR_ILLEGAL_TRX 0x00000004
-#define PGE_ERR_LOCAL_MEM 0x00000005
-#define PGE_ERR_TILED 0x00000006
-
-
-
-/* Page table entries loaded via mmio region, p323
- */
-#define PTE_BASE 0x10000
-#define PTE_ADDR_MASK 0x3FFFF000
-#define PTE_TYPE_MASK 0x00000006
-#define PTE_LOCAL 0x00000002
-#define PTE_MAIN_UNCACHED 0x00000000
-#define PTE_MAIN_CACHED 0x00000006
-#define PTE_VALID_MASK 0x00000001
-#define PTE_VALID 0x00000001
-
-
-/* Ring buffer registers, p277, overview p19
- */
-#define LP_RING 0x2030
-#define HP_RING 0x2040
-
-#define RING_TAIL 0x00
-#define TAIL_ADDR 0x000FFFF8
-
-#define RING_HEAD 0x04
-#define HEAD_WRAP_COUNT 0xFFE00000
-#define HEAD_WRAP_ONE 0x00200000
-#define HEAD_ADDR 0x001FFFFC
-
-#define RING_START 0x08
-#define START_ADDR 0x00FFFFF8
-
-#define RING_LEN 0x0C
-#define RING_NR_PAGES 0x000FF000
-#define RING_REPORT_MASK 0x00000006
-#define RING_REPORT_64K 0x00000002
-#define RING_REPORT_128K 0x00000004
-#define RING_NO_REPORT 0x00000000
-#define RING_VALID_MASK 0x00000001
-#define RING_VALID 0x00000001
-#define RING_INVALID 0x00000000
-
-
-
-/* BitBlt Instructions
- *
- * There are many more masks & ranges yet to add.
- */
-#define BR00_BITBLT_CLIENT 0x40000000
-#define BR00_OP_COLOR_BLT 0x10000000
-#define BR00_OP_SRC_COPY_BLT 0x10C00000
-#define BR00_OP_FULL_BLT 0x11400000
-#define BR00_OP_MONO_SRC_BLT 0x11800000
-#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
-#define BR00_OP_MONO_PAT_BLT 0x11C00000
-#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
-#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
-
-
-#define BR00_TPCY_DISABLE 0x00000000
-#define BR00_TPCY_ENABLE 0x00000010
-
-#define BR00_TPCY_ROP 0x00000000
-#define BR00_TPCY_NO_ROP 0x00000020
-#define BR00_TPCY_EQ 0x00000000
-#define BR00_TPCY_NOT_EQ 0x00000040
-
-#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
-
-#define BR00_PAT_VERT_ALIGN 0x000000e0
-
-#define BR00_LENGTH 0x0000000F
-
-#define BR09_DEST_ADDR 0x03FFFFFF
-
-#define BR11_SOURCE_PITCH 0x00003FFF
-
-#define BR12_SOURCE_ADDR 0x03FFFFFF
-
-#define BR13_SOLID_PATTERN 0x80000000
-#define BR13_RIGHT_TO_LEFT 0x40000000
-#define BR13_LEFT_TO_RIGHT 0x00000000
-#define BR13_MONO_TRANSPCY 0x20000000
-#define BR13_USE_DYN_DEPTH 0x04000000
-#define BR13_DYN_8BPP 0x00000000
-#define BR13_DYN_16BPP 0x01000000
-#define BR13_DYN_24BPP 0x02000000
-#define BR13_ROP_MASK 0x00FF0000
-#define BR13_DEST_PITCH 0x0000FFFF
-#define BR13_PITCH_SIGN_BIT 0x00008000
-
-#define BR14_DEST_HEIGHT 0xFFFF0000
-#define BR14_DEST_WIDTH 0x0000FFFF
-
-#define BR15_PATTERN_ADDR 0x03FFFFFF
-
-#define BR16_SOLID_PAT_COLOR 0x00FFFFFF
-#define BR16_BACKGND_PAT_CLR 0x00FFFFFF
-
-#define BR17_FGND_PAT_CLR 0x00FFFFFF
-
-#define BR18_SRC_BGND_CLR 0x00FFFFFF
-#define BR19_SRC_FGND_CLR 0x00FFFFFF
-
-
-/* Instruction parser instructions
- */
-
-#define INST_PARSER_CLIENT 0x00000000
-#define INST_OP_FLUSH 0x02000000
-#define INST_FLUSH_MAP_CACHE 0x00000001
-
-#define INST_DEST_BUFFER_INFO 0x06800000
-
-#define INST_FRONT_BUFFER_INFO 0x06000000
-#define FRONT_INFO_ASYNC_FLIP 1<<6
-#define FRONT_INFO_PITCH_B 8
-
-#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
-
-
-/* Registers in the i810 host-pci bridge pci config space which affect
- * the i810 graphics operations.
- */
-#define SMRAM_MISCC 0x70
-#define GMS 0x000000c0
-#define GMS_DISABLE 0x00000000
-#define GMS_ENABLE_BARE 0x00000040
-#define GMS_ENABLE_512K 0x00000080
-#define GMS_ENABLE_1M 0x000000c0
-#define USMM 0x00000030
-#define USMM_DISABLE 0x00000000
-#define USMM_TSEG_ZERO 0x00000010
-#define USMM_TSEG_512K 0x00000020
-#define USMM_TSEG_1M 0x00000030
-#define GFX_MEM_WIN_SIZE 0x00010000
-#define GFX_MEM_WIN_32M 0x00010000
-#define GFX_MEM_WIN_64M 0x00000000
-
-/* Overkill? I don't know. Need to figure out top of mem to make the
- * SMRAM calculations come out. Linux seems to have problems
- * detecting it all on its own, so this seems a reasonable double
- * check to any user supplied 'mem=...' boot param.
- *
- * ... unfortunately this reg doesn't work according to spec on the
- * test hardware.
- */
-#define WHTCFG_PAMR_DRP 0x50
-#define SYS_DRAM_ROW_0_SHIFT 16
-#define SYS_DRAM_ROW_1_SHIFT 20
-#define DRAM_MASK 0x0f
-#define DRAM_VALUE_0 0
-#define DRAM_VALUE_1 8
-/* No 2 value defined */
-#define DRAM_VALUE_3 16
-#define DRAM_VALUE_4 16
-#define DRAM_VALUE_5 24
-#define DRAM_VALUE_6 32
-#define DRAM_VALUE_7 32
-#define DRAM_VALUE_8 48
-#define DRAM_VALUE_9 64
-#define DRAM_VALUE_A 64
-#define DRAM_VALUE_B 96
-#define DRAM_VALUE_C 128
-#define DRAM_VALUE_D 128
-#define DRAM_VALUE_E 192
-#define DRAM_VALUE_F 256 /* nice one, geezer */
-#define LM_FREQ_MASK 0x10
-#define LM_FREQ_133 0x10
-#define LM_FREQ_100 0x00
-
-
-
-
-/* These are 3d state registers, but the state is invarient, so we let
- * the X server handle it:
- */
-
-
-
-/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
- */
-#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
-#define CC1_UPDATE_KILL_WRITE (1<<28)
-#define CC1_ENABLE_KILL_WRITE (1<<27)
-#define CC1_DISABLE_KILL_WRITE 0
-#define CC1_UPDATE_COLOR_IDX (1<<26)
-#define CC1_UPDATE_CHROMA_LOW (1<<25)
-#define CC1_UPDATE_CHROMA_HI (1<<24)
-#define CC1_CHROMA_LOW_MASK ((1<<24)-1)
-#define CC2_COLOR_IDX_SHIFT 24
-#define CC2_COLOR_IDX_MASK (0xff<<24)
-#define CC2_CHROMA_HI_MASK ((1<<24)-1)
-
-
-#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
-#define CS_UPDATE_LOAD (1<<17)
-#define CS_UPDATE_USE (1<<16)
-#define CS_UPDATE_LOAD (1<<17)
-#define CS_LOAD_CTX0 0
-#define CS_LOAD_CTX1 (1<<8)
-#define CS_USE_CTX0 0
-#define CS_USE_CTX1 (1<<0)
-
-/* 3D Rendering Engine */
-
-#define RENDER_CLIENT 0x60000000
-
-/* Primitive rendering instruction */
-
-#define GFX_PRIMITIVE 0x1f000000
-#define PRIMITIVE_TRIANGLE 0 << 18
-#define PRIMITIVE_TRI_STRIP 1 << 18
-#define PRIMITIVE_TRI_REV_STRIP 2 << 18
-#define PRIMITIVE_TRI_FAN 3 << 18
-#define PRIMITIVE_POLYGON 4 << 18
-#define PRIMITIVE_LINE 5 << 18
-#define PRIMITIVE_LINE_STRIP 6 << 18
-#define PRIMITIVE_RECTANGLE 7 << 18
-
-/* Vertex format instruction */
-#define GFX_VERTEX_FORMAT 0x05000000
-#define VERTEX_0_TEXCOORDS 0 << 8
-#define VERTEX_1_TEXCOORDS 1 << 8
-#define VERTEX_2_TEXCOORDS 2 << 8
-#define VERTEX_SPECULAR_FOG 1 << 7
-#define VERTEX_DIFFUSE_ALPHA 1 << 6
-#define VERTEX_Z_OFFSET 1 << 5
-#define VERTEX_POS_XYZ 1 << 1
-#define VERTEX_POS_XYZ_RHW 2 << 1
-#define VERTEX_POS_XY 3 << 1
-#define VERTEX_POS_XY_RHW 4 << 1
-
-/* Drawing Rectangle Info instruction */
-
-#define GFX_DRAWING_RECTANGLE_INFO 0x1d800003
-#define GFX_DRAWING_CLIP_DISABLE 1<<31
-
-/* Boolean enable 1 */
-#define GFX_BOOLEAN_ENA_1 0x03000000
-#define BOOL1_ALPHA_SETUP_MASK 1<<17
-#define BOOL1_ALPHA_SETUP_BIT 1<<16
-#define BOOL1_FOG_ENABLE_MASK 1<<7
-#define BOOL1_FOG_ENABLE_BIT 1<<6
-#define BOOL1_ALPHA_TEST_MASK 1<<5
-#define BOOL1_ALPHA_TEST_BIT 1<<4
-#define BOOL1_BLEND_ENABLE_MASK 1<<3
-#define BOOL1_BLEND_ENABLE_BIT 1<<2
-#define BOOL1_Z_ENABLE_MASK 1<<1
-#define BOOL1_Z_ENABLE_BIT 1<<0
-
-/* Boolean enable 2 */
-#define GFX_BOOLEAN_ENA_2 0x04000000
-#define BOOL2_MAPPING_CACHE_MASK 1<<17
-#define BOOL2_MAPPING_CACHE_BIT 1<<16
-#define BOOL2_ALPHA_DITHER_MASK 1<<15
-#define BOOL2_ALPHA_DITHER_BIT 1<<14
-#define BOOL2_FOG_DITHER_MASK 1<<13
-#define BOOL2_FOG_DITHER_BIT 1<<12
-#define BOOL2_SPECULAR_DITHER_MASK 1<<11
-#define BOOL2_SPECULAR_DITHER_BIT 1<<10
-#define BOOL2_COLOR_DITHER_MASK 1<<9
-#define BOOL2_COLOR_DITHER_BIT 1<<8
-#define BOOL2_FB_WRITE_MASK 1<<3
-#define BOOL2_FB_WRITE_BIT 1<<2
-#define BOOL2_Z_WRITE_MASK 1<<1
-#define BOOL2_Z_WRITE_BIT 1<<0
-
-/* Dest buffer variables */
-
-#define GFX_DEST_BUFFER_VARIABLES 0x1d850000
-
-#define DEST_BUF_VAR_8BIT 0 << 8
-#define DEST_BUF_VAR_555 1 << 8
-#define DEST_BUF_VAR_565 2 << 8
-
-/* map color blend stages */
-
-#define GFX_MAP_COLOR_BLEND_STAGES 0
-
-#define MAP_BLEND_STAGE_B 20
-#define MAP_BLEND_ACC_SEL_MASK 1<<19
-#define MAP_BLEND_ACC_SEL_BIT 1<<18
-#define MAP_BLEND_ARG1_MASK 1<<17
-#define MAP_BLEND_ARG1_B 14
-#define MAP_BLEND_REPLICATE_ARG1 1<<13
-#define MAP_BLEND_INVERT_ARG1 1<<12
-
-#define MAP_BLEND_ARG2_MASK 1<<11
-#define MAP_BLEND_ARG2_B 8
-#define MAP_BLEND_REPLICATE_ARG2 1<<7
-#define MAP_BLEND_INVERT_ARG2 1<<6
-
-#define MAP_BLEND_COLOR_OP_MASK 1<<5
-#define MAP_BLEND_COLOR_OP_B 0
-
-#define GFX_SCISSOR_ENABLE 0x1c800000
-
-#define SCISSOR_ENABLE_MASK 1<<1
-#define SCISSOR_ENABLE_BIT 1<<0
diff --git a/hw/kdrive/i810/i810_video.c b/hw/kdrive/i810/i810_video.c
deleted file mode 100644
index 8f4cfcf27..000000000
--- a/hw/kdrive/i810/i810_video.c
+++ /dev/null
@@ -1,1136 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/***************************************************************************
-
-Copyright 2000 Intel Corporation. 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 INTEL, 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.
-
-**************************************************************************/
-
-
-/*
- * i810_video.c: i810 KDrive Xv driver.
- * Based on the XFree86 i810 Xv driver by Jonathan Bian.
- *
- * Authors:
- * Jonathan Bian <jonathan.bian@intel.com>
- * Pontus Lidman <pontus.lidman@nokia.com>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kxv.h"
-#include "i810.h"
-
-#include "Xv.h"
-
-#include "../../xfree86/common/fourcc.h"
-
-typedef struct {
- CARD32 size;
- CARD32 offset;
-} FBLinearRec, *FBLinearPtr;
-
-#define OFF_DELAY 250 /* milliseconds */
-#define FREE_DELAY 15000
-
-#define OFF_TIMER 0x01
-#define FREE_TIMER 0x02
-#define CLIENT_VIDEO_ON 0x04
-
-#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
-
-static KdVideoAdaptorPtr i810SetupImageVideo(ScreenPtr);
-static void i810StopVideo(KdScreenInfo *, pointer, Bool);
-static int i810SetPortAttribute(KdScreenInfo *, Atom, int, pointer);
-static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer);
-static void i810QueryBestSize(KdScreenInfo *, Bool,
- short, short, short, short, unsigned int *, unsigned int *, pointer);
-static int i810PutImage( KdScreenInfo *,
- short, short, short, short, short, short, short, short,
- int, unsigned char*, short, short, Bool, RegionPtr, pointer);
-static int i810QueryImageAttributes(KdScreenInfo *,
- int, unsigned short *, unsigned short *, int *, int *);
-
-static void i810BlockHandler(int, pointer, pointer, pointer);
-
-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
-
-static Atom xvBrightness, xvContrast, xvColorKey;
-
-#define IMAGE_MAX_WIDTH 720
-#define IMAGE_MAX_HEIGHT 576
-#define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT)
-
-#define OVERLAY_UPDATE(p) OUTREG(0x30000, p | 0x80000000);
-
-/*
- * OV0CMD - Overlay Command Register
- */
-#define VERTICAL_CHROMINANCE_FILTER 0x70000000
-#define VC_SCALING_OFF 0x00000000
-#define VC_LINE_REPLICATION 0x10000000
-#define VC_UP_INTERPOLATION 0x20000000
-#define VC_PIXEL_DROPPING 0x50000000
-#define VC_DOWN_INTERPOLATION 0x60000000
-#define VERTICAL_LUMINANCE_FILTER 0x0E000000
-#define VL_SCALING_OFF 0x00000000
-#define VL_LINE_REPLICATION 0x02000000
-#define VL_UP_INTERPOLATION 0x04000000
-#define VL_PIXEL_DROPPING 0x0A000000
-#define VL_DOWN_INTERPOLATION 0x0C000000
-#define HORIZONTAL_CHROMINANCE_FILTER 0x01C00000
-#define HC_SCALING_OFF 0x00000000
-#define HC_LINE_REPLICATION 0x00400000
-#define HC_UP_INTERPOLATION 0x00800000
-#define HC_PIXEL_DROPPING 0x01400000
-#define HC_DOWN_INTERPOLATION 0x01800000
-#define HORIZONTAL_LUMINANCE_FILTER 0x00380000
-#define HL_SCALING_OFF 0x00000000
-#define HL_LINE_REPLICATION 0x00080000
-#define HL_UP_INTERPOLATION 0x00100000
-#define HL_PIXEL_DROPPING 0x00280000
-#define HL_DOWN_INTERPOLATION 0x00300000
-
-#define Y_ADJUST 0x00010000
-#define OV_BYTE_ORDER 0x0000C000
-#define UV_SWAP 0x00004000
-#define Y_SWAP 0x00008000
-#define Y_AND_UV_SWAP 0x0000C000
-#define SOURCE_FORMAT 0x00003C00
-#define RGB_555 0x00000800
-#define RGB_565 0x00000C00
-#define YUV_422 0x00002000
-#define YUV_411 0x00002400
-#define YUV_420 0x00003000
-#define YUV_410 0x00003800
-#define BUFFER_AND_FIELD 0x00000006
-#define BUFFER0_FIELD0 0x00000000
-#define BUFFER1_FIELD0 0x00000004
-#define OVERLAY_ENABLE 0x00000001
-
-/*
- * DOV0STA - Display/Overlay 0 Status Register
- */
-#define DOV0STA 0x30008
-
-#define MINUV_SCALE 0x1
-
-#define RGB16ToColorKey(c) \
- (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3))
-
-#define RGB15ToColorKey(c) \
- (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3))
-
-Bool i810InitVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
- KdVideoAdaptorPtr newAdaptor = NULL;
- int num_adaptors;
-
-/* fprintf(stderr,"i810InitVideo\n"); */
-
- if (screen->fb[0].bitsPerPixel != 8)
- {
- newAdaptor = i810SetupImageVideo(pScreen);
- }
-
- num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
-
- if(newAdaptor) {
- if(!num_adaptors) {
- num_adaptors = 1;
- adaptors = &newAdaptor;
- } else {
- newAdaptors = /* need to free this someplace */
- xalloc((num_adaptors + 1) * sizeof(KdVideoAdaptorPtr*));
- if(newAdaptors) {
- memcpy(newAdaptors, adaptors, num_adaptors *
- sizeof(KdVideoAdaptorPtr));
- newAdaptors[num_adaptors] = newAdaptor;
- adaptors = newAdaptors;
- num_adaptors++;
- }
- }
- }
-
- if(num_adaptors)
- KdXVScreenInit(pScreen, adaptors, num_adaptors);
-
- if(newAdaptors)
- xfree(newAdaptors);
- return TRUE;
-}
-
-/* client libraries expect an encoding */
-static KdVideoEncodingRec DummyEncoding[1] =
-{
- {
- 0,
- "XV_IMAGE",
- IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
- {1, 1}
- }
-};
-
-#define NUM_FORMATS 3
-
-static KdVideoFormatRec Formats[NUM_FORMATS] =
-{
- {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
-};
-
-#define NUM_ATTRIBUTES 3
-
-static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
-{
- {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
- {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
- {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
-};
-
-#define NUM_IMAGES 4
-
-static KdImageRec Images[NUM_IMAGES] =
-{
- XVIMAGE_YUY2,
- XVIMAGE_YV12,
- XVIMAGE_I420,
- XVIMAGE_UYVY
-};
-
-typedef struct {
- CARD32 OBUF_0Y;
- CARD32 OBUF_1Y;
- CARD32 OBUF_0U;
- CARD32 OBUF_0V;
- CARD32 OBUF_1U;
- CARD32 OBUF_1V;
- CARD32 OV0STRIDE;
- CARD32 YRGB_VPH;
- CARD32 UV_VPH;
- CARD32 HORZ_PH;
- CARD32 INIT_PH;
- CARD32 DWINPOS;
- CARD32 DWINSZ;
- CARD32 SWID;
- CARD32 SWIDQW;
- CARD32 SHEIGHT;
- CARD32 YRGBSCALE;
- CARD32 UVSCALE;
- CARD32 OV0CLRC0;
- CARD32 OV0CLRC1;
- CARD32 DCLRKV;
- CARD32 DCLRKM;
- CARD32 SCLRKVH;
- CARD32 SCLRKVL;
- CARD32 SCLRKM;
- CARD32 OV0CONF;
- CARD32 OV0CMD;
-} I810OverlayRegRec, *I810OverlayRegPtr;
-
-typedef struct {
- CARD32 YBuf0offset;
- CARD32 UBuf0offset;
- CARD32 VBuf0offset;
-
- CARD32 YBuf1offset;
- CARD32 UBuf1offset;
- CARD32 VBuf1offset;
-
- unsigned char currentBuf;
-
- unsigned char brightness;
- unsigned char contrast;
-
- RegionRec clip;
- CARD32 colorKey;
-
- CARD32 videoStatus;
- Time offTime;
- Time freeTime;
- FBLinearPtr linear;
-} I810PortPrivRec, *I810PortPrivPtr;
-
-#define GET_PORT_PRIVATE(screen) \
- (I810PortPrivPtr)(((I810CardInfo *) (screen->card->driver))->adaptor->pPortPrivates[0].ptr)
-
-static void i810ResetVideo(KdScreenInfo *screen)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
- I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
-
- /*
- * Default to maximum image size in YV12
- */
-
- overlay->YRGB_VPH = 0;
- overlay->UV_VPH = 0;
- overlay->HORZ_PH = 0;
- overlay->INIT_PH = 0;
- overlay->DWINPOS = 0;
- overlay->DWINSZ = (IMAGE_MAX_HEIGHT << 16) | IMAGE_MAX_WIDTH;
- overlay->SWID = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 15);
- overlay->SWIDQW = (IMAGE_MAX_WIDTH >> 3) | (IMAGE_MAX_WIDTH << 12);
- overlay->SHEIGHT = IMAGE_MAX_HEIGHT | (IMAGE_MAX_HEIGHT << 15);
- overlay->YRGBSCALE = 0x80004000; /* scale factor 1 */
- overlay->UVSCALE = 0x80004000; /* scale factor 1 */
- overlay->OV0CLRC0 = 0x4000; /* brightness: 0 contrast: 1.0 */
- overlay->OV0CLRC1 = 0x80; /* saturation: bypass */
-
- /*
- * Enable destination color keying
- */
- switch(screen->fb[0].depth) {
- case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey);
- overlay->DCLRKM = 0x80070307;
- break;
- case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey);
- overlay->DCLRKM = 0x80070707;
- break;
- default: overlay->DCLRKV = pPriv->colorKey;
- overlay->DCLRKM = 0x80000000;
- break;
- }
-
- overlay->SCLRKVH = 0;
- overlay->SCLRKVL = 0;
- overlay->SCLRKM = 0; /* source color key disable */
- overlay->OV0CONF = 0; /* two 720 pixel line buffers */
-
- overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST |
- YUV_420;
-
- OVERLAY_UPDATE(i810c->OverlayPhysical);
-}
-
-
-static KdVideoAdaptorPtr
-i810SetupImageVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
-
- KdVideoAdaptorPtr adapt;
- I810PortPrivPtr pPriv;
-
-/* fprintf(stderr,"i810SetupImageVideo\n"); */
-
- if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) +
- sizeof(I810PortPrivRec) +
- sizeof(DevUnion))))
- return NULL;
-
- adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
- adapt->name = "I810 Video Overlay";
- adapt->nEncodings = 1;
- adapt->pEncodings = DummyEncoding;
- adapt->nFormats = NUM_FORMATS;
- adapt->pFormats = Formats;
- adapt->nPorts = 1;
- adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
-
- pPriv = (I810PortPrivPtr)(&adapt->pPortPrivates[1]);
-
- adapt->pPortPrivates[0].ptr = (pointer)(pPriv);
- adapt->pAttributes = Attributes;
- adapt->nImages = NUM_IMAGES;
- adapt->nAttributes = NUM_ATTRIBUTES;
- adapt->pImages = Images;
- adapt->PutVideo = NULL;
- adapt->PutStill = NULL;
- adapt->GetVideo = NULL;
- adapt->GetStill = NULL;
- adapt->StopVideo = i810StopVideo;
- adapt->SetPortAttribute = i810SetPortAttribute;
- adapt->GetPortAttribute = i810GetPortAttribute;
- adapt->QueryBestSize = i810QueryBestSize;
- adapt->PutImage = i810PutImage;
- adapt->QueryImageAttributes = i810QueryImageAttributes;
-
- pPriv->colorKey = i810c->colorKey & ((1 << screen->fb[0].depth) - 1);
- pPriv->videoStatus = 0;
- pPriv->brightness = 0;
- pPriv->contrast = 128;
- pPriv->linear = NULL;
- pPriv->currentBuf = 0;
-
- /* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
-
- i810c->adaptor = adapt;
-
- i810c->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = i810BlockHandler;
-
- xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
- xvContrast = MAKE_ATOM("XV_CONTRAST");
- xvColorKey = MAKE_ATOM("XV_COLORKEY");
-
- i810ResetVideo(screen);
-
- return adapt;
-}
-
-
-/* I810ClipVideo -
-
- 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.
-*/
-
-static void
-I810ClipVideo(
- BoxPtr dst,
- INT32 *x1,
- INT32 *x2,
- INT32 *y1,
- INT32 *y2,
- BoxPtr extents, /* extents of the clip region */
- INT32 width,
- INT32 height
-){
- INT32 vscale, hscale, delta;
- int diff;
-
- hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
- vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
-
- *x1 <<= 16; *x2 <<= 16;
- *y1 <<= 16; *y2 <<= 16;
-
- diff = extents->x1 - dst->x1;
- if(diff > 0) {
- dst->x1 = extents->x1;
- *x1 += diff * hscale;
- }
- diff = dst->x2 - extents->x2;
- if(diff > 0) {
- dst->x2 = extents->x2;
- *x2 -= diff * hscale;
- }
- diff = extents->y1 - dst->y1;
- if(diff > 0) {
- dst->y1 = extents->y1;
- *y1 += diff * vscale;
- }
- diff = dst->y2 - extents->y2;
- if(diff > 0) {
- dst->y2 = extents->y2;
- *y2 -= diff * vscale;
- }
-
- if(*x1 < 0) {
- diff = (- *x1 + hscale - 1)/ hscale;
- dst->x1 += diff;
- *x1 += diff * hscale;
- }
- delta = *x2 - (width << 16);
- if(delta > 0) {
- diff = (delta + hscale - 1)/ hscale;
- dst->x2 -= diff;
- *x2 -= diff * hscale;
- }
- if(*y1 < 0) {
- diff = (- *y1 + vscale - 1)/ vscale;
- dst->y1 += diff;
- *y1 += diff * vscale;
- }
- delta = *y2 - (height << 16);
- if(delta > 0) {
- diff = (delta + vscale - 1)/ vscale;
- dst->y2 -= diff;
- *y2 -= diff * vscale;
- }
-}
-
-static void
-i810StopVideo(KdScreenInfo *screen, pointer data, Bool exit)
-{
- I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
-
- REGION_EMPTY(screen->pScreen, &pPriv->clip);
-
- if(exit) {
- if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
- overlay->OV0CMD &= 0xFFFFFFFE;
- OVERLAY_UPDATE(i810c->OverlayPhysical);
- }
- if(pPriv->linear) {
- xfree(pPriv->linear);
- pPriv->linear = NULL;
- }
- pPriv->videoStatus = 0;
- } else {
- if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
- pPriv->videoStatus |= OFF_TIMER;
- pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
- }
- }
-
-}
-
-static int
-i810SetPortAttribute(
- KdScreenInfo *screen,
- Atom attribute,
- int value,
- pointer data
-){
- I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
-
- if(attribute == xvBrightness) {
- if((value < -128) || (value > 127))
- return BadValue;
- pPriv->brightness = value;
- overlay->OV0CLRC0 &= 0xFFFFFF00;
- overlay->OV0CLRC0 |= value;
- OVERLAY_UPDATE(i810c->OverlayPhysical);
- } else
- if(attribute == xvContrast) {
- if((value < 0) || (value > 255))
- return BadValue;
- pPriv->contrast = value;
- overlay->OV0CLRC0 &= 0xFFFE00FF;
- overlay->OV0CLRC0 |= value << 9;
- OVERLAY_UPDATE(i810c->OverlayPhysical);
- } else
- if(attribute == xvColorKey) {
- pPriv->colorKey = value;
- switch(screen->fb[0].depth) {
- case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey);
- break;
- case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey);
- break;
- default: overlay->DCLRKV = pPriv->colorKey;
- break;
- }
- OVERLAY_UPDATE(i810c->OverlayPhysical);
- REGION_EMPTY(screen->pScreen, &pPriv->clip);
- } else return BadMatch;
-
- return Success;
-}
-
-static int
-i810GetPortAttribute(
- KdScreenInfo *screen,
- Atom attribute,
- int *value,
- pointer data
-){
- I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
-
- if(attribute == xvBrightness) {
- *value = pPriv->brightness;
- } else
- if(attribute == xvContrast) {
- *value = pPriv->contrast;
- } else
- if(attribute == xvColorKey) {
- *value = pPriv->colorKey;
- } else return BadMatch;
-
- return Success;
-}
-
-static void
-i810QueryBestSize(
- KdScreenInfo *screen,
- Bool motion,
- short vid_w, short vid_h,
- short drw_w, short drw_h,
- unsigned int *p_w, unsigned int *p_h,
- pointer data
-){
- *p_w = drw_w;
- *p_h = drw_h;
-}
-
-
-static void
-I810CopyPackedData(
- KdScreenInfo *screen,
- unsigned char *buf,
- int srcPitch,
- int dstPitch,
- int top,
- int left,
- int h,
- int w
- )
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
- unsigned char *src, *dst;
-
- src = buf + (top*srcPitch) + (left<<1);
-
- if (pPriv->currentBuf == 0)
- dst = i810c->FbBase + pPriv->YBuf0offset;
- else
- dst = i810c->FbBase + pPriv->YBuf1offset;
-
- w <<= 1;
- while(h--) {
- memcpy(dst, src, w);
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-static void
-i810CopyPlanarData(
- KdScreenInfo *screen,
- unsigned char *buf,
- int srcPitch,
- int dstPitch, /* of chroma */
- int srcH,
- int top,
- int left,
- int h,
- int w,
- int id
- )
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
- int i;
- unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3;
-
- /* Copy Y data */
- src1 = buf + (top*srcPitch) + left;
- if (pPriv->currentBuf == 0)
- dst1 = i810c->FbBase + pPriv->YBuf0offset;
- else
- dst1 = i810c->FbBase + pPriv->YBuf1offset;
-
- for (i = 0; i < h; i++) {
- memcpy(dst1, src1, w);
- src1 += srcPitch;
- dst1 += dstPitch << 1;
- }
-
- /* Copy V data for YV12, or U data for I420 */
- src2 = buf + (srcH*srcPitch) + ((top*srcPitch)>>2) + (left>>1);
- if (pPriv->currentBuf == 0) {
- if (id == FOURCC_I420)
- dst2 = i810c->FbBase + pPriv->UBuf0offset;
- else
- dst2 = i810c->FbBase + pPriv->VBuf0offset;
- } else {
- if (id == FOURCC_I420)
- dst2 = i810c->FbBase + pPriv->UBuf1offset;
- else
- dst2 = i810c->FbBase + pPriv->VBuf1offset;
- }
-
- for (i = 0; i < h/2; i++) {
- memcpy(dst2, src2, w/2);
- src2 += srcPitch>>1;
- dst2 += dstPitch;
- }
-
- /* Copy U data for YV12, or V data for I420 */
- src3 = buf + (srcH*srcPitch) + ((srcH*srcPitch)>>2) + ((top*srcPitch)>>2) + (left>>1);
- if (pPriv->currentBuf == 0) {
- if (id == FOURCC_I420)
- dst3 = i810c->FbBase + pPriv->VBuf0offset;
- else
- dst3 = i810c->FbBase + pPriv->UBuf0offset;
- } else {
- if (id == FOURCC_I420)
- dst3 = i810c->FbBase + pPriv->VBuf1offset;
- else
- dst3 = i810c->FbBase + pPriv->UBuf1offset;
- }
-
- for (i = 0; i < h/2; i++) {
- memcpy(dst3, src3, w/2);
- src3 += srcPitch>>1;
- dst3 += dstPitch;
- }
-}
-
-static void
-i810DisplayVideo(
- KdScreenInfo *screen,
- int id,
- short width, short height,
- int dstPitch, /* of chroma for 4:2:0 */
- int x1, int y1, int x2, int y2,
- BoxPtr dstBox,
- short src_w, short src_h,
- short drw_w, short drw_h
-){
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
- I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
- int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
- int xscaleIntUV = 0, xscaleFractUV = 0, yscaleIntUV = 0, yscaleFractUV = 0;
- unsigned int swidth;
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- swidth = (width + 7) & ~7;
- overlay->SWID = (swidth << 15) | swidth;
- overlay->SWIDQW = (swidth << 12) | (swidth >> 3);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- swidth = ((width + 3) & ~3) << 1;
- overlay->SWID = swidth;
- overlay->SWIDQW = swidth >> 3;
- break;
- }
-
- overlay->SHEIGHT = height | (height << 15);
- overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1;
- overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) |
- (dstBox->x2 - dstBox->x1);
-
- /* buffer locations */
- overlay->OBUF_0Y = pPriv->YBuf0offset;
- overlay->OBUF_1Y = pPriv->YBuf1offset;
- overlay->OBUF_0U = pPriv->UBuf0offset;
- overlay->OBUF_0V = pPriv->VBuf0offset;
- overlay->OBUF_1U = pPriv->UBuf1offset;
- overlay->OBUF_1V = pPriv->VBuf1offset;
-
- /*
- * Calculate horizontal and vertical scaling factors, default to 1:1
- */
- overlay->YRGBSCALE = 0x80004000;
- overlay->UVSCALE = 0x80004000;
-
- /*
- * Initially, YCbCr and Overlay Enable and
- * vertical chrominance up interpolation and horozontal chrominance
- * up interpolation
- */
- overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST |
- OVERLAY_ENABLE;
-
- if ((drw_w != src_w) || (drw_h != src_h))
- {
- xscaleInt = (src_w / drw_w) & 0x3;
- xscaleFract = (src_w << 12) / drw_w;
- yscaleInt = (src_h / drw_h) & 0x3;
- yscaleFract = (src_h << 12) / drw_h;
-
- overlay->YRGBSCALE = (xscaleInt << 15) |
- ((xscaleFract & 0xFFF) << 3) |
- (yscaleInt) |
- ((yscaleFract & 0xFFF) << 20);
-
- if (drw_w > src_w)
- {
- /* horizontal up-scaling */
- overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER;
- overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER;
- overlay->OV0CMD |= (HC_UP_INTERPOLATION | HL_UP_INTERPOLATION);
- }
-
- if (drw_h > src_h)
- {
- /* vertical up-scaling */
- overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER;
- overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER;
- overlay->OV0CMD |= (VC_UP_INTERPOLATION | VL_UP_INTERPOLATION);
- }
-
- if (drw_w < src_w)
- {
- /* horizontal down-scaling */
- overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER;
- overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER;
- overlay->OV0CMD |= (HC_DOWN_INTERPOLATION | HL_DOWN_INTERPOLATION);
- }
-
- if (drw_h < src_h)
- {
- /* vertical down-scaling */
- overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER;
- overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER;
- overlay->OV0CMD |= (VC_DOWN_INTERPOLATION | VL_DOWN_INTERPOLATION);
- }
-
- /* now calculate the UV scaling factor */
-
- if (xscaleFract)
- {
- xscaleFractUV = xscaleFract >> MINUV_SCALE;
- overlay->OV0CMD &= ~HC_DOWN_INTERPOLATION;
- overlay->OV0CMD |= HC_UP_INTERPOLATION;
- }
-
- if (xscaleInt)
- {
- xscaleIntUV = xscaleInt >> MINUV_SCALE;
- if (xscaleIntUV)
- {
- overlay->OV0CMD &= ~HC_UP_INTERPOLATION;
- }
- }
-
- if (yscaleFract)
- {
- yscaleFractUV = yscaleFract >> MINUV_SCALE;
- overlay->OV0CMD &= ~VC_DOWN_INTERPOLATION;
- overlay->OV0CMD |= VC_UP_INTERPOLATION;
- }
-
- if (yscaleInt)
- {
- yscaleIntUV = yscaleInt >> MINUV_SCALE;
- if (yscaleIntUV)
- {
- overlay->OV0CMD &= ~VC_UP_INTERPOLATION;
- overlay->OV0CMD |= VC_DOWN_INTERPOLATION;
- }
- }
-
- overlay->UVSCALE = yscaleIntUV | ((xscaleFractUV & 0xFFF) << 3) |
- ((yscaleFractUV & 0xFFF) << 20);
- }
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16);
- overlay->OV0CMD &= ~SOURCE_FORMAT;
- overlay->OV0CMD |= YUV_420;
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- overlay->OV0STRIDE = dstPitch;
- overlay->OV0CMD &= ~SOURCE_FORMAT;
- overlay->OV0CMD |= YUV_422;
- overlay->OV0CMD &= ~OV_BYTE_ORDER;
- if (id == FOURCC_UYVY)
- overlay->OV0CMD |= Y_SWAP;
- break;
- }
-
- overlay->OV0CMD &= ~BUFFER_AND_FIELD;
- if (pPriv->currentBuf == 0)
- overlay->OV0CMD |= BUFFER0_FIELD0;
- else
- overlay->OV0CMD |= BUFFER1_FIELD0;
-
- OVERLAY_UPDATE(i810c->OverlayPhysical);
-
-}
-
-static FBLinearPtr
-i810AllocateMemory(
- KdScreenInfo *screen,
- FBLinearPtr linear,
- int size
-){
- KdCardInfo *card=screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- FBLinearPtr new_linear;
-
- if(linear) {
- if(linear->size >= size)
- return linear;
- else
- ErrorF("Ran out of memory for overlay buffer, requested size = %d\n",size);
- }
-
- new_linear = xalloc(sizeof(FBLinearRec));
- new_linear->size = i810c->XvMem.Size;
- new_linear->offset = i810c->XvMem.Start;
-
-/* fprintf(stderr,"Overlay mem offset %lx\n",new_linear->offset); */
-
- return new_linear;
-}
-
-static int
-i810PutImage(
- KdScreenInfo *screen,
- 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
-){
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
- INT32 x1, x2, y1, y2;
- int srcPitch, dstPitch;
- int top, left, npixels, nlines, size;
- BoxRec dstBox;
-
- /* Clip */
- x1 = src_x;
- x2 = src_x + src_w;
- y1 = src_y;
- y2 = src_y + src_h;
-
- dstBox.x1 = drw_x;
- dstBox.x2 = drw_x + drw_w;
- dstBox.y1 = drw_y;
- dstBox.y2 = drw_y + drw_h;
-
- I810ClipVideo(&dstBox, &x1, &x2, &y1, &y2,
- REGION_EXTENTS(pScreen, clipBoxes), width, height);
-
- if((x1 >= x2) || (y1 >= y2))
- return Success;
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- srcPitch = (width + 3) & ~3;
- dstPitch = ((width >> 1) + 7) & ~7; /* of chroma */
- size = dstPitch * height * 3;
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- srcPitch = (width << 1);
- dstPitch = (srcPitch + 7) & ~7;
- size = dstPitch * height;
- break;
- }
-
- if(!(pPriv->linear = i810AllocateMemory(screen, pPriv->linear,
- (screen->fb[0].bitsPerPixel == 16) ? size : (size >> 1))))
- return BadAlloc;
-
- /* fixup pointers */
- pPriv->YBuf0offset = pPriv->linear->offset;
- pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height);
- pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height >> 1);
-
- pPriv->YBuf1offset = pPriv->linear->offset + size;
- pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height);
- pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height >> 1);
-
- /* wait for the last rendered buffer to be flipped in */
- while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf);
-
- /* buffer swap */
- if (pPriv->currentBuf == 0)
- pPriv->currentBuf = 1;
- else
- pPriv->currentBuf = 0;
-
- /* copy data */
- top = y1 >> 16;
- left = (x1 >> 16) & ~1;
- npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- top &= ~1;
- nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
- i810CopyPlanarData(screen, buf, srcPitch, dstPitch, height, top, left,
- nlines, npixels, id);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- nlines = ((y2 + 0xffff) >> 16) - top;
- I810CopyPackedData(screen, buf, srcPitch, dstPitch, top, left, nlines,
- npixels);
- break;
- }
-
- /* update cliplist */
- if(!REGION_EQUAL(screen->pScreen, &pPriv->clip, clipBoxes)) {
- REGION_COPY(screen->pScreen, &pPriv->clip, clipBoxes);
- i810FillBoxSolid(screen, REGION_NUM_RECTS(clipBoxes),
- REGION_RECTS(clipBoxes),
- pPriv->colorKey, GXcopy, ~0);
- /*
- XAAFillSolidRects(screen, pPriv->colorKey, GXcopy, ~0,
- REGION_NUM_RECTS(clipBoxes),
- REGION_RECTS(clipBoxes));
- */
- }
-
-
- i810DisplayVideo(screen, id, width, height, dstPitch,
- x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
-
- pPriv->videoStatus = CLIENT_VIDEO_ON;
-
- return Success;
-}
-
-
-static int
-i810QueryImageAttributes(
- KdScreenInfo *screen,
- int id,
- unsigned short *w, unsigned short *h,
- int *pitches, int *offsets
-){
- int size, tmp;
-
- if(*w > 720) *w = 720;
- if(*h > 576) *h = 576;
-
- *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
-i810BlockHandler (
- int i,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask
-){
- ScreenPtr pScreen = screenInfo.screens[i];
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810PortPrivPtr pPriv = GET_PORT_PRIVATE(screen);
- I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
-
- pScreen->BlockHandler = i810c->BlockHandler;
-
- (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
-
- pScreen->BlockHandler = i810BlockHandler;
-
- if(pPriv->videoStatus & TIMER_MASK) {
- UpdateCurrentTime();
- if(pPriv->videoStatus & OFF_TIMER) {
- if(pPriv->offTime < currentTime.milliseconds) {
- /* Turn off the overlay */
- overlay->OV0CMD &= 0xFFFFFFFE;
- OVERLAY_UPDATE(i810c->OverlayPhysical);
-
- pPriv->videoStatus = FREE_TIMER;
- pPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
- }
- } else { /* FREE_TIMER */
- if(pPriv->freeTime < currentTime.milliseconds) {
- if(pPriv->linear) {
- xfree(pPriv->linear);
- pPriv->linear = NULL;
- }
- pPriv->videoStatus = 0;
- }
- }
- }
-}
diff --git a/hw/kdrive/i810/i810draw.c b/hw/kdrive/i810/i810draw.c
deleted file mode 100644
index d6d857c4f..000000000
--- a/hw/kdrive/i810/i810draw.c
+++ /dev/null
@@ -1,606 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/* Hardware accelerated drawing for KDrive i810 driver.
- Author: Pontus Lidman <pontus.lidman@nokia.com>
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#ifdef XV
-#include "kxv.h"
-#endif
-#include "i810.h"
-#include "i810_reg.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-#include "picturestr.h"
-
-#define NUM_STACK_RECTS 1024
-
-void
-i810Sync( KdScreenInfo *screen );
-int
-i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis );
-
-void
-i810EmitInvarientState(KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- BEGIN_LP_RING( 10 );
-
- OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
- OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 );
- OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
- OUT_RING( 0 );
-
-
- OUT_RING( GFX_OP_COLOR_CHROMA_KEY );
- OUT_RING( CC1_UPDATE_KILL_WRITE |
- CC1_DISABLE_KILL_WRITE |
- CC1_UPDATE_COLOR_IDX |
- CC1_UPDATE_CHROMA_LOW |
- CC1_UPDATE_CHROMA_HI |
- 0);
- OUT_RING( 0 );
- OUT_RING( 0 );
-
- /* No depth buffer in KDrive yet */
- /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */
- /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */
-
- ADVANCE_LP_RING();
-}
-
-static unsigned int i810PatternRop[16] = {
- 0x00, /* GXclear */
- 0xA0, /* GXand */
- 0x50, /* GXandReverse */
- 0xF0, /* GXcopy */
- 0x0A, /* GXandInvert */
- 0xAA, /* GXnoop */
- 0x5A, /* GXxor */
- 0xFA, /* GXor */
- 0x05, /* GXnor */
- 0xA5, /* GXequiv */
- 0x55, /* GXinvert */
- 0xF5, /* GXorReverse */
- 0x0F, /* GXcopyInvert */
- 0xAF, /* GXorInverted */
- 0x5F, /* GXnand */
- 0xFF /* GXset */
-};
-
-void
-i810SetupForSolidFill(KdScreenInfo *screen, int color, int rop,
- unsigned int planemask)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF( "i810SetupForFillRectSolid color: %x rop: %x mask: %x\n",
- color, rop, planemask);
-
- /* Color blit, p166 */
- i810c->BR[13] = (BR13_SOLID_PATTERN |
- (i810PatternRop[rop] << 16) |
- (screen->width * i810c->cpp));
- i810c->BR[16] = color;
-}
-
-
-void
-i810SubsequentSolidFillRect(KdScreenInfo *screen, int x, int y, int w, int h)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF( "i810SubsequentFillRectSolid %d,%d %dx%d\n",
- x,y,w,h);
-
- {
- BEGIN_LP_RING(6);
-
- OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 );
- OUT_RING( i810c->BR[13] );
- OUT_RING( (h << 16) | (w * i810c->cpp));
- OUT_RING( i810c->bufferOffset +
- (y * screen->width + x) * i810c->cpp);
-
- OUT_RING( i810c->BR[16]);
- OUT_RING( 0 ); /* pad to quadword */
-
- ADVANCE_LP_RING();
- }
-}
-
-
-BOOL
-i810FillOk (GCPtr pGC)
-{
- FbBits depthMask;
-
- switch (pGC->fillStyle) {
- case FillSolid:
- return TRUE;
- /* More cases later... */
- }
- return FALSE;
-}
-
-void
-i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask)
-{
- i810SetupForSolidFill(screen, pixel, alu, planemask);
- while (nBox--)
- {
- i810SubsequentSolidFillRect(screen, pBox->x1, pBox->y1,
- pBox->x2-pBox->x1, pBox->y2-pBox->y1);
- pBox++;
- }
- KdMarkSync(screen->pScreen);
-}
-
-
-void
-i810PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
-
-
- xRectangle *prect;
- RegionPtr prgnClip;
- register BoxPtr pbox;
- register BoxPtr pboxClipped;
- BoxPtr pboxClippedBase;
- BoxPtr pextent;
- BoxRec stackRects[NUM_STACK_RECTS];
- FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC);
- int numRects;
- int n;
- int xorg, yorg;
- int x, y;
- KdScreenPriv(pDrawable->pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-
- if (!i810FillOk (pGC))
- {
- KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit);
- return;
- }
- prgnClip = fbGetCompositeClip(pGC);
- 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)xalloc(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)
- {
- switch (pGC->fillStyle) {
- case FillSolid:
- i810FillBoxSolid(screen,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->fgPixel, pGC->alu, pGC->planemask);
- break;
- /* More cases later... */
- }
- }
- if (pboxClippedBase != stackRects)
- xfree(pboxClippedBase);
-}
-
-void
-i810RefreshRing(KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
- i810c->LpRing.tail = INREG(LP_RING + RING_TAIL);
- i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8);
- if (i810c->LpRing.space < 0)
- i810c->LpRing.space += i810c->LpRing.mem.Size;
-
- i810c->NeedToSync = TRUE;
-}
-
-int
-i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis )
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
- I810RingBuffer *ring = &(i810c->LpRing);
- int iters = 0;
- int start = 0;
- int now = 0;
- int last_head = 0;
- int first = 0;
-
- /* If your system hasn't moved the head pointer in 2 seconds, I'm going to
- * call it crashed.
- */
- if (timeout_millis == 0)
- timeout_millis = 2000;
-
- if (I810_DEBUG) {
- fprintf(stderr, "i810WaitLpRing %d\n", n);
- first = GetTimeInMillis();
- }
-
- while (ring->space < n)
- {
- int i;
-
- ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
- ring->space = ring->head - (ring->tail+8);
-
- if (ring->space < 0)
- ring->space += ring->mem.Size;
-
- iters++;
- now = GetTimeInMillis();
- if ( start == 0 || now < start || ring->head != last_head) {
- if (I810_DEBUG)
- if (now > start)
- fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
- start = now;
- last_head = ring->head;
- } else if ( now - start > timeout_millis ) {
-
- i810PrintErrorState( screen->card );
- fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
- FatalError("lockup\n");
- }
-
- for (i = 0 ; i < 2000 ; i++)
- ;
- }
-
- if (I810_DEBUG)
- {
- now = GetTimeInMillis();
- if (now - first) {
- fprintf(stderr,"Elapsed %d ms\n", now - first);
- fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
- }
- }
-
- return iters;
-}
-
-void
-i810Sync( KdScreenInfo *screen )
-{
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = card->driver;
-
- if (I810_DEBUG)
- fprintf(stderr, "i810Sync\n");
-
- /* Send a flush instruction and then wait till the ring is empty.
- * This is stronger than waiting for the blitter to finish as it also
- * flushes the internal graphics caches.
- */
- {
- BEGIN_LP_RING(2);
- OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
- OUT_RING( 0 ); /* pad to quadword */
- ADVANCE_LP_RING();
- }
-
- i810WaitLpRing(screen, i810c->LpRing.mem.Size - 8, 0 );
-
- i810c->LpRing.space = i810c->LpRing.mem.Size - 8;
- i810c->nextColorExpandBuf = 0;
-}
-
-static const GCOps i810Ops = {
- KdCheckFillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- KdCheckCopyArea,
- KdCheckCopyPlane,
- KdCheckPolyPoint,
- KdCheckPolylines,
- KdCheckPolySegment,
- miPolyRectangle,
- KdCheckPolyArc,
- miFillPolygon,
- i810PolyFillRect,
- miPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- KdCheckImageGlyphBlt,
- KdCheckPolyGlyphBlt,
- KdCheckPushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-void
-i810ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
-
- fbValidateGC (pGC, changes, pDrawable);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- pGC->ops = (GCOps *) &i810Ops;
- else
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
-}
-
-GCFuncs i810GCFuncs = {
- i810ValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-int
-i810CreateGC (GCPtr pGC)
-{
- if (!fbCreateGC (pGC))
- return FALSE;
-
- if (pGC->depth != 1)
- pGC->funcs = &i810GCFuncs;
-
- return TRUE;
-}
-
-static void
-i810SetRingRegs( KdScreenInfo *screen ) {
- unsigned int itemp;
-
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
- OUTREG(LP_RING + RING_TAIL, 0 );
- OUTREG(LP_RING + RING_HEAD, 0 );
-
- itemp = INREG(LP_RING + RING_START);
- itemp &= ~(START_ADDR);
- itemp |= i810c->LpRing.mem.Start;
- OUTREG(LP_RING + RING_START, itemp );
-
- itemp = INREG(LP_RING + RING_LEN);
- itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK);
- itemp |= ((i810c->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID);
- OUTREG(LP_RING + RING_LEN, itemp );
-}
-
-Bool
-i810InitAccel(ScreenPtr pScreen)
-{
-
-/* fprintf(stderr,"i810InitAccel\n"); */
-
- /*
- * Hook up asynchronous drawing
- */
- KdScreenInitAsync (pScreen);
- /*
- * Replace various fb screen functions
- */
- pScreen->CreateGC = i810CreateGC;
-
- return TRUE;
-}
-
-void
-i810EnableAccel(ScreenPtr pScreen)
-{
-
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = screen->card;
- I810CardInfo *i810c = (I810CardInfo *) card->driver;
-
-/* fprintf(stderr,"i810EnableAccel\n"); */
-
- if (i810c->LpRing.mem.Size == 0) {
- ErrorF("No memory for LpRing!! Acceleration not functional!!\n");
- }
-
- i810SetRingRegs( screen );
-
- KdMarkSync (pScreen);
-}
-
-
-void
-i810SyncAccel(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-
- i810Sync(screen);
-}
-
-void
-i810DisableAccel(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-
-/* fprintf(stderr,"i810DisableAccel\n"); */
- i810RefreshRing( screen );
- i810Sync( screen );
-}
-
-void
-i810FiniAccel(ScreenPtr pScreen)
-{
-/* fprintf(stderr,"i810FiniAccel\n"); */
-
-}
diff --git a/hw/kdrive/i810/i810draw.h b/hw/kdrive/i810/i810draw.h
deleted file mode 100644
index 7c8c04489..000000000
--- a/hw/kdrive/i810/i810draw.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/* Hardware accelerated drawing for KDrive i810 driver, header file.
- Author: Pontus Lidman <pontus.lidman@nokia.com>
-*/
-
-
-#ifndef _I810DRAW_H_
-#define _I810DRAW_H_
-
-void i810RefreshRing(KdScreenInfo *screen);
-int i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis );
-void i810Sync( KdScreenInfo *screen );
-
-#endif /* _I810DRAW_H_ */
diff --git a/hw/kdrive/i810/i810stub.c b/hw/kdrive/i810/i810stub.c
deleted file mode 100644
index fc028288b..000000000
--- a/hw/kdrive/i810/i810stub.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $RCSId: $ */
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/* Stub functions for the i810 KDrive driver
- Author: Pontus Lidman <pontus.lidman@nokia.com>
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kxv.h"
-#include "i810.h"
-
-static const int i810Cards[]={ PCI_CHIP_I810, PCI_CHIP_I810_DC100, PCI_CHIP_I810_E };
-
-#define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0]))
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
- int i;
-
- Bool LinuxFindPci(CARD16, CARD16, CARD32, KdCardAttr *);
-
- for (i = 0; i < numI810Cards; i++)
- if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr))
- KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]);
-}
-
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
- int KdProcessArgument(int, char **, int);
-
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/igs/Imakefile b/hw/kdrive/igs/Imakefile
deleted file mode 100644
index 2214ee5ba..000000000
--- a/hw/kdrive/igs/Imakefile
+++ /dev/null
@@ -1,13 +0,0 @@
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/igs/Imakefile,v 1.2 2000/05/24 23:52:47 keithp Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = igs.c igscmap.c igscurs.c igsdraw.c igsreg.c igsstub.c
-
-OBJS = igs.o igscmap.o igscurs.o igsdraw.o igsreg.o igsstub.o
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(igs,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/igs/igs.c b/hw/kdrive/igs/igs.c
deleted file mode 100644
index 1b0907d4f..000000000
--- a/hw/kdrive/igs/igs.c
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igs.c,v 1.2 2000/05/24 23:52:47 keithp Exp $
- *
- * Copyright © 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "igs.h"
-
-Bool
-igsCardInit (KdCardInfo *card)
-{
- int k;
- char *pixels;
- IgsCardInfo *igsc;
-
- igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo));
- if (!igsc)
- return FALSE;
-
- memset (igsc, '\0', sizeof (IgsCardInfo));
-
- igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0] +
- IGS_FB,
- IGS_MEM);
-
- igsc->vga = (VOL8 *) KdMapDevice (card->attr.address[0] +
- IGS_VGA,
- 64 * 1024);
-
- igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] +
- IGS_COP_OFFSET,
- sizeof (Cop5xxx));
-
- igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] +
- IGS_COP_DATA,
- IGS_COP_DATA_LEN);
-
- igsRegInit (&igsc->igsvga, igsc->vga);
-
- card->driver = igsc;
-
- return TRUE;
-}
-
-Bool
-igsModeSupported (KdScreenInfo *screen,
- const KdMonitorTiming *t)
-{
- /* make sure the clock isn't too fast */
- if (t->clock > IGS_MAX_CLOCK)
- return FALSE;
- /* width must be a multiple of 16 */
- if (t->horizontal & 0xf)
- return FALSE;
- return TRUE;
-}
-
-Bool
-igsModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- int screen_size;
- int pixel_width;
- int byte_width;
- int fb = 0;
-
- screen_size = 0;
- if (screen->fb[fb].depth >= 24)
- {
- screen->fb[fb].depth = 24;
- if (screen->fb[fb].bitsPerPixel != 24)
- screen->fb[fb].bitsPerPixel = 32;
- }
- else if (screen->fb[fb].depth >= 16)
- {
- screen->fb[fb].depth = 16;
- screen->fb[fb].bitsPerPixel = 16;
- }
- else if (screen->fb[fb].depth >= 15)
- {
- screen->fb[fb].depth = 15;
- screen->fb[fb].bitsPerPixel = 16;
- }
- else if (screen->fb[fb].depth >= 12)
- {
- screen->fb[fb].depth = 12;
- screen->fb[fb].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[fb].depth = 8;
- screen->fb[fb].bitsPerPixel = 8;
- }
-
- byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
- pixel_width = screen->width;
- screen->fb[fb].pixelStride = pixel_width;
- screen->fb[fb].byteStride = byte_width;
- screen_size += byte_width * screen->height;
-
- return TRUE;
-}
-
-Bool
-igsScreenInit (KdScreenInfo *screen)
-{
- IgsCardInfo *igsc = screen->card->driver;
- int fb = 0;
- IgsScreenInfo *igss;
- int screen_size, memory;
- int pattern_size;
- int tile_size;
- int stipple_size;
- int poffset, boffset;
- const KdMonitorTiming *t;
-
- if (!screen->width || !screen->height)
- {
- screen->width = 800;
- screen->height = 600;
- screen->rate = 72;
- }
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 8;
-
- t = KdFindMode (screen, igsModeSupported);
-
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
-
- if (!KdTuneMode (screen, igsModeUsable, igsModeSupported))
- {
- return FALSE;
- }
-
- igss = (IgsScreenInfo *) xalloc (sizeof (IgsScreenInfo));
- if (!igss)
- return FALSE;
-
- memset (igss, '\0', sizeof (IgsScreenInfo));
-
- screen_size = screen->fb[fb].byteStride * screen->height;
- memory = IGS_MEM;
- memory -= screen_size;
- if (memory >= 1024)
- {
- igss->cursor_offset = memory - 1024;
-#if BITMAP_BIT_ORDER == MSBFirst
- igss->cursor_base = (CARD8 *) KdMapDevice (card->attr.address[0] +
- igss->cursor_offset,
- 1024);
-#else
- igss->cursor_base = igsc->frameBuffer + igss->cursor_offset;
-#endif
- memory -= 1024;
- }
- else
- igss->cursor_base = 0;
-
- tile_size = IgsTileSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN;
- stipple_size = IgsStippleSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN;
- pattern_size = tile_size + stipple_size;
- if (memory >= pattern_size)
- {
- boffset = screen_size;
- poffset = boffset * 8 / screen->fb[fb].bitsPerPixel;
- igss->tile.offset = poffset;
- igss->tile.base = igsc->frameBuffer + boffset;
-
- boffset = screen_size + tile_size;
- poffset = boffset * 8 / screen->fb[fb].bitsPerPixel;
- igss->stipple.offset = poffset;
- igss->stipple.base = igsc->frameBuffer + boffset;
-
- memory -= pattern_size;
- }
- else
- {
- igss->tile.base = 0;
- igss->stipple.base = 0;
- }
-
- switch (screen->fb[fb].depth) {
- case 8:
- screen->fb[fb].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[fb].blueMask = 0x00;
- screen->fb[fb].greenMask = 0x00;
- screen->fb[fb].redMask = 0x00;
- break;
- case 15:
- screen->fb[fb].visuals = (1 << TrueColor);
- screen->fb[fb].blueMask = 0x001f;
- screen->fb[fb].greenMask = 0x03e0;
- screen->fb[fb].redMask = 0x7c00;
- break;
- case 16:
- screen->fb[fb].visuals = (1 << TrueColor);
- screen->fb[fb].blueMask = 0x001f;
- screen->fb[fb].greenMask = 0x07e0;
- screen->fb[fb].redMask = 0xf800;
- break;
- case 24:
- screen->fb[fb].visuals = (1 << TrueColor);
- screen->fb[fb].blueMask = 0x0000ff;
- screen->fb[fb].greenMask = 0x00ff00;
- screen->fb[fb].redMask = 0xff0000;
- break;
- }
-
- screen->fb[fb].pixelStride = screen->width;
- screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
- screen->fb[fb].frameBuffer = igsc->frameBuffer;
- if (!igsc->cop)
- screen->dumb = TRUE;
- screen->driver = igss;
- return TRUE;
-}
-
-Bool
-igsInitScreen(ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-void
-igsPreserve (KdCardInfo *card)
-{
- IgsCardInfo *igsc = card->driver;
- IgsVga *igsvga = &igsc->igsvga;
-
- igsSave (igsvga);
-}
-
-void
-igsSetBlank (IgsVga *igsvga, Bool blank)
-{
- igsSetImm(igsvga, igs_screen_off, blank ? 1 : 0);
-}
-
-void
-igsSetSync (IgsCardInfo *igsc, int hsync, int vsync)
-{
- IgsVga *igsvga = &igsc->igsvga;
-
- igsSet (igsvga, igs_mexhsyn, hsync);
- igsSet (igsvga, igs_mexvsyn, vsync);
- VgaFlush (&igsvga->card);
-}
-
-
-/*
- * Clock synthesis:
- *
- * scale = p ? (2 * p) : 1
- * f_out = f_ref * ((M + 1) / ((N + 1) * scale))
- *
- * Constraints:
- *
- * 1. 115MHz <= f_ref * ((M + 1) / (N + 1)) <= 260 MHz
- * 2. N >= 1
- *
- * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank))
- * Horizontal refresh rate = clock / (hsize + hblank)
- */
-
-/* all in kHz */
-
-void
-igsGetClock (int target, int *Mp, int *Np, int *Pp, int maxM, int maxN, int maxP, int minVco)
-{
- int M, N, P, bestM, bestN;
- int f_vco, f_out;
- int err, abserr, besterr;
-
- /*
- * Compute correct P value to keep VCO in range
- */
- for (P = 0; P <= maxP; P++)
- {
- f_vco = target * IGS_SCALE(P);
- if (f_vco >= minVco)
- break;
- }
-
- /* M = f_out / f_ref * ((N + 1) * IGS_SCALE(P)); */
- besterr = target;
- for (N = 1; N <= maxN; N++)
- {
- M = ((target * (N + 1) * IGS_SCALE(P) + (IGS_CLOCK_REF/2)) + IGS_CLOCK_REF/2) / IGS_CLOCK_REF - 1;
- if (0 <= M && M <= maxM)
- {
- f_out = IGS_CLOCK(M,N,P);
- err = target - f_out;
- if (err < 0)
- err = -err;
- if (err < besterr)
- {
- besterr = err;
- bestM = M;
- bestN = N;
- }
- }
- }
- *Mp = bestM;
- *Np = bestN;
- *Pp = P;
-}
-
-Bool
-igsEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- KdScreenInfo *screen = pScreenPriv->screen;
- IgsCardInfo *igsc = card->driver;
- IgsVga *igsvga = &igsc->igsvga;
- const KdMonitorTiming *t;
- int hactive, hblank, hfp, hbp;
- int vactive, vblank, vfp, vbp;
- int hsize;
- int fb = 0;
- int m, n, r;
- int h_total;
- int h_display_end;
- int h_blank_start;
- int h_blank_end;
- int h_sync_start;
- int h_sync_end;
- int h_screen_off;
- int v_total;
- int v_retrace_start;
- int v_retrace_end;
- int v_display_end;
- int v_blank_start;
- int v_blank_end;
- int offset;
- int num_fetch;
- int m_m, m_n, m_r;
-
-
- igsSetBlank (igsvga, TRUE);
-
- t = KdFindMode (screen, igsModeSupported);
-
- igsGetClock (t->clock, &m, &n, &r, 2047, 255, 7, IGS_MIN_VCO);
-
- /*
- * Set the chip so that 0x400000 is a big-endian frame buffer
- * with the correct byte swapping enabled
- */
- igsSet (igsvga, igs_biga22force, 0);
- igsSet (igsvga, igs_biga22en, 1);
- igsSet (igsvga, igs_biga24en, 1);
- /*
- * Enable 8-bit DACs
- */
- igsSet (igsvga, igs_rampwdn, 0);
- igsSet (igsvga, igs_dac6_8, 1);
- igsSet (igsvga, igs_dacpwdn, 0);
- /*
- * Set overscan to black
- */
- igsSet (igsvga, igs_overscan_red, 0x00);
- igsSet (igsvga, igs_overscan_green, 0x00);
- igsSet (igsvga, igs_overscan_blue, 0x00);
- /*
- * Enable PCI retries
- */
- igsSet (igsvga, igs_iow_retry, 1);
- igsSet (igsvga, igs_mw_retry, 1);
- igsSet (igsvga, igs_mr_retry, 1);
- igsSet (igsvga, igs_pci_burst_write, 1);
- igsSet (igsvga, igs_pci_burst_read, 1);
- /*
- * Set FIFO
- */
- igsSet (igsvga, igs_memgopg, 1);
- igsSet (igsvga, igs_memr2wpg, 0);
- igsSet (igsvga, igs_crtff16, 0);
- igsSet (igsvga, igs_fifomust, 0xff);
- igsSet (igsvga, igs_fifogen, 0xff);
- /*
- * Enable CRT reg access
- */
- igsSetImm (igsvga, igs_ena_vr_access, 1);
- igsSetImm (igsvga, igs_crt_protect, 0);
-
- hfp = t->hfp;
- hbp = t->hbp;
- hblank = t->hblank;
- hactive = t->horizontal;
- offset = screen->fb[0].byteStride;
-
- vfp = t->vfp;
- vbp = t->vbp;
- vblank = t->vblank;
- vactive = t->vertical;
-
- /*
- * Compute character lengths for horizontal timing values
- */
- hactive = screen->width / 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- offset /= 8;
-
- switch (screen->fb[fb].bitsPerPixel) {
- case 8:
- igsSet (igsvga, igs_overscan_red, pScreen->blackPixel);
- igsSet (igsvga, igs_overscan_green, pScreen->blackPixel);
- igsSet (igsvga, igs_overscan_blue, pScreen->blackPixel);
- igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8);
- igsSet (igsvga, igs_mode_sel, IGS_MODE_8);
- igsSet (igsvga, igs_ramdacbypass, 0);
- break;
- case 16:
- igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_16);
- igsSet (igsvga, igs_ramdacbypass, 1);
- switch (screen->fb[fb].depth) {
- case 12:
- igsSet (igsvga, igs_mode_sel, IGS_MODE_4444);
- break;
- case 15:
- igsSet (igsvga, igs_mode_sel, IGS_MODE_5551);
- break;
- case 16:
- igsSet (igsvga, igs_mode_sel, IGS_MODE_565);
- break;
- }
- break;
- case 24:
- igsSet (igsvga, igs_ramdacbypass, 1);
- igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8);
- igsSet (igsvga, igs_mode_sel, IGS_MODE_888);
- break;
- case 32:
- igsSet (igsvga, igs_ramdacbypass, 1);
- igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_32);
- igsSet (igsvga, igs_mode_sel, IGS_MODE_8888);
- break;
- }
-
- /*
- * Compute horizontal register values from timings
- */
- h_total = hactive + hblank - 5;
- h_display_end = hactive - 1;
-
- h_sync_start = hactive + hfp;
- h_sync_end = hactive + hblank - hbp;
- /*
- * pad the blank values narrow a bit and use the border_select to
- * eliminate the remaining border; don't know why, but it doesn't
- * work in the documented fashion
- */
- h_blank_start = hactive - 1;
- h_blank_end = hactive + hblank - 1 - 1;
-
- num_fetch = (t->horizontal * screen->fb[fb].bitsPerPixel / 64) + 1;
-
- v_total = vactive + vblank - 2;
- v_display_end = vactive - 1;
-
- v_blank_start = vactive - 1;
- v_blank_end = v_blank_start + vblank - 1;
-
- v_retrace_start = vactive + vfp;
- v_retrace_end = vactive + vblank - vbp;
-
-#if 0
-#define chk(a,b,c) fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", a, igsGet(igsvga, b), c);
-
- chk("h_total", igs_h_total, h_total);
- chk("h_display_end", igs_h_de_end, h_display_end);
- chk("h_sync_start", igs_h_rstart, h_sync_start);
- chk("h_sync_end", igs_h_rend, h_sync_end&0x1f);
- chk("h_blank_start", igs_h_bstart, h_blank_start);
- chk("h_blank_end", igs_h_bend, h_blank_end&0x3f);
- chk("offset", igs_offset, offset);
- chk("num_fetch", igs_num_fetch, num_fetch);
-
- chk("v_total", igs_v_total, v_total);
- chk("v_display_end", igs_v_de_end, v_display_end);
- chk("v_blank_start", igs_v_bstart, v_blank_start);
- chk("v_blank_end", igs_v_bend, v_blank_end&0xf);
- chk("v_retrace_start", igs_v_rstart, v_retrace_start);
- chk("v_retrace_end", igs_v_rend, v_retrace_end&0xf);
- chk("vclk_m", igs_vclk_m, m);
- chk("vclk_n", igs_vclk_n, n);
- chk("vclk_p", igs_vclk_p, r);
-
- fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", "vclk",
- IGS_CLOCK(igsGet(igsvga,igs_vclk_m),
- igsGet(igsvga,igs_vclk_n),
- igsGet(igsvga,igs_vclk_p)),
- IGS_CLOCK(m,n,r));
-#endif
- igsSet (igsvga, igs_h_total, h_total);
- igsSet (igsvga, igs_h_de_end, h_display_end);
- igsSet (igsvga, igs_h_rstart, h_sync_start);
- igsSet (igsvga, igs_h_rend, h_sync_end);
- igsSet (igsvga, igs_h_bstart, h_blank_start);
- igsSet (igsvga, igs_h_bend, h_blank_end);
- igsSet (igsvga, igs_offset, offset);
- igsSet (igsvga, igs_num_fetch, num_fetch);
-
- igsSet (igsvga, igs_v_total, v_total);
- igsSet (igsvga, igs_v_de_end, v_display_end);
- igsSet (igsvga, igs_v_bstart, v_blank_start);
- igsSet (igsvga, igs_v_bend, v_blank_end&0xf);
- igsSet (igsvga, igs_v_rstart, v_retrace_start);
- igsSet (igsvga, igs_v_rend, v_retrace_end&0xf);
-
- igsSet (igsvga, igs_vclk_m, m);
- igsSet (igsvga, igs_vclk_n, n);
- igsSet (igsvga, igs_vclk_p, r);
- igsSet (igsvga, igs_vfsel, IGS_CLOCK(m, n, 0) >= 180000);
- VgaFlush (&igsvga->card);
-
- igsSetImm (igsvga, igs_frqlat, 0);
- igsSetImm (igsvga, igs_frqlat, 1);
- igsSetImm (igsvga, igs_frqlat, 0);
-
- igsSetBlank (igsvga, FALSE);
-#if 0
-#define dbg(a,b) fprintf(stderr, "%20.20s = 0x%x\n", a, igsGet(igsvga,b))
-
-#include "reg.dbg"
-
- {
- VGA16 reg;
- char buf[128];
-
- for (reg = 0; reg < IGS_NREG; reg++)
- fprintf(stderr, "%20.20s = 0x%02x\n", igsRegName(buf, reg),
- VgaFetch (&igsvga->card, reg));
- }
-#endif
- return TRUE;
-}
-
-Bool
-igsDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- IgsCardInfo *igsc = pScreenPriv->card->driver;
- IgsVga *igsvga = &igsc->igsvga;
-
- switch (mode) {
- case KD_DPMS_NORMAL:
- igsSetSync (igsc, 0, 0);
- igsSetBlank (igsvga, FALSE);
- break;
- case KD_DPMS_STANDBY:
- igsSetBlank (igsvga, TRUE);
- igsSetSync (igsc, 1, 0);
- break;
- case KD_DPMS_SUSPEND:
- igsSetBlank (igsvga, TRUE);
- igsSetSync (igsc, 0, 1);
- break;
- case KD_DPMS_POWERDOWN:
- igsSetBlank (igsvga, TRUE);
- igsSetSync (igsc, 1, 1);
- break;
- }
- return TRUE;
-}
-
-void
-igsDisable (ScreenPtr pScreen)
-{
-}
-
-void
-igsRestore (KdCardInfo *card)
-{
- IgsCardInfo *igsc = card->driver;
- IgsVga *igsvga = &igsc->igsvga;
-
- igsReset (igsvga);
-}
-
-void
-igsScreenFini (KdScreenInfo *screen)
-{
- IgsScreenInfo *igss = (IgsScreenInfo *) screen->driver;
-
-#if BITMAP_BIT_ORDER == MSBFirst
- if (igss->cursor_base)
- KdUnmapDevice ((void *) igss->cursor_base, 1024);
-#endif
- xfree (igss);
- screen->driver = 0;
-}
-
-void
-igsCardFini (KdCardInfo *card)
-{
- IgsCardInfo *igsc = card->driver;
-
- if (igsc->copData)
- KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN);
- if (igsc->cop)
- KdUnmapDevice ((void *) igsc->cop, sizeof (Cop5xxx));
- if (igsc->vga)
- KdUnmapDevice ((void *) igsc->vga, 64 * 1024);
- if (igsc->frameBuffer)
- KdUnmapDevice (igsc->frameBuffer, IGS_MEM);
- xfree (igsc);
- card->driver = 0;
-}
-
-KdCardFuncs igsFuncs = {
- igsCardInit, /* cardinit */
- igsScreenInit, /* scrinit */
- igsInitScreen,
- igsPreserve, /* preserve */
- igsEnable, /* enable */
- igsDPMS, /* dpms */
- igsDisable, /* disable */
- igsRestore, /* restore */
- igsScreenFini, /* scrfini */
- igsCardFini, /* cardfini */
-
- igsCursorInit, /* initCursor */
- igsCursorEnable, /* enableCursor */
- igsCursorDisable, /* disableCursor */
- igsCursorFini, /* finiCursor */
- 0, /* recolorCursor */
-
- igsDrawInit, /* initAccel */
- igsDrawEnable, /* enableAccel */
- igsDrawSync, /* drawSync */
- igsDrawDisable, /* disableAccel */
- igsDrawFini, /* finiAccel */
-
- igsGetColors, /* getColors */
- igsPutColors, /* putColors */
-};
diff --git a/hw/kdrive/igs/igs.h b/hw/kdrive/igs/igs.h
deleted file mode 100644
index 264425022..000000000
--- a/hw/kdrive/igs/igs.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igs.h,v 1.1 2000/05/06 22:17:43 keithp Exp $
- *
- * Copyright © 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifndef _IGS_H_
-#define _IGS_H_
-
-#include "kdrive.h"
-#include "igsreg.h"
-
-extern KdCardFuncs igsFuncs;
-
-/*
- * FB 0x00000000
- * VGA 0x00800000
- * Blt window 0x008a0000
- * Coprocessor 0x008bf000
- */
-
-#if BITMAP_BIT_ORDER == MSBFirst
-#define IGS_FB 0x00400000
-#else
-#define IGS_FB 0x00000000
-#endif
-#define IGS_VGA 0x00800000
-#define IGS_COP_DATA 0x008a0000
-#define IGS_COP_DATA_LEN 0x00010000
-#define IGS_COP_OFFSET 0x008bf000
-/* give audio 1/2 meg at end */
-#if 1
-#define IGS_MEM ((4096-512)*1024)
-#else
-#define IGS_MEM ((4096)*1024)
-#endif
-
-#define IGS_CLOCK_REF 24576 /* KHz */
-
-#define IGS_SCALE(p) ((p) ? (2 * (p)) : 1)
-
-#define IGS_CLOCK(m,n,p) ((IGS_CLOCK_REF * ((m) + 1)) / (((n) + 1) * IGS_SCALE(p)))
-
-#define IGS_MAX_CLOCK 260000
-
-#define IGS_MIN_VCO 115000
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _Cop5xxx {
- VOL8 pad000[0x10]; /* 0x000 */
-
- VOL32 control; /* 0x010 */
-#define IGS_CONTROL_HBLTW_RDYZ 0x0100
-#define IGS_CONTROL_MALLWBEPTZ 0x0200
-#define IGS_CONTROL_CMDFF 0x0400
-#define IGS_CONTROL_SOP 0x0800
-#define IGS_CONTROL_OPS 0x1000
-#define IGS_CONTROL_TER 0x2000
-#define IGS_CONTROL_HBACKZ 0x4000
-#define IGS_CONTROL_BUSY 0x8000
-
- VOL8 pad014[0x04]; /* 0x014 */
-
- VOL32 src1_stride; /* 0x018 */
-
- VOL32 format; /* 0x01c */
-
-#define IGS_FORMAT_8BPP 0
-#define IGS_FORMAT_16BPP 1
-#define IGS_FORMAT_24BPP 2
-#define IGS_FORMAT_32BPP 3
-
- VOL32 bres_error; /* 0x020 */
- VOL32 bres_k1; /* 0x024 */
- VOL32 bres_k2; /* 0x028 */
- VOL8 pad02c[0x1c]; /* 0x02c */
-
- VOL32 mix; /* 0x048 */
-#define IGS_MIX_FG 0x00ff
-#define IGS_MIX_BG 0xff00
-#define IGS_MAKE_MIX(fg,bg) ((fg) | ((bg) << 8))
-
-#define IGS_MIX_ZERO 0x0
-#define IGS_MIX_SRC_AND_DST 0x1
-#define IGS_MIX_SRC_AND_NOT_DST 0x2
-#define IGS_MIX_SRC 0x3
-#define IGS_MIX_NOT_SRC_AND_DST 0x4
-#define IGS_MIX_DST 0x5
-#define IGS_MIX_SRC_XOR_DST 0x6
-#define IGS_MIX_SRC_OR_DST 0x7
-#define IGS_MIX_NOT_SRC_AND_NOT_DST 0x8
-#define IGS_MIX_SRC_XOR_NOT_DST 0x9
-#define IGS_MIX_NOT_DST 0xa
-#define IGS_MIX_SRC_OR_NOT_DST 0xb
-#define IGS_MIX_NOT_SRC 0xc
-#define IGS_MIX_NOT_SRC_OR_DST 0xd
-#define IGS_MIX_NOT_SRC_OR_NOT_DST 0xe
-#define IGS_MIX_ONE 0xf
-
- VOL32 colorComp; /* 0x04c */
- VOL32 planemask; /* 0x050 */
-
- VOL8 pad054[0x4]; /* 0x054 */
-
- VOL32 fg; /* 0x058 */
- VOL32 bg; /* 0x05c */
- VOL32 dim; /* 0x060 */
-#define IGS_MAKE_DIM(w,h) ((w) | ((h) << 16))
- VOL8 pad5[0x0c]; /* 0x064 */
-
- VOL32 src1_base_address; /* 0x070 */
- VOL8 pad074[0x04]; /* 0x074 */
-
- VOL32 rotate; /* 0x078 */
-#define IGS_MAKE_ROTATE(x,y) ((x) | ((y) << 16))
- VOL32 operation; /* 0x07c */
-
-/* OCT[2:0] */
-#define IGS_DRAW_X_MAJOR 0x00000000
-#define IGS_DRAW_Y_MAJOR 0x00000001
-#define IGS_DRAW_T_B 0x00000000
-#define IGS_DRAW_B_T 0x00000002
-#define IGS_DRAW_L_R 0x00000000
-#define IGS_DRAW_R_L 0x00000004
-
-/* Draw_Mode[1:0] */
-#define IGS_DRAW_ALL 0x00000000
-#define IGS_DRAW_NOT_FIRST 0x00000010
-#define IGS_DRAW_NOT_LAST 0x00000020
-#define IGS_DRAW_NOT_FIRST_LAST 0x00000030
-
-/* TRPS[1:0] */
-#define IGS_TRANS_SRC1 0x00000000
-#define IGS_TRANS_SRC2 0x00000100
-#define IGS_TRANS_DST 0x00000200
-/* TRPS2 Transparent Invert */
-#define IGS_TRANS_INVERT 0x00000400
-/* TRPS3, Transparent Enable */
-#define IGS_TRANS_ENABLE 0x00000800
-
-/* PPS[3:0], Pattern Pixel Select */
-#define IGS_PIXEL_TEXT_OPAQUE 0x00001000
-#define IGS_PIXEL_STIP_OPAQUE 0x00002000
-#define IGS_PIXEL_LINE_OPAQUE 0x00003000
-#define IGS_PIXEL_TEXT_TRANS 0x00005000
-#define IGS_PIXEL_STIP_TRANS 0x00006000
-#define IGS_PIXEL_LINE_TRANS 0x00007000
-#define IGS_PIXEL_FG 0x00008000
-#define IGS_PIXEL_TILE 0x00009000
-#define IGS_PIXEL_TILE_OPAQUE 0x0000d000
-
-/* HostBltEnable[1:0] */
-#define IGS_HBLT_DISABLE 0x00000000
-#define IGS_HBLT_READ 0x00010000
-#define IGS_HBLT_WRITE_1 0x00020000
-#define IGS_HBLT_WRITE_2 0x00030000
-
-/* Src2MapSelect[2:0], Src2 map select mode */
-#define IGS_SRC2_NORMAL 0x00000000
-#define IGS_SRC2_MONO_OPAQUE 0x00100000
-#define IGS_SRC2_FG 0x00200000
-#define IGS_SRC2_MONO_TRANS 0x00500000
-
-/* StepFunction[3:0], Step function select */
-#define IGS_STEP_DRAW_AND_STEP 0x04000000
-#define IGS_STEP_LINE_DRAW 0x05000000
-#define IGS_STEP_PXBLT 0x08000000
-#define IGS_STEP_INVERT_PXBLT 0x09000000
-#define IGS_STEP_TERNARY_PXBLT 0x0b000000
-
-/* FGS */
-#define IGS_FGS_FG 0x00000000
-#define IGS_FGS_SRC 0x20000000
-
-/* BGS */
-#define IGS_BGS_BG 0x00000000
-#define IGS_BGS_SRC 0x80000000
- VOL8 pad080[0x90]; /* 0x080 */
-
- VOL32 debug_control; /* 0x110 */
- VOL8 pad114[0x04]; /* 0x114 */
-
- VOL32 src2_stride; /* 0x118 */
- VOL8 pad11c[0x14]; /* 0x11c */
-
- VOL32 extension; /* 0x130 */
-
-#define IGS_BURST_ENABLE 0x01
-#define IGS_STYLE_LINE 0x02
-#define IGS_ADDITIONAL_WAIT 0x04
-#define IGS_BLOCK_COP_REG 0x08
-#define IGS_TURBO_MONO 0x10
-#define IGS_SELECT_SAMPLE 0x40
-#define IGS_MDSBL_RD_B_WR 0x80
-#define IGS_WRMRSTZ 0x100
-#define IGS_TEST_MTST 0x200
-
- VOL32 style_line; /* 0x134 */
-#define IGS_MAKE_STILE_LINE(roll_over,inc,pattern,accumulator) \
- ((roll_over) | \
- ((style_line_inc) << 8) | \
- ((style_line_patern) << 16) | \
- ((style_line_accumullator) << 24))
- VOL32 style_line_pattern_index; /* 0x138 */
-
- VOL32 mono_burst_total; /* 0x13c */
- VOL8 pad140[0x10]; /* 0x140 */
-
- VOL32 pat_x_rotate; /* 0x150 */
- VOL8 pad154[0x1c]; /* 0x154 */
-
- VOL32 src1_start; /* 0x170 */
- VOL32 src2_start; /* 0x174 */
- VOL32 dst_start; /* 0x178 */
- VOL8 pad17c[0x9c]; /* 0x17c */
-
- VOL32 dst_stride; /* 0x218 */
-} Cop5xxx;
-
-typedef struct _igsCardInfo {
- Cop5xxx *cop;
- VOL8 *vga;
- VOL32 *copData;
- CARD8 *frameBuffer;
- IgsVga igsvga;
-} IgsCardInfo;
-
-#define getIgsCardInfo(kd) ((IgsCardInfo *) ((kd)->card->driver))
-#define igsCardInfo(kd) IgsCardInfo *igsc = getIgsCardInfo(kd)
-
-typedef struct _igsCursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} IgsCursor;
-
-#define IGS_CURSOR_WIDTH 64
-#define IGS_CURSOR_HEIGHT 64
-
-typedef struct _igsPattern {
- INT32 xrot, yrot;
- CARD32 serial_number;
- CARD8 *base;
- CARD32 offset;
-} IgsPattern;
-
-#define IGS_NUM_PATTERN 8
-#define IGS_PATTERN_WIDTH 8
-#define IGS_PATTERN_HEIGHT 8
-
-typedef struct _igsPatternCache {
- CARD8 *base;
- CARD32 offset;
- IgsPattern pattern[IGS_NUM_PATTERN];
- int next;
-} IgsPatternCache;
-
-typedef struct _igsScreenInfo {
- CARD8 *cursor_base;
- CARD32 cursor_offset;
- IgsCursor cursor;
- IgsPatternCache tile;
- IgsPatternCache stipple;
-} IgsScreenInfo;
-
-#define IgsTileSize(bpp) (IGS_PATTERN_WIDTH*(bpp)/8*IGS_PATTERN_HEIGHT)
-#define IgsStippleSize(bpp) (IGS_PATTERN_WIDTH/8*IGS_PATTERN_HEIGHT)
-
-#define getIgsScreenInfo(kd) ((IgsScreenInfo *) ((kd)->screen->driver))
-#define igsScreenInfo(kd) IgsScreenInfo *igss = getIgsScreenInfo(kd)
-
-Bool
-igsDrawInit (ScreenPtr pScreen);
-
-void
-igsDrawEnable (ScreenPtr pScreen);
-
-void
-igsDrawDisable (ScreenPtr pScreen);
-
-void
-igsDrawSync (ScreenPtr pScreen);
-
-void
-igsDrawFini (ScreenPtr pScreen);
-
-void
-igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-
-void
-igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-
-Bool
-igsCursorInit (ScreenPtr pScreen);
-
-void
-igsCursorEnable (ScreenPtr pScreen);
-
-void
-igsCursorDisable (ScreenPtr pScreen);
-
-void
-igsCursorFini (ScreenPtr pScreen);
-
-#endif /* _IGS_H_ */
diff --git a/hw/kdrive/igs/igscmap.c b/hw/kdrive/igs/igscmap.c
deleted file mode 100644
index e6dc04e7b..000000000
--- a/hw/kdrive/igs/igscmap.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "igs.h"
-
-#define IGS_DAC_SHIFT 8
-void
-igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- igsCardInfo(pScreenPriv);
- IgsVga *igsvga = &igsc->igsvga;
-
- while (ndef--)
- {
- igsSetImm (igsvga, igs_dac_read_index, pdefs->pixel);
- pdefs->red = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT;
- pdefs->green = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT;
- pdefs->blue = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT;
- pdefs++;
- }
-}
-
-void
-igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- igsCardInfo(pScreenPriv);
- IgsVga *igsvga = &igsc->igsvga;
-
- while (ndef--)
- {
- igsSetImm (igsvga, igs_dac_write_index, pdefs->pixel);
- igsSetImm (igsvga, igs_dac_data, pdefs->red >> IGS_DAC_SHIFT);
- igsSetImm (igsvga, igs_dac_data, pdefs->green >> IGS_DAC_SHIFT);
- igsSetImm (igsvga, igs_dac_data, pdefs->blue >> IGS_DAC_SHIFT);
- pdefs++;
- }
-}
-
diff --git a/hw/kdrive/igs/igscurs.c b/hw/kdrive/igs/igscurs.c
deleted file mode 100644
index 6bdc61658..000000000
--- a/hw/kdrive/igs/igscurs.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "igs.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- igsCardInfo(pScreenPriv); \
- igsScreenInfo(pScreenPriv); \
- IgsCursor *pCurPriv = &igss->cursor; \
- IgsVga *igsvga = &igsc->igsvga
-
-static void
-_igsMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
-
- igsSet (igsvga, igs_sprite_x, x);
- igsSet (igsvga, igs_sprite_preset_x, xoff);
- igsSet (igsvga, igs_sprite_y, y);
- igsSet (igsvga, igs_sprite_preset_y, yoff);
-}
-
-static void
-igsMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _igsMoveCursor (pScreen, x, y);
- VgaFlush (&igsvga->card);
-}
-
-
-static void
-igsSetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
-
- igsSetImm (igsvga, igs_cursor_write_index, 0);
- igsSetImm (igsvga, igs_cursor_data, pCursor->backRed >> 8);
- igsSetImm (igsvga, igs_cursor_data, pCursor->backGreen >> 8);
- igsSetImm (igsvga, igs_cursor_data, pCursor->backBlue >> 8);
- igsSetImm (igsvga, igs_cursor_write_index, 1);
- igsSetImm (igsvga, igs_cursor_data, pCursor->foreRed >> 8);
- igsSetImm (igsvga, igs_cursor_data, pCursor->foreGreen >> 8);
- igsSetImm (igsvga, igs_cursor_data, pCursor->foreBlue >> 8);
-}
-
-#if BITMAP_BIT_ORDER == MSBFirst
-#define IgsAdjustCursor(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
- v = ((v & 0x00ff00ff) << 8) | ((v >> 8) & 0x00ff00ff); \
- v = ((v & 0x0000ffff) <<16) | ((v >>16) & 0x0000ffff); \
-}
-#else
-#define IgsAdjustCursor(v)
-#endif
-
-#define ExplodeBits2(v) (((v) & 1) | (((v) & 2) << 1))
-#define ExplodeBits4(v) ((ExplodeBits2((v) >> 2) << 4) | \
- (ExplodeBits2((v) & 0x3)))
-#define ExplodeBits8(v) ((ExplodeBits4((v) >> 4) << 8) | \
- (ExplodeBits4((v) & 0xf)))
-#define ExplodeBits16(v) ((ExplodeBits8((v) >> 8) << 16) | \
- (ExplodeBits8((v) & 0xff)))
-static void
-igsLoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- CARD32 *ram, *msk, *mskLine, *src, *srcLine;
- int i, j;
- int cursor_address;
- int lwsrc;
- unsigned char ramdac_control_;
- CARD32 offset;
- CARD32 b0, b1;
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (CARD32 *) igss->cursor_base;
- mskLine = (CARD32 *) bits->mask;
- srcLine = (CARD32 *) bits->source;
-
- h = bits->height;
- if (h > IGS_CURSOR_HEIGHT)
- h = IGS_CURSOR_HEIGHT;
-
- lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
-
- for (i = 0; i < IGS_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += lwsrc;
- srcLine += lwsrc;
- for (j = 0; j < IGS_CURSOR_WIDTH / 32; j++) {
-
- CARD32 m, s;
-
- if (i < h && j < lwsrc)
- {
- m = *msk++;
- s = *src++;
- IgsAdjustCursor(m);
- IgsAdjustCursor(s);
- }
- else
- {
- m = 0;
- s = 0;
- }
- s &= m;
- m = ~m;
- b0 = ExplodeBits16(s&0xffff) | (ExplodeBits16(m&0xffff)<<1);
- b1 = ExplodeBits16(s>>16) | (ExplodeBits16(m>>16)<<1);
- *ram++ = b0;
- *ram++ = b1;
- }
- }
-
- /* Set new color */
- igsSetCursorColors (pScreen);
-
- /* Set address for cursor bits */
- offset = igss->cursor_offset;
- offset >>= 10;
- igsSet (igsvga, igs_sprite_addr, offset);
-
- /* Assume TV interpolation off */
- igsSet (igsvga, igs_hcshf, 3);
- /* Enable the cursor */
- igsSet (igsvga, igs_sprite_visible, 1);
- igsSet (igsvga, igs_sprite_64x64, 1);
- /* Move to new position */
- _igsMoveCursor (pScreen, x, y);
-
- VgaFlush (&igsvga->card);
-}
-
-static void
-igsUnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- /* Disable cursor */
- igsSet (igsvga, igs_sprite_visible, 0);
- VgaFlush (&igsvga->card);
-}
-
-static Bool
-igsRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- igsLoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-igsUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-igsSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- igsLoadCursor (pScreen, x, y);
- else
- igsUnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec igsPointerSpriteFuncs = {
- igsRealizeCursor,
- igsUnrealizeCursor,
- igsSetCursor,
- igsMoveCursor,
-};
-
-static void
-igsQueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-igsCursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!igss->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = IGS_CURSOR_WIDTH;
- pCurPriv->height= IGS_CURSOR_HEIGHT;
- pScreen->QueryBestSize = igsQueryBestSize;
- miPointerInitialize (pScreen,
- &igsPointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-igsCursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- igsLoadCursor (pScreen, x, y);
- }
- else
- igsUnloadCursor (pScreen);
- }
-}
-
-void
-igsCursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- igsUnloadCursor (pScreen);
- }
- }
-}
-
-void
-igsCursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/igs/igsdraw.c b/hw/kdrive/igs/igsdraw.c
deleted file mode 100644
index d92ea6653..000000000
--- a/hw/kdrive/igs/igsdraw.c
+++ /dev/null
@@ -1,1538 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsdraw.c,v 1.1 2000/05/06 22:17:43 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "igs.h"
-#include "igsdraw.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-
-CARD8 igsPatRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0xa0, /* src AND dst */
- /* GXandReverse */ 0x50, /* src AND NOT dst */
- /* GXcopy */ 0xf0, /* src */
- /* GXandInverted*/ 0x0a, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x5a, /* src XOR dst */
- /* GXor */ 0xfa, /* src OR dst */
- /* GXnor */ 0x05, /* NOT src AND NOT dst */
- /* GXequiv */ 0xa5, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xf5, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x0f, /* NOT src */
- /* GXorInverted */ 0xaf, /* NOT src OR dst */
- /* GXnand */ 0x5f, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-/*
- * Handle pixel transfers
- */
-
-#define BURST
-#ifdef BURST
-#define PixTransDeclare VOL32 *pix_trans_base = igsc->copData,\
- *pix_trans = pix_trans_base
-#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 16384) pix_trans = pix_trans_base
-#define PixTransStore(t) *pix_trans++ = (t)
-#else
-#define PixTransDeclare VOL32 *pix_trans = igsc->copData
-#define PixTransStart(n)
-#define PixTransStore(t) *pix_trans = (t)
-#endif
-
-static IgsPattern *
-igsSetPattern (ScreenPtr pScreen,
- PixmapPtr pPixmap,
- CARD8 fillStyle,
- INT32 xrot,
- INT32 yrot)
-{
- KdScreenPriv(pScreen);
- igsCardInfo(pScreenPriv);
- igsScreenInfo(pScreenPriv);
- int i;
- IgsPatternCache *c;
- IgsPattern *p;
-
- if (fillStyle == FillTiled)
- c = &igss->tile;
- else
- c = &igss->stipple;
- for (i = 0; i < IGS_NUM_PATTERN; i++)
- {
- p = &c->pattern[i];
- if (p->serial_number == pPixmap->drawable.serialNumber &&
- p->xrot == xrot &&
- p->yrot == yrot)
- {
- return p;
- }
- }
- p = &c->pattern[c->next];
- if (++c->next == IGS_NUM_PATTERN)
- c->next = 0;
- p->serial_number = pPixmap->drawable.serialNumber;
- p->xrot = xrot;
- p->yrot = yrot;
-
- if (fillStyle != FillTiled)
- {
- FbStip *pix;
- FbStride pixStride;
- int pixBpp;
- int pixXoff, pixYoff;
- CARD8 tmp[8];
- CARD32 *pat;
- int stipX, stipY;
- int y;
- FbStip bits;
-
- fbGetStipDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, pixXoff, pixYoff);
-
- modulus (-yrot - pixYoff, pPixmap->drawable.height, stipY);
- modulus (-xrot - pixXoff, FB_UNIT, stipX);
-
- pat = (CARD32 *) p->base;
-
- for (y = 0; y < 8; y++)
- {
- bits = pix[stipY * pixStride];
- FbRotLeft (bits, stipX);
- tmp[y] = (CARD8) bits;
- stipY++;
- if (stipY == pPixmap->drawable.height)
- stipY = 0;
- }
- for (i = 0; i < 2; i++)
- {
- bits = (tmp[i*4+0] |
- (tmp[i*4+1] << 8) |
- (tmp[i*4+2] << 16) |
- (tmp[i*4+3] << 24));
- IgsAdjustBits32 (bits);
- *pat++ = bits;
- }
- }
- else
- {
- FbBits *pix;
- FbStride pixStride;
- int pixBpp;
- FbBits *pat;
- FbStride patStride;
- int patBpp;
- int patXoff, patYoff;
-
- fbGetDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, patXoff, patYoff);
-
- pat = (FbBits *) p->base;
- patBpp = pixBpp;
- patStride = (patBpp * IGS_PATTERN_WIDTH) / (8 * sizeof (FbBits));
-
- fbTile (pat, patStride, 0,
- patBpp * IGS_PATTERN_WIDTH, IGS_PATTERN_HEIGHT,
-
- pix, pixStride,
- pPixmap->drawable.width * pixBpp,
- pPixmap->drawable.height,
- GXcopy, FB_ALLONES, pixBpp,
- (xrot - patXoff) * pixBpp, yrot - patYoff);
- }
- return p;
-}
-
-void
-igsFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask)
-{
- SetupIgs(pDrawable->pScreen);
- CARD32 cmd;
-
- _igsSetSolidRect(cop,alu,planemask,pixel,cmd);
- while (nBox--)
- {
- _igsRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd);
- pBox++;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-void
-igsFillBoxTiled (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- PixmapPtr pPixmap, int xrot, int yrot, int alu)
-{
- SetupIgs(pDrawable->pScreen);
- CARD32 cmd;
- IgsPattern *p = igsSetPattern (pDrawable->pScreen,
- pPixmap,
- FillTiled,
- xrot, yrot);
-
- _igsSetTiledRect(cop,alu,planemask,p->offset,cmd);
- while (nBox--)
- {
- _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd);
- pBox++;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-void
-igsFillBoxStippled (DrawablePtr pDrawable, GCPtr pGC,
- int nBox, BoxPtr pBox)
-{
- SetupIgs(pDrawable->pScreen);
- CARD32 cmd;
- int xrot = pGC->patOrg.x + pDrawable->x;
- int yrot = pGC->patOrg.y + pDrawable->y;
- IgsPattern *p = igsSetPattern (pDrawable->pScreen,
- pGC->stipple,
- pGC->fillStyle,
- xrot, yrot);
- if (pGC->fillStyle == FillStippled)
- {
- _igsSetStippledRect (cop,pGC->alu,planemask,pGC->fgPixel,p->offset,cmd);
- }
- else
- {
- _igsSetOpaqueStippledRect (cop,pGC->alu,planemask,
- pGC->fgPixel,pGC->bgPixel,p->offset,cmd);
- }
- while (nBox--)
- {
- _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd);
- pBox++;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-
-void
-igsStipple (ScreenPtr pScreen,
- CARD32 cmd,
- FbStip *psrcBase,
- FbStride widthSrc,
- int srcx,
- int srcy,
- int dstx,
- int dsty,
- int width,
- int height)
-{
- SetupIgs(pScreen);
- FbStip *psrcLine, *psrc;
- FbStride widthRest;
- FbStip bits, tmp, lastTmp;
- int leftShift, rightShift;
- int nl, nlMiddle;
- int r;
- PixTransDeclare;
-
- /* Compute blt address and parameters */
- psrc = psrcBase + srcy * widthSrc + (srcx >> 5);
- nlMiddle = (width + 31) >> 5;
- leftShift = srcx & 0x1f;
- rightShift = 32 - leftShift;
- widthRest = widthSrc - nlMiddle;
-
- _igsPlaneBlt(cop,dstx,dsty,width,height,cmd);
-
- if (leftShift == 0)
- {
- while (height--)
- {
- nl = nlMiddle;
- PixTransStart(nl);
- while (nl--)
- {
- tmp = *psrc++;
- IgsAdjustBits32 (tmp);
- PixTransStore (tmp);
- }
- psrc += widthRest;
- }
- }
- else
- {
- widthRest--;
- while (height--)
- {
- bits = *psrc++;
- nl = nlMiddle;
- PixTransStart(nl);
- while (nl--)
- {
- tmp = FbStipLeft(bits, leftShift);
- bits = *psrc++;
- tmp |= FbStipRight(bits, rightShift);
- IgsAdjustBits32(tmp);
- PixTransStore (tmp);
- }
- psrc += widthRest;
- }
- }
-}
-
-void
-igsCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupIgs(pDstDrawable->pScreen);
- int srcX, srcY, dstX, dstY;
- int w, h;
- CARD32 flags;
- CARD32 cmd;
- CARD8 alu;
-
- if (pGC)
- {
- alu = pGC->alu;
- if (sourceInvarient (pGC->alu))
- {
- igsFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask);
- return;
- }
- }
- else
- alu = GXcopy;
-
- _igsSetBlt(cop,alu,pGC->planemask,reverse,upsidedown,cmd);
- while (nbox--)
- {
- w = pbox->x2 - pbox->x1;
- h = pbox->y2 - pbox->y1;
- if (reverse)
- dstX = pbox->x2 - 1;
- else
- dstX = pbox->x1;
- srcX = dstX + dx;
-
- if (upsidedown)
- dstY = pbox->y2 - 1;
- else
- dstY = pbox->y1;
-
- srcY = dstY + dy;
-
- _igsBlt (cop, srcX, srcY, dstX, dstY, w, h, cmd);
- pbox++;
- }
- KdMarkSync (pDstDrawable->pScreen);
-}
-
-RegionPtr
-igsCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- KdScreenPriv(pDstDrawable->pScreen);
- FbBits depthMask;
-
- depthMask = FbFullMask (pDstDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask &&
- pSrcDrawable->type == DRAWABLE_WINDOW &&
- pDstDrawable->type == DRAWABLE_WINDOW)
- {
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, igsCopyNtoN, 0, 0);
- }
- return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty);
-}
-
-typedef struct _igs1toNargs {
- unsigned long copyPlaneFG, copyPlaneBG;
- Bool opaque;
-} igs1toNargs;
-
-void
-igsCopy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupIgs(pDstDrawable->pScreen);
-
- igs1toNargs *args = closure;
- int dstx, dsty;
- FbStip *psrcBase;
- FbStride widthSrc;
- int srcBpp;
- int srcXoff, srcYoff;
- CARD32 cmd;
-
- if (args->opaque && sourceInvarient (pGC->alu))
- {
- igsFillBoxSolid (pDstDrawable, nbox, pbox,
- pGC->bgPixel, pGC->alu, pGC->planemask);
- return;
- }
-
- fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff);
-
- if (args->opaque)
- {
- _igsSetOpaquePlaneBlt (cop, pGC->alu, pGC->planemask, args->copyPlaneFG,
- args->copyPlaneBG, cmd);
- }
- else
- {
- _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask,
- args->copyPlaneFG, cmd);
- }
-
- while (nbox--)
- {
- dstx = pbox->x1;
- dsty = pbox->y1;
-
- igsStipple (pDstDrawable->pScreen, cmd,
- psrcBase, widthSrc,
- dstx + dx - srcXoff, dsty + dy - srcYoff,
- dstx, dsty,
- pbox->x2 - dstx, pbox->y2 - dsty);
- pbox++;
- }
- KdMarkSync (pDstDrawable->pScreen);
-}
-
-RegionPtr
-igsCopyPlane (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- unsigned long bitPlane)
-{
- RegionPtr ret;
- igs1toNargs args;
- FbBits depthMask;
-
- depthMask = FbFullMask (pDstDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask &&
- pDstDrawable->type == DRAWABLE_WINDOW &&
- pSrcDrawable->depth == 1)
- {
- args.copyPlaneFG = pGC->fgPixel;
- args.copyPlaneBG = pGC->bgPixel;
- args.opaque = TRUE;
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, igsCopy1toN, bitPlane, &args);
- }
- return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, bitPlane);
-}
-
-#if 0
-/* would you believe this is slower than fb? */
-void
-igsPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w,
- int h,
- int x,
- int y)
-{
- igs1toNargs args;
- FbBits depthMask;
-
- depthMask = FbFullMask (pDstDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask &&
- pDrawable->type == DRAWABLE_WINDOW &&
- pGC->fillStyle == FillSolid)
- {
- args.opaque = FALSE;
- args.copyPlaneFG = pGC->fgPixel;
- (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC,
- 0, 0, w, h, x, y, igsCopy1toN, 1, &args);
- }
- else
- {
- KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
- }
-}
-#else
-#define igsPushPixels KdCheckPushPixels
-#endif
-
-BOOL
-igsFillOk (GCPtr pGC)
-{
- FbBits depthMask;
-
- depthMask = FbFullMask(pGC->depth);
- if ((pGC->planemask & depthMask) != depthMask)
- return FALSE;
- switch (pGC->fillStyle) {
- case FillSolid:
- return TRUE;
- case FillTiled:
- return (igsPatternDimOk (pGC->tile.pixmap->drawable.width) &&
- igsPatternDimOk (pGC->tile.pixmap->drawable.height));
- case FillStippled:
- case FillOpaqueStippled:
- return (igsPatternDimOk (pGC->stipple->drawable.width) &&
- igsPatternDimOk (pGC->stipple->drawable.height));
- }
- return FALSE;
-}
-
-void
-igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- SetupIgs(pDrawable->pScreen);
- DDXPointPtr pptFree;
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
- int *pwidthFree;/* copies of the pointers to free */
- CARD32 cmd;
- int nTmp;
- INT16 x, y;
- int width;
- IgsPattern *p;
-
- if (!igsFillOk (pGC))
- {
- KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
- }
- nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC));
- pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
- pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) DEALLOCATE_LOCAL(pptFree);
- if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
- return;
- }
- n = miClipSpans(fbGetCompositeClip(pGC),
- ppt, pwidth, n,
- pptFree, pwidthFree, fSorted);
- pwidth = pwidthFree;
- ppt = pptFree;
- switch (pGC->fillStyle) {
- case FillSolid:
- _igsSetSolidRect(cop,pGC->alu,pGC->planemask,pGC->fgPixel,cmd);
- break;
- case FillTiled:
- p = igsSetPattern (pDrawable->pScreen,
- pGC->tile.pixmap,
- FillTiled,
- pGC->patOrg.x + pDrawable->x,
- pGC->patOrg.y + pDrawable->y);
- _igsSetTiledRect (cop,pGC->alu,pGC->planemask,p->offset,cmd);
- break;
- default:
- p = igsSetPattern (pDrawable->pScreen,
- pGC->stipple,
- pGC->fillStyle,
- pGC->patOrg.x + pDrawable->x,
- pGC->patOrg.y + pDrawable->y);
- if (pGC->fillStyle == FillStippled)
- {
- _igsSetStippledRect (cop,pGC->alu,pGC->planemask,
- pGC->fgPixel,p->offset,cmd);
- }
- else
- {
- _igsSetOpaqueStippledRect (cop,pGC->alu,pGC->planemask,
- pGC->fgPixel,pGC->bgPixel,p->offset,cmd);
- }
- break;
- }
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ppt++;
- width = *pwidth++;
- if (width)
- {
- _igsPatRect(cop,x,y,width,1,cmd);
- }
- }
- DEALLOCATE_LOCAL(pptFree);
- DEALLOCATE_LOCAL(pwidthFree);
- KdMarkSync (pDrawable->pScreen);
-}
-
-#define NUM_STACK_RECTS 1024
-
-void
-igsPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
- SetupIgs(pDrawable->pScreen);
- xRectangle *prect;
- RegionPtr prgnClip;
- register BoxPtr pbox;
- register BoxPtr pboxClipped;
- BoxPtr pboxClippedBase;
- BoxPtr pextent;
- BoxRec stackRects[NUM_STACK_RECTS];
- FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC);
- int numRects;
- int n;
- int xorg, yorg;
- int x, y;
-
- if (!igsFillOk (pGC))
- {
- KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit);
- return;
- }
- prgnClip = fbGetCompositeClip (pGC);
- 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)xalloc(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)
- {
- switch (pGC->fillStyle) {
- case FillSolid:
- igsFillBoxSolid(pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->fgPixel, pGC->alu, pGC->planemask);
- break;
- case FillTiled:
- igsFillBoxTiled(pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->tile.pixmap,
- pGC->patOrg.x + pDrawable->x,
- pGC->patOrg.y + pDrawable->y,
- pGC->alu);
- break;
- case FillStippled:
- case FillOpaqueStippled:
- igsFillBoxStippled (pDrawable, pGC,
- pboxClipped-pboxClippedBase, pboxClippedBase);
- break;
- }
- }
- if (pboxClippedBase != stackRects)
- xfree(pboxClippedBase);
-}
-
-int
-igsTextInRegion (GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci)
-{
- int w;
- FontPtr pfont = pGC->font;
- BoxRec bbox;
-
- if (FONTCONSTMETRICS(pfont))
- w = FONTMAXBOUNDS(pfont,characterWidth) * nglyph;
- else
- {
- w = 0;
- while (nglyph--)
- w += (*ppci++)->metrics.characterWidth;
- }
- if (w < 0)
- {
- bbox.x1 = x + w;
- bbox.x2 = x;
- }
- else
- {
- bbox.x1 = x;
- bbox.x2 = x + w;
- }
- w = FONTMINBOUNDS(pfont,leftSideBearing);
- if (w < 0)
- bbox.x1 += w;
- w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth);
- if (w > 0)
- bbox.x2 += w;
- bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent);
- bbox.y2 = y + FONTMAXBOUNDS(pfont,descent);
-
- return RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox);
-}
-
-void
-igsGlyphBltClipped (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- Bool image)
-{
- SetupIgs(pDrawable->pScreen);
- CARD32 cmd;
- int h;
- int w;
- int xBack, yBack;
- int hBack, wBack;
- int lw;
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- unsigned long *bits;
- BoxPtr extents;
- BoxRec bbox;
- CARD32 b;
- CharInfoPtr *ppci;
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pBox;
- int nbox;
- int x1, y1, x2, y2;
- unsigned char alu;
- Bool set;
- PixTransDeclare;
-
- if (image)
- {
- xBack = x;
- yBack = y - FONTASCENT(pGC->font);
- wBack = 0;
- hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- if (hBack)
- {
- h = nglyph;
- ppci = ppciInit;
- while (h--)
- wBack += (*ppci++)->metrics.characterWidth;
- }
- if (wBack < 0)
- {
- xBack = xBack + wBack;
- wBack = -wBack;
- }
- if (hBack < 0)
- {
- yBack = yBack + hBack;
- hBack = -hBack;
- }
- alu = GXcopy;
- if (wBack)
- {
- _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd);
- for (nbox = REGION_NUM_RECTS (pClip),
- pBox = REGION_RECTS (pClip);
- nbox--;
- pBox++)
- {
- x1 = xBack;
- x2 = xBack + wBack;
- y1 = yBack;
- y2 = yBack + hBack;
- if (x1 < pBox->x1) x1 = pBox->x1;
- if (x2 > pBox->x2) x2 = pBox->x2;
- if (y1 < pBox->y1) y1 = pBox->y1;
- if (y2 > pBox->y2) y2 = pBox->y2;
- if (x1 < x2 && y1 < y2)
- {
- _igsRect (cop, x1, y1, x2 - x1, y2 - y1, cmd);
- }
- }
- KdMarkSync (pDrawable->pScreen);
- }
- }
- else
- {
- wBack = 0;
- alu = pGC->alu;
- }
-
- ppci = ppciInit;
- set = FALSE;
- while (nglyph--)
- {
- pci = *ppci++;
- h = pci->metrics.ascent + pci->metrics.descent;
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- x1 = x + pci->metrics.leftSideBearing;
- y1 = y - pci->metrics.ascent;
- bbox.x1 = x1;
- bbox.y1 = y1;
- bbox.x2 = x1 + w;
- bbox.y2 = y1 + h;
- switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox))
- {
- case rgnIN:
- lw = h * ((w + 31) >> 5);
- if (lw)
- {
- if (!set)
- {
- _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd);
- set = TRUE;
- }
- _igsPlaneBlt(cop,
- x + pci->metrics.leftSideBearing,
- y - pci->metrics.ascent,
- w, h, cmd);
- bits = (unsigned long *) pci->bits;
- PixTransStart (lw);
- while (lw--)
- {
- b = *bits++;
- IgsAdjustBits32 (b);
- PixTransStore(b);
- }
- KdMarkSync (pDrawable->pScreen);
- }
- break;
- case rgnPART:
- set = FALSE;
- KdCheckSync (pDrawable->pScreen);
- fbPutXYImage (pDrawable,
- pClip,
- fbPriv->fg,
- fbPriv->bg,
- fbPriv->pm,
- alu,
- FALSE,
- x1, y1,
- w, h,
- (FbStip *) pci->bits,
- (w + 31) >> 5,
- 0);
- break;
- case rgnOUT:
- break;
- }
- x += pci->metrics.characterWidth;
- }
-}
-
-void
-igsGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- Bool image)
-{
- SetupIgs(pDrawable->pScreen);
- CARD32 cmd;
- int h;
- int w;
- int xBack, yBack;
- int hBack, wBack;
- int lw;
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- unsigned long *bits;
- BoxPtr extents;
- BoxRec bbox;
- CARD32 b;
- CharInfoPtr *ppci;
- unsigned char alu;
- PixTransDeclare;
-
- /*
- * Paint background for image text
- */
- if (image)
- {
- xBack = x;
- yBack = y - FONTASCENT(pGC->font);
- wBack = 0;
- hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- if (hBack)
- {
- h = nglyph;
- ppci = ppciInit;
- while (h--)
- wBack += (*ppci++)->metrics.characterWidth;
- }
- if (wBack < 0)
- {
- xBack = xBack + wBack;
- wBack = -wBack;
- }
- if (hBack < 0)
- {
- yBack = yBack + hBack;
- hBack = -hBack;
- }
- alu = GXcopy;
- if (wBack)
- {
- _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd);
- _igsRect (cop, xBack, yBack, wBack, hBack, cmd);
- }
- }
- else
- {
- wBack = 0;
- alu = pGC->alu;
- }
-
- _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd);
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- h = pci->metrics.ascent + pci->metrics.descent;
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- lw = h * ((w + 31) >> 5);
- if (lw)
- {
- _igsPlaneBlt(cop,
- x + pci->metrics.leftSideBearing,
- y - pci->metrics.ascent,
- w, h, cmd);
- bits = (unsigned long *) pci->bits;
- PixTransStart(lw);
- while (lw--)
- {
- b = *bits++;
- IgsAdjustBits32 (b);
- PixTransStore(b);
- }
- }
- x += pci->metrics.characterWidth;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-void
-igsTEGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit,
- int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- Bool image)
-{
- SetupIgs(pDrawable->pScreen);
- CARD32 cmd;
- int x, y;
- int h, lw, lwTmp;
- int w;
- FontPtr pfont = pGC->font;
- unsigned long *char1, *char2, *char3, *char4;
- int widthGlyphs, widthGlyph;
- BoxRec bbox;
- CARD32 tmp;
- PixTransDeclare;
-
- widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
- if (!widthGlyph)
- return;
-
- h = FONTASCENT(pfont) + FONTDESCENT(pfont);
- if (!h)
- return;
-
- x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing);
- y = yInit - FONTASCENT(pfont);
-
- if (image)
- {
- _igsSetOpaquePlaneBlt (cop, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel, cmd);
- }
- else
- {
- _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, pGC->fgPixel, cmd);
- }
-
-#if BITMAP_BIT_ORDER == LSBFirst
-#define SHIFT <<
-#else
-#define SHIFT >>
-#endif
-
-#define LoopIt(count, w, loadup, fetch) \
- while (nglyph >= count) \
- { \
- nglyph -= count; \
- _igsPlaneBlt (cop, x, y, w, h, cmd); \
- x += w; \
- loadup \
- lwTmp = h; \
- PixTransStart(h); \
- while (lwTmp--) { \
- tmp = fetch; \
- IgsAdjustBits32(tmp); \
- PixTransStore(tmp); \
- } \
- }
-
- if (widthGlyph <= 8)
- {
- widthGlyphs = widthGlyph << 2;
- LoopIt(4, widthGlyphs,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;
- char4 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | ((*char3++ | (*char4++
- SHIFT widthGlyph))
- SHIFT widthGlyph))
- SHIFT widthGlyph)))
- }
- else if (widthGlyph <= 10)
- {
- widthGlyphs = (widthGlyph << 1) + widthGlyph;
- LoopIt(3, widthGlyphs,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph)))
- }
- else if (widthGlyph <= 16)
- {
- widthGlyphs = widthGlyph << 1;
- LoopIt(2, widthGlyphs,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | (*char2++ SHIFT widthGlyph)))
- }
- lw = h * ((widthGlyph + 31) >> 5);
- while (nglyph--)
- {
- _igsPlaneBlt (cop, x, y, widthGlyph, h, cmd);
- x += widthGlyph;
- char1 = (unsigned long *) (*ppci++)->bits;
- lwTmp = lw;
- PixTransStart(lw);
- while (lwTmp--)
- {
- tmp = *char1++;
- IgsAdjustBits32(tmp);
- PixTransStore(tmp);
- }
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-/*
- * Blt glyphs using image transfer window
- */
-
-void
-igsPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- if (pGC->fillStyle != FillSolid ||
- fbGetGCPrivate(pGC)->pm != FB_ALLONES)
- {
- KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- return;
- }
- x += pDrawable->x;
- y += pDrawable->y;
-
- switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) {
- case rgnIN:
- if (TERMINALFONT(pGC->font))
- igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE);
- else
- igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE);
- break;
- case rgnPART:
- igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, FALSE);
- break;
- case rgnOUT:
- break;
- }
-}
-
-void
-igsImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- if (fbGetGCPrivate(pGC)->pm != FB_ALLONES)
- {
- KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- return;
- }
- x += pDrawable->x;
- y += pDrawable->y;
-
- switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) {
- case rgnIN:
- if (TERMINALFONT(pGC->font))
- igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE);
- else
- igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE);
- break;
- case rgnPART:
- igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, TRUE);
- break;
- case rgnOUT:
- break;
- }
-}
-
-static void
-igsInvalidatePattern (IgsPatternCache *c,
- PixmapPtr pPixmap)
-{
- int i;
-
- if (c->base)
- {
- for (i = 0; i < IGS_NUM_PATTERN; i++)
- {
- if (c->pattern[i].serial_number == pPixmap->drawable.serialNumber)
- c->pattern[i].serial_number = ~0;
- }
- }
-}
-
-static void
-igsInitPattern (IgsPatternCache *c, int bsize, int psize)
-{
- int i;
- int boffset;
- int poffset;
-
- for (i = 0; i < IGS_NUM_PATTERN; i++)
- {
- boffset = i * bsize;
- poffset = i * psize;
- c->pattern[i].xrot = -1;
- c->pattern[i].yrot = -1;
- c->pattern[i].serial_number = ~0;
- c->pattern[i].offset = c->offset + poffset;
- c->pattern[i].base = c->base + boffset;
- }
- c->next = 0;
-}
-
-static const GCOps igsOps = {
- igsFillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- igsCopyArea,
- igsCopyPlane,
- KdCheckPolyPoint,
- KdCheckPolylines,
- KdCheckPolySegment,
- miPolyRectangle,
- KdCheckPolyArc,
- miFillPolygon,
- igsPolyFillRect,
- KdCheckPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- igsImageGlyphBlt,
- igsPolyGlyphBlt,
- igsPushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-void
-igsValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
-
- fbValidateGC (pGC, changes, pDrawable);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- pGC->ops = (GCOps *) &igsOps;
- else
- pGC->ops = (GCOps *) &fbGCOps;
-}
-
-GCFuncs igsGCFuncs = {
- igsValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-int
-igsCreateGC (GCPtr pGC)
-{
- if (!fbCreateGC (pGC))
- return FALSE;
-
- if (pGC->depth != 1)
- pGC->funcs = &igsGCFuncs;
-
- return TRUE;
-}
-
-void
-igsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdScreenPriv(pScreen);
- RegionRec rgnDst;
- int dx, dy;
- WindowPtr pwinRoot;
-
- pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-
- fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- 0,
- &rgnDst, dx, dy, igsCopyNtoN, 0, 0);
-
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-void
-igsPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
-{
- KdScreenPriv(pWin->drawable.pScreen);
- PixmapPtr pTile;
-
- if (!REGION_NUM_RECTS(pRegion))
- return;
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixmap:
- pTile = pWin->background.pixmap;
- if (igsPatternDimOk (pTile->drawable.width) &&
- igsPatternDimOk (pTile->drawable.height))
- {
- igsFillBoxTiled ((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pTile,
- pWin->drawable.x, pWin->drawable.y, GXcopy);
- return;
- }
- break;
- case BackgroundPixel:
- igsFillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->background.pixel, GXcopy, ~0);
- return;
- }
- break;
- case PW_BORDER:
- if (pWin->borderIsPixel)
- {
- igsFillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->border.pixel, GXcopy, ~0);
- return;
- }
- else
- {
- pTile = pWin->border.pixmap;
- if (igsPatternDimOk (pTile->drawable.width) &&
- igsPatternDimOk (pTile->drawable.height))
- {
- igsFillBoxTiled ((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pTile,
- pWin->drawable.x, pWin->drawable.y, GXcopy);
- return;
- }
- }
- break;
- }
- KdCheckPaintWindow (pWin, pRegion, what);
-}
-
-Bool
-igsDrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- igsCardInfo(pScreenPriv);
- igsScreenInfo(pScreenPriv);
- int i;
- int pattern_size;
- int boffset, poffset;
-
- KdScreenInitAsync (pScreen);
-
- /*
- * Replace various fb screen functions
- */
- pScreen->CreateGC = igsCreateGC;
- pScreen->CopyWindow = igsCopyWindow;
- pScreen->PaintWindowBackground = igsPaintWindow;
- pScreen->PaintWindowBorder = igsPaintWindow;
-
- /*
- * Initialize patterns
- */
- if (igss->tile.base)
- {
- pattern_size = IgsTileSize(pScreenPriv->screen->fb[0].bitsPerPixel);
- igsInitPattern (&igss->tile,
- pattern_size,
- pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel);
- pattern_size = IgsStippleSize(pScreenPriv->screen->fb[0].bitsPerPixel);
- igsInitPattern (&igss->stipple,
- pattern_size,
- pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel);
- }
- return TRUE;
-}
-
-void
-igsDrawEnable (ScreenPtr pScreen)
-{
- SetupIgs(pScreen);
- CARD32 cmd;
- CARD32 base;
- CARD16 stride;
- CARD32 format;
-
- stride = pScreenPriv->screen->fb[0].pixelStride;
- _igsWaitIdleEmpty(cop);
- _igsReset(cop);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 8:
- format = IGS_FORMAT_8BPP;
- break;
- case 16:
- format = IGS_FORMAT_16BPP;
- break;
- case 24:
- format = IGS_FORMAT_24BPP;
- break;
- case 32:
- format = IGS_FORMAT_32BPP;
- break;
- }
- cop->format = format;
- cop->dst_stride = stride - 1;
- cop->src1_stride = stride - 1;
- cop->src2_stride = stride - 1;
- cop->src1_start = 0;
- cop->src2_start = 0;
- cop->extension |= IGS_BLOCK_COP_REG | IGS_BURST_ENABLE;
-
- _igsSetSolidRect(cop, GXcopy, ~0, pScreen->blackPixel, cmd);
- _igsRect (cop, 0, 0,
- pScreenPriv->screen->width, pScreenPriv->screen->height,
- cmd);
- _igsWaitIdleEmpty (cop);
-}
-
-void
-igsDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-igsDrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-igsDrawSync (ScreenPtr pScreen)
-{
- SetupIgs(pScreen);
-
- _igsWaitIdleEmpty(cop);
-}
diff --git a/hw/kdrive/igs/igsdraw.h b/hw/kdrive/igs/igsdraw.h
deleted file mode 100644
index c969826b1..000000000
--- a/hw/kdrive/igs/igsdraw.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsdraw.h,v 1.1 2000/05/06 22:17:43 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 _IGSDRAW_H_
-#define _IGSDRAW_H_
-
-extern CARD8 igsPatRop[];
-
-#define SetupIgs(s) KdScreenPriv(s); \
- igsCardInfo(pScreenPriv); \
- Cop5xxx *cop = igsc->cop; \
- int cop_stride = pScreenPriv->screen->fb[0].pixelStride
-
-#define _igsWaitLoop(cop,mask,value) { \
- int __loop = 1000000; \
- while (((cop)->control & (mask)) != (value)) { \
- if (--__loop <= 0) { \
- FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \
- } \
- } \
-}
-
-#define _igsWaitDone(cop) _igsWaitLoop(cop, \
- (IGS_CONTROL_BUSY| \
- IGS_CONTROL_MALLWBEPTZ), \
- 0)
-
-#if 1
-#define _igsWaitFull(cop) _igsWaitLoop(cop, \
- IGS_CONTROL_CMDFF, \
- 0)
-#else
-#define _igsWaitFull(cop) _igsWaitDone(cop)
-#endif
-
-#define _igsWaitIdleEmpty(cop) _igsWaitDone(cop)
-#define _igsWaitHostBltAck(cop) _igsWaitLoop(cop, \
- (IGS_CONTROL_HBACKZ| \
- IGS_CONTROL_CMDFF), \
- 0)
-
-#define _igsReset(cop) ((cop)->control = 0)
-
-#define IgsInvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-#define IgsInvertBits16(v) { \
- v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \
- v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \
- v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \
-}
-
-#define IgsInvertBits8(v) { \
- v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \
- v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \
- v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \
-}
-
-#define IgsByteSwap32(x) ((x) = (((x) >> 24) | \
- (((x) >> 8) & 0xff00) | \
- (((x) << 8) & 0xff0000) | \
- ((x) << 24)))
-
-#define IgsByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8))
-
-#define igsPatternDimOk(d) ((d) <= IGS_PATTERN_WIDTH && (((d) & ((d) - 1)) == 0))
-
-#if BITMAP_BIT_ORDER == LSBFirst
-#define IgsAdjustBits32(b) IgsInvertBits32(b)
-#define IgsAdjustBits16(x) IgsInvertBits16(x)
-#else
-#define IgsAdjustBits32(x) IgsByteSwap32(x)
-#define IgsAdjustBits16(x) IgsByteSwap16(x)
-#endif
-
-#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\
- _igsWaitFull(cop); \
- (cop)->mix = IGS_MAKE_MIX(alu,alu); \
- (cop)->fg = (pix); \
- (cmd) = (IGS_DRAW_T_B | \
- IGS_DRAW_L_R | \
- IGS_DRAW_ALL | \
- IGS_PIXEL_FG | \
- IGS_HBLT_DISABLE | \
- IGS_SRC2_NORMAL | \
- IGS_STEP_PXBLT | \
- IGS_FGS_FG | \
- IGS_BGS_BG); \
-}
-
-#define _igsSetTiledRect(cop,alu,pm,base,cmd) {\
- _igsWaitFull(cop); \
- (cop)->mix = IGS_MAKE_MIX(alu,alu); \
- (cop)->src1_stride = IGS_PATTERN_WIDTH - 1; \
- (cop)->src1_start = (base); \
- (cmd) = (IGS_DRAW_T_B | \
- IGS_DRAW_L_R | \
- IGS_DRAW_ALL | \
- IGS_PIXEL_TILE | \
- IGS_HBLT_DISABLE | \
- IGS_SRC2_NORMAL | \
- IGS_STEP_PXBLT | \
- IGS_FGS_SRC | \
- IGS_BGS_BG); \
-}
-
-#define _igsSetStippledRect(cop,alu,pm,pix,base,cmd) {\
- _igsWaitFull(cop); \
- (cop)->mix = IGS_MAKE_MIX(alu,alu); \
- (cop)->src1_start = (base); \
- (cop)->fg = (pix); \
- (cmd) = (IGS_DRAW_T_B | \
- IGS_DRAW_L_R | \
- IGS_DRAW_ALL | \
- IGS_PIXEL_STIP_TRANS | \
- IGS_HBLT_DISABLE | \
- IGS_SRC2_NORMAL | \
- IGS_STEP_PXBLT | \
- IGS_FGS_FG | \
- IGS_BGS_BG); \
-}
-
-#define _igsSetOpaqueStippledRect(cop,alu,pm,_fg,_bg,base,cmd) {\
- _igsWaitFull(cop); \
- (cop)->mix = IGS_MAKE_MIX(alu,alu); \
- (cop)->src1_start = (base); \
- (cop)->fg = (_fg); \
- (cop)->bg = (_bg); \
- (cmd) = (IGS_DRAW_T_B | \
- IGS_DRAW_L_R | \
- IGS_DRAW_ALL | \
- IGS_PIXEL_STIP_OPAQUE | \
- IGS_HBLT_DISABLE | \
- IGS_SRC2_NORMAL | \
- IGS_STEP_PXBLT | \
- IGS_FGS_FG | \
- IGS_BGS_BG); \
-}
-
-#define _igsRect(cop,x,y,w,h,cmd) { \
- _igsWaitFull(cop); \
- (cop)->dst_start = (x) + (y) * (cop_stride); \
- (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
- (cop)->operation = (cmd); \
-}
-
-#define _igsPatRect(cop,x,y,w,h,cmd) { \
- _igsWaitFull(cop); \
- (cop)->dst_start = (x) + (y) * (cop_stride); \
- (cop)->rotate = IGS_MAKE_ROTATE(x&7,y&7); \
- (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
- (cop)->operation = (cmd); \
-}
-
-#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \
- _igsWaitFull(cop); \
- (cop)->mix = IGS_MAKE_MIX(alu,alu); \
- (cop)->src1_stride = cop_stride - 1; \
- (cmd) = (IGS_DRAW_ALL | \
- IGS_PIXEL_FG | \
- IGS_HBLT_DISABLE | \
- IGS_SRC2_NORMAL | \
- IGS_STEP_PXBLT | \
- IGS_FGS_SRC | \
- IGS_BGS_BG); \
- if (backwards) (cmd) |= IGS_DRAW_R_L; \
- if (upsidedown) (cmd) |= IGS_DRAW_B_T; \
-}
-
-#if 0
-#define _igsPreparePlaneBlt(cop) { \
- _igsReset(cop); \
- (cop)->dst_stride = cop_stride - 1; \
- (cop)->src1_stride = cop_stride - 1; \
- (cop)->src2_stride = cop_stride - 1; \
- (cop)->format = IGS_FORMAT_16BPP; \
- (cop)->src1_start = 0; \
- (cop)->src2_start = 0; \
-}
-#else
-#define _igsPreparePlaneBlt(cop)
-#endif
-
-#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \
- _igsWaitIdleEmpty(cop); \
- _igsPreparePlaneBlt(cop); \
- (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
- (cop)->fg = (fg_pix); \
- (cmd) = (IGS_DRAW_T_B | \
- IGS_DRAW_L_R | \
- IGS_DRAW_ALL | \
- IGS_PIXEL_FG | \
- IGS_HBLT_WRITE_2 | \
- IGS_SRC2_MONO_TRANS | \
- IGS_STEP_TERNARY_PXBLT | \
- IGS_FGS_FG | \
- IGS_BGS_BG); \
-}
-
-#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \
- _igsWaitIdleEmpty(cop); \
- _igsPreparePlaneBlt(cop); \
- (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
- (cop)->fg = (fg_pix); \
- (cop)->bg = (bg_pix); \
- (cmd) = (IGS_DRAW_T_B | \
- IGS_DRAW_L_R | \
- IGS_DRAW_ALL | \
- IGS_PIXEL_FG | \
- IGS_HBLT_WRITE_2 | \
- IGS_SRC2_MONO_OPAQUE | \
- IGS_STEP_TERNARY_PXBLT | \
- IGS_FGS_FG | \
- IGS_BGS_BG); \
-}
-
-#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \
-/* _igsWaitFull(cop); */ \
- (cop)->dst_start = (x) + (y) * (cop_stride); \
- (cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \
- (cop)->operation = (cmd); \
-/* _igsWaitHostBltAck(cop); */ \
-}
-
-#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \
- _igsWaitFull(cop); \
- (cop)->dst_start = (dx) + (dy) * cop_stride; \
- (cop)->src1_start = (sx) + (sy) * cop_stride; \
- (cop)->src1_stride = cop_stride - 1; \
- (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
- (cop)->operation = (cmd); \
-}
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-#endif
diff --git a/hw/kdrive/igs/igsreg.c b/hw/kdrive/igs/igsreg.c
deleted file mode 100644
index d63fce035..000000000
--- a/hw/kdrive/igs/igsreg.c
+++ /dev/null
@@ -1,971 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "igsreg.h"
-#include <stdio.h>
-
-#define CR00 IGS_CR+0x00
-#define CR01 IGS_CR+0x01
-#define CR02 IGS_CR+0x02
-#define CR03 IGS_CR+0x03
-#define CR04 IGS_CR+0x04
-#define CR05 IGS_CR+0x05
-#define CR06 IGS_CR+0x06
-#define CR07 IGS_CR+0x07
-#define CR08 IGS_CR+0x08
-#define CR09 IGS_CR+0x09
-#define CR0A IGS_CR+0x0A
-#define CR0B IGS_CR+0x0B
-#define CR0C IGS_CR+0x0C
-#define CR0D IGS_CR+0x0D
-#define CR0E IGS_CR+0x0E
-#define CR0F IGS_CR+0x0F
-#define CR10 IGS_CR+0x10
-#define CR11 IGS_CR+0x11
-#define CR12 IGS_CR+0x12
-#define CR13 IGS_CR+0x13
-#define CR14 IGS_CR+0x14
-#define CR15 IGS_CR+0x15
-#define CR16 IGS_CR+0x16
-#define CR17 IGS_CR+0x17
-#define CR18 IGS_CR+0x18
-#define CR19 IGS_CR+0x19
-#define CR1A IGS_CR+0x1A
-#define CR1B IGS_CR+0x1B
-#define CR1C IGS_CR+0x1C
-#define CR1D IGS_CR+0x1D
-#define CR1E IGS_CR+0x1E
-#define CR1F IGS_CR+0x1F
-#define CR20 IGS_CR+0x20
-#define CR21 IGS_CR+0x21
-#define CR22 IGS_CR+0x22
-#define CR23 IGS_CR+0x23
-#define CR24 IGS_CR+0x24
-#define CR25 IGS_CR+0x25
-#define CR26 IGS_CR+0x26
-#define CR27 IGS_CR+0x27
-#define CR28 IGS_CR+0x28
-#define CR29 IGS_CR+0x29
-#define CR2A IGS_CR+0x2A
-#define CR2B IGS_CR+0x2B
-#define CR2C IGS_CR+0x2C
-#define CR2D IGS_CR+0x2D
-#define CR2E IGS_CR+0x2E
-#define CR2F IGS_CR+0x2F
-#define CR30 IGS_CR+0x30
-#define CR31 IGS_CR+0x31
-#define CR32 IGS_CR+0x32
-#define CR33 IGS_CR+0x33
-#define CR34 IGS_CR+0x34
-#define CR35 IGS_CR+0x35
-#define CR36 IGS_CR+0x36
-#define CR37 IGS_CR+0x37
-#define CR38 IGS_CR+0x38
-#define CR39 IGS_CR+0x39
-#define CR3A IGS_CR+0x3A
-#define CR3B IGS_CR+0x3B
-#define CR3C IGS_CR+0x3C
-#define CR3D IGS_CR+0x3D
-#define CR3E IGS_CR+0x3E
-#define CR3F IGS_CR+0x3F
-#define CR40 IGS_CR+0x40
-#define CR41 IGS_CR+0x41
-#define CR42 IGS_CR+0x42
-#define CR43 IGS_CR+0x43
-#define CR44 IGS_CR+0x44
-#define CR45 IGS_CR+0x45
-#define CR46 IGS_CR+0x46
-#define CR47 IGS_CR+0x47
-#define CR48 IGS_CR+0x48
-
-#define CR_FIRST CR00
-#define CR_LAST CR48
-
-#define SR00 IGS_SR+0x00
-#define SR01 IGS_SR+0x01
-#define SR02 IGS_SR+0x02
-#define SR03 IGS_SR+0x03
-#define SR04 IGS_SR+0x04
-
-#define SR_FIRST SR00
-#define SR_LAST SR04
-
-#define AR00 IGS_AR+0x00
-#define AR01 IGS_AR+0x01
-#define AR02 IGS_AR+0x02
-#define AR03 IGS_AR+0x03
-#define AR04 IGS_AR+0x04
-#define AR05 IGS_AR+0x05
-#define AR06 IGS_AR+0x06
-#define AR07 IGS_AR+0x07
-#define AR08 IGS_AR+0x08
-#define AR09 IGS_AR+0x09
-#define AR0A IGS_AR+0x0A
-#define AR0B IGS_AR+0x0B
-#define AR0C IGS_AR+0x0C
-#define AR0D IGS_AR+0x0D
-#define AR0E IGS_AR+0x0E
-#define AR0F IGS_AR+0x0F
-#define AR10 IGS_AR+0x10
-#define AR11 IGS_AR+0x11
-#define AR12 IGS_AR+0x12
-#define AR13 IGS_AR+0x13
-#define AR14 IGS_AR+0x14
-
-#define AR_FIRST AR00
-#define AR_LAST AR14
-
-#define GR00 IGS_GR+0x00
-#define GR01 IGS_GR+0x01
-#define GR02 IGS_GR+0x02
-#define GR03 IGS_GR+0x03
-#define GR04 IGS_GR+0x04
-#define GR05 IGS_GR+0x05
-#define GR06 IGS_GR+0x06
-#define GR07 IGS_GR+0x07
-#define GR08 IGS_GR+0x08
-#define GR09 IGS_GR+0x09
-#define GR0A IGS_GR+0x0A
-#define GR0B IGS_GR+0x0B
-#define GR0C IGS_GR+0x0C
-#define GR0D IGS_GR+0x0D
-#define GR0E IGS_GR+0x0E
-#define GR0F IGS_GR+0x0F
-#define GR10 IGS_GR+0x10
-#define GR11 IGS_GR+0x11
-#define GR12 IGS_GR+0x12
-#define GR13 IGS_GR+0x13
-#define GR14 IGS_GR+0x14
-#define GR15 IGS_GR+0x15
-#define GR16 IGS_GR+0x16
-#define GR17 IGS_GR+0x17
-#define GR18 IGS_GR+0x18
-#define GR19 IGS_GR+0x19
-#define GR1A IGS_GR+0x1A
-#define GR1B IGS_GR+0x1B
-#define GR1C IGS_GR+0x1C
-#define GR1D IGS_GR+0x1D
-#define GR1E IGS_GR+0x1E
-#define GR1F IGS_GR+0x1F
-#define GR20 IGS_GR+0x20
-#define GR21 IGS_GR+0x21
-#define GR22 IGS_GR+0x22
-#define GR23 IGS_GR+0x23
-#define GR24 IGS_GR+0x24
-#define GR25 IGS_GR+0x25
-#define GR26 IGS_GR+0x26
-#define GR27 IGS_GR+0x27
-#define GR28 IGS_GR+0x28
-#define GR29 IGS_GR+0x29
-#define GR2A IGS_GR+0x2A
-#define GR2B IGS_GR+0x2B
-#define GR2C IGS_GR+0x2C
-#define GR2D IGS_GR+0x2D
-#define GR2E IGS_GR+0x2E
-#define GR2F IGS_GR+0x2F
-#define GR30 IGS_GR+0x30
-#define GR31 IGS_GR+0x31
-#define GR32 IGS_GR+0x32
-#define GR33 IGS_GR+0x33
-#define GR34 IGS_GR+0x34
-#define GR35 IGS_GR+0x35
-#define GR36 IGS_GR+0x36
-#define GR37 IGS_GR+0x37
-#define GR38 IGS_GR+0x38
-#define GR39 IGS_GR+0x39
-#define GR3A IGS_GR+0x3A
-#define GR3B IGS_GR+0x3B
-#define GR3C IGS_GR+0x3C
-#define GR3D IGS_GR+0x3D
-#define GR3E IGS_GR+0x3E
-#define GR3F IGS_GR+0x3F
-#define GR40 IGS_GR+0x40
-#define GR41 IGS_GR+0x41
-#define GR42 IGS_GR+0x42
-#define GR43 IGS_GR+0x43
-#define GR44 IGS_GR+0x44
-#define GR45 IGS_GR+0x45
-#define GR46 IGS_GR+0x46
-#define GR47 IGS_GR+0x47
-#define GR48 IGS_GR+0x48
-#define GR49 IGS_GR+0x49
-#define GR4A IGS_GR+0x4A
-#define GR4B IGS_GR+0x4B
-#define GR4C IGS_GR+0x4C
-#define GR4D IGS_GR+0x4D
-#define GR4E IGS_GR+0x4E
-#define GR4F IGS_GR+0x4F
-#define GR50 IGS_GR+0x50
-#define GR51 IGS_GR+0x51
-#define GR52 IGS_GR+0x52
-#define GR53 IGS_GR+0x53
-#define GR54 IGS_GR+0x54
-#define GR55 IGS_GR+0x55
-#define GR56 IGS_GR+0x56
-#define GR57 IGS_GR+0x57
-#define GR58 IGS_GR+0x58
-#define GR59 IGS_GR+0x59
-#define GR5A IGS_GR+0x5A
-#define GR5B IGS_GR+0x5B
-#define GR5C IGS_GR+0x5C
-#define GR5D IGS_GR+0x5D
-#define GR5E IGS_GR+0x5E
-#define GR5F IGS_GR+0x5F
-#define GR60 IGS_GR+0x60
-#define GR61 IGS_GR+0x61
-#define GR62 IGS_GR+0x62
-#define GR63 IGS_GR+0x63
-#define GR64 IGS_GR+0x64
-#define GR65 IGS_GR+0x65
-#define GR66 IGS_GR+0x66
-#define GR67 IGS_GR+0x67
-#define GR68 IGS_GR+0x68
-#define GR69 IGS_GR+0x69
-#define GR6A IGS_GR+0x6A
-#define GR6B IGS_GR+0x6B
-#define GR6C IGS_GR+0x6C
-#define GR6D IGS_GR+0x6D
-#define GR6E IGS_GR+0x6E
-#define GR6F IGS_GR+0x6F
-#define GR70 IGS_GR+0x70
-#define GR71 IGS_GR+0x71
-#define GR72 IGS_GR+0x72
-#define GR73 IGS_GR+0x73
-#define GR74 IGS_GR+0x74
-#define GR75 IGS_GR+0x75
-#define GR76 IGS_GR+0x76
-#define GR77 IGS_GR+0x77
-#define GR78 IGS_GR+0x78
-#define GR79 IGS_GR+0x79
-#define GR7A IGS_GR+0x7A
-#define GR7B IGS_GR+0x7B
-#define GR7C IGS_GR+0x7C
-#define GR7D IGS_GR+0x7D
-#define GR7E IGS_GR+0x7E
-#define GR7F IGS_GR+0x7F
-#define GR80 IGS_GR+0x80
-#define GR81 IGS_GR+0x81
-#define GR82 IGS_GR+0x82
-#define GR83 IGS_GR+0x83
-#define GR84 IGS_GR+0x84
-#define GR85 IGS_GR+0x85
-#define GR86 IGS_GR+0x86
-#define GR87 IGS_GR+0x87
-#define GR88 IGS_GR+0x88
-#define GR89 IGS_GR+0x89
-#define GR8A IGS_GR+0x8A
-#define GR8B IGS_GR+0x8B
-#define GR8C IGS_GR+0x8C
-#define GR8D IGS_GR+0x8D
-#define GR8E IGS_GR+0x8E
-#define GR8F IGS_GR+0x8F
-#define GR90 IGS_GR+0x90
-#define GR91 IGS_GR+0x91
-#define GR92 IGS_GR+0x92
-#define GR93 IGS_GR+0x93
-#define GR94 IGS_GR+0x94
-#define GR95 IGS_GR+0x95
-#define GR96 IGS_GR+0x96
-#define GR97 IGS_GR+0x97
-#define GR98 IGS_GR+0x98
-#define GR99 IGS_GR+0x99
-#define GR9A IGS_GR+0x9A
-#define GR9B IGS_GR+0x9B
-#define GR9C IGS_GR+0x9C
-#define GR9D IGS_GR+0x9D
-#define GR9E IGS_GR+0x9E
-#define GR9F IGS_GR+0x9F
-#define GRA0 IGS_GR+0xA0
-#define GRA1 IGS_GR+0xA1
-#define GRA2 IGS_GR+0xA2
-#define GRA3 IGS_GR+0xA3
-#define GRA4 IGS_GR+0xA4
-#define GRA5 IGS_GR+0xA5
-#define GRA6 IGS_GR+0xA6
-#define GRA7 IGS_GR+0xA7
-#define GRA8 IGS_GR+0xA8
-#define GRA9 IGS_GR+0xA9
-#define GRAA IGS_GR+0xAA
-#define GRAB IGS_GR+0xAB
-#define GRAC IGS_GR+0xAC
-#define GRAD IGS_GR+0xAD
-#define GRAE IGS_GR+0xAE
-#define GRAF IGS_GR+0xAF
-#define GRB0 IGS_GR+0xB0
-#define GRB1 IGS_GR+0xB1
-#define GRB2 IGS_GR+0xB2
-#define GRB3 IGS_GR+0xB3
-#define GRB4 IGS_GR+0xB4
-#define GRB5 IGS_GR+0xB5
-#define GRB6 IGS_GR+0xB6
-#define GRB7 IGS_GR+0xB7
-#define GRB8 IGS_GR+0xB8
-#define GRB9 IGS_GR+0xB9
-#define GRBA IGS_GR+0xBA
-#define GRBB IGS_GR+0xBB
-#define GRBC IGS_GR+0xBC
-#define GRBD IGS_GR+0xBD
-#define GRBE IGS_GR+0xBE
-#define GRBF IGS_GR+0xBF
-
-#define GR_FIRST GR00
-#define GR_LAST GRBF
-
-#define GREX3C IGS_GREX+(0x3c-IGS_GREXBASE)
-
-VgaReg igs_h_total[] = {
- CR00, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_h_de_end[] = {
- CR01, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_h_bstart[] = {
- CR02, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_h_bend[] = {
- CR03, 0, 5,
- CR05, 7, 1,
- VGA_REG_END
-};
-
-VgaReg igs_de_skew[] = {
- CR03, 5, 2,
- VGA_REG_END
-};
-
-VgaReg igs_ena_vr_access[] = {
- CR03, 7, 1,
- VGA_REG_END
-};
-
-VgaReg igs_h_rstart[] = {
- CR04, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_h_rend[] = {
- CR05, 0, 5,
- VGA_REG_END
-};
-
-VgaReg igs_h_rdelay[] = {
- CR05, 5, 2,
- VGA_REG_END
-};
-
-VgaReg igs_v_total[] = {
- CR06, 0, 8,
- CR07, 0, 1,
- CR07, 5, 1,
- GR11, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_v_rstart[] = {
- CR10, 0, 8,
- CR07, 2, 1,
- CR07, 7, 1,
- GR11, 2, 1,
- VGA_REG_END
-};
-
-VgaReg igs_v_rend[] = {
- CR11, 0, 4,
- VGA_REG_END
-};
-
-VgaReg igs_clear_v_int[] = {
- CR11, 4, 1,
- VGA_REG_END
-};
-
-VgaReg igs_disable_v_int[] = {
- CR11, 5, 1,
- VGA_REG_END
-};
-
-VgaReg igs_bandwidth[] = {
- CR11, 6, 1,
- VGA_REG_END
-};
-
-VgaReg igs_crt_protect[] = {
- CR11, 7, 1,
- VGA_REG_END
-};
-
-VgaReg igs_v_de_end[] = {
- CR12, 0, 8,
- CR07, 1, 1,
- CR07, 6, 1,
- GR11, 1, 1,
- VGA_REG_END
-};
-
-VgaReg igs_offset[] = {
- CR13, 0, 8,
- GR15, 4, 2,
- VGA_REG_END
-};
-
-VgaReg igs_v_bstart[] = {
- CR15, 0, 8,
- CR07, 3, 1,
- CR09, 5, 1,
- GR11, 3, 1,
- VGA_REG_END
-};
-
-VgaReg igs_v_bend[] = {
- CR16, 0, 7,
- VGA_REG_END
-};
-
-VgaReg igs_linecomp[] = {
- CR18, 0, 8,
- CR07, 4, 1,
- CR09, 6, 1,
- GR11, 4, 1,
- VGA_REG_END
-};
-
-VgaReg igs_ivideo[] = {
- GR11, 5, 1,
- VGA_REG_END
-};
-
-VgaReg igs_num_fetch[] = {
- GR14, 0, 8,
- GR15, 0, 2,
- VGA_REG_END
-};
-
-VgaReg igs_wcrt0[] = {
- CR1F, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_wcrt1[] = {
- CR1F, 1, 1,
- VGA_REG_END
-};
-
-VgaReg igs_rcrts1[] = {
- CR1F, 4, 1,
- VGA_REG_END
-};
-
-VgaReg igs_selwk[] = {
- CR1F, 6, 1,
- VGA_REG_END
-};
-
-VgaReg igs_dot_clock_8[] = {
- SR01, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_screen_off[] = {
- SR01, 5, 1,
- VGA_REG_END
-};
-
-VgaReg igs_enable_write_plane[] = {
- SR02, 0, 4,
- VGA_REG_END
-};
-
-VgaReg igs_mexhsyn[] = {
- GR16, 0, 2,
- VGA_REG_END
-};
-
-VgaReg igs_mexvsyn[] = {
- GR16, 2, 2,
- VGA_REG_END
-};
-
-VgaReg igs_pci_burst_write[] = {
- GR30, 5, 1,
- VGA_REG_END
-};
-
-VgaReg igs_pci_burst_read[] = {
- GR30, 7, 1,
- VGA_REG_END
-};
-
-VgaReg igs_iow_retry[] = {
- GREX3C, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_mw_retry[] = {
- GREX3C, 1, 1,
- VGA_REG_END
-};
-
-VgaReg igs_mr_retry[] = {
- GREX3C, 2, 1,
- VGA_REG_END
-};
-
-
-
-VgaReg igs_biga22en[] = {
- GR3D, 4, 1,
- VGA_REG_END
-};
-
-VgaReg igs_biga24en[] = {
- GR3D, 5, 1,
- VGA_REG_END
-};
-
-VgaReg igs_biga22force[] = {
- GR3D, 6, 1,
- VGA_REG_END
-};
-
-VgaReg igs_bigswap[] = {
- GR3F, 0, 6,
- VGA_REG_END
-};
-
-/* #define IGS_BIGSWAP_8 0x3f */
-/* #define IGS_BIGSWAP_16 0x2a */
-/* #define IGS_BIGSWAP_32 0x00 */
-
-VgaReg igs_sprite_x[] = {
- GR50, 0, 8,
- GR51, 0, 3,
- VGA_REG_END
-};
-
-VgaReg igs_sprite_preset_x[] = {
- GR52, 0, 6,
- VGA_REG_END
-};
-
-VgaReg igs_sprite_y[] = {
- GR53, 0, 8,
- GR54, 0, 3,
- VGA_REG_END
-};
-
-VgaReg igs_sprite_preset_y[] = {
- GR55, 0, 6,
- VGA_REG_END
-};
-
-VgaReg igs_sprite_visible[] = {
- GR56, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_sprite_64x64[] = {
- GR56, 1, 1,
- VGA_REG_END
-};
-
-VgaReg igs_mgrext[] = {
- GR57, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_hcshf[] = {
- GR57, 4, 2,
- VGA_REG_END
-};
-
-VgaReg igs_mbpfix[] = {
- GR57, 6, 2,
- VGA_REG_END
-};
-
-VgaReg igs_overscan_red[] = {
- GR58, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_overscan_green[] = {
- GR59, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_overscan_blue[] = {
- GR5A, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_memgopg[] = {
- GR73, 2, 1,
- VGA_REG_END
-};
-
-VgaReg igs_memr2wpg[] = {
- GR73, 1, 1,
- VGA_REG_END
-};
-
-VgaReg igs_crtff16[] = {
- GR73, 3, 1,
- VGA_REG_END
-};
-
-VgaReg igs_fifomust[] = {
- GR74, 0, 5,
- VGA_REG_END
-};
-
-VgaReg igs_fifogen[] = {
- GR75, 0, 5,
- VGA_REG_END
-};
-
-VgaReg igs_mode_sel[] = {
- GR77, 0, 4,
- VGA_REG_END
-};
-
-/* #define IGS_MODE_TEXT 0 */
-/* #define IGS_MODE_8 1 */
-/* #define IGS_MODE_565 2 */
-/* #define IGS_MODE_5551 6 */
-/* #define IGS_MODE_8888 3 */
-/* #define IGS_MODE_888 4 */
-/* #define IGS_MODE_332 9 */
-/* #define IGS_MODE_4444 10 */
-
-VgaReg igs_sprite_addr[] = {
- GR7E, 0, 8,
- GR7F, 0, 4,
- VGA_REG_END
-};
-
-VgaReg igs_fastmpie[] = {
- GR9E, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_vclk_m[] = {
- GRB0, 0, 8,
- GRBA, 0, 3,
- VGA_REG_END
-};
-
-VgaReg igs_vclk_n[] = {
- GRB1, 0, 5,
- GRBA, 3, 3,
- VGA_REG_END
-};
-
-VgaReg igs_vfsel[] = {
- GRB1, 5, 1,
- VGA_REG_END
-};
-
-VgaReg igs_vclk_p[] = {
- GRB1, 6, 2,
- GRBA, 6, 1,
- VGA_REG_END
-};
-
-VgaReg igs_frqlat[] = {
- GRB9, 7, 1,
- VGA_REG_END
-};
-
-
-VgaReg igs_dac_mask[] = {
- IGS_DAC + 0, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_dac_read_index[] = {
- IGS_DAC + 1, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_dac_write_index[] = {
- IGS_DAC + 2, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_dac_data[] = {
- IGS_DAC + 3, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_rampwdn[] = {
- IGS_DACEX + 0, 0, 1,
- VGA_REG_END
-};
-
-VgaReg igs_dac6_8[] = {
- IGS_DACEX + 0, 1, 1,
- VGA_REG_END
-};
-
-VgaReg igs_ramdacbypass[] = {
- IGS_DACEX + 0, 4, 1,
- VGA_REG_END
-};
-
-VgaReg igs_dacpwdn[] = {
- IGS_DACEX + 0, 6, 1,
- VGA_REG_END
-};
-
-VgaReg igs_cursor_read_index[] = {
- IGS_DACEX + 1, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_cursor_write_index[] = {
- IGS_DACEX + 2, 0, 8,
- VGA_REG_END
-};
-
-VgaReg igs_cursor_data[] = {
- IGS_DACEX + 3, 0, 8,
- VGA_REG_END
-};
-
-VGA8
-_igsInb (VgaCard *card, VGA16 port)
-{
- VGAVOL8 *reg;
-
- if (card->closure)
- return VgaReadMemb ((VGA32) card->closure + port);
- else
- return VgaInb (port);
-}
-
-void
-_igsOutb (VgaCard *card, VGA8 value, VGA16 port)
-{
- if (card->closure)
- VgaWriteMemb (value, (VGA32) card->closure + port);
- else
- VgaOutb (value, port);
-}
-
-void
-_igsRegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write)
-{
- if (reg < IGS_SR + IGS_NSR)
- {
- map->access = VgaAccessIndIo;
- map->port = 0x3c4;
- map->addr = 0;
- map->value = 1;
- map->index = reg - IGS_SR;
- }
- else if (reg < IGS_GR + IGS_NGR)
- {
- map->access = VgaAccessIndIo;
- map->port = 0x3ce;
- map->addr = 0;
- map->value = 1;
- map->index = reg - IGS_GR;
- }
- else if (reg < IGS_GREX + IGS_NGREX)
- {
- VGA8 gr33;
-
- map->access = VgaAccessDone;
- _igsOutb (card, 0x33, 0x3ce);
- gr33 = _igsInb (card, 0x3cf);
- _igsOutb (card, gr33 | 0x40, 0x3cf);
- _igsOutb (card, IGS_GREXBASE + reg - IGS_GREX, 0x3ce);
- if (write)
- _igsOutb (card, map->value, 0x3cf);
- else
- map->value = _igsInb (card, 0x3cf);
- _igsOutb (card, 0x33, 0x3ce);
- _igsOutb (card, gr33, 0x3cf);
- return;
- }
- else if (reg < IGS_AR + IGS_NAR)
- {
- reg -= IGS_AR;
- map->access = VgaAccessDone;
- /* reset AFF to index */
- (void) _igsInb (card, 0x3da);
- if (reg >= 16)
- reg |= 0x20;
- _igsOutb (card, reg, 0x3c0);
- if (write)
- _igsOutb (card, map->value, 0x3c0);
- else
- map->value = _igsInb (card, 0x3c1);
- if (!(reg & 0x20))
- {
- /* enable video display again */
- (void) _igsInb (card, 0x3da);
- _igsOutb (card, 0x20, 0x3c0);
- }
- return;
- }
- else if (reg < IGS_CR + IGS_NCR)
- {
- map->access = VgaAccessIndIo;
- map->port = 0x3d4;
- map->addr = 0;
- map->value = 1;
- map->index = reg - IGS_CR;
- }
- else if (reg < IGS_DAC + IGS_NDAC)
- {
- map->access = VgaAccessIo;
- map->port = 0x3c6 + reg - IGS_DAC;
- }
- else if (reg < IGS_DACEX + IGS_NDACEX)
- {
- VGA8 gr56;
- reg = 0x3c6 + reg - IGS_DACEX;
- map->access = VgaAccessDone;
- _igsOutb (card, 0x56, 0x3ce);
- gr56 = _igsInb (card, 0x3cf);
- _igsOutb (card, gr56 | 4, 0x3cf);
- if (write)
- _igsOutb (card, map->value, reg);
- else
- map->value = _igsInb (card, reg);
- _igsOutb (card, gr56, 0x3cf);
- return;
- }
- else switch (reg) {
- case IGS_MISC_OUT:
- map->access = VgaAccessIo;
- if (write)
- map->port = 0x3c2;
- else
- map->port = 0x3cc;
- break;
- case IGS_INPUT_STATUS_1:
- map->access = VgaAccessIo;
- map->port = 0x3da;
- break;
- }
- if (card->closure)
- {
- map->port = map->port + (VGA32) card->closure;
- if (map->access == VgaAccessIo)
- map->access = VgaAccessMem;
- if (map->access == VgaAccessIndIo)
- map->access = VgaAccessIndMem;
- }
-}
-
-VgaSave igsSaves[] = {
- CR00, CR18,
- SR01, SR02,
- GR11, GRBA,
- IGS_MISC_OUT, IGS_MISC_OUT,
- VGA_SAVE_END
-};
-
-void
-igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio)
-{
- igsvga->card.map = _igsRegMap;
- igsvga->card.closure = (void *) mmio;
- igsvga->card.max = IGS_NREG;
- igsvga->card.values = igsvga->values;
- igsvga->card.saves = igsSaves;
-}
-
-void
-igsSave (IgsVga *igsvga)
-{
- igsSetImm (igsvga, igs_wcrt0, 1);
- igsSetImm (igsvga, igs_wcrt1, 1);
- igsSetImm (igsvga, igs_rcrts1, 1);
- igsSetImm (igsvga, igs_selwk, 1);
- VgaPreserve (&igsvga->card);
-}
-
-void
-igsReset (IgsVga *igsvga)
-{
- VgaRestore (&igsvga->card);
- igsSetImm (igsvga, igs_frqlat, 0);
- igsSetImm (igsvga, igs_frqlat, 1);
- igsSetImm (igsvga, igs_frqlat, 0);
- VgaFinish (&igsvga->card);
-}
-
-char *
-igsRegName(char *buf, VGA16 reg)
-{
- if (reg < IGS_SR + IGS_NSR)
- {
- sprintf (buf, " SR%02X", reg - IGS_SR);
- }
- else if (reg < IGS_GR + IGS_NGR)
- {
- sprintf (buf, " GR%02X", reg - IGS_GR);
- }
- else if (reg < IGS_GREX + IGS_NGREX)
- {
- sprintf (buf, " GRX%02X", reg - IGS_GREX + IGS_GREXBASE);
- }
- else if (reg < IGS_AR + IGS_NAR)
- {
- sprintf (buf, " AR%02X", reg - IGS_AR);
- }
- else if (reg < IGS_CR + IGS_NCR)
- {
- sprintf (buf, " CR%02X", reg - IGS_CR);
- }
- else if (reg < IGS_DAC + IGS_NDAC)
- {
- sprintf (buf, " DAC%02X", reg - IGS_DAC);
- }
- else if (reg < IGS_DACEX + IGS_NDACEX)
- {
- sprintf (buf, "DACX%02X", reg - IGS_DACEX);
- }
- else switch (reg) {
- case IGS_MISC_OUT:
- sprintf (buf, "MISC_O");
- break;
- case IGS_INPUT_STATUS_1:
- sprintf (buf, "IN_S_1");
- break;
- }
- return buf;
-}
diff --git a/hw/kdrive/igs/igsreg.h b/hw/kdrive/igs/igsreg.h
deleted file mode 100644
index ddccd8907..000000000
--- a/hw/kdrive/igs/igsreg.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 _IGSREG_H_
-#define _IGSREG_H_
-
-#include "vga.h"
-
-#define IGS_SR 0
-#define IGS_NSR 5
-#define IGS_GR (IGS_SR+IGS_NSR)
-#define IGS_NGR 0xC0
-#define IGS_GREX (IGS_GR+IGS_NGR)
-#define IGS_GREXBASE 0x3c
-#define IGS_NGREX 1
-#define IGS_AR (IGS_GREX+IGS_NGREX)
-#define IGS_NAR 0x15
-#define IGS_CR (IGS_AR+IGS_NAR)
-#define IGS_NCR 0x48
-#define IGS_DAC (IGS_CR+IGS_NCR)
-#define IGS_NDAC 4
-#define IGS_DACEX (IGS_DAC+IGS_NDAC)
-#define IGS_NDACEX 4
-#define IGS_MISC_OUT (IGS_DACEX + IGS_NDACEX)
-#define IGS_INPUT_STATUS_1 (IGS_MISC_OUT+1)
-#define IGS_NREG (IGS_INPUT_STATUS_1+1)
-
-extern VgaReg igs_h_total[];
-extern VgaReg igs_h_de_end[];
-extern VgaReg igs_h_bstart[];
-extern VgaReg igs_h_bend[];
-extern VgaReg igs_de_skew[];
-extern VgaReg igs_ena_vr_access[];
-extern VgaReg igs_h_rstart[];
-extern VgaReg igs_h_rend[];
-extern VgaReg igs_h_rdelay[];
-extern VgaReg igs_v_total[];
-extern VgaReg igs_v_rstart[];
-extern VgaReg igs_v_rend[];
-extern VgaReg igs_clear_v_int[];
-extern VgaReg igs_disable_v_int[];
-extern VgaReg igs_bandwidth[];
-extern VgaReg igs_crt_protect[];
-extern VgaReg igs_v_de_end[];
-extern VgaReg igs_offset[];
-extern VgaReg igs_v_bstart[];
-extern VgaReg igs_v_bend[];
-extern VgaReg igs_linecomp[];
-extern VgaReg igs_ivideo[];
-extern VgaReg igs_num_fetch[];
-extern VgaReg igs_wcrt0[];
-extern VgaReg igs_wcrt1[];
-extern VgaReg igs_rcrts1[];
-extern VgaReg igs_selwk[];
-extern VgaReg igs_dot_clock_8[];
-extern VgaReg igs_screen_off[];
-extern VgaReg igs_enable_write_plane[];
-extern VgaReg igs_mexhsyn[];
-extern VgaReg igs_mexvsyn[];
-extern VgaReg igs_pci_burst_write[];
-extern VgaReg igs_pci_burst_read[];
-extern VgaReg igs_iow_retry[];
-extern VgaReg igs_mw_retry[];
-extern VgaReg igs_mr_retry[];
-extern VgaReg igs_biga22en[];
-extern VgaReg igs_biga24en[];
-extern VgaReg igs_biga22force[];
-extern VgaReg igs_bigswap[];
-#define IGS_BIGSWAP_8 0x3f
-#define IGS_BIGSWAP_16 0x2a
-#define IGS_BIGSWAP_32 0x00
-extern VgaReg igs_sprite_x[];
-extern VgaReg igs_sprite_preset_x[];
-extern VgaReg igs_sprite_y[];
-extern VgaReg igs_sprite_preset_y[];
-extern VgaReg igs_sprite_visible[];
-extern VgaReg igs_sprite_64x64[];
-extern VgaReg igs_mgrext[];
-extern VgaReg igs_hcshf[];
-extern VgaReg igs_mbpfix[];
-extern VgaReg igs_overscan_red[];
-extern VgaReg igs_overscan_green[];
-extern VgaReg igs_overscan_blue[];
-extern VgaReg igs_memgopg[];
-extern VgaReg igs_memr2wpg[];
-extern VgaReg igs_crtff16[];
-extern VgaReg igs_fifomust[];
-extern VgaReg igs_fifogen[];
-extern VgaReg igs_mode_sel[];
-#define IGS_MODE_TEXT 0
-#define IGS_MODE_8 1
-#define IGS_MODE_565 2
-#define IGS_MODE_5551 6
-#define IGS_MODE_8888 3
-#define IGS_MODE_888 4
-#define IGS_MODE_332 9
-#define IGS_MODE_4444 10
-extern VgaReg igs_sprite_addr[];
-extern VgaReg igs_fastmpie[];
-extern VgaReg igs_vclk_m[];
-extern VgaReg igs_vclk_n[];
-extern VgaReg igs_vfsel[];
-extern VgaReg igs_vclk_p[];
-extern VgaReg igs_frqlat[];
-extern VgaReg igs_dac_mask[];
-extern VgaReg igs_dac_read_index[];
-extern VgaReg igs_dac_write_index[];
-extern VgaReg igs_dac_data[];
-extern VgaReg igs_rampwdn[];
-extern VgaReg igs_dac6_8[];
-extern VgaReg igs_ramdacbypass[];
-extern VgaReg igs_dacpwdn[];
-extern VgaReg igs_cursor_read_index[];
-extern VgaReg igs_cursor_write_index[];
-extern VgaReg igs_cursor_data[];
-
-#define igsGet(sv,r) VgaGet(&(sv)->card, (r))
-#define igsGetImm(sv,r) VgaGetImm(&(sv)->card, (r))
-#define igsSet(sv,r,v) VgaSet(&(sv)->card, (r), (v))
-#define igsSetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v))
-
-typedef struct _igsVga {
- VgaCard card;
- VgaValue values[IGS_NREG];
-} IgsVga;
-
-void
-igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio);
-
-void
-igsSave (IgsVga *igsvga);
-
-void
-igsReset (IgsVga *igsvga);
-
-#endif /* _IGSREG_H_ */
diff --git a/hw/kdrive/igs/igsstub.c b/hw/kdrive/igs/igsstub.c
deleted file mode 100644
index 832c9df23..000000000
--- a/hw/kdrive/igs/igsstub.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsstub.c,v 1.2 2000/05/24 23:52:48 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "igs.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
- CARD32 count;
-
- count = 0;
-#ifdef EMBED
- attr.address[0] = 0x10000000; /* Adomo Wing video base address */
- attr.io = 0;
- attr.naddr = 1;
-#else
- while (LinuxFindPci (0x10ea, 0x5000, count, &attr))
-#endif
- {
- KdCardInfoAdd (&igsFuncs, &attr, 0);
- count++;
- }
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/ipaq/Imakefile b/hw/kdrive/ipaq/Imakefile
deleted file mode 100644
index 9658ea7e5..000000000
--- a/hw/kdrive/ipaq/Imakefile
+++ /dev/null
@@ -1,13 +0,0 @@
-XCOMM $RCSId: $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = ipaq.c
-
-OBJS = ipaq.o
-
-INCLUDES = -I. $(KDINCS) -I$(KDRIVE)/fbdev -I$(KDRIVE)/pcmcia
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(ipaq,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/ipaq/ipaq.c b/hw/kdrive/ipaq/ipaq.c
deleted file mode 100644
index fcdfefd82..000000000
--- a/hw/kdrive/ipaq/ipaq.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- *
- * Adapted from ts300.c by Alan Hourihane <alanh@fairlite.demon.co.uk>
- * For the Compaq IPAQ handheld, with the HP VGA Out Card (F1252A).
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/ipaq/ipaq.c,v 1.2 2001/05/29 17:47:55 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "pcmcia.h"
-
-extern KdCardFuncs pcmciaFuncs;
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
- if (name && !strcmp(name, "pcmcia"))
- KdCardInfoAdd (&pcmciaFuncs, &attr, 0);
- else
- KdCardInfoAdd (&fbdevFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdInitTouchScreen (&TsFuncs);
-#endif
-}
-
-extern pcmciaDisplayModeRec pcmciaDefaultModes[];
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/itsy/Imakefile b/hw/kdrive/itsy/Imakefile
deleted file mode 100644
index 1c646af6f..000000000
--- a/hw/kdrive/itsy/Imakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/nvfb/Imakefile,v 3.8 1996/12/23 06:30:19 dawes Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = itsy.c ts.c kbd.c
-
-OBJS = itsy.o ts.o kbd.o
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(itsy,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/itsy/itsy.c b/hw/kdrive/itsy/itsy.c
deleted file mode 100644
index ef8ca6dad..000000000
--- a/hw/kdrive/itsy/itsy.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Id: itsy.c,v 1.1 1999/11/02 18:39:28 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/itsy/itsy.c,v 1.2 1999/12/30 03:03:09 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "itsy.h"
-
-/* struct with LCD characteristics defined in fb_brutus.h */
-static struct FbLcdParamsStruct fbLcdParams;
-static int fb_d;
-static int fbn;
-Bool
-itsyCardInit (KdCardInfo *card)
-{
- int k;
- char *fb;
- char *pixels;
-
- if ((fb_d = open("/dev/fbclone", O_RDWR)) < 0) {
- perror("Error opening /dev/fb\n");
- return FALSE;
- }
- if ((k=ioctl(fb_d, FB_LCD_PARAMS, &fbLcdParams)) != 0) {
- perror("Error with /dev/fb ioctl FB_LCD_PARAMS call");
- return FALSE;
- }
-
- fb = (char *) mmap ((caddr_t) NULL, fbLcdParams.frameBufferSize,
- PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fb_d, 0);
-
- fprintf (stderr, "fb mapped at 0x%x\n", fb);
- if (fb == (char *)-1) {
- perror("ERROR: mmap framebuffer fails!");
- return FALSE;
- }
-
- card->driver = fb;
-
- return TRUE;
-}
-
-Bool
-itsyScreenInit (KdScreenInfo *screen)
-{
- CARD8 *fb = screen->card->driver;
-
- screen->width = fbLcdParams.screenSizeH;
- screen->height = fbLcdParams.screenSizeV;
- screen->depth = fbLcdParams.bitsPerPixel;
- screen->bitsPerPixel = fbLcdParams.bitsPerPixel;
- screen->byteStride = fbLcdParams.frameBufferSizeH;
- screen->pixelStride = (fbLcdParams.frameBufferSizeH * 8 /
- fbLcdParams.bitsPerPixel);
- fprintf (stderr, "width %d height %d depth %d pstride %d bstride %d\n",
- screen->width, screen->height, screen->depth,
- screen->pixelStride, screen->byteStride);
- screen->dumb = FALSE;
- screen->softCursor = TRUE;
- screen->blueMask = 0;
- screen->greenMask = 0;
- screen->redMask = 0;
- screen->visuals = 1 << StaticGray;
- screen->rate = 72;
- screen->frameBuffer = (CARD8 *) (fb +
- fbLcdParams.pixelDataOffset +
- (fbLcdParams.reserveTopRows *
- screen->byteStride));
- fprintf (stderr, "Frame buffer 0x%x\n", screen->frameBuffer);
- return TRUE;
-}
-
-static unsigned short itsyIntensity[16] = {
- 0xffff,
- 0xffff,
- 0xedb6,
- 0xdb6d,
- 0xc924,
- 0xb6db,
- 0xa492,
- 0x9249,
- 0x8000,
- 0x6db6,
- 0x5b6d,
- 0x4924,
- 0x36db,
- 0x2492,
- 0x1249,
- 0x0000,
-};
-
-Bool
-itsyCreateColormap (ColormapPtr pmap)
-{
- int i;
-
- for (i = 0; i < 16; i++)
- {
- pmap->red[i].co.local.red = itsyIntensity[i];
- pmap->red[i].co.local.green = itsyIntensity[i];
- pmap->red[i].co.local.blue = itsyIntensity[i];
- }
- return TRUE;
-}
-
-Bool
-itsyInitScreen (ScreenPtr pScreen)
-{
- pScreen->CreateColormap = itsyCreateColormap;
- return TRUE;
-}
-
-void
-itsyPreserve (KdCardInfo *card)
-{
-}
-
-void
-itsyEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
-
- fprintf (stderr, "Enabling LCD display\n");
- /* display it on the LCD */
- ioctl(fb_d, FB_LCD_SHOW, 0);
-}
-
-Bool
-itsyDPMS (ScreenPtr pScreen, int mode)
-{
- if (mode)
- ioctl (fb_d, FB_LCD_OFF, 0);
- else
- ioctl (fb_d, FB_LCD_ON, 0);
- return TRUE;
-}
-
-void
-itsyDisable (ScreenPtr pScreen)
-{
-/* ioctl (fb_d, FB_LCD_SWITCH, 0); */
-/* fprintf (stderr, "Disabling LCD display\n");*/
-}
-
-void
-itsyRestore (KdCardInfo *card)
-{
-}
-
-void
-itsyScreenFini (KdScreenInfo *screen)
-{
-}
-
-void
-itsyCardFini (KdCardInfo *card)
-{
- int k;
-
- fprintf (stderr, "Unmapping driver at 0x%x\n", card->driver);
- munmap (card->driver, fbLcdParams.frameBufferSize);
- fprintf (stderr, "Releasing fbn %d\n", fbn);
- /* release it */
- if (ioctl(fb_d, FB_LCD_FREE, fbn) != 0) {
- printf("FB_LCD_FREE of %d fails!\n", fbn);
- }
- close (fb_d);
- fprintf (stderr, "itsyFini done\n");
-}
-
-KdCardFuncs itsyFuncs = {
- itsyCardInit, /* cardinit */
- itsyScreenInit, /* scrinit */
- itsyInitScreen, /* initScreen */
- itsyPreserve, /* preserve */
- itsyEnable, /* enable */
- itsyDPMS, /* dpms */
- itsyDisable, /* disable */
- itsyRestore, /* restore */
- itsyScreenFini, /* scrfini */
- itsyCardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- 0, /* initAccel */
- 0, /* enableAccel */
- 0, /* disableAccel */
- 0, /* finiAccel */
-
- 0, /* getColors */
- 0, /* putColors */
-};
-
-void
-InitCard (void)
-{
- KdCardAttr attr;
-
- KdCardInfoAdd (&itsyFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&itsyTsMouseFuncs, &itsyKeyboardFuncs);
-}
-
-int itsySessionFd = -1;
-
-int
-ItsyOsInit (void)
-{
- pid_t sid;
- int i;
- itsy_session_info info;
-
- if (itsySessionFd < 0)
- {
- itsySessionFd = open ("/dev/session", 0);
- ErrorF("itsySessionFD %d\n", itsySessionFd);
- }
-
- (void) setsid ();
- sid = getsid (0);
- ErrorF ("Session ID %d PID %d\n", sid, getpid ());
- info.sid = sid;
- strcpy (info.name, "X");
- if (itsySessionFd >= 0)
- {
- i = ioctl (itsySessionFd, SESSION_SET_INFO, &info);
- if (i < 0)
- perror ("SESSION_SET_INFO");
- }
- return 1;
-}
-
-void
-ItsyOsEnable (void)
-{
- itsy_session_request req;
- int i;
-
-#define MANAGER_SID_TO_FOREGROUND 2
-
- req.operation = MANAGER_SID_TO_FOREGROUND;
- req.data = 0;
- if (itsySessionFd >= 0)
- {
- i = ioctl (itsySessionFd, SESSION_MANAGER_REQUEST, &req);
- if (i < 0)
- perror ("SESSION_MANAGER_REQUEST");
- }
-}
-
-Bool
-ItsyOsSpecialKey (KeySym sym)
-{
- return FALSE;
-}
-
-void
-ItsyOsDisable (void)
-{
-}
-
-void
-ItsyOsFini (void)
-{
-}
-
-KdOsFuncs ItsyOsFuncs = {
- ItsyOsInit,
- ItsyOsEnable,
- ItsyOsSpecialKey,
- ItsyOsDisable,
- ItsyOsFini,
-};
-
-void
-OsVendorInit (void)
-{
- KdOsInit (&ItsyOsFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/itsy/itsy.h b/hw/kdrive/itsy/itsy.h
deleted file mode 100644
index 3c1fdd79e..000000000
--- a/hw/kdrive/itsy/itsy.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Id: itsy.h,v 1.1 1999/11/02 18:39:28 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/itsy/itsy.h,v 1.1 1999/11/19 13:53:53 hohndel Exp $ */
-
-#include "kdrive.h"
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <linux/itsy_fb.h>
-#include <linux/itsy_ts.h>
-#include <linux/itsy_buttons.h>
-#include <linux/itsy_session.h>
-#include <unistd.h>
-#include <sys/mman.h>
-
-#define FB_HEIGHT 200
-#define FB_WIDTH 320
-#define FB_DEPTH 4
-#define FB_PALETTE_SIZE 16
-
-extern KdMouseFuncs itsyTsMouseFuncs;
-extern KdKeyboardFuncs itsyKeyboardFuncs;
diff --git a/hw/kdrive/itsy/kbd.c b/hw/kdrive/itsy/kbd.c
deleted file mode 100644
index eec6514e1..000000000
--- a/hw/kdrive/itsy/kbd.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Id: kbd.c,v 1.1 1999/11/02 18:39:28 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/itsy/kbd.c,v 1.1 1999/11/19 13:53:53 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "itsy.h"
-#include "kkeymap.h"
-#include <X11/keysym.h>
-#include <linux/itsy_buttons.h>
-
-#define ITSY_WIDTH 2
-
-KeySym ItsyKeymap[] = {
-/* 1 8 */ XK_Escape, NoSymbol,
-/* 2 9 */ XK_1, XK_exclam,
-/* 3 10 */ XK_2, XK_at,
-/* 4 11 */ XK_3, XK_numbersign,
-/* 5 12 */ XK_4, XK_dollar,
-/* 6 13 */ XK_5, XK_percent,
-/* 7 14 */ XK_6, XK_asciicircum,
-/* 8 15 */ XK_7, XK_ampersand,
-/* 9 16 */ XK_8, XK_asterisk,
-/* 10 17 */ XK_9, XK_parenleft,
-/* 11 18 */ XK_0, XK_parenright,
-/* 12 19 */ XK_minus, XK_underscore,
-/* 13 20 */ XK_equal, XK_plus,
-/* 14 21 */ XK_BackSpace, NoSymbol,
-/* 15 22 */ XK_Tab, NoSymbol,
-/* 16 23 */ XK_Q, NoSymbol,
-/* 17 24 */ XK_W, NoSymbol,
-/* 18 25 */ XK_E, NoSymbol,
-/* 19 26 */ XK_R, NoSymbol,
-/* 20 27 */ XK_T, NoSymbol,
-/* 21 28 */ XK_Y, NoSymbol,
-/* 22 29 */ XK_U, NoSymbol,
-/* 23 30 */ XK_I, NoSymbol,
-/* 24 31 */ XK_O, NoSymbol,
-/* 25 32 */ XK_P, NoSymbol,
-/* 26 33 */ XK_bracketleft, XK_braceleft,
-/* 27 34 */ XK_bracketright, XK_braceright,
-/* 28 35 */ XK_Return, NoSymbol,
-/* 29 36 */ XK_Control_L, NoSymbol,
-/* 30 37 */ XK_A, NoSymbol,
-/* 31 38 */ XK_S, NoSymbol,
-/* 32 39 */ XK_D, NoSymbol,
-/* 33 40 */ XK_F, NoSymbol,
-/* 34 41 */ XK_G, NoSymbol,
-/* 35 42 */ XK_H, NoSymbol,
-/* 36 43 */ XK_J, NoSymbol,
-/* 37 44 */ XK_K, NoSymbol,
-/* 38 45 */ XK_L, NoSymbol,
-/* 39 46 */ XK_semicolon, XK_colon,
-/* 40 47 */ XK_apostrophe, XK_quotedbl,
-/* 41 48 */ XK_grave, XK_asciitilde,
-/* 42 49 */ XK_Shift_L, NoSymbol,
-/* 43 50 */ XK_backslash, XK_bar,
-/* 44 51 */ XK_Z, NoSymbol,
-/* 45 52 */ XK_X, NoSymbol,
-/* 46 53 */ XK_C, NoSymbol,
-/* 47 54 */ XK_V, NoSymbol,
-/* 48 55 */ XK_B, NoSymbol,
-/* 49 56 */ XK_N, NoSymbol,
-/* 50 57 */ XK_M, NoSymbol,
-/* 51 58 */ XK_comma, XK_less,
-/* 52 59 */ XK_period, XK_greater,
-/* 53 60 */ XK_slash, XK_question,
-/* 54 61 */ XK_Shift_R, NoSymbol,
-/* 55 62 */ XK_KP_Multiply, NoSymbol,
-/* 56 63 */ XK_Alt_L, XK_Meta_L,
-/* 57 64 */ XK_space, NoSymbol,
-/* 58 65 */ XK_Caps_Lock, NoSymbol,
-/* 59 66 */ XK_F1, NoSymbol,
-/* 60 67 */ XK_F2, NoSymbol,
-/* 61 68 */ XK_F3, NoSymbol,
-/* 62 69 */ XK_F4, NoSymbol,
-/* 63 70 */ XK_F5, NoSymbol,
-/* 64 71 */ XK_F6, NoSymbol,
-/* 65 72 */ XK_F7, NoSymbol,
-/* 66 73 */ XK_F8, NoSymbol,
-/* 67 74 */ XK_F9, NoSymbol,
-/* 68 75 */ XK_F10, NoSymbol,
-/* 69 76 */ XK_Break, XK_Pause,
-/* 70 77 */ XK_Scroll_Lock, NoSymbol,
-/* 71 78 */ XK_KP_Home, XK_KP_7,
-/* 72 79 */ XK_KP_Up, XK_KP_8,
-/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
-/* 74 81 */ XK_KP_Subtract, NoSymbol,
-/* 75 82 */ XK_KP_Left, XK_KP_4,
-/* 76 83 */ XK_KP_5, NoSymbol,
-/* 77 84 */ XK_KP_Right, XK_KP_6,
-/* 78 85 */ XK_KP_Add, NoSymbol,
-/* 79 86 */ XK_KP_End, XK_KP_1,
-/* 80 87 */ XK_KP_Down, XK_KP_2,
-/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
-/* 82 89 */ XK_KP_Insert, XK_KP_0,
-/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
-/* 84 91 */ NoSymbol, NoSymbol,
-/* 85 92 */ NoSymbol, NoSymbol,
-/* 86 93 */ NoSymbol, NoSymbol,
-/* 87 94 */ XK_F11, NoSymbol,
-/* 88 95 */ XK_F12, NoSymbol,
-
-/* These are remapped from the extended set (using ExtendMap) */
-
-/* 89 96 */ XK_Control_R, NoSymbol,
-/* 90 97 */ XK_KP_Enter, NoSymbol,
-/* 91 98 */ XK_KP_Divide, NoSymbol,
-/* 92 99 */ XK_Sys_Req, XK_Print,
-/* 93 100 */ XK_Alt_R, XK_Meta_R,
-/* 94 101 */ XK_Num_Lock, NoSymbol,
-/* 95 102 */ XK_Home, NoSymbol,
-/* 96 103 */ XK_Up, NoSymbol,
-/* 97 104 */ XK_Page_Up, NoSymbol,
-/* 98 105 */ XK_Left, NoSymbol,
-/* 99 106 */ XK_Right, NoSymbol,
-/* 100 107 */ XK_End, NoSymbol,
-/* 101 108 */ XK_Down, NoSymbol,
-/* 102 109 */ XK_Page_Down, NoSymbol,
-/* 103 110 */ XK_Insert, NoSymbol,
-/* 104 111 */ XK_Delete, NoSymbol,
-/* 105 112 */ XK_Super_L, NoSymbol,
-/* 106 113 */ XK_Super_R, NoSymbol,
-/* 107 114 */ XK_Menu, NoSymbol,
-
-/* Itsy hardware buttons */
-#define ITSY_BUTTON_FIRST 108
-#define ITSY_BUTTON_LAST 116
-
-/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
-/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
-/* 110 117 */ XK_Up, NoSymbol, /* joypad */
-/* 111 118 */ XK_Down, NoSymbol,
-/* 112 119 */ XK_Left, NoSymbol,
-/* 113 120 */ XK_Right, NoSymbol,
-/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
-/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
-/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
-};
-
-static unsigned long itsyButtonState;
-
-void
-ItsyKeyboardLoad (void)
-{
- KeySym *k;
-
- itsyButtonState = 0;
- kdMinScanCode = 1;
- kdKeymapWidth = ITSY_WIDTH;
- kdMaxScanCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
- memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
-}
-
-int
-ItsyKeyboardInit (void)
-{
- int butPort;
-
- butPort = open ("/dev/buttons", 0);
- fprintf (stderr, "butPort %d\n", butPort);
- return butPort;
-}
-
-void
-ItsyKeyboardFini (int fd)
-{
- if (fd >= 0)
- close (fd);
-}
-
-void
-ItsyKeyboardRead (int fd)
-{
- itsy_buttons_event event;
- int b;
- unsigned long bit;
- unsigned long change;
- unsigned long buttons;
-
- if (read (fd, &event, sizeof (event)) == sizeof (event))
- {
- buttons = event.state;
- change = buttons ^ itsyButtonState;
- if (!change)
- return;
- for (b = ITSY_BUTTON_FIRST; b <= ITSY_BUTTON_LAST; b++)
- {
- bit = (1 << (b - ITSY_BUTTON_FIRST));
- if (change & bit)
- KdEnqueueKeyboardEvent (b, (buttons & bit) == 0);
- }
- itsyButtonState = buttons;
- }
-}
-
-void
-ItsyKeyboardLeds (int leds)
-{
-}
-
-void
-ItsyKeyboardBell (int volume, int frequency, int duration)
-{
-}
-
-KdKeyboardFuncs itsyKeyboardFuncs = {
- ItsyKeyboardLoad,
- ItsyKeyboardInit,
- ItsyKeyboardRead,
- ItsyKeyboardLeds,
- ItsyKeyboardBell,
- ItsyKeyboardFini,
- 0,
-};
diff --git a/hw/kdrive/itsy/ts.c b/hw/kdrive/itsy/ts.c
deleted file mode 100644
index 10efe90c8..000000000
--- a/hw/kdrive/itsy/ts.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Id: ts.c,v 1.1 1999/11/02 18:39:28 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/itsy/ts.c,v 1.1 1999/11/19 13:53:54 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include "itsy.h"
-#include <X11/Xproto.h>
-#include "inputstr.h"
-#include "Xpoll.h"
-
-int
-itsyTsReadBytes (int fd, char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
- }
- return tot;
-}
-
-void
-itsyTsRead (int tsPort)
-{
- ts_event event;
- long buf[3];
- int n;
- long pressure;
- long x, y;
- unsigned long flags;
- unsigned long buttons;
-
- n = itsyTsReadBytes (tsPort, (char *) &event,
- sizeof (event), sizeof (event));
- if (n == sizeof (event))
- {
- if (event.pressure)
- {
- flags = KD_BUTTON_1;
- x = event.point.x;
- y = event.point.y;
- }
- else
- {
- flags = KD_MOUSE_DELTA;
- x = 0;
- y = 0;
- }
- KdEnqueueMouseEvent (flags, x, y);
- }
-}
-
-#if 0
-#define ITSY_DEBUG_LOW 1
-
-//
-// Touch screen parameters are stored
-// in the flash. This code is taken from 'wm1'.
-//
-void itsySetTouchCalibration (int mou_filedsc,
- int xs, int xt, int ys, int yt, int xys)
-{
- int k, ibuf[10];
-
- ibuf[0] = xs;
- ibuf[1] = xt;
- ibuf[2] = ys;
- ibuf[3] = yt;
- ibuf[4] = xys;
- if ((k=ioctl(mou_filedsc, TS_SET_CALM, ibuf)) != 0) {
- fprintf(stderr, "ERROR: ioctl TS_SET_CALM returns %d\n", k);
- }
-}
-
-
-int itsyReadFlashBlock(int location, signed char *data, int dbytes)
-{
- int offset, bytes;
- int flashfd;
-
- flashfd = open("/dev/flash1", O_RDONLY);
- if (flashfd < 0) return(0);
-
- offset = lseek(flashfd, location, SEEK_SET);
- if (offset != location) {
- close(flashfd);
- return(0);
- }
-
- bytes = read(flashfd, data, dbytes);
- if (bytes != dbytes) {
- close(flashfd);
- return(0);
- }
-
- close(flashfd);
- return(1);
-}
-
-/**********************************************************************/
-#define RAMSIZE (0x400000)
-#define MONITOR_BLOCKSIZE (32)
-/**********************************************************************/
-
-/* code for storing calibration into flash */
-
-#define CALIBRATE_BLOCKSIZE (32)
-#define CALIBRATE_OFFSET (RAMSIZE-MONITOR_BLOCKSIZE-CALIBRATE_BLOCKSIZE)
-#define CALIBRATE_MAGIC_NUM (0x0babedee)
-
-
-static int check_if_calibrated_and_set(int mou_filedsc)
-{
- signed char cal_data[CALIBRATE_BLOCKSIZE];
- int *iptr;
-
- if (itsyReadFlashBlock(CALIBRATE_OFFSET,
- cal_data, CALIBRATE_BLOCKSIZE) == 0) {
- if ( ITSY_DEBUG_LOW ) {
- fprintf(stderr,"unable to read calibration data for touch screen\n");
- }
- return(0);
- }
-
- iptr = (int *) cal_data;
- if (iptr[0] == CALIBRATE_MAGIC_NUM) {
- if ( ITSY_DEBUG_LOW ) {
- fprintf(stderr,"Calibrating touch screen using %d, %d, %d, %d, %d\n",
- iptr[1], iptr[2], iptr[3], iptr[4], iptr[5]);
- }
- itsySetTouchCalibration(mou_filedsc, iptr[1], iptr[2], iptr[3], iptr[4], iptr[5]);
- return(1);
- }
- else {
- if ( ITSY_DEBUG_LOW ) {
- fprintf(stderr,"Couldn't calibrate screen\n");
- }
- return(0);
- }
-}
-#endif
-
-int
-itsyTsInit (void)
-{
- int tsPort;
-
- tsPort = open ("/dev/ts", 0);
- fprintf (stderr, "tsPort %d\n", tsPort);
-#if 0
- if (tsPort >= 0)
- check_if_calibrated_and_set (tsPort);
-#endif
- return tsPort;
-}
-
-void
-itsyTsFini (int tsPort)
-{
- if (tsPort >= 0)
- close (tsPort);
-}
-
-KdMouseFuncs itsyTsMouseFuncs = {
- itsyTsInit,
- itsyTsRead,
- itsyTsFini
-};
-
diff --git a/hw/kdrive/linux/Imakefile b/hw/kdrive/linux/Imakefile
deleted file mode 100644
index c4fc2642f..000000000
--- a/hw/kdrive/linux/Imakefile
+++ /dev/null
@@ -1,25 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/linux/Imakefile,v 1.8 2001/10/12 06:33:09 keithp Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-#if TouchScreen
-#if HasTsLib
-TSSRCS = tslib.c
-TSOBJS = tslib.o
-#else
-TSSRCS = ts.c
-TSOBJS = ts.o
-#endif
-#endif
-
-SRCS = keyboard.c linux.c mouse.c ps2.c bus.c ms.c agp.c $(TSSRCS)
-
-OBJS = keyboard.o linux.o mouse.o ps2.o bus.o ms.o agp.o $(TSOBJS)
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(linux,$(OBJS))
-
-DependTarget()
diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am
deleted file mode 100644
index 1edd7713f..000000000
--- a/hw/kdrive/linux/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- @XSERVER_CFLAGS@
-
-
-noinst_LIBRARIES = liblinux.a
-
-if TSLIB
-TSLIB_C = tslib.c
-endif
-
-if H3600_TS
-TS_C = ts.c
-endif
-
-liblinux_a_SOURCES = \
- agp.c \
- agp.h \
- bus.c \
- keyboard.c \
- klinux.h \
- linux.c \
- mouse.c \
- ms.c \
- ps2.c \
- $(TSLIB_C) \
- $(TS_C)
-
-liblinux_a_DEPENDENCIES = \
- agp.c \
- bus.c \
- keyboard.c \
- linux.c \
- mouse.c \
- ms.c \
- ps2.c \
- $(TSLIB_C) \
- $(TS_C)
-
diff --git a/hw/kdrive/linux/agp.c b/hw/kdrive/linux/agp.c
deleted file mode 100644
index d401e03a1..000000000
--- a/hw/kdrive/linux/agp.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Abstraction of the AGP GART interface.
- *
- * This version is for both Linux and FreeBSD.
- *
- * Copyright © 2000-2001 Nokia Home Communications
- * Copyright © 2000 VA Linux Systems, Inc.
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
- */
-
-/* $RCSId: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.4 2000/08/28 18:12:56 dawes Exp $ */
-
-/*
- * Author: Pontus Lidman <pontus.lidman@nokia.com> (adaption to KDrive) and others
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/X.h>
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "agp.h"
-
-#if defined(linux)
-#include <asm/ioctl.h>
-
-#include <linux/agpgart.h>
-
-#elif defined(__FreeBSD__)
-#include <sys/ioctl.h>
-#include <sys/agpio.h>
-#endif
-
-#ifndef AGP_DEVICE
-#define AGP_DEVICE "/dev/agpgart"
-#endif
-/* AGP page size is independent of the host page size. */
-#ifndef AGP_PAGE_SIZE
-#define AGP_PAGE_SIZE 4096
-#endif
-#define AGPGART_MAJOR_VERSION 0
-#define AGPGART_MINOR_VERSION 99
-
-static int gartFd = -1;
-static int acquiredScreen = -1;
-
-/*
- * Open /dev/agpgart. Keep it open until server exit.
- */
-
-static Bool
-GARTInit(void)
-{
- static Bool initDone = FALSE;
- struct _agp_info agpinf;
-
- if (initDone)
- return (gartFd != -1);
-
- initDone = TRUE;
-
- if (gartFd == -1)
- gartFd = open(AGP_DEVICE, O_RDWR, 0);
- else
- return FALSE;
-
- if (gartFd == -1) {
- fprintf(stderr, "Unable to open " AGP_DEVICE " (%s)\n",
- strerror(errno));
- return FALSE;
- }
-
- KdAcquireGART(-1);
- /* Check the kernel driver version. */
- if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
- fprintf(stderr, "GARTInit: AGPIOC_INFO failed (%s)\n",
- strerror(errno));
- close(gartFd);
- gartFd = -1;
- return FALSE;
- }
- KdReleaseGART(-1);
-
-#if defined(linux)
- /* Per Dave Jones, every effort will be made to keep the
- * agpgart interface backwards compatible, so allow all
- * future versions.
- */
- if (
-#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
- agpinf.version.major < AGPGART_MAJOR_VERSION ||
-#endif
- (agpinf.version.major == AGPGART_MAJOR_VERSION &&
- agpinf.version.minor < AGPGART_MINOR_VERSION)) {
- fprintf(stderr,
- "Kernel agpgart driver version is not current"
- " (%d.%d vs %d.%d)\n",
- agpinf.version.major, agpinf.version.minor,
- AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
- close(gartFd);
- gartFd = -1;
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-Bool
-KdAgpGARTSupported()
-{
- return GARTInit();
-}
-
-AgpInfoPtr
-KdGetAGPInfo(int screenNum)
-{
- struct _agp_info agpinf;
- AgpInfoPtr info;
-
- if (!GARTInit())
- return NULL;
-
-
- if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
- fprintf(stderr, "Failed to allocate AgpInfo\n");
- return NULL;
- }
-
- if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
- fprintf(stderr,
- "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
- strerror(errno));
- return NULL;
- }
-
- info->bridgeId = agpinf.bridge_id;
- info->agpMode = agpinf.agp_mode;
- info->base = agpinf.aper_base;
- info->size = agpinf.aper_size;
- info->totalPages = agpinf.pg_total;
- info->systemPages = agpinf.pg_system;
- info->usedPages = agpinf.pg_used;
-
- return info;
-}
-
-/*
- * XXX If multiple screens can acquire the GART, should we have a reference
- * count instead of using acquiredScreen?
- */
-
-Bool
-KdAcquireGART(int screenNum)
-{
- if (screenNum != -1 && !GARTInit())
- return FALSE;
-
- if (screenNum == -1 || acquiredScreen != screenNum) {
- if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
- fprintf(stderr,
- "AGPIOC_ACQUIRE failed (%s)\n",
- strerror(errno));
- return FALSE;
- }
- acquiredScreen = screenNum;
- }
-
- return TRUE;
-}
-
-Bool
-KdReleaseGART(int screenNum)
-{
- if (screenNum != -1 && !GARTInit())
- return FALSE;
-
- if (acquiredScreen == screenNum) {
- if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
- fprintf(stderr,
- "AGPIOC_RELEASE failed (%s)\n",
- strerror(errno));
- return FALSE;
- }
- acquiredScreen = -1;
- return TRUE;
- }
- return FALSE;
-}
-
-int
-KdAllocateGARTMemory(int screenNum, unsigned long size, int type,
- unsigned long *physical)
-{
- struct _agp_allocate alloc;
- int pages;
-
- /*
- * Allocates "size" bytes of GART memory (rounds up to the next
- * page multiple) or type "type". A handle (key) for the allocated
- * memory is returned. On error, the return value is -1.
- */
-
- if (!GARTInit() || acquiredScreen != screenNum)
- return -1;
-
- pages = (size / AGP_PAGE_SIZE);
- if (size % AGP_PAGE_SIZE != 0)
- pages++;
-
- /* XXX check for pages == 0? */
-
- alloc.pg_count = pages;
- alloc.type = type;
-
- if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
- fprintf(stderr, "KdAllocateGARTMemory: "
- "allocation of %d pages failed\n\t(%s)\n", pages,
- strerror(errno));
- return -1;
- }
-
- if (physical)
- *physical = alloc.physical;
-
- return alloc.key;
-}
-
-
-/* Bind GART memory with "key" at "offset" */
-Bool
-KdBindGARTMemory(int screenNum, int key, unsigned long offset)
-{
- struct _agp_bind bind;
- int pageOffset;
-
- if (!GARTInit() || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- fprintf(stderr,
- "AGP not acquired by this screen\n");
- return FALSE;
- }
-
- if (offset % AGP_PAGE_SIZE != 0) {
- fprintf(stderr, "KdBindGARTMemory: "
- "offset (0x%lx) is not page-aligned (%d)\n",
- offset, AGP_PAGE_SIZE);
- return FALSE;
- }
- pageOffset = offset / AGP_PAGE_SIZE;
-
- bind.pg_start = pageOffset;
- bind.key = key;
-
- if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
- fprintf(stderr, "KdBindGARTMemory: "
- "binding of gart memory with key %d\n"
- "\tat offset 0x%lx failed (%s)\n",
- key, offset, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* Unbind GART memory with "key" */
-Bool
-KdUnbindGARTMemory(int screenNum, int key)
-{
- struct _agp_unbind unbind;
-
- if (!GARTInit() || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- fprintf(stderr,
- "AGP not acquired by this screen\n");
- return FALSE;
- }
-
- unbind.priority = 0;
- unbind.key = key;
-
- if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
- fprintf(stderr, "KdUnbindGARTMemory: "
- "unbinding of gart memory with key %d "
- "failed (%s)\n", key, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* XXX Interface may change. */
-Bool
-KdEnableAGP(int screenNum, CARD32 mode)
-{
- agp_setup setup;
-
- if (!GARTInit() || acquiredScreen != screenNum)
- return FALSE;
-
- setup.agp_mode = mode;
- if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
- fprintf(stderr, "KdEnableAGP: "
- "AGPIOC_SETUP with mode %ld failed (%s)\n",
- mode, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
diff --git a/hw/kdrive/linux/agp.h b/hw/kdrive/linux/agp.h
deleted file mode 100644
index 419dee1b4..000000000
--- a/hw/kdrive/linux/agp.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 2000, 2001 Nokia Home Communications
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group */
-
-/* agp.h - header file for KDrive AGP GART interface
- *
- * Author: Pontus Lidman <pontus.lidman@nokia.com>
- *
- */
-
-#ifndef _AGP_H_
-#define _AGP_H_
-
-#include <X11/Xdefs.h>
-#include <X11/Xmd.h>
-
-/* These two definitions must be consistent with the kernel's,
- but using 1 or 2 in driver code is even uglier */
-#define AGP_DCACHE_MEMORY 1
-#define AGP_PHYS_MEMORY 2
-
-typedef struct _AgpInfo {
- unsigned long bridgeId;
- unsigned long agpMode;
- unsigned long base;
- unsigned long size;
- unsigned long totalPages;
- unsigned long systemPages;
- unsigned long usedPages;
-} AgpInfo, *AgpInfoPtr;
-
-extern Bool KdAgpGARTSupported(void);
-extern AgpInfoPtr KdGetAGPInfo(int screenNum);
-extern Bool KdAcquireGART(int screenNum);
-extern Bool KdReleaseGART(int screenNum);
-extern int KdAllocateGARTMemory(int screenNum, unsigned long size, int type,
- unsigned long *physical);
-extern Bool KdBindGARTMemory(int screenNum, int key, unsigned long offset);
-extern Bool KdUnbindGARTMemory(int screenNum, int key);
-extern Bool KdEnableAGP(int screenNum, CARD32 mode);
-
-#endif /* _AGP_H_ */
diff --git a/hw/kdrive/linux/bus.c b/hw/kdrive/linux/bus.c
deleted file mode 100644
index 15d2ba846..000000000
--- a/hw/kdrive/linux/bus.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/bus.c,v 1.2 2001/06/29 14:00:41 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-
-/* /dev/adbmouse is a busmouse */
-
-static void
-BusRead (int adbPort, void *closure)
-{
- unsigned char buf[3];
- int n;
- int dx, dy;
- unsigned long flags;
-
- n = read (adbPort, buf, 3);
- if (n == 3)
- {
- flags = KD_MOUSE_DELTA;
- dx = (char) buf[1];
- dy = -(char) buf[2];
- if ((buf[0] & 4) == 0)
- flags |= KD_BUTTON_1;
- if ((buf[0] & 2) == 0)
- flags |= KD_BUTTON_2;
- if ((buf[0] & 1) == 0)
- flags |= KD_BUTTON_3;
- KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
- }
-}
-
-char *BusNames[] = {
- "/dev/adbmouse",
- "/dev/mouse",
-};
-
-#define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0]))
-
-int BusInputType;
-
-static int
-BusInit (void)
-{
- int i;
- int busPort;
- int n = 0;
-
- if (!BusInputType)
- BusInputType = KdAllocInputType ();
-
- for (i = 0; i < NUM_BUS_NAMES; i++)
- {
- busPort = open (BusNames[i], 0);
- {
- KdRegisterFd (BusInputType, busPort, BusRead, 0);
- n++;
- }
- }
- return n;
-}
-
-static void
-BusFini (void)
-{
- KdUnregisterFds (BusInputType, TRUE);
-}
-
-KdMouseFuncs BusMouseFuncs = {
- BusInit,
- BusFini
-};
diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
deleted file mode 100644
index 97b0683de..000000000
--- a/hw/kdrive/linux/keyboard.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.10 2001/11/08 10:26:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kkeymap.h"
-#include <linux/keyboard.h>
-#include <linux/kd.h>
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-extern int LinuxConsoleFd;
-
-static const KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- 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_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
-};
-
-static unsigned char tbl[KD_MAX_WIDTH] =
-{
- 0,
- 1 << KG_SHIFT,
- (1 << KG_ALTGR),
- (1 << KG_ALTGR) | (1 << KG_SHIFT)
-};
-
-static void
-readKernelMapping(void)
-{
- KeySym *k;
- int i, j;
- struct kbentry kbe;
- int minKeyCode, maxKeyCode;
- int row;
-
- minKeyCode = NR_KEYS;
- maxKeyCode = 0;
- row = 0;
- for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i)
- {
- kbe.kb_index = i;
-
- k = kdKeymap + row * KD_MAX_WIDTH;
-
- for (j = 0; j < KD_MAX_WIDTH; ++j)
- {
- unsigned short kval;
-
- k[j] = NoSymbol;
-
- kbe.kb_table = tbl[j];
- kbe.kb_value = 0;
- if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value))
- {
- case KT_LATIN:
- case KT_LETTER:
- k[j] = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- k[j] = XK_F1 + kval;
- else switch (kbe.kb_value)
- {
- case K_FIND:
- k[j] = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- k[j] = XK_Insert;
- break;
- case K_REMOVE:
- k[j] = XK_Delete;
- break;
- case K_SELECT:
- k[j] = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- k[j] = XK_Prior;
- break;
- case K_PGDN:
- k[j] = XK_Next;
- break;
- case K_HELP:
- k[j] = XK_Help;
- break;
- case K_DO:
- k[j] = XK_Execute;
- break;
- case K_PAUSE:
- k[j] = XK_Pause;
- break;
- case K_MACRO:
- k[j] = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value)
- {
- case K_ENTER:
- k[j] = XK_Return;
- break;
- case K_BREAK:
- k[j] = XK_Break;
- break;
- case K_CAPS:
- k[j] = XK_Caps_Lock;
- break;
- case K_NUM:
- k[j] = XK_Num_Lock;
- break;
- case K_HOLD:
- k[j] = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- k[j] = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value)
- {
- case K_PPLUS:
- k[j] = XK_KP_Add;
- break;
- case K_PMINUS:
- k[j] = XK_KP_Subtract;
- break;
- case K_PSTAR:
- k[j] = XK_KP_Multiply;
- break;
- case K_PSLASH:
- k[j] = XK_KP_Divide;
- break;
- case K_PENTER:
- k[j] = XK_KP_Enter;
- break;
- case K_PCOMMA:
- k[j] = XK_KP_Separator;
- break;
- case K_PDOT:
- k[j] = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- k[j] = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- k[j] = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value)
- {
- case K_DGRAVE:
- k[j] = XK_dead_grave;
- break;
- case K_DACUTE:
- k[j] = XK_dead_acute;
- break;
- case K_DCIRCM:
- k[j] = XK_dead_circumflex;
- break;
- case K_DTILDE:
- k[j] = XK_dead_tilde;
- break;
- case K_DDIERE:
- k[j] = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value)
- {
- case K_DOWN:
- k[j] = XK_Down;
- break;
- case K_LEFT:
- k[j] = XK_Left;
- break;
- case K_RIGHT:
- k[j] = XK_Right;
- break;
- case K_UP:
- k[j] = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value)
- {
- case K_ALTGR:
- k[j] = XK_Mode_switch;
- break;
- case K_ALT:
- k[j] = (kbe.kb_index == 0x64 ?
- XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- k[j] = (kbe.kb_index == 0x61 ?
- XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- k[j] = XK_Control_L;
- break;
- case K_CTRLR:
- k[j] = XK_Control_R;
- break;
- case K_SHIFT:
- k[j] = (kbe.kb_index == 0x36 ?
- XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- k[j] = XK_Shift_L;
- break;
- case K_SHIFTR:
- k[j] = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- k[j] = XK_Shift_Lock;
- break;
-
-#ifdef KT_X
- case KT_X:
- /* depends on new keyboard symbols in file linux/keyboard.h */
- if(kbe.kb_value == K_XMENU) k[j] = XK_Menu;
- if(kbe.kb_value == K_XTELEPHONE) k[j] = XK_telephone;
- break;
-#endif
-#ifdef KT_XF
- case KT_XF:
- /* special linux keysyms which map directly to XF86 keysyms */
- k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
- break;
-#endif
-
- default:
- break;
- }
- if (i < minKeyCode)
- minKeyCode = i;
- if (i > maxKeyCode)
- maxKeyCode = i;
- }
-
- if (minKeyCode == NR_KEYS)
- continue;
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol;
- row++;
- }
- kdMinScanCode = minKeyCode;
- kdMaxScanCode = maxKeyCode;
-}
-
-static void
-LinuxKeyboardLoad (void)
-{
- readKernelMapping ();
-}
-
-static void
-LinuxKeyboardRead (int fd, void *closure)
-{
- unsigned char buf[256], *b;
- int n;
-
- while ((n = read (fd, buf, sizeof (buf))) > 0)
- {
- b = buf;
- while (n--)
- {
- KdEnqueueKeyboardEvent (b[0] & 0x7f, b[0] & 0x80);
- b++;
- }
- }
-}
-
-static int LinuxKbdTrans;
-static struct termios LinuxTermios;
-static int LinuxKbdType;
-
-static int
-LinuxKeyboardEnable (int fd, void *closure)
-{
- struct termios nTty;
- unsigned char buf[256];
- int n;
-
- ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
- tcgetattr (fd, &LinuxTermios);
-
- ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
- nTty = LinuxTermios;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(fd, TCSANOW, &nTty);
- /*
- * Flush any pending keystrokes
- */
- while ((n = read (fd, buf, sizeof (buf))) > 0)
- ;
- return fd;
-}
-
-static void
-LinuxKeyboardDisable (int fd, void *closure)
-{
- ioctl(LinuxConsoleFd, KDSKBMODE, LinuxKbdTrans);
- tcsetattr(LinuxConsoleFd, TCSANOW, &LinuxTermios);
-}
-
-static int
-LinuxKeyboardInit (void)
-{
- if (!LinuxKbdType)
- LinuxKbdType = KdAllocInputType ();
-
- KdRegisterFd (LinuxKbdType, LinuxConsoleFd, LinuxKeyboardRead, 0);
- LinuxKeyboardEnable (LinuxConsoleFd, 0);
- KdRegisterFdEnableDisable (LinuxConsoleFd,
- LinuxKeyboardEnable,
- LinuxKeyboardDisable);
- return 1;
-}
-
-static void
-LinuxKeyboardFini (void)
-{
- LinuxKeyboardDisable (LinuxConsoleFd, 0);
- KdUnregisterFds (LinuxKbdType, FALSE);
-}
-
-static void
-LinuxKeyboardLeds (int leds)
-{
- ioctl (LinuxConsoleFd, KDSETLED, leds & 7);
-}
-
-static void
-LinuxKeyboardBell (int volume, int pitch, int duration)
-{
- if (volume && pitch)
- {
- ioctl(LinuxConsoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- volume / 50) << 16));
-
- }
-}
-
-KdKeyboardFuncs LinuxKeyboardFuncs = {
- LinuxKeyboardLoad,
- LinuxKeyboardInit,
- LinuxKeyboardLeds,
- LinuxKeyboardBell,
- LinuxKeyboardFini,
- 3,
-};
diff --git a/hw/kdrive/linux/klinux.h b/hw/kdrive/linux/klinux.h
deleted file mode 100644
index 29ebe3aa9..000000000
--- a/hw/kdrive/linux/klinux.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 _KLINUX_H_
-#define _KLINUX_H_
-
-Bool
-LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr);
-
-unsigned char *
-LinuxGetPciCfg(KdCardAttr *attr);
-
-#endif /* _KLINUX_H_ */
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
deleted file mode 100644
index 555102925..000000000
--- a/hw/kdrive/linux/linux.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/linux.c,v 1.6 2001/07/24 21:26:17 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "klinux.h"
-#include <errno.h>
-#include <signal.h>
-#include <linux/vt.h>
-#include <linux/kd.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <X11/keysym.h>
-#include <linux/apm_bios.h>
-
-static int vtno;
-int LinuxConsoleFd;
-int LinuxApmFd = -1;
-static int activeVT;
-static Bool enabled;
-
-static void
-LinuxVTRequest (int sig)
-{
- kdSwitchPending = TRUE;
-}
-
-/* Check before chowning -- this avoids touching the file system */
-static void
-LinuxCheckChown (char *file)
-{
- struct stat st;
- __uid_t u;
- __gid_t g;
-
- if (stat (file, &st) < 0)
- return;
- u = getuid ();
- g = getgid ();
- if (st.st_uid != u || st.st_gid != g)
- chown (file, u, g);
-}
-
-static int
-LinuxInit (void)
-{
- int fd = -1;
- char vtname[11];
- struct vt_stat vts;
-
- LinuxConsoleFd = -1;
- /* check if we're run with euid==0 */
- if (geteuid() != 0)
- {
- FatalError("LinuxInit: Server must be suid root\n");
- }
-
- if (kdVirtualTerminal >= 0)
- vtno = kdVirtualTerminal;
- else
- {
- if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
- {
- FatalError(
- "LinuxInit: Cannot open /dev/tty0 (%s)\n",
- strerror(errno));
- }
- if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) ||
- (vtno == -1))
- {
- FatalError("xf86OpenConsole: Cannot find a free VT\n");
- }
- }
- close(fd);
-
- sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */
-
- if ((LinuxConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
- {
- FatalError("LinuxInit: Cannot open %s (%s)\n",
- vtname, strerror(errno));
- }
-
- /* change ownership of the vt */
- LinuxCheckChown (vtname);
-
- /*
- * the current VT device we're running on is not "console", we want
- * to grab all consoles too
- *
- * Why is this needed?
- */
- LinuxCheckChown ("/dev/tty0");
- /*
- * Linux doesn't switch to an active vt after the last close of a vt,
- * so we do this ourselves by remembering which is active now.
- */
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0)
- {
- activeVT = vts.v_active;
- }
-
- return 1;
-}
-
-Bool
-LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr)
-{
- FILE *f;
- char line[2048], *l, *end;
- CARD32 bus, id, addr;
- int n;
- CARD32 ven_dev;
- Bool ret = FALSE;
- int i;
-
- ven_dev = (((CARD32) vendor) << 16) | ((CARD32) device);
- f = fopen ("/proc/bus/pci/devices", "r");
- if (!f)
- return FALSE;
- attr->io = 0;
- while (fgets (line, sizeof (line)-1, f))
- {
- line[sizeof(line)-1] = '\0';
- l = line;
- bus = strtoul (l, &end, 16);
- if (end == l)
- continue;
- l = end;
- id = strtoul (l, &end, 16);
- if (end == l)
- continue;
- l = end;
- if (id != ven_dev)
- continue;
- if (count--)
- continue;
- (void) strtoul (l, &end, 16);
- if (end == l)
- continue;
- l = end;
- n = 0;
- for (i = 0; i < 6; i++)
- {
- addr = strtoul (l, &end, 16);
- if (end == l)
- break;
- if (addr & 1)
- attr->io = addr & ~0xf;
- else
- {
- if (n == KD_MAX_CARD_ADDRESS)
- break;
- attr->address[n++] = addr & ~0xf;
- }
- l = end;
- }
- while (n > 0)
- {
- if (attr->address[n-1] != 0)
- break;
- n--;
- }
- attr->naddr = n;
- attr->bus = bus;
- ret = TRUE;
- break;
- }
- fclose (f);
- return ret;
-}
-
-unsigned char *
-LinuxGetPciCfg(KdCardAttr *attr)
-{
- char filename[256];
- FILE *f;
- unsigned char *cfg;
- int r;
-
- snprintf(filename, 255, "/proc/bus/pci/%02x/%02x.%x",
- attr->bus >> 8, (attr->bus & 0xff) >> 3, attr->bus & 7);
-/* fprintf(stderr,"Find card on path %s\n",filename); */
-
- if (!(f=fopen(filename,"r")))
- return NULL;
-
- if (!(cfg=xalloc(256)))
- {
- fclose(f);
- return NULL;
- }
-
- if (256 != (r=fread(cfg, 1, 256, f)))
- {
- fprintf(stderr,"LinuxGetPciCfg: read %d, expected 256\n",r);
- free(cfg);
- cfg=NULL;
- }
- fclose(f);
-/* fprintf(stderr,"LinuxGetPciCfg: success, returning %p\n",cfg); */
- return cfg;
-}
-
-static void
-LinuxSetSwitchMode (int mode)
-{
- struct sigaction act;
- struct vt_mode VT;
-
- if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0)
- {
- FatalError ("LinuxInit: VT_GETMODE failed\n");
- }
-
- if (mode == VT_PROCESS)
- {
- act.sa_handler = LinuxVTRequest;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction (SIGUSR1, &act, 0);
-
- VT.mode = mode;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- }
- else
- {
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction (SIGUSR1, &act, 0);
-
- VT.mode = mode;
- VT.relsig = 0;
- VT.acqsig = 0;
- }
- if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0)
- {
- FatalError("LinuxInit: VT_SETMODE failed\n");
- }
-}
-
-static void
-LinuxApmBlock (pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
-{
-}
-
-static Bool LinuxApmRunning;
-
-static void
-LinuxApmWakeup (pointer blockData, int result, pointer pReadmask)
-{
- fd_set *readmask = (fd_set *) pReadmask;
-
- if (result > 0 && LinuxApmFd >= 0 && FD_ISSET (LinuxApmFd, readmask))
- {
- apm_event_t event;
- Bool running = LinuxApmRunning;
- int cmd = APM_IOC_SUSPEND;
-
- while (read (LinuxApmFd, &event, sizeof (event)) == sizeof (event))
- {
- switch (event) {
- case APM_SYS_STANDBY:
- case APM_USER_STANDBY:
- running = FALSE;
- cmd = APM_IOC_STANDBY;
- break;
- case APM_SYS_SUSPEND:
- case APM_USER_SUSPEND:
- case APM_CRITICAL_SUSPEND:
- running = FALSE;
- cmd = APM_IOC_SUSPEND;
- break;
- case APM_NORMAL_RESUME:
- case APM_CRITICAL_RESUME:
- case APM_STANDBY_RESUME:
- running = TRUE;
- break;
- }
- }
- if (running && !LinuxApmRunning)
- {
- KdResume ();
- LinuxApmRunning = TRUE;
- }
- else if (!running && LinuxApmRunning)
- {
- KdSuspend ();
- LinuxApmRunning = FALSE;
- ioctl (LinuxApmFd, cmd, 0);
- }
- }
-}
-
-#ifdef FNONBLOCK
-#define NOBLOCK FNONBLOCK
-#else
-#define NOBLOCK FNDELAY
-#endif
-
-static void
-LinuxEnable (void)
-{
- if (enabled)
- return;
- if (kdSwitchPending)
- {
- kdSwitchPending = FALSE;
- ioctl (LinuxConsoleFd, VT_RELDISP, VT_ACKACQ);
- }
- /*
- * Open the APM driver
- */
- LinuxApmFd = open ("/dev/apm_bios", 2);
- if (LinuxApmFd < 0 && errno == ENOENT)
- LinuxApmFd = open ("/dev/misc/apm_bios", 2);
- if (LinuxApmFd >= 0)
- {
- LinuxApmRunning = TRUE;
- fcntl (LinuxApmFd, F_SETFL, fcntl (LinuxApmFd, F_GETFL) | NOBLOCK);
- RegisterBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
- AddEnabledDevice (LinuxApmFd);
- }
-
- /*
- * now get the VT
- */
- LinuxSetSwitchMode (VT_AUTO);
- if (ioctl(LinuxConsoleFd, VT_ACTIVATE, vtno) != 0)
- {
- FatalError("LinuxInit: VT_ACTIVATE failed\n");
- }
- if (ioctl(LinuxConsoleFd, VT_WAITACTIVE, vtno) != 0)
- {
- FatalError("LinuxInit: VT_WAITACTIVE failed\n");
- }
- LinuxSetSwitchMode (VT_PROCESS);
- if (ioctl(LinuxConsoleFd, KDSETMODE, KD_GRAPHICS) < 0)
- {
- FatalError("LinuxInit: KDSETMODE KD_GRAPHICS failed\n");
- }
- enabled = TRUE;
-}
-
-static Bool
-LinuxSpecialKey (KeySym sym)
-{
- struct vt_stat vts;
- int con;
-
- if (XK_F1 <= sym && sym <= XK_F12)
- {
- con = sym - XK_F1 + 1;
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
- if (con != vts.v_active && (vts.v_state & (1 << con)))
- {
- ioctl (LinuxConsoleFd, VT_ACTIVATE, con);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static void
-LinuxDisable (void)
-{
- ioctl(LinuxConsoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
- if (kdSwitchPending)
- {
- kdSwitchPending = FALSE;
- ioctl (LinuxConsoleFd, VT_RELDISP, 1);
- }
- enabled = FALSE;
- if (LinuxApmFd >= 0)
- {
- RemoveBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
- RemoveEnabledDevice (LinuxApmFd);
- close (LinuxApmFd);
- LinuxApmFd = -1;
- }
-}
-
-static void
-LinuxFini (void)
-{
- struct vt_mode VT;
- struct vt_stat vts;
- int fd;
-
- if (LinuxConsoleFd < 0)
- return;
-
- if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) != -1)
- {
- VT.mode = VT_AUTO;
- ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
- }
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
- /*
- * Find a legal VT to switch to, either the one we started from
- * or the lowest active one that isn't ours
- */
- if (activeVT < 0 ||
- activeVT == vts.v_active ||
- !(vts.v_state & (1 << activeVT)))
- {
- for (activeVT = 1; activeVT < 16; activeVT++)
- if (activeVT != vtno && (vts.v_state & (1 << activeVT)))
- break;
- if (activeVT == 16)
- activeVT = -1;
- }
- /*
- * Perform a switch back to the active VT when we were started
- */
- if (activeVT >= -1)
- {
- ioctl (LinuxConsoleFd, VT_ACTIVATE, activeVT);
- ioctl (LinuxConsoleFd, VT_WAITACTIVE, activeVT);
- activeVT = -1;
- }
- close(LinuxConsoleFd); /* make the vt-manager happy */
- fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
- if (fd >= 0)
- {
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (fd, VT_GETSTATE, &vts);
- if (ioctl (fd, VT_DISALLOCATE, vtno) < 0)
- fprintf (stderr, "Can't deallocate console %d errno %d\n", vtno, errno);
- close (fd);
- }
- return;
-}
-
-KdOsFuncs LinuxFuncs = {
- LinuxInit,
- LinuxEnable,
- LinuxSpecialKey,
- LinuxDisable,
- LinuxFini,
-};
-
-void
-OsVendorInit (void)
-{
- KdOsInit (&LinuxFuncs);
-}
diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c
deleted file mode 100644
index 1faffd27b..000000000
--- a/hw/kdrive/linux/mouse.c
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/mouse.c,v 1.6 2002/08/02 16:11:35 keithp Exp $
- *
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <errno.h>
-#include <termios.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-
-#undef DEBUG
-#undef DEBUG_BYTES
-#define KBUFIO_SIZE 256
-#define MOUSE_TIMEOUT 100
-
-typedef struct _kbufio {
- int fd;
- unsigned char buf[KBUFIO_SIZE];
- int avail;
- int used;
-} Kbufio;
-
-static Bool
-MouseWaitForReadable (int fd, int timeout)
-{
- fd_set set;
- struct timeval tv, *tp;
- int n;
- CARD32 done;
-
- done = GetTimeInMillis () + timeout;
- for (;;)
- {
- FD_ZERO (&set);
- FD_SET (fd, &set);
- if (timeout == -1)
- tp = 0;
- else
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- tp = &tv;
- }
- n = select (fd + 1, &set, 0, 0, tp);
- if (n > 0)
- return TRUE;
- if (n < 0 && (errno == EAGAIN || errno == EINTR))
- {
- timeout = (int) (done - GetTimeInMillis ());
- if (timeout > 0)
- continue;
- }
- break;
- }
- return FALSE;
-}
-
-static int
-MouseReadByte (Kbufio *b, int timeout)
-{
- int n;
- if (b->avail <= b->used)
- {
- if (timeout && !MouseWaitForReadable (b->fd, timeout))
- {
-#ifdef DEBUG_BYTES
- ErrorF ("\tTimeout %d\n", timeout);
-#endif
- return -1;
- }
- n = read (b->fd, b->buf, KBUFIO_SIZE);
- if (n <= 0)
- return -1;
- b->avail = n;
- b->used = 0;
- }
-#ifdef DEBUG_BYTES
- ErrorF ("\tget %02x\n", b->buf[b->used]);
-#endif
- return b->buf[b->used++];
-}
-
-#if NOTUSED
-static int
-MouseFlush (Kbufio *b, char *buf, int size)
-{
- CARD32 now = GetTimeInMillis ();
- CARD32 done = now + 100;
- int c;
- int n = 0;
-
- while ((c = MouseReadByte (b, done - now)) != -1)
- {
- if (buf)
- {
- if (n == size)
- {
- memmove (buf, buf + 1, size - 1);
- n--;
- }
- buf[n++] = c;
- }
- now = GetTimeInMillis ();
- if ((INT32) (now - done) >= 0)
- break;
- }
- return n;
-}
-
-static int
-MousePeekByte (Kbufio *b, int timeout)
-{
- int c;
-
- c = MouseReadByte (b, timeout);
- if (c != -1)
- --b->used;
- return c;
-}
-#endif /* NOTUSED */
-
-static Bool
-MouseWaitForWritable (int fd, int timeout)
-{
- fd_set set;
- struct timeval tv, *tp;
- int n;
-
- FD_ZERO (&set);
- FD_SET (fd, &set);
- if (timeout == -1)
- tp = 0;
- else
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- tp = &tv;
- }
- n = select (fd + 1, 0, &set, 0, tp);
- if (n > 0)
- return TRUE;
- return FALSE;
-}
-
-static Bool
-MouseWriteByte (int fd, unsigned char c, int timeout)
-{
- int ret;
-
-#ifdef DEBUG_BYTES
- ErrorF ("\tput %02x\n", c);
-#endif
- for (;;)
- {
- ret = write (fd, &c, 1);
- if (ret == 1)
- return TRUE;
- if (ret == 0)
- return FALSE;
- if (errno != EWOULDBLOCK)
- return FALSE;
- if (!MouseWaitForWritable (fd, timeout))
- return FALSE;
- }
-}
-
-static Bool
-MouseWriteBytes (int fd, unsigned char *c, int n, int timeout)
-{
- while (n--)
- if (!MouseWriteByte (fd, *c++, timeout))
- return FALSE;
- return TRUE;
-}
-
-#define MAX_MOUSE 10 /* maximum length of mouse protocol */
-#define MAX_SKIP 16 /* number of error bytes before switching */
-#define MAX_VALID 4 /* number of valid packets before accepting */
-
-typedef struct _kmouseProt {
- char *name;
- Bool (*Complete) (KdMouseInfo *mi, unsigned char *ev, int ne);
- int (*Valid) (KdMouseInfo *mi, unsigned char *ev, int ne);
- Bool (*Parse) (KdMouseInfo *mi, unsigned char *ev, int ne);
- Bool (*Init) (KdMouseInfo *mi);
- unsigned char headerMask, headerValid;
- unsigned char dataMask, dataValid;
- Bool tty;
- unsigned int c_iflag;
- unsigned int c_oflag;
- unsigned int c_lflag;
- unsigned int c_cflag;
- unsigned int speed;
- unsigned char *init;
- unsigned long state;
-} KmouseProt;
-
-typedef enum _kmouseStage {
- MouseBroken, MouseTesting, MouseWorking
-} KmouseStage;
-
-typedef struct _kmouse {
- Kbufio iob;
- const KmouseProt *prot;
- int i_prot;
- KmouseStage stage; /* protocol verification stage */
- Bool tty; /* mouse device is a tty */
- int valid; /* sequential valid events */
- int tested; /* bytes scanned during Testing phase */
- int invalid;/* total invalid bytes for this protocol */
- unsigned long state; /* private per protocol, init to prot->state */
-} Kmouse;
-
-static int mouseValid (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- const KmouseProt *prot = km->prot;
- int i;
-
- for (i = 0; i < ne; i++)
- if ((ev[i] & prot->headerMask) == prot->headerValid)
- break;
- if (i != 0)
- return i;
- for (i = 1; i < ne; i++)
- if ((ev[i] & prot->dataMask) != prot->dataValid)
- return -1;
- return 0;
-}
-
-static Bool threeComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- return ne == 3;
-}
-
-static Bool fourComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- return ne == 4;
-}
-
-static Bool fiveComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- return ne == 5;
-}
-
-static Bool MouseReasonable (KdMouseInfo *mi, unsigned long flags, int dx, int dy)
-{
- Kmouse *km = mi->driver;
-
- if (km->stage == MouseWorking)
- return TRUE;
- if (dx < -50 || dx > 50)
- {
-#ifdef DEBUG
- ErrorF ("Large X %d\n", dx);
-#endif
- return FALSE;
- }
- if (dy < -50 || dy > 50)
- {
-#ifdef DEBUG
- ErrorF ("Large Y %d\n", dy);
-#endif
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * Standard PS/2 mouse protocol
- */
-static Bool ps2Parse (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- int dx, dy, dz;
- unsigned long flags;
- unsigned long flagsrelease = 0;
-
- flags = KD_MOUSE_DELTA;
- if (ev[0] & 4)
- flags |= KD_BUTTON_2;
- if (ev[0] & 2)
- flags |= KD_BUTTON_3;
- if (ev[0] & 1)
- flags |= KD_BUTTON_1;
-
- if (ne > 3)
- {
- dz = (int) (signed char) ev[3];
- if (dz < 0)
- {
- flags |= KD_BUTTON_4;
- flagsrelease = KD_BUTTON_4;
- }
- else if (dz > 0)
- {
- flags |= KD_BUTTON_5;
- flagsrelease = KD_BUTTON_5;
- }
- }
-
- dx = ev[1];
- if (ev[0] & 0x10)
- dx -= 256;
- dy = ev[2];
- if (ev[0] & 0x20)
- dy -= 256;
- dy = -dy;
- if (!MouseReasonable (mi, flags, dx, dy))
- return FALSE;
- if (km->stage == MouseWorking)
- {
- KdEnqueueMouseEvent (mi, flags, dx, dy);
- if (flagsrelease)
- {
- flags &= ~flagsrelease;
- KdEnqueueMouseEvent (mi, flags, dx, dy);
- }
- }
- return TRUE;
-}
-
-static Bool ps2Init (KdMouseInfo *mi);
-
-static const KmouseProt ps2Prot = {
- "ps/2",
- threeComplete, mouseValid, ps2Parse, ps2Init,
- 0x08, 0x08, 0x00, 0x00,
- FALSE
-};
-
-static const KmouseProt imps2Prot = {
- "imps/2",
- fourComplete, mouseValid, ps2Parse, ps2Init,
- 0x08, 0x08, 0x00, 0x00,
- FALSE
-};
-
-static const KmouseProt exps2Prot = {
- "exps/2",
- fourComplete, mouseValid, ps2Parse, ps2Init,
- 0x08, 0x08, 0x00, 0x00,
- FALSE
-};
-
-/*
- * Once the mouse is known to speak ps/2 protocol, go and find out
- * what advanced capabilities it has and turn them on
- */
-
-/* these extracted from FreeBSD 4.3 sys/dev/kbd/atkbdcreg.h */
-
-/* aux device commands (sent to KBD_DATA_PORT) */
-#define PSMC_SET_SCALING11 0x00e6
-#define PSMC_SET_SCALING21 0x00e7
-#define PSMC_SET_RESOLUTION 0x00e8
-#define PSMC_SEND_DEV_STATUS 0x00e9
-#define PSMC_SET_STREAM_MODE 0x00ea
-#define PSMC_SEND_DEV_DATA 0x00eb
-#define PSMC_SET_REMOTE_MODE 0x00f0
-#define PSMC_SEND_DEV_ID 0x00f2
-#define PSMC_SET_SAMPLING_RATE 0x00f3
-#define PSMC_ENABLE_DEV 0x00f4
-#define PSMC_DISABLE_DEV 0x00f5
-#define PSMC_SET_DEFAULTS 0x00f6
-#define PSMC_RESET_DEV 0x00ff
-
-/* PSMC_SET_RESOLUTION argument */
-#define PSMD_RES_LOW 0 /* typically 25ppi */
-#define PSMD_RES_MEDIUM_LOW 1 /* typically 50ppi */
-#define PSMD_RES_MEDIUM_HIGH 2 /* typically 100ppi (default) */
-#define PSMD_RES_HIGH 3 /* typically 200ppi */
-#define PSMD_MAX_RESOLUTION PSMD_RES_HIGH
-
-/* PSMC_SET_SAMPLING_RATE */
-#define PSMD_MAX_RATE 255 /* FIXME: not sure if it's possible */
-
-/* aux device ID */
-#define PSM_MOUSE_ID 0
-#define PSM_BALLPOINT_ID 2
-#define PSM_INTELLI_ID 3
-#define PSM_EXPLORER_ID 4
-#define PSM_4DMOUSE_ID 6
-#define PSM_4DPLUS_ID 8
-
-static unsigned char ps2_init[] = {
- PSMC_ENABLE_DEV,
- 0,
-};
-
-#define NINIT_PS2 1
-
-static unsigned char wheel_3button_init[] = {
- PSMC_SET_SAMPLING_RATE, 200,
- PSMC_SET_SAMPLING_RATE, 100,
- PSMC_SET_SAMPLING_RATE, 80,
- PSMC_SEND_DEV_ID,
- 0,
-};
-
-#define NINIT_IMPS2 4
-
-static unsigned char wheel_5button_init[] = {
- PSMC_SET_SAMPLING_RATE, 200,
- PSMC_SET_SAMPLING_RATE, 100,
- PSMC_SET_SAMPLING_RATE, 80,
- PSMC_SET_SAMPLING_RATE, 200,
- PSMC_SET_SAMPLING_RATE, 200,
- PSMC_SET_SAMPLING_RATE, 80,
- PSMC_SEND_DEV_ID,
- 0
-};
-
-#define NINIT_EXPS2 7
-
-static unsigned char intelli_init[] = {
- PSMC_SET_SAMPLING_RATE, 200,
- PSMC_SET_SAMPLING_RATE, 100,
- PSMC_SET_SAMPLING_RATE, 80,
- 0
-};
-
-#define NINIT_INTELLI 3
-
-static int
-ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next)
-{
- Kmouse *km = mi->driver;
- int c = -1;
- int skipping;
- Bool waiting;
-
- skipping = 0;
- waiting = FALSE;
- while (ninit || ret_next)
- {
- c = MouseReadByte (&km->iob, MOUSE_TIMEOUT);
- if (c == -1)
- break;
- /* look for ACK */
- if (c == 0xfa)
- {
- ninit--;
- if (ret_next)
- waiting = TRUE;
- }
- /* look for packet start -- not the response */
- else if ((c & 0x08) == 0x08)
- waiting = FALSE;
- else if (waiting)
- break;
- }
- return c;
-}
-
-static Bool
-ps2Init (KdMouseInfo *mi)
-{
- Kmouse *km = mi->driver;
- int skipping;
- Bool waiting;
- int id;
- unsigned char *init;
- int ninit;
-
- /* Send Intellimouse initialization sequence */
- MouseWriteBytes (km->iob.fd, intelli_init, strlen (intelli_init), 100);
- /*
- * Send ID command
- */
- if (!MouseWriteByte (km->iob.fd, PSMC_SEND_DEV_ID, 100))
- return FALSE;
- skipping = 0;
- waiting = FALSE;
- id = ps2SkipInit (mi, 0, TRUE);
- switch (id) {
- case 3:
- init = wheel_3button_init;
- ninit = NINIT_IMPS2;
- km->prot = &imps2Prot;
- break;
- case 4:
- init = wheel_5button_init;
- ninit = NINIT_EXPS2;
- km->prot = &exps2Prot;
- break;
- default:
- init = ps2_init;
- ninit = NINIT_PS2;
- km->prot = &ps2Prot;
- break;
- }
- if (init)
- MouseWriteBytes (km->iob.fd, init, strlen (init), 100);
- /*
- * Flush out the available data to eliminate responses to the
- * initialization string. Make sure any partial event is
- * skipped
- */
- (void) ps2SkipInit (mi, ninit, FALSE);
- return TRUE;
-}
-
-static Bool busParse (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- int dx, dy;
- unsigned long flags;
-
- flags = KD_MOUSE_DELTA;
- dx = (signed char) ev[1];
- dy = -(signed char) ev[2];
- if ((ev[0] & 4) == 0)
- flags |= KD_BUTTON_1;
- if ((ev[0] & 2) == 0)
- flags |= KD_BUTTON_2;
- if ((ev[0] & 1) == 0)
- flags |= KD_BUTTON_3;
- if (!MouseReasonable (mi, flags, dx, dy))
- return FALSE;
- if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
- return TRUE;
-}
-
-static const KmouseProt busProt = {
- "bus",
- threeComplete, mouseValid, busParse, 0,
- 0xf8, 0x00, 0x00, 0x00,
- FALSE
-};
-
-/*
- * Standard MS serial protocol, three bytes
- */
-
-static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- int dx, dy;
- unsigned long flags;
-
- flags = KD_MOUSE_DELTA;
-
- if (ev[0] & 0x20)
- flags |= KD_BUTTON_1;
- if (ev[0] & 0x10)
- flags |= KD_BUTTON_3;
-
- dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
- dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
- if (!MouseReasonable (mi, flags, dx, dy))
- return FALSE;
- if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
- return TRUE;
-}
-
-static const KmouseProt msProt = {
- "ms",
- threeComplete, mouseValid, msParse, 0,
- 0xc0, 0x40, 0xc0, 0x00,
- TRUE,
- IGNPAR,
- 0,
- 0,
- CS7 | CSTOPB | CREAD | CLOCAL,
- B1200,
-};
-
-/*
- * Logitech mice send 3 or 4 bytes, the only way to tell is to look at the
- * first byte of a synchronized protocol stream and see if it's got
- * any bits turned on that can't occur in that fourth byte
- */
-static Bool logiComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
-
- if ((ev[0] & 0x40) == 0x40)
- return ne == 3;
- if (km->stage != MouseBroken && (ev[0] & ~0x23) == 0)
- return ne == 1;
- return FALSE;
-}
-
-static int logiValid (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- const KmouseProt *prot = km->prot;
- int i;
-
- for (i = 0; i < ne; i++)
- {
- if ((ev[i] & 0x40) == 0x40)
- break;
- if (km->stage != MouseBroken && (ev[i] & ~0x23) == 0)
- break;
- }
- if (i != 0)
- return i;
- for (i = 1; i < ne; i++)
- if ((ev[i] & prot->dataMask) != prot->dataValid)
- return -1;
- return 0;
-}
-
-static Bool logiParse (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- int dx, dy;
- unsigned long flags;
-
- flags = KD_MOUSE_DELTA;
-
- if (ne == 3)
- {
- if (ev[0] & 0x20)
- flags |= KD_BUTTON_1;
- if (ev[0] & 0x10)
- flags |= KD_BUTTON_3;
-
- dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
- dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
- flags |= km->state & KD_BUTTON_2;
- }
- else
- {
- if (ev[0] & 0x20)
- flags |= KD_BUTTON_2;
- dx = 0;
- dy = 0;
- flags |= km->state & (KD_BUTTON_1|KD_BUTTON_3);
- }
-
- if (!MouseReasonable (mi, flags, dx, dy))
- return FALSE;
- if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
- return TRUE;
-}
-
-static const KmouseProt logiProt = {
- "logitech",
- logiComplete, logiValid, logiParse, 0,
- 0xc0, 0x40, 0xc0, 0x00,
- TRUE,
- IGNPAR,
- 0,
- 0,
- CS7 | CSTOPB | CREAD | CLOCAL,
- B1200,
-};
-
-/*
- * Mouse systems protocol, 5 bytes
- */
-static Bool mscParse (KdMouseInfo *mi, unsigned char *ev, int ne)
-{
- Kmouse *km = mi->driver;
- int dx, dy;
- unsigned long flags;
-
- flags = KD_MOUSE_DELTA;
-
- if (!(ev[0] & 0x4))
- flags |= KD_BUTTON_1;
- if (!(ev[0] & 0x2))
- flags |= KD_BUTTON_2;
- if (!(ev[0] & 0x1))
- flags |= KD_BUTTON_3;
- dx = (signed char)(ev[1]) + (signed char)(ev[3]);
- dy = - ((signed char)(ev[2]) + (signed char)(ev[4]));
-
- if (!MouseReasonable (mi, flags, dx, dy))
- return FALSE;
- if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
- return TRUE;
-}
-
-static const KmouseProt mscProt = {
- "msc",
- fiveComplete, mouseValid, mscParse, 0,
- 0xf8, 0x80, 0x00, 0x00,
- TRUE,
- IGNPAR,
- 0,
- 0,
- CS8 | CSTOPB | CREAD | CLOCAL,
- B1200,
-};
-
-/*
- * Use logitech before ms -- they're the same except that
- * logitech sometimes has a fourth byte
- */
-static const KmouseProt *kmouseProts[] = {
- &ps2Prot, &imps2Prot, &exps2Prot, &busProt, &logiProt, &msProt, &mscProt,
-};
-
-#define NUM_PROT (sizeof (kmouseProts) / sizeof (kmouseProts[0]))
-
-static void
-MouseInitProtocol (Kmouse *km)
-{
- int ret;
- struct termios t;
-
- if (km->prot->tty)
- {
- ret = tcgetattr (km->iob.fd, &t);
-
- if (ret >= 0)
- {
- t.c_iflag = km->prot->c_iflag;
- t.c_oflag = km->prot->c_oflag;
- t.c_lflag = km->prot->c_lflag;
- t.c_cflag = km->prot->c_cflag;
- cfsetispeed (&t, km->prot->speed);
- cfsetospeed (&t, km->prot->speed);
- ret = tcsetattr (km->iob.fd, TCSANOW, &t);
- }
- }
- km->stage = MouseBroken;
- km->valid = 0;
- km->tested = 0;
- km->invalid = 0;
- km->state = km->prot->state;
-}
-
-static void
-MouseFirstProtocol (Kmouse *km, char *prot)
-{
- if (prot)
- {
- for (km->i_prot = 0; km->i_prot < NUM_PROT; km->i_prot++)
- if (!strcmp (prot, kmouseProts[km->i_prot]->name))
- break;
- if (km->i_prot == NUM_PROT)
- {
- int i;
- ErrorF ("Unknown mouse protocol \"%s\". Pick one of:", prot);
- for (i = 0; i < NUM_PROT; i++)
- ErrorF (" %s", kmouseProts[i]->name);
- ErrorF ("\n");
- }
- else
- {
- km->prot = kmouseProts[km->i_prot];
- if (km->tty && !km->prot->tty)
- ErrorF ("Mouse device is serial port, protocol %s is not serial protocol\n",
- prot);
- else if (!km->tty && km->prot->tty)
- ErrorF ("Mouse device is not serial port, protocol %s is serial protocol\n",
- prot);
- }
- }
- if (!km->prot)
- {
- for (km->i_prot = 0; kmouseProts[km->i_prot]->tty != km->tty; km->i_prot++)
- ;
- km->prot = kmouseProts[km->i_prot];
- }
- MouseInitProtocol (km);
-}
-
-static void
-MouseNextProtocol (Kmouse *km)
-{
- do
- {
- if (!km->prot)
- km->i_prot = 0;
- else
- if (++km->i_prot == NUM_PROT) km->i_prot = 0;
- km->prot = kmouseProts[km->i_prot];
- } while (km->prot->tty != km->tty);
- MouseInitProtocol (km);
- ErrorF ("Switching to mouse protocol \"%s\"\n", km->prot->name);
-}
-
-static void
-MouseRead (int mousePort, void *closure)
-{
- KdMouseInfo *mi = closure;
- Kmouse *km = mi->driver;
- unsigned char event[MAX_MOUSE];
- int ne;
- int c;
- int i;
- int timeout;
-
- timeout = 0;
- ne = 0;
- for(;;)
- {
- c = MouseReadByte (&km->iob, timeout);
- if (c == -1)
- {
- if (ne)
- {
- km->invalid += ne + km->tested;
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseBroken;
- }
- break;
- }
- event[ne++] = c;
- i = (*km->prot->Valid) (mi, event, ne);
- if (i != 0)
- {
-#ifdef DEBUG
- ErrorF ("Mouse protocol %s broken %d of %d bytes bad\n",
- km->prot->name, i > 0 ? i : ne, ne);
-#endif
- if (i > 0 && i < ne)
- {
- ne -= i;
- memmove (event, event + i, ne);
- }
- else
- {
- i = ne;
- ne = 0;
- }
- km->invalid += i + km->tested;
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseBroken;
- if (km->invalid > MAX_SKIP)
- {
- MouseNextProtocol (km);
- ne = 0;
- }
- timeout = 0;
- }
- else
- {
- if ((*km->prot->Complete) (mi, event, ne))
- {
- if ((*km->prot->Parse) (mi, event, ne))
- {
- switch (km->stage)
- {
- case MouseBroken:
-#ifdef DEBUG
- ErrorF ("Mouse protocol %s seems OK\n",
- km->prot->name);
-#endif
- /* do not zero invalid to accumulate invalid bytes */
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseTesting;
- /* fall through ... */
- case MouseTesting:
- km->valid++;
- km->tested += ne;
- if (km->valid > MAX_VALID)
- {
-#ifdef DEBUG
- ErrorF ("Mouse protocol %s working\n",
- km->prot->name);
-#endif
- km->stage = MouseWorking;
- km->invalid = 0;
- km->tested = 0;
- km->valid = 0;
- if (km->prot->Init && !(*km->prot->Init) (mi))
- km->stage = MouseBroken;
- }
- break;
- case MouseWorking:
- break;
- }
- }
- else
- {
- km->invalid += ne + km->tested;
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseBroken;
- }
- ne = 0;
- timeout = 0;
- }
- else
- timeout = MOUSE_TIMEOUT;
- }
- }
-}
-
-int MouseInputType;
-
-char *kdefaultMouse[] = {
- "/dev/mouse",
- "/dev/psaux",
- "/dev/input/mice",
- "/dev/adbmouse",
- "/dev/ttyS0",
- "/dev/ttyS1",
-};
-
-#define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0]))
-
-static Bool
-MouseInit (void)
-{
- int i;
- int fd;
- Kmouse *km;
- KdMouseInfo *mi, *next;
- int n = 0;
- char *prot;
-
- if (!MouseInputType)
- MouseInputType = KdAllocInputType ();
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
- prot = mi->prot;
- if (mi->inputType)
- continue;
- if (!mi->name)
- {
- for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
- {
- fd = open (kdefaultMouse[i], 2);
- if (fd >= 0)
- {
- mi->name = KdSaveString (kdefaultMouse[i]);
- break;
- }
- }
- }
- else
- fd = open (mi->name, 2);
-
- if (fd >= 0)
- {
- km = (Kmouse *) xalloc (sizeof (Kmouse));
- if (km)
- {
- km->iob.fd = fd;
- km->iob.avail = km->iob.used = 0;
- km->prot = 0;
- km->i_prot = 0;
- km->tty = isatty (fd);
- mi->driver = km;
- mi->inputType = MouseInputType;
- MouseFirstProtocol (km, mi->prot);
- if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi))
- n++;
- }
- else
- close (fd);
- }
- }
- return TRUE;
-}
-
-static void
-MouseFini (void)
-{
- KdMouseInfo *mi;
-
- KdUnregisterFds (MouseInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == MouseInputType)
- {
- xfree (mi->driver);
- mi->driver = 0;
- mi->inputType = 0;
- }
- }
-}
-
-KdMouseFuncs LinuxMouseFuncs = {
- MouseInit,
- MouseFini,
-};
diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
deleted file mode 100644
index b29f6527b..000000000
--- a/hw/kdrive/linux/ms.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-Copyright (c) 2001 by Juliusz Chroboczek
-Copyright (c) 1999 by Keith Packard
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-/* $RCSId: xc/programs/Xserver/hw/kdrive/linux/ms.c,v 1.1 2001/08/09 20:45:15 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <errno.h>
-#include <termios.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-
-static int
-MsReadBytes (int fd, char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
- }
- return tot;
-}
-
-static void
-MsRead (int port, void *closure)
-{
- unsigned char buf[3 * 200];
- unsigned char *b;
- int n;
- int dx, dy;
- unsigned long flags;
-
- while ((n = MsReadBytes (port, buf, sizeof (buf), 3)) > 0)
- {
- b = buf;
- while (n >= 3)
- {
- flags = KD_MOUSE_DELTA;
-
- if (b[0] & 0x20)
- flags |= KD_BUTTON_1;
- if (b[0] & 0x10)
- flags |= KD_BUTTON_3;
-
- dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3F));
- dy = (char)(((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
- n -= 3;
- b += 3;
- KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
- }
- }
-}
-
-int MsInputType;
-
-static int
-MsInit (void)
-{
- int port;
- char *device = "/dev/mouse";
- struct termios t;
- int ret;
-
- if (!MsInputType)
- MsInputType = KdAllocInputType ();
- port = open (device, O_RDWR | O_NONBLOCK);
- if(port < 0) {
- ErrorF("Couldn't open %s (%d)\n", device, (int)errno);
- return 0;
- } else if (port == 0) {
- ErrorF("Opening %s returned 0! Please complain to Keith.\n",
- device);
- goto bail;
- }
-
- if(!isatty(port)) {
- ErrorF("%s is not a tty\n", device);
- goto bail;
- }
-
- ret = tcgetattr(port, &t);
- if(ret < 0) {
- ErrorF("Couldn't tcgetattr(%s): %d\n", device, errno);
- goto bail;
- }
- t.c_iflag &= ~ (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
- IGNCR | ICRNL | IXON | IXOFF);
- t.c_oflag &= ~ OPOST;
- t.c_lflag &= ~ (ECHO | ECHONL | ICANON | ISIG | IEXTEN);
- t.c_cflag &= ~ (CSIZE | PARENB);
- t.c_cflag |= CS8 | CLOCAL | CSTOPB;
-
- cfsetispeed (&t, B1200);
- cfsetospeed (&t, B1200);
- t.c_cc[VMIN] = 1;
- t.c_cc[VTIME] = 0;
- ret = tcsetattr(port, TCSANOW, &t);
- if(ret < 0) {
- ErrorF("Couldn't tcsetattr(%s): %d\n", device, errno);
- goto bail;
- }
- if (KdRegisterFd (MsInputType, port, MsRead, (void *) 0))
- return 1;
-
- bail:
- close(port);
- return 0;
-}
-
-static void
-MsFini (void)
-{
- KdUnregisterFds (MsInputType, TRUE);
-}
-
-KdMouseFuncs MsMouseFuncs = {
- MsInit,
- MsFini
-};
diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
deleted file mode 100644
index da3372011..000000000
--- a/hw/kdrive/linux/ps2.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/ps2.c,v 1.6 2001/10/12 06:33:10 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-
-static int
-Ps2ReadBytes (int fd, char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
- }
- return tot;
-}
-
-char *Ps2Names[] = {
- "/dev/psaux",
-/* "/dev/mouse", */
- "/dev/input/mice",
-};
-
-#define NUM_PS2_NAMES (sizeof (Ps2Names) / sizeof (Ps2Names[0]))
-
-static void
-Ps2Read (int ps2Port, void *closure)
-{
- unsigned char buf[3 * 200];
- unsigned char *b;
- int n;
- int dx, dy;
- unsigned long flags;
- unsigned long left_button = KD_BUTTON_1;
- unsigned long right_button = KD_BUTTON_3;
-
-#undef SWAP_USB
-#ifdef SWAP_USB
- if (id == 2)
- {
- left_button = KD_BUTTON_3;
- right_button = KD_BUTTON_1;
- }
-#endif
- while ((n = Ps2ReadBytes (ps2Port, buf, sizeof (buf), 3)) > 0)
- {
- b = buf;
- while (n >= 3)
- {
- flags = KD_MOUSE_DELTA;
- if (b[0] & 4)
- flags |= KD_BUTTON_2;
- if (b[0] & 2)
- flags |= right_button;
- if (b[0] & 1)
- flags |= left_button;
-
- dx = b[1];
- if (b[0] & 0x10)
- dx -= 256;
- dy = b[2];
- if (b[0] & 0x20)
- dy -= 256;
- dy = -dy;
- n -= 3;
- b += 3;
- KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
- }
- }
-}
-
-int Ps2InputType;
-
-static int
-Ps2Init (void)
-{
- int i;
- int ps2Port;
- int n;
-
- if (!Ps2InputType)
- Ps2InputType = KdAllocInputType ();
- n = 0;
- for (i = 0; i < NUM_PS2_NAMES; i++)
- {
- ps2Port = open (Ps2Names[i], 0);
- if (ps2Port >= 0)
- {
- if (KdRegisterFd (Ps2InputType, ps2Port, Ps2Read, (void *) i))
- n++;
- }
- }
- return n;
-}
-
-static void
-Ps2Fini (void)
-{
- KdUnregisterFds (Ps2InputType, TRUE);
-}
-
-KdMouseFuncs Ps2MouseFuncs = {
- Ps2Init,
- Ps2Fini
-};
diff --git a/hw/kdrive/linux/ts.c b/hw/kdrive/linux/ts.c
deleted file mode 100644
index 9051c0d61..000000000
--- a/hw/kdrive/linux/ts.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/ts.c,v 1.9 2002/08/15 18:07:48 keithp Exp $
- *
- * Derived from ps2.c by Jim Gettys
- *
- * Copyright © 1999 Keith Packard
- * Copyright © 2000 Compaq Computer Corporation
- *
- * 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 Keith Packard or Compaq not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard and Compaq makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-#include <sys/ioctl.h>
-#include <linux/h3600_ts.h> /* touch screen events */
-
-static long lastx = 0, lasty = 0;
-
-int KdTsPhyScreen = 0;
-
-static int
-TsReadBytes (int fd, char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
- }
- return tot;
-}
-
-static void
-TsRead (int tsPort, void *closure)
-{
- KdMouseInfo *mi = closure;
- TS_EVENT event;
- int n;
- long x, y;
- unsigned long flags;
-
- n = TsReadBytes (tsPort, (char *) &event, sizeof (event), sizeof (event));
- if (n == sizeof (event))
- {
- if (event.pressure)
- {
- /*
- * HACK ATTACK. (static global variables used !)
- * Here we test for the touch screen driver actually being on the
- * touch screen, if it is we send absolute coordinates. If not,
- * then we send delta's so that we can track the entire vga screen.
- */
- if (KdCurScreen == KdTsPhyScreen) {
- flags = KD_BUTTON_1;
- x = event.x;
- y = event.y;
- }
- else
- {
- flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA;
- if ((lastx == 0) || (lasty == 0)) {
- x = 0;
- y = 0;
- } else {
- x = event.x - lastx;
- y = event.y - lasty;
- }
- lastx = event.x;
- lasty = event.y;
- }
- } else {
- flags = KD_MOUSE_DELTA;
- x = 0;
- y = 0;
- lastx = 0;
- lasty = 0;
- }
- KdEnqueueMouseEvent (mi, flags, x, y);
- }
-}
-
-char *TsNames[] = {
- "/dev/ts",
- "/dev/h3600_ts" /* temporary name; note this code can try
- to open more than one device */
-};
-
-#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
-
-int TsInputType;
-
-static int
-TsEnable (int fd, void *closure)
-{
- KdMouseInfo *mi = (KdMouseInfo *)closure;
-
- return open (mi->name, 0);
-}
-
-static void
-TsDisable (int fd, void *closure)
-{
- close (fd);
-}
-
-static int
-TsInit (void)
-{
- int i;
- int fd;
- KdMouseInfo *mi, *next;
- int n = 0;
-
- if (!TsInputType)
- TsInputType = KdAllocInputType ();
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
- if (mi->inputType)
- continue;
- if (!mi->name)
- {
- for (i = 0; i < NUM_TS_NAMES; i++)
- {
- fd = open (TsNames[i], 0);
- if (fd >= 0)
- {
- mi->name = KdSaveString (TsNames[i]);
- break;
- }
- }
- }
- else
- fd = open (mi->name, 0);
- if (fd >= 0)
- {
- struct h3600_ts_calibration cal;
- /*
- * Check to see if this is a touch screen
- */
- if (ioctl (fd, TS_GET_CAL, &cal) != -1)
- {
- mi->driver = (void *) fd;
- mi->inputType = TsInputType;
- if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
- {
- /* Set callbacks for vt switches etc */
- KdRegisterFdEnableDisable (fd, TsEnable, TsDisable);
-
- n++;
- }
- }
- else
- close (fd);
- }
- }
-
- return 0;
-}
-
-static void
-TsFini (void)
-{
- KdMouseInfo *mi;
-
- KdUnregisterFds (TsInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == TsInputType)
- {
- mi->driver = 0;
- mi->inputType = 0;
- }
- }
-}
-
-KdMouseFuncs TsFuncs = {
- TsInit,
- TsFini
-};
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
deleted file mode 100644
index 7d8bfdf84..000000000
--- a/hw/kdrive/linux/tslib.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/tslib.c,v 1.1 2002/11/01 22:27:49 keithp Exp $
- * TSLIB based touchscreen driver for TinyX
- * Derived from ts.c by Keith Packard
- * Derived from ps2.c by Jim Gettys
- *
- * Copyright © 1999 Keith Packard
- * Copyright © 2000 Compaq Computer Corporation
- * Copyright © 2002 MontaVista Software Inc.
- *
- * 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 Keith Packard or Compaq not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard and Compaq makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL KEITH PACKARD 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.
- *
- * 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 Michael Taht or MontaVista not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Michael Taht and Montavista make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * MICHAEL TAHT AND MONTAVISTA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL EITHER 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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-#include <sys/ioctl.h>
-#include <tslib.h>
-
-static long lastx = 0, lasty = 0;
-static struct tsdev *tsDev = NULL;
-
-/* extern int TSLibWantRawData; */
-
-int KdTsPhyScreen = 0;
-
-static void
-TsRead (int tsPort, void *closure)
-{
- KdMouseInfo *mi = closure;
- struct ts_sample event;
- int n;
- long x, y;
- unsigned long flags;
-
- /*
- if (TSLibWantRawData)
- n = ts_read_raw(tsDev, &event, 1);
- else
- */
-
- n = ts_read(tsDev, &event, 1);
-
- if (n == 1)
- {
- if (event.pressure)
- {
- /*
- * HACK ATTACK. (static global variables used !)
- * Here we test for the touch screen driver actually being on the
- * touch screen, if it is we send absolute coordinates. If not,
- * then we send delta's so that we can track the entire vga screen.
- */
- if (KdCurScreen == KdTsPhyScreen) {
- flags = KD_BUTTON_1;
- x = event.x;
- y = event.y;
- } else {
- flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA;
- if ((lastx == 0) || (lasty == 0)) {
- x = 0;
- y = 0;
- } else {
- x = event.x - lastx;
- y = event.y - lasty;
- }
- lastx = event.x;
- lasty = event.y;
- }
- } else {
- flags = KD_MOUSE_DELTA;
- x = 0;
- y = 0;
- lastx = 0;
- lasty = 0;
- }
-
- KdEnqueueMouseEvent (mi, flags, x, y);
- }
-}
-
-static char *TsNames[] = {
- NULL,
- "/dev/ts",
- "/dev/touchscreen/0",
-};
-
-#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
-
-int TsInputType;
-
-static int
-TslibEnable (int not_needed_fd, void *closure)
-{
- KdMouseInfo *mi = closure;
- int fd = 0;
-
- fprintf(stderr, "%s() called\n", __func__);
-
- if(!(tsDev = ts_open(mi->name, 0))) {
- fprintf(stderr, "%s() failed to open %s\n", __func__, mi->name );
- return -1; /* XXX Not sure what to return here */
- }
-
- ts_config(tsDev);
- fd=ts_fd(tsDev);
-
- return fd;
-}
-
-static void
-TslibDisable (int fd, void *closure)
-{
- ts_close(tsDev);
-}
-
-static int
-TslibInit (void)
-{
- int i, j = 0;
- KdMouseInfo *mi, *next;
- int fd= 0;
- int n = 0;
-
- if (!TsInputType)
- TsInputType = KdAllocInputType ();
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
- if (mi->inputType)
- continue;
-
- /* Check for tslib env var device setting */
- if ((TsNames[0] = getenv("TSLIB_TSDEVICE")) == NULL)
- j++;
-
- if (!mi->name)
- {
- for (i = j; i < NUM_TS_NAMES; i++)
- {
-
- /* XXX Should check for */
-
- if(!(tsDev = ts_open(TsNames[i],0))) continue;
- ts_config(tsDev);
- fd=ts_fd(tsDev);
- if (fd >= 0)
- {
- mi->name = KdSaveString (TsNames[i]);
- break;
- }
- }
- } else {
-
- if(!(tsDev = ts_open(mi->name,0)))
- continue;
- ts_config(tsDev);
- fd=ts_fd(tsDev);
-
- }
-
- if (fd > 0 && tsDev != 0)
- {
- mi->driver = (void *) fd;
- mi->inputType = TsInputType;
- if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
- n++;
-
- /* Set callbacks for vt switches etc */
- KdRegisterFdEnableDisable (fd, TslibEnable, TslibDisable);
-
- }
- else
- {
- fprintf(stderr, "%s() failed to open tslib\n", __func__);
- if (fd > 0) close(fd);
- }
-
-
- }
-
- return n;
-}
-
-static void
-TslibFini (void)
-{
- KdMouseInfo *mi;
-
- KdUnregisterFds (TsInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == TsInputType)
- {
- if(mi->driver) ts_close(tsDev);
- mi->driver = 0;
- mi->inputType = 0;
- }
- }
-}
-
-KdMouseFuncs TsFuncs = {
- TslibInit,
- TslibFini
-};
diff --git a/hw/kdrive/mach64/Makefile.am b/hw/kdrive/mach64/Makefile.am
deleted file mode 100644
index 47202971a..000000000
--- a/hw/kdrive/mach64/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- -I$(top_srcdir)/hw/kdrive/vesa \
- @XSERVER_CFLAGS@
-
-bin_PROGRAMS = Xmach64
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-
-noinst_LIBRARIES = libmach64.a
-
-libmach64_a_SOURCES = \
- mach64.c \
- mach64draw.c \
- mach64video.c \
- fourcc.h \
- mach64.h \
- mach64draw.h
-
-Xmach64_SOURCES = \
- mach64stub.c
-
-MACH64_LIBS = \
- libmach64.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
-
-
-Xmach64_LDADD = \
- $(MACH64_LIBS) \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-
-Xmach64_DEPENDENCIES = $(MACH64_LIBS) @KDRIVE_LIBS@
diff --git a/hw/kdrive/mach64/fourcc.h b/hw/kdrive/mach64/fourcc.h
deleted file mode 100644
index b19f5decc..000000000
--- a/hw/kdrive/mach64/fourcc.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.4 2003/04/23 21:51:24 tsi Exp $ */
-
-/*
- This header file contains listings of STANDARD guids for video formats.
- Please do not place non-registered, or incomplete entries in this file.
- A list of some popular fourcc's are at: http://www.webartz.com/fourcc/
- For an explanation of fourcc <-> guid mappings see RFC2361.
-*/
-
-#ifndef _XF86_FOURCC_H_
-#define _XF86_FOURCC_H_ 1
-
-#define FOURCC_YUY2 0x32595559
-#define XVIMAGE_YUY2 \
- { \
- FOURCC_YUY2, \
- XvYUV, \
- LSBFirst, \
- {'Y','U','Y','2', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 16, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 1, 1, \
- {'Y','U','Y','V', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_YV12 0x32315659
-#define XVIMAGE_YV12 \
- { \
- FOURCC_YV12, \
- XvYUV, \
- LSBFirst, \
- {'Y','V','1','2', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 12, \
- XvPlanar, \
- 3, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 2, 2, \
- {'Y','V','U', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_I420 0x30323449
-#define XVIMAGE_I420 \
- { \
- FOURCC_I420, \
- XvYUV, \
- LSBFirst, \
- {'I','4','2','0', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 12, \
- XvPlanar, \
- 3, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 2, 2, \
- {'Y','U','V', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-
-#define FOURCC_UYVY 0x59565955
-#define XVIMAGE_UYVY \
- { \
- FOURCC_UYVY, \
- XvYUV, \
- LSBFirst, \
- {'U','Y','V','Y', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 16, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 1, 1, \
- {'U','Y','V','Y', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_IA44 0x34344149
-#define XVIMAGE_IA44 \
- { \
- FOURCC_IA44, \
- XvYUV, \
- LSBFirst, \
- {'I','A','4','4', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 8, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 1, 1, \
- 1, 1, 1, \
- {'A','I', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_AI44 0x34344941
-#define XVIMAGE_AI44 \
- { \
- FOURCC_AI44, \
- XvYUV, \
- LSBFirst, \
- {'A','I','4','4', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 8, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 1, 1, \
- 1, 1, 1, \
- {'I','A', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#endif /* _XF86_FOURCC_H_ */
diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c
deleted file mode 100644
index 3d24045da..000000000
--- a/hw/kdrive/mach64/mach64.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.10 2002/10/14 18:01:41 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mach64.h"
-#include <sys/io.h>
-
-static Bool
-mach64CardInit (KdCardInfo *card)
-{
- Mach64CardInfo *mach64c;
-
- mach64c = (Mach64CardInfo *) xalloc (sizeof (Mach64CardInfo));
- if (!mach64c)
- return FALSE;
-
- (void) mach64MapReg (card, mach64c);
- mach64c->lcdEnabled = FALSE;
-
- if (!vesaInitialize (card, &mach64c->vesa))
- {
- xfree (mach64c);
- return FALSE;
- }
-
- card->driver = mach64c;
-
- return TRUE;
-}
-
-static Bool
-mach64ScreenInit (KdScreenInfo *screen)
-{
- Mach64CardInfo *mach64c = screen->card->driver;
- Mach64ScreenInfo *mach64s;
-
- mach64s = (Mach64ScreenInfo *) xalloc (sizeof (Mach64ScreenInfo));
- if (!mach64s)
- return FALSE;
- memset (mach64s, '\0', sizeof (Mach64ScreenInfo));
- if (!vesaScreenInitialize (screen, &mach64s->vesa))
- {
- xfree (mach64s);
- return FALSE;
- }
- if (!mach64c->reg)
- screen->dumb = TRUE;
- if (mach64s->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
- switch (screen->fb[0].depth) {
- case 8:
- mach64s->colorKey = 0xff;
- break;
- case 15:
- case 16:
- mach64s->colorKey = 0x001e;
- break;
- case 24:
- mach64s->colorKey = 0x0000fe;
- break;
- default:
- mach64s->colorKey = 1;
- break;
- }
- screen->driver = mach64s;
- return TRUE;
-}
-
-static Bool
-mach64InitScreen (ScreenPtr pScreen)
-{
-#ifdef XV
- mach64InitVideo(pScreen);
-#endif
- return vesaInitScreen (pScreen);
-}
-
-#ifdef RANDR
-static Bool
-mach64RandRSetConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
-{
- KdCheckSync (pScreen);
-
- if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-mach64RandRInit (ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
-
- pScrPriv->rrSetConfig = mach64RandRSetConfig;
-}
-#endif
-
-static Bool
-mach64FinishInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
- ret = vesaFinishInitScreen (pScreen);
-#ifdef RANDR
- mach64RandRInit (pScreen);
-#endif
- return ret;
-}
-
-static Bool
-mach64CreateResources (ScreenPtr pScreen)
-{
- return vesaCreateResources (pScreen);
-}
-
-CARD32
-mach64ReadLCD (Reg *reg, int id)
-{
- CARD32 LCD_INDEX;
-
- LCD_INDEX = reg->LCD_INDEX & ~(0x3f);
- reg->LCD_INDEX = (LCD_INDEX | id);
- return reg->LCD_DATA;
-}
-
-void
-mach64WriteLCD (Reg *reg, int id, CARD32 data)
-{
- CARD32 LCD_INDEX;
-
- LCD_INDEX = reg->LCD_INDEX & ~(0x3f);
- reg->LCD_INDEX = (LCD_INDEX | id);
- reg->LCD_DATA = data;
-}
-
-void
-mach64Preserve (KdCardInfo *card)
-{
- Mach64CardInfo *mach64c = card->driver;
- Reg *reg = mach64c->reg;
-
- vesaPreserve(card);
- if (reg)
- {
- mach64c->save.LCD_GEN_CTRL = mach64ReadLCD (reg, 1);
- }
-}
-
-Bool
-mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c)
-{
- mach64c->reg_base = (CARD8 *) KdMapDevice (MACH64_REG_BASE(card),
- MACH64_REG_SIZE(card));
-
- if (!mach64c->reg_base)
- {
- mach64c->reg = 0;
- mach64c->media_reg = 0;
- return FALSE;
- }
-
- KdSetMappedMode (MACH64_REG_BASE(card),
- MACH64_REG_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- mach64c->reg = (Reg *) (mach64c->reg_base + MACH64_REG_OFF(card));
- mach64c->media_reg = (MediaReg *) (mach64c->reg_base + MACH64_MEDIA_REG_OFF(card));
- return TRUE;
-}
-
-void
-mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c)
-{
- if (mach64c->reg_base)
- {
- KdResetMappedMode (MACH64_REG_BASE(card),
- MACH64_REG_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- KdUnmapDevice ((void *) mach64c->reg_base, MACH64_REG_SIZE(card));
- mach64c->reg_base = 0;
- mach64c->reg = 0;
- mach64c->media_reg = 0;
- }
-}
-
-void
-mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c)
-{
- if (!mach64c->reg_base)
- mach64MapReg (card, mach64c);
- if (mach64c->reg)
- {
- if (mach64c->reg->GUI_STAT == 0xffffffff)
- FatalError ("Mach64 REG not visible\n");
- }
-}
-
-void
-mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c)
-{
- mach64UnmapReg (card, mach64c);
-}
-
-Bool
-mach64Enable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- Mach64CardInfo *mach64c = pScreenPriv->card->driver;
-
- if (!vesaEnable (pScreen))
- return FALSE;
-
- mach64SetMMIO (pScreenPriv->card, mach64c);
- mach64DPMS (pScreen, KD_DPMS_NORMAL);
-#ifdef XV
- KdXVEnable (pScreen);
-#endif
- return TRUE;
-}
-
-void
-mach64Disable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- Mach64CardInfo *mach64c = pScreenPriv->card->driver;
-
-#ifdef XV
- KdXVDisable (pScreen);
-#endif
- mach64ResetMMIO (pScreenPriv->card, mach64c);
- vesaDisable (pScreen);
-}
-
-const CARD8 mach64DPMSModes[4] = {
- 0x80, /* KD_DPMS_NORMAL */
- 0x8c, /* KD_DPMS_STANDBY */
- 0x8c, /* KD_DPMS_STANDBY */
- 0x8c, /* KD_DPMS_STANDBY */
-/* 0xb0, KD_DPMS_SUSPEND */
-/* 0xbc, KD_DPMS_POWERDOWN */
-};
-
-#define PWR_MGT_ON (1 << 0)
-#define PWR_MGT_MODE (3 << 1)
-#define PWR_MGT_MODE_PIN (0 << 1)
-#define PWR_MGT_MODE_REG (1 << 1)
-#define PWR_MGT_MODE_TIMER (2 << 1)
-#define PWR_MGR_MODE_PCI (3 << 1)
-#define AUTO_PWRUP_EN (1 << 3)
-#define ACTIVITY_PIN_ON (1 << 4)
-#define STANDBY_POL (1 << 5)
-#define SUSPEND_POL (1 << 6)
-#define SELF_REFRESH (1 << 7)
-#define ACTIVITY_PIN_EN (1 << 8)
-#define KEYBD_SNOOP (1 << 9)
-#define DONT_USE_F32KHZ (1 << 10)
-#define TRISTATE_MEM_EN (1 << 11)
-#define LCDENG_TEST_MODE (0xf << 12)
-#define STANDBY_COUNT (0xf << 16)
-#define SUSPEND_COUNT (0xf << 20)
-#define BIASON (1 << 24)
-#define BLON (1 << 25)
-#define DIGON (1 << 26)
-#define PM_D3_RST_ENB (1 << 27)
-#define STANDBY_NOW (1 << 28)
-#define SUSPEND_NOW (1 << 29)
-#define PWR_MGT_STATUS (3 << 30)
-#define PWR_MGT_STATUS_ON (0 << 30)
-#define PWR_MGT_STATUS_STANDBY (1 << 30)
-#define PWR_MGT_STATUS_SUSPEND (2 << 30)
-#define PWR_MGT_STATUS_TRANSITION (3 << 30)
-
-Bool
-mach64DPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- Mach64CardInfo *mach64c = pScreenPriv->card->driver;
- int hsync_off = 0, vsync_off = 0, blank = 0;
- CARD32 CRTC_GEN_CNTL;
- CARD32 LCD_GEN_CTRL;
- Reg *reg = mach64c->reg;
-
- if (!reg)
- return FALSE;
-
- CRTC_GEN_CNTL = reg->CRTC_GEN_CNTL;
- LCD_GEN_CTRL = mach64ReadLCD (reg, 1);
-
- switch (mode) {
- case KD_DPMS_NORMAL:
- hsync_off = 0;
- vsync_off = 0;
- blank = 0;
- break;
- case KD_DPMS_STANDBY:
- hsync_off = 1;
- vsync_off = 0;
- blank = 1;
- break;
- case KD_DPMS_SUSPEND:
- hsync_off = 0;
- vsync_off = 1;
- blank = 1;
- break;
- case KD_DPMS_POWERDOWN:
- hsync_off = 1;
- vsync_off = 1;
- blank = 1;
- }
-
- if (hsync_off)
- CRTC_GEN_CNTL |= (1 << 2);
- else
- CRTC_GEN_CNTL &= ~(1 << 2);
- if (vsync_off)
- CRTC_GEN_CNTL |= (1 << 3);
- else
- CRTC_GEN_CNTL &= ~(1 << 3);
- if (blank)
- {
- mach64c->lcdEnabled = (LCD_GEN_CTRL & (1 << 1)) != 0;
- LCD_GEN_CTRL &= ~(1 << 1);
- CRTC_GEN_CNTL |= (1 << 6);
-
- }
- else
- {
- if (!(LCD_GEN_CTRL & 3) || mach64c->lcdEnabled)
- LCD_GEN_CTRL |= (1 << 1);
- CRTC_GEN_CNTL &= ~(1 << 6);
- }
-
- KdCheckSync (pScreen);
-
- mach64WriteLCD (reg, 1, LCD_GEN_CTRL);
-
- reg->CRTC_GEN_CNTL = CRTC_GEN_CNTL;
- return TRUE;
-}
-
-static void
-mach64Restore (KdCardInfo *card)
-{
- Mach64CardInfo *mach64c = card->driver;
- Reg *reg = mach64c->reg;
-
- if (reg)
- {
- mach64WriteLCD (reg, 1, mach64c->save.LCD_GEN_CTRL);
- }
- mach64ResetMMIO (card, mach64c);
- vesaRestore (card);
-}
-
-static void
-mach64ScreenFini (KdScreenInfo *screen)
-{
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
-#ifdef XV
- mach64FiniVideo(screen->pScreen);
-#endif
- vesaScreenFini (screen);
- xfree (mach64s);
- screen->driver = 0;
-}
-
-static void
-mach64CardFini (KdCardInfo *card)
-{
- Mach64CardInfo *mach64c = card->driver;
-
- mach64UnmapReg (card, mach64c);
- vesaCardFini (card);
- xfree (mach64c);
-}
-
-#define mach64CursorInit 0 /* initCursor */
-#define mach64CursorEnable 0 /* enableCursor */
-#define mach64CursorDisable 0 /* disableCursor */
-#define mach64CursorFini 0 /* finiCursor */
-#define mach64RecolorCursor 0 /* recolorCursor */
-
-KdCardFuncs mach64Funcs = {
- mach64CardInit, /* cardinit */
- mach64ScreenInit, /* scrinit */
- mach64InitScreen, /* initScreen */
- mach64FinishInitScreen, /* finishInitScreen */
- mach64CreateResources, /* createRes */
- mach64Preserve, /* preserve */
- mach64Enable, /* enable */
- mach64DPMS, /* dpms */
- mach64Disable, /* disable */
- mach64Restore, /* restore */
- mach64ScreenFini, /* scrfini */
- mach64CardFini, /* cardfini */
-
- mach64CursorInit, /* initCursor */
- mach64CursorEnable, /* enableCursor */
- mach64CursorDisable, /* disableCursor */
- mach64CursorFini, /* finiCursor */
- mach64RecolorCursor, /* recolorCursor */
-
- mach64DrawInit, /* initAccel */
- mach64DrawEnable, /* enableAccel */
- mach64DrawSync, /* syncAccel */
- mach64DrawDisable, /* disableAccel */
- mach64DrawFini, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-};
diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h
deleted file mode 100644
index 68e762b3b..000000000
--- a/hw/kdrive/mach64/mach64.h
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * Id: mach64.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/mach64/mach64.h,v 1.5 2001/06/23 03:41:24 keithp Exp $ */
-
-#ifndef _MACH64_H_
-#define _MACH64_H_
-#include <vesa.h>
-#include "kxv.h"
-
-/*
- * offset from ioport beginning
- */
-
-#define MACH64_REG_BASE(c) ((c)->attr.address[1])
-#define MACH64_REG_SIZE(c) (4096)
-
-#define MACH64_REG_OFF(c) (1024)
-#define MACH64_MEDIA_REG_OFF(c) (0)
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _Reg {
- VOL32 CRTC_H_TOTAL_DISP; /* 0x00 */
- VOL32 CRTC_H_SYNC_STRT_WID; /* 0x01 */
- VOL32 CRTC_V_TOTAL_DISP; /* 0x02 */
- VOL32 CRTC_V_SYNC_STRT_WID; /* 0x03 */
- VOL32 CRTC_VLINE_CRNT_VLINE; /* 0x04 */
- VOL32 CRTC_OFF_PITCH; /* 0x05 */
- VOL32 CRTC_INT_CNTL; /* 0x06 */
- VOL32 CRTC_GEN_CNTL; /* 0x07 */
- VOL32 DSP_CONFIG; /* 0x08 */
- VOL32 DSP_ON_OFF; /* 0x09 */
- VOL32 TIMER_CONFIG; /* 0x0a */
- VOL32 MEM_BUF_CNTL; /* 0x0b */
- VOL32 unused0; /* 0x0c */
- VOL32 MEM_ADDR_CONFIG; /* 0x0d */
- VOL32 CRT_TRAP; /* 0x0e */
- VOL32 I2C_CNTL_0; /* 0x0f */
- VOL32 OVR_CLR; /* 0x10 */
- VOL32 OVR_WID_LEFT_RIGHT; /* 0x11 */
- VOL32 OVR_WID_TOP_BOTTOM; /* 0x12 */
- VOL32 VGA_DSP_CONFIG; /* 0x13 */
- VOL32 VGA_DSP_ON_OFF; /* 0x14 */
- VOL32 DSP2_CONFIG; /* 0x15 */
- VOL32 DSP2_ON_OFF; /* 0x16 */
- VOL32 CRTC2_OFF_PITCH; /* 0x17 */
- VOL32 CUR_CLR0; /* 0x18 */
- VOL32 CUR_CLR1; /* 0x19 */
- VOL32 CUR_OFFSET; /* 0x1a */
- VOL32 CUR_HORZ_VERT_POSN; /* 0x1b */
- VOL32 CUR_HORZ_VERT_OFF; /* 0x1c */
- VOL32 TV_OUT_INDEX; /* 0x1d */
- VOL32 GP_IO; /* 0x1e */
- VOL32 HW_DEBUG; /* 0x1f */
- VOL32 SCRATCH_REG0; /* 0x20 */
- VOL32 SCRATCH_REG1;
- VOL32 SCRATCH_REG2;
- VOL32 SCRATCH_REG3;
- VOL32 CLOCK_CNTL;
- VOL32 CONFIG_STAT1;
- VOL32 CONFIG_STAT2;
- VOL32 TV_OUT_DATA;
- VOL32 BUS_CNTL; /* 0x28 */
- VOL32 LCD_INDEX; /* 0x29 */
- VOL32 LCD_DATA; /* 0x2a */
- VOL32 EXT_MEM_CNTL;
- VOL32 MEM_CNTL;
- VOL32 MEM_VGA_WP_SEL;
- VOL32 MEM_VGA_RP_SEL;
- VOL32 I2C_CNTL_1;
- VOL32 DAC_REGS; /* 0x30 */
- VOL32 DAC_CNTL; /* 0x31 */
- VOL32 unused_32;
- VOL32 unused_33;
- VOL32 GEN_TEST_CNTL; /* 0x34 */
- VOL32 CUSTOM_MACRO_CNTL;
- VOL32 unused36;
- VOL32 CONFIG_CNTL;
- VOL32 CONFIG_CHIP_ID;
- VOL32 CONFIG_STAT0;
- VOL32 CRC_SIG;
- VOL32 unused_3b;
- VOL32 unused_3c;
- VOL32 unused_3d;
- VOL32 unused_3e;
- VOL32 unused_3f;
- VOL32 DST_OFF_PITCH; /* 0x40 */
- VOL32 DST_X;
- VOL32 DST_Y;
- VOL32 DST_Y_X;
- VOL32 DST_WIDTH;
- VOL32 DST_HEIGHT;
- VOL32 DST_HEIGHT_WIDTH;
- VOL32 DST_X_WIDTH;
- VOL32 DST_BRES_LNTH;
- VOL32 DST_BRES_ERR;
- VOL32 DST_BRES_INC;
- VOL32 DST_BRES_DEC;
- VOL32 DST_CNTL;
- VOL32 DST_Y_X_ALIAS;
- VOL32 TRAIL_BRES_ERR;
- VOL32 TRAIL_BRES_INC;
- VOL32 TRAIL_BRES_DEC;
- VOL32 LEAD_BRES_LNTH;
- VOL32 Z_OFF_PITCH;
- VOL32 Z_CNTL;
- VOL32 ALPHA_TST_CNTL;
- VOL32 unused55;
- VOL32 SECONDARY_STW_EXP;
- VOL32 SECONDARY_S_X_INC;
- VOL32 SECONDARY_S_Y_INC;
- VOL32 SECONDARY_S_START;
- VOL32 SECONDARY_W_X_INC;
- VOL32 SECONDARY_W_Y_INC;
- VOL32 SECONDARY_W_START;
- VOL32 SECONDARY_T_X_INC;
- VOL32 SECONDARY_T_Y_INC;
- VOL32 SECONDARY_T_START;
- VOL32 SRC_OFF_PITCH;
- VOL32 SRC_X;
- VOL32 SRC_Y;
- VOL32 SRC_Y_X;
- VOL32 SRC_WIDTH1;
- VOL32 SRC_HEIGHT1;
- VOL32 SRC_HEIGHT1_WIDTH1;
- VOL32 SRC_X_START;
- VOL32 SRC_Y_START;
- VOL32 SRC_Y_X_START;
- VOL32 SRC_WIDTH2;
- VOL32 SRC_HEIGHT2;
- VOL32 SRC_HEIGHT2_WIDTH2;
- VOL32 SRC_CNTL;
- VOL32 unused6e;
- VOL32 unused6f;
- union {
- struct {
- VOL32 SCALE_OFF; /* 0x70 */
- VOL32 unused71;
- VOL32 unused72;
- VOL32 unused73;
- VOL32 unused74;
- VOL32 unused75;
- VOL32 unused76;
- VOL32 SCALE_WIDTH;
- VOL32 SCALE_HEIGHT;
- VOL32 unused79;
- VOL32 unused7a;
- VOL32 SCALE_PITCH;
- VOL32 SCALE_X_INC;
- VOL32 SCALE_Y_INC;
- VOL32 SCALE_VACC;
- VOL32 SCALE_3D_CNTL; /* 0x7f */
- } scaler;
- struct {
- VOL32 TEX_0_OFF; /* 0x70 */
- VOL32 TEX_1_OFF;
- VOL32 TEX_2_OFF;
- VOL32 TEX_3_OFF;
- VOL32 TEX_4_OFF;
- VOL32 TEX_5_OFF;
- VOL32 TEX_6_OFF;
- VOL32 TEX_7_OFF;
- VOL32 TEX_8_OFF;
- VOL32 TEX_9_OFF;
- VOL32 TEX_10_OFF;
- VOL32 S_Y_INC;
- VOL32 RED_X_INC;
- VOL32 GREEN_X_INC; /* 0x7d */
- VOL32 unused7e;
- VOL32 unused7f;
- } texture;
- } u;
- VOL32 HOST_DATA[16]; /* 0x80 */
- VOL32 HOST_CNTL; /* 0x90 */
- VOL32 BM_HOSTDATA; /* 0x91 */
- VOL32 BM_ADDR; /* 0x92 */
- VOL32 BM_GUI_TABLE_CMD; /* 0x93 */
- VOL32 unused94; /* 0x94 */
- VOL32 unused95; /* 0x95 */
- VOL32 unused96; /* 0x96 */
- VOL32 FOG_TABLE_INDEX; /* 0x97 */
- VOL32 FOG_TABLE_DATA[8]; /* 0x98 */
- VOL32 PAT_REG0; /* 0xa0 */
- VOL32 PAT_REG1;
- VOL32 PAT_CNTL;
- VOL32 unused_0a3;
- VOL32 unused_0a4;
- VOL32 unused_0a5;
- VOL32 unused_0a6;
- VOL32 unused_0a7;
- VOL32 SC_LEFT;
- VOL32 SC_RIGHT;
- VOL32 SC_LEFT_RIGHT;
- VOL32 SC_TOP;
- VOL32 SC_BOTTOM;
- VOL32 SC_TOP_BOTTOM;
- VOL32 USR1_DST_OFF_PITCH;
- VOL32 USR2_DST_OFF_PITCH;
- VOL32 DP_BKGD_CLR; /* 0xb0 */
- VOL32 DP_FRGD_CLR;
- VOL32 DP_WRITE_MSK;
- VOL32 unused_0b3;
- VOL32 DP_PIX_WIDTH;
- VOL32 DP_MIX;
- VOL32 DP_SRC;
- VOL32 DP_FRGD_CLR_MIX;
- VOL32 DP_FRGD_BKGD_CLR;
- VOL32 unused_0b9;
- VOL32 DST_X_Y;
- VOL32 DST_WIDTH_HEIGHT;
- VOL32 USR_DST_PITCH;
- VOL32 unused_0bd;
- VOL32 DP_SET_GUI_ENGINE2;
- VOL32 DP_SET_GUI_ENGINE;
- VOL32 CLR_CMP_CLR; /* 0xc0 */
- VOL32 CLR_CMP_MSK;
- VOL32 CLR_CMP_CNTL;
- VOL32 unused_0c3;
- VOL32 FIFO_STAT;
- VOL32 unused_0c5;
- VOL32 unused_0c6;
- VOL32 unused_0c7;
- VOL32 unused_0c8;
- VOL32 unused_0c9;
- VOL32 unused_0ca;
- VOL32 unused_0cb;
- VOL32 GUI_TRAJ_CNTL;
- VOL32 unused_0cd;
- VOL32 GUI_STAT;
- VOL32 unused_0cf;
- VOL32 TEX_PALETTE_INDEX;
- VOL32 STW_EXP;
- VOL32 LOG_MAX_INC;
- VOL32 S_X_INC;
- VOL32 S_Y_INC_2_SCALE_PITCH;
- VOL32 S_START;
- VOL32 W_X_INC;
- VOL32 W_Y_INC;
- VOL32 W_START;
- VOL32 T_X_INC;
- VOL32 T_Y_INC_SECONDARY_SCALE_PITCH;
- VOL32 T_START;
- VOL32 TEX_SIZE_PITCH;
- VOL32 TEX_CNTL;
- VOL32 SECONDARY_TEX_OFFSET_SECONDARY_SCALE_OFF;
- VOL32 TEX_PALETTE;
- VOL32 SCALE_PITCH_BOTH; /* 0xe0 */
- VOL32 SECONDARY_SCALE_OFF_ACC;
- VOL32 SCALE_OFF_ACC;
- VOL32 SCALE_DST_Y_X;
- VOL32 unused_0e4;
- VOL32 unused_0e5;
- VOL32 COMPOSITE_SHADOW_ID;
- VOL32 SECONDARY_SCALE_X_INC_SPECULAR_RED_X_INC;
- VOL32 SPECULAR_RED_Y_INC;
- VOL32 SPECULAR_RED_START_SECONDARY_SCALE_HACC;;
- VOL32 SPECULAR_GREEN_X_INC;
- VOL32 SPECULAR_GREEN_Y_INC;
- VOL32 SPECULAR_GREEN_START;
- VOL32 SPECULAR_BLUE_X_INC;
- VOL32 SPECULAR_BLUE_Y_INC;
- VOL32 SPECULAR_BLUE_START;
- VOL32 RED_X_INC_SCALE_X_INC;
- VOL32 RED_Y_INC;
- VOL32 RED_START_SCALE_HACC;
- VOL32 GREEN_X_INC_SCALE_Y_INC;
- VOL32 GREEN_Y_INC_SECONDARY_SCALE_Y_INC;
- VOL32 GREEN_START_SECONDARY_SCALE_VACC;
- VOL32 BLUE_X_INC;
- VOL32 BLUE_Y_INC;
- VOL32 BLUE_START;
- VOL32 Z_X_INC;
- VOL32 Z_Y_INC;
- VOL32 Z_START;
- VOL32 ALPHA_X_INC;
- VOL32 FOG_X_INC;
- VOL32 ALPHA_Y_INC;
- VOL32 FOG_Y_INC;
- VOL32 ALPHA_START;
- VOL32 FOG_START;
- VOL32 unused_0ff;
-} Reg; /* 0x100 */
-
-#define DST_X_DIR (1 << 0)
-#define DST_Y_DIR (1 << 1)
-#define DST_Y_MAJOR (1 << 2)
-#define DST_X_TILE (1 << 3)
-#define DST_Y_TILE (1 << 4)
-#define DST_LAST_PEL (1 << 5)
-#define DST_POLYGON_EN (1 << 6)
-#define DST_24_ROT_EN (1 << 7)
-#define DST_24_ROT(n) ((n) << 8)
-#define DST_BRES_ZERO (1 << 11)
-#define DST_POLYGON_RTEDGE_DIS (1 << 12)
-#define TRAIL_X_DIR (1 << 13)
-#define TRAP_FILL_DIR (1 << 14)
-#define TRAIL_BRES_SIGN (1 << 15)
-#define SRC_PATT_EN (1 << 16)
-#define SRC_PATT_ROT_EN (1 << 17)
-#define SRC_LINEAR_EN (1 << 18)
-#define SRC_BYTE_ALIGN (1 << 19)
-#define SRC_LINE_X_DIR (1 << 20)
-#define SRC_8x8x8_BRUSH (1 << 21)
-#define FAST_FILL_EN (1 << 22)
-#define SRC_TRACK_DST (1 << 23)
-#define PAT_MONO_EN (1 << 24)
-#define PAT_CLR_4x2_EN (1 << 25)
-#define PAT_CLR_8x1_EN (1 << 26)
-#define HOST_BYTE_ALIGN (1 << 28)
-#define HOST_BIG_ENDIAN_EN (1 << 29)
-
-/* BUS_CNTL bits */
-#define BUS_DBL_RESYNC (1 << 0)
-#define BUS_MSTR_RESET (1 << 1)
-#define BUS_FLUSH_BUF (1 << 2)
-#define BUS_STOP_REQ_DIS (1 << 3)
-#define BUS_APER_REG_DIS (1 << 4)
-#define BUS_EXTRA_PIPE_DIS (1 << 5)
-#define BUS_MASTER_DIS (1 << 6)
-#define ROM_WRT_EN (1 << 7)
-#define CHIP_HIDDEN_REV (3 << 8)
-#define BUS_PCI_READ_RETRY_EN (1 << 13)
-#define BUS_PCI_WRT_RETRY_EN (1 << 15)
-#define BUS_RETRY_WS (0xf << 16)
-#define BUS_MSTR_RD_MULT (1 << 20)
-#define BUS_MSTR_RD_LINE (1 << 21)
-#define BUS_SUSPEND (1 << 22)
-#define LAT16X (1 << 23)
-#define BUS_RD_DISCARD_EN (1 << 24)
-#define BUS_RD_ABORT_EN (1 << 25)
-#define BUS_MSTR_WS (1 << 26)
-#define BUS_EXT_REG_EN (1 << 27)
-#define BUS_MSTR_DISCONNECT_EN (1 << 28)
-#define BUS_WRT_BURST (1 << 29)
-#define BUS_READ_BURST (1 << 30)
-#define BUS_RDY_READ_DLY (1 << 31)
-
-#define SCALE_PIX_EXPAND (1 << 0)
-#define SCALE_Y2R_TEMP (1 << 1)
-#define SCALE_HORZ_MODE (1 << 2)
-#define SCALE_VERT_MODE (1 << 3)
-#define SCALE_SIGNED_UV (1 << 4)
-#define SCALE_GAMMA_SEL (3 << 5)
-#define SCALE_GAMMA_BRIGHT (0 << 5)
-#define SCALE_GAMMA_22 (1 << 5)
-#define SCALE_GAMMA_18 (2 << 5)
-#define SCALE_GAMMA_14 (3 << 5)
-#define SCALE_DISP_SEL (1 << 7)
-#define SCALE_BANDWIDTH (1 << 26)
-#define SCALE_DIS_LIMIT (1 << 27)
-#define SCALE_CLK_FORCE_ON (1 << 29)
-#define SCALE_OVERLAY_EN (1 << 30)
-#define SCALE_EN (1 << 31)
-
-#define VIDEO_IN_VYUY422 (0xb)
-#define VIDEO_IN_YVYU422 (0xc)
-#define SCALER_IN_15bpp (0x3 << 16)
-#define SCALER_IN_16bpp (0x4 << 16)
-#define SCALER_IN_32bpp (0x6 << 16)
-#define SCALER_IN_YUV_9 (0x9 << 16)
-#define SCALER_IN_YUV_12 (0xa << 16)
-#define SCALER_IN_VYUY422 (0xb << 16)
-#define SCALER_IN_YVYU422 (0xc << 16)
-
-#define CAP_INPUT_MODE (1 << 0)
-#define CAP_BUF_MODE (1 << 2)
-#define CAP_START_BUF (1 << 3)
-#define CAP_BUF_TYPE_FIELD (0 << 4)
-#define CAP_BUF_TYPE_ALTERNATING (1 << 4)
-#define CAP_BUF_TYPE_FRAME (2 << 4)
-
-#define OVL_BUF_MODE (1 << 28)
-#define OVL_BUF_NEXT (1 << 29)
-
-#define CAP_TRIGGER (3 << 0)
-#define OVL_CUR_BUF (1 << 5)
-#define OVL_BUF_STATUS (1 << 6)
-#define CAP_BUF_STATUS (1 << 7)
-#define CAPTURE_EN (1 << 31)
-
-typedef struct _MediaReg {
- VOL32 OVERLAY_Y_X_START; /* 0x100 */
- VOL32 OVERLAY_Y_X_END;
- VOL32 OVERLAY_VIDEO_KEY_CLR;
- VOL32 OVERLAY_VIDEO_KEY_MSK;
- VOL32 OVERLAY_GRAPHICS_KEY_CLR;
- VOL32 OVERLAY_GRAPHICS_KEY_MSK;
- VOL32 OVERLAY_KEY_CNTL;
- VOL32 unused_107;
- VOL32 OVERLAY_SCALE_INC;
- VOL32 OVERLAY_SCALE_CNTL;
- VOL32 SCALER_HEIGHT_WIDTH;
- VOL32 SCALER_TEST;
- VOL32 unused_10c;
- VOL32 SCALER_BUF0_OFFSET;
- VOL32 SCALER_BUF1_OFFSET;
- VOL32 SCALER_BUF_PITCH;
- VOL32 CAPTURE_START_END; /* 0x110 */
- VOL32 CAPTURE_X_WIDTH;
- VOL32 VIDEO_FORMAT;
- VOL32 VBI_START_END;
- VOL32 CAPTURE_CONFIG;
- VOL32 TRIG_CNTL;
- VOL32 OVERLAY_EXCLUSIVE_HORZ;
- VOL32 OVERLAY_EXCLUSIVE_VERT;
- VOL32 VBI_WIDTH;
- VOL32 CAPTURE_DEBUG;
- VOL32 VIDEO_SYNC_TEST;
- VOL32 unused_11b;
- VOL32 SNAPSHOT_VH_COUNTS;
- VOL32 SNAPSHOT_F_COUNT;
- VOL32 N_VIF_COUNT;
- VOL32 SNAPSHOT_VIF_COUNT;
- VOL32 CAPTURE_BUF0_OFFSET; /* 0x120 */
- VOL32 CAPTURE_BUF1_OFFSET;
- VOL32 ONESHOT_BUF_OFFSET;
- VOL32 unused_123;
- VOL32 unused_124;
- VOL32 unused_125;
- VOL32 unused_126;
- VOL32 unused_127;
- VOL32 unused_128;
- VOL32 unused_129;
- VOL32 unused_12a;
- VOL32 unused_12b;
- VOL32 SNAPSHOT2_VH_COUNTS;
- VOL32 SNAPSHOT2_F_COUNT;
- VOL32 N_VIF2_COUNT;
- VOL32 SNAPSHOT2_VIF_COUNT;
- VOL32 MPP_CONFIG; /* 0x130 */
- VOL32 MPP_STROBE_SEQ;
- VOL32 MPP_ADDR;
- VOL32 MPP_DATA;
- VOL32 unused_134;
- VOL32 unused_135;
- VOL32 unused_136;
- VOL32 unused_137;
- VOL32 unused_138;
- VOL32 unused_139;
- VOL32 unused_13a;
- VOL32 unused_13b;
- VOL32 unused_13c;
- VOL32 unused_13d;
- VOL32 unused_13e;
- VOL32 unused_13f;
- VOL32 TVO_CNTL; /* 0x140 */
- VOL32 unused_141[15];
- VOL32 unused_150; /* 0x150 */
- VOL32 CRT_HORZ_VERT_LOAD; /* 0x151 */
- VOL32 AGP_BASE; /* 0x152 */
- VOL32 AGP_CNTL; /* 0x153 */
- VOL32 SCALER_COLOUR_CNTL; /* 0x154 */
- VOL32 SCALER_H_COEFF0; /* 0x155 */
- VOL32 SCALER_H_COEFF1; /* 0x156 */
- VOL32 SCALER_H_COEFF2; /* 0x157 */
- VOL32 SCALER_H_COEFF3; /* 0x158 */
- VOL32 SCALER_H_COEFF4; /* 0x159 */
- VOL32 unused_15a;
- VOL32 unused_15b;
- VOL32 GUI_CMDFIFO_DEBUG;
- VOL32 GUI_CMDFIFO_DATA;
- VOL32 GUI_CNTL;
- VOL32 unused_15f;
- VOL32 BM_FRAME_BUF_OFFSET; /* 0x160 */
- VOL32 BM_SYSTEM_MEM_ADDR;
- VOL32 BM_COMMAND;
- VOL32 BM_STATUS;
- VOL32 unused_164[10];
- VOL32 BM_GUI_TABLE;
- VOL32 BM_SYSTEM_TABLE;
- VOL32 unused_170[5]; /* 0x170 */
- VOL32 SCALER_BUF0_OFFSET_U;
- VOL32 SCALER_BUF0_OFFSET_V;
- VOL32 SCALER_BUF1_OFFSET_U;
- VOL32 SCALER_BUF1_OFFSET_V;
- VOL32 unused_179[7];
- VOL32 unused_180[16]; /* 0x180 */
- VOL32 setup_engine[0x40]; /* 0x190 */
- VOL32 dvd_subpicture[0x30]; /* 0x1d0 */
-} MediaReg;
-
-#define MACH64_XY(x,y) (((x) & 0x7fff) | (((y) & 0x7fff) << 16))
-#define MACH64_YX(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16))
-
-typedef struct _mach64Save {
- CARD32 LCD_GEN_CTRL;
-} Mach64Save;
-
-typedef struct _mach64CardInfo {
- VesaCardPrivRec vesa;
- CARD8 *reg_base;
- Reg *reg;
- MediaReg *media_reg;
- Mach64Save save;
- Bool lcdEnabled;
-} Mach64CardInfo;
-
-#define getMach64CardInfo(kd) ((Mach64CardInfo *) ((kd)->card->driver))
-#define mach64CardInfo(kd) Mach64CardInfo *mach64c = getMach64CardInfo(kd)
-
-typedef struct _mach64Cursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} Mach64Cursor;
-
-#define MACH64_CURSOR_WIDTH 64
-#define MACH64_CURSOR_HEIGHT 64
-
-/*
- * Xv information, optional
- */
-typedef struct _mach64PortPriv {
- CARD32 YBuf0Offset;
-
- CARD32 YBuf1Offset;
-
- CARD8 currentBuf;
-
- int brightness;
- int saturation;
-
- RegionRec clip;
- CARD32 colorKey;
-
- Bool videoOn;
- Time offTime;
- Time freeTime;
- CARD32 size;
- CARD32 offset;
- KdOffscreenArea *off_screen;
-} Mach64PortPrivRec, *Mach64PortPrivPtr;
-
-Bool mach64InitVideo(ScreenPtr pScreen);
-void mach64FiniVideo(ScreenPtr pScreen);
-
-typedef struct _mach64ScreenInfo {
- VesaScreenPrivRec vesa;
- CARD32 DP_PIX_WIDTH;
- CARD32 DP_SET_GUI_ENGINE;
- Bool bpp24;
- Mach64Cursor cursor;
- CARD32 colorKey;
- KdVideoAdaptorPtr pAdaptor;
-} Mach64ScreenInfo;
-
-#define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver))
-#define mach64ScreenInfo(kd) Mach64ScreenInfo *mach64s = getMach64ScreenInfo(kd)
-
-CARD32
-mach64ReadLCD (Reg *reg, int id);
-
-void
-mach64WriteLCD (Reg *reg, int id, CARD32 data);
-
-void
-mach64Preserve (KdCardInfo *card);
-
-Bool
-mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c);
-
-void
-mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c);
-
-void
-mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c);
-
-void
-mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c);
-
-Bool
-mach64Enable (ScreenPtr pScreen);
-
-void
-mach64Disable (ScreenPtr pScreen);
-
-Bool
-mach64DPMS (ScreenPtr pScreen, int mode);
-
-void
-mach64WaitAvail(Reg *reg, int n);
-
-void
-mach64WaitIdle (Reg *reg);
-
-Bool
-mach64DrawSetup (ScreenPtr pScreen);
-
-Bool
-mach64DrawInit (ScreenPtr pScreen);
-
-void
-mach64DrawReinit (ScreenPtr pScreen);
-
-void
-mach64DrawEnable (ScreenPtr pScreen);
-
-void
-mach64DrawSync (ScreenPtr pScreen);
-
-void
-mach64DrawDisable (ScreenPtr pScreen);
-
-void
-mach64DrawFini (ScreenPtr pScreen);
-
-CARD8
-mach64ReadIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index);
-
-void
-mach64WriteIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index, CARD8 value);
-
-Bool
-mach64CursorInit (ScreenPtr pScreen);
-
-void
-mach64CursorEnable (ScreenPtr pScreen);
-
-void
-mach64CursorDisable (ScreenPtr pScreen);
-
-void
-mach64CursorFini (ScreenPtr pScreen);
-
-void
-mach64RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
-
-extern KdCardFuncs mach64Funcs;
-
-#endif /* _MACH64_H_ */
diff --git a/hw/kdrive/mach64/mach64curs.c b/hw/kdrive/mach64/mach64curs.c
deleted file mode 100644
index b5d7cd16c..000000000
--- a/hw/kdrive/mach64/mach64curs.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Id: tridentcurs.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentcurs.c,v 1.6 2000/09/03 05:11:20 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "trident.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- tridentCardInfo(pScreenPriv); \
- tridentScreenInfo(pScreenPriv); \
- TridentCursor *pCurPriv = &tridents->cursor
-
-static void
-_tridentMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
-
- /* This is the recommended order to move the cursor */
-
- tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh);
- tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow);
- tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow);
- tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff);
- tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff);
- tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh);
-}
-
-static void
-tridentMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _tridentMoveCursor (pScreen, x, y);
-}
-
-static void
-tridentAllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
-
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
-}
-
-static void
-tridentSetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CARD32 fg, bg;
-
- fg = pCurPriv->source;
- bg = pCurPriv->mask;
- tridentWriteIndex (tridentc, 0x3d4, 0x48, fg);
- tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8);
- tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16);
-
- tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg);
- tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8);
- tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16);
-}
-
-void
-tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- tridentAllocCursorColors (pScreen);
- tridentSetCursorColors (pScreen);
-}
-
-#define InvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-static void
-tridentLoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- CARD32 *ram, *msk, *mskLine, *src, *srcLine;
- int i, j;
- int cursor_address;
- int lwsrc;
- unsigned char ramdac_control_;
- CARD32 offset;
-
- /*
- * Allocate new colors
- */
- tridentAllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (CARD32 *) tridents->cursor_base;
- mskLine = (CARD32 *) bits->mask;
- srcLine = (CARD32 *) bits->source;
-
- h = bits->height;
- if (h > TRIDENT_CURSOR_HEIGHT)
- h = TRIDENT_CURSOR_HEIGHT;
-
- lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
-
- for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += lwsrc;
- srcLine += lwsrc;
- for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) {
-
- CARD32 m, s;
-
-#if 1
- if (i < h && j < lwsrc)
- {
- m = *msk++;
- s = *src++;
- InvertBits32(m);
- InvertBits32(s);
- }
- else
- {
- m = 0;
- s = 0;
- }
-#endif
- *ram++ = m;
- *ram++ = s;
- }
- }
-
- /* Set address for cursor bits */
- offset = tridents->cursor_base - (CARD8 *) tridents->screen;
- offset >>= 10;
- tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff));
- tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8));
-
- /* Set new color */
- tridentSetCursorColors (pScreen);
-
- /* Enable the cursor */
- tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1);
-
- /* Move to new position */
- tridentMoveCursor (pScreen, x, y);
-}
-
-static void
-tridentUnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- /* Disable cursor */
- tridentWriteIndex (tridentc, 0x3d4, 0x50, 0);
-}
-
-static Bool
-tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- tridentLoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- tridentLoadCursor (pScreen, x, y);
- else
- tridentUnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec tridentPointerSpriteFuncs = {
- tridentRealizeCursor,
- tridentUnrealizeCursor,
- tridentSetCursor,
- tridentMoveCursor,
-};
-
-static void
-tridentQueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-tridentCursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!tridents->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = TRIDENT_CURSOR_WIDTH;
- pCurPriv->height= TRIDENT_CURSOR_HEIGHT;
- pScreen->QueryBestSize = tridentQueryBestSize;
- miPointerInitialize (pScreen,
- &tridentPointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-tridentCursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- tridentLoadCursor (pScreen, x, y);
- }
- else
- tridentUnloadCursor (pScreen);
- }
-}
-
-void
-tridentCursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- tridentUnloadCursor (pScreen);
- }
- }
-}
-
-void
-tridentCursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c
deleted file mode 100644
index d93e7dff7..000000000
--- a/hw/kdrive/mach64/mach64draw.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Id: mach64draw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/mach64/mach64draw.c,v 1.6 2001/07/23 03:44:17 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mach64.h"
-#include "mach64draw.h"
-
-#include <X11/Xmd.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-#include "picturestr.h"
-
-CARD8 mach64Rop[16] = {
- /* GXclear */ 0x01, /* 0 */
- /* GXand */ 0x0c, /* src AND dst */
- /* GXandReverse */ 0x0d, /* src AND NOT dst */
- /* GXcopy */ 0x07, /* src */
- /* GXandInverted*/ 0x0e, /* NOT src AND dst */
- /* GXnoop */ 0x03, /* dst */
- /* GXxor */ 0x05, /* src XOR dst */
- /* GXor */ 0x0b, /* src OR dst */
- /* GXnor */ 0x0f, /* NOT src AND NOT dst */
- /* GXequiv */ 0x06, /* NOT src XOR dst */
- /* GXinvert */ 0x00, /* NOT dst */
- /* GXorReverse */ 0x0a, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x04, /* NOT src */
- /* GXorInverted */ 0x09, /* NOT src OR dst */
- /* GXnand */ 0x08, /* NOT src OR NOT dst */
- /* GXset */ 0x02, /* 1 */
-};
-
-#define MACH64_DRAW_COMBO_SOLID 0x1
-#define MACH64_DRAW_COMBO_COPY 0x8
-
-#define SYNC_ALWAYS 0
-#if SYNC_ALWAYS
-static ScreenPtr mach64Screen;
-#endif
-static Reg *reg;
-static CARD32 avail;
-static CARD32 triple;
-
-#define IDX(reg,n) (&(reg)->n - &(reg)->CRTC_H_TOTAL_DISP)
-
-void
-mach64WaitAvail(Reg *reg, int n)
-{
- if (avail < n)
- {
- while ((avail = ((reg->GUI_STAT) >> 16) & 0x3ff) < n)
- ;
- }
- avail -= n;
-}
-
-void
-mach64WaitIdle (Reg *reg)
-{
- while (reg->GUI_STAT & 1)
- ;
-}
-
-static Bool
-mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait)
-{
- ScreenPtr pScreen = pDst->drawable.pScreen;
- KdScreenPriv(pScreen);
- mach64ScreenInfo(pScreenPriv);
- mach64CardInfo(pScreenPriv);
- CARD32 DST_PITCH;
- CARD32 DST_OFFSET;
- CARD32 SRC_PITCH;
- CARD32 SRC_OFFSET;
-
- reg = mach64c->reg;
- triple = mach64s->bpp24;
-#if SYNC_ALWAYS
- mach64Screen = pScreen;
-#endif
- if (!reg)
- return FALSE;
-
- /*
- * No acceleration for other formats (yet)
- */
- if (pDst->drawable.bitsPerPixel != pScreenPriv->screen->fb[0].bitsPerPixel)
- return FALSE;
-
- /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
- DST_PITCH = pDst->devKind / pDst->drawable.bitsPerPixel;
- if (triple)
- DST_PITCH *= 3;
- /* bytes / 8 */
- DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3;
-
- mach64WaitAvail(reg, wait + (pSrc ? 5 : 4));
- reg->DP_SET_GUI_ENGINE = mach64s->DP_SET_GUI_ENGINE | (combo << 20);
- reg->DP_PIX_WIDTH = mach64s->DP_PIX_WIDTH;
- reg->DST_OFF_PITCH = ((DST_OFFSET << 0) | /* USR1_DST_OFFSET */
- (DST_PITCH << 22) | /* USR1_DST_PITCH */
- 0);
- if (pSrc)
- {
- /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
- SRC_PITCH = pSrc->devKind / pSrc->drawable.bitsPerPixel;
- if (triple)
- SRC_PITCH *= 3;
- /* bytes / 8 */
- SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3;
-
- reg->SRC_OFF_PITCH = ((SRC_OFFSET << 0) |
- (SRC_PITCH << 22) |
- 0);
- }
- return TRUE;
-}
-
-static Bool
-mach64PrepareSolid (PixmapPtr pPixmap,
- int alu,
- Pixel pm,
- Pixel fg)
-{
- if (!mach64Setup (pPixmap, 0, 1, 3))
- return FALSE;
- reg->DP_MIX = (mach64Rop[alu] << 16) | 0;
- reg->DP_WRITE_MSK = pm;
- reg->DP_FRGD_CLR = fg;
- return TRUE;
-}
-
-static void
-mach64Solid (int x1, int y1, int x2, int y2)
-{
- if (triple)
- {
- CARD32 traj;
-
- x1 *= 3;
- x2 *= 3;
-
- traj = (DST_X_DIR |
- DST_Y_DIR |
- DST_24_ROT_EN |
- DST_24_ROT((x1 / 4) % 6));
- mach64WaitAvail (reg, 1);
- reg->GUI_TRAJ_CNTL = traj;
- }
- mach64WaitAvail(reg,2);
- reg->DST_X_Y = MACH64_XY(x1,y1);
- reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1);
-}
-
-static void
-mach64DoneSolid (void)
-{
-#if SYNC_ALWAYS
- KdCheckSync (mach64Screen);
-#endif
-}
-
-static int copyDx;
-static int copyDy;
-static CARD32 copyCombo;
-
-static Bool
-mach64PrepareCopy (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- int dx,
- int dy,
- int alu,
- Pixel pm)
-{
- copyCombo = 8 | 2 | 1;
- copyDx = dx;
- copyDy = dy;
-
- /*
- * Avoid going backwards when copying pixmaps to the screen.
- * This should reduce tearing somewhat
- */
- if (pSrcPixmap == pDstPixmap)
- {
- if (dx <= 0)
- copyCombo &= ~1;
- if (dy <= 0)
- copyCombo &= ~2;
- }
-
- if (!mach64Setup (pDstPixmap, pSrcPixmap, copyCombo, 2))
- return FALSE;
-
- reg->DP_MIX = (mach64Rop[alu] << 16) | 0;
- reg->DP_WRITE_MSK = pm;
- return TRUE;
-}
-
-static void
-mach64Copy (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int w,
- int h)
-{
- if (triple)
- {
- CARD32 traj;
-
- srcX *= 3;
- dstX *= 3;
- w *= 3;
-
- traj = DST_24_ROT_EN | DST_24_ROT((dstX / 4) % 6);
-
- if (copyCombo & 1)
- traj |= 1;
- if (copyCombo & 2)
- traj |= 2;
-
- mach64WaitAvail (reg, 1);
- reg->GUI_TRAJ_CNTL = traj;
- }
- if ((copyCombo & 1) == 0)
- {
- srcX += w - 1;
- dstX += w - 1;
- }
- if ((copyCombo & 2) == 0)
- {
- srcY += h - 1;
- dstY += h - 1;
- }
- mach64WaitAvail (reg, 4);
- reg->SRC_Y_X = MACH64_YX(srcX, srcY);
- reg->SRC_WIDTH1 = w;
- reg->DST_Y_X = MACH64_YX(dstX, dstY);
- reg->DST_HEIGHT_WIDTH = MACH64_YX(w,h);
-}
-
-static void
-mach64DoneCopy (void)
-{
-#if SYNC_ALWAYS
- KdCheckSync (mach64Screen);
-#endif
-}
-
-KaaScreenInfoRec mach64Kaa = {
- mach64PrepareSolid,
- mach64Solid,
- mach64DoneSolid,
-
- mach64PrepareCopy,
- mach64Copy,
- mach64DoneCopy,
-
- 64, /* Offscreen byte alignment */
- 64, /* Offscreen pitch */
- KAA_OFFSCREEN_PIXMAPS, /* Flags */
-};
-
-Bool
-mach64DrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
-
- if (pScreenPriv->screen->fb[0].depth == 4)
- return FALSE;
-
- if (!kaaDrawInit (pScreen, &mach64Kaa))
- return FALSE;
-
- return TRUE;
-}
-
-#define PIX_FORMAT_MONO 0
-#define PIX_FORMAT_PSEUDO_8 2
-#define PIX_FORMAT_TRUE_1555 3
-#define PIX_FORMAT_TRUE_565 4
-#define PIX_FORMAT_TRUE_8888 6
-#define PIX_FORMAT_TRUE_332 7
-#define PIX_FORMAT_GRAY_8 8
-#define PIX_FORMAT_YUV_422 0xb
-#define PIX_FORMAT_YUV_444 0xe
-#define PIX_FORMAT_TRUE_4444 0xf
-
-void
-mach64DrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- mach64ScreenInfo(pScreenPriv);
- CARD32 DP_PIX_WIDTH = 0;
- CARD32 SET_DP_DST_PIX_WIDTH = 0;
-
- avail = 0;
- mach64s->bpp24 = FALSE;
-
- switch (pScreenPriv->screen->fb[0].depth) {
- case 1:
- DP_PIX_WIDTH = ((PIX_FORMAT_MONO << 0) | /* DP_DST_PIX_WIDTH */
- (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
- (PIX_FORMAT_MONO << 8) | /* DP_SRC_PIX_WIDTH */
- (0 << 13) | /* DP_HOST_TRIPLE_EN */
- (0 << 14) | /* DP_PALETTE_TYPE */
- (PIX_FORMAT_MONO << 16) | /* DP_HOST_PIX_WIDTH */
- (0 << 20) | /* DP_C14_RGB_INDEX */
- (0 << 24) | /* DP_BYTE_PIX_ORDER */
- (0 << 25) | /* DP_CONVERSION_TEMP */
- (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
- (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
- (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
- 0);
- SET_DP_DST_PIX_WIDTH = PIX_FORMAT_MONO;
- break;
- case 4:
- FatalError ("mach64 can't accelerate 4bpp");
- break;
- case 8:
- DP_PIX_WIDTH = ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */
- (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
- (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */
- (0 << 13) | /* DP_HOST_TRIPLE_EN */
- (0 << 14) | /* DP_PALETTE_TYPE */
- (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */
- (0 << 20) | /* DP_C14_RGB_INDEX */
- (0 << 24) | /* DP_BYTE_PIX_ORDER */
- (0 << 25) | /* DP_CONVERSION_TEMP */
- (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
- (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
- (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
- 0);
- SET_DP_DST_PIX_WIDTH = PIX_FORMAT_PSEUDO_8;
- break;
- case 15:
- DP_PIX_WIDTH = ((PIX_FORMAT_TRUE_1555 << 0) | /* DP_DST_PIX_WIDTH */
- (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
- (PIX_FORMAT_TRUE_1555 << 8) | /* DP_SRC_PIX_WIDTH */
- (0 << 13) | /* DP_HOST_TRIPLE_EN */
- (0 << 14) | /* DP_PALETTE_TYPE */
- (PIX_FORMAT_TRUE_1555 << 16) | /* DP_HOST_PIX_WIDTH */
- (0 << 20) | /* DP_C14_RGB_INDEX */
- (0 << 24) | /* DP_BYTE_PIX_ORDER */
- (0 << 25) | /* DP_CONVERSION_TEMP */
- (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
- (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
- (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
- 0);
- SET_DP_DST_PIX_WIDTH = PIX_FORMAT_TRUE_1555;
- break;
- case 16:
- DP_PIX_WIDTH = ((PIX_FORMAT_TRUE_565 << 0) | /* DP_DST_PIX_WIDTH */
- (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
- (PIX_FORMAT_TRUE_565 << 8) | /* DP_SRC_PIX_WIDTH */
- (0 << 13) | /* DP_HOST_TRIPLE_EN */
- (0 << 14) | /* DP_PALETTE_TYPE */
- (PIX_FORMAT_TRUE_565 << 16) | /* DP_HOST_PIX_WIDTH */
- (0 << 20) | /* DP_C14_RGB_INDEX */
- (0 << 24) | /* DP_BYTE_PIX_ORDER */
- (0 << 25) | /* DP_CONVERSION_TEMP */
- (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
- (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
- (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
- 0);
- SET_DP_DST_PIX_WIDTH = PIX_FORMAT_TRUE_565;
- break;
- case 24:
- if (pScreenPriv->screen->fb[0].bitsPerPixel == 24)
- {
- mach64s->bpp24 = TRUE;
- DP_PIX_WIDTH = ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */
- (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */
- (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */
- (0 << 13) | /* DP_HOST_TRIPLE_EN */
- (0 << 14) | /* DP_PALETTE_TYPE */
- (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */
- (0 << 20) | /* DP_C14_RGB_INDEX */
- (0 << 24) | /* DP_BYTE_PIX_ORDER */
- (0 << 25) | /* DP_CONVERSION_TEMP */
- (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
- (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
- (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
- 0);
- SET_DP_DST_PIX_WIDTH = PIX_FORMAT_PSEUDO_8;
- }
- else
- {
- DP_PIX_WIDTH = ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */
- (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
- (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */
- (0 << 13) | /* DP_HOST_TRIPLE_EN */
- (0 << 14) | /* DP_PALETTE_TYPE */
- (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */
- (0 << 20) | /* DP_C14_RGB_INDEX */
- (0 << 24) | /* DP_BYTE_PIX_ORDER */
- (0 << 25) | /* DP_CONVERSION_TEMP */
- (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
- (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
- (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
- 0);
- SET_DP_DST_PIX_WIDTH = PIX_FORMAT_TRUE_8888;
- }
- break;
- }
-
- mach64s->DP_PIX_WIDTH = DP_PIX_WIDTH;
- mach64s->DP_SET_GUI_ENGINE = ((SET_DP_DST_PIX_WIDTH << 3) |
- (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
- (6 << 7) | /* SET_DST_OFFSET */
- (0 << 10) | /* SET_DST_PITCH */
- (0 << 14) | /* SET_DST_PITCH_BY_2 */
- (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
- (0 << 16) | /* SET_SRC_HGTWID1_2 */
- (0 << 20) | /* SET_DRAWING_COMBO */
- (1 << 24) | /* SET_BUS_MASTER_OP */
- (0 << 26) | /* SET_BUS_MASTER_EN */
- (0 << 27) | /* SET_BUS_MASTER_SYNC */
- (0 << 28) | /* DP_HOST_TRIPLE_EN */
- (0 << 29) | /* FAST_FILL_EN */
- (0 << 30) | /* BLOCK_WRITE_EN */
- 0);
- KdMarkSync (pScreen);
-}
-
-void
-mach64DrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-mach64DrawFini (ScreenPtr pScreen)
-{
- kaaDrawFini (pScreen);
-}
-
-void
-mach64DrawSync (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- mach64CardInfo(pScreenPriv);
- reg = mach64c->reg;
-
- mach64WaitIdle (reg);
-}
diff --git a/hw/kdrive/mach64/mach64draw.h b/hw/kdrive/mach64/mach64draw.h
deleted file mode 100644
index b7053ae49..000000000
--- a/hw/kdrive/mach64/mach64draw.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Id: tridentdraw.h,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.h,v 1.4 2000/10/11 06:04:40 keithp Exp $ */
-
-#ifndef _TRIDENTDRAW_H_
-#define _TRIDENTDRAW_H_
-
-#define SetupTrident(s) KdScreenPriv(s); \
- tridentCardInfo(pScreenPriv); \
- Cop *cop = tridentc->cop
-
-#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
-
-#define _tridentInit(cop,tridentc) { \
- if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \
- (cop)->multi = (tridentc)->cop_depth; \
- (cop)->multi = (tridentc)->cop_stride; \
- (cop)->multi = TridentAlpha; \
-} \
-
-#define _tridentSetSolidRect(cop,pix,alu,cmd) {\
- cop->multi = COP_MULTI_PATTERN; \
- cop->multi = COP_MULTI_ROP | tridentRop[alu]; \
- cop->fg = (pix); \
- cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
-}
-
-#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \
- (cop)->dst_start_xy = TRI_XY (x1,y1); \
- (cop)->dst_end_xy = TRI_XY(x2,y2); \
- _tridentWaitDone(cop); \
- (cop)->command = (cmd); \
-}
-
-#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
- COP_STATUS_DPE_BUSY | \
- COP_STATUS_MI_BUSY)
-
-#define _tridentWaitDone(cop) { \
- int __q__ = 500000; \
- while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
- ; \
- if (!__q__) \
- (cop)->status = 0; \
-}
-
-#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop)
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-#endif
diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c
deleted file mode 100644
index 29ebb1bc1..000000000
--- a/hw/kdrive/mach64/mach64stub.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Id: mach64stub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/mach64/mach64stub.c,v 1.2 2001/10/12 06:33:10 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mach64.h"
-#include <klinux.h>
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr))
- KdCardInfoAdd (&mach64Funcs, &attr, 0);
- else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr))
- KdCardInfoAdd (&mach64Funcs, &attr, 0);
- else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr))
- KdCardInfoAdd (&mach64Funcs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/mach64/mach64video.c b/hw/kdrive/mach64/mach64video.c
deleted file mode 100644
index 23d671580..000000000
--- a/hw/kdrive/mach64/mach64video.c
+++ /dev/null
@@ -1,1038 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/mach64/mach64video.c,v 1.9tsi Exp $ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mach64.h"
-
-#include <X11/extensions/Xv.h>
-#include "fourcc.h"
-
-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
-
-static Atom xvBrightness, xvSaturation, xvColorKey;
-
-#define IMAGE_MAX_WIDTH 720
-#define IMAGE_MAX_HEIGHT 576
-
-static void
-mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- Reg *reg = mach64c->reg;
- MediaReg *media = mach64c->media_reg;
-
- REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
-
- if (!media)
- return;
-
- if(pPortPriv->videoOn)
- {
- mach64WaitIdle (reg);
- /* wait for buffer to be displayed */
- while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
- ;
- /* wait for buffer to be finished */
- while (((media->TRIG_CNTL >> 6) & 1) != 0)
- ;
- mach64WaitAvail (reg, 1);
- media->OVERLAY_SCALE_CNTL = 0;
- pPortPriv->videoOn = FALSE;
- mach64WaitIdle (reg);
- }
- if (pPortPriv->off_screen)
- {
- KdOffscreenFree (pPortPriv->off_screen);
- pPortPriv->off_screen = 0;
- }
-}
-
-static int
-mach64SetPortAttribute(KdScreenInfo *screen,
- Atom attribute,
- int value,
- pointer data)
-{
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
-
- if(attribute == xvBrightness)
- {
- if(value < -1000)
- value = -1000;
- if (value > 1000)
- value = 1000;
- pPortPriv->brightness = value;
- }
- else if(attribute == xvSaturation)
- {
- if (value < -1000)
- value = -1000;
- if (value > 1000)
- value = 1000;
- pPortPriv->saturation = value;
- }
- else if(attribute == xvColorKey)
- {
- if (pPortPriv->colorKey != value)
- {
- pPortPriv->colorKey = value;
- REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
- }
- }
- else
- return BadMatch;
-
- return Success;
-}
-
-static int
-mach64GetPortAttribute(KdScreenInfo *screen,
- Atom attribute,
- int *value,
- pointer data)
-{
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
-
- if(attribute == xvBrightness)
- *value = pPortPriv->brightness;
- else if(attribute == xvSaturation)
- *value = pPortPriv->saturation;
- else if(attribute == xvColorKey)
- *value = pPortPriv->colorKey;
- else
- return BadMatch;
-
- return Success;
-}
-
-static void
-mach64QueryBestSize(KdScreenInfo *screen,
- Bool motion,
- short vid_w,
- short vid_h,
- short drw_w,
- short drw_h,
- unsigned int *p_w,
- unsigned int *p_h,
- pointer data)
-{
- *p_w = drw_w;
- *p_h = drw_h;
-}
-
-
-static void
-mach64CopyPackedData(KdScreenInfo *screen,
- unsigned char *buf,
- int randr,
- int srcPitch,
- int dstPitch,
- int srcW,
- int srcH,
- int top,
- int left,
- int h,
- int w)
-{
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- CARD8 *src = buf, *dst;
- int srcDown = srcPitch, srcRight = 2, srcNext;
- int p;
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- src = buf;
- srcDown = srcPitch;
- srcRight = 2;
- break;
- case RR_Rotate_90:
- src = buf + (srcH - 1) * 2;
- srcDown = -2;
- srcRight = srcPitch;
- break;
- case RR_Rotate_180:
- src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2;
- srcDown = -srcPitch;
- srcRight = -2;
- break;
- case RR_Rotate_270:
- src = buf + srcPitch * (srcW - 1);
- srcDown = 2;
- srcRight = -srcPitch;
- break;
- }
-
- src = src + top*srcDown + left*srcRight;
-
- if (pPortPriv->currentBuf == 0)
- dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset;
- else
- dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset;
-
- w >>= 1;
- srcRight >>= 1;
- srcNext = srcRight >> 1;
- while(h--)
- {
- CARD16 *s = (CARD16 *) src;
- CARD32 *d = (CARD32 *) dst;
- p = w;
- while (p--)
- {
- *d++ = s[0] | (s[srcNext] << 16);
- s += srcRight;
- }
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-static void
-mach64CopyPlanarData(KdScreenInfo *screen,
- unsigned char *buf,
- int randr,
- int srcPitch,
- int srcPitch2,
- int dstPitch, /* of chroma */
- int srcW,
- int srcH,
- int height,
- int top,
- int left,
- int h,
- int w,
- int id)
-{
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- int i, j;
- CARD8 *src1, *src2, *src3, *dst1;
- int srcDown = srcPitch, srcDown2 = srcPitch2;
- int srcRight = 2, srcRight2 = 1, srcNext = 1;
-
- /* compute source data pointers */
- src1 = buf;
- src2 = src1 + height * srcPitch;
- src3 = src2 + (height >> 1) * srcPitch2;
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcDown2 = srcPitch2;
- srcRight = 2;
- srcRight2 = 1;
- srcNext = 1;
- break;
- case RR_Rotate_90:
- src1 = src1 + srcH - 1;
- src2 = src2 + (srcH >> 1) - 1;
- src3 = src3 + (srcH >> 1) - 1;
- srcDown = -1;
- srcDown2 = -1;
- srcRight = srcPitch * 2;
- srcRight2 = srcPitch2;
- srcNext = srcPitch;
- break;
- case RR_Rotate_180:
- src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- srcDown = -srcPitch;
- srcDown2 = -srcPitch2;
- srcRight = -2;
- srcRight2 = -1;
- srcNext = -1;
- break;
- case RR_Rotate_270:
- src1 = src1 + srcPitch * (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
- srcDown = 1;
- srcDown2 = 1;
- srcRight = -srcPitch * 2;
- srcRight2 = -srcPitch2;
- srcNext = -srcPitch;
- break;
- }
-
- /* adjust for origin */
- src1 += top * srcDown + left * srcNext;
- src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
- src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
-
- if (id == FOURCC_I420)
- {
- CARD8 *srct = src2;
- src2 = src3;
- src3 = srct;
- }
-
- if (pPortPriv->currentBuf == 0)
- dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset;
- else
- dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset;
-
- w >>= 1;
- for (j = 0; j < h; j++)
- {
- CARD32 *dst = (CARD32 *) dst1;
- CARD8 *s1l = src1;
- CARD8 *s1r = src1 + srcNext;
- CARD8 *s2 = src2;
- CARD8 *s3 = src3;
-
- for (i = 0; i < w; i++)
- {
- *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
- s1l += srcRight;
- s1r += srcRight;
- s2 += srcRight2;
- s3 += srcRight2;
- }
- src1 += srcDown;
- dst1 += dstPitch;
- if (j & 1)
- {
- src2 += srcDown2;
- src3 += srcDown2;
- }
- }
-}
-
-static void
-mach64PaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
-{
- GCPtr pGC;
- CARD32 val[2];
- xRectangle *rects, *r;
- BoxPtr pBox = REGION_RECTS (pRgn);
- int nBox = REGION_NUM_RECTS (pRgn);
-
- rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
- if (!rects)
- goto bail0;
- r = rects;
- while (nBox--)
- {
- r->x = pBox->x1 - pDraw->x;
- r->y = pBox->y1 - pDraw->y;
- r->width = pBox->x2 - pBox->x1;
- r->height = pBox->y2 - pBox->y1;
- r++;
- pBox++;
- }
-
- pGC = GetScratchGC (pDraw->depth, pDraw->pScreen);
- if (!pGC)
- goto bail1;
-
- val[0] = fg;
- val[1] = IncludeInferiors;
- ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
-
- ValidateGC (pDraw, pGC);
-
- (*pGC->ops->PolyFillRect) (pDraw, pGC,
- REGION_NUM_RECTS (pRgn), rects);
-
- FreeScratchGC (pGC);
-bail1:
- DEALLOCATE_LOCAL (rects);
-bail0:
- ;
-}
-
-/* Mach64ClipVideo -
-
- 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.
-*/
-
-static void
-Mach64ClipVideo(BoxPtr dst,
- INT32 *x1,
- INT32 *x2,
- INT32 *y1,
- INT32 *y2,
- BoxPtr extents, /* extents of the clip region */
- INT32 width,
- INT32 height)
-{
- INT32 vscale, hscale, delta;
- int diff;
-
- hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
- vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
-
- *x1 <<= 16; *x2 <<= 16;
- *y1 <<= 16; *y2 <<= 16;
-
- diff = extents->x1 - dst->x1;
- if(diff > 0) {
- dst->x1 = extents->x1;
- *x1 += diff * hscale;
- }
- diff = dst->x2 - extents->x2;
- if(diff > 0) {
- dst->x2 = extents->x2;
- *x2 -= diff * hscale;
- }
- diff = extents->y1 - dst->y1;
- if(diff > 0) {
- dst->y1 = extents->y1;
- *y1 += diff * vscale;
- }
- diff = dst->y2 - extents->y2;
- if(diff > 0) {
- dst->y2 = extents->y2;
- *y2 -= diff * vscale;
- }
-
- if(*x1 < 0) {
- diff = (- *x1 + hscale - 1)/ hscale;
- dst->x1 += diff;
- *x1 += diff * hscale;
- }
- delta = *x2 - (width << 16);
- if(delta > 0) {
- diff = (delta + hscale - 1)/ hscale;
- dst->x2 -= diff;
- *x2 -= diff * hscale;
- }
- if(*y1 < 0) {
- diff = (- *y1 + vscale - 1)/ vscale;
- dst->y1 += diff;
- *y1 += diff * vscale;
- }
- delta = *y2 - (height << 16);
- if(delta > 0) {
- diff = (delta + vscale - 1)/ vscale;
- dst->y2 -= diff;
- *y2 -= diff * vscale;
- }
-}
-
-static void
-mach64DisplayVideo(KdScreenInfo *screen,
- int id,
- int dstPitch, /* of chroma for 4:2:0 */
- int x1,
- int y1,
- int x2,
- int y2,
- int dst_x1,
- int dst_y1,
- int dst_x2,
- int dst_y2,
- short src_w,
- short src_h,
- short drw_w,
- short drw_h)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- Reg *reg = mach64c->reg;
- MediaReg *media = mach64c->media_reg;
- int HORZ_INC, VERT_INC;
- CARD32 SCALER_IN;
- int bright;
- int sat;
-
- if (id == FOURCC_UYVY)
- SCALER_IN = SCALER_IN_YVYU422;
- else
- SCALER_IN = SCALER_IN_VYUY422;
-
- mach64WaitAvail (reg, 4);
-
- media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422;
-
- /* color key */
- media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1;
- media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey;
- /* set key control to obey only graphics color key */
- media->OVERLAY_KEY_CNTL = 0x50;
-
- mach64WaitAvail (reg, 9);
- media->CAPTURE_DEBUG = 0;
- /* no exclusive video region */
- media->OVERLAY_EXCLUSIVE_HORZ = 0;
- media->OVERLAY_EXCLUSIVE_VERT = 0;
- /* scaling coefficients */
- media->SCALER_H_COEFF0 = 0x00002000;
- media->SCALER_H_COEFF1 = 0x0D06200D;
- media->SCALER_H_COEFF2 = 0x0D0A1C0D;
- media->SCALER_H_COEFF3 = 0x0C0E1A0C;
- media->SCALER_H_COEFF4 = 0x0C14140C;
- media->SCALER_TEST = 0;
-
- mach64WaitAvail (reg, 2);
- media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND |
- SCALE_GAMMA_BRIGHT |
- SCALE_BANDWIDTH |
- SCALE_OVERLAY_EN |
- SCALE_EN);
-
- bright = (pPortPriv->brightness * 64 / 1000);
- if (bright < -0x40)
- bright = -0x40;
- if (bright > 0x3f)
- bright = 0x3f;
- bright = bright & 0x7f;
- sat = ((pPortPriv->saturation * 31 + 31000) / 2000);
- if (sat > 0x1f)
- sat = 0x1f;
- if (sat < 0)
- sat = 0;
-
- media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */
- (sat << 8) | /* SATURATION_U */
- (sat << 16) | /* SATURATION_V */
- (0 << 21) | /* SCALER_VERT_ADJ_UV */
- (0 << 28)); /* SCALER_HORZ_ADJ_UV */
-
- VERT_INC = (src_h << 12) / drw_h;
- HORZ_INC = (src_w << 12) / drw_w;
-
- mach64WaitAvail (reg, 13);
-
- /* lock registers to prevent non-atomic update */
- media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1);
- /* ending screen coordinate */
- media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2);
-
- media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC);
-
- media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF_PITCH = dstPitch >> 1;
- media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16));
-
- media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28;
-
- /* set XY location and unlock */
- media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1);
-}
-
-static void
-mach64VideoSave (KdOffscreenArea *area)
-{
- ScreenPtr pScreen = area->screen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
-
- if (pPortPriv->off_screen == area)
- pPortPriv->off_screen = 0;
-}
-
-static int
-mach64PutImage(KdScreenInfo *screen,
- DrawablePtr pDraw,
- 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)
-{
- KdCardInfo *card = screen->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
- MediaReg *media = mach64c->media_reg;
- INT32 x1, x2, y1, y2;
- int randr = mach64s->vesa.randr;
- int srcPitch, srcPitch2, dstPitch;
- int top, left, npixels, nlines, size;
- BoxRec dstBox;
- int dst_width = width, dst_height = height;
- int rot_x1, rot_y1, rot_x2, rot_y2;
- int dst_x1, dst_y1, dst_x2, dst_y2;
- int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
-
- /* Clip */
- x1 = src_x;
- x2 = src_x + src_w;
- y1 = src_y;
- y2 = src_y + src_h;
-
- dstBox.x1 = drw_x;
- dstBox.x2 = drw_x + drw_w;
- dstBox.y1 = drw_y;
- dstBox.y2 = drw_y + drw_h;
-
- Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2,
- REGION_EXTENTS(pScreen, clipBoxes), width, height);
-
- if((x1 >= x2) || (y1 >= y2))
- return Success;
-
- if (!media)
- return BadAlloc;
-
- if (randr & (RR_Rotate_0|RR_Rotate_180))
- {
- dst_width = width;
- dst_height = height;
- rot_src_w = src_w;
- rot_src_h = src_h;
- rot_drw_w = drw_w;
- rot_drw_h = drw_h;
- }
- else
- {
- dst_width = height;
- dst_height = width;
- rot_src_w = src_h;
- rot_src_h = src_w;
- rot_drw_w = drw_h;
- rot_drw_h = drw_w;
- }
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- default:
- dst_x1 = dstBox.x1;
- dst_y1 = dstBox.y1;
- dst_x2 = dstBox.x2;
- dst_y2 = dstBox.y2;
- rot_x1 = x1;
- rot_y1 = y1;
- rot_x2 = x2;
- rot_y2 = y2;
- break;
- case RR_Rotate_90:
- dst_x1 = dstBox.y1;
- dst_y1 = screen->height - dstBox.x2;
- dst_x2 = dstBox.y2;
- dst_y2 = screen->height - dstBox.x1;
-
- rot_x1 = y1;
- rot_y1 = (src_w << 16) - x2;
- rot_x2 = y2;
- rot_y2 = (src_w << 16) - x1;
- break;
- case RR_Rotate_180:
- dst_x1 = screen->width - dstBox.x2;
- dst_y1 = screen->height - dstBox.y2;
- dst_x2 = screen->width - dstBox.x1;
- dst_y2 = screen->height - dstBox.y1;
- rot_x1 = (src_w << 16) - x2;
- rot_y1 = (src_h << 16) - y2;
- rot_x2 = (src_w << 16) - x1;
- rot_y2 = (src_h << 16) - y1;
- break;
- case RR_Rotate_270:
- dst_x1 = screen->width - dstBox.y2;
- dst_y1 = dstBox.x1;
- dst_x2 = screen->width - dstBox.y1;
- dst_y2 = dstBox.x2;
- rot_x1 = (src_h << 16) - y2;
- rot_y1 = x1;
- rot_x2 = (src_h << 16) - y1;
- rot_y2 = x2;
- break;
- }
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- dstPitch = ((dst_width << 1) + 15) & ~15;
- srcPitch = (width + 3) & ~3;
- srcPitch2 = ((width >> 1) + 3) & ~3;
- size = dstPitch * (int) dst_height;
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- dstPitch = ((dst_width << 1) + 15) & ~15;
- srcPitch = (width << 1);
- srcPitch2 = 0;
- size = dstPitch * (int) dst_height;
- break;
- }
-
- if (pPortPriv->off_screen && size != pPortPriv->size)
- {
- KdOffscreenFree (pPortPriv->off_screen);
- pPortPriv->off_screen = 0;
- }
-
- if (!pPortPriv->off_screen)
- {
- pPortPriv->off_screen = KdOffscreenAlloc (screen->pScreen, size * 2, 64,
- TRUE, mach64VideoSave,
- pPortPriv);
- if (!pPortPriv->off_screen)
- return BadAlloc;
- }
-
- pPortPriv->offset = pPortPriv->off_screen->offset;
- pPortPriv->size = size;
- /* fixup pointers */
-
- pPortPriv->YBuf0Offset = pPortPriv->offset;
- pPortPriv->YBuf1Offset = pPortPriv->offset + size;
-
-#if 0
- mach64WaitIdle (reg);
-
- if (pPortPriv->videoOn)
- {
- /* wait for buffer to be displayed */
- while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
- ;
- }
-#endif
- /*
- * Use the other buffer
- */
- pPortPriv->currentBuf = 1 - pPortPriv->currentBuf;
-
- /* copy data */
- top = rot_y1 >> 16;
- left = (rot_x1 >> 16) & ~1;
- npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- top &= ~1;
- nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
- mach64CopyPlanarData(screen, buf, randr,
- srcPitch, srcPitch2, dstPitch,
- rot_src_w, rot_src_h, height,
- top, left, nlines, npixels, id);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- nlines = ((rot_y2 + 0xffff) >> 16) - top;
- mach64CopyPackedData(screen, buf, randr,
- srcPitch, dstPitch,
- rot_src_w, rot_src_h,
- top, left, nlines,
- npixels);
- break;
- }
-
- mach64DisplayVideo(screen, id, dstPitch,
- rot_x1, rot_y1, rot_x2, rot_y2,
- dst_x1, dst_y1,
- dst_x2, dst_y2,
- rot_src_w, rot_src_h, rot_drw_w, rot_drw_h);
-
- /* update cliplist */
- if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
- {
- REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
- mach64PaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
- }
-
- pPortPriv->videoOn = TRUE;
-
- return Success;
-}
-
-static int
-mach64QueryImageAttributes(KdScreenInfo *screen,
- int id,
- unsigned short *w,
- unsigned short *h,
- int *pitches,
- int *offsets)
-{
- int size, tmp;
-
- if(*w > IMAGE_MAX_WIDTH)
- *w = IMAGE_MAX_WIDTH;
- if(*h > IMAGE_MAX_HEIGHT)
- *h = IMAGE_MAX_HEIGHT;
-
- *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;
-}
-
-
-/* client libraries expect an encoding */
-static KdVideoEncodingRec DummyEncoding[1] =
-{
- {
- 0,
- "XV_IMAGE",
- IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
- {1, 1}
- }
-};
-
-#define NUM_FORMATS 3
-
-static KdVideoFormatRec Formats[NUM_FORMATS] =
-{
- {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
-};
-
-#define NUM_ATTRIBUTES 3
-
-static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
-{
- {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"},
- {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
- {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}
-};
-
-#define NUM_IMAGES 4
-
-static KdImageRec Images[NUM_IMAGES] =
-{
- XVIMAGE_YUY2,
- XVIMAGE_YV12,
- XVIMAGE_I420,
- XVIMAGE_UYVY
-};
-
-static void mach64ResetVideo(KdScreenInfo *screen)
-{
-}
-
-static int
-mach64ReputImage (KdScreenInfo *screen,
- DrawablePtr pDraw,
- short drw_x,
- short drw_y,
- RegionPtr clipBoxes,
- pointer data)
-{
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
- BoxPtr pOldExtents = REGION_EXTENTS (screen->pScreen, &pPortPriv->clip);
- BoxPtr pNewExtents = REGION_EXTENTS (screen->pScreen, clipBoxes);
-
- if (pOldExtents->x1 == pNewExtents->x1 &&
- pOldExtents->x2 == pNewExtents->x2 &&
- pOldExtents->y1 == pNewExtents->y1 &&
- pOldExtents->y2 == pNewExtents->y2)
- {
- /* update cliplist */
- if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
- {
- REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
- mach64PaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
- }
- return Success;
- }
- return BadMatch;
-}
-
-static KdVideoAdaptorPtr
-mach64SetupImageVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- mach64ScreenInfo(pScreenPriv);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdVideoAdaptorPtr adapt;
- Mach64PortPrivPtr pPortPriv;
-
- if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) +
- sizeof(Mach64PortPrivRec) +
- sizeof(DevUnion))))
- return NULL;
-
- adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
- adapt->name = "Mach64 Video Overlay";
- adapt->nEncodings = 1;
- adapt->pEncodings = DummyEncoding;
- adapt->nFormats = NUM_FORMATS;
- adapt->pFormats = Formats;
- adapt->nPorts = 1;
- adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
-
- pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]);
-
- adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv);
- adapt->pAttributes = Attributes;
- adapt->nImages = NUM_IMAGES;
- adapt->nAttributes = NUM_ATTRIBUTES;
- adapt->pImages = Images;
- adapt->PutVideo = NULL;
- adapt->PutStill = NULL;
- adapt->GetVideo = NULL;
- adapt->GetStill = NULL;
- adapt->StopVideo = mach64StopVideo;
- adapt->SetPortAttribute = mach64SetPortAttribute;
- adapt->GetPortAttribute = mach64GetPortAttribute;
- adapt->QueryBestSize = mach64QueryBestSize;
- adapt->PutImage = mach64PutImage;
- adapt->ReputImage = mach64ReputImage;
- adapt->QueryImageAttributes = mach64QueryImageAttributes;
-
- pPortPriv->colorKey = mach64s->colorKey;
- pPortPriv->videoOn = FALSE;
- pPortPriv->brightness = 0;
- pPortPriv->saturation = 0;
- pPortPriv->currentBuf = 0;
- pPortPriv->off_screen = 0;
- pPortPriv->size = 0;
- pPortPriv->offset = 0;
-
- /* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
-
- mach64s->pAdaptor = adapt;
-
- xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
- xvSaturation = MAKE_ATOM("XV_SATURATION");
- xvColorKey = MAKE_ATOM("XV_COLORKEY");
-
- mach64ResetVideo(screen);
-
- return adapt;
-}
-
-Bool mach64InitVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
- KdVideoAdaptorPtr newAdaptor = NULL;
- int num_adaptors;
- KdCardInfo *card = pScreenPriv->card;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
-
- mach64s->pAdaptor = NULL;
-
- if (!mach64c->media_reg)
- return FALSE;
-
- newAdaptor = mach64SetupImageVideo(pScreen);
-
- num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
-
- if(newAdaptor)
- {
- if(!num_adaptors)
- {
- num_adaptors = 1;
- adaptors = &newAdaptor;
- }
- else
- {
- newAdaptors = xalloc((num_adaptors + 1) *
- sizeof(KdVideoAdaptorPtr*));
- if(newAdaptors)
- {
- memcpy(newAdaptors, adaptors,
- num_adaptors * sizeof(KdVideoAdaptorPtr));
- newAdaptors[num_adaptors] = newAdaptor;
- adaptors = newAdaptors;
- num_adaptors++;
- }
- }
- }
-
- if(num_adaptors)
- KdXVScreenInit(pScreen, adaptors, num_adaptors);
-
- if(newAdaptors)
- xfree(newAdaptors);
- return TRUE;
-}
-
-void
-mach64FiniVideo (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- mach64ScreenInfo(pScreenPriv);
- KdVideoAdaptorPtr adapt = mach64s->pAdaptor;
-
- if (adapt)
- {
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]);
- REGION_UNINIT (pScreen, &pPortPriv->clip);
- xfree (adapt);
- }
-}
diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am
deleted file mode 100644
index 56fa3a0cf..000000000
--- a/hw/kdrive/mga/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- -I$(top_srcdir)/hw/kdrive/vesa \
- @XSERVER_CFLAGS@
-
-bin_PROGRAMS = Xmga
-
-noinst_LIBRARIES = libmga.a
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-libmga_a_SOURCES = \
- mgadraw.c \
- mga.c \
- mga.h
-
-Xmga_SOURCES = \
- mgastub.c
-
-Xmga_LDADD = \
- libmga.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
diff --git a/hw/kdrive/mga/mga.c b/hw/kdrive/mga/mga.c
deleted file mode 100644
index 556b9b18f..000000000
--- a/hw/kdrive/mga/mga.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mga.h"
-
-static Bool
-mgaCardInit (KdCardInfo *card)
-{
- MgaCardInfo *mgac;
-
- mgac = (MgaCardInfo *) xalloc (sizeof (MgaCardInfo));
- if (!mgac)
- return FALSE;
-
- mgaMapReg (card, mgac);
-
- if (!vesaInitialize (card, &mgac->vesa))
- {
- xfree (mgac);
- return FALSE;
- }
-
- mgac->fifo_size = 0;
-
- card->driver = mgac;
-
- return TRUE;
-}
-
-static Bool
-mgaScreenInit (KdScreenInfo *screen)
-{
- MgaScreenInfo *mgas;
-
- mgas = (MgaScreenInfo *) xalloc (sizeof (MgaScreenInfo));
- if (!mgas)
- return FALSE;
- memset (mgas, '\0', sizeof (MgaScreenInfo));
- if (!vesaScreenInitialize (screen, &mgas->vesa))
- {
- xfree (mgas);
- return FALSE;
- }
-#if 0
- /* if (!mgac->reg)
- screen->dumb = TRUE; */
-
- if (mgas->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
-
- fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping);
-#endif
- screen->driver = mgas;
- return TRUE;
-}
-
-static Bool
-mgaInitScreen (ScreenPtr pScreen)
-{
- return vesaInitScreen (pScreen);
-}
-
-static Bool
-mgaFinishInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
-
- ret = vesaFinishInitScreen (pScreen);
-
- return ret;
-}
-
-static Bool
-mgaCreateResources (ScreenPtr pScreen)
-{
- return vesaCreateResources (pScreen);
-}
-
-static void
-mgaPreserve (KdCardInfo *card)
-{
- vesaPreserve (card);
-}
-
-Bool
-mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac)
-{
- mgac->reg_base = (CARD8 *) KdMapDevice (MGA_REG_BASE (card),
- MGA_REG_SIZE (card));
-
- if (!mgac->reg_base)
- {
- return FALSE;
- }
-
- KdSetMappedMode (MGA_REG_BASE (card),
- MGA_REG_SIZE (card),
- KD_MAPPED_MODE_REGISTERS);
-
- return TRUE;
-}
-
-void
-mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac)
-{
- if (mgac->reg_base)
- {
- KdResetMappedMode (MGA_REG_BASE (card),
- MGA_REG_SIZE (card),
- KD_MAPPED_MODE_REGISTERS);
- KdUnmapDevice ((void *) mgac->reg_base, MGA_REG_SIZE (card));
- mgac->reg_base = 0;
- // mgac->reg = 0;
- }
-}
-
-void
-mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac)
-{
- if (!mgac->reg_base)
- mgaMapReg (card, mgac);
-}
-
-void
-mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac)
-{
- mgaUnmapReg (card, mgac);
-}
-
-static Bool
-mgaDPMS (ScreenPtr pScreen, int mode)
-{
- /* XXX */
- return TRUE;
-}
-
-static Bool
-mgaEnable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- MgaCardInfo *mgac = pScreenPriv->card->driver;
-
- if (!vesaEnable (pScreen))
- return FALSE;
-
- mgaSetMMIO (pScreenPriv->card, mgac);
- mgaDPMS (pScreen, KD_DPMS_NORMAL);
-
- return TRUE;
-}
-
-static void
-mgaDisable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- MgaCardInfo *mgac = pScreenPriv->card->driver;
-
- mgaResetMMIO (pScreenPriv->card, mgac);
-
- vesaDisable (pScreen);
-}
-
-static void
-mgaRestore (KdCardInfo *card)
-{
- MgaCardInfo *mgac = card->driver;
-
- mgaResetMMIO (card, mgac);
- vesaRestore (card);
-}
-
-static void
-mgaScreenFini (KdScreenInfo *screen)
-{
- MgaScreenInfo *mgas = (MgaScreenInfo *) screen->driver;
-
- vesaScreenFini (screen);
- xfree (mgas);
- screen->driver = 0;
-}
-
-static void
-mgaCardFini (KdCardInfo *card)
-{
- MgaCardInfo *mgac = (MgaCardInfo *)card->driver;
-
- mgaUnmapReg (card, mgac);
- vesaCardFini (card);
-}
-
-KdCardFuncs mgaFuncs = {
- mgaCardInit, /* cardinit */
- mgaScreenInit, /* scrinit */
- mgaInitScreen, /* initScreen */
- mgaFinishInitScreen, /* finishInitScreen */
- mgaCreateResources, /* createRes */
- mgaPreserve, /* preserve */
- mgaEnable, /* enable */
- mgaDPMS, /* dpms */
- mgaDisable, /* disable */
- mgaRestore, /* restore */
- mgaScreenFini, /* scrfini */
- mgaCardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- mgaDrawInit, /* initAccel */
- mgaDrawEnable, /* enableAccel */
- mgaDrawSync, /* syncAccel */
- mgaDrawDisable, /* disableAccel */
- mgaDrawFini, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-};
-
diff --git a/hw/kdrive/mga/mga.h b/hw/kdrive/mga/mga.h
deleted file mode 100644
index ff9716d85..000000000
--- a/hw/kdrive/mga/mga.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-
-#ifndef _MGA_H_
-#define _MGA_H_
-#include <vesa.h>
-#include <klinux.h>
-
-#define MGA_REG_BASE(c) ((c)->attr.address[1])
-#define MGA_REG_SIZE(c) (0x4000)
-
-#define MGA_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
-#define MGA_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
-
-#define MGA_REG_EXEC (0x0100)
-#define MGA_REG_DWGCTL (0x1c00)
-#define MGA_REG_PLNWT (0x1c1c)
-#define MGA_REG_FCOL (0x1c24)
-#define MGA_REG_MACCESS (0x1c04)
-#define MGA_REG_SGN (0x1c58)
-#define MGA_REG_AR0 (0x1c60)
-#define MGA_REG_AR1 (0x1c64)
-#define MGA_REG_AR2 (0x1c68)
-#define MGA_REG_AR3 (0x1c6C)
-#define MGA_REG_AR4 (0x1c70)
-#define MGA_REG_AR5 (0x1c74)
-#define MGA_REG_AR6 (0x1c78)
-
-#define MGA_REG_CXBNDRY (0x1c80)
-#define MGA_REG_FXBNDRY (0x1c84)
-#define MGA_REG_YDSTLEN (0x1c88)
-#define MGA_REG_PITCH (0x1c8c)
-#define MGA_REG_YTOP (0x1c98)
-#define MGA_REG_YBOT (0x1c9c)
-#define MGA_REG_FIFOSTATUS (0x1e10)
-#define MGA_REG_STATUS (0x1e14)
-#define MGA_REG_SRCORG (0x2cb4)
-#define MGA_REG_DSTORG (0x2cb8)
-
-#define MGA_PW8 (0)
-#define MGA_PW16 (1)
-#define MGA_PW24 (2)
-#define MGA_PW32 (3)
-
-/* Drawing opcodes */
-#define MGA_OPCOD_TRAP (4)
-#define MGA_OPCOD_BITBLT (8)
-
-#define MGA_DWGCTL_SOLID (1 << 11)
-#define MGA_DWGCTL_ARZERO (1 << 12)
-#define MGA_DWGCTL_SGNZERO (1 << 13)
-#define MGA_DWGCTL_SHIFTZERO (1 << 14)
-
-#define MGA_DWGCTL_BFCOL (2 << 25)
-
-#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)
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _mgaCardInfo {
- VesaCardPrivRec vesa;
- CARD8 *reg_base;
- int fifo_size;
-} MgaCardInfo;
-
-#define getMgaCardInfo(kd) ((MgaCardInfo *) ((kd)->card->driver))
-#define mgaCardInfo(kd) MgaCardInfo *mgac = getMgaCardInfo(kd)
-
-typedef struct _mgaScreenInfo {
- VesaScreenPrivRec vesa;
-
- int pitch;
- int pw;
-
-} MgaScreenInfo;
-
-#define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver))
-#define mgaScreenInfo(kd) MgaScreenInfo *mgas = getMgaScreenInfo(kd)
-
-Bool
-mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac);
-
-void
-mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac);
-
-void
-mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
-
-void
-mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
-
-Bool
-mgaDrawSetup (ScreenPtr pScreen);
-
-Bool
-mgaDrawInit (ScreenPtr pScreen);
-
-void
-mgaDrawEnable (ScreenPtr pScreen);
-
-void
-mgaDrawSync (ScreenPtr pScreen);
-
-void
-mgaDrawDisable (ScreenPtr pScreen);
-
-void
-mgaDrawFini (ScreenPtr pScreen);
-
-extern KdCardFuncs mgaFuncs;
-
-#endif /* _MGA_H_ */
diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c
deleted file mode 100644
index 04cd44fc9..000000000
--- a/hw/kdrive/mga/mgadraw.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mga.h"
-
-CARD32 mgaRop[16] = {
- /* GXclear */ MGA_ATYPE_RPL | 0x00000000, /* 0 */
- /* GXand */ MGA_ATYPE_RSTR | 0x00080000, /* src AND dst */
- /* GXandReverse */ MGA_ATYPE_RSTR | 0x00040000, /* src AND NOT dst */
- /* GXcopy */ MGA_ATYPE_RSTR | 0x000c0000, /* src */
- /* GXandInverted */ MGA_ATYPE_RSTR | 0x00020000, /* NOT src AND dst */
- /* GXnoop */ MGA_ATYPE_RSTR | 0x000a0000, /* dst */
- /* GXxor */ MGA_ATYPE_RSTR | 0x00060000, /* src XOR dst */
- /* GXor */ MGA_ATYPE_RSTR | 0x000e0000, /* src OR dst */
- /* GXnor */ MGA_ATYPE_RSTR | 0x00010000, /* NOT src AND NOT dst */
- /* GXequiv */ MGA_ATYPE_RSTR | 0x00090000, /* NOT src XOR dst */
- /* GXinvert */ MGA_ATYPE_RSTR | 0x00050000, /* NOT dst */
- /* GXorReverse */ MGA_ATYPE_RSTR | 0x000d0000, /* src OR NOT dst */
- /* GXcopyInverted */ MGA_ATYPE_RPL | 0x00030000, /* NOT src */
- /* GXorInverted */ MGA_ATYPE_RSTR | 0x000b0000, /* NOT src OR dst */
- /* GXnand */ MGA_ATYPE_RSTR | 0x00070000, /* NOT src OR NOT dst */
- /* GXset */ MGA_ATYPE_RPL | 0x000f0000 /* 1 */
-};
-
-static VOL8 *mmio;
-int fifo_size;
-int pitch, src_pitch;
-int dir;
-
-static void
-mgaWaitAvail (int n)
-{
- if (fifo_size < n) {
- while ((fifo_size = MGA_IN32 (mmio, MGA_REG_FIFOSTATUS) & 0xff) < n)
- ;
- }
-
- fifo_size -= n;
-}
-
-static void
-mgaWaitIdle (void)
-{
- while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000);
-}
-
-static Bool
-mgaSetup (ScreenPtr pScreen, int wait)
-{
- KdScreenPriv (pScreen);
- mgaScreenInfo (pScreenPriv);
- mgaCardInfo (pScreenPriv);
-
- fifo_size = 0;
- mmio = mgac->reg_base;
- pitch = mgas->pitch;
-
- if (!mmio)
- return FALSE;
-
- mgaWaitAvail (wait + 4);
- MGA_OUT32 (mmio, MGA_REG_MACCESS, mgas->pw);
- MGA_OUT32 (mmio, MGA_REG_CXBNDRY, 0xffff0000);
- MGA_OUT32 (mmio, MGA_REG_YTOP, 0x00000000);
- MGA_OUT32 (mmio, MGA_REG_YBOT, 0x007fffff);
-
- return TRUE;
-}
-
-static Bool
-mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
-{
- KdScreenPriv(pPixmap->drawable.pScreen);
- int cmd;
- int dst_org;
-
- cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO |
- MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
-
- dst_org = (int)pPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base;
-
- mgaSetup (pPixmap->drawable.pScreen, 5);
-
- MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org);
- MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3));
- MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
- MGA_OUT32 (mmio, MGA_REG_FCOL, fg);
- MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
-
- return TRUE;
-}
-
-static void
-mgaSolid (int x1, int y1, int x2, int y2)
-{
- mgaWaitAvail (2);
-
- MGA_OUT32 (mmio, MGA_REG_FXBNDRY, (x2 << 16) | (x1 & 0xffff));
- MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (y1 << 16) | (y2 - y1));
-}
-
-static void
-mgaDoneSolid (void)
-{
-}
-
-#define BLIT_LEFT 1
-#define BLIT_UP 4
-
-static Bool
-mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap,
- int dx, int dy, int alu, Pixel pm)
-{
- KdScreenPriv(pSrcPixmap->drawable.pScreen);
-
- int cmd;
-
- cmd = MGA_OPCOD_BITBLT | MGA_DWGCTL_BFCOL | MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
-
- dir = 0;
-
- if (dy < 0)
- dir |= BLIT_UP;
- if (dx < 0)
- dir |= BLIT_LEFT;
-
- mgaSetup (pSrcPixmap->drawable.pScreen, 7);
-
- MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pSrcPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base));
- MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base));
- MGA_OUT32 (mmio, MGA_REG_PITCH, pDstPixmap->devKind / (pDstPixmap->drawable.bitsPerPixel >> 3));
- src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3);
-
- MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
- MGA_OUT32 (mmio, MGA_REG_SGN, dir);
- MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
- MGA_OUT32 (mmio, MGA_REG_AR5, src_pitch * (dy < 0 ? -1 : 1) );
-
- return TRUE;
-}
-
-static void
-mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h)
-{
- int start, end;
-
- if (dir & BLIT_UP)
- {
- srcY += h - 1;
- dstY += h - 1;
- }
-
- w--;
- start = end = srcY * src_pitch + srcX;
-
- if (dir & BLIT_LEFT)
- start += w;
- else
- end += w;
-
- mgaWaitAvail (4);
- MGA_OUT32 (mmio, MGA_REG_AR0, end);
- MGA_OUT32 (mmio, MGA_REG_AR3, start);
- MGA_OUT32 (mmio, MGA_REG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff));
- MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (dstY << 16) | h);
-}
-
-static void
-mgaDoneCopy (void)
-{
-}
-
-KaaScreenInfoRec mgaKaa = {
- mgaPrepareSolid,
- mgaSolid,
- mgaDoneSolid,
-
- mgaPrepareCopy,
- mgaCopy,
- mgaDoneCopy,
-
- 192, /* Offscreen byte alignment */
- 64, /* Offset pitch */
- KAA_OFFSCREEN_PIXMAPS, /* Flags */
-};
-
-Bool
-mgaDrawInit (ScreenPtr pScreen)
-{
- if (!kaaDrawInit (pScreen, &mgaKaa))
- return FALSE;
-
- return TRUE;
-}
-
-void
-mgaDrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- mgaScreenInfo (pScreenPriv);
-
- mgas->pitch = pScreenPriv->screen->width;
-
- switch (pScreenPriv->screen->fb[0].depth) {
- case 8:
- mgas->pw = MGA_PW8;
- break;
- case 16:
- mgas->pw = MGA_PW16;
- break;
- case 24:
- mgas->pw = MGA_PW24;
- break;
- case 32:
- mgas->pw = MGA_PW32;
- break;
- default:
- FatalError ("unsupported pixel format");
- }
-
- KdMarkSync (pScreen);
-}
-
-void
-mgaDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-mgaDrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-mgaDrawSync (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- mgaCardInfo (pScreenPriv);
-
- mmio = mgac->reg_base;
-
- mgaWaitIdle ();
-}
diff --git a/hw/kdrive/mga/mgastub.c b/hw/kdrive/mga/mgastub.c
deleted file mode 100644
index 45f6f5792..000000000
--- a/hw/kdrive/mga/mgastub.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mga.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x102b, 0x0525, 0, &attr))
- KdCardInfoAdd (&mgaFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/nvidia/Makefile.am b/hw/kdrive/nvidia/Makefile.am
deleted file mode 100644
index 41ad93691..000000000
--- a/hw/kdrive/nvidia/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- -I$(top_srcdir)/hw/kdrive/vesa \
- @XSERVER_CFLAGS@
-
-bin_PROGRAMS = Xnvidia
-
-noinst_LIBRARIES = libnvidia.a
-
-# nvidiavideo.c
-
-libnvidia_a_SOURCES = \
- nvidia.c \
- nvidiadraw.c \
- fourcc.h \
- nvidia.h \
- nvidiadraw.h
-
-
-Xnvidia_SOURCES = \
- nvidiastub.c
-
-Xnvidia_LDADD = \
- libnvidia.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@
diff --git a/hw/kdrive/nvidia/fourcc.h b/hw/kdrive/nvidia/fourcc.h
deleted file mode 100644
index b19f5decc..000000000
--- a/hw/kdrive/nvidia/fourcc.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.4 2003/04/23 21:51:24 tsi Exp $ */
-
-/*
- This header file contains listings of STANDARD guids for video formats.
- Please do not place non-registered, or incomplete entries in this file.
- A list of some popular fourcc's are at: http://www.webartz.com/fourcc/
- For an explanation of fourcc <-> guid mappings see RFC2361.
-*/
-
-#ifndef _XF86_FOURCC_H_
-#define _XF86_FOURCC_H_ 1
-
-#define FOURCC_YUY2 0x32595559
-#define XVIMAGE_YUY2 \
- { \
- FOURCC_YUY2, \
- XvYUV, \
- LSBFirst, \
- {'Y','U','Y','2', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 16, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 1, 1, \
- {'Y','U','Y','V', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_YV12 0x32315659
-#define XVIMAGE_YV12 \
- { \
- FOURCC_YV12, \
- XvYUV, \
- LSBFirst, \
- {'Y','V','1','2', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 12, \
- XvPlanar, \
- 3, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 2, 2, \
- {'Y','V','U', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_I420 0x30323449
-#define XVIMAGE_I420 \
- { \
- FOURCC_I420, \
- XvYUV, \
- LSBFirst, \
- {'I','4','2','0', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 12, \
- XvPlanar, \
- 3, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 2, 2, \
- {'Y','U','V', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-
-#define FOURCC_UYVY 0x59565955
-#define XVIMAGE_UYVY \
- { \
- FOURCC_UYVY, \
- XvYUV, \
- LSBFirst, \
- {'U','Y','V','Y', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 16, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 2, 2, \
- 1, 1, 1, \
- {'U','Y','V','Y', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_IA44 0x34344149
-#define XVIMAGE_IA44 \
- { \
- FOURCC_IA44, \
- XvYUV, \
- LSBFirst, \
- {'I','A','4','4', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 8, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 1, 1, \
- 1, 1, 1, \
- {'A','I', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#define FOURCC_AI44 0x34344941
-#define XVIMAGE_AI44 \
- { \
- FOURCC_AI44, \
- XvYUV, \
- LSBFirst, \
- {'A','I','4','4', \
- 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
- 8, \
- XvPacked, \
- 1, \
- 0, 0, 0, 0, \
- 8, 8, 8, \
- 1, 1, 1, \
- 1, 1, 1, \
- {'I','A', \
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
- XvTopToBottom \
- }
-
-#endif /* _XF86_FOURCC_H_ */
diff --git a/hw/kdrive/nvidia/nvidia.c b/hw/kdrive/nvidia/nvidia.c
deleted file mode 100644
index fa53476b1..000000000
--- a/hw/kdrive/nvidia/nvidia.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "nvidia.h"
-#include <sys/io.h>
-
-static Bool
-nvidiaCardInit (KdCardInfo *card)
-{
- NvidiaCardInfo *nvidiac;
-
- nvidiac = (NvidiaCardInfo *) xalloc (sizeof (NvidiaCardInfo));
- if (!nvidiac)
- return FALSE;
-
- (void) nvidiaMapReg (card, nvidiac);
-
- if (!vesaInitialize (card, &nvidiac->vesa))
- {
- xfree (nvidiac);
- return FALSE;
- }
-
- card->driver = nvidiac;
-
- return TRUE;
-}
-
-static Bool
-nvidiaScreenInit (KdScreenInfo *screen)
-{
- NvidiaCardInfo *nvidiac = screen->card->driver;
- NvidiaScreenInfo *nvidias;
- int screen_size, memory;
-
- nvidias = (NvidiaScreenInfo *) xalloc (sizeof (NvidiaScreenInfo));
- if (!nvidias)
- return FALSE;
- memset (nvidias, '\0', sizeof (NvidiaScreenInfo));
- if (!vesaScreenInitialize (screen, &nvidias->vesa))
- {
- xfree (nvidias);
- return FALSE;
- }
- if (!nvidiac->reg_base)
- screen->dumb = TRUE;
- if (nvidias->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
- nvidias->screen = nvidias->vesa.fb;
- memory = nvidias->vesa.fb_size;
- screen_size = screen->fb[0].byteStride * screen->height;
- if (nvidias->screen && memory >= screen_size + 2048)
- {
- memory -= 2048;
- nvidias->cursor_base = nvidias->screen + memory - 2048;
- }
- else
- nvidias->cursor_base = 0;
- screen->softCursor = TRUE; /* XXX for now */
- memory -= screen_size;
- if (memory > screen->fb[0].byteStride)
- {
- nvidias->off_screen = nvidias->screen + screen_size;
- nvidias->off_screen_size = memory;
- }
- else
- {
- nvidias->off_screen = 0;
- nvidias->off_screen_size = 0;
- }
- screen->driver = nvidias;
- return TRUE;
-}
-
-static Bool
-nvidiaInitScreen (ScreenPtr pScreen)
-{
-#if 0
-#ifdef XV
- KdScreenPriv(pScreen);
- NvidiaCardInfo *nvidiac = pScreenPriv->screen->card->driver;
- if (nvidiac->media_reg && nvidiac->reg)
- nvidiaInitVideo(pScreen);
-#endif
-#endif
- return vesaInitScreen (pScreen);
-}
-
-#ifdef RANDR
-static Bool
-nvidiaRandRSetConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
-{
- KdCheckSync (pScreen);
-
- if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-nvidiaRandRInit (ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
-
- pScrPriv->rrSetConfig = nvidiaRandRSetConfig;
-}
-#endif
-
-static Bool
-nvidiaFinishInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
- ret = vesaFinishInitScreen (pScreen);
-#ifdef RANDR
- nvidiaRandRInit (pScreen);
-#endif
- return ret;
-}
-
-void
-nvidiaPreserve (KdCardInfo *card)
-{
- vesaPreserve(card);
-}
-
-void
-nvidiaOutb (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 val)
-{
- asm volatile ("outb %b0,%w1" : : "a" (val), "d" (port));
-}
-
-CARD8
-nvidiaInb (NvidiaCardInfo *nvidiac, CARD16 port)
-{
- CARD8 v;
- asm volatile ("inb %w1,%b0" : "=a" (v) : "d" (port));
- return v;
-}
-
-CARD8
-nvidiaGetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id)
-{
- CARD8 ret;
- DBGOUT ("nvidiaGetIndex(0x%x,0x%x)\n", addr, id);
- nvidiaOutb (nvidiac, addr, id);
- ret = nvidiaInb (nvidiac, data);
- DBGOUT (" -> 0x%x\n", ret);
- return ret;
-}
-
-void
-nvidiaSetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id, CARD8 val)
-{
- DBGOUT ("nvidiaSetIndex(0x%x,0x%x) = 0x%x\n", addr, id, val);
- nvidiaOutb (nvidiac, addr, id);
- nvidiaOutb (nvidiac, data, val);
-}
-
-static void vgaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock)
-{
- CARD8 cr11;
- ENTER ();
- cr11 = nvidiaGetIndex (nvidiac, 0x3d4, 0x3d5, 0x11);
- if (lock) cr11 |= 0x80;
- else cr11 &= ~0x80;
- nvidiaSetIndex (nvidiac, 0x3d4, 0x3d5, 0x11, cr11);
- LEAVE ();
-}
-
-static void nvidiaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock)
-{
- if (NVIDIA_IS_3(nvidiac))
- nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x06, lock ? 0x99 : 0x57);
- else
- nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x1f, lock ? 0x99 : 0x57);
- vgaLockUnlock(nvidiac, lock);
-}
-
-Bool
-nvidiaMapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac)
-{
- nvidiac->reg_base = (CARD8 *) KdMapDevice (NVIDIA_REG_BASE(card),
- NVIDIA_REG_SIZE(card));
-
- if (!nvidiac->reg_base)
- {
- nvidiac->mmio = 0;
- nvidiac->rop = 0;
- nvidiac->blt = 0;
- nvidiac->rect = 0;
- return FALSE;
- }
-
- nvidiac->mmio = (CARD8 *) (nvidiac->reg_base + NVIDIA_MMIO_OFF(card));
- nvidiac->rop = (NvidiaRop *) (nvidiac->reg_base + NVIDIA_ROP_OFF(card));
- nvidiac->rect = (NvidiaRectangle *) (nvidiac->reg_base + NVIDIA_RECTANGLE_OFF(card));
- nvidiac->blt = (NvidiaScreenBlt *) (nvidiac->reg_base + NVIDIA_BLT_OFF(card));
- nvidiac->busy = (NvidiaBusy *) (nvidiac->reg_base + NVIDIA_BUSY_OFF(card));
- KdSetMappedMode (NVIDIA_REG_BASE(card),
- NVIDIA_REG_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- return TRUE;
-}
-
-void
-nvidiaUnmapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac)
-{
- if (nvidiac->reg_base)
- {
- KdResetMappedMode (NVIDIA_REG_BASE(card),
- NVIDIA_REG_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- KdUnmapDevice ((void *) nvidiac->reg_base, NVIDIA_REG_SIZE(card));
- nvidiac->reg_base = 0;
- nvidiac->rop = 0;
- nvidiac->blt = 0;
- nvidiac->rect = 0;
- }
-}
-
-void
-nvidiaSetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac)
-{
- if (!nvidiac->reg_base)
- nvidiaMapReg (card, nvidiac);
- nvidiaLockUnlock (nvidiac, FALSE);
- nvidiac->fifo_free = 0;
- nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree;
-}
-
-void
-nvidiaResetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac)
-{
- nvidiaUnmapReg (card, nvidiac);
- nvidiaLockUnlock (nvidiac, TRUE);
-}
-
-Bool
-nvidiaEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- NvidiaCardInfo *nvidiac = pScreenPriv->card->driver;
-
- if (!vesaEnable (pScreen))
- return FALSE;
-
- nvidiaSetMMIO (pScreenPriv->card, nvidiac);
-#ifdef XV
- KdXVEnable (pScreen);
-#endif
- return TRUE;
-}
-
-void
-nvidiaDisable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- NvidiaCardInfo *nvidiac = pScreenPriv->card->driver;
-
-#ifdef XV
- KdXVDisable (pScreen);
-#endif
- nvidiaResetMMIO (pScreenPriv->card, nvidiac);
- vesaDisable (pScreen);
-}
-
-static Bool
-nvidiaDPMS (ScreenPtr pScreen, int mode)
-{
- return vesaDPMS (pScreen, mode);
-}
-
-static void
-nvidiaRestore (KdCardInfo *card)
-{
- NvidiaCardInfo *nvidiac = card->driver;
-
- nvidiaResetMMIO (card, nvidiac);
- vesaRestore (card);
-}
-
-static void
-nvidiaScreenFini (KdScreenInfo *screen)
-{
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
-
- vesaScreenFini (screen);
- xfree (nvidias);
- screen->driver = 0;
-}
-
-static void
-nvidiaCardFini (KdCardInfo *card)
-{
- NvidiaCardInfo *nvidiac = card->driver;
-
- nvidiaUnmapReg (card, nvidiac);
- vesaCardFini (card);
-}
-
-#define nvidiaCursorInit 0 /* initCursor */
-#define nvidiaCursorEnable 0 /* enableCursor */
-#define nvidiaCursorDisable 0 /* disableCursor */
-#define nvidiaCursorFini 0 /* finiCursor */
-#define nvidiaRecolorCursor 0 /* recolorCursor */
-
-KdCardFuncs nvidiaFuncs = {
- nvidiaCardInit, /* cardinit */
- nvidiaScreenInit, /* scrinit */
- nvidiaInitScreen, /* initScreen */
- nvidiaFinishInitScreen, /* finishInitScreen */
- vesaCreateResources, /* createRes */
- nvidiaPreserve, /* preserve */
- nvidiaEnable, /* enable */
- nvidiaDPMS, /* dpms */
- nvidiaDisable, /* disable */
- nvidiaRestore, /* restore */
- nvidiaScreenFini, /* scrfini */
- nvidiaCardFini, /* cardfini */
-
- nvidiaCursorInit, /* initCursor */
- nvidiaCursorEnable, /* enableCursor */
- nvidiaCursorDisable, /* disableCursor */
- nvidiaCursorFini, /* finiCursor */
- nvidiaRecolorCursor, /* recolorCursor */
-
- nvidiaDrawInit, /* initAccel */
- nvidiaDrawEnable, /* enableAccel */
- nvidiaDrawSync, /* syncAccel */
- nvidiaDrawDisable, /* disableAccel */
- nvidiaDrawFini, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-};
diff --git a/hw/kdrive/nvidia/nvidia.h b/hw/kdrive/nvidia/nvidia.h
deleted file mode 100644
index 083ffc0ea..000000000
--- a/hw/kdrive/nvidia/nvidia.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 _NVIDIA_H_
-#define _NVIDIA_H_
-#include <vesa.h>
-#include "kxv.h"
-#include "klinux.h"
-
-/*
- * offset from ioport beginning
- */
-
-#define DEBUG
-#ifdef DEBUG
-#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
-#else
-#define DBGOUT(fmt,a...)
-#endif
-
-#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
-#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
-
-#define NVIDIA_REG_BASE(c) ((c)->attr.address[0])
-#define NVIDIA_REG_SIZE(c) (16 * 1024 * 1024)
-
-#define NVIDIA_PCIO_OFF(c) (0x601000)
-#define NVIDIA_MMIO_OFF(c) (NVIDIA_PCIO_OFF(c) + 0)
-#define NVIDIA_FIFO_OFF(c) (0x800000)
-#define NVIDIA_ROP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0)
-#define NVIDIA_CLIP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x2000)
-#define NVIDIA_PATT_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x4000)
-#define NVIDIA_PIXMAP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x6000)
-#define NVIDIA_BLT_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x8000)
-#define NVIDIA_RECTANGLE_OFF(c) (NVIDIA_FIFO_OFF(c) + 0xa000)
-#define NVIDIA_LINE_OFF(c) (NVIDIA_FIFO_OFF(c) + 0xc000)
-#define NVIDIA_IS_3(c) (0)
-#define NVIDIA_BUSY(c) (NVIDIA_IS_3(c) ? 0x6b0 : 0x700)
-#define NVIDIA_BUSY_OFF(c) (0x400000 + NVIDIA_BUSY(c))
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-#define NVIDIA_XY(x,y) ((x) | ((y) << 16))
-
-typedef struct {
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- VOL32 FifoFree;
-#else
- VOL16 FifoFree;
- VOL16 Nop;
-#endif
-} NvidiaFifoFree;
-
-/*
- * Raster OPeration. Windows style ROP3.
- */
-typedef struct {
- VOL32 reserved00[4];
- NvidiaFifoFree FifoFree;
- VOL32 reserved01[0x0BB];
- VOL32 Rop3;
-} NvidiaRop;
-
-/*
- * 2D filled rectangle.
- */
-typedef struct {
- VOL32 reserved00[4];
- NvidiaFifoFree FifoFree;
- VOL32 reserved01[0x0BB];
- VOL32 reserved03[(0x040)-1];
- VOL32 Color1A;
- VOL32 TopLeft;
- VOL32 WidthHeight;
-} NvidiaRectangle;
-
-/*
- * 2D screen-screen BLT.
- */
-typedef struct {
- VOL32 reserved00[4];
- NvidiaFifoFree FifoFree;
- VOL32 reserved01[0x0BB];
- VOL32 TopLeftSrc;
- VOL32 TopLeftDst;
- VOL32 WidthHeight;
-} NvidiaScreenBlt;
-
-typedef struct {
- VOL32 busy;
-} NvidiaBusy;
-
-typedef struct _nvidiaCardInfo {
- VesaCardPrivRec vesa;
- CARD8 *reg_base;
- int fifo_free;
- int fifo_size;
- CARD8 *mmio;
- NvidiaRop *rop;
- NvidiaRectangle *rect;
- NvidiaScreenBlt *blt;
- NvidiaBusy *busy;
-} NvidiaCardInfo;
-
-#define getNvidiaCardInfo(kd) ((NvidiaCardInfo *) ((kd)->card->driver))
-#define nvidiaCardInfo(kd) NvidiaCardInfo *nvidiac = getNvidiaCardInfo(kd)
-
-/*
- * Xv information, optional
- */
-typedef struct _nvidiaPortPriv {
- CARD32 YBuf0Offset;
-
- CARD32 YBuf1Offset;
-
- CARD8 currentBuf;
-
- int brightness;
- int saturation;
-
- RegionRec clip;
- CARD32 colorKey;
-
- Bool videoOn;
- Time offTime;
- Time freeTime;
- CARD32 size;
- CARD32 offset;
-} NvidiaPortPrivRec, *NvidiaPortPrivPtr;
-
-Bool nvidiaInitVideo(ScreenPtr pScreen);
-
-typedef struct _nvidiaScreenInfo {
- VesaScreenPrivRec vesa;
- CARD8 *cursor_base;
- CARD8 *screen;
- CARD8 *off_screen;
- int off_screen_size;
- KdVideoAdaptorPtr pAdaptor;
-} NvidiaScreenInfo;
-
-#define getNvidiaScreenInfo(kd) ((NvidiaScreenInfo *) ((kd)->screen->driver))
-#define nvidiaScreenInfo(kd) NvidiaScreenInfo *nvidias = getNvidiaScreenInfo(kd)
-
-void
-nvidiaPreserve (KdCardInfo *card);
-
-void
-nvidiaOutb (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 val);
-
-CARD8
-nvidiaInb (NvidiaCardInfo *nvidiac, CARD16 port);
-
-CARD8
-nvidiaGetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id);
-
-void
-nvidiaSetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id, CARD8 val);
-
-Bool
-nvidiaMapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac);
-
-void
-nvidiaUnmapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac);
-
-void
-nvidiaSetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac);
-
-void
-nvidiaResetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac);
-
-Bool
-nvidiaEnable (ScreenPtr pScreen);
-
-void
-nvidiaDisable (ScreenPtr pScreen);
-
-void
-nvidiaWait (NvidiaCardInfo *card, NvidiaFifoFree *free, int n);
-
-void
-nvidiaWaitIdle (NvidiaCardInfo *card);
-
-Bool
-nvidiaDrawSetup (ScreenPtr pScreen);
-
-Bool
-nvidiaDrawInit (ScreenPtr pScreen);
-
-void
-nvidiaDrawReinit (ScreenPtr pScreen);
-
-void
-nvidiaDrawEnable (ScreenPtr pScreen);
-
-void
-nvidiaDrawSync (ScreenPtr pScreen);
-
-void
-nvidiaDrawDisable (ScreenPtr pScreen);
-
-void
-nvidiaDrawFini (ScreenPtr pScreen);
-
-CARD8
-nvidiaReadIndex (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 index);
-
-void
-nvidiaWriteIndex (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 index, CARD8 value);
-
-Bool
-nvidiaCursorInit (ScreenPtr pScreen);
-
-void
-nvidiaCursorEnable (ScreenPtr pScreen);
-
-void
-nvidiaCursorDisable (ScreenPtr pScreen);
-
-void
-nvidiaCursorFini (ScreenPtr pScreen);
-
-void
-nvidiaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
-
-extern KdCardFuncs nvidiaFuncs;
-
-#endif /* _NVIDIA_H_ */
diff --git a/hw/kdrive/nvidia/nvidiacurs.c b/hw/kdrive/nvidia/nvidiacurs.c
deleted file mode 100644
index b5d7cd16c..000000000
--- a/hw/kdrive/nvidia/nvidiacurs.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Id: tridentcurs.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentcurs.c,v 1.6 2000/09/03 05:11:20 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "trident.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- tridentCardInfo(pScreenPriv); \
- tridentScreenInfo(pScreenPriv); \
- TridentCursor *pCurPriv = &tridents->cursor
-
-static void
-_tridentMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
-
- /* This is the recommended order to move the cursor */
-
- tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh);
- tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow);
- tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow);
- tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff);
- tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff);
- tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh);
-}
-
-static void
-tridentMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _tridentMoveCursor (pScreen, x, y);
-}
-
-static void
-tridentAllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
-
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
-}
-
-static void
-tridentSetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CARD32 fg, bg;
-
- fg = pCurPriv->source;
- bg = pCurPriv->mask;
- tridentWriteIndex (tridentc, 0x3d4, 0x48, fg);
- tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8);
- tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16);
-
- tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg);
- tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8);
- tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16);
-}
-
-void
-tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- tridentAllocCursorColors (pScreen);
- tridentSetCursorColors (pScreen);
-}
-
-#define InvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-static void
-tridentLoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- CARD32 *ram, *msk, *mskLine, *src, *srcLine;
- int i, j;
- int cursor_address;
- int lwsrc;
- unsigned char ramdac_control_;
- CARD32 offset;
-
- /*
- * Allocate new colors
- */
- tridentAllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (CARD32 *) tridents->cursor_base;
- mskLine = (CARD32 *) bits->mask;
- srcLine = (CARD32 *) bits->source;
-
- h = bits->height;
- if (h > TRIDENT_CURSOR_HEIGHT)
- h = TRIDENT_CURSOR_HEIGHT;
-
- lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
-
- for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += lwsrc;
- srcLine += lwsrc;
- for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) {
-
- CARD32 m, s;
-
-#if 1
- if (i < h && j < lwsrc)
- {
- m = *msk++;
- s = *src++;
- InvertBits32(m);
- InvertBits32(s);
- }
- else
- {
- m = 0;
- s = 0;
- }
-#endif
- *ram++ = m;
- *ram++ = s;
- }
- }
-
- /* Set address for cursor bits */
- offset = tridents->cursor_base - (CARD8 *) tridents->screen;
- offset >>= 10;
- tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff));
- tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8));
-
- /* Set new color */
- tridentSetCursorColors (pScreen);
-
- /* Enable the cursor */
- tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1);
-
- /* Move to new position */
- tridentMoveCursor (pScreen, x, y);
-}
-
-static void
-tridentUnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- /* Disable cursor */
- tridentWriteIndex (tridentc, 0x3d4, 0x50, 0);
-}
-
-static Bool
-tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- tridentLoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- tridentLoadCursor (pScreen, x, y);
- else
- tridentUnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec tridentPointerSpriteFuncs = {
- tridentRealizeCursor,
- tridentUnrealizeCursor,
- tridentSetCursor,
- tridentMoveCursor,
-};
-
-static void
-tridentQueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-tridentCursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!tridents->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = TRIDENT_CURSOR_WIDTH;
- pCurPriv->height= TRIDENT_CURSOR_HEIGHT;
- pScreen->QueryBestSize = tridentQueryBestSize;
- miPointerInitialize (pScreen,
- &tridentPointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-tridentCursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- tridentLoadCursor (pScreen, x, y);
- }
- else
- tridentUnloadCursor (pScreen);
- }
-}
-
-void
-tridentCursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- tridentUnloadCursor (pScreen);
- }
- }
-}
-
-void
-tridentCursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/nvidia/nvidiadraw.c b/hw/kdrive/nvidia/nvidiadraw.c
deleted file mode 100644
index b49ed7805..000000000
--- a/hw/kdrive/nvidia/nvidiadraw.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "nvidia.h"
-#include "nvidiadraw.h"
-
-#include <X11/Xmd.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-#include "picturestr.h"
-
-CARD8 nvidiaRop[16] = {
- /* GXclear */ 0x01, /* 0 */
- /* GXand */ 0x0c, /* src AND dst */
- /* GXandReverse */ 0x0d, /* src AND NOT dst */
- /* GXcopy */ 0x07, /* src */
- /* GXandInverted*/ 0x0e, /* NOT src AND dst */
- /* GXnoop */ 0x03, /* dst */
- /* GXxor */ 0x05, /* src XOR dst */
- /* GXor */ 0x0b, /* src OR dst */
- /* GXnor */ 0x0f, /* NOT src AND NOT dst */
- /* GXequiv */ 0x06, /* NOT src XOR dst */
- /* GXinvert */ 0x00, /* NOT dst */
- /* GXorReverse */ 0x0a, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x04, /* NOT src */
- /* GXorInverted */ 0x09, /* NOT src OR dst */
- /* GXnand */ 0x08, /* NOT src OR NOT dst */
- /* GXset */ 0x02, /* 1 */
-};
-
-static NvidiaCardInfo *card;
-
-void
-nvidiaWait (NvidiaCardInfo *card, NvidiaFifoFree *free, int n)
-{
- while (card->fifo_free < n)
- {
- card->fifo_free = free->FifoFree >> 2;
- }
- card->fifo_free -= n;
-}
-
-void
-nvidiaWaitIdle (NvidiaCardInfo *card)
-{
- while (card->fifo_free < card->fifo_size || (card->busy->busy & 1))
- {
- card->fifo_free = card->rop->FifoFree.FifoFree >> 2;
- }
-}
-
-static Bool
-nvidiaPrepareSolid (PixmapPtr pPixmap,
- int alu,
- Pixel pm,
- Pixel fg)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- KdScreenPriv(pScreen);
- nvidiaCardInfo(pScreenPriv);
-
- card = nvidiac;
- if (~pm & FbFullMask(pPixmap->drawable.depth))
- return FALSE;
- nvidiaWait (nvidiac, &nvidiac->rop->FifoFree, 1);
- nvidiac->rop->Rop3 = nvidiaRop[alu];
- nvidiaWait (nvidiac, &nvidiac->rect->FifoFree, 1);
- nvidiac->rect->Color1A = fg;
- return TRUE;
-}
-
-static void
-nvidiaSolid (int x1, int y1, int x2, int y2)
-{
- nvidiaWait (card, &card->rect->FifoFree, 2);
- card->rect->TopLeft = NVIDIA_XY(x1,y1);
- card->rect->WidthHeight = NVIDIA_XY(x2-x1,y2-y1);
-}
-
-static void
-nvidiaDoneSolid (void)
-{
-}
-
-
-static Bool
-nvidiaPrepareCopy (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- int dx,
- int dy,
- int alu,
- Pixel pm)
-{
- ScreenPtr pScreen = pDstPixmap->drawable.pScreen;
- KdScreenPriv(pScreen);
- nvidiaCardInfo(pScreenPriv);
-
- card = nvidiac;
- if (~pm & FbFullMask(pDstPixmap->drawable.depth))
- return FALSE;
- nvidiaWait (nvidiac, &card->rop->FifoFree, 1);
- nvidiac->rop->Rop3 = nvidiaRop[alu];
- return TRUE;
-}
-
-static void
-nvidiaCopy (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int w,
- int h)
-{
- nvidiaWait (card, &card->blt->FifoFree, 3);
- card->blt->TopLeftSrc = NVIDIA_XY(srcX, srcY);
- card->blt->TopLeftDst = NVIDIA_XY(dstX, dstY);
- card->blt->WidthHeight = NVIDIA_XY(w, h);
-}
-
-static void
-nvidiaDoneCopy (void)
-{
-}
-
-KaaScreenInfoRec nvidiaKaa = {
- nvidiaPrepareSolid,
- nvidiaSolid,
- nvidiaDoneSolid,
-
- nvidiaPrepareCopy,
- nvidiaCopy,
- nvidiaDoneCopy,
-};
-
-Bool
-nvidiaDrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- nvidiaCardInfo(pScreenPriv);
- Bool ret = TRUE;
-
- ENTER ();
- if (pScreenPriv->screen->fb[0].depth == 4)
- ret = FALSE;
-
- if (ret && !nvidiac->rop)
- {
- ErrorF ("Failed to map fifo registers\n");
- ret = FALSE;
- }
- if (ret && !nvidiac->rop->FifoFree.FifoFree)
- {
- ErrorF ("Fifo appears broken\n");
- ret = FALSE;
- }
- if (ret && !kaaDrawInit (pScreen, &nvidiaKaa))
- {
- ErrorF ("kaaDrawInit failed\n");
- ret = FALSE;
- }
-
- LEAVE ();
- return ret;
-}
-
-#define PIX_FORMAT_MONO 0
-#define PIX_FORMAT_PSEUDO_8 2
-#define PIX_FORMAT_TRUE_1555 3
-#define PIX_FORMAT_TRUE_565 4
-#define PIX_FORMAT_TRUE_8888 6
-#define PIX_FORMAT_TRUE_332 7
-#define PIX_FORMAT_GRAY_8 8
-#define PIX_FORMAT_YUV_422 0xb
-#define PIX_FORMAT_YUV_444 0xe
-#define PIX_FORMAT_TRUE_4444 0xf
-
-void
-nvidiaDrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- nvidiaCardInfo(pScreenPriv);
-
- ENTER ();
- nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree;
- nvidiac->fifo_free = 0;
- KdMarkSync (pScreen);
- LEAVE ();
-}
-
-void
-nvidiaDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-nvidiaDrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-nvidiaDrawSync (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- nvidiaCardInfo(pScreenPriv);
-
- nvidiaWaitIdle (nvidiac);
-}
diff --git a/hw/kdrive/nvidia/nvidiadraw.h b/hw/kdrive/nvidia/nvidiadraw.h
deleted file mode 100644
index b7053ae49..000000000
--- a/hw/kdrive/nvidia/nvidiadraw.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Id: tridentdraw.h,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.h,v 1.4 2000/10/11 06:04:40 keithp Exp $ */
-
-#ifndef _TRIDENTDRAW_H_
-#define _TRIDENTDRAW_H_
-
-#define SetupTrident(s) KdScreenPriv(s); \
- tridentCardInfo(pScreenPriv); \
- Cop *cop = tridentc->cop
-
-#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
-
-#define _tridentInit(cop,tridentc) { \
- if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \
- (cop)->multi = (tridentc)->cop_depth; \
- (cop)->multi = (tridentc)->cop_stride; \
- (cop)->multi = TridentAlpha; \
-} \
-
-#define _tridentSetSolidRect(cop,pix,alu,cmd) {\
- cop->multi = COP_MULTI_PATTERN; \
- cop->multi = COP_MULTI_ROP | tridentRop[alu]; \
- cop->fg = (pix); \
- cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
-}
-
-#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \
- (cop)->dst_start_xy = TRI_XY (x1,y1); \
- (cop)->dst_end_xy = TRI_XY(x2,y2); \
- _tridentWaitDone(cop); \
- (cop)->command = (cmd); \
-}
-
-#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
- COP_STATUS_DPE_BUSY | \
- COP_STATUS_MI_BUSY)
-
-#define _tridentWaitDone(cop) { \
- int __q__ = 500000; \
- while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
- ; \
- if (!__q__) \
- (cop)->status = 0; \
-}
-
-#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop)
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-#endif
diff --git a/hw/kdrive/nvidia/nvidiastub.c b/hw/kdrive/nvidia/nvidiastub.c
deleted file mode 100644
index 285a73844..000000000
--- a/hw/kdrive/nvidia/nvidiastub.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "nvidia.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x10de, 0x0112, 0, &attr))
- KdCardInfoAdd (&nvidiaFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/nvidia/nvidiavideo.c b/hw/kdrive/nvidia/nvidiavideo.c
deleted file mode 100644
index 04cc8044c..000000000
--- a/hw/kdrive/nvidia/nvidiavideo.c
+++ /dev/null
@@ -1,1018 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "nvidia.h"
-
-#include <X11/extensions/Xv.h>
-#include "fourcc.h"
-
-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
-
-static Atom xvBrightness, xvSaturation, xvColorKey;
-
-#define IMAGE_MAX_WIDTH 720
-#define IMAGE_MAX_HEIGHT 576
-
-static void
-nvidiaStopVideo(KdScreenInfo *screen, pointer data, Bool exit)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr;
- Reg *reg = nvidiac->reg;
- MediaReg *media = nvidiac->media_reg;
-
- REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
-
- if (!media)
- return;
-
- if(pPortPriv->videoOn)
- {
- nvidiaWaitIdle (reg);
- /* wait for buffer to be displayed */
- while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
- ;
- /* wait for buffer to be finished */
- while (((media->TRIG_CNTL >> 6) & 1) != 0)
- ;
- nvidiaWaitAvail (reg, 1);
- media->OVERLAY_SCALE_CNTL = 0;
- pPortPriv->videoOn = FALSE;
- nvidiaWaitIdle (reg);
- }
-}
-
-static int
-nvidiaSetPortAttribute(KdScreenInfo *screen,
- Atom attribute,
- int value,
- pointer data)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr;
- MediaReg *media = nvidiac->media_reg;
-
- if(attribute == xvBrightness)
- {
- if(value < -1000)
- value = -1000;
- if (value > 1000)
- value = 1000;
- pPortPriv->brightness = value;
- }
- else if(attribute == xvSaturation)
- {
- if (value < -1000)
- value = -1000;
- if (value > 1000)
- value = 1000;
- pPortPriv->saturation = value;
- }
- else if(attribute == xvColorKey)
- {
- if (pPortPriv->colorKey != value)
- {
- pPortPriv->colorKey = value;
- REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
- }
- }
- else
- return BadMatch;
-
- return Success;
-}
-
-static int
-nvidiaGetPortAttribute(KdScreenInfo *screen,
- Atom attribute,
- int *value,
- pointer data)
-{
- NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data;
-
- if(attribute == xvBrightness)
- *value = pPortPriv->brightness;
- else if(attribute == xvSaturation)
- *value = pPortPriv->saturation;
- else if(attribute == xvColorKey)
- *value = pPortPriv->colorKey;
- else
- return BadMatch;
-
- return Success;
-}
-
-static void
-nvidiaQueryBestSize(KdScreenInfo *screen,
- Bool motion,
- short vid_w,
- short vid_h,
- short drw_w,
- short drw_h,
- unsigned int *p_w,
- unsigned int *p_h,
- pointer data)
-{
- *p_w = drw_w;
- *p_h = drw_h;
-}
-
-
-static void
-nvidiaCopyPackedData(KdScreenInfo *screen,
- unsigned char *buf,
- int randr,
- int srcPitch,
- int dstPitch,
- int srcW,
- int srcH,
- int top,
- int left,
- int h,
- int w)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr;
- CARD8 *src, *dst;
- int srcDown, srcRight, srcNext;
- int p;
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- src = buf;
- srcDown = srcPitch;
- srcRight = 2;
- break;
- case RR_Rotate_90:
- src = buf + (srcH - 1) * 2;
- srcDown = -2;
- srcRight = srcPitch;
- break;
- case RR_Rotate_180:
- src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2;
- srcDown = -srcPitch;
- srcRight = -2;
- break;
- case RR_Rotate_270:
- src = buf + srcPitch * (srcW - 1);
- srcDown = 2;
- srcRight = -srcPitch;
- break;
- }
-
- src = src + top*srcDown + left*srcRight;
-
- if (pPortPriv->currentBuf == 0)
- dst = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf0Offset;
- else
- dst = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf1Offset;
-
- w >>= 1;
- srcRight >>= 1;
- srcNext = srcRight >> 1;
- while(h--)
- {
- CARD16 *s = (CARD16 *) src;
- CARD32 *d = (CARD32 *) dst;
- p = w;
- while (p--)
- {
- *d++ = s[0] | (s[srcNext] << 16);
- s += srcRight;
- }
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-static void
-nvidiaCopyPlanarData(KdScreenInfo *screen,
- unsigned char *buf,
- int randr,
- int srcPitch,
- int srcPitch2,
- int dstPitch, /* of chroma */
- int srcW,
- int srcH,
- int height,
- int top,
- int left,
- int h,
- int w,
- int id)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr;
- int i, j;
- CARD8 *src1, *src2, *src3, *dst1;
- int srcDown, srcDown2, srcRight, srcRight2, srcNext;
-
- /* compute source data pointers */
- src1 = buf;
- src2 = src1 + height * srcPitch;
- src3 = src2 + (height >> 1) * srcPitch2;
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcDown2 = srcPitch2;
- srcRight = 2;
- srcRight2 = 1;
- srcNext = 1;
- break;
- case RR_Rotate_90:
- src1 = src1 + srcH - 1;
- src2 = src2 + (srcH >> 1) - 1;
- src3 = src3 + (srcH >> 1) - 1;
- srcDown = -1;
- srcDown2 = -1;
- srcRight = srcPitch * 2;
- srcRight2 = srcPitch2;
- srcNext = srcPitch;
- break;
- case RR_Rotate_180:
- src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- srcDown = -srcPitch;
- srcDown2 = -srcPitch2;
- srcRight = -2;
- srcRight2 = -1;
- srcNext = -1;
- break;
- case RR_Rotate_270:
- src1 = src1 + srcPitch * (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
- srcDown = 1;
- srcDown2 = 1;
- srcRight = -srcPitch * 2;
- srcRight2 = -srcPitch2;
- srcNext = -srcPitch;
- break;
- }
-
- /* adjust for origin */
- src1 += top * srcDown + left * srcNext;
- src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
- src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
-
- if (id == FOURCC_I420)
- {
- CARD8 *srct = src2;
- src2 = src3;
- src3 = srct;
- }
-
- if (pPortPriv->currentBuf == 0)
- dst1 = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf0Offset;
- else
- dst1 = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf1Offset;
-
- w >>= 1;
- for (j = 0; j < h; j++)
- {
- CARD32 *dst = (CARD32 *) dst1;
- CARD8 *s1l = src1;
- CARD8 *s1r = src1 + srcNext;
- CARD8 *s2 = src2;
- CARD8 *s3 = src3;
-
- for (i = 0; i < w; i++)
- {
- *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
- s1l += srcRight;
- s1r += srcRight;
- s2 += srcRight2;
- s3 += srcRight2;
- }
- src1 += srcDown;
- dst1 += dstPitch;
- if (j & 1)
- {
- src2 += srcDown2;
- src3 += srcDown2;
- }
- }
-}
-
-static void
-nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
-{
- WindowPtr pRoot = WindowTable[pScreen->myNum];
- GCPtr pGC;
- CARD32 val[2];
- xRectangle *rects, *r;
- BoxPtr pBox = REGION_RECTS (pRgn);
- int nBox = REGION_NUM_RECTS (pRgn);
-
- rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
- if (!rects)
- goto bail0;
- r = rects;
- while (nBox--)
- {
- r->x = pBox->x1;
- r->y = pBox->y1;
- r->width = pBox->x2 - pBox->x1;
- r->height = pBox->y2 - pBox->y1;
- r++;
- pBox++;
- }
-
- pGC = GetScratchGC (pRoot->drawable.depth, pScreen);
- if (!pGC)
- goto bail1;
-
- val[0] = fg;
- val[1] = IncludeInferiors;
- ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
-
- ValidateGC (&pRoot->drawable, pGC);
-
- (*pGC->ops->PolyFillRect) (&pRoot->drawable, pGC,
- REGION_NUM_RECTS (pRgn), rects);
-
- FreeScratchGC (pGC);
-bail1:
- DEALLOCATE_LOCAL (rects);
-bail0:
- ;
-}
-
-/* NvidiaClipVideo -
-
- 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.
-*/
-
-static void
-NvidiaClipVideo(BoxPtr dst,
- INT32 *x1,
- INT32 *x2,
- INT32 *y1,
- INT32 *y2,
- BoxPtr extents, /* extents of the clip region */
- INT32 width,
- INT32 height)
-{
- INT32 vscale, hscale, delta;
- int diff;
-
- hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
- vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
-
- *x1 <<= 16; *x2 <<= 16;
- *y1 <<= 16; *y2 <<= 16;
-
- diff = extents->x1 - dst->x1;
- if(diff > 0) {
- dst->x1 = extents->x1;
- *x1 += diff * hscale;
- }
- diff = dst->x2 - extents->x2;
- if(diff > 0) {
- dst->x2 = extents->x2;
- *x2 -= diff * hscale;
- }
- diff = extents->y1 - dst->y1;
- if(diff > 0) {
- dst->y1 = extents->y1;
- *y1 += diff * vscale;
- }
- diff = dst->y2 - extents->y2;
- if(diff > 0) {
- dst->y2 = extents->y2;
- *y2 -= diff * vscale;
- }
-
- if(*x1 < 0) {
- diff = (- *x1 + hscale - 1)/ hscale;
- dst->x1 += diff;
- *x1 += diff * hscale;
- }
- delta = *x2 - (width << 16);
- if(delta > 0) {
- diff = (delta + hscale - 1)/ hscale;
- dst->x2 -= diff;
- *x2 -= diff * hscale;
- }
- if(*y1 < 0) {
- diff = (- *y1 + vscale - 1)/ vscale;
- dst->y1 += diff;
- *y1 += diff * vscale;
- }
- delta = *y2 - (height << 16);
- if(delta > 0) {
- diff = (delta + vscale - 1)/ vscale;
- dst->y2 -= diff;
- *y2 -= diff * vscale;
- }
-}
-
-static void
-nvidiaDisplayVideo(KdScreenInfo *screen,
- int id,
- int dstPitch, /* of chroma for 4:2:0 */
- int x1,
- int y1,
- int x2,
- int y2,
- int dst_x1,
- int dst_y1,
- int dst_x2,
- int dst_y2,
- short src_w,
- short src_h,
- short drw_w,
- short drw_h)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr;
- Reg *reg = nvidiac->reg;
- MediaReg *media = nvidiac->media_reg;
- int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
- int xscaleIntUV = 0, xscaleFractUV = 0;
- int yscaleIntUV = 0, yscaleFractUV = 0;
- int randr = nvidias->vesa.randr;
- int HORZ_INC, VERT_INC;
- CARD32 SCALER_IN;
- CARD32 OVERLAY_SCALE_CNTL;
- int tmp;
- int left;
- int bright;
- int sat;
-
- if (id == FOURCC_UYVY)
- SCALER_IN = SCALER_IN_YVYU422;
- else
- SCALER_IN = SCALER_IN_VYUY422;
-
- nvidiaWaitAvail (reg, 4);
-
- media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422;
-
- /* color key */
- media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1;
- media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey;
- /* set key control to obey only graphics color key */
- media->OVERLAY_KEY_CNTL = 0x50;
-
- nvidiaWaitAvail (reg, 9);
- media->CAPTURE_DEBUG = 0;
- /* no exclusive video region */
- media->OVERLAY_EXCLUSIVE_HORZ = 0;
- media->OVERLAY_EXCLUSIVE_VERT = 0;
- /* scaling coefficients */
- media->SCALER_H_COEFF0 = 0x00002000;
- media->SCALER_H_COEFF1 = 0x0D06200D;
- media->SCALER_H_COEFF2 = 0x0D0A1C0D;
- media->SCALER_H_COEFF3 = 0x0C0E1A0C;
- media->SCALER_H_COEFF4 = 0x0C14140C;
- media->SCALER_TEST = 0;
-
- nvidiaWaitAvail (reg, 2);
- media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND |
- SCALE_GAMMA_BRIGHT |
- SCALE_BANDWIDTH |
- SCALE_OVERLAY_EN |
- SCALE_EN);
-
- bright = (pPortPriv->brightness * 64 / 1000);
- if (bright < -0x40)
- bright = -0x40;
- if (bright > 0x3f)
- bright = 0x3f;
- bright = bright & 0x7f;
- sat = ((pPortPriv->saturation * 31 + 31000) / 2000);
- if (sat > 0x1f)
- sat = 0x1f;
- if (sat < 0)
- sat = 0;
-
- media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */
- (sat << 8) | /* SATURATION_U */
- (sat << 16) | /* SATURATION_V */
- (0 << 21) | /* SCALER_VERT_ADJ_UV */
- (0 << 28)); /* SCALER_HORZ_ADJ_UV */
-
- VERT_INC = (src_h << 12) / drw_h;
- HORZ_INC = (src_w << 12) / drw_w;
-
- nvidiaWaitAvail (reg, 13);
-
- /* lock registers to prevent non-atomic update */
- media->OVERLAY_Y_X_START = 0x80000000 | NVIDIA_YX (dst_x1, dst_y1);
- /* ending screen coordinate */
- media->OVERLAY_Y_X_END = 0x80000000 | NVIDIA_YX (dst_x2, dst_y2);
-
- media->OVERLAY_SCALE_INC = NVIDIA_YX(HORZ_INC, VERT_INC);
-
- media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF_PITCH = dstPitch >> 1;
- media->SCALER_HEIGHT_WIDTH = NVIDIA_YX(src_w - (x1 >> 16), src_h - (y1 >> 16));
-
- media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28;
-
- /* set XY location and unlock */
- media->OVERLAY_Y_X_START = NVIDIA_YX (dst_x1, dst_y1);
-}
-
-static int
-nvidiaPutImage(KdScreenInfo *screen,
- 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)
-{
- KdCardInfo *card = screen->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data;
- Reg *reg = nvidiac->reg;
- MediaReg *media = nvidiac->media_reg;
- INT32 x1, x2, y1, y2;
- int randr = nvidias->vesa.randr;
- int srcPitch, srcPitch2, dstPitch;
- int top, left, npixels, nlines, size;
- BoxRec dstBox;
- int dst_width = width, dst_height = height;
- int rot_x1, rot_y1, rot_x2, rot_y2;
- int dst_x1, dst_y1, dst_x2, dst_y2;
- int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
-
- /* Clip */
- x1 = src_x;
- x2 = src_x + src_w;
- y1 = src_y;
- y2 = src_y + src_h;
-
- dstBox.x1 = drw_x;
- dstBox.x2 = drw_x + drw_w;
- dstBox.y1 = drw_y;
- dstBox.y2 = drw_y + drw_h;
-
- NvidiaClipVideo(&dstBox, &x1, &x2, &y1, &y2,
- REGION_EXTENTS(pScreen, clipBoxes), width, height);
-
- if((x1 >= x2) || (y1 >= y2))
- return Success;
-
- if (!media)
- return BadAlloc;
-
- if (randr & (RR_Rotate_0|RR_Rotate_180))
- {
- dst_width = width;
- dst_height = height;
- rot_src_w = src_w;
- rot_src_h = src_h;
- rot_drw_w = drw_w;
- rot_drw_h = drw_h;
- }
- else
- {
- dst_width = height;
- dst_height = width;
- rot_src_w = src_h;
- rot_src_h = src_w;
- rot_drw_w = drw_h;
- rot_drw_h = drw_w;
- }
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- dst_x1 = dstBox.x1;
- dst_y1 = dstBox.y1;
- dst_x2 = dstBox.x2;
- dst_y2 = dstBox.y2;
- rot_x1 = x1;
- rot_y1 = y1;
- rot_x2 = x2;
- rot_y2 = y2;
- break;
- case RR_Rotate_90:
- dst_x1 = dstBox.y1;
- dst_y1 = screen->height - dstBox.x2;
- dst_x2 = dstBox.y2;
- dst_y2 = screen->height - dstBox.x1;
-
- rot_x1 = y1;
- rot_y1 = (src_w << 16) - x2;
- rot_x2 = y2;
- rot_y2 = (src_w << 16) - x1;
- break;
- case RR_Rotate_180:
- dst_x1 = screen->width - dstBox.x2;
- dst_y1 = screen->height - dstBox.y2;
- dst_x2 = screen->width - dstBox.x1;
- dst_y2 = screen->height - dstBox.y1;
- rot_x1 = (src_w << 16) - x2;
- rot_y1 = (src_h << 16) - y2;
- rot_x2 = (src_w << 16) - x1;
- rot_y2 = (src_h << 16) - y1;
- break;
- case RR_Rotate_270:
- dst_x1 = screen->width - dstBox.y2;
- dst_y1 = dstBox.x1;
- dst_x2 = screen->width - dstBox.y1;
- dst_y2 = dstBox.x2;
- rot_x1 = (src_h << 16) - y2;
- rot_y1 = x1;
- rot_x2 = (src_h << 16) - y1;
- rot_y2 = x2;
- break;
- }
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- dstPitch = ((dst_width << 1) + 15) & ~15;
- srcPitch = (width + 3) & ~3;
- srcPitch2 = ((width >> 1) + 3) & ~3;
- size = dstPitch * (int) dst_height;
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- dstPitch = ((dst_width << 1) + 15) & ~15;
- srcPitch = (width << 1);
- size = dstPitch * (int) dst_height;
- break;
- }
-
- pPortPriv->offset = nvidias->off_screen - (CARD8 *) nvidias->vesa.fb;
- /* fixup pointers */
-
- pPortPriv->YBuf0Offset = pPortPriv->offset;
- pPortPriv->YBuf1Offset = pPortPriv->offset + size;
-
-#if 0
- nvidiaWaitIdle (reg);
-
- if (pPortPriv->videoOn)
- {
- /* wait for buffer to be displayed */
- while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
- ;
- }
-#endif
- /*
- * Use the other buffer
- */
- pPortPriv->currentBuf = 1 - pPortPriv->currentBuf;
-
- /* copy data */
- top = rot_y1 >> 16;
- left = (rot_x1 >> 16) & ~1;
- npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- top &= ~1;
- nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
- nvidiaCopyPlanarData(screen, buf, randr,
- srcPitch, srcPitch2, dstPitch,
- rot_src_w, rot_src_h, height,
- top, left, nlines, npixels, id);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- nlines = ((rot_y2 + 0xffff) >> 16) - top;
- nvidiaCopyPackedData(screen, buf, randr,
- srcPitch, dstPitch,
- rot_src_w, rot_src_h,
- top, left, nlines,
- npixels);
- break;
- }
-
- nvidiaDisplayVideo(screen, id, dstPitch,
- rot_x1, rot_y1, rot_x2, rot_y2,
- dst_x1, dst_y1,
- dst_x2, dst_y2,
- rot_src_w, rot_src_h, rot_drw_w, rot_drw_h);
-
- /* update cliplist */
- if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
- {
- REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
- nvidiaPaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey);
- }
-
- pPortPriv->videoOn = TRUE;
-
- return Success;
-}
-
-static int
-nvidiaQueryImageAttributes(KdScreenInfo *screen,
- int id,
- unsigned short *w,
- unsigned short *h,
- int *pitches,
- int *offsets)
-{
- int size, tmp;
-
- if(*w > IMAGE_MAX_WIDTH)
- *w = IMAGE_MAX_WIDTH;
- if(*h > IMAGE_MAX_HEIGHT)
- *h = IMAGE_MAX_HEIGHT;
-
- *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;
-}
-
-
-/* client libraries expect an encoding */
-static KdVideoEncodingRec DummyEncoding[1] =
-{
- {
- 0,
- "XV_IMAGE",
- IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
- {1, 1}
- }
-};
-
-#define NUM_FORMATS 3
-
-static KdVideoFormatRec Formats[NUM_FORMATS] =
-{
- {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
-};
-
-#define NUM_ATTRIBUTES 3
-
-static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
-{
- {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"},
- {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
- {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}
-};
-
-#define NUM_IMAGES 4
-
-static KdImageRec Images[NUM_IMAGES] =
-{
- XVIMAGE_YUY2,
- XVIMAGE_YV12,
- XVIMAGE_I420,
- XVIMAGE_UYVY
-};
-
-static void nvidiaResetVideo(KdScreenInfo *screen)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
- NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr;
- MediaReg *media = nvidiac->media_reg;
-
- /*
- * Default to maximum image size in YV12
- */
-
-}
-
-static int
-nvidiaReputImage (KdScreenInfo *screen,
- short drw_x,
- short drw_y,
- RegionPtr clipBoxes,
- pointer data)
-{
- ScreenPtr pScreen = screen->pScreen;
- NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data;
- BoxPtr pOldExtents = REGION_EXTENTS (pScreen, &pPortPriv->clip);
- BoxPtr pNewExtents = REGION_EXTENTS (pScreen, clipBoxes);
-
- if (pOldExtents->x1 == pNewExtents->x1 &&
- pOldExtents->x2 == pNewExtents->x2 &&
- pOldExtents->y1 == pNewExtents->y1 &&
- pOldExtents->y2 == pNewExtents->y2)
- {
- /* update cliplist */
- if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
- {
- REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
- nvidiaPaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey);
- }
- return Success;
- }
- return BadMatch;
-}
-
-static KdVideoAdaptorPtr
-nvidiaSetupImageVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- nvidiaCardInfo(pScreenPriv);
- nvidiaScreenInfo(pScreenPriv);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- KdVideoAdaptorPtr adapt;
- NvidiaPortPrivPtr pPortPriv;
-
- if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) +
- sizeof(NvidiaPortPrivRec) +
- sizeof(DevUnion))))
- return NULL;
-
- adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
- adapt->name = "Nvidia Video Overlay";
- adapt->nEncodings = 1;
- adapt->pEncodings = DummyEncoding;
- adapt->nFormats = NUM_FORMATS;
- adapt->pFormats = Formats;
- adapt->nPorts = 1;
- adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
-
- pPortPriv = (NvidiaPortPrivPtr)(&adapt->pPortPrivates[1]);
-
- adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv);
- adapt->pAttributes = Attributes;
- adapt->nImages = NUM_IMAGES;
- adapt->nAttributes = NUM_ATTRIBUTES;
- adapt->pImages = Images;
- adapt->PutVideo = NULL;
- adapt->PutStill = NULL;
- adapt->GetVideo = NULL;
- adapt->GetStill = NULL;
- adapt->StopVideo = nvidiaStopVideo;
- adapt->SetPortAttribute = nvidiaSetPortAttribute;
- adapt->GetPortAttribute = nvidiaGetPortAttribute;
- adapt->QueryBestSize = nvidiaQueryBestSize;
- adapt->PutImage = nvidiaPutImage;
- adapt->ReputImage = nvidiaReputImage;
- adapt->QueryImageAttributes = nvidiaQueryImageAttributes;
-
- pPortPriv->colorKey = nvidias->colorKey;
- pPortPriv->videoOn = FALSE;
- pPortPriv->brightness = 0;
- pPortPriv->saturation = 0;
- pPortPriv->currentBuf = 0;
-
- /* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
-
- nvidias->pAdaptor = adapt;
-
- xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
- xvSaturation = MAKE_ATOM("XV_SATURATION");
- xvColorKey = MAKE_ATOM("XV_COLORKEY");
-
- nvidiaResetVideo(screen);
-
- return adapt;
-}
-
-Bool nvidiaInitVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
- KdVideoAdaptorPtr newAdaptor = NULL;
- int num_adaptors;
- KdCardInfo *card = pScreenPriv->card;
- NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
- NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver;
-
- if (!nvidiac->media_reg)
- return FALSE;
-
- newAdaptor = nvidiaSetupImageVideo(pScreen);
-
- num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
-
- if(newAdaptor)
- {
- if(!num_adaptors)
- {
- num_adaptors = 1;
- adaptors = &newAdaptor;
- }
- else
- {
- newAdaptors = xalloc((num_adaptors + 1) *
- sizeof(KdVideoAdaptorPtr*));
- if(newAdaptors)
- {
- memcpy(newAdaptors, adaptors,
- num_adaptors * sizeof(KdVideoAdaptorPtr));
- newAdaptors[num_adaptors] = newAdaptor;
- adaptors = newAdaptors;
- num_adaptors++;
- }
- }
- }
-
- if(num_adaptors)
- KdXVScreenInit(pScreen, adaptors, num_adaptors);
-
- if(newAdaptors)
- xfree(newAdaptors);
- return TRUE;
-}
diff --git a/hw/kdrive/pcmcia/Imakefile b/hw/kdrive/pcmcia/Imakefile
deleted file mode 100644
index 29da5c418..000000000
--- a/hw/kdrive/pcmcia/Imakefile
+++ /dev/null
@@ -1,13 +0,0 @@
-XCOMM $RCSId: $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = pcmcia.c pcmciacurs.c pcmciastub.c pcmciashadow.c pcmciarotate.c
-
-OBJS = pcmcia.o pcmciacurs.o pcmciastub.o pcmciashadow.o pcmciarotate.o
-
-INCLUDES = -I. $(KDINCS) -I$(KDRIVE)/fbdev
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(pcmcia,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/pcmcia/modes.h b/hw/kdrive/pcmcia/modes.h
deleted file mode 100644
index 9087e9e74..000000000
--- a/hw/kdrive/pcmcia/modes.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- */
-/* $RCSId: $ */
-
-#define V_NHSYNC 0x01
-#define V_NVSYNC 0x02
-#define V_PHSYNC 0x04
-#define V_PVSYNC 0x08
-#define V_INTERLACE 0x10
-
-pcmciaDisplayModeRec pcmciaDefaultModes [] = {
-/* 640x400 @ 70Hz (VGA) hsync: 37.9kHz */
- {640, 400, 70 ,31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC},
-/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */
- {640, 480, 60 ,25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC},
-/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */
- {640, 480, 72 ,31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC},
-/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */
- {640, 480, 75 ,31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC},
-/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */
- {640, 480, 85 ,36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC},
-/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */
- {800, 600, 56 ,36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC},
-/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */
- {800, 600, 60 ,40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC},
-/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */
- {800, 600, 72 ,50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC},
-/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */
- {800, 600, 75 ,49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC},
-/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */
- {800, 600, 85 ,56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC},
-/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */
- {1024, 768, 43 ,44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE},
-/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */
- {1024, 768, 60 ,65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC},
-/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */
- {1024, 768, 70 ,75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC},
-/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */
- {1024, 768, 75 ,78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC},
-/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */
- {1024, 768, 85 ,94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC},
-/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */
- {1152, 864, 75 ,108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
-};
diff --git a/hw/kdrive/pcmcia/pcmcia.c b/hw/kdrive/pcmcia/pcmcia.c
deleted file mode 100644
index 087b0a604..000000000
--- a/hw/kdrive/pcmcia/pcmcia.c
+++ /dev/null
@@ -1,1200 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * A driver for the following PCMCIA cards...
- * Hewlett Packards HP VGA Out (Model F1252A)
- * Colorgraphics Voyager VGA
- *
- * Tested running under a Compaq IPAQ Pocket PC running Linux
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmcia.c,v 1.6 2002/10/14 18:01:41 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "pcmcia.h"
-#define extern
-#include <asm/io.h>
-#undef extern
-
-#define CLOCK 14318 /* KHz */
-#define CLK_N(a,b) (a & 0xff)
-#define CLK_M(a,b) ((b) & 0x3f)
-#define CLK_K(a,b) (((b) >> 6) & 3)
-#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b)))
-
-extern void
-tridentUpdatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf);
-extern void
-cirrusUpdatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf);
-
-static Bool
-tridentSetCLK(int clock, CARD8 *a, CARD8 *b);
-
-static Bool
-CirrusFindClock(int freq, int *num_out, int *den_out);
-
-Bool
-pcmciaCardInit (KdCardInfo *card)
-{
- pcmciaCardInfo *pcmciac;
- CARD8 r9;
-
- pcmciac = (pcmciaCardInfo *) xalloc (sizeof (pcmciaCardInfo));
- if (!pcmciac)
- return FALSE;
-
- pcmciac->cop_base = (CARD8 *) KdMapDevice (PCMCIA_COP_BASE(card),
- PCMCIA_COP_SIZE(card));
-
- r9 = pcmciaReadIndex (pcmciac, 0x3c4, 0x09);
- /*
- * Crude detection....
- * The trident chip has a read only register at 0x09, which returns 0x4.
- * If it's not that, we assume the cirrus chip.
- * BREAKAGE.! If we have an anonymous PCMCIA card inserted, we could
- * potentially smash something here. FIXME !
- */
- if (r9 == 0x04) {
- ErrorF("PCMCIA: Found HP VGA card\n");
- pcmciac->HP = TRUE; /* Select HP VGA Out Card */
- } else {
- ErrorF("PCMCIA: Found Voyager VGA card\n");
- pcmciac->HP = FALSE; /* Select Voyager VGA Card */
- }
-
- if (pcmciac->HP) {
- /* needed by the accelerator - later */
- pcmciac->cop = (Cop *) (pcmciac->cop_base + TRIDENT_COP_OFF(card));
- }
-
- /*
- * Map frame buffer
- */
- if (pcmciac->HP)
- pcmciac->fb = KdMapDevice (0x2ce00000, 0x80000);
- else
- pcmciac->fb = KdMapDevice (0x2c0a0000, 0x10000); /*64K bank switched*/
-
- if (!pcmciac->fb)
- return FALSE;
-
- pcmciac->window = 0;
-
- card->driver = pcmciac;
-
- return TRUE;
-}
-
-Bool
-pcmciaModeSupported (KdScreenInfo *screen,
- const KdMonitorTiming *t)
-{
- KdCardInfo *card = screen->card;
- pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver;
-
- if (pcmciac->HP)
- {
- CARD8 a, b;
- if (!tridentSetCLK (t->clock, &a, &b))
- return FALSE;
- }
- else
- {
- int a, b;
- if (!CirrusFindClock (t->clock, &a, &b))
- return FALSE;
- }
-
- /* width must be a multiple of 16 */
- if (t->horizontal & 0xf)
- return FALSE;
- return TRUE;
-}
-
-Bool
-pcmciaModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver;
- int screen_size;
- int pixel_width;
- int byte_width;
- int fb;
-
- if (screen->fb[0].depth == 8)
- screen->fb[0].bitsPerPixel = 8;
- else if (screen->fb[0].depth == 15 || screen->fb[0].depth == 16)
- screen->fb[0].bitsPerPixel = 16;
- else
- return FALSE;
-
- screen_size = 0;
- screen->fb[0].pixelStride = screen->width;
- screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3);
- screen->fb[0].frameBuffer = pcmciac->fb;
- screen_size = screen->fb[0].byteStride * screen->height;
-
- return screen_size <= pcmciac->memory;
-}
-
-Bool
-pcmciaScreenInit (KdScreenInfo *screen)
-{
- pcmciaCardInfo *pcmciac = screen->card->driver;
- pcmciaScreenInfo *pcmcias;
- int screen_size, memory;
- int i;
- const KdMonitorTiming *t;
-
- pcmcias = (pcmciaScreenInfo *) xalloc (sizeof (pcmciaScreenInfo));
- if (!pcmcias)
- return FALSE;
- memset (pcmcias, '\0', sizeof (pcmciaScreenInfo));
-
- /* if (!pcmciac->cop) */
- screen->dumb = TRUE;
-
- if (screen->fb[0].depth < 8)
- screen->fb[0].depth = 8;
-
- /* default to 16bpp */
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 16;
-
- /* default to 60Hz refresh */
- if (!screen->width || !screen->height)
- {
- screen->width = 640;
- screen->height = 400;
- screen->rate = 60;
- }
-
- pcmciac->memory = 512 * 1024;
- if (pcmciac->HP && !screen->softCursor && screen->fb[0].depth == 8)
- {
- /* ack, bail on the HW cursor for everything -- no ARGB falback */
- pcmcias->cursor_base = 0;
-#if 0
- /* Let's do hw cursor for the HP card, only in 8bit mode though */
- pcmcias->cursor_base = pcmcias->screen + pcmciac->memory - 4096;
- pcmciac->memory -= 4096;
-#endif
- }
-
- pcmcias->screen = pcmciac->fb;
- screen->driver = pcmcias;
-
- t = KdFindMode (screen, pcmciaModeSupported);
-
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
-
- pcmcias->randr = screen->randr;
-
- if (!KdTuneMode (screen, pcmciaModeUsable, pcmciaModeSupported))
- {
- xfree (pcmcias);
- return FALSE;
- }
-
- switch (screen->fb[0].depth) {
- case 4:
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case 8:
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case 15:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x03e0;
- screen->fb[0].redMask = 0x7c00;
- break;
- case 16:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x07e0;
- screen->fb[0].redMask = 0xf800;
- break;
- }
-
- return TRUE;
-}
-
-void *
-tridentWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
-
- if (!pScreenPriv->enabled)
- return 0;
-
- *size = pScreenPriv->screen->fb[0].byteStride;
- return (CARD8 *) pcmciac->fb + row * pScreenPriv->screen->fb[0].byteStride + offset;
-}
-
-void *
-cirrusWindowWindowed (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
- int bank, boffset;
-
- if (!pScreenPriv->enabled)
- return 0;
-
- bank = (row * pScreenPriv->screen->fb[0].byteStride) / 0x1000;
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x0B, 0x0c);
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x09, bank);
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x0A, bank);
- *size = pScreenPriv->screen->fb[0].byteStride;
- return (CARD8 *) pcmciac->fb + (row * pScreenPriv->screen->fb[0].byteStride) - (bank * 0x1000) + offset;
-}
-
-LayerPtr
-pcmciaLayerCreate (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver;
- ShadowUpdateProc update;
- ShadowWindowProc window;
- PixmapPtr pPixmap;
- int kind;
-
- if (pcmciac->HP) {
- window = tridentWindowLinear;
- if (pcmcias->randr == RR_Rotate_0)
- update = tridentUpdatePacked;
- else
- update = pcmciaUpdateRotatePacked;
- } else {
- window = cirrusWindowWindowed;
- if (pcmcias->randr == RR_Rotate_0)
- update = cirrusUpdatePacked;
- else
- update = pcmciaUpdateRotatePacked;
- }
-
- if (!update)
- abort ();
-
- kind = LAYER_SHADOW;
- pPixmap = 0;
-
- return LayerCreate (pScreen, kind, screen->fb[0].depth,
- pPixmap, update, window, pcmcias->randr, 0);
-}
-
-void
-pcmciaConfigureScreen (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevPriv *priv = pScreenPriv->card->driver;
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver;
- KdMouseMatrix m;
-
- KdComputeMouseMatrix (&m, pcmcias->randr,
- screen->width, screen->height);
-
- if (m.matrix[0][0])
- {
- pScreen->width = screen->width;
- pScreen->height = screen->height;
- pScreen->mmWidth = screen->width_mm;
- pScreen->mmHeight = screen->height_mm;
- }
- else
- {
- pScreen->width = screen->height;
- pScreen->height = screen->width;
- pScreen->mmWidth = screen->height_mm;
- pScreen->mmHeight = screen->width_mm;
- }
- KdSetMouseMatrix (&m);
-}
-
-#ifdef RANDR
-
-Bool
-pcmciaRandRSupported (ScreenPtr pScreen,
- const KdMonitorTiming *t)
-{
- KdScreenPriv(pScreen);
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
- KdScreenInfo *screen = pScreenPriv->screen;
- int screen_size;
- int byteStride;
-
- /* Make sure the clock is supported */
- if (!pcmciaModeSupported (screen, t))
- return FALSE;
- /* Check for sufficient memory */
- byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3);
- screen_size = byteStride * screen->height;
-
- return screen_size <= pcmciac->memory;
-}
-
-Bool
-pcmciaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
-{
- KdScreenPriv(pScreen);
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver;
-
- *rotations = (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270|
- RR_Reflect_X|RR_Reflect_Y);
-
- return KdRandRGetInfo (pScreen, pcmcias->randr, pcmciaRandRSupported);
-}
-
-int
-pcmciaLayerAdd (WindowPtr pWin, pointer value)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- LayerPtr pLayer = (LayerPtr) value;
-
- if (!LayerWindowAdd (pScreen, pLayer, pWin))
- return WT_STOPWALKING;
-
- return WT_WALKCHILDREN;
-}
-
-int
-pcmciaLayerRemove (WindowPtr pWin, pointer value)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- LayerPtr pLayer = (LayerPtr) value;
-
- LayerWindowRemove (pScreen, pLayer, pWin);
-
- return WT_WALKCHILDREN;
-}
-
-pcmciaRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevPriv *priv = pScreenPriv->card->driver;
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver;
- Bool wasEnabled = pScreenPriv->enabled;
- int newwidth, newheight;
- LayerPtr pNewLayer;
- int kind;
- int oldrandr = pcmcias->randr;
- PixmapPtr pPixmap;
- const KdMonitorTiming *t;
-
- randr = KdAddRotation (screen->randr, randr);
-
- t = KdRandRGetTiming (pScreen, pcmciaRandRSupported, rate, pSize);
-
- if (wasEnabled)
- KdDisableScreen (pScreen);
-
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
-
- pcmcias->randr = randr;
- pcmciaConfigureScreen (pScreen);
-
- pNewLayer = pcmciaLayerCreate (pScreen);
-
- if (!pNewLayer)
- {
- pcmcias->randr = oldrandr;
- pcmciaConfigureScreen (pScreen);
- if (wasEnabled)
- KdEnableScreen (pScreen);
- return FALSE;
- }
-
- if (WalkTree (pScreen, pcmciaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING)
- {
- WalkTree (pScreen, pcmciaLayerRemove, (pointer) pNewLayer);
- LayerDestroy (pScreen, pNewLayer);
- pcmcias->randr = oldrandr;
- pcmciaConfigureScreen (pScreen);
- if (wasEnabled)
- KdEnableScreen (pScreen);
- return FALSE;
- }
- WalkTree (pScreen, pcmciaLayerRemove, (pointer) pcmcias->pLayer);
- LayerDestroy (pScreen, pcmcias->pLayer);
- pcmcias->pLayer = pNewLayer;
- if (wasEnabled)
- KdEnableScreen (pScreen);
- return TRUE;
-}
-
-Bool
-pcmciaRandRInit (ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen))
- return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = pcmciaRandRGetInfo;
- pScrPriv->rrSetConfig = pcmciaRandRSetConfig;
- return TRUE;
-}
-#endif
-
-Bool
-pcmciaInitScreen (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver;
-
- if (!LayerStartInit (pScreen))
- return FALSE;
- if (!LayerFinishInit (pScreen))
- return FALSE;
-
- pcmciaConfigureScreen (pScreen);
-
- pcmcias->pLayer = pcmciaLayerCreate (pScreen);
- if (!pcmcias->pLayer)
- return FALSE;
-#ifdef RANDR
- if (!pcmciaRandRInit (pScreen))
- return FALSE;
-#endif
- return TRUE;
-}
-
-CARD8
-pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index)
-{
- CARD8 value;
-
- pcmciac->cop_base[port] = index;
- value = pcmciac->cop_base[port+1];
- return value;
-}
-
-void
-pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value)
-{
- pcmciac->cop_base[port] = index;
- pcmciac->cop_base[port+1] = value;
-}
-
-CARD8
-pcmciaReadReg (pcmciaCardInfo *pcmciac, CARD16 port)
-{
- CARD8 value;
-
- value = pcmciac->cop_base[port];
-
- return value;
-}
-
-void
-pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value)
-{
- pcmciac->cop_base[port] = value;
-}
-
-
-void
-pcmciaPause ()
-{
- struct timeval tv;
-
- tv.tv_sec = 0;
- tv.tv_usec = 50 * 1000;
- select (1, 0, 0, 0, &tv);
-}
-
-void
-pcmciaPreserve (KdCardInfo *card)
-{
-}
-
-/* CLOCK_FACTOR is double the osc freq in kHz (osc = 14.31818 MHz) */
-#define CLOCK_FACTOR 28636
-
-/* stability constraints for internal VCO -- MAX_VCO also determines the maximum Video pixel clock */
-#define MIN_VCO CLOCK_FACTOR
-#define MAX_VCO 111000
-
-/* clock in kHz is (numer * CLOCK_FACTOR / (denom & 0x3E)) >> (denom & 1) */
-#define VCOVAL(n, d) \
- ((((n) & 0x7F) * CLOCK_FACTOR / ((d) & 0x3E)) )
-
-#define CLOCKVAL(n, d) \
- (VCOVAL(n, d) >> ((d) & 1))
-
-static Bool
-CirrusFindClock(int freq, int *num_out, int *den_out)
-{
- int n;
- int num = 0, den = 0;
- int mindiff;
-
- /*
- * If max_clock is greater than the MAX_VCO default, ignore
- * MAX_VCO. On the other hand, if MAX_VCO is higher than max_clock,
- * make use of the higher MAX_VCO value.
- */
-
- mindiff = freq;
- for (n = 0x10; n < 0x7f; n++) {
- int d;
- for (d = 0x14; d < 0x3f; d++) {
- int c, diff;
- /* Avoid combinations that can be unstable. */
- if ((VCOVAL(n, d) < MIN_VCO) || (VCOVAL(n, d) > MAX_VCO))
- continue;
- c = CLOCKVAL(n, d);
- diff = abs(c - freq);
- if (diff < mindiff) {
- mindiff = diff;
- num = n;
- den = d;
- }
- }
- }
- if (n == 0x80)
- return FALSE;
-
- *num_out = num;
- *den_out = den;
-
- return TRUE;
-}
-
-
-static Bool
-tridentSetCLK(int clock, CARD8 *a, CARD8 *b)
-{
- int powerup[4] = { 1,2,4,8 };
- int clock_diff = 750;
- int freq, ffreq;
- int m, n, k;
- int p, q, r, s;
- int startn, endn;
- int endm, endk;
-
- p = q = r = s = 0;
-
- startn = 0;
- endn = 121;
- endm = 31;
- endk = 1;
-
- freq = clock;
-
- for (k=0;k<=endk;k++)
- for (n=startn;n<=endn;n++)
- for (m=1;m<=endm;m++)
- {
- ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) ));
- if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff))
- {
- clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq;
- p = n; q = m; r = k; s = ffreq;
- }
- }
-
-#if 0
- ErrorF ("ffreq %d clock %d\n", s, clock);
-#endif
- if (s == 0)
- return FALSE;
-
- /* N is first 7bits, first M bit is 8th bit */
- *a = ((1 & q) << 7) | p;
- /* first 4bits are rest of M, 1bit for K value */
- *b = (((q & 0xFE) >> 1) | (r << 4));
- return TRUE;
-}
-
-Bool
-pcmciaEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver;
- int i,j;
- unsigned char Sequencer[6];
- unsigned char CRTC[31];
- unsigned char Graphics[9];
- unsigned char Attribute[21];
- unsigned char MiscOutReg;
- const KdMonitorTiming *t;
- int hactive, hblank, hfp, hbp;
- int vactive, vblank, vfp, vbp;
-
- int h_active;
- int h_total;
- int h_display_end;
- int h_sync_start;
- int h_sync_end;
- int h_skew = 0;
-
- int v_active;
- int v_total;
- int v_sync_start;
- int v_sync_end;
- int v_skew = 0;
-
- t = KdFindMode (screen, pcmciaModeSupported);
-
- hactive = t->horizontal;
- hfp = t->hfp;
- hbp = t->hbp;
- hblank = t->hblank;
-
- h_active = hactive;
- h_sync_start = hactive + hfp;
- h_sync_end = hactive + hblank - hbp;
- h_total = hactive + hblank;
-
- vactive = t->vertical;
- vfp = t->vfp;
- vbp = t->vbp;
- vblank = t->vblank;
-
- v_active = vactive;
- v_sync_start = vactive + vfp;
- v_sync_end = vactive + vblank - vbp;
- v_total = vactive + vblank;
-
- /*
- * compute correct Hsync & Vsync polarity
- */
-
- MiscOutReg = 0x23;
- if (t->hpol == KdSyncNegative)
- MiscOutReg |= 0x40;
- if (t->vpol == KdSyncNegative)
- MiscOutReg |= 0x80;
-
- /*
- * Time Sequencer
- */
- if (pScreenPriv->screen->fb[0].depth == 4)
- Sequencer[0] = 0x02;
- else
- Sequencer[0] = 0x00;
- Sequencer[1] = 0x01;
- Sequencer[2] = 0x0F;
- Sequencer[3] = 0x00; /* Font select */
- if (pScreenPriv->screen->fb[0].depth < 8)
- Sequencer[4] = 0x06; /* Misc */
- else
- Sequencer[4] = 0x0E; /* Misc */
- Sequencer[5] = 0x00;
-
- /*
- * CRTC Controller
- */
- CRTC[0] = ((h_total) >> 3) - 5;
- CRTC[1] = (hactive >> 3) - 1;
- CRTC[2] = ((min(h_sync_start,h_active)) >> 3) - 1;
- CRTC[3] = ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F) | 0x80;
- i = (((h_skew << 2) + 0x10) & ~0x1F);
- if (i < 0x80)
- CRTC[3] |= i;
- CRTC[4] = (h_sync_start >> 3);
- CRTC[5] = (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2)
- | (((h_sync_end >> 3)) & 0x1F);
-
- CRTC[6] = (v_total - 2) & 0xFF;
- CRTC[7] = (((v_total - 2) & 0x100) >> 8)
- | (((v_active - 1) & 0x100) >> 7)
- | ((v_sync_start & 0x100) >> 6)
- | ((((min(v_sync_start,v_active)) - 1) & 0x100) >> 5)
- | 0x10
- | (((v_total - 2) & 0x200) >> 4)
- | (((v_active - 1) & 0x200) >> 3)
- | ((v_sync_start & 0x200) >> 2);
- CRTC[8] = 0x00;
- CRTC[9] = ((((min(v_sync_start,v_active))-1) & 0x200) >> 4) | 0x40;
- CRTC[10] = 0x00;
- CRTC[11] = 0x00;
- CRTC[12] = 0x00;
- CRTC[13] = 0x00;
- CRTC[14] = 0x00;
- CRTC[15] = 0x00;
- CRTC[16] = v_sync_start & 0xFF;
- CRTC[17] = (v_sync_end & 0x0F) | 0x20;
- CRTC[18] = (v_active - 1) & 0xFF;
- if (pScreenPriv->screen->fb[0].depth == 4)
- CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 4;
- else
- if (pScreenPriv->screen->fb[0].depth == 8)
- CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 3;
- else
- if (pScreenPriv->screen->fb[0].depth == 16 ||
- pScreenPriv->screen->fb[0].depth == 15)
- CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 2;
- CRTC[20] = 0x00;
- CRTC[21] = ((min(v_sync_end,v_active)) - 1) & 0xFF;
- CRTC[22] = ((min(v_sync_end,v_active)) - 1) & 0xFF;
- if (pScreenPriv->screen->fb[0].depth < 8)
- CRTC[23] = 0xE3;
- else
- CRTC[23] = 0xC3;
- CRTC[24] = 0xFF;
- CRTC[25] = 0x00;
- CRTC[26] = 0x00;
-#if 0
- if (!pcmciac->HP)
- if (mode.Flags & V_INTERLACE) CRTC[26] |= 0x01;
-#endif
- if (pcmciac->HP)
- CRTC[27] = 0x00;
- else
- CRTC[27] = 0x22;
- CRTC[28] = 0x00;
- CRTC[29] = 0x00;
- CRTC[30] = 0x80;
-#if 0
- if (pcmciac->HP)
- if (mode.Flags & V_INTERLACE) CRTC[30] |= 0x04;
-#endif
-
-{
- int nExtBits = 0;
- CARD32 ExtBits;
- CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6;
-
- CRTC[3] = (CRTC[3] & ~0x1F)
- | ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F);
- CRTC[5] = (CRTC[5] & ~0x80)
- | (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2);
- ExtBits = (((min(h_sync_end,h_total)) >> 3) - 1) & ExtBitMask;
-
- /* First the horizontal case */
- if ((((min(h_sync_end,h_total)) >> 3) == (h_total >> 3)))
- {
- int i = (CRTC[3] & 0x1F)
- | ((CRTC[5] & 0x80) >> 2)
- | ExtBits;
- if ((i-- > ((((min(h_sync_start,h_active)) >> 3) - 1)
- & (0x3F | ExtBitMask)))
- && ((min(h_sync_end,h_total)) == h_total))
- i = 0;
- CRTC[3] = (CRTC[3] & ~0x1F) | (i & 0x1F);
- CRTC[5] = (CRTC[5] & ~0x80) | ((i << 2) & 0x80);
- ExtBits = i & ExtBitMask;
- }
-}
-{
- CARD32 ExtBits;
- CARD32 ExtBitMask = 0;
- /* If width is not known nBits should be 0. In this
- * case BitMask is set to 0 so we can check for it. */
- CARD32 BitMask = 0;
- int VBlankStart = ((min(v_sync_start,v_active)) - 1) & 0xFF;
- CRTC[22] = ((min(v_sync_end,v_total)) - 1) & 0xFF;
- ExtBits = ((min(v_sync_end,v_total)) - 1) & ExtBitMask;
-
- if ((min(v_sync_end,v_total)) == v_total)
- /* Null top overscan */
- {
- int i = CRTC[22] | ExtBits;
- if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask)))
- || ((i > VBlankStart) && /* 8-bit case */
- ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */
- !(CRTC[9] & 0x9F)) /* 1 scanline/row */
- i = 0;
- else
- i = (i - 1);
- CRTC[22] = i & 0xFF;
- ExtBits = i & 0xFF00;
- }
-}
-
- /*
- * Graphics Display Controller
- */
- Graphics[0] = 0x00;
- Graphics[1] = 0x00;
- Graphics[2] = 0x00;
- Graphics[3] = 0x00;
- Graphics[4] = 0x00;
- if (pScreenPriv->screen->fb[0].depth == 4)
- Graphics[5] = 0x02;
- else
- Graphics[5] = 0x40;
- Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */
- Graphics[7] = 0x0F;
- Graphics[8] = 0xFF;
-
- Attribute[0] = 0x00; /* standard colormap translation */
- Attribute[1] = 0x01;
- Attribute[2] = 0x02;
- Attribute[3] = 0x03;
- Attribute[4] = 0x04;
- Attribute[5] = 0x05;
- Attribute[6] = 0x06;
- Attribute[7] = 0x07;
- Attribute[8] = 0x08;
- Attribute[9] = 0x09;
- Attribute[10] = 0x0A;
- Attribute[11] = 0x0B;
- Attribute[12] = 0x0C;
- Attribute[13] = 0x0D;
- Attribute[14] = 0x0E;
- Attribute[15] = 0x0F;
- if (pScreenPriv->screen->fb[0].depth == 4)
- Attribute[16] = 0x81;
- else
- Attribute[16] = 0x41;
- if (pScreenPriv->screen->fb[0].bitsPerPixel == 16)
- Attribute[17] = 0x00;
- else
- Attribute[17] = 0xFF;
- Attribute[18] = 0x0F;
- Attribute[19] = 0x00;
- Attribute[20] = 0x00;
-
- /* Wake up the card */
- if (pcmciac->HP) {
- pcmciaWriteReg(pcmciac, 0x3c3, 0x1);
- pcmciaWriteReg(pcmciac, 0x46e8, 0x10);
- } else {
- pcmciaWriteReg(pcmciac, 0x105, 0x1);
- pcmciaWriteReg(pcmciac, 0x46e8, 0x1f);
- pcmciaWriteReg(pcmciac, 0x102, 0x1);
- pcmciaWriteReg(pcmciac, 0x46e8, 0xf);
- pcmciaWriteReg(pcmciac, 0x3c3, 0x1);
- }
-
- if (pcmciac->HP) {
- /* unlock */
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x11, 0x92);
- j = pcmciaReadIndex(pcmciac, 0x3c4, 0xb);
- pcmciaWriteIndex(pcmciac, 0x3c4, 0xe, 0xc2);
-
- /* switch on dac */
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x29, 0x24);
- /* switch on the accelerator */
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x36, 0x80);
-
- /* bump up memory clk */
- pcmciaWriteReg(pcmciac, 0x43c6, 0x65);
- pcmciaWriteReg(pcmciac, 0x43c7, 0x00);
- } else {
- /* unlock */
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x06, 0x12);
- pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg);
- }
-
- /* synchronous reset */
- pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0);
-
- pcmciaWriteReg(pcmciac, 0x3da, 0x10);
-
- for (i=0;i<6;i++)
- pcmciaWriteIndex(pcmciac, 0x3c4, i, Sequencer[i]);
-
- if (pcmciac->HP) {
- /* Stick chip into color mode */
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x2f, 0x06);
- /* Switch on Linear addressing */
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x21, 0x2e);
- } else {
- /* Stick chip into 8bit access mode - ugh! */
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x0F, 0x20); /* 0x26 ? */
- /* reset mclk */
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x1F, 0);
- }
-
- pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0x3);
-
- for (i=0;i<31;i++)
- pcmciaWriteIndex(pcmciac, 0x3d4, i, CRTC[i]);
-
- for (i=0;i<9;i++)
- pcmciaWriteIndex(pcmciac, 0x3ce, i, Graphics[i]);
-
- j = pcmciaReadReg(pcmciac, 0x3da);
-
- for (i=0;i<21;i++) {
- pcmciaWriteReg(pcmciac, 0x3c0, i);
- pcmciaWriteReg(pcmciac, 0x3c0, Attribute[i]);
- }
-
- j = pcmciaReadReg(pcmciac, 0x3da);
- pcmciaWriteReg(pcmciac, 0x3c0, 0x20);
-
- j = pcmciaReadReg(pcmciac, 0x3c8);
- j = pcmciaReadReg(pcmciac, 0x3c6);
- j = pcmciaReadReg(pcmciac, 0x3c6);
- j = pcmciaReadReg(pcmciac, 0x3c6);
- j = pcmciaReadReg(pcmciac, 0x3c6);
- switch (pScreenPriv->screen->fb[0].depth) {
- /* This is here for completeness, when/if we ever do 4bpp */
- case 4:
- pcmciaWriteReg(pcmciac, 0x3c6, 0x0);
- if (pcmciac->HP) {
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x90);
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00);
- } else
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x00);
- break;
- case 8:
- pcmciaWriteReg(pcmciac, 0x3c6, 0x0);
- if (pcmciac->HP) {
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x92);
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00);
- } else
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x01);
- break;
- case 15:
- if (pcmciac->HP) {
- pcmciaWriteReg(pcmciac, 0x3c6, 0x10);
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a);
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04);
- } else {
- pcmciaWriteReg(pcmciac, 0x3c6, 0xC0);
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03);
- }
- break;
- case 16:
- if (pcmciac->HP) {
- pcmciaWriteReg(pcmciac, 0x3c6, 0x30);
- pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a);
- pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04);
- } else {
- pcmciaWriteReg(pcmciac, 0x3c6, 0xC1);
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03);
- }
- break;
- }
- j = pcmciaReadReg(pcmciac, 0x3c8);
-
- pcmciaWriteReg(pcmciac, 0x3c6, 0xff);
-
- for (i=0;i<256;i++) {
- pcmciaWriteReg(pcmciac, 0x3c8, i);
- pcmciaWriteReg(pcmciac, 0x3c9, i);
- pcmciaWriteReg(pcmciac, 0x3c9, i);
- pcmciaWriteReg(pcmciac, 0x3c9, i);
- }
-
- /* Set the Clock */
- if (pcmciac->HP) {
- CARD8 a,b;
- int clock = t->clock;
- if (pScreenPriv->screen->fb[0].bitsPerPixel == 16)
- clock *= 2;
- tridentSetCLK(clock, &a, &b);
- pcmciaWriteReg(pcmciac, 0x43c8, a);
- pcmciaWriteReg(pcmciac, 0x43c9, b);
- } else {
- int num, den;
- unsigned char tmp;
- int clock = t->clock;
- if (pScreenPriv->screen->fb[0].bitsPerPixel == 16)
- clock *= 2;
-
- CirrusFindClock(clock, &num, &den);
-
- tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x0d);
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x0d, (tmp & 0x80) | num);
- tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x1d);
- pcmciaWriteIndex(pcmciac, 0x3c4, 0x1d, (tmp & 0xc0) | den);
- }
- pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg | 0x08);
-
-#if 1
- for (i=1;i<0x3f;i++)
- ErrorF("0x3c4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3c4, i));
-
- ErrorF("\n");
-
- for (i=0;i<0x3f;i++)
- ErrorF("0x3ce:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3ce, i));
-
- ErrorF("\n");
-
- for (i=0;i<0x3f;i++)
- ErrorF("0x3d4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3d4, i));
-#endif
-
- return TRUE;
-}
-
-void
-pcmciaDisable (ScreenPtr pScreen)
-{
-}
-
-const CARD8 tridentDPMSModes[4] = {
- 0x00, /* KD_DPMS_NORMAL */
- 0x01, /* KD_DPMS_STANDBY */
- 0x02, /* KD_DPMS_SUSPEND */
- 0x03, /* KD_DPMS_POWERDOWN */
-};
-
-Bool
-pcmciaDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
-
- if (pcmciac->HP) {
- pcmciaWriteIndex (pcmciac, 0x3ce, 0x23, tridentDPMSModes[mode]);
- pcmciaPause ();
- } else {
- /* Voyager */
- }
-
- return TRUE;
-}
-
-void
-pcmciaRestore (KdCardInfo *card)
-{
-}
-
-void
-pcmciaScreenFini (KdScreenInfo *screen)
-{
- pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver;
-
- xfree (pcmcias);
- screen->driver = 0;
-}
-
-void
-pcmciaCardFini (KdCardInfo *card)
-{
- pcmciaCardInfo *pcmciac = card->driver;
-
- if (pcmciac->cop_base)
- KdUnmapDevice ((void *) pcmciac->cop_base, PCMCIA_COP_SIZE(card));
-}
-
-void
-pcmciaGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
-
- while (ndef--)
- {
- pcmciaWriteReg (pcmciac, 0x3C7, pdefs->pixel);
- pdefs->red = pcmciaReadReg (pcmciac, 0x3C9) << 10;
- pdefs->green = pcmciaReadReg (pcmciac, 0x3C9) << 10;
- pdefs->blue = pcmciaReadReg (pcmciac, 0x3C9) << 10;
- pdefs++;
- }
-}
-
-void
-pcmciaPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- pcmciaCardInfo *pcmciac = pScreenPriv->card->driver;
-
- while (ndef--)
- {
- pcmciaWriteReg (pcmciac, 0x3C8, pdefs->pixel);
- pcmciaWriteReg (pcmciac, 0x3C9, pdefs->red >> 10);
- pcmciaWriteReg (pcmciac, 0x3C9, pdefs->green >> 10);
- pcmciaWriteReg (pcmciac, 0x3C9, pdefs->blue >> 10);
- pdefs++;
- }
-}
-
-
-KdCardFuncs pcmciaFuncs = {
- pcmciaCardInit, /* cardinit */
- pcmciaScreenInit, /* scrinit */
- pcmciaInitScreen, /* initScreen */
- pcmciaPreserve, /* preserve */
- pcmciaEnable, /* enable */
- pcmciaDPMS, /* dpms */
- pcmciaDisable, /* disable */
- pcmciaRestore, /* restore */
- pcmciaScreenFini, /* scrfini */
- pcmciaCardFini, /* cardfini */
-
- pcmciaCursorInit, /* initCursor */
- pcmciaCursorEnable, /* enableCursor */
- pcmciaCursorDisable, /* disableCursor */
- pcmciaCursorFini, /* finiCursor */
- pcmciaRecolorCursor, /* recolorCursor */
-
-#if 0 /* not yet */
- pcmciaDrawInit, /* initAccel */
- pcmciaDrawEnable, /* enableAccel */
- pcmciaDrawSync, /* syncAccel */
- pcmciaDrawDisable, /* disableAccel */
- pcmciaDrawFini, /* finiAccel */
-#else
- 0,
- 0,
- 0,
- 0,
- 0,
-#endif
-
- pcmciaGetColors, /* getColors */
- pcmciaPutColors, /* putColors */
-};
diff --git a/hw/kdrive/pcmcia/pcmcia.h b/hw/kdrive/pcmcia/pcmcia.h
deleted file mode 100644
index cb4d13a6c..000000000
--- a/hw/kdrive/pcmcia/pcmcia.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmcia.h,v 1.1 2001/05/23 08:56:09 alanh Exp $ */
-
-#ifndef _PCMCIA_H_
-#define _PCMCIA_H_
-
-#include <fbdev.h>
-
-/*
- * offset from ioport beginning
- */
-
-#define PCMCIA_COP_BASE(c) 0x20000000
-#define PCMCIA_COP_SIZE(c) 0x10000
-#define TRIDENT_COP_OFF(c) 0x2100
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _cop {
- VOL32 src_start_xy; /* 0x00 */
- VOL32 src_end_xy; /* 0x04 */
- VOL32 dst_start_xy; /* 0x08 */
- VOL32 dst_end_xy; /* 0x0c */
- VOL32 alpha; /* 0x10 */
- CARD8 pad14[0xc]; /* 0x14 */
- VOL32 multi; /* 0x20 */
-
-#define COP_MULTI_CLIP_TOP_LEFT 0x10000000
-#define COP_MULTI_DEPTH 0x40000000
-#define COP_MULTI_COLOR_KEY 0x70000000
-#define COP_MULTI_STYLE 0x50000000
-#define COP_MULTI_PATTERN 0x80000000
-#define COP_MULTI_ROP 0x90000000
-#define COP_MULTI_STRIDE 0x60000000
-#define COP_MULTI_Z 0xa0000000
-#define COP_MULTI_ALPHA 0xb0000000
-#define COP_MULTI_TEXTURE 0xd0000000
-#define COP_MULTI_TEXTURE_BOUND 0xe0000000
-#define COP_MULTI_TEXTURE_ADVANCED 0x20000000
-#define COP_MULTI_MASK 0xf0000000
-
-#define COP_DEPTH_8 0x00000000
-#define COP_DEPTH_16 0x00000001
-#define COP_DEPTH_24_32 0x00000002
-#define COP_DEPTH_15 0x00000005
-#define COP_DEPTH_DITHER_DISABLE 0x00000008
-
-
-#define COP_ALPHA_SRC_BLEND_0 0x00000000
-#define COP_ALPHA_SRC_BLEND_1 0x00000001
-#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002
-#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003
-#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004
-#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005
-#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006
-#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007
-#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008
-#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009
-#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A
-#define COP_ALPHA_SRC_BLEND_BG 0x0000000B
-
-#define COP_ALPHA_DST_BLEND_0 0x00000000
-#define COP_ALPHA_DST_BLEND_1 0x00000010
-#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020
-#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030
-#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040
-#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050
-#define COP_ALPHA_DST_BLEND_DST_A 0x00000060
-#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070
-#define COP_ALPHA_DST_BLEND_DST_C 0x00000080
-#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090
-#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0
-
-#define COP_ALPHA_RESULT_ALPHA 0x00100000
-#define COP_ALPHA_DEST_ALPHA 0x00200000
-#define COP_ALPHA_SOURCE_ALPHA 0x00400000
-#define COP_ALPHA_WRITE_ENABLE 0x00800000
-#define COP_ALPHA_TEST_ENABLE 0x01000000
-#define COP_ALPHA_BLEND_ENABLE 0x02000000
-#define COP_ALPHA_DEST_VALUE 0x04000000
-#define COP_ALPHA_SOURCE_VALUE 0x08000000
-
- VOL32 command; /* 0x24 */
-#define COP_OP_NULL 0x00000000
-#define COP_OP_LINE 0x20000000
-#define COP_OP_BLT 0x80000000
-#define COP_OP_TEXT 0x90000000
-#define COP_OP_POLY 0xb0000000
-#define COP_OP_POLY2 0xe0000000
-#define COP_SCL_EXPAND 0x00800000
-#define COP_SCL_OPAQUE 0x00400000
-#define COP_SCL_REVERSE 0x00200000
-#define COP_SCL_MONO_OFF 0x001c0000
-#define COP_LIT_TEXTURE 0x00004000
-#define COP_BILINEAR 0x00002000
-#define COP_OP_ZBUF 0x00000800
-#define COP_OP_ROP 0x00000400
-#define COP_OP_FG 0x00000200
-#define COP_OP_FB 0x00000080
-#define COP_X_REVERSE 0x00000004
-#define COP_CLIP 0x00000001
- VOL32 texture_format; /* 0x28 */
- CARD8 pad2c[0x4]; /* 0x2c */
-
- VOL32 clip_bottom_right; /* 0x30 */
- VOL32 dataIII; /* 0x34 */
- VOL32 dataIV; /* 0x38 */
- CARD8 pad3c[0x8]; /* 0x3c */
-
- VOL32 fg; /* 0x44 */
- VOL32 bg; /* 0x48 */
- CARD8 pad4c[0x4]; /* 0x4c */
-
- VOL32 pattern_fg; /* 0x50 */
- VOL32 pattern_bg; /* 0x54 */
- CARD8 pad58[0xc]; /* 0x58 */
-
- VOL32 status; /* 0x64 */
-#define COP_STATUS_BE_BUSY 0x80000000
-#define COP_STATUS_DPE_BUSY 0x20000000
-#define COP_STATUS_MI_BUSY 0x10000000
-#define COP_STATUS_FIFO_BUSY 0x08000000
-#define COP_STATUS_WB_BUSY 0x00800000
-#define COP_STATUS_Z_FAILED 0x00400000
-#define COP_STATUS_EFFECTIVE 0x00200000
-#define COP_STATUS_LEFT_VIEW 0x00080000
-
- CARD8 pad68[0x4]; /* 0x68 */
-
- VOL32 src_offset; /* 0x6c */
- VOL32 z_offset; /* 0x70 */
- CARD8 pad74[0x4]; /* 0x74 */
-
- VOL32 display_offset; /* 0x78 */
- VOL32 dst_offset; /* 0x7c */
- CARD8 pad80[0x34]; /* 0x80 */
-
- VOL32 semaphore; /* 0xb4 */
-} Cop;
-
-#define TRI_XY(x,y) ((y) << 16 | (x))
-
-typedef struct _pcmciaCardInfo {
- CARD8 *fb;
- Bool HP;
- CARD32 memory;
- CARD8 *cop_base;
- Cop *cop;
- CARD32 *window;
- CARD32 cop_depth;
- CARD32 cop_stride;
-} pcmciaCardInfo;
-
-#define getpcmciaCardInfo(kd) ((pcmciaCardInfo *) ((kd)->card->driver))
-#define pcmciaCardInfo(kd) pcmciaCardInfo *pcmciac = getpcmciaCardInfo(kd)
-
-typedef struct _pcmciaCursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} pcmciaCursor;
-
-#define PCMCIA_CURSOR_WIDTH 64
-#define PCMCIA_CURSOR_HEIGHT 64
-
-typedef struct _pcmciaScreenInfo {
- CARD8 *cursor_base;
- CARD8 *screen;
- CARD8 *off_screen;
- int off_screen_size;
- int randr;
- LayerPtr pLayer;
- pcmciaCursor cursor;
-} pcmciaScreenInfo;
-
-#define getpcmciaScreenInfo(kd) ((pcmciaScreenInfo *) ((kd)->screen->driver))
-#define pcmciaScreenInfo(kd) pcmciaScreenInfo *pcmcias = getpcmciaScreenInfo(kd)
-
-Bool
-pcmciaDrawInit (ScreenPtr pScreen);
-
-void
-pcmciaDrawEnable (ScreenPtr pScreen);
-
-void
-pcmciaDrawSync (ScreenPtr pScreen);
-
-void
-pcmciaDrawDisable (ScreenPtr pScreen);
-
-void
-pcmciaDrawFini (ScreenPtr pScreen);
-
-CARD8
-pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index);
-
-void
-pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value);
-
-void
-pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value);
-
-Bool
-pcmciaCursorInit (ScreenPtr pScreen);
-
-void
-pcmciaCursorEnable (ScreenPtr pScreen);
-
-void
-pcmciaCursorDisable (ScreenPtr pScreen);
-
-void
-pcmciaCursorFini (ScreenPtr pScreen);
-
-void
-pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
-
-void
-pcmciaUpdateRotatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf);
-
-typedef struct _pcmciaDisplayModeRec {
- int Width;
- int Height;
- int Refresh;
- int Clock; /* pixel clock freq */
- int HDisplay; /* horizontal timing */
- int HSyncStart;
- int HSyncEnd;
- int HTotal;
- int HSkew;
- int VDisplay; /* vertical timing */
- int VSyncStart;
- int VSyncEnd;
- int VTotal;
- int VScan;
- int Flags;
-} pcmciaDisplayModeRec, *pcmciaDisplayModePtr;
-
-extern KdCardFuncs pcmciaFuncs;
-
-#endif /* _PCMCIA_H_ */
diff --git a/hw/kdrive/pcmcia/pcmciacurs.c b/hw/kdrive/pcmcia/pcmciacurs.c
deleted file mode 100644
index 1cb86cfe9..000000000
--- a/hw/kdrive/pcmcia/pcmciacurs.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- */
-/* $RCSId: $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "pcmcia.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- pcmciaCardInfo(pScreenPriv); \
- pcmciaScreenInfo(pScreenPriv); \
- pcmciaCursor *pCurPriv = &pcmcias->cursor
-
-static void
-_pcmciaMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
-
- /* This is the recommended order to move the cursor */
- if (pcmciac->HP) {
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x40, xlow);
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x41, xhigh);
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x42, ylow);
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x43, yhigh);
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x46, xoff);
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x47, yoff);
- } else {
- x >>= 3;
- y >>= 3;
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
- /* Don't be alarmed, yes the upper 3bits of the index are correct */
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x10 | xhigh << 5, xlow);
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x11 | yhigh << 5, ylow);
- }
-}
-
-static void
-pcmciaMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _pcmciaMoveCursor (pScreen, x, y);
-}
-
-static void
-pcmciaAllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
-
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
-}
-
-static void
-pcmciaSetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CARD32 fg, bg;
-
- fg = pCurPriv->source;
- bg = pCurPriv->mask;
-
- if (pcmciac->HP) {
- /*
- * This trident chip uses the palette for it's cursor colors - ouch!
- * We enforce it to always stay the black/white colors as we don't
- * want it to muck with the overscan color. Tough. Use softCursor
- * if you want to change cursor colors.
- */
- pcmciaWriteReg (pcmciac, 0x3c8, 0xff); /* DAC 0 */
- pcmciaWriteReg (pcmciac, 0x3c9, 0x00);
- pcmciaWriteReg (pcmciac, 0x3c9, 0x00);
- pcmciaWriteReg (pcmciac, 0x3c9, 0x00);
- pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 255 */
- pcmciaWriteReg (pcmciac, 0x3c9, 0x3f);
- pcmciaWriteReg (pcmciac, 0x3c9, 0x3f);
- pcmciaWriteReg (pcmciac, 0x3c9, 0x3f);
- } else {
- CARD8 temp;
- temp = pcmciaReadIndex(pcmciac, 0x3c4, 0x12);
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, (temp & 0xFE) | 0x02);
-
- pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 256 */
- pcmciaWriteReg (pcmciac, 0x3c9, fg);
- pcmciaWriteReg (pcmciac, 0x3c9, fg >> 8);
- pcmciaWriteReg (pcmciac, 0x3c9, fg >> 16);
- pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 257 */
- pcmciaWriteReg (pcmciac, 0x3c9, bg);
- pcmciaWriteReg (pcmciac, 0x3c9, bg >> 8);
- pcmciaWriteReg (pcmciac, 0x3c9, bg >> 16);
-
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, temp);
- }
-}
-
-void
-pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- pcmciaAllocCursorColors (pScreen);
- pcmciaSetCursorColors (pScreen);
-}
-
-#define InvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-static void
-pcmciaLoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- CARD8 *ram;
- CARD32 *msk, *mskLine, *src, *srcLine;
- int i, j;
- int cursor_address;
- int lwsrc;
- unsigned char ramdac_control_;
- CARD32 offset;
-
- /*
- * Allocate new colors
- */
- pcmciaAllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- if (pcmciac->HP) {
- ram = (CARD8 *) pcmcias->cursor_base;
- } else {
- /* The last bank */
- ram = (CARD8 *) pcmciac->fb;
- pcmciaWriteIndex (pcmciac, 0x3ce, 0x09, 0x7f);
- pcmciaWriteIndex (pcmciac, 0x3ce, 0x0A, 0x7f);
- }
-
- mskLine = (CARD32 *) bits->mask;
- srcLine = (CARD32 *) bits->source;
-
- h = bits->height;
- if (h > PCMCIA_CURSOR_HEIGHT)
- h = PCMCIA_CURSOR_HEIGHT;
-
- lwsrc = BitmapBytePad(bits->width) / 4;
-
- for (i = 0; i < PCMCIA_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += lwsrc;
- srcLine += lwsrc;
- for (j = 0; j < PCMCIA_CURSOR_WIDTH / 32; j++) {
-
- CARD32 m, s;
-
- if (i < h && j < lwsrc)
- {
- m = *msk++;
- s = *src++;
- InvertBits32(m);
- InvertBits32(s);
- }
- else
- {
- m = 0;
- s = 0;
- }
-
- /* Do 8bit access */
- *ram++ = (m & 0xff);
- *ram++ = (m & 0xff00) >> 8;
- *ram++ = (m & 0xff0000) >> 16;
- *ram++ = (m & 0xff000000) >> 24;
- *ram++ = (s & 0xff);
- *ram++ = (s & 0xff00) >> 8;
- *ram++ = (s & 0xff0000) >> 16;
- *ram++ = (s & 0xff000000) >> 24;
- }
- }
-
- /* Set address for cursor bits */
- if (pcmciac->HP) {
- offset = pcmcias->cursor_base - (CARD8 *) pcmcias->screen;
- offset >>= 10;
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x44, (CARD8) (offset & 0xff));
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x45, (CARD8) (offset >> 8));
- } else {
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x13, 15); /* ?? */
- }
-
- /* Set new color */
- pcmciaSetCursorColors (pScreen);
-
- /* Enable the cursor */
- if (pcmciac->HP)
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0xc1);
- else
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0x05);
-
- /* Move to new position */
- pcmciaMoveCursor (pScreen, x, y);
-}
-
-static void
-pcmciaUnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- /* Disable cursor */
- if (pcmciac->HP)
- pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0);
- else
- pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0);
-}
-
-static Bool
-pcmciaRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- pcmciaLoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-pcmciaUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-pcmciaSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- pcmciaLoadCursor (pScreen, x, y);
- else
- pcmciaUnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec pcmciaPointerSpriteFuncs = {
- pcmciaRealizeCursor,
- pcmciaUnrealizeCursor,
- pcmciaSetCursor,
- pcmciaMoveCursor,
-};
-
-static void
-pcmciaQueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-pcmciaCursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pcmcias->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = PCMCIA_CURSOR_WIDTH;
- pCurPriv->height= PCMCIA_CURSOR_HEIGHT;
- pScreen->QueryBestSize = pcmciaQueryBestSize;
- miPointerInitialize (pScreen,
- &pcmciaPointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-pcmciaCursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- pcmciaLoadCursor (pScreen, x, y);
- }
- else
- pcmciaUnloadCursor (pScreen);
- }
-}
-
-void
-pcmciaCursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- pcmciaUnloadCursor (pScreen);
- }
- }
-}
-
-void
-pcmciaCursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/pcmcia/pcmciarotate.c b/hw/kdrive/pcmcia/pcmciarotate.c
deleted file mode 100644
index 6ac7efbfd..000000000
--- a/hw/kdrive/pcmcia/pcmciarotate.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/miext/shadow/shrotate.c,v 1.3 2001/07/21 04:13:26 keithp Exp $
- *
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "font.h"
-#include "dixfontstr.h"
-#include "fontstruct.h"
-#include "mi.h"
-#include "regionstr.h"
-#include "globals.h"
-#include "gcstruct.h"
-#include "shadow.h"
-#include "fb.h"
-
-/*
- * These indicate which way the source (shadow) is scanned when
- * walking the screen in a particular direction
- */
-
-#define LEFT_TO_RIGHT 1
-#define RIGHT_TO_LEFT -1
-#define TOP_TO_BOTTOM 2
-#define BOTTOM_TO_TOP -2
-
-typedef CARD16 PcBits;
-typedef INT32 PcStride;
-
-#define PC_SHIFT 4
-#define PC_UNIT (1 << PC_SHIFT)
-#define PC_HALFUNIT (1 << (PC_SHIFT-1))
-#define PC_MASK (PC_UNIT - 1)
-#define PC_ALLONES ((PcBits) -1)
-
-#define PcScrRight(x,b) FbScrRight(x,b)
-#define PcScrLeft(x,b) FbScrLeft(x,b)
-#define PcBitsMask(x,w) (PcScrRight(PC_ALLONES,(x) & PC_MASK) & \
- PcScrLeft(PC_ALLONES,(PC_UNIT - ((x) + (w))) & PC_MASK))
-
-#define pcGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
- PixmapPtr _pPix; \
- if ((pDrawable)->type != DRAWABLE_PIXMAP) \
- _pPix = fbGetWindowPixmap(pDrawable); \
- else \
- _pPix = (PixmapPtr) (pDrawable); \
- (pointer) = (PcBits *) _pPix->devPrivate.ptr; \
- (stride) = ((int) _pPix->devKind) / sizeof (PcBits); \
- (bpp) = _pPix->drawable.bitsPerPixel; \
- (xoff) = 0; \
- (yoff) = 0; \
-}
-
-void
-pcmciaUpdateRotatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf)
-{
- RegionPtr damage = &pBuf->damage;
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = REGION_NUM_RECTS (damage);
- BoxPtr pbox = REGION_RECTS (damage);
- PcBits *shaBits;
- PcStride shaStride;
- int shaBpp;
- int shaXoff, shaYoff;
- int box_x1, box_x2, box_y1, box_y2;
- int sha_x1, sha_y1;
- int scr_x1, scr_x2, scr_y1, scr_y2, scr_w, scr_h;
- int scr_x, scr_y;
- int w;
- int pixelsPerBits;
- int pixelsMask;
- PcStride shaStepOverY, shaStepDownY, shaStepOverX, shaStepDownX;
- PcBits *shaLine, *sha;
- int shaHeight = pShadow->drawable.height;
- int shaWidth = pShadow->drawable.width;
- PcBits shaMask;
- int shaFirstShift, shaShift;
- int o_x_dir;
- int o_y_dir;
- int x_dir;
- int y_dir;
-
- pcGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
- pixelsPerBits = (sizeof (PcBits) * 8) / shaBpp;
- pixelsMask = ~(pixelsPerBits - 1);
- shaMask = PcBitsMask (PC_UNIT-shaBpp, shaBpp);
- /*
- * Compute rotation related constants to walk the shadow
- */
- o_x_dir = LEFT_TO_RIGHT;
- o_y_dir = TOP_TO_BOTTOM;
- if (pBuf->randr & SHADOW_REFLECT_X)
- o_x_dir = -o_x_dir;
- if (pBuf->randr & SHADOW_REFLECT_Y)
- o_y_dir = -o_y_dir;
- switch (pBuf->randr & (SHADOW_ROTATE_ALL)) {
- case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */
- default:
- x_dir = o_x_dir;
- y_dir = o_y_dir;
- break;
- case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */
- x_dir = o_y_dir;
- y_dir = -o_x_dir;
- break;
- case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */
- x_dir = -o_x_dir;
- y_dir = -o_y_dir;
- break;
- case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */
- x_dir = -o_y_dir;
- y_dir = o_x_dir;
- break;
- }
- switch (x_dir) {
- case LEFT_TO_RIGHT:
- shaStepOverX = shaBpp;
- shaStepOverY = 0;
- break;
- case TOP_TO_BOTTOM:
- shaStepOverX = 0;
- shaStepOverY = shaStride;
- break;
- case RIGHT_TO_LEFT:
- shaStepOverX = -shaBpp;
- shaStepOverY = 0;
- break;
- case BOTTOM_TO_TOP:
- shaStepOverX = 0;
- shaStepOverY = -shaStride;
- break;
- }
- switch (y_dir) {
- case TOP_TO_BOTTOM:
- shaStepDownX = 0;
- shaStepDownY = shaStride;
- break;
- case RIGHT_TO_LEFT:
- shaStepDownX = -shaBpp;
- shaStepDownY = 0;
- break;
- case BOTTOM_TO_TOP:
- shaStepDownX = 0;
- shaStepDownY = -shaStride;
- break;
- case LEFT_TO_RIGHT:
- shaStepDownX = shaBpp;
- shaStepDownY = 0;
- break;
- }
-
- while (nbox--)
- {
- box_x1 = pbox->x1;
- box_y1 = pbox->y1;
- box_x2 = pbox->x2;
- box_y2 = pbox->y2;
- pbox++;
-
- /*
- * Compute screen and shadow locations for this box
- */
- switch (x_dir) {
- case LEFT_TO_RIGHT:
- scr_x1 = box_x1 & pixelsMask;
- scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask;
-
- sha_x1 = scr_x1;
- break;
- case TOP_TO_BOTTOM:
- scr_x1 = box_y1 & pixelsMask;
- scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask;
-
- sha_y1 = scr_x1;
- break;
- case RIGHT_TO_LEFT:
- scr_x1 = (shaWidth - box_x2) & pixelsMask;
- scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask;
-
- sha_x1 = (shaWidth - scr_x1 - 1);
- break;
- case BOTTOM_TO_TOP:
- scr_x1 = (shaHeight - box_y2) & pixelsMask;
- scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask;
-
- sha_y1 = (shaHeight - scr_x1 - 1);
- break;
- }
- switch (y_dir) {
- case TOP_TO_BOTTOM:
- scr_y1 = box_y1;
- scr_y2 = box_y2;
-
- sha_y1 = scr_y1;
- break;
- case RIGHT_TO_LEFT:
- scr_y1 = (shaWidth - box_x2);
- scr_y2 = (shaWidth - box_x1);
-
- sha_x1 = box_x2 - 1;
- break;
- case BOTTOM_TO_TOP:
- scr_y1 = shaHeight - box_y2;
- scr_y2 = shaHeight - box_y1;
-
- sha_y1 = box_y2 - 1;
- break;
- case LEFT_TO_RIGHT:
- scr_y1 = box_x1;
- scr_y2 = box_x2;
-
- sha_x1 = box_x1;
- break;
- }
- scr_w = ((scr_x2 - scr_x1) * shaBpp) >> PC_SHIFT;
- scr_h = scr_y2 - scr_y1;
- scr_y = scr_y1;
-
- /* shift amount for first pixel on screen */
- shaFirstShift = PC_UNIT - ((sha_x1 * shaBpp) & PC_MASK) - shaBpp;
-
- /* pointer to shadow data first placed on screen */
- shaLine = (shaBits +
- sha_y1 * shaStride +
- ((sha_x1 * shaBpp) >> PC_SHIFT));
-
- /*
- * Copy the bits, always write across the physical frame buffer
- * to take advantage of write combining.
- */
- while (scr_h--)
- {
- int p;
- PcBits bits;
- PcBits *win;
- int i;
- CARD32 winSize;
-
- sha = shaLine;
- shaShift = shaFirstShift;
- w = scr_w;
- scr_x = scr_x1 * shaBpp >> PC_SHIFT;
-
- while (w)
- {
- /*
- * Map some of this line
- */
- win = (PcBits *) (*pBuf->window) (pScreen,
- scr_y,
- scr_x << 1,
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- i = (winSize >> 1);
- if (i > w)
- i = w;
- w -= i;
- scr_x += i;
- /*
- * Copy the portion of the line mapped
- */
- while (i--)
- {
- bits = 0;
- p = pixelsPerBits;
- /*
- * Build one word of output from multiple inputs
- *
- * Note that for 90/270 rotations, this will walk
- * down the shadow hitting each scanline once.
- * This is probably not very efficient.
- */
- while (p--)
- {
- bits = PcScrLeft(bits, shaBpp);
- bits |= PcScrRight (*sha, shaShift) & shaMask;
-
- shaShift -= shaStepOverX;
- if (shaShift >= PC_UNIT)
- {
- shaShift -= PC_UNIT;
- sha--;
- }
- else if (shaShift < 0)
- {
- shaShift += PC_UNIT;
- sha++;
- }
- sha += shaStepOverY;
- }
- *win++ = bits;
- }
- }
- scr_y++;
- shaFirstShift -= shaStepDownX;
- if (shaFirstShift >= PC_UNIT)
- {
- shaFirstShift -= PC_UNIT;
- shaLine--;
- }
- else if (shaFirstShift < 0)
- {
- shaFirstShift += PC_UNIT;
- shaLine++;
- }
- shaLine += shaStepDownY;
- }
- }
-}
diff --git a/hw/kdrive/pcmcia/pcmciashadow.c b/hw/kdrive/pcmcia/pcmciashadow.c
deleted file mode 100644
index abe73a0ba..000000000
--- a/hw/kdrive/pcmcia/pcmciashadow.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmciashadow.c,v 1.1 2001/05/23 08:56:09 alanh Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "font.h"
-#include "dixfontstr.h"
-#include "fontstruct.h"
-#include "mi.h"
-#include "regionstr.h"
-#include "globals.h"
-#include "gcstruct.h"
-#include "shadow.h"
-#include "fb.h"
-
-void
-tridentUpdatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf)
-{
- RegionPtr damage = &pBuf->damage;
- PixmapPtr pShadow = pBuf->pPixmap;
- shadowScrPriv(pScreen);
- int nbox = REGION_NUM_RECTS (damage);
- BoxPtr pbox = REGION_RECTS (damage);
- FbBits *shaBase, *shaLine, *sha;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- int shaXoff, shaYoff; /* XXX assumed to be zero */
- int x, y, w, h, width;
- int i;
- FbBits *winBase, *win;
- CARD32 winSize;
-
- fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
- while (nbox--)
- {
- x = pbox->x1 * shaBpp;
- y = pbox->y1;
- w = (pbox->x2 - pbox->x1) * shaBpp;
- h = pbox->y2 - pbox->y1;
-
- scrLine = (x >> FB_SHIFT);
- shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
-
- x &= FB_MASK;
- w = (w + x + FB_MASK) >> FB_SHIFT;
-
- while (h--)
- {
- winSize = 0;
- scrBase = 0;
- width = w;
- scr = scrLine;
- sha = shaLine;
- while (width) {
- /* how much remains in this window */
- i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
- winBase = (FbBits *) (*pBuf->window) (pScreen,
- y,
- scr * sizeof (FbBits),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
- return;
- scrBase = scr;
- winSize /= sizeof (FbBits);
- i = winSize;
- }
- win = winBase + (scr - scrBase);
- if (i > width)
- i = width;
- width -= i;
- scr += i;
- {
- CARD16 *sha16 = (CARD16*)sha;
- CARD16 *win16 = (CARD16*)win;
- while (i--)
- {
- *win16++ = *sha16++;
- *win16++ = *sha16++;
- }
- }
- }
- shaLine += shaStride;
- y++;
- }
- pbox++;
- }
-}
-
-void
-cirrusUpdatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf)
-{
- RegionPtr damage = &pBuf->damage;
- PixmapPtr pShadow = pBuf->pPixmap;
- shadowScrPriv(pScreen);
- int nbox = REGION_NUM_RECTS (damage);
- BoxPtr pbox = REGION_RECTS (damage);
- FbBits *shaBase, *shaLine, *sha;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- int shaXoff, shaYoff; /* XXX assumed to be zero */
- int x, y, w, h, width;
- int i;
- FbBits *winBase, *win;
- CARD32 winSize;
-
- fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
- while (nbox--)
- {
- x = pbox->x1 * shaBpp;
- y = pbox->y1;
- w = (pbox->x2 - pbox->x1) * shaBpp;
- h = pbox->y2 - pbox->y1;
-
- scrLine = (x >> FB_SHIFT);
- shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
-
- x &= FB_MASK;
- w = (w + x + FB_MASK) >> FB_SHIFT;
-
- while (h--)
- {
- winSize = 0;
- scrBase = 0;
- width = w;
- scr = scrLine;
- sha = shaLine;
- while (width) {
- /* how much remains in this window */
- i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
- winBase = (FbBits *) (*pBuf->window) (pScreen,
- y,
- scr * sizeof (FbBits),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
- return;
- scrBase = scr;
- winSize /= sizeof (FbBits);
- i = winSize;
- }
- win = winBase + (scr - scrBase);
- if (i > width)
- i = width;
- width -= i;
- scr += i;
- {
- CARD8 *sha8 = (CARD8*)sha;
- CARD8 *win8 = (CARD8*)win;
- while (i--)
- {
- *win8++ = *sha8++;
- *win8++ = *sha8++;
- *win8++ = *sha8++;
- *win8++ = *sha8++;
- }
- }
- }
- shaLine += shaStride;
- y++;
- }
- pbox++;
- }
-}
diff --git a/hw/kdrive/pcmcia/pcmciastub.c b/hw/kdrive/pcmcia/pcmciastub.c
deleted file mode 100644
index 8759f4a08..000000000
--- a/hw/kdrive/pcmcia/pcmciastub.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmciastub.c,v 1.1 2001/05/23 08:56:09 alanh Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "pcmcia.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- KdCardInfoAdd (&pcmciaFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-extern pcmciaDisplayModeRec pcmciaDefaultModes[];
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/r128/Makefile.am b/hw/kdrive/r128/Makefile.am
deleted file mode 100644
index a3a989c41..000000000
--- a/hw/kdrive/r128/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- -I$(top_srcdir)/hw/kdrive/vesa \
- @XSERVER_CFLAGS@
-
-bin_PROGRAMS = Xr128
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-noinst_LIBRARIES = libr128.a
-
-libr128_a_SOURCES = \
- r128draw.c \
- r128.c \
- r128.h
-
-Xr128_SOURCES = \
- r128stub.c
-
-Xr128_LDADD = \
- libr128.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
diff --git a/hw/kdrive/r128/r128.c b/hw/kdrive/r128/r128.c
deleted file mode 100644
index 2be8b26d2..000000000
--- a/hw/kdrive/r128/r128.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "r128.h"
-
-static Bool
-r128CardInit (KdCardInfo *card)
-{
- R128CardInfo *r128c;
-
- r128c = (R128CardInfo *) xalloc (sizeof (R128CardInfo));
- if (!r128c)
- return FALSE;
-
- r128MapReg (card, r128c);
-
- if (!vesaInitialize (card, &r128c->vesa))
- {
- xfree (r128c);
- return FALSE;
- }
-
- r128c->fifo_size = 0;
-
- card->driver = r128c;
-
- return TRUE;
-}
-
-static Bool
-r128ScreenInit (KdScreenInfo *screen)
-{
- R128ScreenInfo *r128s;
- int screen_size, memory;
-
- r128s = (R128ScreenInfo *) xalloc (sizeof (R128ScreenInfo));
- if (!r128s)
- return FALSE;
- memset (r128s, '\0', sizeof (R128ScreenInfo));
- if (!vesaScreenInitialize (screen, &r128s->vesa))
- {
- xfree (r128s);
- return FALSE;
- }
-#if 0
- /* if (!r128c->reg)
- screen->dumb = TRUE; */
-
- if (r128s->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
-
- fprintf (stderr, "vesa mapping is %d\n", r128s->vesa.mapping);
-#endif
- r128s->screen = r128s->vesa.fb;
-
- memory = r128s->vesa.fb_size;
- screen_size = screen->fb[0].byteStride * screen->height;
-
- memory -= screen_size;
- if (memory > screen->fb[0].byteStride)
- {
- r128s->off_screen = r128s->screen + screen_size;
- r128s->off_screen_size = memory;
- }
- else
- {
- r128s->off_screen = 0;
- r128s->off_screen_size = 0;
- }
- screen->driver = r128s;
- return TRUE;
-}
-
-static Bool
-r128InitScreen (ScreenPtr pScreen)
-{
- return vesaInitScreen (pScreen);
-}
-
-static Bool
-r128FinishInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
-
- ret = vesaFinishInitScreen (pScreen);
-
- return ret;
-}
-
-static void
-r128Preserve (KdCardInfo *card)
-{
- vesaPreserve (card);
-}
-
-Bool
-r128MapReg (KdCardInfo *card, R128CardInfo *r128c)
-{
- r128c->reg_base = (CARD8 *) KdMapDevice (R128_REG_BASE (card),
- R128_REG_SIZE (card));
-
- if (!r128c->reg_base)
- {
- return FALSE;
- }
-
- KdSetMappedMode (R128_REG_BASE (card),
- R128_REG_SIZE (card),
- KD_MAPPED_MODE_REGISTERS);
-
- return TRUE;
-}
-
-void
-r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c)
-{
- if (r128c->reg_base)
- {
- KdResetMappedMode (R128_REG_BASE (card),
- R128_REG_SIZE (card),
- KD_MAPPED_MODE_REGISTERS);
- KdUnmapDevice ((void *) r128c->reg_base, R128_REG_SIZE (card));
- r128c->reg_base = 0;
- }
-}
-
-void
-r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c)
-{
- if (!r128c->reg_base)
- r128MapReg (card, r128c);
-}
-
-void
-r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c)
-{
- r128UnmapReg (card, r128c);
-}
-
-
-static Bool
-r128DPMS (ScreenPtr pScreen, int mode)
-{
- /* XXX */
- return TRUE;
-}
-
-static Bool
-r128Enable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- R128CardInfo *r128c = pScreenPriv->card->driver;
-
- if (!vesaEnable (pScreen))
- return FALSE;
-
- r128SetMMIO (pScreenPriv->card, r128c);
- r128DPMS (pScreen, KD_DPMS_NORMAL);
-
- return TRUE;
-}
-
-static void
-r128Disable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- R128CardInfo *r128c = pScreenPriv->card->driver;
-
- r128ResetMMIO (pScreenPriv->card, r128c);
- vesaDisable (pScreen);
-}
-
-static void
-r128Restore (KdCardInfo *card)
-{
- R128CardInfo *r128c = card->driver;
-
- r128ResetMMIO (card, r128c);
- vesaRestore (card);
-}
-
-static void
-r128ScreenFini (KdScreenInfo *screen)
-{
- R128ScreenInfo *r128s = (R128ScreenInfo *) screen->driver;
-
- vesaScreenFini (screen);
- xfree (r128s);
- screen->driver = 0;
-}
-
-static void
-r128CardFini (KdCardInfo *card)
-{
- R128CardInfo *r128c = (R128CardInfo *)card->driver;
-
- r128UnmapReg (card, r128c);
- vesaCardFini (card);
-}
-
-KdCardFuncs r128Funcs = {
- r128CardInit, /* cardinit */
- r128ScreenInit, /* scrinit */
- r128InitScreen, /* initScreen */
- r128FinishInitScreen, /* finishInitScreen */
- vesaCreateResources,/* createRes */
- r128Preserve, /* preserve */
- r128Enable, /* enable */
- r128DPMS, /* dpms */
- r128Disable, /* disable */
- r128Restore, /* restore */
- r128ScreenFini, /* scrfini */
- r128CardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- r128DrawInit, /* initAccel */
- r128DrawEnable, /* enableAccel */
- r128DrawSync, /* syncAccel */
- r128DrawDisable, /* disableAccel */
- r128DrawFini, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-};
-
diff --git a/hw/kdrive/r128/r128.h b/hw/kdrive/r128/r128.h
deleted file mode 100644
index 8cf2bd4e2..000000000
--- a/hw/kdrive/r128/r128.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-
-#ifndef _R128_H_
-#define _R128_H_
-#include <vesa.h>
-
-#define R128_REG_BASE(c) ((c)->attr.address[1])
-#define R128_REG_SIZE(c) (0x4000)
-
-#define R128_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
-#define R128_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
-
-#define R128_REG_GUI_STAT 0x1740
-#define R128_REG_DEFAULT_OFFSET 0x16e0
-#define R128_REG_DEFAULT_PITCH 0x16e4
-#define R128_REG_DP_GUI_MASTER_CNTL 0x146c
-#define R128_REG_DP_BRUSH_FRGD_CLR 0x147c
-#define R128_REG_DP_WRITE_MASK 0x16cc
-#define R128_REG_DP_CNTL 0x16c0
-#define R128_REG_DST_WIDTH_HEIGHT 0x1598
-#define R128_REG_DST_Y_X 0x1438
-#define R128_REG_PC_NGUI_CTLSTAT 0x0184
-#define R128_REG_DST_HEIGHT_WIDTH 0x143c
-#define R128_REG_SRC_Y_X 0x1434
-#define R128_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
-#define R128_AUX_SC_CNTL 0x1660
-#define R128_SC_TOP_LEFT 0x16ec
-#define R128_SC_BOTTOM_RIGHT 0x16f0
-
-#define R128_GMC_DST_DATATYPE_SHIFT 8
-#define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28)
-#define R128_GMC_AUX_CLIP_DIS (1 << 29)
-#define R128_GMC_BRUSH_SOLID_COLOR (13 << 4)
-#define R128_GMC_SRC_DATATYPE_COLOR (3 << 12)
-#define R128_GMC_ROP3_SHIFT 16
-#define R128_DST_X_LEFT_TO_RIGHT (1 << 0)
-#define R128_DST_Y_TOP_TO_BOTTOM (1 << 1)
-#define R128_GUI_ACTIVE (1 << 31)
-#define R128_PC_BUSY (1 << 31)
-#define R128_DP_SRC_SOURCE_MEMORY (2 << 24)
-#define R128_DEFAULT_SC_RIGHT_MAX (0x1fff << 0)
-#define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _r128CardInfo {
- VesaCardPrivRec vesa;
- CARD8 *reg_base;
- int fifo_size;
-} R128CardInfo;
-
-#define getR128CardInfo(kd) ((R128CardInfo *) ((kd)->card->driver))
-#define r128CardInfo(kd) R128CardInfo *r128c = getR128CardInfo(kd)
-
-typedef struct _r128ScreenInfo {
- VesaScreenPrivRec vesa;
- CARD8 *screen;
- CARD8 *off_screen;
- int off_screen_size;
-
- int pitch;
- int datatype;
-
- int dp_gui_master_cntl;
-} R128ScreenInfo;
-
-#define getR128ScreenInfo(kd) ((R128ScreenInfo *) ((kd)->screen->driver))
-#define r128ScreenInfo(kd) R128ScreenInfo *r128s = getR128ScreenInfo(kd)
-
-Bool
-r128MapReg (KdCardInfo *card, R128CardInfo *r128c);
-
-void
-r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c);
-
-void
-r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c);
-
-void
-r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c);
-
-Bool
-r128DrawSetup (ScreenPtr pScreen);
-
-Bool
-r128DrawInit (ScreenPtr pScreen);
-
-void
-r128DrawEnable (ScreenPtr pScreen);
-
-void
-r128DrawSync (ScreenPtr pScreen);
-
-void
-r128DrawDisable (ScreenPtr pScreen);
-
-void
-r128DrawFini (ScreenPtr pScreen);
-
-extern KdCardFuncs r128Funcs;
-
-#endif /* _R128_H_ */
diff --git a/hw/kdrive/r128/r128draw.c b/hw/kdrive/r128/r128draw.c
deleted file mode 100644
index be4dc79ae..000000000
--- a/hw/kdrive/r128/r128draw.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "r128.h"
-
-CARD8 r128SolidRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0xa0, /* src AND dst */
- /* GXandReverse */ 0x50, /* src AND NOT dst */
- /* GXcopy */ 0xf0, /* src */
- /* GXandInverted*/ 0x0a, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x5a, /* src XOR dst */
- /* GXor */ 0xfa, /* src OR dst */
- /* GXnor */ 0x05, /* NOT src AND NOT dst */
- /* GXequiv */ 0xa5, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xf5, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x0f, /* NOT src */
- /* GXorInverted */ 0xaf, /* NOT src OR dst */
- /* GXnand */ 0x5f, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-CARD8 r128BltRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0x88, /* src AND dst */
- /* GXandReverse */ 0x44, /* src AND NOT dst */
- /* GXcopy */ 0xcc, /* src */
- /* GXandInverted*/ 0x22, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x66, /* src XOR dst */
- /* GXor */ 0xee, /* src OR dst */
- /* GXnor */ 0x11, /* NOT src AND NOT dst */
- /* GXequiv */ 0x99, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xdd, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x33, /* NOT src */
- /* GXorInverted */ 0xbb, /* NOT src OR dst */
- /* GXnand */ 0x77, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-int copydx, copydy;
-int fifo_size;
-char *mmio;
-
-static void
-r128WaitAvail (int n)
-{
- if (fifo_size < n)
- {
- while ((fifo_size = R128_IN32 (mmio, R128_REG_GUI_STAT) & 0xfff) < n)
- ;
- }
-
- fifo_size -= n;
-}
-
-static void
-r128WaitIdle (void)
-{
- int tries;
-
- r128WaitAvail (64);
-
- tries = 1000000;
- while (tries--)
- {
- if ((R128_IN32 (mmio, R128_REG_GUI_STAT) & R128_GUI_ACTIVE) == 0)
- break;
- }
-
- R128_OUT32 (mmio, R128_REG_PC_NGUI_CTLSTAT,
- R128_IN32 (mmio, R128_REG_PC_NGUI_CTLSTAT | 0xff));
-
- tries = 1000000;
- while (tries--)
- {
- if ((R128_IN32 (mmio, R128_REG_PC_NGUI_CTLSTAT) & R128_PC_BUSY) != R128_PC_BUSY)
- break;
- }
-
-}
-
-static Bool
-r128Setup (ScreenPtr pScreen, int wait)
-{
- KdScreenPriv (pScreen);
- r128ScreenInfo (pScreenPriv);
- r128CardInfo (pScreenPriv);
-
- fifo_size = 0;
-
- mmio = r128c->reg_base;
-
- if (!mmio)
- return FALSE;
-
- r128WaitAvail (2);
- R128_OUT32 (mmio, R128_REG_DEFAULT_OFFSET, 0);
- R128_OUT32 (mmio, R128_REG_DEFAULT_PITCH, r128s->pitch);
-
- r128WaitAvail (4);
- R128_OUT32 (mmio, R128_AUX_SC_CNTL, 0);
- R128_OUT32 (mmio, R128_DEFAULT_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX
- | R128_DEFAULT_SC_BOTTOM_MAX));
- R128_OUT32 (mmio, R128_SC_TOP_LEFT, 0);
- R128_OUT32 (mmio, R128_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX
- | R128_DEFAULT_SC_BOTTOM_MAX));
- r128WaitAvail (wait);
- return TRUE;
-}
-
-static Bool
-r128PrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
-{
- KdScreenPriv (pPixmap->drawable.pScreen);
- r128ScreenInfo (pScreenPriv);
-
- r128Setup (pPixmap->drawable.pScreen, 4);
- R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl
- | R128_GMC_BRUSH_SOLID_COLOR
- | R128_GMC_SRC_DATATYPE_COLOR
- | (r128SolidRop[alu] << R128_GMC_ROP3_SHIFT));
- R128_OUT32 (mmio, R128_REG_DP_BRUSH_FRGD_CLR, fg);
- R128_OUT32 (mmio, R128_REG_DP_WRITE_MASK, pm);
- R128_OUT32 (mmio, R128_REG_DP_CNTL,
- (R128_DST_X_LEFT_TO_RIGHT | R128_DST_Y_TOP_TO_BOTTOM));
-
- return TRUE;
-}
-
-static void
-r128Solid (int x1, int y1, int x2, int y2)
-{
- r128WaitAvail (2);
- R128_OUT32 (mmio, R128_REG_DST_Y_X, (y1 << 16) | x1);
- R128_OUT32 (mmio, R128_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1));
-
-}
-
-static void
-r128DoneSolid (void)
-{
-}
-
-static Bool
-r128PrepareCopy (PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
-{
- KdScreenPriv (pSrc->drawable.pScreen);
- r128ScreenInfo (pScreenPriv);
-
- copydx = dx;
- copydy = dy;
-
- r128Setup (pSrc->drawable.pScreen, 3);
- R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl
- | R128_GMC_BRUSH_SOLID_COLOR
- | R128_GMC_SRC_DATATYPE_COLOR
- | (r128BltRop[alu] << R128_GMC_ROP3_SHIFT)
- | R128_DP_SRC_SOURCE_MEMORY);
- R128_OUT32 (mmio, R128_REG_DP_WRITE_MASK, pm);
- R128_OUT32 (mmio, R128_REG_DP_CNTL,
- ((dx >= 0 ? R128_DST_X_LEFT_TO_RIGHT : 0)
- | (dy >= 0 ? R128_DST_Y_TOP_TO_BOTTOM : 0)));
-
-
- return TRUE;
-}
-
-static void
-r128Copy (int srcX, int srcY, int dstX, int dstY, int w, int h)
-{
- if (copydx < 0)
- {
- srcX += w - 1;
- dstX += w - 1;
- }
-
- if (copydy < 0)
- {
- srcY += h - 1;
- dstY += h - 1;
- }
-
- r128WaitAvail (3);
- R128_OUT32 (mmio, R128_REG_SRC_Y_X, (srcY << 16) | srcX);
- R128_OUT32 (mmio, R128_REG_DST_Y_X, (dstY << 16) | dstX);
- R128_OUT32 (mmio, R128_REG_DST_HEIGHT_WIDTH, (h << 16) | w);
-}
-
-static void
-r128DoneCopy (void)
-{
-}
-
-KaaScreenInfoRec r128Kaa = {
- r128PrepareSolid,
- r128Solid,
- r128DoneSolid,
-
- r128PrepareCopy,
- r128Copy,
- r128DoneCopy,
-};
-
-Bool
-r128DrawInit (ScreenPtr pScreen)
-{
- if (!kaaDrawInit (pScreen, &r128Kaa))
- return FALSE;
-
- return TRUE;
-}
-
-void
-r128DrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- r128ScreenInfo (pScreenPriv);
-
- r128s->pitch = pScreenPriv->screen->width >> 3;
-
- switch (pScreenPriv->screen->fb[0].depth) {
- case 8:
- r128s->datatype = 2;
- break;
- case 15:
- r128s->datatype = 3;
- break;
- case 16:
- r128s->datatype = 4;
- break;
- case 24:
- r128s->datatype = 5;
- break;
- case 32:
- r128s->datatype = 6;
- break;
- default:
- FatalError ("unsupported pixel format");
- }
-
- r128s->dp_gui_master_cntl = ((r128s->datatype << R128_GMC_DST_DATATYPE_SHIFT)
- | R128_GMC_CLR_CMP_CNTL_DIS
- | R128_GMC_AUX_CLIP_DIS);
-
- KdMarkSync (pScreen);
-}
-
-void
-r128DrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-r128DrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-r128DrawSync (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- r128CardInfo (pScreenPriv);
-
- mmio = r128c->reg_base;
-
- r128WaitIdle ();
-}
diff --git a/hw/kdrive/r128/r128stub.c b/hw/kdrive/r128/r128stub.c
deleted file mode 100644
index 30dc32c66..000000000
--- a/hw/kdrive/r128/r128stub.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "r128.h"
-#include "klinux.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x1002, 0x4c46, 0, &attr))
- KdCardInfoAdd (&r128Funcs, &attr, 0);
- else if (LinuxFindPci (0x1002, 0x5046, 0, &attr))
- KdCardInfoAdd (&r128Funcs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/savage/Imakefile b/hw/kdrive/savage/Imakefile
deleted file mode 100644
index 4d7577900..000000000
--- a/hw/kdrive/savage/Imakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/nvfb/Imakefile,v 3.8 1996/12/23 06:30:19 dawes Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = s3.c s3clock.c s3cmap.c s3curs.c s3draw.c s3gc.c s3reg.c s3stub.c
-
-OBJS = s3.o s3clock.o s3cmap.o s3curs.o s3draw.o s3gc.o s3reg.o s3stub.o
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(savage,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/savage/s3.c b/hw/kdrive/savage/s3.c
deleted file mode 100644
index 06f23abaf..000000000
--- a/hw/kdrive/savage/s3.c
+++ /dev/null
@@ -1,1838 +0,0 @@
-/*
- * Id: s3.c,v 1.3 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3.c,v 1.4 2000/05/06 22:17:44 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-#define REGISTERS_OFFSET (0x1000000)
-#define PACKED_OFFSET (0x8100)
-#define IOMAP_OFFSET (0x8000)
-
-#define S3_MIN_CLOCK 250000
-
-static void
-_s3SetBlank (S3Ptr s3, S3Vga *s3vga, Bool blank)
-{
- CARD8 clock_mode;
-
- s3SetImm(s3vga, s3_screen_off, blank ? 1 : 0);
-}
-
-Bool
-s3CardInit (KdCardInfo *card)
-{
- S3CardInfo *s3c;
- S3Ptr s3;
- S3Vga *s3vga;
- int size;
- CARD8 *registers;
- CARD32 s3FrameBuffer;
- CARD32 s3Registers;
- CARD8 *temp_buffer;
- CARD32 max_memory;
- VGA32 save_linear_window_size;
- VGA32 save_enable_linear;
- VGA32 save_register_lock_2;
- VGA32 save_misc_output;
-
- s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo));
- if (!s3c)
- {
- goto bail0;
- }
-
- memset (s3c, '\0', sizeof (S3CardInfo));
-
- card->driver = s3c;
-
-#ifdef VXWORKS
- s3c->bios_initialized = 0;
-#else
- s3c->bios_initialized = 1;
-#endif
-
- if (card->attr.naddr > 1 && card->attr.address[1])
- {
- s3FrameBuffer = card->attr.address[1];
- s3Registers = card->attr.address[0];
- max_memory = 32 * 1024 * 1024;
- }
- else
- {
- s3FrameBuffer = card->attr.address[0];
- s3Registers = s3FrameBuffer + REGISTERS_OFFSET;
- max_memory = 16 * 1024 * 1024;
- }
-
-#ifdef DEBUG
- fprintf (stderr, "S3 at 0x%x/0x%x\n", s3Registers, s3FrameBuffer);
-#endif
- registers = KdMapDevice (s3Registers,
- sizeof (S3) + PACKED_OFFSET);
- if (!registers)
- {
- ErrorF ("Can't map s3 device\n");
- goto bail2;
- }
- s3 = (S3Ptr) (registers + PACKED_OFFSET);
- s3c->registers = registers;
- s3c->s3 = s3;
-
- s3vga = &s3c->s3vga;
- s3RegInit (s3vga, (VGAVOL8 *) (registers + IOMAP_OFFSET));
-
- if (!s3c->bios_initialized)
- {
- volatile CARD32 *wakeup;
-
- wakeup = (volatile CARD32 *) (registers + 0x8510);
- ErrorF ("Wakeup S3 chip at 0x%x\n", wakeup);
- ErrorF ("Wakeup was 0x%x\n", *wakeup);
- /* wakeup the chip */
- *(volatile CARD32 *) (registers + 0x8510) = 1;
- ErrorF ("Wakeup is 0x%x\n", *wakeup);
- }
- s3Set (s3vga, s3_io_addr_select, 1);
- s3Set (s3vga, s3_enable_ram, 1);
- VgaFlush (&s3vga->card);
-
- save_register_lock_2 = s3Get (s3vga, s3_register_lock_2);
- s3SetImm (s3vga, s3_register_lock_2, 0xa0);
- save_linear_window_size = s3Get (s3vga, s3_linear_window_size);
- save_enable_linear = s3Get (s3vga, s3_enable_linear);
- s3Set (s3vga, s3_linear_window_size, 3);
- s3Set (s3vga, s3_enable_linear, 1);
- VgaFlush (&s3vga->card);
- VgaFinish (&s3vga->card);
-
- /*
- * Can't trust S3 register value for frame buffer amount, must compute
- */
- temp_buffer = KdMapDevice (s3FrameBuffer, max_memory);
-
- s3c->memory = KdFrameBufferSize (temp_buffer, max_memory);
-
- s3Set (s3vga, s3_linear_window_size, save_linear_window_size);
- s3Set (s3vga, s3_enable_linear, save_enable_linear);
- VgaFlush (&s3vga->card);
- s3SetImm (s3vga, s3_register_lock_2, save_register_lock_2);
- VgaFinish (&s3vga->card);
-#ifdef DEBUG
- fprintf (stderr, "Frame buffer 0x%x\n", s3c->memory);
-#endif
- KdUnmapDevice (temp_buffer, max_memory);
-
- if (!s3c->memory)
- {
- ErrorF ("Can't detect s3 frame buffer at 0x%x\n", s3FrameBuffer);
- goto bail3;
- }
-
- s3c->frameBuffer = KdMapDevice (s3FrameBuffer, s3c->memory);
- if (!s3c->frameBuffer)
- {
- ErrorF ("Can't map s3 frame buffer\n");
- goto bail3;
- }
-
- card->driver = s3c;
-
- return TRUE;
-bail3:
- KdUnmapDevice ((void *) s3, sizeof (S3));
-bail2:
-bail1:
- xfree (s3c);
-bail0:
- return FALSE;
-}
-
-Bool
-s3ModeSupported (KdScreenInfo *screen,
- const KdMonitorTiming *t)
-{
- if (screen->fb[1].depth)
- {
- /*
- * Must have at least one true color stream
- */
- if (screen->fb[0].depth <= 8 &&
- screen->fb[1].depth <= 8)
- return FALSE;
- }
- /* make sure the clock isn't too fast */
- if (t->clock > S3_MAX_CLOCK * 2)
- return FALSE;
- /* width must be a multiple of 16 */
- if (t->horizontal & 0xf)
- return FALSE;
- return TRUE;
-}
-
-Bool
-s3ModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
- int screen_size;
- int pixel_width;
- int byte_width;
- int fb;
-
- screen_size = 0;
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (screen->fb[fb].depth >= 24)
- {
- screen->fb[fb].depth = 24;
- if (screen->fb[fb].bitsPerPixel != 24)
- screen->fb[fb].bitsPerPixel = 32;
- }
- else if (screen->fb[fb].depth >= 16)
- {
- screen->fb[fb].depth = 16;
- screen->fb[fb].bitsPerPixel = 16;
- }
- else if (screen->fb[fb].depth >= 15)
- {
- screen->fb[fb].depth = 15;
- screen->fb[fb].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[fb].depth = 8;
- screen->fb[fb].bitsPerPixel = 8;
- }
-
- /*
- * SGRAM requires stride % 64 == 0
- */
- screen->fb[fb].pixelStride = (screen->width + 63) & ~63;
- screen->fb[fb].byteStride = screen->fb[fb].pixelStride * (screen->fb[fb].bitsPerPixel >> 3);
- screen_size += screen->fb[fb].byteStride * screen->height;
- }
-
- return screen_size <= s3c->memory;
-}
-
-Bool
-s3ScreenInit (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
- S3ScreenInfo *s3s;
- int memory;
- int requested_memory;
- int v_total, h_total;
- int m, n, r;
- int i;
- const KdMonitorTiming *t;
- int screen_size;
- int fb;
- int ma;
-
- s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo));
- if (!s3s)
- return FALSE;
-
- memset (s3s, '\0', sizeof (S3ScreenInfo));
-
-#ifdef PHOENIX
- screen->width = 1152;
- screen->height = 900;
- screen->rate = 85;
- screen->depth = 32;
-#endif
- if (!screen->width || !screen->height)
- {
- screen->width = 800;
- screen->height = 600;
- screen->rate = 72;
- }
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 8;
-
- t = KdFindMode (screen, s3ModeSupported);
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
- s3GetClock (t->clock, &m, &n, &r, 511, 127, 4, 250000);
-#ifdef DEBUG
- fprintf (stderr, "computed %d,%d,%d (%d)\n",
- m, n, r, S3_CLOCK(m,n,r));
-#endif
-#if 0
- /*
- * Can only operate in pixel-doubled mode at 8 or 16 bits per pixel
- */
- if (screen->depth > 16 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK)
- screen->depth = 16;
-#endif
-
- if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported))
- {
- xfree (s3s);
- return FALSE;
- }
-
- s3s->fbmap[2] = -1;
- if (screen->fb[1].depth)
- {
- if (screen->fb[0].bitsPerPixel >= 16)
- {
- s3s->fbmap[0] = 1;
- s3s->fbmap[1] = 0;
- }
- else
- {
- s3s->fbmap[0] = 0;
- s3s->fbmap[1] = 1;
- }
- }
- else
- {
- s3s->fbmap[0] = 0;
- s3s->fbmap[1] = -1;
- }
-
- screen_size = 0;
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- screen_size += screen->fb[fb].byteStride * screen->height;
-
- memory = s3c->memory - screen_size;
-
- /*
- * Stick cursor at end of memory
- */
- if (memory >= 2048)
- {
- s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048);
- memory -= 2048;
- }
- else
- s3s->cursor_base = 0;
-
- screen_size = 0;
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
- {
- fb = s3s->fbmap[ma];
- screen->fb[fb].frameBuffer = s3c->frameBuffer + screen_size;
- screen_size += screen->fb[fb].byteStride * screen->height;
-
- REGION_INIT(pScreen, (&s3s->region[fb]), NullBox, 0);
- if (screen->fb[fb].bitsPerPixel == 8)
- s3s->fb[ma].chroma_key = 0xff;
- else
- s3s->fb[ma].chroma_key = 0;
-
- /*
- * Use remaining memory for off-screen storage, but only use
- * one piece (either right or bottom).
- */
- if (memory >= screen->fb[fb].byteStride * S3_TILE_SIZE)
- {
- s3s->fb[ma].offscreen = screen->fb[fb].frameBuffer;
- s3s->fb[ma].offscreen_x = 0;
- s3s->fb[ma].offscreen_y = screen->height;
- s3s->fb[ma].offscreen_width = screen->fb[fb].pixelStride;
- s3s->fb[ma].offscreen_height = S3_TILE_SIZE;
- memory -= s3s->fb[ma].offscreen_height * screen->fb[fb].byteStride;
- screen_size += s3s->fb[ma].offscreen_height * screen->fb[fb].byteStride;
- }
- else
- s3s->fb[ma].offscreen = 0;
-
- switch (screen->fb[fb].depth) {
- case 8:
- screen->fb[fb].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[fb].blueMask = 0x00;
- screen->fb[fb].greenMask = 0x00;
- screen->fb[fb].redMask = 0x00;
- break;
- case 15:
- screen->fb[fb].visuals = (1 << TrueColor);
- screen->fb[fb].blueMask = 0x001f;
- screen->fb[fb].greenMask = 0x03e0;
- screen->fb[fb].redMask = 0x7c00;
- break;
- case 16:
- screen->fb[fb].visuals = (1 << TrueColor);
- screen->fb[fb].blueMask = 0x001f;
- screen->fb[fb].greenMask = 0x07e0;
- screen->fb[fb].redMask = 0xf800;
- break;
- case 24:
- screen->fb[fb].visuals = (1 << TrueColor);
- screen->fb[fb].blueMask = 0x0000ff;
- screen->fb[fb].greenMask = 0x00ff00;
- screen->fb[fb].redMask = 0xff0000;
- break;
- }
- }
-
- screen->driver = s3s;
-
- return TRUE;
-}
-
-typedef struct _biosInit {
- VGA16 reg;
- VGA8 value;
-} s3BiosInit;
-
-s3BiosInit s3BiosReg[] = {
- S3_SR +0x15, 0x23,
- S3_MISC_OUT, 0x2f,
- 0xffff, 1,
- S3_SR +0x15, 0x03,
-
- S3_SR + 0x0, 0x03,
- S3_SR + 0x1, 0x00,
- S3_SR + 0x2, 0x03,
- S3_SR + 0x3, 0x00,
- S3_SR + 0x4, 0x02,
- S3_SR + 0x5, 0x05,
- S3_SR + 0x6, 0x06,
- S3_SR + 0x7, 0x07,
-/* S3_SR + 0x8, 0x06, */
- S3_SR + 0x9, 0x00,
- S3_SR + 0xa, 0x0a,
- S3_SR + 0xb, 0x00,
- S3_SR + 0xc, 0x0c,
- S3_SR + 0xd, 0x00,
- S3_SR + 0xe, 0x0e,
- S3_SR + 0xf, 0x0f,
-
-/* S3_SR +0x10, 0x00, */
-/* S3_SR +0x11, 0x0c, */
- S3_SR +0x12, 0x01,
- S3_SR +0x13, 0x52,
- S3_SR +0x14, 0x00,
-
-/* S3_SR +0x15, 0x03, */
-
- S3_SR +0x16, 0xc5,
- S3_SR +0x17, 0xfc,
- S3_SR +0x18, 0x40,
- S3_SR +0x19, 0x00,
- S3_SR +0x1a, 0x01,
- S3_SR +0x1b, 0x02,
- S3_SR +0x1c, 0x5d,
- S3_SR +0x1d, 0x00,
- S3_SR +0x1e, 0x00,
- S3_SR +0x1f, 0x00,
- S3_SR +0x20, 0x20,
- S3_SR +0x21, 0x21,
- S3_SR +0x22, 0x22,
- S3_SR +0x23, 0x23,
- S3_SR +0x24, 0x24,
- S3_SR +0x25, 0x25,
- S3_SR +0x26, 0x26,
- S3_SR +0x27, 0x04,
- S3_SR +0x28, 0xff,
- S3_SR +0x29, 0x00,
- S3_SR +0x2a, 0x2a,
- S3_SR +0x2b, 0x2b,
- S3_SR +0x2c, 0x2c,
- S3_SR +0x2d, 0x2d,
- S3_SR +0x2e, 0x2e,
- S3_SR +0x2f, 0x2f,
- S3_SR +0x30, 0x00,
- S3_SR +0x31, 0x06,
- S3_SR +0x32, 0x41,
- S3_SR +0x33, 0x67,
- S3_SR +0x34, 0x00,
- S3_SR +0x35, 0x00,
- S3_SR +0x36, 0x01,
- S3_SR +0x37, 0x52,
- S3_SR +0x38, 0x5d,
- S3_SR +0x39, 0x05,
- S3_SR +0x3a, 0x3a,
- S3_SR +0x3b, 0x3b,
- S3_SR +0x3c, 0x3c,
- S3_SR +0x3d, 0x00,
- S3_SR +0x3e, 0x3e,
- S3_SR +0x3f, 0x00,
- S3_SR +0x40, 0x40,
- S3_SR +0x41, 0x41,
- S3_SR +0x42, 0x42,
- S3_SR +0x43, 0x43,
- S3_SR +0x44, 0x44,
- S3_SR +0x45, 0x45,
- S3_SR +0x46, 0x46,
- S3_SR +0x47, 0x47,
- S3_SR +0x48, 0x48,
- S3_SR +0x49, 0x49,
- S3_SR +0x4a, 0x4a,
- S3_SR +0x4b, 0x4b,
- S3_SR +0x4c, 0x4c,
- S3_SR +0x4d, 0x4d,
- S3_SR +0x4e, 0x4e,
- S3_SR +0x4f, 0x4f,
- S3_SR +0x50, 0x00,
- S3_SR +0x51, 0x00,
- S3_SR +0x52, 0x00,
- S3_SR +0x53, 0x00,
- S3_SR +0x54, 0x00,
- S3_SR +0x55, 0x00,
- S3_SR +0x56, 0x00,
- S3_SR +0x57, 0x00,
- S3_SR +0x58, 0x00,
- S3_SR +0x59, 0x70,
- S3_SR +0x5a, 0x38,
- S3_SR +0x5b, 0x08,
- S3_SR +0x5c, 0x77,
- S3_SR +0x5d, 0x77,
- S3_SR +0x5e, 0x00,
- S3_SR +0x5f, 0x00,
- S3_SR +0x60, 0xff,
- S3_SR +0x61, 0xbf,
- S3_SR +0x62, 0xff,
- S3_SR +0x63, 0xff,
- S3_SR +0x64, 0xf7,
- S3_SR +0x65, 0xff,
- S3_SR +0x66, 0xff,
- S3_SR +0x67, 0xff,
- S3_SR +0x68, 0xff,
- S3_SR +0x69, 0xff,
- S3_SR +0x6a, 0xff,
- S3_SR +0x6b, 0xff,
- S3_SR +0x6c, 0xff,
- S3_SR +0x6d, 0xff,
- S3_SR +0x6e, 0x9b,
- S3_SR +0x6f, 0xbf,
-
- S3_AR + 0x00, 0x00,
- S3_AR + 0x01, 0x01,
- S3_AR + 0x02, 0x02,
- S3_AR + 0x03, 0x03,
- S3_AR + 0x04, 0x04,
- S3_AR + 0x05, 0x05,
- S3_AR + 0x06, 0x06,
- S3_AR + 0x07, 0x07,
- S3_AR + 0x08, 0x08,
- S3_AR + 0x09, 0x09,
- S3_AR + 0x0a, 0x0a,
- S3_AR + 0x0b, 0x0b,
- S3_AR + 0x0c, 0x0c,
- S3_AR + 0x0d, 0x0d,
- S3_AR + 0x0e, 0x0e,
- S3_AR + 0x0f, 0x0f,
- S3_AR + 0x10, 0x05,
- S3_AR + 0x11, 0x00,
- S3_AR + 0x12, 0x0f,
- S3_AR + 0x13, 0x08,
- S3_AR + 0x14, 0x00,
-
- S3_GR + 0x00, 0x00,
- S3_GR + 0x01, 0x00,
- S3_GR + 0x02, 0x00,
- S3_GR + 0x03, 0x00,
- S3_GR + 0x04, 0x00,
- S3_GR + 0x05, 0x10,
- S3_GR + 0x06, 0x0e,
- S3_GR + 0x07, 0x00,
-
- S3_CR + 0x00, 0x5f,
- S3_CR + 0x01, 0x4f,
- S3_CR + 0x02, 0x50,
- S3_CR + 0x03, 0x82,
- S3_CR + 0x04, 0x55,
- S3_CR + 0x05, 0x81,
- S3_CR + 0x06, 0xbf,
- S3_CR + 0x07, 0x1f,
- S3_CR + 0x08, 0x00,
- S3_CR + 0x09, 0x4f,
- S3_CR + 0x0a, 0x0d,
- S3_CR + 0x0b, 0x0e,
- S3_CR + 0x0c, 0x00,
- S3_CR + 0x0d, 0x00,
- S3_CR + 0x0e, 0x3f,
- S3_CR + 0x0f, 0xff,
- S3_CR + 0x10, 0x9c,
- S3_CR + 0x11, 0x0e,
- S3_CR + 0x12, 0x8f,
- S3_CR + 0x13, 0x28,
- S3_CR + 0x14, 0x1f,
- S3_CR + 0x15, 0x96,
- S3_CR + 0x16, 0xb9,
- S3_CR + 0x17, 0xa3,
- S3_CR + 0x18, 0xff,
- S3_CR + 0x19, 0xdf,
- S3_CR + 0x1a, 0xdf,
- S3_CR + 0x1b, 0xdf,
- S3_CR + 0x1c, 0xdf,
- S3_CR + 0x1d, 0xdf,
- S3_CR + 0x1e, 0xdf,
- S3_CR + 0x1f, 0xdf,
- S3_CR + 0x20, 0xdf,
- S3_CR + 0x21, 0x00,
-/* S3_CR + 0x22, 0x07, */
- S3_CR + 0x23, 0x00,
- S3_CR + 0x24, 0xdf,
- S3_CR + 0x25, 0xdf,
- S3_CR + 0x26, 0x00,
- S3_CR + 0x27, 0xdf,
- S3_CR + 0x28, 0xdf,
- S3_CR + 0x29, 0xdf,
- S3_CR + 0x2a, 0xdf,
- S3_CR + 0x2b, 0xdf,
- S3_CR + 0x2c, 0xdf,
- S3_CR + 0x2d, 0x8a,
- S3_CR + 0x2e, 0x22,
- S3_CR + 0x2f, 0x02,
- S3_CR + 0x30, 0xe1,
- S3_CR + 0x31, 0x05,
- S3_CR + 0x32, 0x40,
- S3_CR + 0x33, 0x08,
- S3_CR + 0x34, 0x00,
- S3_CR + 0x35, 0x00,
- S3_CR + 0x36, 0xbf,
- S3_CR + 0x37, 0x9b,
-/* S3_CR + 0x38, 0x7b, */
-/* S3_CR + 0x39, 0xb8, */
- S3_CR + 0x3a, 0x45,
- S3_CR + 0x3b, 0x5a,
- S3_CR + 0x3c, 0x10,
- S3_CR + 0x3d, 0x00,
- S3_CR + 0x3e, 0xfd,
- S3_CR + 0x3f, 0x00,
- S3_CR + 0x40, 0x00,
- S3_CR + 0x41, 0x92,
- S3_CR + 0x42, 0xc0,
- S3_CR + 0x43, 0x68,
- S3_CR + 0x44, 0xff,
- S3_CR + 0x45, 0xe8,
- S3_CR + 0x46, 0xff,
- S3_CR + 0x47, 0xff,
- S3_CR + 0x48, 0xf8,
- S3_CR + 0x49, 0xff,
- S3_CR + 0x4a, 0xfe,
- S3_CR + 0x4b, 0xff,
- S3_CR + 0x4c, 0xff,
- S3_CR + 0x4d, 0xff,
- S3_CR + 0x4e, 0xff,
- S3_CR + 0x4f, 0xff,
- S3_CR + 0x50, 0x00,
- S3_CR + 0x51, 0x00,
- S3_CR + 0x52, 0x00,
- S3_CR + 0x53, 0x00,
- S3_CR + 0x54, 0x00,
- S3_CR + 0x55, 0x00,
- S3_CR + 0x56, 0x00,
- S3_CR + 0x57, 0x00,
-#if 0
- S3_CR + 0x58, 0x00,
- S3_CR + 0x59, 0xf0,
-#endif
- S3_CR + 0x5a, 0x00,
- S3_CR + 0x5b, 0x00,
-#if 0
- S3_CR + 0x5c, 0x00,
-#endif
- S3_CR + 0x5d, 0x00,
- S3_CR + 0x5e, 0x00,
- S3_CR + 0x5f, 0x00,
- S3_CR + 0x60, 0x09,
- S3_CR + 0x61, 0x9d,
- S3_CR + 0x62, 0xff,
- S3_CR + 0x63, 0x00,
- S3_CR + 0x64, 0xfd,
- S3_CR + 0x65, 0x04,
- S3_CR + 0x66, 0x88,
- S3_CR + 0x67, 0x00,
- S3_CR + 0x68, 0x7f,
- S3_CR + 0x69, 0x00,
- S3_CR + 0x6a, 0x00,
- S3_CR + 0x6b, 0x00,
- S3_CR + 0x6c, 0x00,
- S3_CR + 0x6d, 0x11,
- S3_CR + 0x6e, 0xff,
- S3_CR + 0x6f, 0xfe,
-
- S3_CR + 0x70, 0x30,
- S3_CR + 0x71, 0xc0,
- S3_CR + 0x72, 0x07,
- S3_CR + 0x73, 0x1f,
- S3_CR + 0x74, 0x1f,
- S3_CR + 0x75, 0x1f,
- S3_CR + 0x76, 0x0f,
- S3_CR + 0x77, 0x1f,
- S3_CR + 0x78, 0x01,
- S3_CR + 0x79, 0x01,
- S3_CR + 0x7a, 0x1f,
- S3_CR + 0x7b, 0x1f,
- S3_CR + 0x7c, 0x17,
- S3_CR + 0x7d, 0x17,
- S3_CR + 0x7e, 0x17,
- S3_CR + 0x7f, 0xfd,
- S3_CR + 0x80, 0x00,
- S3_CR + 0x81, 0x92,
- S3_CR + 0x82, 0x10,
- S3_CR + 0x83, 0x07,
- S3_CR + 0x84, 0x42,
- S3_CR + 0x85, 0x00,
- S3_CR + 0x86, 0x00,
- S3_CR + 0x87, 0x00,
- S3_CR + 0x88, 0x10,
- S3_CR + 0x89, 0xfd,
- S3_CR + 0x8a, 0xfd,
- S3_CR + 0x8b, 0xfd,
- S3_CR + 0x8c, 0xfd,
- S3_CR + 0x8d, 0xfd,
- S3_CR + 0x8e, 0xfd,
- S3_CR + 0x8f, 0xfd,
- S3_CR + 0x90, 0x00,
- S3_CR + 0x91, 0x4f,
- S3_CR + 0x92, 0x10,
- S3_CR + 0x93, 0x00,
- S3_CR + 0x94, 0xfd,
- S3_CR + 0x95, 0xfd,
- S3_CR + 0x96, 0xfd,
- S3_CR + 0x97, 0xfd,
- S3_CR + 0x98, 0xfd,
- S3_CR + 0x99, 0xff,
- S3_CR + 0x9a, 0xfd,
- S3_CR + 0x9b, 0xff,
- S3_CR + 0x9c, 0xfd,
- S3_CR + 0x9d, 0xfd,
- S3_CR + 0x9e, 0xfd,
- S3_CR + 0x9f, 0xff,
- S3_CR + 0xa0, 0x0f,
-#if 0
- S3_CR + 0xa1, 0x00,
- S3_CR + 0xa2, 0x00,
- S3_CR + 0xa3, 0x00,
- S3_CR + 0xa4, 0x55,
-#endif
- S3_CR + 0xa5, 0x09,
- S3_CR + 0xa6, 0x20,
-#if 0
- S3_CR + 0xa7, 0x00,
- S3_CR + 0xa8, 0x00,
- S3_CR + 0xa9, 0x00,
- S3_CR + 0xaa, 0x00,
- S3_CR + 0xab, 0x00,
- S3_CR + 0xac, 0x00,
- S3_CR + 0xad, 0x00,
- S3_CR + 0xae, 0x00,
- S3_CR + 0xaf, 0x00,
- S3_CR + 0xb0, 0xff,
-#endif
- S3_CR + 0xb1, 0x0e,
-#if 0
- S3_CR + 0xb2, 0x55,
- S3_CR + 0xb3, 0x00,
- S3_CR + 0xb4, 0x55,
- S3_CR + 0xb5, 0x00,
- S3_CR + 0xb6, 0x00,
-#endif
- S3_CR + 0xb7, 0x84,
-#if 0
- S3_CR + 0xb8, 0xff,
- S3_CR + 0xb9, 0xff,
- S3_CR + 0xba, 0xff,
- S3_CR + 0xbb, 0xff,
- S3_CR + 0xbc, 0xff,
- S3_CR + 0xbd, 0xff,
- S3_CR + 0xbe, 0xff,
- S3_CR + 0xbf, 0xff,
-#endif
-
- S3_SR +0x15, 0x23,
- 0xffff, 1,
- S3_SR +0x15, 0x03,
- 0xffff, 1,
-};
-
-#define S3_NUM_BIOS_REG (sizeof (s3BiosReg) / sizeof (s3BiosReg[0]))
-
-typedef struct _bios32Init {
- VGA16 offset;
- VGA32 value;
-} s3Bios32Init;
-
-s3Bios32Init s3Bios32Reg[] = {
- 0x8168, 0x00000000,
- 0x816c, 0x00000001,
- 0x8170, 0x00000000,
- 0x8174, 0x00000000,
- 0x8178, 0x00000000,
- 0x817c, 0x00000000,
-#if 0
- 0x8180, 0x00140000,
- 0x8184, 0x00000000,
- 0x8188, 0x00000000,
- 0x8190, 0x00000000,
- 0x8194, 0x00000000,
- 0x8198, 0x00000000,
- 0x819c, 0x00000000,
- 0x81a0, 0x00000000,
-#endif
- 0x81c0, 0x00000000,
- 0x81c4, 0x01fbffff,
- 0x81c8, 0x00f7ffbf,
- 0x81cc, 0x00f7ff00,
- 0x81d0, 0x11ffff7f,
- 0x81d4, 0x7fffffdf,
- 0x81d8, 0xfdfff9ff,
- 0x81e0, 0xfd000000,
- 0x81e4, 0x00000000,
- 0x81e8, 0x00000000,
- 0x81ec, 0x00010000,
- 0x81f0, 0x07ff057f,
- 0x81f4, 0x07ff07ff,
- 0x81f8, 0x00000000,
- 0x81fc, 0x00000000,
- 0x8200, 0x00000000,
- 0x8204, 0x00000000,
- 0x8208, 0x33000000,
- 0x820c, 0x7f000000,
- 0x8210, 0x80000000,
- 0x8214, 0x00000000,
- 0x8218, 0xffffffff,
- 0x8300, 0xff007fef,
- 0x8304, 0xfffdf7bf,
- 0x8308, 0xfdfffbff,
-};
-
-#define S3_NUM_BIOS32_REG (sizeof (s3Bios32Reg) / sizeof (s3Bios32Reg[0]))
-
-/*
- * Initialize the card precisely as the bios does
- */
-s3DoBiosInit (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
- CARD32 *regs = (CARD32 *) s3c->registers;
- S3Vga *s3vga = &s3c->s3vga;
- int r;
-
- for (r = 0; r < S3_NUM_BIOS_REG; r++)
- {
- if (s3BiosReg[r].reg == 0xffff)
- sleep (s3BiosReg[r].value);
- else
- VgaStore (&s3vga->card, s3BiosReg[r].reg, s3BiosReg[r].value);
- }
- VgaStore (&s3vga->card, S3_SR+0x10, 0x22);
- VgaStore (&s3vga->card, S3_SR+0x11, 0x44);
- VgaStore (&s3vga->card, S3_SR+0x15, 0x01);
- sleep (1);
- VgaStore (&s3vga->card, S3_SR+0x15, 0x03);
- VgaStore (&s3vga->card, S3_CR+0x6f, 0xff);
- VgaStore (&s3vga->card, S3_CR+0x3f, 0x3f);
- sleep (1);
- VgaStore (&s3vga->card, S3_CR+0x3f, 0x00);
- VgaStore (&s3vga->card, S3_CR+0x6f, 0xfe);
- VgaInvalidate (&s3vga->card);
- for (r = 0; r < S3_NUM_BIOS32_REG; r++)
- regs[s3Bios32Reg[r].offset/4] = s3Bios32Reg[r].value;
-}
-
-void
-s3Preserve (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
- S3Ptr s3 = s3c->s3;
- S3Vga *s3vga = &s3c->s3vga;
- S3Save *save = &s3c->save;
- CARD8 t1, t2;
- CARD8 *cursor_base;
- CARD8 streams_mode;
-
- s3Save (s3vga);
- if (!s3c->bios_initialized)
- s3DoBiosInit (card);
-
- _s3SetBlank (s3, s3vga, TRUE);
- /*
- * Preserve the first part of the frame buffer which holds
- * the text mode fonts and data
- */
- s3Set (s3vga, s3_linear_window_size, 3);
- s3Set (s3vga, s3_enable_linear, 1);
- VgaFlush (&s3vga->card);
- memcpy (save->text_save, s3c->frameBuffer, S3_TEXT_SAVE);
- /*
- * Preserve graphics engine state
- */
- save->alt_mix = s3->alt_mix;
- save->write_mask = s3->write_mask;
- save->fg = s3->fg;
- save->bg = s3->bg;
- /*
- * Preserve streams processor state
- */
- streams_mode = s3Get (s3vga, s3_streams_mode);
- s3SetImm (s3vga, s3_streams_mode, 3);
- save->global_bitmap_1 = s3->global_bitmap_1;
- save->global_bitmap_2 = s3->global_bitmap_2;
- save->adv_func_cntl = s3->adv_func_cntl;
- save->primary_bitmap_1 = s3->primary_bitmap_1;
- save->primary_bitmap_2 = s3->primary_bitmap_2;
- save->secondary_bitmap_1 = s3->secondary_bitmap_1;
- save->secondary_bitmap_2 = s3->secondary_bitmap_2;
- save->primary_stream_control = s3->primary_stream_control;
- save->blend_control = s3->blend_control;
- save->primary_stream_addr_0 = s3->primary_stream_addr_0;
- save->primary_stream_addr_1 = s3->primary_stream_addr_1;
- save->primary_stream_stride = s3->primary_stream_stride;
- save->primary_stream_xy = s3->primary_stream_xy;
- save->primary_stream_size = s3->primary_stream_size;
- save->primary_stream_mem = s3->primary_stream_mem;
- save->secondary_stream_xy = s3->secondary_stream_xy;
- save->secondary_stream_size = s3->secondary_stream_size;
- save->streams_fifo = s3->streams_fifo;
- s3SetImm (s3vga, s3_streams_mode, streams_mode);
- _s3SetBlank (s3, s3vga, FALSE);
-}
-
-/*
- * Enable the card for rendering. Manipulate the initial settings
- * of the card here.
- */
-int s3CpuTimeout, s3AccelTimeout;
-
-void
-s3SetGlobalBitmap (ScreenPtr pScreen, int ma)
-{
- KdScreenPriv(pScreen);
- s3ScreenInfo (pScreenPriv);
-
- if (s3s->current_ma != ma)
- {
- s3CardInfo (pScreenPriv);
- S3Vga *s3vga = &s3c->s3vga;
- S3Ptr s3 = s3c->s3;
- CARD32 gb1, gb2;
- int depth;
- int length;
- KdCheckSync (pScreen);
- switch (s3s->fb[ma].accel_bpp) {
- case 8:
- case 24:
- length = 0;
- break;
- case 16:
- length = 1;
- break;
- case 32:
- length = 3;
- break;
- }
- s3SetImm (s3vga, s3_pixel_length, length);
- gb1 = s3s->fb[ma].bitmap_offset;
- gb2 = ((1 << 0) |
- (0 << 2) |
- (1 << 3) |
- ((s3s->fb[ma].accel_stride >> 4) << 4) |
- (s3s->fb[ma].accel_bpp << 16) |
- (0 << 24) |
- (1 << 28));
- s3->global_bitmap_1 = gb1;
- s3->global_bitmap_2 = gb2;
- s3->global_bitmap_2 = gb2;
- s3s->current_ma = ma;
- }
-}
-
-Bool
-s3Enable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- KdScreenInfo *screen = pScreenPriv->screen;
- s3CardInfo (pScreenPriv);
- s3ScreenInfo (pScreenPriv);
-
- S3Vga *s3vga = &s3c->s3vga;
- S3Ptr s3 = s3c->s3;
- int hactive, hblank, hfp, hbp;
- int vactive, vblank, vfp, vbp;
- int hsize;
-
- int h_total;
- int h_display_end;
- int h_blank_start;
- int h_blank_end;
- int h_sync_start;
- int h_sync_end;
- int h_screen_off;
- int h_start_fifo_fetch;
-
- int primary_stream_l1[KD_MAX_FB];
-
- int v_total;
- int v_retrace_start;
- int v_retrace_end;
- int v_display_end;
- int v_blank_start;
- int v_blank_end;
- int v_blank_start_adjust = 0;
- int v_blank_end_adjust = 0;
-
- int h_blank_start_adjust = 0;
- int h_blank_end_adjust = 0;
- int h_sync_start_adjust = 0;
- int h_sync_end_adjust = 0;
- int h_start_fifo_fetch_adjust = 0;
- int h_sync_extend;
- int h_blank_extend;
- int i;
- CARD16 cursor_address;
- const KdMonitorTiming *t;
- int m, n, r;
- Bool clock_double;
- int cpu_timeout;
- int accel_timeout;
- int bytes_per_ms;
- CARD32 control[2];
- int fb;
- int ma;
-
- s3s->primary_depth = screen->fb[s3s->fbmap[0]].depth;
-
- s3s->use_streams = TRUE;
-
- t = KdFindMode (screen, s3ModeSupported);
-
- hfp = t->hfp;
- hbp = t->hbp;
- hblank = t->hblank;
- hactive = t->horizontal;
-
- vfp = t->vfp;
- vbp = t->vbp;
- vblank = t->vblank;
- vactive = t->vertical;
-
-
- m = s3Get (s3vga, s3_dclk_m);
- n = s3Get (s3vga, s3_dclk_n);
- r = s3Get (s3vga, s3_dclk_r);
-#define DEBUG_CLOCK
-#ifdef DEBUG_CLOCK
- fprintf (stderr, "old clock %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r));
-#endif
- clock_double = FALSE;
- s3GetClock (t->clock, &m, &n, &r, 511, 127, 4, 250000);
- if (S3_CLOCK(m,n,r) > S3_MAX_CLOCK && !s3s->use_streams)
- clock_double = TRUE;
- s3Set (s3vga, s3_clock_select, 3);
- s3Set (s3vga, s3_dclk_m, m);
- s3Set (s3vga, s3_dclk_n, n);
- s3Set (s3vga, s3_dclk_r, r);
-#ifdef DEBUG_CLOCK
- fprintf (stderr, "new clock %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r));
-#endif
-
- if (s3s->use_streams)
- {
- s3Set (s3vga, s3_streams_mode, 3);
- s3Set (s3vga, s3_enable_l1_parameter, 1);
- }
- else
- {
- s3Set (s3vga, s3_streams_mode, 0);
- s3Set (s3vga, s3_enable_l1_parameter, 0);
- }
- s3Set (s3vga, s3_flat_panel_output_control_1, 0);
- s3Set (s3vga, s3_flat_panel_output_control_2, 0);
- s3Set (s3vga, s3_select_graphics_mode, 1);
- s3Set (s3vga, s3_enable_blinking, 0);
- s3Set (s3vga, s3_enable_vga_16bit, 0);
- s3Set (s3vga, s3_enhanced_memory_mapping, 1);
- s3Set (s3vga, s3_enable_sff, 1);
- s3Set (s3vga, s3_enable_2d_access, 1);
- s3Set (s3vga, s3_2bk_cga, 1);
- s3Set (s3vga, s3_4bk_hga, 1);
- s3Set (s3vga, s3_v_total_double, 0);
- s3Set (s3vga, s3_address_16k_wrap, 1);
- s3Set (s3vga, s3_word_mode, 0);
- s3Set (s3vga, s3_byte_mode, 1);
- s3Set (s3vga, s3_hardware_reset, 1);
- s3Set (s3vga, s3_max_scan_line, 0);
- s3Set (s3vga, s3_linear_window_size, 3);
- s3Set (s3vga, s3_enable_linear, 1);
- s3Set (s3vga, s3_enable_2d_3d, 1);
- s3Set (s3vga, s3_refresh_control, 1);
- s3Set (s3vga, s3_disable_pci_read_bursts, 0);
- s3Set (s3vga, s3_pci_disconnect_enable, 1);
- s3Set (s3vga, s3_primary_load_control, 0);
- s3Set (s3vga, s3_secondary_load_control, 0);
- s3Set (s3vga, s3_pci_retry_enable, 1);
- s3Set (s3vga, s3_enable_256, 1);
- s3Set (s3vga, s3_border_select, 1); /* eliminate white border */
- s3SetImm (s3vga, s3_lock_palette, 0); /* unlock palette/border regs */
- s3Set (s3vga, s3_disable_v_retrace_int, 1);
- if (t->hpol == KdSyncPositive)
- s3Set (s3vga, s3_horz_sync_neg, 0);
- else
- s3Set (s3vga, s3_horz_sync_neg, 1);
- if (t->vpol == KdSyncPositive)
- s3Set (s3vga, s3_vert_sync_neg, 0);
- else
- s3Set (s3vga, s3_vert_sync_neg, 1);
-
- s3Set (s3vga, s3_dot_clock_8, 1);
- s3Set (s3vga, s3_enable_write_plane, 0xf);
- s3Set (s3vga, s3_extended_memory_access, 1);
- s3Set (s3vga, s3_sequential_addressing_mode, 1);
- s3Set (s3vga, s3_select_chain_4_mode, 1);
- s3Set (s3vga, s3_linear_addressing_control, 1);
-
- s3Set (s3vga, s3_enable_gamma_correction, 0);
-
- s3Set (s3vga, s3_enable_8_bit_luts, 1);
-
- s3Set (s3vga, s3_dclk_invert, 0);
- s3Set (s3vga, s3_enable_clock_double, 0);
- s3Set (s3vga, s3_dclk_over_2, 0);
-
- s3Set (s3vga, s3_delay_h_enable, 0);
- s3Set (s3vga, s3_sdclk_skew, 0);
-
- s3Set (s3vga, s3_dac_mask, 0xff);
-
-#if 0
-#ifdef DEBUG_CLOCK
- m = s3Get (s3vga, s3_mclk_m);
- n = s3Get (s3vga, s3_mclk_n);
- r = s3Get (s3vga, s3_mclk_r);
- fprintf (stderr, "old mclk %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r));
-#endif
-
- s3GetClock (125282, &m, &n, &r, 127, 31, 3, 250000);
-
-#ifdef DEBUG_CLOCK
- fprintf (stderr, "new mclk %d, %d, %d (%d)\n", m, n, r,S3_CLOCK(m,n,r));
-#endif
-
- s3Set (s3vga, s3_mclk_m, m);
- s3Set (s3vga, s3_mclk_n, n);
- s3Set (s3vga, s3_mclk_r, r);
-
-#ifdef DEBUG_CLOCK
- m = s3Get (s3vga, s3_eclk_m);
- n = s3Get (s3vga, s3_eclk_n);
- r = s3Get (s3vga, s3_eclk_r);
- fprintf (stderr, "old eclk %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r));
-#endif
-
-#define S3_ECLK 125282
-
- s3GetClock (S3_ECLK, &m, &n, &r, 127, 31, 3, 250000);
-
-#ifdef DEBUG_CLOCK
- fprintf (stderr, "new eclk %d, %d, %d (%d)\n", m, n, r,S3_CLOCK(m,n,r));
-#endif
-
- s3Set (s3vga, s3_eclk_m, m);
- s3Set (s3vga, s3_eclk_n, n);
- s3Set (s3vga, s3_eclk_r, r);
-#endif
-
- /*
- * Compute character lengths for horizontal timing values
- */
- hactive = screen->width / 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- /*
- * Set pixel size, choose clock doubling mode
- */
-
- bytes_per_ms = 0;
-
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
- {
- fb = s3s->fbmap[ma];
- s3s->fb[ma].accel_bpp = screen->fb[fb].bitsPerPixel;
- s3s->fb[ma].accel_stride = screen->fb[fb].pixelStride;
- s3s->fb[ma].bitmap_offset = screen->fb[fb].frameBuffer - s3c->frameBuffer;
- switch (s3s->fb[ma].accel_bpp) {
- case 8:
- h_screen_off = hactive;
- s3Set (s3vga, s3_pixel_length, 0);
- s3Set (s3vga, s3_color_mode, 0);
- control[ma] = 0;
- /*
- * Set up for double-pixel mode, switch color modes,
- * divide the dclk and delay h blank by 2 dclks
- */
- if (clock_double)
- {
- s3Set (s3vga, s3_color_mode, 1);
- s3Set (s3vga, s3_dclk_over_2, 1);
- s3Set (s3vga, s3_enable_clock_double, 1);
- s3Set (s3vga, s3_h_skew, 1);
- h_blank_start_adjust = -3;
- h_blank_end_adjust = -4;
- s3Set (s3vga, s3_border_select, 0);
- }
- break;
- case 16:
- h_screen_off = hactive * 2;
- s3Set (s3vga, s3_pixel_length, 1);
- if (screen->fb[fb].depth == 15)
- control[ma] = 3 << 24;
- else
- control[ma] = 5 << 24;
- if (clock_double)
- {
- if (screen->fb[fb].depth == 15)
- s3Set (s3vga, s3_color_mode, 3);
- else
- s3Set (s3vga, s3_color_mode, 5);
- s3Set (s3vga, s3_dclk_over_2, 1);
- s3Set (s3vga, s3_enable_clock_double, 1);
- s3Set (s3vga, s3_border_select, 0);
- h_blank_start_adjust = 4;
- h_blank_end_adjust = -4;
- }
- else
- {
- if (screen->fb[fb].depth == 15)
- s3Set (s3vga, s3_color_mode, 2);
- else
- s3Set (s3vga, s3_color_mode, 4);
- s3Set (s3vga, s3_dclk_over_2, 0);
- s3Set (s3vga, s3_enable_clock_double, 0);
- s3Set (s3vga, s3_delay_blank, 0);
- }
- break;
- case 24:
- control[ma] = 6 << 24;
- h_screen_off = hactive * 3;
- s3s->fb[ma].accel_bpp = 8;
- s3s->fb[ma].accel_stride = screen->fb[fb].pixelStride * 3;
- break;
- case 32:
- control[ma] = 7 << 24;
- h_screen_off = hactive * 4;
- s3Set (s3vga, s3_pixel_length, 3);
- s3Set (s3vga, s3_color_mode, 0xd);
- break;
- }
- bytes_per_ms += t->clock * (screen->fb[fb].bitsPerPixel / 8);
- primary_stream_l1[ma] = (screen->width * screen->fb[fb].bitsPerPixel / (8 * 8)) - 1;
- }
-
- /*
- * X server starts frame buffer at top of memory
- */
- s3Set (s3vga, s3_start_address, 0);
-
- /*
- * Set various registers to avoid snow on the screen
- */
-
- fprintf (stderr, "bytes_per_ms %d\n", bytes_per_ms);
- fprintf (stderr, "primary 0x%x master 0x%x command 0x%x lpb 0x%x cpu 0x%x 2d 0x%x\n",
- s3Get (s3vga, s3_primary_stream_timeout),
- s3Get (s3vga, s3_master_control_unit_timeout),
- s3Get (s3vga, s3_command_buffer_timeout),
- s3Get (s3vga, s3_lpb_timeout),
- s3Get (s3vga, s3_cpu_timeout),
- s3Get (s3vga, s3_2d_graphics_engine_timeout));
-
- /*
- * Test:
- * accel x11perf -line500
- * cpu x11perf -circle500
- *
- * cpu accel
- * 1600x1200x32x85 (918000) 1 1 not enough
- * 1600x1200x32x75 (810000) 3 2
- * 1600x1200x32x70 (756000) 4 3
- * 1600x1200x32x60 (648000) 6 5
- *
- * 1280x1024x32x85 (630000) 6 4
- * 1280x1024x32x75 (540000) a 6
- * 1280x1024x32x60 (432000) 1f a
- *
- * 1152x900x32x85 (490000) a 6
- * 1152x900x32x75 (433000) 1f 8
- * 1152x900x32x70 (401000) 1f a
- * 1152x900x32x66 (380000) 1f a
- *
- * 1024x768x32x85 (378000) 1f a
- * 1024x768x32x75 (315000) 1f b
- * 1024x768x32x70 (300000) 1f b
- * 1024x768x32x60 (260000) 1f 12
- *
- * 800x600x32x85 (225000) 1f 1a
- * 800x600x32x72 (200000) 1f 1d
- * 800x600x32x75 (198000) 1f 1d
- *
- * 1600x1200x16x85 (459000) 1f 8
- * 1600x1200x16x75 (405000) 1f a
- * 1600x1200x16x70 (378000) 1f b
- * 1600x1200x16x60 (324000) 1f f
- *
- * 1280x1024x16x85 (315000) 1f 12
- * 1280x1024x16x75 (270000) 1f 16
- * 1280x1024x16x60 (216000) 1f 1d
- *
- * 1600x1200x8x85 (229000) 1f 1f
- *
- */
-
- if (s3CpuTimeout)
- {
- if (s3CpuTimeout < 0)
- cpu_timeout = 0;
- else
- cpu_timeout = s3CpuTimeout;
- if (s3AccelTimeout < 0)
- accel_timeout = 0;
- else if (s3AccelTimeout)
- accel_timeout = s3AccelTimeout;
- else
- accel_timeout = s3CpuTimeout;
- }
- else if (bytes_per_ms >= 900000)
- {
- cpu_timeout = 0x01;
- accel_timeout = 0x01;
- }
- else if (bytes_per_ms >= 800000)
- {
- cpu_timeout = 0x03;
- accel_timeout = 0x02;
- }
- else if (bytes_per_ms >= 700000)
- {
- cpu_timeout = 0x04;
- accel_timeout = 0x03;
- }
- else if (bytes_per_ms >= 600000)
- {
- cpu_timeout = 0x06;
- accel_timeout = 0x04;
- }
- else if (bytes_per_ms >= 475000)
- {
- cpu_timeout = 0x0a;
- accel_timeout = 0x06;
- }
- else if (bytes_per_ms >= 425000)
- {
- cpu_timeout = 0x1f;
- accel_timeout = 0x8;
- }
- else if (bytes_per_ms >= 300000)
- {
- cpu_timeout = 0x1f;
- accel_timeout = 0x0a;
- }
- else if (bytes_per_ms >= 250000)
- {
- cpu_timeout = 0x1f;
- accel_timeout = 0x12;
- }
- else if (bytes_per_ms >= 200000)
- {
- cpu_timeout = 0x1f;
- accel_timeout = 0x1a;
- }
- else
- {
- cpu_timeout = 0x1f;
- accel_timeout = 0x1f;
- }
-
- fprintf (stderr, "cpu 0x%x accel 0x%x\n", cpu_timeout, accel_timeout);
-
- s3Set (s3vga, s3_primary_stream_timeout, 0xc0);
- s3Set (s3vga, s3_master_control_unit_timeout, 0xf);
- s3Set (s3vga, s3_command_buffer_timeout, 0x1f);
- s3Set (s3vga, s3_lpb_timeout, 0xf);
- s3Set (s3vga, s3_2d_graphics_engine_timeout, accel_timeout);
- s3Set (s3vga, s3_cpu_timeout, cpu_timeout);
-
- s3Set (s3vga, s3_fifo_fetch_timing, 1);
- s3Set (s3vga, s3_fifo_drain_delay, 2);
-
- /*
- * Compute horizontal register values from timings
- */
- h_total = hactive + hblank - 5;
- h_display_end = hactive - 1;
-
- h_sync_start = hactive + hfp + h_sync_start_adjust;
- h_sync_end = hactive + hblank - hbp + h_sync_end_adjust;
- /*
- * pad the blank values narrow a bit and use the border_select to
- * eliminate the remaining border; don't know why, but it doesn't
- * work in the documented fashion
- */
- h_blank_start = hactive + 1 + h_blank_start_adjust;
- h_blank_end = hactive + hblank - 2 + h_blank_end_adjust;
- /*
- * The manual says h_total - 5, but the
- * bios does differently...
- */
- if (screen->width >= 1600)
- h_start_fifo_fetch = h_total - 24;
- else if (screen->width >= 1280)
- h_start_fifo_fetch = h_total - 19;
- else if (screen->width >= 1024)
- h_start_fifo_fetch = h_total - 14;
- else if (screen->width >= 800)
- h_start_fifo_fetch = h_total - 10;
- else
- h_start_fifo_fetch = h_total - 5;
-
- h_start_fifo_fetch += h_start_fifo_fetch_adjust;
- if (h_blank_end - h_blank_start >= 0x40)
- h_blank_extend = 1;
- else
- h_blank_extend = 0;
-
- if (h_sync_end - h_sync_start >= 0x20)
- h_sync_extend = 1;
- else
- h_sync_extend = 0;
-
-#ifdef DEBUG
- fprintf (stderr, "h_total %d h_display_end %d\n",
- h_total, h_display_end);
- fprintf (stderr, "h_sync_start %d h_sync_end %d h_sync_extend %d\n",
- h_sync_start, h_sync_end, h_sync_extend);
- fprintf (stderr, "h_blank_start %d h_blank_end %d h_blank_extend %d\n",
- h_blank_start, h_blank_end, h_blank_extend);
-#endif
-
- s3Set (s3vga, s3_h_total, h_total);
- s3Set (s3vga, s3_h_display_end, h_display_end);
- s3Set (s3vga, s3_h_blank_start, h_blank_start);
- s3Set (s3vga, s3_h_blank_end, h_blank_end);
- s3Set (s3vga, s3_h_sync_start, h_sync_start);
- s3Set (s3vga, s3_h_sync_end, h_sync_end);
- s3Set (s3vga, s3_screen_offset, h_screen_off);
- s3Set (s3vga, s3_h_start_fifo_fetch, h_start_fifo_fetch);
- s3Set (s3vga, s3_h_sync_extend, h_sync_extend);
- s3Set (s3vga, s3_h_blank_extend, h_blank_extend);
-
- s3Set (s3vga, s3_dac_power_saving_disable, 0);
- s3Set (s3vga, s3_dac_power_up_time, hactive + hblank);
-
- s3Set (s3vga, s3_primary_stream_l1, primary_stream_l1[0]);
-
- s3Set (s3vga, s3_streams_fifo_delay, 0);
-
- v_total = vactive + vblank - 2;
- v_display_end = vactive - 1;
-
- v_blank_start = vactive - 1 + v_blank_start_adjust;
- v_blank_end = v_blank_start + vblank - 1 + v_blank_end_adjust;
-
- v_retrace_start = vactive + vfp;
- v_retrace_end = vactive + vblank - vbp;
-
- s3Set (s3vga, s3_v_total, v_total);
- s3Set (s3vga, s3_v_retrace_start, v_retrace_start);
- s3Set (s3vga, s3_v_retrace_end, v_retrace_end);
- s3Set (s3vga, s3_v_display_end, v_display_end);
- s3Set (s3vga, s3_v_blank_start, v_blank_start);
- s3Set (s3vga, s3_v_blank_end, v_blank_end);
-
- if (vactive >= 1024)
- s3Set (s3vga, s3_line_compare, 0x7ff);
- else
- s3Set (s3vga, s3_line_compare, 0x3ff);
-
- /*
- * Set cursor
- */
- if (!screen->softCursor)
- {
- cursor_address = (s3s->cursor_base - s3c->frameBuffer) / 1024;
-
- s3Set (s3vga, s3_cursor_address, cursor_address);
- s3Set (s3vga, s3_cursor_ms_x11, 0);
- s3Set (s3vga, s3_cursor_enable, 1);
- }
- else
- s3Set (s3vga, s3_cursor_enable, 0);
-
-#define MAKE_GBF(bds,be,stride,bpp,tile) (\
- ((bds) << 0) | \
- ((be) << 3) | \
- ((stride) << 4) | \
- ((bpp) << 16) | \
- ((tile) << 24))
- /*
- * Set accelerator
- */
- switch (screen->width) {
-#if 0
- case 640: s3Set (s3vga, s3_ge_screen_width, 1); break;
- case 800: s3Set (s3vga, s3_ge_screen_width, 2); break;
- case 1024: s3Set (s3vga, s3_ge_screen_width, 0); break;
- case 1152: s3Set (s3vga, s3_ge_screen_width, 4); break;
- case 1280: s3Set (s3vga, s3_ge_screen_width, 3); break;
- case 1600: s3Set (s3vga, s3_ge_screen_width, 6); break;
-#endif
- default:
- s3Set (s3vga, s3_ge_screen_width, 7); /* use global bitmap descriptor */
- }
-
-#if 0
- crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */
-#endif
-
- /*
- * Set DPMS to normal
- */
- s3Set (s3vga, s3_hsync_control, 0);
- s3Set (s3vga, s3_vsync_control, 0);
-
- _s3SetBlank (s3, s3vga, TRUE);
- if (s3s->use_streams)
- s3Set (s3vga, s3_primary_stream_definition, 1);
- else
- s3Set (s3vga, s3_primary_stream_definition, 0);
-
- VgaFlush(&s3vga->card);
- VgaSetImm (&s3vga->card, s3_clock_load_imm, 1);
- VgaSetImm(&s3vga->card, s3_clock_load_imm, 0);
-
-
- if (s3s->use_streams)
- {
- fb = s3s->fbmap[0];
- s3->primary_stream_control = control[0];
- s3->primary_stream_addr_0 =
- s3->primary_stream_addr_1 = s3s->fb[0].bitmap_offset;
- s3->primary_stream_stride = screen->fb[fb].byteStride;
- s3->primary_stream_xy = (1 << 16) | 1;
- s3->primary_stream_size = ((screen->fb[fb].pixelStride - 1) << 16) | screen->height;
- s3->primary_stream_mem = (screen->fb[fb].byteStride * screen->height) / 8 - 1;
- if (s3s->fbmap[1] >= 0)
- {
- fb = s3s->fbmap[1];
- s3->blend_control = 5 << 24;
- if (s3s->fb[0].accel_bpp == 8)
- s3->chroma_key_control = 0x33000000 | s3s->fb[0].chroma_key;
- else
- s3->chroma_key_control = 0x13010101;
- s3->secondary_stream_control = control[1] | screen->width;
- s3->secondary_stream_h_scale = (1 << 15);
- s3->color_adjustment = 0;
- s3->secondary_stream_vscale = (1 << 15);
- s3->secondary_stream_vinit = 0;
- s3->secondary_stream_mbuf = 0;
- s3->secondary_stream_addr_0 =
- s3->secondary_stream_addr_1 = s3s->fb[1].bitmap_offset;
- s3->secondary_stream_stride = screen->fb[fb].byteStride;
- s3->secondary_stream_scount = screen->height;
- s3->secondary_stream_xy = (1 << 16) | 1;
- s3->secondary_stream_size = ((screen->fb[fb].pixelStride - 1) << 16) | screen->height;
- s3->secondary_stream_mem = (1 << 22) | ((screen->fb[fb].byteStride * screen->height) / 8 - 1);
- }
- else
- {
- s3->blend_control = 1 << 24;
- s3->secondary_stream_xy = 0x07ff07ff;
- s3->secondary_stream_size = 0x00010001;
- }
- s3->streams_fifo = (0x20 << 11) | (0x20 << 5) | 0x2;
- }
- s3->mult_misc_read_sel = (((1 << 9) |
- (1 << 11) |
- (0xe << 12)) |
- (((0xe << 0) |
- (0xf << 12)) << 16));
-
- s3->cmd_overflow_buf_ptr = (1 << 3);
- s3->bci_power_management = (1 << 9);
- s3->adv_func_cntl = (3 << 8) | (1 << 4) | (1 << 2) | 1;
- s3->primary_bitmap_1 = 0;
- s3->primary_bitmap_2 = 0;
- s3->secondary_bitmap_1 = 0;
- s3->secondary_bitmap_2 = 0;
- s3s->current_ma = -1;
- _s3SetBlank (s3, s3vga, FALSE);
-#if 0
- {
- VGA16 r;
- static CARD32 streams[][2] = {
- /* PCI registers */
- 0x8000, 0x8024,
- 0x802c, 0x8034,
- 0x803c, 0x8040,
-#if 0
- 0x8080, 0x808c, /* AGP */
-#endif
- 0x80dc, 0x80e0,
-
- /* 2D registers */
- 0x8168, 0x8188,
- 0x8190, 0x81a0,
- 0x81c0, 0x81d8,
- 0x81e0, 0x8218,
- 0x8300, 0x8308,
- 0x8504, 0x8510,
-
- /* LPB/VIP registers */
- 0xff00, 0xff18,
- 0xff20, 0xff38,
- 0xff40, 0xff40,
- 0xff70, 0xff78,
- 0xff8c, 0xffa0,
-
-#if 0
- /* 3D registers */
- 0x48508, 0x48508,
- 0x48528, 0x48528,
- 0x48548, 0x48548,
- 0x48584, 0x485f0,
-#endif
-
- /* motion compensation registers */
- 0x48900, 0x48924,
-#if 0
- 0x48928, 0x48928,
-#endif
-
- /* Mastered data transfer registers */
- 0x48a00, 0x48a1c,
-
- /* configuation/status registers */
- 0x48c00, 0x48c18,
- 0x48c20, 0x48c24,
- 0x48c40, 0x48c50,
- 0x48c60, 0x48c64,
-
- 0, 0,
- };
-#ifdef PHOENIX
-#undef stderr
-#define stderr stdout
-#endif
- CARD32 *regs = (CARD32 *) s3c->registers;
- int i;
- CARD32 reg;
-
-
- for (r = S3_SR + 0; r < S3_SR + S3_NSR; r++)
- fprintf (stderr, "SR%02x = %02x\n", r-S3_SR, VgaFetch (&s3vga->card, r));
- for (r = S3_GR + 0; r < S3_GR + S3_NGR; r++)
- fprintf (stderr, "GR%02x = %02x\n", r-S3_GR, VgaFetch (&s3vga->card, r));
- for (r = S3_AR + 0; r < S3_AR + S3_NAR; r++)
- fprintf (stderr, "AR%02x = %02x\n", r-S3_AR, VgaFetch (&s3vga->card, r));
- for (r = S3_CR + 0; r < S3_CR + S3_NCR; r++)
- fprintf (stderr, "CR%02x = %02x\n", r-S3_CR, VgaFetch (&s3vga->card, r));
- for (r = S3_DAC + 0; r < S3_DAC + S3_NDAC; r++)
- fprintf (stderr, "DAC%02x = %02x\n", r-S3_DAC, VgaFetch (&s3vga->card, r));
- fprintf (stderr, "MISC_OUT = %02x\n", VgaFetch (&s3vga->card, S3_MISC_OUT));
- fprintf (stderr, "INPUT_STATUS = %02x\n", VgaFetch (&s3vga->card, S3_INPUT_STATUS_1));
-
-
- for (i = 0; streams[i][0]; i++)
- {
- for (reg = streams[i][0]; reg <= streams[i][1]; reg += 4)
- fprintf (stderr, "0x%4x: 0x%08x\n", reg, regs[reg/4]);
- }
- }
-#endif
- return TRUE;
-}
-
-void
-s3Disable (ScreenPtr pScreen)
-{
-}
-
-void
-s3Restore (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
- S3Ptr s3 = s3c->s3;
- S3Vga *s3vga = &s3c->s3vga;
- S3Save *save = &s3c->save;
- CARD8 *cursor_base;
- CARD8 streams_mode;
-
- _s3SetBlank (s3, s3vga, TRUE);
- /* streams processor state */
- streams_mode = s3Get (s3vga, s3_streams_mode);
- s3SetImm (s3vga, s3_streams_mode, 3);
- s3->global_bitmap_1 = save->global_bitmap_1;
- s3->global_bitmap_2 = save->global_bitmap_2;
- s3->adv_func_cntl = save->adv_func_cntl;
- s3->primary_bitmap_1 = save->primary_bitmap_1;
- s3->primary_bitmap_2 = save->primary_bitmap_2;
- s3->secondary_bitmap_1 = save->secondary_bitmap_1;
- s3->secondary_bitmap_2 = save->secondary_bitmap_2;
- s3->primary_stream_control = save->primary_stream_control;
- s3->blend_control = save->blend_control;
- s3->primary_stream_addr_0 = save->primary_stream_addr_0;
- s3->primary_stream_addr_0 = save->primary_stream_addr_0;
- s3->primary_stream_stride = save->primary_stream_stride;
- s3->primary_stream_xy = save->primary_stream_xy;
- s3->primary_stream_size = save->primary_stream_size;
- s3->primary_stream_mem = save->primary_stream_mem;
- s3->secondary_stream_xy = save->secondary_stream_xy;
- s3->secondary_stream_size = save->secondary_stream_size;
- s3->streams_fifo = save->streams_fifo;
- s3SetImm (s3vga, s3_streams_mode, streams_mode);
- /* graphics engine state */
- s3->alt_mix = save->alt_mix;
- s3->write_mask = save->write_mask;
- s3->fg = save->fg;
- s3->bg = save->bg;
- /* XXX should save and restore real values? */
- s3->scissors_tl = 0x00000000;
- s3->scissors_br = 0x0fff0fff;
-
- VgaRestore (&s3vga->card);
- s3Set (s3vga, s3_linear_window_size, 3);
- s3Set (s3vga, s3_enable_linear, 1);
- VgaFlush (&s3vga->card);
- memcpy (s3c->frameBuffer, save->text_save, S3_TEXT_SAVE);
- s3Reset (s3vga);
- _s3SetBlank (s3, s3vga, FALSE);
-}
-
-void
-_s3SetSync (S3CardInfo *s3c, int hsync, int vsync)
-{
- /* this abuses the macros defined to access the crtc structure */
- S3Ptr s3 = s3c->s3;
- S3Vga *s3vga = &s3c->s3vga;
-
- s3Set (s3vga, s3_hsync_control, hsync);
- s3Set (s3vga, s3_vsync_control, vsync);
- VgaFlush (&s3vga->card);
-}
-
-Bool
-s3DPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- S3Vga *s3vga = &s3c->s3vga;
-
- switch (mode) {
- case KD_DPMS_NORMAL:
- _s3SetSync (s3c, 0, 0);
- _s3SetBlank (s3c->s3, s3vga, FALSE);
- break;
- case KD_DPMS_STANDBY:
- _s3SetBlank (s3c->s3, s3vga, TRUE);
- _s3SetSync (s3c, 1, 0);
- break;
- case KD_DPMS_SUSPEND:
- _s3SetBlank (s3c->s3, s3vga, TRUE);
- _s3SetSync (s3c, 0, 1);
- break;
- case KD_DPMS_POWERDOWN:
- _s3SetBlank (s3c->s3, s3vga, TRUE);
- _s3SetSync (s3c, 1, 1);
- break;
- }
- return TRUE;
-}
-
-Bool
-s3InitScreen(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- KdScreenInfo *screen = pScreenPriv->screen;
- s3CardInfo (pScreenPriv);
- s3ScreenInfo (pScreenPriv);
- int ma, fb;
-
- if (screen->fb[1].depth)
- {
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
-
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
- {
- fb = s3s->fbmap[ma];
- pScrPriv->layer[fb].key = s3s->fb[ma].chroma_key;
- }
- }
- return TRUE;
-}
-
-void
-s3ScreenFini (KdScreenInfo *screen)
-{
- S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver;
-
- xfree (s3s);
- screen->driver = 0;
-}
-
-void
-s3CardFini (KdCardInfo *card)
-{
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
-
- KdUnmapDevice (s3c->frameBuffer, s3c->memory);
- KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET);
- xfree (s3c);
- card->driver = 0;
-}
-
-KdCardFuncs s3Funcs = {
- s3CardInit,
- s3ScreenInit,
- s3InitScreen,
- s3Preserve,
- s3Enable,
- s3DPMS,
- s3Disable,
- s3Restore,
- s3ScreenFini,
- s3CardFini,
- s3CursorInit,
- s3CursorEnable,
- s3CursorDisable,
- s3CursorFini,
- s3RecolorCursor,
- s3DrawInit,
- s3DrawEnable,
- s3DrawSync,
- s3DrawDisable,
- s3DrawFini,
- s3GetColors,
- s3PutColors,
-};
diff --git a/hw/kdrive/savage/s3.h b/hw/kdrive/savage/s3.h
deleted file mode 100644
index 86e1863b4..000000000
--- a/hw/kdrive/savage/s3.h
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Id: s3.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.4 2000/05/06 22:17:45 keithp Exp $ */
-
-#ifndef _S3_H_
-#define _S3_H_
-
-#include "kdrive.h"
-#include "s3reg.h"
-
-/* VESA Approved Register Definitions */
-
-/*
- * Linear Addressing 000 0000 - 0ff ffff (16m)
- * Image data transfer 100 0000 - 100 7fff (32k)
- * PCI config 100 8000 - 100 8043
- * Packed enhanced regs 100 8100 - 100 814a
- * Streams regs 100 8180 - 100 81ff
- * Current Y pos 100 82e8
- * CRT VGA 3b? regs 100 83b0 - 100 83bf
- * CRT VGA 3c? regs 100 83c0 - 100 83cf
- * CRT VGA 3d? regs 100 83d0 - 100 83df
- * Subsystem status (42e8h) 100 8504
- * Advanced function (42e8h) 100 850c
- * Enhanced regs 100 86e8 - 100 eeea
- * Local peripheral bus 100 ff00 - 100 ff5c
- *
- * We don't care about the image transfer or PCI regs, so
- * this structure starts at the packed enhanced regs
- */
-
-typedef volatile CARD32 VOL32;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD8 VOL8;
-
-typedef volatile struct _s3 {
- VOL32 alt_curxy; /* 8100 */
- VOL32 _pad0; /* 8104 */
- VOL32 alt_step; /* 8108 */
- VOL32 _pad1; /* 810c */
- VOL32 err_term; /* 8110 */
- VOL32 _pad2; /* 8114 */
- VOL32 cmd_gp_stat; /* 8118 */
- VOL32 short_stroke; /* 811c */
- VOL32 bg; /* 8120 */
- VOL32 fg; /* 8124 */
- VOL32 write_mask; /* 8128 */
- VOL32 read_mask; /* 812c */
- VOL32 color_cmp; /* 8130 */
- VOL32 alt_mix; /* 8134 */
- VOL32 scissors_tl; /* 8138 */
- VOL32 scissors_br; /* 813c */
-#if 0
- VOL16 pix_cntl; /* 8140 */
- VOL16 mult_misc2; /* 8142 */
-#else
- VOL32 pix_cntl_mult_misc2; /* 8140 */
-#endif
- VOL32 mult_misc_read_sel; /* 8144 */
- VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */
- VOL8 _pad3a[0x1c]; /* 814c */
- VOL32 global_bitmap_1; /* 8168 */
- VOL32 global_bitmap_2; /* 816c */
- VOL32 primary_bitmap_1; /* 8170 */
- VOL32 primary_bitmap_2; /* 8174 */
- VOL32 secondary_bitmap_1; /* 8178 */
- VOL32 secondary_bitmap_2; /* 817c */
- VOL32 primary_stream_control; /* 8180 */
- VOL32 chroma_key_control; /* 8184 */
- VOL32 genlocking_control; /* 8188 */
- VOL8 _pad3b[0x4]; /* 818c */
- VOL32 secondary_stream_control; /* 8190 */
- VOL32 chroma_key_upper_bound; /* 8194 */
- VOL32 secondary_stream_h_scale; /* 8198 */
- VOL32 color_adjustment; /* 819c */
- VOL32 blend_control; /* 81a0 */
- VOL8 _pad3c[0x1c]; /* 81a4 */
- VOL32 primary_stream_addr_0; /* 81c0 */
- VOL32 primary_stream_addr_1; /* 81c4 */
- VOL32 primary_stream_stride; /* 81c8 */
- VOL32 secondary_stream_mbuf; /* 81cc */
- VOL32 secondary_stream_addr_0;/* 81d0 */
- VOL32 secondary_stream_addr_1;/* 81d4 */
- VOL32 secondary_stream_stride;/* 81d8 */
- VOL8 _pad81dc[4]; /* 81dc */
- VOL32 secondary_stream_vscale;/* 81e0 */
- VOL32 secondary_stream_vinit; /* 81e4 */
- VOL32 secondary_stream_scount;/* 81e8 */
- VOL32 streams_fifo; /* 81ec */
- VOL32 primary_stream_xy; /* 81f0 */
- VOL32 primary_stream_size; /* 81f4 */
- VOL32 secondary_stream_xy; /* 81f8 */
- VOL32 secondary_stream_size; /* 81fc */
- VOL8 _pad8200[0xe8]; /* 8200 */
- VOL32 cur_y; /* 82e8 */
- VOL8 _pad4[0x14]; /* 82ec */
- VOL32 primary_stream_mem; /* 8300 */
- VOL32 secondary_stream_mem; /* 8304 */
- VOL8 _pad8308[0xD2]; /* 8308 */
- VOL8 input_status_1; /* 83da */
- VOL8 _pad83db[0x131]; /* 83db */
- VOL32 adv_func_cntl; /* 850c */
- VOL8 _pad8510[0x5dd8]; /* 8510 */
- VOL32 pix_trans; /* e2e8 */
- VOL8 _pade2ec[0x3a92c]; /* e2ec */
- VOL32 cmd_overflow_buf_ptr; /* 48c18 */
- VOL8 _pad48c1c[0x8]; /* 48c1c */
- VOL32 bci_power_management; /* 48c24 */
- VOL8 _pad48c28[0x38]; /* 48c28 */
- VOL32 alt_status_0; /* 48c60 */
- VOL32 alt_status_1; /* 48c64 */
-} S3, *S3Ptr;
-
-#define VGA_STATUS_1_DTM 0x01
-#define VGA_STATUS_1_VSY 0x08
-
-#define DAC_MASK 0x03c6
-#define DAC_R_INDEX 0x03c7
-#define DAC_W_INDEX 0x03c8
-#define DAC_DATA 0x03c9
-#define DISP_STAT 0x02e8
-#define H_TOTAL 0x02e8
-#define H_DISP 0x06e8
-#define H_SYNC_STRT 0x0ae8
-#define H_SYNC_WID 0x0ee8
-#define V_TOTAL 0x12e8
-#define V_DISP 0x16e8
-#define V_SYNC_STRT 0x1ae8
-#define V_SYNC_WID 0x1ee8
-#define DISP_CNTL 0x22e8
-#define ADVFUNC_CNTL 0x4ae8
-#define SUBSYS_STAT 0x42e8
-#define SUBSYS_CNTL 0x42e8
-#define ROM_PAGE_SEL 0x46e8
-#define CUR_Y 0x82e8
-#define CUR_X 0x86e8
-#define DESTY_AXSTP 0x8ae8
-#define DESTX_DIASTP 0x8ee8
-#define ERR_TERM 0x92e8
-#define MAJ_AXIS_PCNT 0x96e8
-#define GP_STAT 0x9ae8
-#define CMD 0x9ae8
-#define SHORT_STROKE 0x9ee8
-#define BKGD_COLOR 0xa2e8
-#define FRGD_COLOR 0xa6e8
-#define WRT_MASK 0xaae8
-#define RD_MASK 0xaee8
-#define COLOR_CMP 0xb2e8
-#define BKGD_MIX 0xb6e8
-#define FRGD_MIX 0xbae8
-#define MULTIFUNC_CNTL 0xbee8
-#define MIN_AXIS_PCNT 0x0000
-#define SCISSORS_T 0x1000
-#define SCISSORS_L 0x2000
-#define SCISSORS_B 0x3000
-#define SCISSORS_R 0x4000
-#define MEM_CNTL 0x5000
-#define PATTERN_L 0x8000
-#define PATTERN_H 0x9000
-#define PIX_CNTL 0xa000
-#define CONTROL_MISC2 0xd000
-#define PIX_TRANS 0xe2e8
-
-/* Advanced Function Control Regsiter */
-#define CLKSEL 0x0004
-#define DISABPASSTHRU 0x0001
-
-/* Graphics Processor Status Register */
-
-#define GPNSLOT 13
-
-#define GPBUSY_1 0x0080
-#define GPBUSY_2 0x0040
-#define GPBUSY_3 0x0020
-#define GPBUSY_4 0x0010
-#define GPBUSY_5 0x0008
-#define GPBUSY_6 0x0004
-#define GPBUSY_7 0x0002
-#define GPBUSY_8 0x0001
-#define GPBUSY_9 0x8000
-#define GPBUSY_10 0x4000
-#define GPBUSY_11 0x2000
-#define GPBUSY_12 0x1000
-#define GPBUSY_13 0x0800
-
-#define GPEMPTY 0x0400
-#define GPBUSY 0x0200
-#define DATDRDY 0x0100
-
-/* Command Register */
-#define CMD_NOP 0x0000
-#define CMD_LINE 0x2000
-#define CMD_RECT 0x4000
-#define CMD_RECTV1 0x6000
-#define CMD_RECTV2 0x8000
-#define CMD_LINEAF 0xa000
-#define CMD_BITBLT 0xc000
-#define CMD_PATBLT 0xe000
-#define CMD_OP_MSK 0xe000
-#define BYTSEQ 0x1000
-#define _32BITNOPAD 0x0600
-#define _32BIT 0x0400
-#define _16BIT 0x0200
-#define _8BIT 0x0000
-#define PCDATA 0x0100
-#define INC_Y 0x0080
-#define YMAJAXIS 0x0040
-#define INC_X 0x0020
-#define DRAW 0x0010
-#define LINETYPE 0x0008
-#define LASTPIX 0x0004 /* Draw last pixel in line */
-#define PLANAR 0x0002
-#define WRTDATA 0x0001
-
-/* Background Mix Register */
-#define BSS_BKGDCOL 0x0000
-#define BSS_FRGDCOL 0x0020
-#define BSS_PCDATA 0x0040
-#define BSS_BITBLT 0x0060
-
-/* Foreground Mix Register */
-#define FSS_BKGDCOL 0x0000
-#define FSS_FRGDCOL 0x0020
-#define FSS_PCDATA 0x0040
-#define FSS_BITBLT 0x0060
-
-/* The Mixes */
-#define MIX_MASK 0x001f
-
-#define MIX_NOT_DST 0x0000
-#define MIX_0 0x0001
-#define MIX_1 0x0002
-#define MIX_DST 0x0003
-#define MIX_NOT_SRC 0x0004
-#define MIX_XOR 0x0005
-#define MIX_XNOR 0x0006
-#define MIX_SRC 0x0007
-#define MIX_NAND 0x0008
-#define MIX_NOT_SRC_OR_DST 0x0009
-#define MIX_SRC_OR_NOT_DST 0x000a
-#define MIX_OR 0x000b
-#define MIX_AND 0x000c
-#define MIX_SRC_AND_NOT_DST 0x000d
-#define MIX_NOT_SRC_AND_DST 0x000e
-#define MIX_NOR 0x000f
-
-#define MIX_MIN 0x0010
-#define MIX_DST_MINUS_SRC 0x0011
-#define MIX_SRC_MINUS_DST 0x0012
-#define MIX_PLUS 0x0013
-#define MIX_MAX 0x0014
-#define MIX_HALF__DST_MINUS_SRC 0x0015
-#define MIX_HALF__SRC_MINUS_DST 0x0016
-#define MIX_AVERAGE 0x0017
-#define MIX_DST_MINUS_SRC_SAT 0x0018
-#define MIX_SRC_MINUS_DST_SAT 0x001a
-#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c
-#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e
-#define MIX_AVERAGE_SAT 0x001f
-
-/* Pixel Control Register */
-#define MIXSEL_FRGDMIX 0x0000
-#define MIXSEL_PATT 0x0040
-#define MIXSEL_EXPPC 0x0080
-#define MIXSEL_EXPBLT 0x00c0
-#define COLCMPOP_F 0x0000
-#define COLCMPOP_T 0x0008
-#define COLCMPOP_GE 0x0010
-#define COLCMPOP_LT 0x0018
-#define COLCMPOP_NE 0x0020
-#define COLCMPOP_EQ 0x0028
-#define COLCMPOP_LE 0x0030
-#define COLCMPOP_GT 0x0038
-#define PLANEMODE 0x0004
-
-/* Multifunction Control Misc 8144 */
-#define MISC_DST_BA_0 (0x0 << 0)
-#define MISC_DST_BA_1 (0x1 << 0)
-#define MISC_DST_BA_2 (0x2 << 0)
-#define MISC_DST_BA_3 (0x3 << 0)
-#define MISC_SRC_BA_0 (0x0 << 2)
-#define MISC_SRC_BA_1 (0x1 << 2)
-#define MISC_SRC_BA_2 (0x2 << 2)
-#define MISC_SRC_BA_3 (0x3 << 2)
-#define MISC_RSF (1 << 4)
-#define MISC_EXT_CLIP (1 << 5)
-#define MISC_SRC_NE (1 << 7)
-#define MISC_ENB_CMP (1 << 8)
-#define MISC_32B (1 << 9)
-#define MISC_DC (1 << 11)
-#define MISC_INDEX_E (0xe << 12)
-
-#define S3_SAVAGE4_SLOTS 0x0001ffff
-#define S3_SAVAGE4_2DI 0x00800000
-
-#define _s3WaitLoop(s3,mask,value){ \
- int __loop = 1000000; \
- while (((s3)->alt_status_0 & (mask)) != (value)) \
- if (--__loop == 0) { \
- ErrorF ("savage wait loop failed 0x%x\n", s3->alt_status_0); \
- break; \
- } \
-}
-
-#define S3_SAVAGE4_ROOM 10
-
-#define _s3WaitSlots(s3,n) { \
- int __loop = 1000000; \
- while (((s3)->alt_status_0 & S3_SAVAGE4_SLOTS) >= S3_SAVAGE4_ROOM-(n)) \
- if (--__loop == 0) { \
- ErrorF ("savage wait loop failed 0x%x\n", s3->alt_status_0); \
- break; \
- } \
-}
-
-#define _s3WaitEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS, 0)
-#define _s3WaitIdleEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS|S3_SAVAGE4_2DI, S3_SAVAGE4_2DI)
-#define _s3WaitIdle(s3) _s3WaitLoop(s3,S3_SAVAGE4_2DI, S3_SAVAGE4_2DI)
-
-typedef struct _s3Cursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} S3Cursor;
-
-typedef struct _s3PatternCache {
- int id;
- int x, y;
-} S3PatternCache;
-
-typedef struct _s3Patterns {
- S3PatternCache *cache;
- int ncache;
- int last_used;
- int last_id;
-} S3Patterns;
-
-#define S3_CLOCK_REF 14318 /* KHz */
-
-#define S3_CLOCK(m,n,r) ((S3_CLOCK_REF * ((m) + 2)) / (((n) + 2) * (1 << (r))))
-
-#define S3_MAX_CLOCK 150000 /* KHz */
-
-typedef struct _s3Timing {
- /* label */
- int horizontal;
- int vertical;
- int rate;
- /* horizontal timing */
- int hfp; /* front porch */
- int hbp; /* back porch */
- int hblank; /* blanking */
- /* vertical timing */
- int vfp; /* front porch */
- int vbp; /* back porch */
- int vblank; /* blanking */
- /* clock values */
- int dac_m;
- int dac_n;
- int dac_r;
-} S3Timing;
-
-#define S3_TEXT_SAVE (64*1024)
-
-typedef struct _s3Save {
- CARD8 cursor_fg;
- CARD8 cursor_bg;
- CARD8 lock1;
- CARD8 lock2;
- CARD8 locksrtc;
- CARD8 clock_mode;
- CARD32 alt_mix;
- CARD32 write_mask;
- CARD32 fg;
- CARD32 bg;
- CARD32 global_bitmap_1;
- CARD32 global_bitmap_2;
- CARD32 adv_func_cntl;
- CARD32 primary_bitmap_1;
- CARD32 primary_bitmap_2;
- CARD32 secondary_bitmap_1;
- CARD32 secondary_bitmap_2;
- CARD32 primary_stream_control;
- CARD32 blend_control;
- CARD32 primary_stream_addr_0;
- CARD32 primary_stream_addr_1;
- CARD32 primary_stream_stride;
- CARD32 primary_stream_xy;
- CARD32 primary_stream_size;
- CARD32 primary_stream_mem;
- CARD32 secondary_stream_xy;
- CARD32 secondary_stream_size;
- CARD32 streams_fifo;
- CARD8 text_save[S3_TEXT_SAVE];
-} S3Save;
-
-typedef struct _s3CardInfo {
- S3Ptr s3; /* pointer to register structure */
- int memory; /* amount of memory */
- CARD8 *frameBuffer; /* pointer to frame buffer */
- CARD8 *registers; /* pointer to register map */
- S3Vga s3vga;
- S3Save save;
- Bool need_sync;
- Bool bios_initialized; /* whether the bios has been run */
-} S3CardInfo;
-
-typedef struct _s3FbInfo {
- CARD8 *offscreen; /* pointer to offscreen area */
- int offscreen_y; /* top y coordinate of offscreen area */
- int offscreen_x; /* top x coordinate of offscreen area */
- int offscreen_width; /* width of offscreen area */
- int offscreen_height; /* height of offscreen area */
- S3Patterns patterns;
- CARD32 bitmap_offset;
- int accel_stride;
- int accel_bpp;
- CARD32 chroma_key;
-} S3FBInfo;
-
-typedef struct _s3ScreenInfo {
- CARD8 *cursor_base; /* pointer to cursor area */
- S3Cursor cursor;
- Bool managing_border;
- Bool use_streams;
- int primary_depth;
- int current_ma;
- CARD32 border_pixel;
- S3FBInfo fb[KD_MAX_FB];
- RegionRec region[KD_MAX_FB];
- int fbmap[KD_MAX_FB+1]; /* map from fb to stream */
-} S3ScreenInfo;
-
-#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver))
-#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd)
-
-#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver))
-#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd)
-
-Bool s3CardInit (KdCardInfo *);
-Bool s3ScreenInit (KdScreenInfo *);
-Bool s3Enable (ScreenPtr pScreen);
-void s3Disable (ScreenPtr pScreen);
-void s3Fini (ScreenPtr pScreen);
-
-Bool s3CursorInit (ScreenPtr pScreen);
-void s3CursorEnable (ScreenPtr pScreen);
-void s3CursorDisable (ScreenPtr pScreen);
-void s3CursorFini (ScreenPtr pScreen);
-void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
-
-void s3DumbPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
-void s3DumbCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-Bool s3DrawInit (ScreenPtr pScreen);
-void s3DrawEnable (ScreenPtr pScreen);
-void s3DrawSync (ScreenPtr pScreen);
-void s3DrawDisable (ScreenPtr pScreen);
-void s3DrawFini (ScreenPtr pScreen);
-
-void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-
-void S3InitCard (KdCardAttr *attr);
-
-void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco);
-
-extern KdCardFuncs s3Funcs;
-
-/*
- * Wait for the begining of the retrace interval
- */
-
-#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\
- DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \
- __FILE__, __LINE__)); \
- break; \
-}
-
-#define DRAW_DEBUG(a)
-
-#define _s3WaitVRetrace(s3vga) { \
- int _loop_count; \
- _loop_count = 0; \
- while (s3GetImm(s3vga, s3_vertical_sync_active) != 0) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \
-}
-#define _s3WaitVRetraceFast(s3) { \
- int _loop_count; \
- _loop_count = 0; \
- while (s3->input_status_1 & 8) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while ((s3->input_status_1 & 8) == 0) S3_RETRACE_LOOP_CHECK; \
-}
-/*
- * Wait for the begining of the retrace interval
- */
-#define _s3WaitVRetraceEnd(s3vga) { \
- int _loop_count; \
- _loop_count = 0; \
- while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while (s3GetImm(s3vga, s3_vertical_sync_active) != 0) S3_RETRACE_LOOP_CHECK; \
-}
-
-#define S3_CURSOR_WIDTH 64
-#define S3_CURSOR_HEIGHT 64
-#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8)
-
-#define S3_TILE_SIZE 8
-
-#endif /* _S3_H_ */
diff --git a/hw/kdrive/savage/s3.nick b/hw/kdrive/savage/s3.nick
deleted file mode 100644
index 8f6791f87..000000000
--- a/hw/kdrive/savage/s3.nick
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $RCSId: $ */
-
-global f_ref = 14318000;
-
-function s3_clock (m, n, r)
-{
- return f_ref * (m + 2) / ((n + 2) * (2 ^ r));
-}
-
-function s3_near (f1, f2)
-{
- return abs (f1 - f2) < f1 / 10;
-}
-
-function s3_clocks (f)
-{
- auto m, n, r, ft;
- auto dist, min_dist;
- auto min_m, min_n, min_r;
-
- min_dist = f / 5;
- for (r = 0; r <= 3; r++)
- for (n = 0; n <= 31; n++)
- for (m = 0; m <= 127; m++)
- {
- ft = s3_clock (m, n, r);
- if (s3_near (ft, f))
- printf ("m %d n %d r %d = %d\n",
- m, n, r, ft);
- dist = abs (f - ft);
- if (dist < min_dist)
- {
- min_dist = dist;
- min_m = m;
- min_n = n;
- min_r = r;
- }
- }
- printf ("m %d n %d r %d f %d dist %d\n",
- min_m, min_n, min_r, s3_clock(min_m, min_n, min_r), min_dist);
-}
diff --git a/hw/kdrive/savage/s3clock.c b/hw/kdrive/savage/s3clock.c
deleted file mode 100644
index e3286b8c2..000000000
--- a/hw/kdrive/savage/s3clock.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Id: s3clock.c,v 1.2 1999/11/02 06:16:29 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3clock.c,v 1.3 2000/02/23 20:30:02 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-/*
- * Clock synthesis:
- *
- * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R)))
- *
- * Constraints:
- *
- * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz
- * 2. N >= 1
- *
- * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank))
- * Horizontal refresh rate = clock / (hsize + hblank)
- */
-
-/* all in kHz */
-
-void
-s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco)
-{
- int M, N, R, bestM, bestN;
- int f_vco, f_out;
- int err, abserr, besterr;
-
- /*
- * Compute correct R value to keep VCO in range
- */
- for (R = 0; R <= maxR; R++)
- {
- f_vco = target * (1 << R);
- if (f_vco >= minVco)
- break;
- }
-
- /* M = f_out / f_ref * ((N + 2) * (1 << R)); */
- besterr = target;
- for (N = 1; N <= maxN; N++)
- {
- M = ((target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) + S3_CLOCK_REF/2) / S3_CLOCK_REF - 2;
- if (0 <= M && M <= maxM)
- {
- f_out = S3_CLOCK(M,N,R);
- err = target - f_out;
- if (err < 0)
- err = -err;
- if (err < besterr)
- {
- besterr = err;
- bestM = M;
- bestN = N;
- }
- }
- }
- *Mp = bestM;
- *Np = bestN;
- *Rp = R;
-}
diff --git a/hw/kdrive/savage/s3cmap.c b/hw/kdrive/savage/s3cmap.c
deleted file mode 100644
index f10ac5752..000000000
--- a/hw/kdrive/savage/s3cmap.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Id: s3cmap.c,v 1.2 1999/11/02 06:16:29 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.4 2000/05/06 22:17:45 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-void
-s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- S3Vga *s3vga = &s3c->s3vga;
-
- while (ndef--)
- {
- s3SetImm (s3vga, s3_dac_read_index, pdefs->pixel);
- pdefs->red = s3GetImm (s3vga, s3_dac_data) << 8;
- pdefs->green = s3GetImm (s3vga, s3_dac_data) << 8;
- pdefs->blue = s3GetImm (s3vga, s3_dac_data) << 8;
- pdefs++;
- }
-}
-
-#ifndef S3_TRIO
-#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
-
-void
-s3SetTrueChromaKey (ScreenPtr pScreen, int pfb, xColorItem *pdef)
-{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- KdScreenPriv(pScreen);
- s3ScreenInfo(pScreenPriv);
- int fb, ma;
- CARD32 key;
- int r, g, b;
-
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
- {
- fb = s3s->fbmap[ma];
- if (fb != pfb && pScreenPriv->screen->fb[fb].redMask)
- {
- r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
- g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
- b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
- key = ((Shift(pdef->red,r) & pScreenPriv->screen->fb[fb].redMask) |
- (Shift(pdef->green,g) & pScreenPriv->screen->fb[fb].greenMask) |
- (Shift(pdef->blue,b) & pScreenPriv->screen->fb[fb].blueMask));
- if (pScrPriv->layer[fb].key != key)
- {
- pScrPriv->layer[fb].key = key;
- (*pScrPriv->PaintKey) (&pScrPriv->layer[fb].u.run.pixmap->drawable,
- &pScrPriv->layer[pfb].u.run.region,
- pScrPriv->layer[fb].key, fb);
- }
- }
- }
-}
-#endif
-
-void
-s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- s3ScreenInfo(pScreenPriv);
- S3Vga *s3vga = &s3c->s3vga;
- xColorItem *chroma = 0;
- CARD32 key;
-
-#if 0
- _s3WaitVRetrace (s3vga);
-#else
- S3Ptr s3 = s3c->s3;
- _s3WaitVRetraceFast(s3);
-#endif
-#ifndef S3_TRIO
- if (pScreenPriv->screen->fb[1].depth)
- {
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- key = pScrPriv->layer[fb].key;
- }
-#endif
- else
- key = ~0;
- while (ndef--)
- {
- if (pdefs->pixel == key)
- chroma = pdefs;
- s3SetImm (s3vga, s3_dac_write_index, pdefs->pixel);
- s3SetImm (s3vga, s3_dac_data, pdefs->red >> 8);
- s3SetImm (s3vga, s3_dac_data, pdefs->green >> 8);
- s3SetImm (s3vga, s3_dac_data, pdefs->blue >> 8);
- pdefs++;
- }
-#ifndef S3_TRIO
- if (chroma && !pScreenPriv->closed)
- s3SetTrueChromaKey (pScreen, fb, chroma);
-#endif
-}
-
diff --git a/hw/kdrive/savage/s3curs.c b/hw/kdrive/savage/s3curs.c
deleted file mode 100644
index eae7f642b..000000000
--- a/hw/kdrive/savage/s3curs.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * Id: s3curs.c,v 1.2 1999/11/02 06:16:29 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3curs.c,v 1.3 2000/02/23 20:30:03 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-#include "s3draw.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- s3CardInfo(pScreenPriv); \
- s3ScreenInfo(pScreenPriv); \
- S3Ptr s3 = s3c->s3; \
- S3Vga *s3vga = &s3c->s3vga; \
- S3Cursor *pCurPriv = &s3s->cursor
-
-static void
-_s3MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- DRAW_DEBUG ((DEBUG_CURSOR, "s3MoveCursor %d %d", x, y));
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
-
- /* This is the recommended order to move the cursor */
-
- s3SetImm (s3vga, s3_cursor_xhigh, xhigh);
- s3SetImm (s3vga, s3_cursor_xlow, xlow);
- s3SetImm (s3vga, s3_cursor_ylow, ylow);
- s3SetImm (s3vga, s3_cursor_xoff, xoff);
- s3SetImm (s3vga, s3_cursor_yoff, yoff);
- s3SetImm (s3vga, s3_cursor_yhigh, yhigh);
-
- DRAW_DEBUG ((DEBUG_CURSOR, "s3MoveCursor done"));
-}
-
-static void
-s3MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _s3MoveCursor (pScreen, x, y);
-}
-
-#define S3Trunc(c) (((c) >> 8) & 0xff)
-
-#define S3CursColor(r,g,b) ((S3Trunc(r) << 16) | \
- (S3Trunc(g) << 8) | \
- (S3Trunc(b)))
-
-static void
-s3AllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
-
- if (s3s->use_streams)
- {
- pCurPriv->source = S3CursColor(pCursor->foreRed,
- pCursor->foreGreen,
- pCursor->foreBlue);
- pCurPriv->mask = S3CursColor(pCursor->backRed,
- pCursor->backGreen,
- pCursor->backBlue);
- }
- else
- {
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
- }
-}
-
-static void
-_s3SetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- /* set foreground */
- /* Reset cursor color stack pointers */
- (void) s3GetImm (s3vga, s3_cursor_enable);
- s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source);
- s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source >> 8);
- s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source >> 16);
-
- /* set background */
- /* Reset cursor color stack pointers */
- (void) s3GetImm (s3vga, s3_cursor_enable);
- s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask);
- s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask >> 8);
- s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask >> 16);
-}
-
-void
-s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- s3AllocCursorColors (pScreen);
- _s3SetCursorColors (pScreen);
-}
-
-static void
-s3LoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- unsigned char r[2], g[2], b[2];
- unsigned long *ram;
- unsigned long *msk, *mskLine, *src, *srcLine;
- unsigned long and, xor;
- int i, j;
- int cursor_address;
- int wsrc;
- unsigned char ramdac_control_;
-
- /*
- * Allocate new colors
- */
- s3AllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (unsigned long *) s3s->cursor_base;
- mskLine = (unsigned long *) bits->mask;
- srcLine = (unsigned long *) bits->source;
-
- h = bits->height;
- if (h > S3_CURSOR_HEIGHT)
- h = S3_CURSOR_HEIGHT;
-
- wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */
-
- for (i = 0; i < S3_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += wsrc;
- srcLine += wsrc;
- for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) {
-
- unsigned long m, s;
-
- if (i < h && j < wsrc)
- {
- m = *msk++;
- s = *src++;
- xor = m & s;
- and = ~m;
- }
- else
- {
- and = 0xffffffff;
- xor = 0x00000000;
- }
-
- S3AdjustBits32(and);
- S3AdjustBits32(xor);
-#define S3SwapNibbles(x) ((x) = (((x) & 0x0f0f0f0f) << 4 | \
- ((x) >> 4) & 0x0f0f0f0f))
- if (s3s->use_streams)
- {
- S3SwapNibbles(and);
- S3SwapNibbles(xor);
- }
- *ram++ = (and & 0xffff) | (xor << 16);
- *ram++ = (and >> 16) | (xor & 0xffff0000);
- }
- }
-
- _s3WaitIdle (s3);
-
- /* Set new color */
- _s3SetCursorColors (pScreen);
-
- /* Enable the cursor */
- s3SetImm (s3vga, s3_cursor_ms_x11, 0);
- s3SetImm (s3vga, s3_cursor_enable, 1);
-
- /* Wait for VRetrace to make sure the position is read */
- _s3WaitVRetrace (s3vga);
-
- /* Move to new position */
- _s3MoveCursor (pScreen, x, y);
-}
-
-static void
-s3UnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- /* Disable cursor */
- s3SetImm (s3vga, s3_cursor_enable, 0);
-}
-
-static Bool
-s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
-#ifdef FB_OLD_SCREEN
- short x, y;
-#else
- int x, y;
-#endif
-
- miPointerPosition (&x, &y);
- s3LoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- s3LoadCursor (pScreen, x, y);
- else
- s3UnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec s3PointerSpriteFuncs = {
- s3RealizeCursor,
- s3UnrealizeCursor,
- s3SetCursor,
- s3MoveCursor,
-};
-
-static void
-s3QueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-s3CursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!s3s->cursor_base)
- {
- DRAW_DEBUG ((DEBUG_CURSOR,"Not enough screen memory for cursor %d", s3d->memory));
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = S3_CURSOR_WIDTH;
- pCurPriv->height= S3_CURSOR_HEIGHT;
- pScreen->QueryBestSize = s3QueryBestSize;
- miPointerInitialize (pScreen,
- &s3PointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-s3CursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- DRAW_DEBUG ((DEBUG_INIT, "s3CursorEnable"));
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
-#ifdef FB_OLD_SCREEN
- short x, y;
-#else
- int x, y;
-#endif
-
- miPointerPosition (&x, &y);
- s3LoadCursor (pScreen, x, y);
- }
- else
- s3UnloadCursor (pScreen);
- }
-}
-
-void
-s3CursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- s3UnloadCursor (pScreen);
- }
- }
-}
-
-void
-s3CursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/savage/s3draw.c b/hw/kdrive/savage/s3draw.c
deleted file mode 100644
index cae765675..000000000
--- a/hw/kdrive/savage/s3draw.c
+++ /dev/null
@@ -1,3247 +0,0 @@
-/*
- * Id: s3draw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.6 2001/05/29 04:54:11 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-#include "s3draw.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-
-/*
- * Map X rops to S3 rops
- */
-
-short s3alu[16] = {
- MIX_0,
- MIX_AND,
- MIX_SRC_AND_NOT_DST,
- MIX_SRC,
- MIX_NOT_SRC_AND_DST,
- MIX_DST,
- MIX_XOR,
- MIX_OR,
- MIX_NOR,
- MIX_XNOR,
- MIX_NOT_DST,
- MIX_SRC_OR_NOT_DST,
- MIX_NOT_SRC,
- MIX_NOT_SRC_OR_DST,
- MIX_NAND,
- MIX_1
-};
-
-/*
- * Handle pixel transfers
- */
-
-#define BURST
-#ifdef BURST
-#define PixTransDeclare VOL32 *pix_trans_base = (VOL32 *) (s3c->registers),\
- *pix_trans = pix_trans_base
-#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 8192) pix_trans = pix_trans_base
-#define PixTransStore(t) *pix_trans++ = (t)
-#else
-#define PixTransDeclare VOL32 *pix_trans = &s3->pix_trans
-#define PixTransStart(n)
-#define PixTransStore(t) *pix_trans = (t)
-#endif
-
-int s3GCPrivateIndex;
-int s3WindowPrivateIndex;
-int s3Generation;
-
-/*
- s3DoBitBlt
- =============
- Bit Blit for all window to window blits.
-*/
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-void
-s3CopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupS3(pDstDrawable->pScreen);
- int srcX, srcY, dstX, dstY;
- int w, h;
- int flags;
-
- if (sourceInvarient (pGC->alu))
- {
- s3FillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask);
- return;
- }
-
- s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC));
- _s3SetBlt(s3,pGC->alu,pGC->planemask);
- DRAW_DEBUG ((DEBUG_RENDER, "s3CopyNtoN alu %d planemask 0x%x",
- pGC->alu, pGC->planemask));
- while (nbox--)
- {
- w = pbox->x2 - pbox->x1;
- h = pbox->y2 - pbox->y1;
- flags = 0;
- if (reverse)
- {
- dstX = pbox->x2 - 1;
- }
- else
- {
- dstX = pbox->x1;
- flags |= INC_X;
- }
- srcX = dstX + dx;
-
- if (upsidedown)
- {
- dstY = pbox->y2 - 1;
- }
- else
- {
- dstY = pbox->y1;
- flags |= INC_Y;
- }
- srcY = dstY + dy;
-
- _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags);
- pbox++;
- }
- MarkSyncS3 (pSrcDrawable->pScreen);
-}
-
-RegionPtr
-s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- SetupS3(pDstDrawable->pScreen);
-
- if (pSrcDrawable->type == DRAWABLE_WINDOW &&
- pDstDrawable->type == DRAWABLE_WINDOW)
- {
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, s3CopyNtoN, 0, 0);
- }
- return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty);
-}
-
-typedef struct _s31toNargs {
- unsigned long copyPlaneFG, copyPlaneBG;
- Bool opaque;
-} s31toNargs;
-
-void
-_s3Stipple (S3CardInfo *s3c,
- FbStip *psrcBase,
- FbStride widthSrc,
- int srcx,
- int srcy,
- int dstx,
- int dsty,
- int width,
- int height)
-{
- S3Ptr s3 = s3c->s3;
- FbStip *psrcLine, *psrc;
- FbStride widthRest;
- FbStip bits, tmp, lastTmp;
- int leftShift, rightShift;
- int nl, nlMiddle;
- int r;
- PixTransDeclare;
-
- /* Compute blt address and parameters */
- psrc = psrcBase + srcy * widthSrc + (srcx >> 5);
- nlMiddle = (width + 31) >> 5;
- leftShift = srcx & 0x1f;
- rightShift = 32 - leftShift;
- widthRest = widthSrc - nlMiddle;
-
- _s3PlaneBlt(s3,dstx,dsty,width,height);
-
- if (leftShift == 0)
- {
- while (height--)
- {
- nl = nlMiddle;
- PixTransStart(nl);
- while (nl--)
- {
- tmp = *psrc++;
- S3AdjustBits32 (tmp);
- PixTransStore (tmp);
- }
- psrc += widthRest;
- }
- }
- else
- {
- widthRest--;
- while (height--)
- {
- bits = *psrc++;
- nl = nlMiddle;
- PixTransStart(nl);
- while (nl--)
- {
- tmp = FbStipLeft(bits, leftShift);
- bits = *psrc++;
- tmp |= FbStipRight(bits, rightShift);
- S3AdjustBits32(tmp);
- PixTransStore (tmp);
- }
- psrc += widthRest;
- }
- }
-}
-
-void
-s3Copy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupS3(pDstDrawable->pScreen);
-
- s31toNargs *args = closure;
- int dstx, dsty;
- FbStip *psrcBase;
- FbStride widthSrc;
- int srcBpp;
- int srcXoff, srcYoff;
-
- if (args->opaque && sourceInvarient (pGC->alu))
- {
- s3FillBoxSolid (pDstDrawable, nbox, pbox,
- pGC->bgPixel, pGC->alu, pGC->planemask);
- return;
- }
-
- s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC));
- fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff);
-
- if (args->opaque)
- {
- _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask,args->copyPlaneFG,
- args->copyPlaneBG);
- }
- else
- {
- _s3SetTransparentPlaneBlt (s3, pGC->alu,
- pGC->planemask, args->copyPlaneFG);
- }
-
- while (nbox--)
- {
- dstx = pbox->x1;
- dsty = pbox->y1;
-
- _s3Stipple (s3c,
- psrcBase, widthSrc,
- dstx + dx - srcXoff, dsty + dy - srcYoff,
- dstx, dsty,
- pbox->x2 - dstx, pbox->y2 - dsty);
- pbox++;
- }
- MarkSyncS3 (pDstDrawable->pScreen);
-}
-
-RegionPtr
-s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- SetupS3 (pDstDrawable->pScreen);
- RegionPtr ret;
- s31toNargs args;
-
- if (pDstDrawable->type == DRAWABLE_WINDOW &&
- pSrcDrawable->depth == 1)
- {
- args.copyPlaneFG = pGC->fgPixel;
- args.copyPlaneBG = pGC->bgPixel;
- args.opaque = TRUE;
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, s3Copy1toN, bitPlane, &args);
- }
- return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, bitPlane);
-}
-
-void
-s3PushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y)
-{
- SetupS3 (pDrawable->pScreen);
- s31toNargs args;
-
- if (pDrawable->type == DRAWABLE_WINDOW && pGC->fillStyle == FillSolid)
- {
- args.opaque = FALSE;
- args.copyPlaneFG = pGC->fgPixel;
- (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC,
- 0, 0, w, h, x, y, s3Copy1toN, 1, &args);
- }
- else
- {
- KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
- }
-}
-
-void
-s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask)
-{
- SetupS3(pDrawable->pScreen);
- register int r;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable));
- _s3SetSolidFill(s3,pixel,alu,planemask);
-
- while (nBox--) {
- _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1);
- pBox++;
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-_s3SetPattern (ScreenPtr pScreen, int ma,
- int alu, unsigned long planemask, s3PatternPtr pPattern)
-{
- SetupS3(pScreen);
- S3PatternCache *cache;
-
- _s3LoadPattern (pScreen, ma, pPattern);
- cache = pPattern->cache;
-
- switch (pPattern->fillStyle) {
- case FillTiled:
- _s3SetTile(s3,alu,planemask);
- break;
- case FillStippled:
- _s3SetStipple(s3,alu,planemask,pPattern->fore);
- break;
- case FillOpaqueStippled:
- _s3SetOpaqueStipple(s3,alu,planemask,pPattern->fore,pPattern->back);
- break;
- }
-}
-
-void
-s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- int alu, unsigned long planemask, s3PatternPtr pPattern)
-{
- SetupS3(pDrawable->pScreen);
- S3PatternCache *cache;
- int patx, paty;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable));
- _s3SetPattern (pDrawable->pScreen, s3DrawMap(pDrawable), alu, planemask, pPattern);
- cache = pPattern->cache;
- while (nBox--)
- {
- _s3PatRect(s3,cache->x, cache->y,
- pBox->x1, pBox->y1,
- pBox->x2-pBox->x1, pBox->y2-pBox->y1);
- pBox++;
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-s3FillBoxLargeStipple (DrawablePtr pDrawable, GCPtr pGC,
- int nBox, BoxPtr pBox)
-{
- SetupS3(pDrawable->pScreen);
- DrawablePtr pStipple = &pGC->stipple->drawable;
- int xRot = pGC->patOrg.x + pDrawable->x;
- int yRot = pGC->patOrg.y + pDrawable->y;
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff;
- int stipWidth, stipHeight;
- int dstX, dstY, width, height;
-
- stipWidth = pStipple->width;
- stipHeight = pStipple->height;
- fbGetStipDrawable (pStipple, stip, stipStride, stipBpp, stipXoff, stipYoff);
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable));
- if (pGC->fillStyle == FillOpaqueStippled)
- {
- _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask,
- pGC->fgPixel, pGC->bgPixel);
-
- }
- else
- {
- _s3SetTransparentPlaneBlt(s3,pGC->alu,pGC->planemask, pGC->fgPixel);
- }
-
- while (nBox--)
- {
- int stipX, stipY, sx;
- int widthTmp;
- int h, w;
- int x, y;
-
- dstX = pBox->x1;
- dstY = pBox->y1;
- width = pBox->x2 - pBox->x1;
- height = pBox->y2 - pBox->y1;
- pBox++;
- modulus (dstY - yRot - stipYoff, stipHeight, stipY);
- modulus (dstX - xRot - stipXoff, stipWidth, stipX);
- y = dstY;
- while (height)
- {
- h = stipHeight - stipY;
- if (h > height)
- h = height;
- height -= h;
- widthTmp = width;
- x = dstX;
- sx = stipX;
- while (widthTmp)
- {
- w = (stipWidth - sx);
- if (w > widthTmp)
- w = widthTmp;
- widthTmp -= w;
- _s3Stipple (s3c,
- stip,
- stipStride,
- sx, stipY,
- x, y,
- w, h);
- x += w;
- sx = 0;
- }
- y += h;
- stipY = 0;
- }
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-#define NUM_STACK_RECTS 1024
-
-void
-s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
- s3GCPrivate(pGC);
- xRectangle *prect;
- RegionPtr prgnClip;
- register BoxPtr pbox;
- register BoxPtr pboxClipped;
- BoxPtr pboxClippedBase;
- BoxPtr pextent;
- BoxRec stackRects[NUM_STACK_RECTS];
- int numRects;
- int n;
- int xorg, yorg;
- int x, y;
-
- prgnClip = fbGetCompositeClip(pGC);
- 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)
- {
- if (pGC->fillStyle == FillSolid)
- s3FillBoxSolid(pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->fgPixel, pGC->alu, pGC->planemask);
- else if (s3Priv->pPattern)
- s3FillBoxPattern (pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->alu, pGC->planemask,
- s3Priv->pPattern);
- else
- s3FillBoxLargeStipple (pDrawable, pGC,
- pboxClipped-pboxClippedBase,
- pboxClippedBase);
- }
- if (pboxClippedBase != stackRects)
- DEALLOCATE_LOCAL(pboxClippedBase);
-}
-
-void
-_s3FillSpanLargeStipple (DrawablePtr pDrawable, GCPtr pGC,
- int n, DDXPointPtr ppt, int *pwidth)
-{
- SetupS3 (pDrawable->pScreen);
- DrawablePtr pStipple = &pGC->stipple->drawable;
- int xRot = pGC->patOrg.x + pDrawable->x;
- int yRot = pGC->patOrg.y + pDrawable->y;
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff;
- int stipWidth, stipHeight;
- int dstX, dstY, width, height;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- stipWidth = pStipple->width;
- stipHeight = pStipple->height;
- fbGetStipDrawable (pStipple, stip, stipStride, stipBpp, stipXoff, stipYoff);
- if (pGC->fillStyle == FillOpaqueStippled)
- {
- _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask,
- pGC->fgPixel, pGC->bgPixel);
-
- }
- else
- {
- _s3SetTransparentPlaneBlt(s3,pGC->alu,pGC->planemask, pGC->fgPixel);
- }
- while (n--)
- {
- int stipX, stipY, sx;
- int w;
- int x, y;
-
- dstX = ppt->x;
- dstY = ppt->y;
- ppt++;
- width = *pwidth++;
- modulus (dstY - yRot - stipYoff, stipHeight, stipY);
- modulus (dstX - xRot - stipXoff, stipWidth, stipX);
- y = dstY;
- x = dstX;
- sx = stipX;
- while (width)
- {
- w = (stipWidth - sx);
- if (w > width)
- w = width;
- width -= w;
- _s3Stipple (s3c,
- stip,
- stipStride,
- sx, stipY,
- x, y,
- w, 1);
- x += w;
- sx = 0;
- }
- }
-}
-
-void
-s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- s3GCPrivate(pGC);
- SetupS3(pDrawable->pScreen);
- int x, y, x1, y1, x2, y2;
- int width;
- /* next three parameters are post-clip */
- int nTmp;
- int *pwidthFree;/* copies of the pointers to free */
- DDXPointPtr pptFree;
- BoxPtr extents;
- S3PatternCache *cache;
- RegionPtr pClip = fbGetCompositeClip (pGC);
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- if (REGION_NUM_RECTS(pClip) == 1 &&
- (pGC->fillStyle == FillSolid || s3Priv->pPattern))
- {
- extents = REGION_RECTS(pClip);
- x1 = extents->x1;
- x2 = extents->x2;
- y1 = extents->y1;
- y2 = extents->y2;
- if (pGC->fillStyle == FillSolid)
- {
- _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask);
- cache = 0;
- }
- else
- {
- _s3SetPattern (pDrawable->pScreen, s3GCMap(pGC), pGC->alu, pGC->planemask,
- s3Priv->pPattern);
- cache = s3Priv->pPattern->cache;
- }
- while (n--)
- {
- y = ppt->y;
- if (y1 <= y && y < y2)
- {
- x = ppt->x;
- width = *pwidth;
- if (x < x1)
- {
- width -= (x1 - x);
- x = x1;
- }
- if (x2 < x + width)
- width = x2 - x;
- if (width > 0)
- {
- if (cache)
- {
- _s3PatRect(s3, cache->x, cache->y, x, y, width, 1);
- }
- else
- {
- _s3SolidRect(s3,x,y,width,1);
- }
- }
- }
- ppt++;
- pwidth++;
- }
- }
- else
- {
- nTmp = n * miFindMaxBand(pClip);
- pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
- pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) DEALLOCATE_LOCAL(pptFree);
- if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
- return;
- }
- n = miClipSpans(fbGetCompositeClip(pGC),
- ppt, pwidth, n,
- pptFree, pwidthFree, fSorted);
- pwidth = pwidthFree;
- ppt = pptFree;
- if (pGC->fillStyle == FillSolid)
- {
- _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask);
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ppt++;
- width = *pwidth++;
- if (width)
- {
- _s3SolidRect(s3,x,y,width,1);
- }
- }
- }
- else if (s3Priv->pPattern)
- {
- _s3SetPattern (pDrawable->pScreen, s3GCMap(pGC), pGC->alu, pGC->planemask,
- s3Priv->pPattern);
- cache = s3Priv->pPattern->cache;
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ppt++;
- width = *pwidth++;
- if (width)
- {
- _s3PatRect(s3, cache->x, cache->y, x, y, width, 1);
- }
- }
- }
- else
- {
- _s3FillSpanLargeStipple (pDrawable, pGC, n, ppt, pwidth);
- }
- DEALLOCATE_LOCAL(pptFree);
- DEALLOCATE_LOCAL(pwidthFree);
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-#include "mifillarc.h"
-
-#define FILLSPAN(s3,y,__x1,__x2) {\
- DRAW_DEBUG ((DEBUG_ARCS, "FILLSPAN %d: %d->%d", y, __x1, __x2)); \
- if ((__x2) >= (__x1)) {\
- _s3SolidRect(s3,(__x1),(y),(__x2)-(__x1)+1,1); \
- } \
-}
-
-#define FILLSLICESPANS(flip,__y) \
- if (!flip) \
- { \
- FILLSPAN(s3,__y,xl,xr) \
- } \
- else \
- { \
- xc = xorg - x; \
- FILLSPAN(s3, __y, xc, xr) \
- xc += slw - 1; \
- FILLSPAN(s3, __y, xl, xc) \
- }
-
-static void
-_s3FillEllipse (DrawablePtr pDraw, S3Ptr s3, xArc *arc)
-{
- KdScreenPriv(pDraw->pScreen);
- int x, y, e;
- int yk, xk, ym, xm, dx, dy, xorg, yorg;
- int y_top, y_bot;
- miFillArcRec info;
- register int xpos;
- int slw;
-
- s3SetGlobalBitmap (pDraw->pScreen, s3DrawMap (pDraw));
- miFillArcSetup(arc, &info);
- MIFILLARCSETUP();
- y_top = pDraw->y + yorg - y;
- y_bot = pDraw->y + yorg + y + dy;
- xorg += pDraw->x;
- while (y)
- {
- y_top++;
- y_bot--;
- MIFILLARCSTEP(slw);
- if (!slw)
- continue;
- xpos = xorg - x;
- _s3SolidRect (s3,xpos,y_top,slw,1);
- if (miFillArcLower(slw))
- _s3SolidRect (s3,xpos,y_bot,slw,1);
- }
-}
-
-
-static void
-_s3FillArcSlice (DrawablePtr pDraw, GCPtr pGC, S3Ptr s3, xArc *arc)
-{
- KdScreenPriv(pDraw->pScreen);
- int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
- register int x, y, e;
- miFillArcRec info;
- miArcSliceRec slice;
- int xl, xr, xc;
- int y_top, y_bot;
-
- s3SetGlobalBitmap (pDraw->pScreen, s3DrawMap (pDraw));
- DRAW_DEBUG ((DEBUG_ARCS, "slice %dx%d+%d+%d %d->%d",
- arc->width, arc->height, arc->x, arc->y,
- arc->angle1, arc->angle2));
- miFillArcSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- DRAW_DEBUG ((DEBUG_ARCS, "edge1.x %d edge2.x %d",
- slice.edge1.x, slice.edge2.x));
- MIFILLARCSETUP();
- DRAW_DEBUG ((DEBUG_ARCS, "xorg %d yorg %d",
- xorg, yorg));
- xorg += pDraw->x;
- yorg += pDraw->y;
- y_top = yorg - y;
- y_bot = yorg + y + dy;
- slice.edge1.x += pDraw->x;
- slice.edge2.x += pDraw->x;
- DRAW_DEBUG ((DEBUG_ARCS, "xorg %d y_top %d y_bot %d",
- xorg, y_top, y_bot));
- while (y > 0)
- {
- y_top++;
- y_bot--;
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- MIARCSLICEUPPER(xl, xr, slice, slw);
- FILLSLICESPANS(slice.flip_top, y_top);
- }
- if (miFillSliceLower(slice))
- {
- MIARCSLICELOWER(xl, xr, slice, slw);
- FILLSLICESPANS(slice.flip_bot, y_bot);
- }
- }
-}
-
-void
-s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
-{
- SetupS3(pDraw->pScreen);
- xArc *arc;
- int i;
- int x, y;
- BoxRec box;
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BOOL set;
-
- set = FALSE;
- for (; --narcs >= 0; parcs++)
- {
- if (miFillArcEmpty(parcs))
- continue;
- if (miCanFillArc(parcs))
- {
- box.x1 = parcs->x + pDraw->x;
- box.y1 = parcs->y + pDraw->y;
- box.x2 = box.x1 + (int)parcs->width + 1;
- box.y2 = box.y1 + (int)parcs->height + 1;
- switch (RECT_IN_REGION(pDraw->pScreen, pClip, &box))
- {
- case rgnIN:
- if (!set)
- {
- _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
- set = TRUE;
- }
- if ((parcs->angle2 >= FULLCIRCLE) ||
- (parcs->angle2 <= -FULLCIRCLE))
- {
- DRAW_DEBUG ((DEBUG_ARCS, "Full circle ellipse %dx%d",
- parcs->width, parcs->height));
- _s3FillEllipse (pDraw, s3, parcs);
- }
- else
- {
- DRAW_DEBUG ((DEBUG_ARCS, "Partial ellipse %dx%d",
- parcs->width, parcs->height));
- _s3FillArcSlice (pDraw, pGC, s3, parcs);
- }
- /* fall through ... */
- case rgnOUT:
- continue;
- case rgnPART:
- break;
- }
- }
- if (set)
- {
- MarkSyncS3 (pDraw->pScreen);
- set = FALSE;
- }
- KdCheckPolyFillArc(pDraw, pGC, 1, parcs);
- }
- if (set)
- {
- MarkSyncS3 (pDraw->pScreen);
- set = FALSE;
- }
-}
-
-void
-s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int countInit, DDXPointPtr ptsIn)
-{
- SetupS3(pDrawable->pScreen);
- int nwidth;
- int maxy;
- int origin;
- int count;
- register int vertex1, vertex2;
- int c;
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr extents;
- int clip;
- int y, sy;
- int *vertex1p, *vertex2p;
- int *endp;
- int x1, x2, sx;
- int dx1, dx2;
- int dy1, dy2;
- int e1, e2;
- int step1, step2;
- int sign1, sign2;
- int h;
- int l, r;
- int nmiddle;
-
- if (mode == CoordModePrevious || REGION_NUM_RECTS(pClip) != 1)
- {
- KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
- return;
- }
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- sy = pDrawable->y;
- sx = pDrawable->x;
- origin = *((int *) &pDrawable->x);
- origin -= (origin & 0x8000) << 1;
- extents = &pClip->extents;
- vertex1 = *((int *) &extents->x1) - origin;
- vertex2 = *((int *) &extents->x2) - origin - 0x00010001;
- clip = 0;
-
- y = 32767;
- maxy = 0;
- vertex2p = (int *) ptsIn;
- endp = vertex2p + countInit;
- if (shape == Convex)
- {
- count = countInit;
- while (count--)
- {
- c = *vertex2p;
- clip |= (c - vertex1) | (vertex2 - c);
- c = intToY(c);
- DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c));
- if (c < y)
- {
- y = c;
- vertex1p = vertex2p;
- }
- vertex2p++;
- if (c > maxy)
- maxy = c;
- }
- }
- else
- {
- int yFlip = 0;
- dx1 = 1;
- x2 = -1;
- x1 = -1;
- count = countInit;
- while (count--)
- {
- c = *vertex2p;
- clip |= (c - vertex1) | (vertex2 - c);
- c = intToY(c);
- DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c));
- if (c < y)
- {
- y = c;
- vertex1p = vertex2p;
- }
- vertex2p++;
- if (c > maxy)
- maxy = c;
- if (c == x1)
- continue;
- if (dx1 > 0)
- {
- if (x2 < 0)
- x2 = c;
- else
- dx2 = dx1 = (c - x1) >> 31;
- }
- else
- if ((c - x1) >> 31 != dx1)
- {
- dx1 = ~dx1;
- yFlip++;
- }
- x1 = c;
- }
- x1 = (x2 - c) >> 31;
- if (x1 != dx1)
- yFlip++;
- if (x1 != dx2)
- yFlip++;
- if (yFlip != 2)
- clip = 0x8000;
- }
- if (y == maxy)
- return;
-
- if (clip & 0x80008000)
- {
- KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
- return;
- }
- _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask);
-
- vertex2p = vertex1p;
- vertex2 = vertex1 = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
-#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
- x = intToX(vertex); \
- if (dy = intToY(c) - y) { \
- dx = intToX(c) - x; \
- step = 0; \
- if (dx >= 0) \
- { \
- e = 0; \
- sign = 1; \
- if (dx >= dy) {\
- step = dx / dy; \
- dx = dx % dy; \
- } \
- } \
- else \
- { \
- e = 1 - dy; \
- sign = -1; \
- dx = -dx; \
- if (dx >= dy) { \
- step = - (dx / dy); \
- dx = dx % dy; \
- } \
- } \
- } \
- x += sx; \
- vertex = c; \
-}
-
-#define Step(x,dx,dy,e,sign,step) {\
- x += step; \
- if ((e += dx) > 0) \
- { \
- x += sign; \
- e -= dy; \
- } \
-}
- sy += y;
- DRAW_DEBUG ((DEBUG_POLYGON, "Starting polygon at %d", sy));
- for (;;)
- {
- DRAW_DEBUG ((DEBUG_POLYGON, "vertex1 0x%x vertex2 0x%x y %d vy1 %d vy2 %d",
- vertex1, vertex2,
- y, intToY(vertex1), intToY (vertex2)));
- if (y == intToY(vertex1))
- {
- DRAW_DEBUG ((DEBUG_POLYGON, "Find next -- vertext"));
- do
- {
- if (vertex1p == (int *) ptsIn)
- vertex1p = endp;
- c = *--vertex1p;
- Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1);
- DRAW_DEBUG ((DEBUG_POLYGON, "-- vertex 0x%x y %d",
- vertex1, intToY(vertex1)));
- } while (y >= intToY(vertex1));
- h = dy1;
- }
- else
- {
- Step(x1,dx1,dy1,e1,sign1,step1)
- h = intToY(vertex1) - y;
- }
- if (y == intToY(vertex2))
- {
- DRAW_DEBUG ((DEBUG_POLYGON, "Find next ++ vertext"));
- do
- {
- c = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
- Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
- DRAW_DEBUG ((DEBUG_POLYGON, "++ vertex 0x%x y %d",
- vertex1, intToY(vertex1)));
- } while (y >= intToY(vertex2));
- if (dy2 < h)
- h = dy2;
- }
- else
- {
- Step(x2,dx2,dy2,e2,sign2,step2)
- if ((c = (intToY(vertex2) - y)) < h)
- h = c;
- }
- DRAW_DEBUG ((DEBUG_POLYGON, "This band %d", h));
- /* fill spans for this segment */
- for (;;)
- {
- nmiddle = x2 - x1;
- DRAW_DEBUG ((DEBUG_POLYGON, "This span %d->%d", x1, x2));
- if (nmiddle)
- {
- l = x1;
- if (nmiddle < 0)
- {
- nmiddle = -nmiddle;
- l = x2;
- }
- _s3SolidRect(s3,l,sy,nmiddle,1);
- }
- y++;
- sy++;
- if (!--h)
- break;
- Step(x1,dx1,dy1,e1,sign1,step1)
- Step(x2,dx2,dy2,e2,sign2,step2)
- }
- if (y == maxy)
- break;
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-s3PolyGlyphBltClipped (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- SetupS3(pDrawable->pScreen);
- int h;
- int w;
- int xBack, yBack;
- int hBack, wBack;
- int lw;
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- unsigned long *bits;
- BoxPtr extents;
- BoxRec bbox;
- CARD32 b;
- CharInfoPtr *ppci;
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pBox;
- int nbox;
- int x1, y1, x2, y2;
- unsigned char alu;
- Bool set;
- PixTransDeclare;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- x += pDrawable->x;
- y += pDrawable->y;
-
- if (pglyphBase == (pointer) 1)
- {
- xBack = x;
- yBack = y - FONTASCENT(pGC->font);
- wBack = 0;
- hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- if (hBack)
- {
- h = nglyph;
- ppci = ppciInit;
- while (h--)
- wBack += (*ppci++)->metrics.characterWidth;
- }
- if (wBack < 0)
- {
- xBack = xBack + wBack;
- wBack = -wBack;
- }
- if (hBack < 0)
- {
- yBack = yBack + hBack;
- hBack = -hBack;
- }
- alu = GXcopy;
- }
- else
- {
- wBack = 0;
- alu = pGC->alu;
- }
-
- if (wBack)
- {
- _s3SetSolidFill (s3, pGC->bgPixel, GXcopy, pGC->planemask);
- for (nbox = REGION_NUM_RECTS (pClip),
- pBox = REGION_RECTS (pClip);
- nbox--;
- pBox++)
- {
- x1 = xBack;
- x2 = xBack + wBack;
- y1 = yBack;
- y2 = yBack + hBack;
- if (x1 < pBox->x1) x1 = pBox->x1;
- if (x2 > pBox->x2) x2 = pBox->x2;
- if (y1 < pBox->y1) y1 = pBox->y1;
- if (y2 > pBox->y2) y2 = pBox->y2;
- if (x1 < x2 && y1 < y2)
- {
- _s3SolidRect (s3, x1, y1, x2 - x1, y2 - y1);
- }
- }
- MarkSyncS3 (pDrawable->pScreen);
- }
- ppci = ppciInit;
- set = FALSE;
- while (nglyph--)
- {
- pci = *ppci++;
- h = pci->metrics.ascent + pci->metrics.descent;
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- x1 = x + pci->metrics.leftSideBearing;
- y1 = y - pci->metrics.ascent;
- bbox.x1 = x1;
- bbox.y1 = y1;
- bbox.x2 = x1 + w;
- bbox.y2 = y1 + h;
- switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox))
- {
- case rgnIN:
-#if 1
- lw = h * ((w + 31) >> 5);
- if (lw)
- {
- if (!set)
- {
- _s3SetTransparentPlaneBlt (s3, alu, pGC->planemask, pGC->fgPixel);
- set = TRUE;
- }
- _s3PlaneBlt(s3,
- x + pci->metrics.leftSideBearing,
- y - pci->metrics.ascent,
- w, h);
- bits = (unsigned long *) pci->bits;
- PixTransStart (lw);
- while (lw--)
- {
- b = *bits++;
- S3AdjustBits32 (b);
- PixTransStore(b);
- }
- MarkSyncS3 (pDrawable->pScreen);
- }
- break;
-#endif
- case rgnPART:
- set = FALSE;
- CheckSyncS3 (pDrawable->pScreen);
- fbPutXYImage (pDrawable,
- pClip,
- fbPriv->fg,
- fbPriv->bg,
- fbPriv->pm,
- alu,
- FALSE,
- x1, y1,
- w, h,
- (FbStip *) pci->bits,
- (w + 31) >> 5,
- 0);
- break;
- case rgnOUT:
- break;
- }
- x += pci->metrics.characterWidth;
- }
-}
-
-/*
- * Blt glyphs using S3 image transfer register, this does both
- * poly glyph blt and image glyph blt (when pglyphBase == 1)
- */
-
-void
-s3PolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- SetupS3(pDrawable->pScreen);
- int h;
- int w;
- int xBack, yBack;
- int hBack, wBack;
- int lw;
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- unsigned long *bits;
- BoxPtr extents;
- BoxRec bbox;
- CARD32 b;
- CharInfoPtr *ppci;
- unsigned char alu;
- PixTransDeclare;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- x += pDrawable->x;
- y += pDrawable->y;
-
- /* compute an approximate (but covering) bounding box */
- ppci = ppciInit;
- w = 0;
- h = nglyph;
- while (h--)
- w += (*ppci++)->metrics.characterWidth;
- if (w < 0)
- {
- bbox.x1 = x + w;
- bbox.x2 = x;
- }
- else
- {
- bbox.x1 = x;
- bbox.x2 = x + w;
- }
- w = FONTMINBOUNDS(pfont,leftSideBearing);
- if (w < 0)
- bbox.x1 += w;
- w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth);
- if (w > 0)
- bbox.x2 += w;
- bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent);
- bbox.y2 = y + FONTMAXBOUNDS(pfont,descent);
-
- DRAW_DEBUG ((DEBUG_TEXT, "PolyGlyphBlt %d box is %d %d", nglyph,
- bbox.x1, bbox.x2));
- switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox))
- {
- case rgnIN:
- break;
- case rgnPART:
- s3PolyGlyphBltClipped(pDrawable, pGC, x - pDrawable->x,
- y - pDrawable->y,
- nglyph, ppciInit, pglyphBase);
- case rgnOUT:
- return;
- }
-
- if (pglyphBase == (pointer) 1)
- {
- xBack = x;
- yBack = y - FONTASCENT(pGC->font);
- wBack = 0;
- hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- if (hBack)
- {
- h = nglyph;
- ppci = ppciInit;
- while (h--)
- wBack += (*ppci++)->metrics.characterWidth;
- }
- if (wBack < 0)
- {
- xBack = xBack + wBack;
- wBack = -wBack;
- }
- if (hBack < 0)
- {
- yBack = yBack + hBack;
- hBack = -hBack;
- }
- alu = GXcopy;
- }
- else
- {
- wBack = 0;
- alu = pGC->alu;
- }
-
- if (wBack)
- {
- _s3SetSolidFill (s3, pGC->bgPixel, GXcopy, pGC->planemask);
- _s3SolidRect (s3, xBack, yBack, wBack, hBack);
- }
- _s3SetTransparentPlaneBlt (s3, alu, pGC->planemask, pGC->fgPixel);
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- h = pci->metrics.ascent + pci->metrics.descent;
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- lw = h * ((w + 31) >> 5);
- if (lw)
- {
- _s3PlaneBlt(s3,
- x + pci->metrics.leftSideBearing,
- y - pci->metrics.ascent,
- w, h);
- bits = (unsigned long *) pci->bits;
- PixTransStart(lw);
- while (lw--)
- {
- b = *bits++;
- S3AdjustBits32 (b);
- PixTransStore(b);
- }
- }
- x += pci->metrics.characterWidth;
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-s3ImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- s3PolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1);
-}
-
-/*
- * Blt TE fonts using S3 image transfer. Differs from
- * above in that it doesn't need to fill a solid rect for
- * the background and it can draw multiple characters at a time
- */
-
-void
-s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- SetupS3(pDrawable->pScreen);
- int x, y;
- int h, lw, lwTmp;
- int w;
- FontPtr pfont = pGC->font;
- unsigned long *char1, *char2, *char3, *char4;
- int widthGlyphs, widthGlyph;
- BoxRec bbox;
- CARD32 tmp;
- PixTransDeclare;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
- if (!widthGlyph)
- return;
-
- h = FONTASCENT(pfont) + FONTDESCENT(pfont);
- if (!h)
- return;
-
- DRAW_DEBUG ((DEBUG_TEXT, "ImageTEGlyphBlt chars are %d %d",
- widthGlyph, h));
-
- x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x;
- y = yInit - FONTASCENT(pfont) + pDrawable->y;
-
- bbox.x1 = x;
- bbox.x2 = x + (widthGlyph * nglyph);
- bbox.y1 = y;
- bbox.y2 = y + h;
-
- switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox))
- {
- case rgnIN:
- break;
- case rgnPART:
- if (pglyphBase == (pointer) 1)
- pglyphBase = 0;
- else
- pglyphBase = (pointer) 1;
- s3PolyGlyphBltClipped(pDrawable, pGC,
- xInit,
- yInit,
- nglyph, ppci,
- pglyphBase);
- case rgnOUT:
- return;
- }
-
- if (pglyphBase == (pointer) 1)
- {
- _s3SetTransparentPlaneBlt (s3, pGC->alu, pGC->planemask, pGC->fgPixel);
- }
- else
- {
- _s3SetOpaquePlaneBlt (s3, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel);
- }
-
-#if BITMAP_BIT_ORDER == LSBFirst
-#define SHIFT <<
-#else
-#define SHIFT >>
-#endif
-
-#define LoopIt(count, w, loadup, fetch) \
- while (nglyph >= count) \
- { \
- nglyph -= count; \
- _s3PlaneBlt (s3, x, y, w, h); \
- x += w; \
- loadup \
- lwTmp = h; \
- PixTransStart(h); \
- while (lwTmp--) { \
- tmp = fetch; \
- S3AdjustBits32(tmp); \
- PixTransStore(tmp); \
- } \
- }
-
- if (widthGlyph <= 8)
- {
- widthGlyphs = widthGlyph << 2;
- LoopIt(4, widthGlyphs,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;
- char4 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | ((*char3++ | (*char4++
- SHIFT widthGlyph))
- SHIFT widthGlyph))
- SHIFT widthGlyph)))
- }
- else if (widthGlyph <= 10)
- {
- widthGlyphs = (widthGlyph << 1) + widthGlyph;
- LoopIt(3, widthGlyphs,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph)))
- }
- else if (widthGlyph <= 16)
- {
- widthGlyphs = widthGlyph << 1;
- LoopIt(2, widthGlyphs,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | (*char2++ SHIFT widthGlyph)))
- }
- lw = h * ((widthGlyph + 31) >> 5);
- while (nglyph--)
- {
- _s3PlaneBlt (s3, x, y, widthGlyph, h);
- x += widthGlyph;
- char1 = (unsigned long *) (*ppci++)->bits;
- lwTmp = lw;
- PixTransStart(lw);
- while (lwTmp--)
- {
- tmp = *char1++;
- S3AdjustBits32(tmp);
- PixTransStore(tmp);
- }
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y,
- unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- s3ImageTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1);
-}
-
-Bool
-_s3Segment (DrawablePtr pDrawable,
- GCPtr pGC,
- int x1,
- int y1,
- int x2,
- int y2,
- Bool drawLast,
- Bool s3Set)
-{
- SetupS3(pDrawable->pScreen);
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pBox;
- int nBox;
- int adx; /* abs values of dx and dy */
- int ady;
- int signdx; /* sign of dx and dy */
- int signdy;
- int e, e1, e2; /* bresenham error and increments */
- int len; /* length of segment */
- int axis; /* major axis */
- int octant;
- int cmd;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- unsigned int oc1; /* outcode of point 1 */
- unsigned int oc2; /* outcode of point 2 */
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
- 1, 1, octant);
-
- cmd = LASTPIX;
-
- if (adx > ady)
- {
- axis = X_AXIS;
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- len = adx;
- }
- else
- {
- cmd |= YMAJAXIS;
- axis = Y_AXIS;
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- SetYMajorOctant(octant);
- len = ady;
- }
-
- /* S3 line drawing hardware has limited resolution for error terms */
- if (len >= 4096)
- {
- int dashOff = 0;
-
- KdCheckSync (pDrawable->pScreen);
- fbSegment (pDrawable, pGC, x1, y1, x2, y2, drawLast, &dashOff);
- return FALSE;
- }
-
- FIXUP_ERROR (e, octant, bias);
-
- nBox = REGION_NUM_RECTS (pClip);
- pBox = REGION_RECTS (pClip);
-
- if (signdx > 0)
- cmd |= INC_X;
- if (signdy > 0)
- cmd |= INC_Y;
-
- /* we have bresenham parameters and two points.
- all we have to do now is clip and draw.
- */
-
- if (drawLast)
- len++;
- while(nBox--)
- {
- oc1 = 0;
- oc2 = 0;
- OUTCODES(oc1, x1, y1, pBox);
- OUTCODES(oc2, x2, y2, pBox);
- if ((oc1 | oc2) == 0)
- {
- if (!s3Set)
- {
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
- s3Set = TRUE;
- }
- _s3SetCur (s3, x1, y1);
- _s3ClipLine (s3, cmd, e1, e2, e, len);
- break;
- }
- else if (oc1 & oc2)
- {
- pBox++;
- }
- else
- {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int clipdx, clipdy;
- int err;
-
- if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2-1,
- pBox->y2-1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pBox++;
- continue;
- }
-
- if (axis == X_AXIS)
- len = abs(new_x2 - new_x1);
- else
- len = abs(new_y2 - new_y1);
- if (clip2 != 0 || drawLast)
- len++;
- if (len)
- {
- /* unwind bresenham error term to first point */
- err = e;
- if (clip1)
- {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- if (axis == X_AXIS)
- err += (e2 - e1) * clipdy + e1 * clipdx;
- else
- err += (e2 - e1) * clipdx + e1 * clipdy;
- }
- if (!s3Set)
- {
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
- s3Set = TRUE;
- }
- _s3SetCur (s3, new_x1, new_y1);
- _s3ClipLine (s3, cmd, e1, e2, err, len);
- }
- pBox++;
- }
- } /* while (nBox--) */
- return s3Set;
-}
-
-void
-s3Polylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt)
-{
- SetupS3(pDrawable->pScreen);
- int x, y, nx, ny;
- int ox = pDrawable->x, oy = pDrawable->y;
- Bool s3Set = FALSE;
-
- if (!npt)
- return;
-
- x = ppt->x + ox;
- y = ppt->y + oy;
- while (--npt)
- {
- ++ppt;
- if (mode == CoordModePrevious)
- {
- nx = x + ppt->x;
- ny = y + ppt->y;
- }
- else
- {
- nx = ppt->x + ox;
- ny = ppt->y + oy;
- }
- s3Set = _s3Segment (pDrawable, pGC, x, y, nx, ny,
- npt == 1 && pGC->capStyle != CapNotLast,
- s3Set);
- x = nx;
- y = ny;
- }
- if (s3Set)
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-s3PolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit)
-{
- SetupS3(pDrawable->pScreen);
- int x, y;
- int ox = pDrawable->x, oy = pDrawable->y;
- RegionPtr pClip = fbGetCompositeClip (pGC);
- BoxPtr pBox;
- int nbox;
- int nseg;
- xSegment *pSeg;
- int dx, dy;
- int maj, min, len, inc;
- int t;
- CARD32 cmd;
- CARD32 init_cmd;
- Bool drawLast;
- Bool s3Set = FALSE;
-
- drawLast = pGC->capStyle != CapNotLast;
-
- for (nseg = nsegInit, pSeg = pSegInit; nseg--; pSeg++)
- {
- s3Set = _s3Segment (pDrawable, pGC, pSeg->x1 + ox, pSeg->y1 + oy,
- pSeg->x2 + ox, pSeg->y2 + oy, drawLast, s3Set);
-
- }
- if (s3Set)
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-/*
- * Check to see if a pattern can be painted with the S3
- */
-
-#define _s3CheckPatternSize(s) ((s) <= S3_TILE_SIZE && ((s) & ((s) - 1)) == 0)
-#define s3CheckPattern(w,h) (_s3CheckPatternSize(w) && _s3CheckPatternSize(h))
-
-Bool
-s3AllocPattern (ScreenPtr pScreen,
- int ma,
- PixmapPtr pPixmap,
- int xorg, int yorg,
- int fillStyle, Pixel fg, Pixel bg,
- s3PatternPtr *ppPattern)
-{
- KdScreenPriv(pScreen);
- s3ScreenInfo(pScreenPriv);
- s3PatternPtr pPattern;
-
- if (s3s->fb[ma].patterns.cache && fillStyle != FillSolid &&
- s3CheckPattern (pPixmap->drawable.width, pPixmap->drawable.height))
- {
- if (!(pPattern = *ppPattern))
- {
- pPattern = (s3PatternPtr) xalloc (sizeof (s3PatternRec));
- if (!pPattern)
- return FALSE;
- *ppPattern = pPattern;
- }
-
- pPattern->cache = 0;
- pPattern->id = 0;
- pPattern->pPixmap = pPixmap;
- pPattern->fillStyle = fillStyle;
- pPattern->xrot = (-xorg) & (S3_TILE_SIZE-1);
- pPattern->yrot = (-yorg) & (S3_TILE_SIZE-1);
- pPattern->fore = fg;
- pPattern->back = bg;
- return TRUE;
- }
- else
- {
- if (*ppPattern)
- {
- xfree (*ppPattern);
- *ppPattern = 0;
- }
- return FALSE;
- }
-}
-
-void
-s3CheckGCFill (GCPtr pGC)
-{
- s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC);
- PixmapPtr pPixmap;
-
- switch (pGC->fillStyle) {
- case FillSolid:
- pPixmap = 0;
- break;
- case FillOpaqueStippled:
- case FillStippled:
- pPixmap = pGC->stipple;
- break;
- case FillTiled:
- pPixmap = pGC->tile.pixmap;
- break;
- }
- s3AllocPattern (pGC->pScreen,
- s3GCMap(pGC),
- pPixmap,
- pGC->patOrg.x + pGC->lastWinOrg.x,
- pGC->patOrg.y + pGC->lastWinOrg.y,
- pGC->fillStyle, pGC->fgPixel, pGC->bgPixel,
- &s3Priv->pPattern);
-}
-
-void
-s3MoveGCFill (GCPtr pGC)
-{
- s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC);
- int xorg, yorg;
- s3PatternPtr pPattern;
-
- if (pPattern = s3Priv->pPattern)
- {
- /*
- * Reset origin
- */
- xorg = pGC->patOrg.x + pGC->lastWinOrg.x;
- yorg = pGC->patOrg.y + pGC->lastWinOrg.y;
- pPattern->xrot = (-xorg) & (S3_TILE_SIZE - 1);
- pPattern->yrot = (-yorg) & (S3_TILE_SIZE - 1);
- /*
- * Invalidate cache entry
- */
- pPattern->id = 0;
- pPattern->cache = 0;
- }
-}
-
-/*
- * S3 Patterns. These are always full-depth images, stored in off-screen
- * memory.
- */
-
-Pixel
-s3FetchPatternPixel (s3PatternPtr pPattern, int x, int y)
-{
- CARD8 *src;
- CARD16 *src16;
- CARD32 *src32;
- PixmapPtr pPixmap = pPattern->pPixmap;
-
- x = (x + pPattern->xrot) % pPixmap->drawable.width;
- y = (y + pPattern->yrot) % pPixmap->drawable.height;
- src = (CARD8 *) pPixmap->devPrivate.ptr + y * pPixmap->devKind;
- switch (pPixmap->drawable.bitsPerPixel) {
- case 1:
- return (src[x>>3] >> (x & 7)) & 1 ? 0xffffffff : 0x00;
- case 4:
- if (x & 1)
- return src[x>>1] >> 4;
- else
- return src[x>>1] & 0xf;
- case 8:
- return src[x];
- case 16:
- src16 = (CARD16 *) src;
- return src16[x];
- case 32:
- src32 = (CARD32 *) src;
- return src32[x];
- }
-}
-
-/*
- * Place pattern image on screen; done with S3 locked
- */
-void
-_s3PutPattern (ScreenPtr pScreen, int ma, s3PatternPtr pPattern)
-{
- SetupS3(pScreen);
- s3ScreenInfo(pScreenPriv);
- int x, y;
- CARD8 *dstLine, *dst8;
- CARD16 *dst16;
- CARD32 *dst32;
- S3PatternCache *cache = pPattern->cache;
-#ifdef S3_TRIO
- int fb = 0;
-#else
- int fb = s3s->fbmap[ma];
-#endif
-
- DRAW_DEBUG ((DEBUG_PATTERN, "_s3PutPattern 0x%x id %d to %d %d",
- pPattern, pPattern->id, cache->x, cache->y));
-
- dstLine = (pScreenPriv->screen->fb[fb].frameBuffer +
- cache->y * pScreenPriv->screen->fb[fb].byteStride +
- cache->x * pScreenPriv->bytesPerPixel[fb]);
-
- CheckSyncS3 (pScreen);
-
- for (y = 0; y < S3_TILE_SIZE; y++)
- {
- switch (pScreenPriv->screen->fb[fb].bitsPerPixel) {
- case 8:
- dst8 = dstLine;
- for (x = 0; x < S3_TILE_SIZE; x++)
- *dst8++ = s3FetchPatternPixel (pPattern, x, y);
- DRAW_DEBUG ((DEBUG_PATTERN, "%c%c%c%c%c%c%c%c",
- dstLine[0] ? 'X' : ' ',
- dstLine[1] ? 'X' : ' ',
- dstLine[2] ? 'X' : ' ',
- dstLine[3] ? 'X' : ' ',
- dstLine[4] ? 'X' : ' ',
- dstLine[5] ? 'X' : ' ',
- dstLine[6] ? 'X' : ' ',
- dstLine[7] ? 'X' : ' '));
- break;
- case 16:
- dst16 = (CARD16 *) dstLine;
- for (x = 0; x < S3_TILE_SIZE; x++)
- *dst16++ = s3FetchPatternPixel (pPattern, x, y);
- break;
- case 32:
- dst32 = (CARD32 *) dstLine;
- for (x = 0; x < S3_TILE_SIZE; x++)
- *dst32++ = s3FetchPatternPixel (pPattern, x, y);
- break;
- }
- dstLine += pScreenPriv->screen->fb[fb].byteStride;
- }
-}
-
-/*
- * Load a stipple to off-screen memory; done with S3 locked
- */
-void
-_s3LoadPattern (ScreenPtr pScreen, int ma, s3PatternPtr pPattern)
-{
- SetupS3(pScreen);
- s3ScreenInfo(pScreenPriv);
- S3PatternCache *cache;
-
- DRAW_DEBUG((DEBUG_PATTERN,
- "s3LoadPattern 0x%x id %d cache 0x%x cacheid %d",
- pPattern, pPattern->id, pPattern->cache,
- pPattern->cache ? pPattern->cache->id : -1));
- /*
- * Check to see if its still loaded
- */
- cache = pPattern->cache;
- if (cache && cache->id == pPattern->id)
- return;
- /*
- * Lame replacement strategy; assume we'll have plenty of room.
- */
- cache = &s3s->fb[ma].patterns.cache[s3s->fb[ma].patterns.last_used];
- if (++s3s->fb[ma].patterns.last_used == s3s->fb[ma].patterns.ncache)
- s3s->fb[ma].patterns.last_used = 0;
- cache->id = ++s3s->fb[ma].patterns.last_id;
- pPattern->id = cache->id;
- pPattern->cache = cache;
- _s3PutPattern (pScreen, ma, pPattern);
-}
-
-void
-s3DestroyGC (GCPtr pGC)
-{
- s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC);
-
- if (s3Priv->pPattern)
- xfree (s3Priv->pPattern);
- miDestroyGC (pGC);
-}
-
-GCFuncs s3GCFuncs = {
- s3ValidateGC,
- miChangeGC,
- miCopyGC,
- s3DestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-int
-s3CreateGC (GCPtr pGC)
-{
- KdScreenPriv(pGC->pScreen);
- s3ScreenInfo(pScreenPriv);
- s3PrivGCPtr s3Priv;
-
- if (!fbCreateGC (pGC))
- return FALSE;
-
- if (pGC->depth != 1)
- pGC->funcs = &s3GCFuncs;
-
- s3Priv = s3GetGCPrivate(pGC);
- s3Priv->type = DRAWABLE_PIXMAP;
- s3Priv->pPattern = 0;
-#ifndef S3_TRIO
- if (pGC->depth == s3s->primary_depth)
- s3Priv->ma = 0;
- else
- s3Priv->ma = 1;
-#endif
- return TRUE;
-}
-
-Bool
-s3CreateWindow (WindowPtr pWin)
-{
- KdScreenPriv(pWin->drawable.pScreen);
- s3ScreenInfo(pScreenPriv);
-
- pWin->devPrivates[s3WindowPrivateIndex].ptr = 0;
- return KdCreateWindow (pWin);
-}
-
-Bool
-s3DestroyWindow (WindowPtr pWin)
-{
- s3PatternPtr pPattern;
- if (pPattern = s3GetWindowPrivate(pWin))
- xfree (pPattern);
- return fbDestroyWindow (pWin);
-}
-
-Bool
-s3ChangeWindowAttributes (WindowPtr pWin, Mask mask)
-{
- KdScreenPriv(pWin->drawable.pScreen);
- Bool ret;
- s3PatternPtr pPattern;
- PixmapPtr pPixmap;
- int fillStyle;
-
- ret = fbChangeWindowAttributes (pWin, mask);
- if (mask & CWBackPixmap)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- {
- pPixmap = pWin->background.pixmap;
- fillStyle = FillTiled;
- }
- else
- {
- pPixmap = 0;
- fillStyle = FillSolid;
- }
- pPattern = s3GetWindowPrivate(pWin);
- s3AllocPattern (pWin->drawable.pScreen,
- s3DrawMap (&pWin->drawable),
- pPixmap,
- pWin->drawable.x, pWin->drawable.y,
- fillStyle, 0, 0, &pPattern);
- DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "Background pattern 0x%x pixmap 0x%x style %d",
- pPattern, pPixmap, fillStyle));
- s3SetWindowPrivate (pWin, pPattern);
- }
- return ret;
-}
-
-
-#ifndef S3_TRIO
-void
-s3PaintKey (DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int fb)
-{
- SetupS3 (pDrawable->pScreen);
- s3ScreenInfo (pScreenPriv);
- int nBox = REGION_NUM_RECTS(pRegion);
- BoxPtr pBox = REGION_RECTS(pRegion);
- int ma;
-
- if (!nBox)
- return;
-
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
- if (s3s->fbmap[ma] == fb)
- break;
- s3SetGlobalBitmap (pDrawable->pScreen, ma);
- _s3SetSolidFill (s3, pixel, GXcopy, 0xffffffff);
- while (nBox--)
- {
- _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1);
- pBox++;
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-#endif
-
-void
-s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
-{
- SetupS3(pWin->drawable.pScreen);
- s3ScreenInfo(pScreenPriv);
- s3PatternPtr pPattern;
-
- DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "s3PaintWindow 0x%x extents %d %d %d %d n %d",
- pWin->drawable.id,
- pRegion->extents.x1, pRegion->extents.y1,
- pRegion->extents.x2, pRegion->extents.y2,
- REGION_NUM_RECTS(pRegion)));
- if (!REGION_NUM_RECTS(pRegion))
- return;
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixmap:
- pPattern = s3GetWindowPrivate(pWin);
- if (pPattern)
- {
- s3FillBoxPattern ((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- GXcopy, ~0, pPattern);
- return;
- }
- break;
- case BackgroundPixel:
- s3FillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->background.pixel, GXcopy, ~0);
- return;
- }
- break;
- case PW_BORDER:
-#ifndef S3_TRIO
- if (s3s->fbmap[1] >= 0)
- fbOverlayUpdateLayerRegion (pWin->drawable.pScreen,
- fbOverlayWindowLayer (pWin),
- pRegion);
-#endif
- if (pWin->borderIsPixel)
- {
- s3FillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->border.pixel, GXcopy, ~0);
- return;
- }
- break;
- }
- KdCheckPaintWindow (pWin, pRegion, what);
-}
-
-void
-s3CopyWindowProc (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pboxOrig,
- int nboxOrig,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupS3(pDstDrawable->pScreen);
- s3ScreenInfo(pScreenPriv);
- KdScreenInfo *screen = pScreenPriv->screen;
- int srcX, srcY, dstX, dstY;
- int x1, x2;
- int w, h;
- int flags;
- int fb = (int) closure;
- int ma;
- BoxPtr pbox;
- int nbox;
- int bitsPerPixel;
-
-#ifdef S3_TRIO
- ma = 0;
-#else
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
- if (s3s->fbmap[ma] == fb)
- break;
-#endif
- bitsPerPixel = screen->fb[fb].bitsPerPixel;
- if (bitsPerPixel == 24)
- dx *= 3;
- nbox = nboxOrig;
- pbox = pboxOrig;
- s3SetGlobalBitmap (pDstDrawable->pScreen, ma);
- _s3SetBlt(s3,GXcopy,~0);
- while (nbox--)
- {
- x1 = pbox->x1;
- x2 = pbox->x2;
- if (bitsPerPixel == 24)
- {
- x1 *= 3;
- x2 *= 3;
- }
-
- w = x2 - x1;
- h = pbox->y2 - pbox->y1;
- flags = 0;
- if (reverse)
- {
- dstX = x2 - 1;
- }
- else
- {
- dstX = x1;
- flags |= INC_X;
- }
- srcX = dstX + dx;
-
- if (upsidedown)
- {
- dstY = pbox->y2 - 1;
- }
- else
- {
- dstY = pbox->y1;
- flags |= INC_Y;
- }
- srcY = dstY + dy;
-
- _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags);
- pbox++;
- }
- MarkSyncS3 (pDstDrawable->pScreen);
-}
-
-void
-s3CopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdScreenPriv (pScreen);
- s3ScreenInfo (pScreenPriv);
- KdScreenInfo *screen = pScreenPriv->screen;
- RegionRec rgnDst;
- int dx, dy;
- WindowPtr pwinRoot;
-
- pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
-
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst,
- &pWin->borderClip, prgnSrc);
-
- fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- 0,
- &rgnDst, dx, dy, s3CopyWindowProc, 0, 0);
-
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-void
-s3_24FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask)
-{
- SetupS3(pDrawable->pScreen);
- register int r;
- int x1, x2;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable));
- _s3SetSolidFill(s3,pixel,alu,planemask);
-
- while (nBox--) {
- x1 = pBox->x1 * 3;
- x2 = pBox->x2 * 3;
- _s3SolidRect(s3,x1,pBox->y1,x2-x1,pBox->y2-pBox->y1);
- pBox++;
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-#define ok24(p) (((p) & 0xffffff) == ((((p) & 0xff) << 16) | (((p) >> 8) & 0xffff)))
-
-void
-s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- SetupS3(pDrawable->pScreen);
- int x, y, x1, y1, x2, y2;
- int width;
- /* next three parameters are post-clip */
- int nTmp;
- int *pwidthFree;/* copies of the pointers to free */
- DDXPointPtr pptFree;
- BoxPtr extents;
- RegionPtr pClip = fbGetCompositeClip (pGC);
-
- if (pGC->fillStyle != FillSolid || !ok24 (pGC->fgPixel) || !ok24(pGC->planemask))
- {
- KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
- }
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- if (REGION_NUM_RECTS(pClip) == 1)
- {
- extents = REGION_RECTS(pClip);
- x1 = extents->x1;
- x2 = extents->x2;
- y1 = extents->y1;
- y2 = extents->y2;
- _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask);
- while (n--)
- {
- y = ppt->y;
- if (y1 <= y && y < y2)
- {
- x = ppt->x;
- width = *pwidth;
- if (x < x1)
- {
- width -= (x1 - x);
- x = x1;
- }
- if (x2 < x + width)
- width = x2 - x;
- if (width > 0)
- {
- _s3SolidRect(s3,x*3,y,width*3,1);
- }
- }
- ppt++;
- pwidth++;
- }
- }
- else
- {
- nTmp = n * miFindMaxBand(pClip);
- pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
- pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) DEALLOCATE_LOCAL(pptFree);
- if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
- return;
- }
- n = miClipSpans(fbGetCompositeClip(pGC),
- ppt, pwidth, n,
- pptFree, pwidthFree, fSorted);
- pwidth = pwidthFree;
- ppt = pptFree;
- _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask);
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ppt++;
- width = *pwidth++;
- if (width)
- {
- _s3SolidRect(s3,x*3,y,width*3,1);
- }
- }
- DEALLOCATE_LOCAL(pptFree);
- DEALLOCATE_LOCAL(pwidthFree);
- }
- MarkSyncS3 (pDrawable->pScreen);
-}
-
-void
-s3_24CopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupS3(pDstDrawable->pScreen);
- int srcX, srcY, dstX, dstY;
- int w, h;
- int flags;
- int x1, x2;
-
- if (sourceInvarient (pGC->alu))
- {
- s3_24FillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask);
- return;
- }
-
- s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC));
- _s3SetBlt(s3,pGC->alu,pGC->planemask);
- DRAW_DEBUG ((DEBUG_RENDER, "s3CopyNtoN alu %d planemask 0x%x",
- pGC->alu, pGC->planemask));
- dx *= 3;
- while (nbox--)
- {
- x1 = pbox->x1 * 3;
- x2 = pbox->x2 * 3;
- w = x2 - x1;
- h = pbox->y2 - pbox->y1;
- flags = 0;
- if (reverse)
- {
- dstX = x2 - 1;
- }
- else
- {
- dstX = x1;
- flags |= INC_X;
- }
- srcX = dstX + dx;
-
- if (upsidedown)
- {
- dstY = pbox->y2 - 1;
- }
- else
- {
- dstY = pbox->y1;
- flags |= INC_Y;
- }
- srcY = dstY + dy;
-
- _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags);
- pbox++;
- }
- MarkSyncS3 (pSrcDrawable->pScreen);
-}
-
-RegionPtr
-s3_24CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- SetupS3(pDstDrawable->pScreen);
-
- if (pSrcDrawable->type == DRAWABLE_WINDOW &&
- pDstDrawable->type == DRAWABLE_WINDOW &&
- ok24(pGC->planemask))
- {
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, s3_24CopyNtoN, 0, 0);
- }
- return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty);
-}
-
-
-#define NUM_STACK_RECTS 1024
-
-void
-s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
- s3GCPrivate(pGC);
- xRectangle *prect;
- RegionPtr prgnClip;
- register BoxPtr pbox;
- register BoxPtr pboxClipped;
- BoxPtr pboxClippedBase;
- BoxPtr pextent;
- BoxRec stackRects[NUM_STACK_RECTS];
- int numRects;
- int n;
- int xorg, yorg;
- int x, y;
-
- if (pGC->fillStyle != FillSolid || !ok24 (pGC->fgPixel) || !ok24(pGC->planemask))
- {
- KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit);
- return;
- }
-
- prgnClip = fbGetCompositeClip(pGC);
- 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)
- {
- s3_24FillBoxSolid(pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->fgPixel, pGC->alu, pGC->planemask);
- }
- if (pboxClippedBase != stackRects)
- DEALLOCATE_LOCAL(pboxClippedBase);
-}
-
-void
-s3_24SolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
- FbBits fg)
-{
- SetupS3 (pDrawable->pScreen);
- BoxPtr pbox;
- int nbox;
- int partX1, partX2, partY1, partY2;
-
- s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable));
- _s3SetSolidFill(s3,fg,GXcopy,~0);
-
- for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
- nbox--;
- pbox++)
- {
- partX1 = pbox->x1;
- if (partX1 < x1)
- partX1 = x1;
-
- partX2 = pbox->x2;
- if (partX2 > x2)
- partX2 = x2;
-
- if (partX2 <= partX1)
- continue;
-
- partY1 = pbox->y1;
- if (partY1 < y1)
- partY1 = y1;
-
- partY2 = pbox->y2;
- if (partY2 > y2)
- partY2 = y2;
-
- if (partY2 <= partY1)
- continue;
-
- partX1 *= 3;
- partX2 *= 3;
- _s3SolidRect(s3,partX1, partY1, partX2-partX1, partY2-partY1);
- }
- MarkSyncS3(pDrawable->pScreen);
-}
-
-void
-s3_24ImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- Bool opaque;
- int n;
- int gx, gy;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbBits depthMask;
- int xBack, widthBack;
- int yBack, heightBack;
-
- depthMask = FbFullMask(pDrawable->depth);
- if (!ok24 (pGC->fgPixel) ||
- !ok24(pGC->bgPixel) ||
- !ok24(pGC->planemask))
- {
- KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
- return;
- }
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- ppci = ppciInit;
- n = nglyph;
- widthBack = 0;
- while (n--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
- xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT(pGC->font);
- heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- s3_24SolidBoxClipped (pDrawable,
- fbGetCompositeClip(pGC),
- xBack,
- yBack,
- xBack + widthBack,
- yBack + heightBack,
- pPriv->bg);
-
- KdCheckSync (pDrawable->pScreen);
-
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- fbGlyph24 (dst + (gy - dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->fg,
- gx - dstXoff,
- gHeight);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- GXcopy,
- FALSE,
-
- gx,
- gy,
- gWidth, gHeight,
-
- (FbStip *) pglyph,
- gStride,
- 0);
- }
- }
- x += pci->metrics.characterWidth;
- }
-}
-
-static const GCOps s3_24GCOps = {
- s3_24FillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- KdCheckCopyArea,
- KdCheckCopyPlane,
- KdCheckPolyPoint,
- KdCheckPolylines,
- KdCheckPolySegment,
- KdCheckPolyRectangle,
- KdCheckPolyArc,
- KdCheckFillPolygon,
- s3_24PolyFillRect,
- KdCheckPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- s3_24ImageGlyphBlt,
- KdCheckPolyGlyphBlt,
- KdCheckPushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-void
-s3_24ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- if (pDrawable->type != DRAWABLE_WINDOW)
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
- else
- pGC->ops = (GCOps *) &s3_24GCOps;
- fbValidateGC (pGC, changes, pDrawable);
-}
-
-GCFuncs s3_24GCFuncs = {
- s3_24ValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-Bool
-s3_24CreateGC (GCPtr pGC)
-{
- if (!fbCreateGC (pGC))
- return FALSE;
-
- if (pGC->depth != 1)
- pGC->funcs = &s3_24GCFuncs;
-
- return TRUE;
-}
-
-Bool
-s3_24CreateWindow(WindowPtr pWin)
-{
- return fbCreateWindow (pWin);
-}
-
-void
-s3_24PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
-{
- SetupS3(pWin->drawable.pScreen);
- s3PatternPtr pPattern;
-
- DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "s3PaintWindow 0x%x extents %d %d %d %d n %d",
- pWin->drawable.id,
- pRegion->extents.x1, pRegion->extents.y1,
- pRegion->extents.x2, pRegion->extents.y2,
- REGION_NUM_RECTS(pRegion)));
- if (!REGION_NUM_RECTS(pRegion))
- return;
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixel:
- if (ok24(pWin->background.pixel))
- {
- s3_24FillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->background.pixel, GXcopy, ~0);
- return;
- }
- }
- break;
- case PW_BORDER:
- if (pWin->borderIsPixel && ok24(pWin->border.pixel))
- {
- s3_24FillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->border.pixel, GXcopy, ~0);
- return;
- }
- break;
- }
- KdCheckPaintWindow (pWin, pRegion, what);
-}
-
-Bool
-s3DrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- s3ScreenInfo(pScreenPriv);
- int ncache_w, ncache_h, ncache;
- int px, py;
- S3PatternCache *cache;
- Bool dumb = FALSE;
- int ma;
-
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 8:
- case 16:
- case 32:
- break;
- case 24:
- dumb = TRUE;
- break;
- default:
- return FALSE;
- }
- /*
- * Hook up asynchronous drawing
- */
- RegisterSync (pScreen);
- /*
- * Replace various fb screen functions
- */
- if (dumb)
- {
- pScreen->CreateGC = s3_24CreateGC;
- pScreen->CreateWindow = s3_24CreateWindow;
- pScreen->PaintWindowBackground = s3_24PaintWindow;
- pScreen->PaintWindowBorder = s3_24PaintWindow;
- pScreen->CopyWindow = s3CopyWindow;
- }
- else
- {
- if (serverGeneration != s3Generation)
- {
- s3GCPrivateIndex = AllocateGCPrivateIndex ();
- s3WindowPrivateIndex = AllocateWindowPrivateIndex ();
- s3Generation = serverGeneration;
- }
- if (!AllocateWindowPrivate(pScreen, s3WindowPrivateIndex, 0))
- return FALSE;
- if (!AllocateGCPrivate(pScreen, s3GCPrivateIndex, sizeof (s3PrivGCRec)))
- return FALSE;
- pScreen->CreateGC = s3CreateGC;
- pScreen->CreateWindow = s3CreateWindow;
- pScreen->ChangeWindowAttributes = s3ChangeWindowAttributes;
- pScreen->DestroyWindow = s3DestroyWindow;
- pScreen->PaintWindowBackground = s3PaintWindow;
- pScreen->PaintWindowBorder = s3PaintWindow;
-#ifndef S3_TRIO
- if (pScreenPriv->screen->fb[1].depth)
- {
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
-
- pScrPriv->PaintKey = s3PaintKey;
- pScrPriv->CopyWindow = s3CopyWindowProc;
- pScreen->CopyWindow = fbOverlayCopyWindow;
- }
- else
-#endif
- pScreen->CopyWindow = s3CopyWindow;
-
- /*
- * Initialize patterns
- */
-#ifdef S3_TRIO
- ma = 0;
-#else
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
-#endif
- {
- ncache_w = s3s->fb[ma].offscreen_width / S3_TILE_SIZE;
- ncache_h = s3s->fb[ma].offscreen_height / S3_TILE_SIZE;
- ncache = ncache_w * ncache_h;
- if (ncache > 64)
- ncache = 64;
- DRAW_DEBUG ((DEBUG_S3INIT, "ncache_w %d ncache_h %d ncache %d",
- ncache_w, ncache_h, ncache));
- s3s->fb[ma].patterns.cache = (S3PatternCache *) xalloc (ncache * sizeof (S3PatternCache));
- if (s3s->fb[ma].patterns.cache)
- {
- DRAW_DEBUG ((DEBUG_S3INIT, "Have pattern cache"));
- s3s->fb[ma].patterns.ncache = ncache;
- s3s->fb[ma].patterns.last_used = 0;
- s3s->fb[ma].patterns.last_id = 0;
- cache = s3s->fb[ma].patterns.cache;
- for (py = 0; py < ncache_h && ncache; py++)
- for (px = 0; px < ncache_w && ncache; px++)
- {
- cache->id = 0;
- cache->x = s3s->fb[ma].offscreen_x + px * S3_TILE_SIZE;
- cache->y = s3s->fb[ma].offscreen_y + py * S3_TILE_SIZE;
- cache++;
- ncache--;
- }
- }
- }
- }
- return TRUE;
-}
-
-void
-s3DrawEnable (ScreenPtr pScreen)
-{
- SetupS3(pScreen);
- s3ScreenInfo(pScreenPriv);
- int c;
- int ma;
-
- s3SetGlobalBitmap (pScreen, 0);
- _s3WaitIdleEmpty (s3);
- if (pScreenPriv->screen->fb[0].bitsPerPixel == 24)
- {
- _s3SetScissorsTl(s3, 0, 0);
- _s3SetScissorsBr(s3, pScreenPriv->screen->width*3 - 1, pScreenPriv->screen->height - 1);
- _s3SetSolidFill(s3, pScreen->whitePixel, GXcopy, ~0);
- _s3SolidRect (s3, 0, 0, pScreenPriv->screen->width*3, pScreenPriv->screen->height);
- }
- else
- {
- /*
- * Flush pattern cache
- */
-#ifdef S3_TRIO
- ma = 0;
-#else
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
-#endif
- {
- for (c = 0; c < s3s->fb[ma].patterns.ncache; c++)
- s3s->fb[ma].patterns.cache[c].id = 0;
- }
-
- _s3SetScissorsTl(s3, 0, 0);
- _s3SetScissorsBr(s3, pScreenPriv->screen->width - 1, pScreenPriv->screen->height - 1);
- _s3SetSolidFill(s3, pScreen->blackPixel, GXcopy, ~0);
- _s3SolidRect (s3, 0, 0, pScreenPriv->screen->width, pScreenPriv->screen->height);
- }
- MarkSyncS3 (pScreen);
-}
-
-void
-s3DrawDisable (ScreenPtr pScreen)
-{
- SetupS3 (pScreen);
- _s3WaitIdleEmpty (s3);
-}
-
-void
-s3DrawFini (ScreenPtr pScreen)
-{
- SetupS3(pScreen);
- s3ScreenInfo(pScreenPriv);
- int ma;
-
-#ifdef S3_TRIO
- ma = 0;
-#else
- for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
-#endif
- {
- if (s3s->fb[ma].patterns.cache)
- {
- xfree (s3s->fb[ma].patterns.cache);
- s3s->fb[ma].patterns.cache = 0;
- s3s->fb[ma].patterns.ncache = 0;
- }
- }
-}
-
-void
-s3DrawSync (ScreenPtr pScreen)
-{
- SetupS3(pScreen);
-
- _s3WaitIdleEmpty(s3c->s3);
-}
diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h
deleted file mode 100644
index a95b53b12..000000000
--- a/hw/kdrive/savage/s3draw.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Id: s3draw.h,v 1.2 1999/11/02 06:16:29 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.4 2000/05/06 22:17:47 keithp Exp $ */
-
-#ifndef _S3DRAW_H_
-#define _S3DRAW_H_
-
-extern int s3GCPrivateIndex;
-extern int s3WindowPrivateIndex;
-
-typedef struct _s3Pattern {
- S3PatternCache *cache;
- int id;
- PixmapPtr pPixmap;
- int fillStyle;
- int xrot, yrot;
- unsigned int fore, back;
-} s3PatternRec, *s3PatternPtr;
-
-typedef struct _s3PrivGC {
- int type; /* type of drawable validated against */
- int ma; /* stream descriptor */
- s3PatternPtr pPattern; /* pattern */
-} s3PrivGCRec, *s3PrivGCPtr;
-
-#define s3GetGCPrivate(g) ((s3PrivGCPtr) \
- (g)->devPrivates[s3GCPrivateIndex].ptr)
-
-#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g)
-
-#define s3GetWindowPrivate(w) ((s3PatternPtr) \
- (w)->devPrivates[s3WindowPrivateIndex].ptr)
-
-#define s3SetWindowPrivate(w,p) (\
- (w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p)
-
-void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern);
-
-#define SetupS3(s) KdScreenPriv(s); \
- s3CardInfo(pScreenPriv); \
- S3Ptr s3 = s3c->s3
-
-#ifdef S3_SYNC_DEBUG
-#define SYNC_DEBUG() fprintf (stderr, "Sync at %s:%d\n", __FILE__,__LINE__)
-#else
-#define SYNC_DEBUG()
-#endif
-
-#define S3_ASYNC
-#ifdef S3_ASYNC
-#define CheckSyncS3(s) KdCheckSync(s)
-#define MarkSyncS3(s) KdMarkSync(s)
-#define RegisterSync(screen) KdScreenInitAsync (screen)
-#else
-#define CheckSyncS3(s3c)
-#define MarkSyncS3(s3c) _s3WaitIdleEmpty(s3c->s3)
-#define RegisterSync(screen)
-#endif
-
-#define WIDEN(x) ((unsigned long) (x))
-#define MERGE(a,b) ((WIDEN(a) << 16) | WIDEN(b))
-
-#define s3BitmapDescriptor(_stream) ((_stream) + 1)
-
-#ifdef S3_TRIO
-#define s3DrawMap(pDraw) 0
-#define s3SetGlobalBitmap(s,d)
-#else
-#define s3DrawMap(pDraw) ((pDraw)->depth == \
- getS3ScreenInfo(pScreenPriv)->primary_depth ? 0 : 1)
-#endif
-
-#define s3GCMap(pGC) (s3GetGCPrivate(pGC)->ma)
-
-/*
- * Ok, so the S3 is broken -- it expects bitmaps to come MSB bit order,
- * but it's willing to take them in LSB byte order. These macros
- * flip bits around without flipping bytes. Instead of using a table
- * and burning memory bandwidth, do them in place with the CPU.
- */
-
-/* The MIPS compiler automatically places these constants in registers */
-#define S3InvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-#define S3InvertBits16(v) { \
- v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \
- v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \
- v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \
-}
-
-#define S3InvertBits8(v) { \
- v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \
- v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \
- v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \
-}
-
-#define S3ByteSwap32(x) ((x) = (((x) >> 24) | \
- (((x) >> 8) & 0xff00) | \
- (((x) << 8) & 0xff0000) | \
- ((x) << 24)))
-
-#define S3ByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8))
-
-#if BITMAP_BIT_ORDER == LSBFirst
-#define S3AdjustBits32(x) S3InvertBits32(x)
-#define S3AdjustBits16(x) S3InvertBits16(x)
-#else
-#define S3AdjustBits32(x) S3ByteSwap32(x)
-#define S3AdjustBits16(x) S3ByteSwap16(x)
-#endif
-
-#define _s3WaitSlot(s3) _s3WaitSlots(s3,1)
-
-#define _s3SetFg(s3,_fg) { \
- DRAW_DEBUG ((DEBUG_REGISTERS, " fg <- 0x%x", _fg));\
- s3->fg = (_fg); \
-}
-
-#define _s3SetBg(s3,_bg) { \
- DRAW_DEBUG ((DEBUG_REGISTERS, " bg <- 0x%x", _bg));\
- s3->bg = (_bg); \
-}
-
-#define _s3SetWriteMask(s3,_mask) {\
- DRAW_DEBUG((DEBUG_REGISTERS," write_mask <- 0x%x", _mask)); \
- s3->write_mask = (_mask); \
-}
-
-#define _s3SetReadMask(s3,_mask) {\
- DRAW_DEBUG((DEBUG_REGISTERS," read_mask <- 0x%x", _mask)); \
- s3->read_mask = (_mask); \
-}
-
-#define _s3SetPixelControl(s3,_ctl) { \
- DRAW_DEBUG((DEBUG_REGISTERS, " pix_cntl <- 0x%x", PIX_CNTL | (_ctl))); \
- s3->pix_cntl_mult_misc2 = MERGE (CONTROL_MISC2, PIX_CNTL | (_ctl)); \
-}
-
-#define _s3SetFgMix(s3,_mix) { \
- DRAW_DEBUG((DEBUG_REGISTERS, " fg_mix <- 0x%x", _mix)); \
- s3->enh_fg_mix = (_mix); \
-}
-
-#define _s3SetBgMix(s3,_mix) { \
- DRAW_DEBUG((DEBUG_REGISTERS, " bg_mix <- 0x%x", _mix)); \
- s3->enh_bg_mix = (_mix); \
-}
-
-#define _s3SetMix(s3,fg_mix,bg_mix) { \
- DRAW_DEBUG((DEBUG_REGISTERS, " alt_mix <- 0x%x", MERGE(fg_mix,bg_mix))); \
- s3->alt_mix = MERGE(fg_mix,bg_mix); \
-}
-
-#define _s3SetCur(s3,_x,_y) { \
- DRAW_DEBUG ((DEBUG_REGISTERS, " alt_curxy <- 0x%x", MERGE(_x,_y))); \
- s3->alt_curxy = MERGE(_x,_y); \
-}
-
-#define _s3SetStep(s3,_x,_y) { \
- DRAW_DEBUG ((DEBUG_REGISTERS, " alt_step <- 0x%x", MERGE(_x,_y))); \
- s3->alt_step = MERGE(_x,_y); \
-}
-
-#define _s3SetErr(s3,_e) { \
- DRAW_DEBUG ((DEBUG_REGISTERS, " err_term <- 0x%x", _e)); \
- s3->err_term = (_e); \
-}
-
-#define _s3SetPcnt(s3,_x,_y) { \
- DRAW_DEBUG ((DEBUG_REGISTERS, " alt_pcnt <- 0x%x", MERGE(_x,_y))); \
- s3->alt_pcnt = MERGE(_x,_y); \
-}
-
-#define _s3SetScissorsTl(s3,t,l) {\
- DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_tl <- 0x%x", MERGE(t,l))); \
- s3->scissors_tl = MERGE(t,l); \
-}
-
-#define _s3SetScissorsBr(s3,b,r) {\
- DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_br <- 0x%x", MERGE(b,r))); \
- s3->scissors_br = MERGE(b,r); \
-}
-
-#define _s3CmdWait(s3)
-
-#define _s3SetCmd(s3,_cmd) { \
- DRAW_DEBUG((DEBUG_REGISTERS, " cmd <- 0x%x", _cmd)); \
- _s3CmdWait(s3); \
- s3->cmd_gp_stat = (_cmd); \
- /* { CARD32 __junk__; __junk__ = s3->cmd_gp_stat; } */ \
-}
-
-#define _s3SetSolidFill(s3,pix,alu,mask) { \
- DRAW_DEBUG((DEBUG_SET,"set fill 0x%x %d 0x%x",pix,alu,mask)); \
- _s3WaitSlots(s3,4); \
- _s3SetFg (s3, pix); \
- _s3SetWriteMask(s3,mask); \
- _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL | MIX_SRC); \
- _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-#define _s3SolidRect(s3,x,y,w,h) {\
- DRAW_DEBUG((DEBUG_RENDER,"solid rect %d,%d %dx%d",x,y,w,h)); \
- _s3WaitSlots(s3,3); \
- _s3SetCur(s3, x, y); \
- _s3SetPcnt (s3, (w)-1, (h)-1); \
- _s3SetCmd (s3, CMD_RECT|INC_X|INC_Y|DRAW|WRTDATA); \
- DRAW_DEBUG((DEBUG_RENDER," done")); \
-}
-
-#define _s3SolidLine(s3,maj,min,len,cmd) { \
- DRAW_DEBUG ((DEBUG_RENDER, "solid line 0x%x 0x%x 0x%x", maj, min, cmd)); \
- _s3WaitSlots(s3,4); \
- _s3SetPcnt(s3, (len), 0); \
- _s3SetStep(s3, 2*((min) - (maj)), 2*(min)); \
- _s3SetErr(s3, 2*(min) - (maj)); \
- _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \
-}
-
-#define _s3ClipLine(s3,cmd,e1,e2,e,len) {\
- DRAW_DEBUG ((DEBUG_RENDER, "clip line 0x%x 0x%x 0x%x 0x%x 0x%x", cmd,e1,e2,e,len)); \
- _s3WaitSlots(s3, 4); \
- _s3SetPcnt (s3, (len), 0); \
- _s3SetStep (s3, e2, e1); \
- _s3SetErr (s3, e); \
- _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \
-}
-
-#define _s3SetTile(s3,alu,mask) { \
- DRAW_DEBUG ((DEBUG_SET,"set tile %d 0x%x", alu, mask)); \
- _s3WaitSlots(s3,3); \
- _s3SetWriteMask(s3, mask); \
- _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT|s3alu[alu]); \
- _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-/*
- * For some reason, MIX_DST doesn't work in this mode; use MIX_OR with
- * an explicit 0 pixel value
- */
-#define _s3SetStipple(s3,alu,mask,_fg) {\
- DRAW_DEBUG ((DEBUG_SET,"set stipple 0x%x %d 0x%x", _fg, alu, mask)); \
- _s3WaitSlots(s3,5); \
- _s3SetFg (s3, _fg); \
- _s3SetBg (s3, 0); \
- _s3SetWriteMask(s3,mask); \
- _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|MIX_OR); \
- _s3SetPixelControl (s3, MIXSEL_EXPBLT); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-#define _s3SetOpaqueStipple(s3,alu,mask,_fg,_bg) {\
- DRAW_DEBUG ((DEBUG_SET,"set opaque stipple 0x%x 0x%x %d 0x%x", _fg, _bg, alu, mask)); \
- _s3WaitSlots(s3,5); \
- _s3SetFg (s3, _fg); \
- _s3SetBg (s3, _bg); \
- _s3SetWriteMask(s3,mask); \
- _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \
- _s3SetPixelControl (s3, MIXSEL_EXPBLT); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-#define _s3PatRect(s3,px,py,x,y,w,h) {\
- DRAW_DEBUG ((DEBUG_RENDER, "pat rect %d,%d %dx%d", x,y,w,h)); \
- _s3WaitSlots(s3, 4); \
- _s3SetCur (s3, px, py); \
- _s3SetStep (s3, x, y); \
- _s3SetPcnt (s3, (w)-1, (h)-1); \
- _s3SetCmd (s3, CMD_PATBLT|INC_X|INC_Y|DRAW|PLANAR|WRTDATA); \
- DRAW_DEBUG((DEBUG_RENDER," done")); \
-}
-
-#define _s3SetBlt(s3,alu,mask) { \
- DRAW_DEBUG ((DEBUG_SET,"set blt %d 0x%x", alu, mask)); \
- _s3WaitSlots(s3,3); \
- _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \
- _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT | s3alu[alu]); \
- _s3SetWriteMask(s3, mask); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-#define _s3Blt(s3,_sx,_sy,_dx,_dy,_w,_h,_dir) { \
- DRAW_DEBUG ((DEBUG_RENDER, "blt %d,%d -> %d,%d %dx%d 0x%x", \
- _sx,_sy,_dx,_dy,_w,_h,_dir)); \
- _s3WaitSlots(s3,4); \
- _s3SetCur(s3,_sx,_sy); \
- _s3SetStep(s3,_dx,_dy); \
- _s3SetPcnt(s3,(_w)-1,(_h)-1); \
- _s3SetCmd (s3, CMD_BITBLT | (_dir) | DRAW | WRTDATA); \
- DRAW_DEBUG((DEBUG_RENDER," done")); \
-}
-
-#define _s3SetOpaquePlaneBlt(s3,alu,mask,_fg,_bg) {\
- DRAW_DEBUG ((DEBUG_SET,"set opaque plane blt 0x%x 0x%x %d 0x%x", \
- _fg, _bg, alu, mask)); \
- /* _s3WaitSlots(s3, 5); */ \
- _s3WaitIdleEmpty (s3); \
- _s3SetFg(s3,_fg); \
- _s3SetBg(s3,_bg); \
- _s3SetWriteMask(s3,mask); \
- _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \
- _s3SetPixelControl(s3,MIXSEL_EXPPC); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-#define _s3SetTransparentPlaneBlt(s3,alu,mask,_fg) {\
- DRAW_DEBUG ((DEBUG_SET,"set transparent plane blt 0x%x %d 0x%x", \
- _fg, alu, mask)); \
- /*_s3WaitSlots(s3, 4); */ \
- _s3WaitIdleEmpty (s3); \
- _s3SetFg(s3,_fg); \
- _s3SetWriteMask(s3,mask); \
- _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|MIX_DST); \
- _s3SetPixelControl(s3,MIXSEL_EXPPC); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-/* Across the plane blt */
-#define _s3PlaneBlt(s3,x,y,w,h) {\
- DRAW_DEBUG ((DEBUG_RENDER, "plane blt %d,%d %dx%d", x,y,w,h)); \
- _s3WaitSlots(s3, 4); \
- _s3SetPixelControl(s3,MIXSEL_EXPPC); \
- _s3SetCur(s3, x, y); \
- _s3SetPcnt (s3, (w)-1, (h)-1); \
- _s3SetCmd (s3, \
- CMD_RECT| /* Fill rectangle */ \
- BYTSEQ| /* LSB byte order */ \
- _32BIT| /* 32 bit data on 32 bit boundaries */ \
- PCDATA| /* Data from CPU */ \
- INC_X|INC_Y| /* X and Y both increasing */ \
- DRAW| /* Draw, not move */ \
- PLANAR| /* multi pixel */ \
- WRTDATA); \
- DRAW_DEBUG((DEBUG_RENDER," done")); \
-}
-
-#define _s3SetClip(s3,pbox) {\
- DRAW_DEBUG ((DEBUG_SET, "set clip %dx%d -> %dx%d ", \
- pbox->x1, pbox->y1, pbox->x2, pbox->y2)); \
- _s3WaitSlots(s3, 2); \
- _s3SetScissorsTl(s3,(pbox)->x1, (pbox)->y1); \
- _s3SetScissorsBr(s3,(pbox)->x2 - 1, (pbox)->y2 - 1); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-#define _s3ResetClip(s3,pScreen) { \
- DRAW_DEBUG ((DEBUG_SET, "reset clip")); \
- _s3WaitSlots(s3, 2); \
- _s3SetScissorsTl(s3,0,0); \
- _s3SetScissorsBr(s3,pScreen->width - 1, pScreen->height - 1); \
- DRAW_DEBUG((DEBUG_SET," done")); \
-}
-
-RegionPtr
-s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty);
-
-RegionPtr
-s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane);
-
-void
-s3PushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y);
-
-void
-s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask);
-
-void
-s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- int alu, unsigned long planemask, s3PatternPtr pPattern);
-
-void
-s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit);
-
-void
-s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted);
-
-void
-s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
-
-void
-s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
-
-void
-s3PolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int y,
- unsigned int nglyphInit,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-void
-s3ImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-void
-s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int xInit, int y,
- unsigned int nglyphInit,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-void
-s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y,
- unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
-
-void
-s3Polylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int nptInit, DDXPointPtr pptInit);
-
-void
-s3PolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit);
-
-void
-s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu, unsigned long planemask);
-
-void s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable);
-
-void
-s3CheckGCFill (GCPtr pGC);
-
-void
-s3MoveGCFill (GCPtr pGC);
-
-void
-s3SyncProc (DrawablePtr pDrawable);
-
-#endif
diff --git a/hw/kdrive/savage/s3gc.c b/hw/kdrive/savage/s3gc.c
deleted file mode 100644
index 6faadff27..000000000
--- a/hw/kdrive/savage/s3gc.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Id: s3gc.c,v 1.2 1999/11/02 06:16:29 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3gc.c,v 1.3 2000/01/21 01:12:02 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-#include "s3draw.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "migc.h"
-
-/*
- * Common op groups. Common assumptions:
- *
- * lineWidth 0
- * lineStyle LineSolid
- * fillStyle FillSolid
- * rop GXcopy
- * font <= 32 pixels wide
- */
-
-/* TE font */
-static const GCOps s3TEOps = {
- s3FillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- s3CopyArea,
- s3CopyPlane,
- KdCheckPolyPoint,
- s3Polylines,
- s3PolySegment,
- KdCheckPolyRectangle,
- KdCheckPolyArc,
- s3FillPoly,
- s3PolyFillRect,
- s3PolyFillArcSolid,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- s3ImageTEGlyphBlt,
- s3PolyTEGlyphBlt,
- s3PushPixels
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-/* Non TE font */
-static const GCOps s3NonTEOps = {
- s3FillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- s3CopyArea,
- s3CopyPlane,
- KdCheckPolyPoint,
- s3Polylines,
- s3PolySegment,
- KdCheckPolyRectangle,
- KdCheckPolyArc,
- s3FillPoly,
- s3PolyFillRect,
- s3PolyFillArcSolid,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- s3ImageGlyphBlt,
- s3PolyGlyphBlt,
- s3PushPixels
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-static GCOps *
-s3MatchCommon (DrawablePtr pDraw, GCPtr pGC, FbGCPrivPtr fbPriv)
-{
- KdScreenPriv (pDraw->pScreen);
-
- if (!REGION_NOTEMPTY(pDraw->pScreen,fbGetCompositeClip(pGC)))
- {
- DRAW_DEBUG ((DEBUG_CLIP, "Empty composite clip, clipping all ops"));
- return &kdNoopOps;
- }
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return (GCOps *) &kdAsyncPixmapGCOps;
-
- if (pGC->lineWidth != 0)
- return 0;
- if (pGC->lineStyle != LineSolid)
- return 0;
- if (pGC->fillStyle != FillSolid)
- return 0;
- if (fbPriv->and != 0)
- return 0;
- if (pGC->font)
- {
- if (TERMINALFONT(pGC->font))
- return (GCOps *) &s3TEOps;
- else
- return (GCOps *) &s3NonTEOps;
- }
- return 0;
-}
-
-void
-s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- int new_type; /* drawable type has changed */
- int new_origin;
-
- /* flags for changing the proc vector */
- FbGCPrivPtr fbPriv;
- s3PrivGCPtr s3Priv;
- int oneRect;
- GCOps *newops;
-
- fbPriv = fbGetGCPrivate(pGC);
- s3Priv = s3GetGCPrivate(pGC);
-
- new_type = FALSE;
- new_origin = FALSE;
-
- /*
- * If the type of drawable has changed, fix up accelerated functions
- */
- if (s3Priv->type != pDrawable->type)
- {
- new_type = TRUE;
- s3Priv->type = pDrawable->type;
- }
-
- /*
- * Check tile/stipple origin
- */
- if (pGC->lastWinOrg.x != pDrawable->x || pGC->lastWinOrg.y != pDrawable->y)
- new_origin = TRUE;
-
- /*
- * Call down to FB to set clip list and rrop values
- */
-
- fbValidateGC (pGC, changes, pDrawable);
-
- /*
- * Check accelerated pattern if necessary
- */
- if (changes & (GCFillStyle|GCStipple|GCTile))
- s3CheckGCFill (pGC);
- else if (s3Priv->pPattern &&
- (new_origin || changes & (GCTileStipXOrigin|GCTileStipYOrigin)))
- s3MoveGCFill (pGC);
-
- /*
- * Try to match common vector
- */
-
- if (newops = s3MatchCommon (pDrawable, pGC, fbPriv))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- return;
- }
-
- /*
- * No common vector matched, create private ops vector and
- * fill it in
- */
- if (!pGC->ops->devPrivate.val)
- {
- /*
- * Switch from noop vector by first switching to fb
- * vector and fixing it up
- */
- if (pGC->ops == &kdNoopOps)
- {
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
- new_type = TRUE;
- }
- pGC->ops = miCreateGCOps (pGC->ops);
- pGC->ops->devPrivate.val = 1;
- }
-
- /*
- * Fills
- */
- if (new_type || (changes & (GCFillStyle|GCTile|GCStipple)))
- {
- pGC->ops->FillSpans = KdCheckFillSpans;
- pGC->ops->PolyFillRect = KdCheckPolyFillRect;
- if (s3Priv->type == DRAWABLE_WINDOW &&
- (pGC->fillStyle != FillTiled || s3Priv->pPattern))
- {
- pGC->ops->FillSpans = s3FillSpans;
- pGC->ops->PolyFillRect = s3PolyFillRect;
- }
- }
-
- /*
- * Blt
- */
- if (new_type)
- {
- pGC->ops->CopyArea = s3CopyArea;
- pGC->ops->CopyPlane = s3CopyPlane;
- pGC->ops->PushPixels = s3PushPixels;
- }
-
- /*
- * Lines
- */
- if (new_type || (changes & (GCLineStyle|GCLineWidth|GCFillStyle)))
- {
- pGC->ops->Polylines = KdCheckPolylines;
- pGC->ops->PolySegment = KdCheckPolySegment;
- if (pGC->lineStyle == LineSolid &&
- pGC->lineWidth == 0 &&
- pGC->fillStyle == FillSolid &&
- s3Priv->type == DRAWABLE_WINDOW)
- {
- pGC->ops->Polylines = s3Polylines;
- pGC->ops->PolySegment = s3PolySegment;
- }
- }
-
- /*
- * Polygons
- */
- if (new_type || (changes & (GCFillStyle)))
- {
- pGC->ops->FillPolygon = KdCheckFillPolygon;
- if (s3Priv->type == DRAWABLE_WINDOW &&
- pGC->fillStyle == FillSolid)
- {
- pGC->ops->FillPolygon = s3FillPoly;
- }
- }
-
- /*
- * Filled arcs
- */
- if (new_type || (changes & GCFillStyle))
- {
- pGC->ops->PolyFillArc = KdCheckPolyFillArc;
- if (s3Priv->type == DRAWABLE_WINDOW &&
- pGC->fillStyle == FillSolid)
- {
- pGC->ops->PolyFillArc = s3PolyFillArcSolid;
- }
- }
-
- /*
- * Text
- */
- if (new_type || (changes & (GCFont|GCFillStyle)))
- {
- pGC->ops->PolyGlyphBlt = KdCheckPolyGlyphBlt;
- pGC->ops->ImageGlyphBlt = KdCheckImageGlyphBlt;
- if (s3Priv->type == DRAWABLE_WINDOW && pGC->font)
- {
- if (pGC->fillStyle == FillSolid)
- {
- if (TERMINALFONT(pGC->font))
- pGC->ops->PolyGlyphBlt = s3PolyTEGlyphBlt;
- else
- pGC->ops->PolyGlyphBlt = s3PolyGlyphBlt;
- }
- if (TERMINALFONT(pGC->font))
- pGC->ops->ImageGlyphBlt = s3ImageTEGlyphBlt;
- else
- pGC->ops->ImageGlyphBlt = s3ImageGlyphBlt;
- }
- }
-}
diff --git a/hw/kdrive/savage/s3reg.c b/hw/kdrive/savage/s3reg.c
deleted file mode 100644
index 052bcf4d7..000000000
--- a/hw/kdrive/savage/s3reg.c
+++ /dev/null
@@ -1,1304 +0,0 @@
-/*
- * Id: s3reg.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3reg.c,v 1.3 2000/02/23 20:30:04 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3reg.h"
-
-#define CR00 S3_CR+0x00
-#define CR01 S3_CR+0x01
-#define CR02 S3_CR+0x02
-#define CR03 S3_CR+0x03
-#define CR04 S3_CR+0x04
-#define CR05 S3_CR+0x05
-#define CR06 S3_CR+0x06
-#define CR07 S3_CR+0x07
-#define CR08 S3_CR+0x08
-#define CR09 S3_CR+0x09
-#define CR0A S3_CR+0x0A
-#define CR0B S3_CR+0x0B
-#define CR0C S3_CR+0x0C
-#define CR0D S3_CR+0x0D
-#define CR0E S3_CR+0x0E
-#define CR0F S3_CR+0x0F
-#define CR10 S3_CR+0x10
-#define CR11 S3_CR+0x11
-#define CR12 S3_CR+0x12
-#define CR13 S3_CR+0x13
-#define CR14 S3_CR+0x14
-#define CR15 S3_CR+0x15
-#define CR16 S3_CR+0x16
-#define CR17 S3_CR+0x17
-#define CR18 S3_CR+0x18
-#define CR19 S3_CR+0x19
-#define CR1A S3_CR+0x1A
-#define CR1B S3_CR+0x1B
-#define CR1C S3_CR+0x1C
-#define CR1D S3_CR+0x1D
-#define CR1E S3_CR+0x1E
-#define CR1F S3_CR+0x1F
-#define CR20 S3_CR+0x20
-#define CR21 S3_CR+0x21
-#define CR22 S3_CR+0x22
-#define CR23 S3_CR+0x23
-#define CR24 S3_CR+0x24
-#define CR25 S3_CR+0x25
-#define CR26 S3_CR+0x26
-#define CR27 S3_CR+0x27
-#define CR28 S3_CR+0x28
-#define CR29 S3_CR+0x29
-#define CR2A S3_CR+0x2A
-#define CR2B S3_CR+0x2B
-#define CR2C S3_CR+0x2C
-#define CR2D S3_CR+0x2D
-#define CR2E S3_CR+0x2E
-#define CR2F S3_CR+0x2F
-#define CR30 S3_CR+0x30
-#define CR31 S3_CR+0x31
-#define CR32 S3_CR+0x32
-#define CR33 S3_CR+0x33
-#define CR34 S3_CR+0x34
-#define CR35 S3_CR+0x35
-#define CR36 S3_CR+0x36
-#define CR37 S3_CR+0x37
-#define CR38 S3_CR+0x38
-#define CR39 S3_CR+0x39
-#define CR3A S3_CR+0x3A
-#define CR3B S3_CR+0x3B
-#define CR3C S3_CR+0x3C
-#define CR3D S3_CR+0x3D
-#define CR3E S3_CR+0x3E
-#define CR3F S3_CR+0x3F
-#define CR40 S3_CR+0x40
-#define CR41 S3_CR+0x41
-#define CR42 S3_CR+0x42
-#define CR43 S3_CR+0x43
-#define CR44 S3_CR+0x44
-#define CR45 S3_CR+0x45
-#define CR46 S3_CR+0x46
-#define CR47 S3_CR+0x47
-#define CR48 S3_CR+0x48
-#define CR49 S3_CR+0x49
-#define CR4A S3_CR+0x4A
-#define CR4B S3_CR+0x4B
-#define CR4C S3_CR+0x4C
-#define CR4D S3_CR+0x4D
-#define CR4E S3_CR+0x4E
-#define CR4F S3_CR+0x4F
-#define CR50 S3_CR+0x50
-#define CR51 S3_CR+0x51
-#define CR52 S3_CR+0x52
-#define CR53 S3_CR+0x53
-#define CR54 S3_CR+0x54
-#define CR55 S3_CR+0x55
-#define CR56 S3_CR+0x56
-#define CR57 S3_CR+0x57
-#define CR58 S3_CR+0x58
-#define CR59 S3_CR+0x59
-#define CR5A S3_CR+0x5A
-#define CR5B S3_CR+0x5B
-#define CR5C S3_CR+0x5C
-#define CR5D S3_CR+0x5D
-#define CR5E S3_CR+0x5E
-#define CR5F S3_CR+0x5F
-#define CR60 S3_CR+0x60
-#define CR61 S3_CR+0x61
-#define CR62 S3_CR+0x62
-#define CR63 S3_CR+0x63
-#define CR64 S3_CR+0x64
-#define CR65 S3_CR+0x65
-#define CR66 S3_CR+0x66
-#define CR67 S3_CR+0x67
-#define CR68 S3_CR+0x68
-#define CR69 S3_CR+0x69
-#define CR6A S3_CR+0x6A
-#define CR6B S3_CR+0x6B
-#define CR6C S3_CR+0x6C
-#define CR6D S3_CR+0x6D
-#define CR6E S3_CR+0x6E
-#define CR6F S3_CR+0x6F
-#define CR70 S3_CR+0x70
-#define CR71 S3_CR+0x71
-#define CR72 S3_CR+0x72
-#define CR73 S3_CR+0x73
-#define CR74 S3_CR+0x74
-#define CR75 S3_CR+0x75
-#define CR76 S3_CR+0x76
-#define CR77 S3_CR+0x77
-#define CR78 S3_CR+0x78
-#define CR79 S3_CR+0x79
-#define CR7A S3_CR+0x7A
-#define CR7B S3_CR+0x7B
-#define CR7C S3_CR+0x7C
-#define CR7D S3_CR+0x7D
-#define CR7E S3_CR+0x7E
-#define CR7F S3_CR+0x7F
-#define CR80 S3_CR+0x80
-#define CR81 S3_CR+0x81
-#define CR82 S3_CR+0x82
-#define CR83 S3_CR+0x83
-#define CR84 S3_CR+0x84
-#define CR85 S3_CR+0x85
-#define CR86 S3_CR+0x86
-#define CR87 S3_CR+0x87
-#define CR88 S3_CR+0x88
-#define CR89 S3_CR+0x89
-#define CR8A S3_CR+0x8A
-#define CR8B S3_CR+0x8B
-#define CR8C S3_CR+0x8C
-#define CR8D S3_CR+0x8D
-#define CR8E S3_CR+0x8E
-#define CR8F S3_CR+0x8F
-#define CR90 S3_CR+0x90
-#define CR91 S3_CR+0x91
-#define CR92 S3_CR+0x92
-#define CR93 S3_CR+0x93
-#define CR94 S3_CR+0x94
-#define CR95 S3_CR+0x95
-#define CR96 S3_CR+0x96
-#define CR97 S3_CR+0x97
-#define CR98 S3_CR+0x98
-#define CR99 S3_CR+0x99
-#define CR9A S3_CR+0x9A
-#define CR9B S3_CR+0x9B
-#define CR9C S3_CR+0x9C
-#define CR9D S3_CR+0x9D
-#define CR9E S3_CR+0x9E
-#define CR9F S3_CR+0x9F
-#define CRA0 S3_CR+0xA0
-#define CRA1 S3_CR+0xA1
-#define CRA2 S3_CR+0xA2
-#define CRA3 S3_CR+0xA3
-#define CRA4 S3_CR+0xA4
-#define CRA5 S3_CR+0xA5
-#define CRA6 S3_CR+0xA6
-#define CRA7 S3_CR+0xA7
-#define CRA8 S3_CR+0xA8
-#define CRA9 S3_CR+0xA9
-#define CRAA S3_CR+0xAA
-#define CRAB S3_CR+0xAB
-#define CRAC S3_CR+0xAC
-#define CRAD S3_CR+0xAD
-#define CRAE S3_CR+0xAE
-#define CRAF S3_CR+0xAF
-#define CRB0 S3_CR+0xB0
-#define CRB1 S3_CR+0xB1
-#define CRB2 S3_CR+0xB2
-#define CRB3 S3_CR+0xB3
-#define CRB4 S3_CR+0xB4
-#define CRB5 S3_CR+0xB5
-#define CRB6 S3_CR+0xB6
-#define CRB7 S3_CR+0xB7
-#define CRB8 S3_CR+0xB8
-#define CRB9 S3_CR+0xB9
-#define CRBA S3_CR+0xBA
-#define CRBB S3_CR+0xBB
-#define CRBC S3_CR+0xBC
-#define CRBD S3_CR+0xBD
-#define CRBE S3_CR+0xBE
-#define CRBF S3_CR+0xBF
-
-#define CR_FIRST CR00
-
-VgaReg s3_h_total[] = {
- CR00, 0, 8,
- CR5D, 0, 1,
- CR5F, 0, 2,
- VGA_REG_END
-};
-
-VgaReg s3_h_display_end[] = {
- CR01, 0, 8,
- CR5D, 1, 1,
- CR5F, 2, 2,
- VGA_REG_END
-};
-
-VgaReg s3_h_blank_start[] = {
- CR02, 0, 8,
- CR5D, 2, 1,
- CR5F, 4, 2,
- VGA_REG_END
-};
-
-VgaReg s3_h_blank_end[] = {
- CR03, 0, 5,
- CR05, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_display_skew[] = {
- CR03, 5, 2,
- VGA_REG_END
-};
-
-VgaReg s3_h_sync_start[] = {
- CR04, 0, 8,
- CR5D, 4, 1,
- CR5F, 6, 2,
- VGA_REG_END
-};
-
-VgaReg s3_h_sync_end[] = {
- CR05, 0, 5,
- VGA_REG_END
-};
-
-VgaReg s3_h_skew[] = {
- CR05, 5, 2,
- VGA_REG_END
-};
-
-VgaReg s3_v_total[] = {
- CR06, 0, 8,
- CR07, 0, 1,
- CR07, 5, 1,
- CR5E, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_preset_row_scan[] = {
- CR08, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_max_scan_line[] = {
- CR09, 0, 5,
- VGA_REG_END
-};
-
-VgaReg s3_start_address[] = {
- CR0D, 0, 8,
- CR0C, 0, 8,
- CR69, 0, 7,
- VGA_REG_END
-};
-
-VgaReg s3_v_retrace_start[] = {
- CR10, 0, 8,
- CR07, 2, 1,
- CR07, 7, 1,
- CR5E, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_v_retrace_end[] = {
- CR11, 0, 4,
- VGA_REG_END
-};
-
-VgaReg s3_clear_v_retrace_int[] = {
- CR11, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_disable_v_retrace_int[] = {
- CR11, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_lock_crtc[] = {
- CR11, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_v_display_end[] = {
- CR12, 0, 8,
- CR07, 1, 1,
- CR07, 6, 1,
- CR5E, 1, 1,
- VGA_REG_END
-};
-
-VgaReg s3_screen_offset[] = {
- CR13, 0, 8,
- CR51, 4, 2,
- VGA_REG_END
-};
-
-VgaReg s3_count_by_4_mode[] = {
- CR14, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_doubleword_mode[] = {
- CR14, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_v_blank_start[] = {
- CR15, 0, 8,
- CR07, 3, 1,
- CR09, 5, 1,
- CR5E, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_v_blank_end[] = {
- CR16, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_2bk_cga[] = {
- CR17, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_4bk_hga[] = {
- CR17, 1, 1,
- VGA_REG_END
-};
-
-VgaReg s3_v_total_double[] = {
- CR17, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_word_mode[] = {
- CR17, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_address_16k_wrap[] = {
- CR17, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_byte_mode[] = {
- CR17, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_hardware_reset[] = {
- CR17, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_line_compare[] = {
- CR18, 0, 8,
- CR07, 4, 1,
- CR09, 6, 1,
- CR5E, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_delay_primary_load[] = {
- CR21, 1, 1,
- VGA_REG_END
-};
-
-VgaReg s3_device_id[] = {
- CR2E, 0, 8,
- CR2D, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_revision[] = {
- CR2F, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_enable_vga_16bit[] = {
- CR31, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enhanced_memory_mapping[] = {
- CR31, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_lock_dac_writes[] = {
- CR33, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_border_select[] = {
- CR33, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_lock_palette[] = {
- CR33, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_sff[] = {
- CR34, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_lock_vert[] = {
- CR35, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_lock_horz[] = {
- CR35, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_io_disable[] = {
- CR36, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_mem_size[] = {
- CR36, 5, 3,
- VGA_REG_END
-};
-
-VgaReg s3_register_lock_1 [] = {
- CR38, 0, 8, /* load with 0x48 */
- VGA_REG_END
-};
-
-VgaReg s3_register_lock_2 [] = {
- CR39, 0, 8, /* load with 0xa0 */
- VGA_REG_END
-};
-
-VgaReg s3_refresh_control[] = {
- CR3A, 0, 2,
- VGA_REG_END
-};
-
-VgaReg s3_enable_256[] = {
- CR3A, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_disable_pci_read_bursts[] = {
- CR3A, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_h_start_fifo_fetch[] = {
- CR3B, 0, 8,
- CR5D, 6, 1,
- CR5B, 2, 2,
- VGA_REG_END
-};
-
-VgaReg s3_enable_2d_access[] = {
- CR40, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_interlace[] = {
- CR42, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_old_screen_off_8[] = {
- CR43, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_h_counter_double_mode[] = {
- CR43, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_enable[] = {
- CR45, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_right[] = {
- CR45, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_xhigh[] = {
- CR46, 0, 3,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_xlow[] = {
- CR47, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_yhigh[] = {
- CR48, 0, 3,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_ylow[] = {
- CR49, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_fg[] = {
- CR4A, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_bg[] = {
- CR4B, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_address[] = {
- CR4D, 0, 8,
- CR4C, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_xoff[] = {
- CR4E, 0, 6,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_yoff[] = {
- CR4F, 0, 6,
- VGA_REG_END
-};
-
-VgaReg s3_ge_screen_width[] = {
- CR50, 6, 2,
- CR50, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_pixel_length[] = {
- CR50, 4, 2,
- VGA_REG_END
-};
-
-VgaReg s3_big_endian_linear[] = {
- CR53, 1, 2,
- VGA_REG_END
-};
-
-VgaReg s3_mmio_select[] = {
- CR53, 3, 2,
- VGA_REG_END
-};
-
-VgaReg s3_mmio_window[] = {
- CR53, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_swap_nibbles[] = {
- CR53, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_cursor_ms_x11[] = {
- CR55, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_linear_window_size[] = {
- CR58, 0, 2,
- VGA_REG_END
-};
-
-VgaReg s3_enable_linear[] = {
- CR58, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_h_blank_extend[] = {
- CR5D, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_h_sync_extend[] = {
- CR5D, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_sdclk_skew[] = {
- CR60, 0, 4,
- VGA_REG_END
-};
-
-VgaReg s3_delay_blank[] = {
- CR65, 3, 2,
- VGA_REG_END
-};
-
-VgaReg s3_delay_h_enable[] = {
- CR65, 6, 2,
- CR65, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_2d_3d[] = {
- CR66, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_pci_disconnect_enable[] = {
- CR66, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_primary_load_control[] = {
- CR66, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_secondary_load_control[] = {
- CR66, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_pci_retry_enable[] = {
- CR66, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_streams_mode[] = {
- CR67, 2, 2,
- VGA_REG_END
-};
-
-VgaReg s3_color_mode[] = {
- CR67, 4, 4,
- VGA_REG_END
-};
-
-VgaReg s3_primary_stream_definition[] = {
- CR69, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_primary_stream_timeout[] = {
- CR71, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_master_control_unit_timeout[] = {
- CR74, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_command_buffer_timeout[] = {
- CR75, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_lpb_timeout[] = {
- CR76, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_cpu_timeout[] = {
- CR78, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_2d_graphics_engine_timeout[] = {
- CR79, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_fifo_drain_delay[] = {
- CR85, 0, 3,
- VGA_REG_END
-};
-
-VgaReg s3_fifo_fetch_timing[] = {
- CR85, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dac_power_up_time[] = {
- CR86, 0, 7,
- VGA_REG_END
-};
-
-VgaReg s3_dac_power_saving_disable[] = {
- CR86, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_flat_panel_output_control_1[] = {
- CR90, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_streams_fifo_delay[] = {
- CR90, 4, 2,
- VGA_REG_END
-};
-
-VgaReg s3_flat_panel_output_control_2[] = {
- CR90, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_l1_parameter[] = {
- CR90, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_primary_stream_l1[] = {
- CR91, 0, 8,
- CR90, 0, 3,
- VGA_REG_END
-};
-
-#define CR_LAST CR91
-
-#define SR00 S3_SR+0x00
-#define SR01 S3_SR+0x01
-#define SR02 S3_SR+0x02
-#define SR03 S3_SR+0x03
-#define SR04 S3_SR+0x04
-#define SR05 S3_SR+0x05
-#define SR06 S3_SR+0x06
-#define SR07 S3_SR+0x07
-#define SR08 S3_SR+0x08
-#define SR09 S3_SR+0x09
-#define SR0A S3_SR+0x0A
-#define SR0B S3_SR+0x0B
-#define SR0C S3_SR+0x0C
-#define SR0D S3_SR+0x0D
-#define SR0E S3_SR+0x0E
-#define SR0F S3_SR+0x0F
-#define SR10 S3_SR+0x10
-#define SR11 S3_SR+0x11
-#define SR12 S3_SR+0x12
-#define SR13 S3_SR+0x13
-#define SR14 S3_SR+0x14
-#define SR15 S3_SR+0x15
-#define SR16 S3_SR+0x16
-#define SR17 S3_SR+0x17
-#define SR18 S3_SR+0x18
-#define SR19 S3_SR+0x19
-#define SR1A S3_SR+0x1A
-#define SR1B S3_SR+0x1B
-#define SR1C S3_SR+0x1C
-#define SR1D S3_SR+0x1D
-#define SR1E S3_SR+0x1E
-#define SR1F S3_SR+0x1F
-#define SR20 S3_SR+0x20
-#define SR21 S3_SR+0x21
-#define SR22 S3_SR+0x22
-#define SR23 S3_SR+0x23
-#define SR24 S3_SR+0x24
-#define SR25 S3_SR+0x25
-#define SR26 S3_SR+0x26
-#define SR27 S3_SR+0x27
-#define SR28 S3_SR+0x28
-#define SR29 S3_SR+0x29
-#define SR2A S3_SR+0x2A
-#define SR2B S3_SR+0x2B
-#define SR2C S3_SR+0x2C
-#define SR2D S3_SR+0x2D
-#define SR2E S3_SR+0x2E
-#define SR2F S3_SR+0x2F
-#define SR30 S3_SR+0x30
-#define SR31 S3_SR+0x31
-#define SR32 S3_SR+0x32
-#define SR33 S3_SR+0x33
-#define SR34 S3_SR+0x34
-#define SR35 S3_SR+0x35
-#define SR36 S3_SR+0x36
-#define SR37 S3_SR+0x37
-#define SR38 S3_SR+0x38
-#define SR39 S3_SR+0x39
-#define SR3A S3_SR+0x3A
-#define SR3B S3_SR+0x3B
-#define SR3C S3_SR+0x3C
-#define SR3D S3_SR+0x3D
-#define SR3E S3_SR+0x3E
-#define SR3F S3_SR+0x3F
-#define SR40 S3_SR+0x40
-#define SR41 S3_SR+0x41
-#define SR42 S3_SR+0x42
-#define SR43 S3_SR+0x43
-#define SR44 S3_SR+0x44
-#define SR45 S3_SR+0x45
-#define SR46 S3_SR+0x46
-#define SR47 S3_SR+0x47
-#define SR48 S3_SR+0x48
-#define SR49 S3_SR+0x49
-#define SR4A S3_SR+0x4A
-#define SR4B S3_SR+0x4B
-#define SR4C S3_SR+0x4C
-#define SR4D S3_SR+0x4D
-#define SR4E S3_SR+0x4E
-#define SR4F S3_SR+0x4F
-#define SR50 S3_SR+0x50
-#define SR51 S3_SR+0x51
-#define SR52 S3_SR+0x52
-#define SR53 S3_SR+0x53
-#define SR54 S3_SR+0x54
-#define SR55 S3_SR+0x55
-#define SR56 S3_SR+0x56
-#define SR57 S3_SR+0x57
-#define SR58 S3_SR+0x58
-#define SR59 S3_SR+0x59
-#define SR5A S3_SR+0x5A
-#define SR5B S3_SR+0x5B
-#define SR5C S3_SR+0x5C
-#define SR5D S3_SR+0x5D
-#define SR5E S3_SR+0x5E
-#define SR5F S3_SR+0x5F
-#define SR60 S3_SR+0x60
-#define SR61 S3_SR+0x61
-#define SR62 S3_SR+0x62
-#define SR63 S3_SR+0x63
-#define SR64 S3_SR+0x64
-#define SR65 S3_SR+0x65
-#define SR66 S3_SR+0x66
-#define SR67 S3_SR+0x67
-#define SR68 S3_SR+0x68
-#define SR69 S3_SR+0x69
-#define SR6A S3_SR+0x6A
-#define SR6B S3_SR+0x6B
-#define SR6C S3_SR+0x6C
-#define SR6D S3_SR+0x6D
-#define SR6E S3_SR+0x6E
-#define SR6F S3_SR+0x6F
-
-#define SR_FIRST SR02
-
-VgaReg s3_dot_clock_8[] = {
- SR01, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_screen_off[] = {
- SR01, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_write_plane[] = {
- SR02, 0, 4,
- VGA_REG_END
-};
-
-VgaReg s3_extended_memory_access[] = {
- SR04, 1, 1,
- VGA_REG_END
-};
-
-VgaReg s3_sequential_addressing_mode[] = {
- SR04, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_select_chain_4_mode[] = {
- SR04, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_unlock_extended_sequencer[] = {
- SR08, 0, 8, /* write 0x06 */
- VGA_REG_END
-};
-
-VgaReg s3_linear_addressing_control[] = {
- SR09, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_disable_io_ports[] = {
- SR09, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_hsync_control[] = {
- SR0D, 4, 2,
- VGA_REG_END
-};
-
-VgaReg s3_vsync_control[] = {
- SR0D, 6, 2,
- VGA_REG_END
-};
-
-VgaReg s3_mclk_n[] = {
- SR10, 0, 5,
- VGA_REG_END
-};
-
-VgaReg s3_mclk_r[] = {
- SR10, 5, 2,
- VGA_REG_END
-};
-
-VgaReg s3_mclk_m[] = {
- SR11, 0, 7,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_n[] = {
- SR12, 0, 6,
- SR29, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_r[] = {
- SR12, 6, 2,
- SR29, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_m[] = {
- SR13, 0, 8,
- SR29, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_mclk_load[] = {
- SR15, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_load[] = {
- SR15, 1, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_over_2[] = {
- SR15, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_clock_load_imm[] = {
- SR15, 5, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_invert[] = {
- SR15, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_clock_double[] = {
- SR18, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_double_15_16_invert[] = {
- SR1A, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_gamma_correction[] = {
- SR1B, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_8_bit_luts[] = {
- SR1B, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dclk_control[] = {
- SR1B, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_eclk_n[] = {
- SR32, 0, 5,
- VGA_REG_END
-};
-
-VgaReg s3_eclk_r[] = {
- SR32, 5, 2,
- VGA_REG_END
-};
-
-VgaReg s3_eclk_m[] = {
- SR32, 0, 5,
- VGA_REG_END
-};
-
-VgaReg s3_vga_dclk_n[] = {
- SR36, 0, 6,
- SR39, 4, 1,
- VGA_REG_END
-};
-
-VgaReg s3_vga_dclk_r[] = {
- SR36, 6, 2,
- SR39, 2, 1,
- VGA_REG_END
-};
-
-VgaReg s3_vga_dclk_m1[] = {
- SR37, 0, 8,
- SR39, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_vga_dclk_m2[] = {
- SR38, 0, 8,
- SR39, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_vga_clk_select[] = {
- SR39, 0, 1,
- VGA_REG_END
-};
-
-#define SR_LAST SR39
-
-#define AR00 (S3_AR+0x00)
-#define AR10 (S3_AR+0x10)
-#define AR11 (S3_AR+0x11)
-#define AR12 (S3_AR+0x12)
-#define AR13 (S3_AR+0x13)
-#define AR14 (S3_AR+0x14)
-
-#define AR_FIRST AR00
-
-VgaReg s3_select_graphics_mode[] = {
- AR10, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_blinking[] = {
- AR10, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_border_color[] = {
- AR11, 0, 8,
- VGA_REG_END
-};
-
-#define AR_LAST AR11
-
-VgaReg s3_io_addr_select[] = {
- S3_MISC_OUT, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_enable_ram[] = {
- S3_MISC_OUT, 1, 1,
- VGA_REG_END
-};
-
-VgaReg s3_clock_select[] = {
- S3_MISC_OUT, 2, 2,
- VGA_REG_END
-};
-
-VgaReg s3_horz_sync_neg[] = {
- S3_MISC_OUT, 6, 1,
- VGA_REG_END
-};
-
-VgaReg s3_vert_sync_neg[] = {
- S3_MISC_OUT, 7, 1,
- VGA_REG_END
-};
-
-VgaReg s3_display_mode_inactive[] = {
- S3_INPUT_STATUS_1, 0, 1,
- VGA_REG_END
-};
-
-VgaReg s3_vertical_sync_active[] = {
- S3_INPUT_STATUS_1, 3, 1,
- VGA_REG_END
-};
-
-VgaReg s3_dac_mask[] = {
- S3_DAC + 0, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_dac_read_index[] = {
- S3_DAC + 1, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_dac_write_index[] = {
- S3_DAC + 2, 0, 8,
- VGA_REG_END
-};
-
-VgaReg s3_dac_data[] = {
- S3_DAC + 3, 0, 8,
- VGA_REG_END
-};
-
-VGA8
-_s3Inb (VgaCard *card, VGA16 port)
-{
- VGAVOL8 *reg;
-
- if (card->closure)
- return VgaReadMemb ((VGA32) card->closure + port);
- else
- return VgaInb (port);
-}
-
-void
-_s3Outb (VgaCard *card, VGA8 value, VGA16 port)
-{
- if (card->closure)
- VgaWriteMemb (value, (VGA32) card->closure + port);
- else
- VgaOutb (value, port);
-}
-
-void
-_s3RegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write)
-{
-
- if (reg < S3_SR + S3_NSR)
- {
- map->access = VgaAccessIndIo;
- map->port = 0x3c4;
- map->addr = 0;
- map->value = 1;
- map->index = reg - S3_SR;
- }
- else if (reg < S3_GR + S3_NGR)
- {
- map->access = VgaAccessIndIo;
- map->port = 0x3ce;
- map->addr = 0;
- map->value = 1;
- map->index = reg - S3_GR;
- }
- else if (reg < S3_AR + S3_NAR)
- {
- reg -= S3_AR;
- map->access = VgaAccessDone;
- /* reset AFF to index */
- (void) _s3Inb (card, 0x3da);
- if (reg >= 16)
- reg |= 0x20;
- _s3Outb (card, reg, 0x3c0);
- if (write)
- _s3Outb (card, map->value, 0x3c0);
- else
- map->value = _s3Inb (card, 0x3c1);
- if (!(reg & 0x20))
- {
- /* enable video display again */
- (void) _s3Inb (card, 0x3da);
- _s3Outb (card, 0x20, 0x3c0);
- }
- return;
- }
- else if (reg < S3_CR + S3_NCR)
- {
- map->access = VgaAccessIndIo;
- map->port = 0x3d4;
- map->addr = 0;
- map->value = 1;
- map->index = reg - S3_CR;
- }
- else if (reg < S3_DAC + S3_NDAC)
- {
- map->access = VgaAccessIo;
- map->port = 0x3c6 + reg - S3_DAC;
- }
- else switch (reg) {
- case S3_MISC_OUT:
- map->access = VgaAccessIo;
- if (write)
- map->port = 0x3c2;
- else
- map->port = 0x3cc;
- break;
- case S3_INPUT_STATUS_1:
- map->access = VgaAccessIo;
- map->port = 0x3da;
- break;
- }
- if (card->closure)
- {
- map->port = map->port + (VGA32) card->closure;
- if (map->access == VgaAccessIo)
- map->access = VgaAccessMem;
- if (map->access == VgaAccessIndIo)
- map->access = VgaAccessIndMem;
- }
-}
-
-VgaSave s3Saves[] = {
- CR_FIRST, CR18,
- CR31, CR_LAST,
- SR_FIRST, SR15,
- SR18, SR_LAST,
- AR_FIRST, AR_LAST,
- S3_MISC_OUT, S3_MISC_OUT,
- VGA_SAVE_END
-};
-
-void
-s3RegInit (S3Vga *s3vga, VGAVOL8 *mmio)
-{
- s3vga->card.map = _s3RegMap;
- s3vga->card.closure = (void *) mmio;
- s3vga->card.max = S3_NREG;
- s3vga->card.values = s3vga->values;
- s3vga->card.saves = s3Saves;
-}
-
-void
-s3Save (S3Vga *s3vga)
-{
- s3vga->save_lock_crtc = s3Get(s3vga, s3_lock_crtc);
- s3SetImm (s3vga, s3_lock_crtc, 0);
- s3vga->save_register_lock_1 = s3Get (s3vga, s3_register_lock_1);
- s3SetImm (s3vga, s3_register_lock_1, 0x48);
- s3vga->save_register_lock_2 = s3Get (s3vga, s3_register_lock_2);
- s3SetImm (s3vga, s3_register_lock_2, 0xa5);
- s3vga->save_unlock_extended_sequencer = s3Get (s3vga, s3_unlock_extended_sequencer);
- s3SetImm (s3vga, s3_unlock_extended_sequencer, 0x06);
- s3vga->save_lock_horz = s3Get (s3vga, s3_lock_horz);
- s3SetImm (s3vga, s3_lock_horz, 0);
- s3vga->save_lock_vert = s3Get (s3vga, s3_lock_vert);
- s3SetImm (s3vga, s3_lock_vert, 0);
- s3vga->save_dot_clock_8 = s3Get (s3vga, s3_dot_clock_8);
- VgaPreserve (&s3vga->card);
-}
-
-void
-s3Reset (S3Vga *s3vga)
-{
- VgaRestore (&s3vga->card);
- s3SetImm (s3vga, s3_clock_load_imm, 1);
- s3SetImm (s3vga, s3_clock_load_imm, 0);
- s3SetImm (s3vga, s3_dot_clock_8, s3vga->save_dot_clock_8);
- s3SetImm (s3vga, s3_lock_vert, s3vga->save_lock_vert);
- s3SetImm (s3vga, s3_lock_horz, s3vga->save_lock_horz);
- s3SetImm (s3vga, s3_lock_dac_writes, s3vga->save_lock_dac_writes);
- s3SetImm (s3vga, s3_unlock_extended_sequencer, s3vga->save_unlock_extended_sequencer);
- s3SetImm (s3vga, s3_register_lock_2, s3vga->save_register_lock_2);
- s3SetImm (s3vga, s3_register_lock_1, s3vga->save_register_lock_1);
- s3SetImm (s3vga, s3_lock_crtc, s3vga->save_lock_crtc);
- VgaFinish (&s3vga->card);
-}
diff --git a/hw/kdrive/savage/s3reg.h b/hw/kdrive/savage/s3reg.h
deleted file mode 100644
index 9b3c5447b..000000000
--- a/hw/kdrive/savage/s3reg.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Id: s3reg.h,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3reg.h,v 1.3 2000/02/23 20:30:05 dawes Exp $ */
-
-#ifndef _S3REG_H_
-#define _S3REG_H_
-
-#include "vga.h"
-
-#define S3_SR 0
-#define S3_NSR 0x70
-#define S3_GR (S3_SR+S3_NSR)
-#define S3_NGR 0x09
-#define S3_AR (S3_GR+S3_NGR)
-#define S3_NAR 0x15
-#define S3_CR (S3_AR+S3_NAR)
-#define S3_NCR 0xc0
-#define S3_DAC (S3_CR+S3_NCR)
-#define S3_NDAC 4
-#define S3_MISC_OUT (S3_DAC + S3_NDAC)
-#define S3_INPUT_STATUS_1 (S3_MISC_OUT+1)
-#define S3_NREG (S3_INPUT_STATUS_1+1)
-
-extern VgaReg s3_h_total[];
-extern VgaReg s3_h_display_end[];
-extern VgaReg s3_h_blank_start[];
-extern VgaReg s3_h_blank_end[];
-extern VgaReg s3_display_skew[];
-extern VgaReg s3_h_sync_start[];
-extern VgaReg s3_h_sync_end[];
-extern VgaReg s3_h_skew[];
-extern VgaReg s3_v_total[];
-extern VgaReg s3_preset_row_scan[];
-extern VgaReg s3_max_scan_line[];
-extern VgaReg s3_start_address[];
-extern VgaReg s3_v_retrace_start[];
-extern VgaReg s3_v_retrace_end[];
-extern VgaReg s3_clear_v_retrace_int[];
-extern VgaReg s3_disable_v_retrace_int[];
-extern VgaReg s3_lock_crtc[];
-extern VgaReg s3_v_display_end[];
-extern VgaReg s3_screen_offset[];
-extern VgaReg s3_count_by_4_mode[];
-extern VgaReg s3_doubleword_mode[];
-extern VgaReg s3_v_blank_start[];
-extern VgaReg s3_v_blank_end[];
-extern VgaReg s3_2bk_cga[];
-extern VgaReg s3_4bk_hga[];
-extern VgaReg s3_v_total_double[];
-extern VgaReg s3_address_16k_wrap[];
-extern VgaReg s3_word_mode[];
-extern VgaReg s3_byte_mode[];
-extern VgaReg s3_hardware_reset[];
-extern VgaReg s3_line_compare[];
-extern VgaReg s3_delay_primary_load[];
-extern VgaReg s3_device_id[];
-extern VgaReg s3_revision[];
-extern VgaReg s3_enable_vga_16bit[];
-extern VgaReg s3_enhanced_memory_mapping[];
-extern VgaReg s3_enable_sff[];
-extern VgaReg s3_lock_dac_writes[];
-extern VgaReg s3_border_select[];
-extern VgaReg s3_lock_palette[];
-extern VgaReg s3_lock_vert[];
-extern VgaReg s3_lock_horz[];
-extern VgaReg s3_io_disable[];
-extern VgaReg s3_mem_size[];
-extern VgaReg s3_register_lock_1 [];
-extern VgaReg s3_register_lock_2 [];
-extern VgaReg s3_refresh_control[];
-extern VgaReg s3_enable_256[];
-extern VgaReg s3_disable_pci_read_bursts[];
-extern VgaReg s3_h_start_fifo_fetch[];
-extern VgaReg s3_enable_2d_access[];
-extern VgaReg s3_interlace[];
-extern VgaReg s3_old_screen_off_8[];
-extern VgaReg s3_h_counter_double_mode[];
-extern VgaReg s3_cursor_enable[];
-extern VgaReg s3_cursor_right[];
-extern VgaReg s3_cursor_xhigh[];
-extern VgaReg s3_cursor_xlow[];
-extern VgaReg s3_cursor_yhigh[];
-extern VgaReg s3_cursor_ylow[];
-extern VgaReg s3_cursor_fg[];
-extern VgaReg s3_cursor_bg[];
-extern VgaReg s3_cursor_address[];
-extern VgaReg s3_cursor_xoff[];
-extern VgaReg s3_cursor_yoff[];
-extern VgaReg s3_ge_screen_width[];
-extern VgaReg s3_pixel_length[];
-extern VgaReg s3_big_endian_linear[];
-extern VgaReg s3_mmio_select[];
-extern VgaReg s3_mmio_window[];
-extern VgaReg s3_swap_nibbles[];
-extern VgaReg s3_cursor_ms_x11[];
-extern VgaReg s3_linear_window_size[];
-extern VgaReg s3_enable_linear[];
-extern VgaReg s3_h_blank_extend[];
-extern VgaReg s3_h_sync_extend[];
-extern VgaReg s3_sdclk_skew[];
-extern VgaReg s3_delay_blank[];
-extern VgaReg s3_delay_h_enable[];
-extern VgaReg s3_enable_2d_3d[];
-extern VgaReg s3_pci_disconnect_enable[];
-extern VgaReg s3_primary_load_control[];
-extern VgaReg s3_secondary_load_control[];
-extern VgaReg s3_pci_retry_enable[];
-extern VgaReg s3_streams_mode[];
-extern VgaReg s3_color_mode[];
-extern VgaReg s3_primary_stream_definition[];
-extern VgaReg s3_primary_stream_timeout[];
-extern VgaReg s3_master_control_unit_timeout[];
-extern VgaReg s3_command_buffer_timeout[];
-extern VgaReg s3_lpb_timeout[];
-extern VgaReg s3_cpu_timeout[];
-extern VgaReg s3_2d_graphics_engine_timeout[];
-extern VgaReg s3_fifo_drain_delay[];
-extern VgaReg s3_fifo_fetch_timing[];
-extern VgaReg s3_dac_power_up_time[];
-extern VgaReg s3_dac_power_saving_disable[];
-extern VgaReg s3_flat_panel_output_control_1[];
-extern VgaReg s3_streams_fifo_delay[];
-extern VgaReg s3_flat_panel_output_control_2[];
-extern VgaReg s3_enable_l1_parameter[];
-extern VgaReg s3_primary_stream_l1[];
-
-extern VgaReg s3_dot_clock_8[];
-extern VgaReg s3_screen_off[];
-extern VgaReg s3_enable_write_plane[];
-extern VgaReg s3_extended_memory_access[];
-extern VgaReg s3_sequential_addressing_mode[];
-extern VgaReg s3_select_chain_4_mode[];
-
-extern VgaReg s3_unlock_extended_sequencer[];
-extern VgaReg s3_linear_addressing_control[];
-extern VgaReg s3_disable_io_ports[];
-extern VgaReg s3_hsync_control[];
-extern VgaReg s3_vsync_control[];
-extern VgaReg s3_mclk_n[];
-extern VgaReg s3_mclk_r[];
-extern VgaReg s3_mclk_m[];
-extern VgaReg s3_dclk_n[];
-extern VgaReg s3_dclk_r[];
-extern VgaReg s3_dclk_m[];
-extern VgaReg s3_mclk_load[];
-extern VgaReg s3_dclk_load[];
-extern VgaReg s3_dclk_over_2[];
-extern VgaReg s3_clock_load_imm[];
-extern VgaReg s3_dclk_invert[];
-extern VgaReg s3_enable_clock_double[];
-extern VgaReg s3_dclk_double_15_16_invert[];
-extern VgaReg s3_enable_gamma_correction[];
-extern VgaReg s3_enable_8_bit_luts[];
-extern VgaReg s3_dclk_control[];
-extern VgaReg s3_eclk_n[];
-extern VgaReg s3_eclk_r[];
-extern VgaReg s3_eclk_m[];
-extern VgaReg s3_vga_dclk_n[];
-extern VgaReg s3_vga_dclk_r[];
-extern VgaReg s3_vga_dclk_m1[];
-extern VgaReg s3_vga_dclk_m2[];
-extern VgaReg s3_vga_clk_select[];
-extern VgaReg s3_select_graphics_mode[];
-extern VgaReg s3_enable_blinking[];
-extern VgaReg s3_border_color[];
-
-extern VgaReg s3_io_addr_select[];
-extern VgaReg s3_enable_ram[];
-extern VgaReg s3_clock_select[];
-extern VgaReg s3_horz_sync_neg[];
-extern VgaReg s3_vert_sync_neg[];
-
-extern VgaReg s3_display_mode_inactive[];
-extern VgaReg s3_vertical_sync_active[];
-
-extern VgaReg s3_dac_mask[];
-extern VgaReg s3_dac_read_index[];
-extern VgaReg s3_dac_write_index[];
-extern VgaReg s3_dac_data[];
-
-#define s3Get(sv,r) VgaGet(&(sv)->card, (r))
-#define s3GetImm(sv,r) VgaGetImm(&(sv)->card, (r))
-#define s3Set(sv,r,v) VgaSet(&(sv)->card, (r), (v))
-#define s3SetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v))
-
-typedef struct _s3Vga {
- VgaCard card;
- VgaValue values[S3_NREG];
- VGA32 save_lock_crtc;
- VGA32 save_register_lock_1;
- VGA32 save_register_lock_2;
- VGA32 save_unlock_extended_sequencer;
- VGA32 save_lock_dac_writes;
- VGA32 save_lock_horz;
- VGA32 save_lock_vert;
- VGA32 save_dot_clock_8;
-} S3Vga;
-
-void
-s3RegInit (S3Vga *s3vga, VGAVOL8 *mmio);
-
-void
-s3Save (S3Vga *s3vga);
-
-void
-s3Reset (S3Vga *s3vga);
-
-#endif /* _S3REG_H_ */
diff --git a/hw/kdrive/savage/s3rtst.c b/hw/kdrive/savage/s3rtst.c
deleted file mode 100644
index c88e34585..000000000
--- a/hw/kdrive/savage/s3rtst.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Id: s3rtst.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3rtst.c,v 1.1 1999/11/19 13:53:57 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include "s3reg.h"
-
-typedef struct {
- VgaReg *reg;
- char *name;
-} NamedVgaReg;
-
-NamedVgaReg s3VRegs[] = {
- s3_h_total, "h_total",
- s3_h_display_end, "h_display_end",
- s3_h_blank_start, "h_blank_start",
- s3_h_blank_end, "h_blank_end",
- s3_display_skew, "display_skew",
- s3_h_sync_start, "h_sync_start",
- s3_h_sync_end, "h_sync_end",
- s3_h_skew, "h_skew",
- s3_v_total, "v_total",
- s3_preset_row_scan, "preset_row_scan",
- s3_max_scan_line, "max_scan_line",
- s3_start_address, "start_address",
- s3_v_retrace_start, "v_retrace_start",
- s3_v_retrace_end, "v_retrace_end",
- s3_clear_v_retrace_int, "clear_v_retrace_int",
- s3_disable_v_retrace_int, "disable_v_retrace_int",
- s3_lock_crtc, "lock_crtc",
- s3_v_display_end, "v_display_end",
- s3_screen_offset, "screen_offset",
- s3_count_by_4_mode, "count_by_4_mode",
- s3_doubleword_mode, "doubleword_mode",
- s3_v_blank_start, "v_blank_start",
- s3_v_blank_end, "v_blank_end",
- s3_v_total_double, "v_total_double",
- s3_word_mode, "word_mode",
- s3_byte_mode, "byte_mode",
- s3_line_compare, "line_compare",
- s3_device_id, "device_id",
- s3_revision, "revision",
- s3_lock_vert, "lock_vert",
- s3_lock_horz, "lock_horz",
- s3_io_disable, "io_disable",
- s3_mem_size, "mem_size",
- s3_register_lock_1 , "register_lock_1 ",
- s3_register_lock_2 , "register_lock_2 ",
- s3_refresh_control, "refresh_control",
- s3_enable_256, "enable_256",
- s3_enable_pci_read_bursts, "enable_pci_read_bursts",
- s3_h_start_fifo_fetch, "h_start_fifo_fetch",
- s3_interlace, "interlace",
- s3_old_screen_off_8, "old_screen_off_8",
- s3_h_counter_double_mode, "h_counter_double_mode",
- s3_hardware_cursor_enable, "hardware_cursor_enable",
- s3_hardware_cursor_right, "hardware_cursor_right",
- s3_hardware_cursor_x, "hardware_cursor_x",
- s3_hardware_cursor_y, "hardware_cursor_y",
- s3_hardware_cursor_fg, "hardware_cursor_fg",
- s3_cursor_address, "cursor_address",
- s3_cursor_start_x, "cursor_start_x",
- s3_cursor_start_y, "cursor_start_y",
- s3_ge_screen_width, "ge_screen_width",
- s3_pixel_length, "pixel_length",
- s3_big_endian_linear, "big_endian_linear",
- s3_mmio_select, "mmio_select",
- s3_mmio_window, "mmio_window",
- s3_swap_nibbles, "swap_nibbles",
- s3_hardware_cursor_ms_x11, "hardware_cursor_ms_x11",
- s3_h_blank_extend, "h_blank_extend",
- s3_h_sync_extend, "h_sync_extend",
- s3_enable_2d_3d, "enable_2d_3d",
- s3_pci_disconnect_enable, "pci_disconnect_enable",
- s3_pci_retry_enable, "pci_retry_enable",
- s3_color_mode, "color_mode",
- s3_screen_off, "screen_off",
- s3_unlock_extended_sequencer, "unlock_extended_sequencer",
- s3_disable_io_ports, "disable_io_ports",
- s3_hsync_control, "hsync_control",
- s3_vsync_control, "vsync_control",
- s3_mclk_n, "mclk_n",
- s3_mclk_r, "mclk_r",
- s3_mclk_m, "mclk_m",
- s3_dclk_n, "dclk_n",
- s3_dclk_r, "dclk_r",
- s3_dclk_m, "dclk_m",
- s3_mclk_load, "mclk_load",
- s3_dclk_load, "dclk_load",
- s3_dclk_over_2, "dclk_over_2",
- s3_clock_load_imm, "clock_load_imm",
- s3_dclk_invert, "dclk_invert",
- s3_enable_clock_double, "enable_clock_double",
- s3_dclk_double_15_16_invert, "dclk_double_15_16_invert",
- s3_enable_gamma_correction, "enable_gamma_correction",
- s3_enable_8_bit_luts, "enable_8_bit_luts",
- s3_dclk_control, "dclk_control",
- s3_vga_dclk_n, "vga_dclk_n",
- s3_vga_dclk_r, "vga_dclk_r",
- s3_vga_dclk_m1, "vga_dclk_m1",
- s3_vga_dclk_m2, "vga_dclk_m2",
- s3_vga_clk_select, "vga_clk_select",
- s3_clock_select, "clock_select",
-};
-
-#define NUM_S3_VREGS (sizeof (s3VRegs)/ sizeof (s3VRegs[0]))
-
-main (int argc, char **argv)
-{
- int i;
-
- iopl(3);
- s3SetImm(s3_register_lock_1, 0x48);
- s3SetImm(s3_register_lock_2, 0xa0);
- s3SetImm(s3_unlock_extended_sequencer, 0x06);
- for (i = 0; i < NUM_S3_VREGS; i++)
- printf ("%-20.20s %8x\n", s3VRegs[i].name, s3Get (s3VRegs[i].reg));
- s3Restore ();
-}
diff --git a/hw/kdrive/savage/s3stub.c b/hw/kdrive/savage/s3stub.c
deleted file mode 100644
index d5c55d598..000000000
--- a/hw/kdrive/savage/s3stub.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Id: s3stub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/savage/s3stub.c,v 1.3 2000/02/23 20:30:05 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-#ifdef VXWORKS
- attr.naddr = 2;
- attr.io = 0;
- attr.address[0] = 0xbc000000; /* registers */
- attr.address[1] = 0xba000000; /* frame buffer */
- KdCardInfoAdd (&s3Funcs, &attr, 0);
-#else
- CARD32 count;
-
- count = 0;
- while (LinuxFindPci (0x5333, 0x8a22, count, &attr))
- {
- KdCardInfoAdd (&s3Funcs, &attr, 0);
- count++;
- }
-#endif
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
-#ifdef VXWORKS
- KdInitInput (&VxWorksMouseFuncs, &VxWorksKeyboardFuncs);
-#endif
-#ifdef linux
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#endif
-}
-
-extern int s3CpuTimeout;
-extern int s3AccelTimeout;
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!strcmp (argv[i], "-cpu"))
- {
- s3CpuTimeout = strtol(argv[i+1], NULL, 0);
- return 2;
- }
- if (!strcmp (argv[i], "-accel"))
- {
- s3AccelTimeout = strtol (argv[i+1], NULL, 0);
- return 2;
- }
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/sis530/Imakefile b/hw/kdrive/sis530/Imakefile
deleted file mode 100644
index 08ac126cc..000000000
--- a/hw/kdrive/sis530/Imakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/nvfb/Imakefile,v 3.8 1996/12/23 06:30:19 dawes Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = sis.c sisclock.c siscmap.c siscurs.c sisdraw.c sisio.c sisstub.c
-
-OBJS = sis.o sisclock.o siscmap.o siscurs.o sisdraw.o sisio.o sisstub.o
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(sis530,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/sis530/sis.c b/hw/kdrive/sis530/sis.c
deleted file mode 100644
index b2a95326e..000000000
--- a/hw/kdrive/sis530/sis.c
+++ /dev/null
@@ -1,924 +0,0 @@
-/*
- * Id: sis.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sis.c,v 1.4 2000/05/06 22:17:49 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "sis.h"
-
-#define MAX_FB_SIZE (4096 * 1024)
-
-#define MMIO_SIZE (64 * 1024)
-
-int sisMemoryTable[8] = {
- 1, 2, 4, 0, 0, 2, 4, 8
-};
-
-Bool
-sisCardInit (KdCardInfo *card)
-{
- SisCardInfo *sisc;
- SisPtr sis;
- int size;
- CARD8 *registers;
- CARD8 *temp_buffer;
- CARD8 save_sr5;
-
- sisc = (SisCardInfo *) xalloc (sizeof (SisCardInfo));
- if (!sisc)
- goto bail0;
-
- sisc->io_base = card->attr.io;
- /*
- * enable access to SiS ports (no MMIO available)
- */
- iopl(3);
- save_sr5 = GetSrtc(sisc,0x5);
- if (save_sr5 != 0x21)
- save_sr5 = 0x86;
- PutSrtc(sisc,0x5,0x86);
-#if 0
- {
- int i;
-
- for (i = 0; i <= 0x3f; i++)
- fprintf (stderr, "SR%02x = %02x\n", i, GetSrtc(sisc,i));
- }
-#endif
- sisc->memory = sisMemoryTable[GetSrtc(sisc,0xc)&0x7] * 1024 * 1024;
-
- PutSrtc(sisc,0x5,save_sr5);
-
- if (!sisc->memory)
- {
- ErrorF ("Can't detect SiS530 frame buffer\n");
- goto bail1;
- }
-
- /*
- * Map frame buffer and MMIO registers
- */
- sisc->frameBuffer = KdMapDevice (card->attr.address[0], sisc->memory);
- if (!sisc->frameBuffer)
- goto bail1;
-
- sisc->registers = KdMapDevice (card->attr.address[1], MMIO_SIZE);
- if (!sisc->registers)
- goto bail2;
-
- /*
- * Offset from base of MMIO to registers
- */
- sisc->sis = (SisPtr) (sisc->registers + SIS_MMIO_OFFSET);
- sisc->cpu_bitblt = (VOL32 *) sisc->registers;
-
- card->driver = sisc;
-
- return TRUE;
-bail2:
- KdUnmapDevice (sisc->frameBuffer, sisc->memory);
-bail1:
- xfree (sisc);
-bail0:
- return FALSE;
-}
-
-Bool
-sisModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t)
-{
- if (t->horizontal != 1600 &&
- t->horizontal != 1280 &&
- t->horizontal != 1152 &&
- t->horizontal != 1024 &&
- t->horizontal != 800 &&
- t->horizontal != 640)
- return FALSE;
- return TRUE;
-}
-
-Bool
-sisModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- SisCardInfo *sisc = (SisCardInfo *) card->driver;
- SisScreenInfo *siss;
- int i;
- KdMonitorTiming *t;
- CARD32 memory;
- int byte_width, pixel_width, screen_size;
-
- if (screen->fb[0].depth >= 24)
- {
- screen->fb[0].depth = 24;
- screen->fb[0].bitsPerPixel = 24;
- screen->dumb = TRUE;
- }
- else if (screen->fb[0].depth >= 16)
- {
- screen->fb[0].depth = 16;
- screen->fb[0].bitsPerPixel = 16;
- }
- else if (screen->fb[0].depth >= 15)
- {
- screen->fb[0].depth = 15;
- screen->fb[0].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[0].depth = 8;
- screen->fb[0].bitsPerPixel = 8;
- }
- byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
- pixel_width = screen->width;
- screen->fb[0].pixelStride = pixel_width;
- screen->fb[0].byteStride = byte_width;
-
- screen_size = byte_width * screen->height;
-
- return screen_size <= sisc->memory;
-}
-
-Bool
-sisScreenInit (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- SisCardInfo *sisc = (SisCardInfo *) card->driver;
- SisScreenInfo *siss;
- int i;
- const KdMonitorTiming *t;
- CARD32 memory;
- int byte_width, pixel_width, screen_size;
-
- siss = (SisScreenInfo *) xalloc (sizeof (SisScreenInfo));
- if (!siss)
- return FALSE;
-
- memset (siss, '\0', sizeof (SisScreenInfo));
-
- if (!screen->width || !screen->height)
- {
- screen->width = 800;
- screen->height = 600;
- screen->rate = 72;
- }
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 8;
-
- t = KdFindMode (screen, sisModeSupported);
-
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
-
- if (!KdTuneMode (screen, sisModeUsable, sisModeSupported))
- {
- xfree (sisc);
- return FALSE;
- }
-
- memory = sisc->memory - screen_size;
-
- screen->fb[0].frameBuffer = sisc->frameBuffer;
-
- /*
- * Cursor lives in the last 16k of memory
- */
- if (memory >= 16384 && !screen->softCursor)
- {
- siss->cursor_base = sisc->frameBuffer + (sisc->memory - 16384);
- siss->cursor_off = siss->cursor_base - sisc->frameBuffer;
- memory -= 16384;
- }
- else
- {
- screen->softCursor = TRUE;
- siss->cursor_base = 0;
- siss->cursor_off = 0;
- }
-
- if (memory > 8192)
- {
- siss->expand = screen->fb[0].frameBuffer + screen_size;
- siss->expand_off = siss->expand - sisc->frameBuffer;
- siss->expand_len = memory;
- memory = 0;
- }
- else
- {
- siss->expand = 0;
- siss->expand_len = 0;
- }
-
- switch (screen->fb[0].depth) {
- case 8:
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case 15:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x03e0;
- screen->fb[0].redMask = 0x7c00;
- break;
- case 16:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x07e0;
- screen->fb[0].redMask = 0xf800;
- break;
- case 24:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x0000ff;
- screen->fb[0].greenMask = 0x00ff00;
- screen->fb[0].redMask = 0xff0000;
- break;
- }
-
- screen->driver = siss;
-
- return TRUE;
-}
-
-static void
-_sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
-{
- crtc->misc_output = _sisInb(sisc->io_base+0x4c);
- crtc->h_total_0_7 = GetCrtc (sisc, 0x00);
- crtc->h_display_end_0_7 = GetCrtc (sisc, 0x01);
- crtc->h_blank_start_0_7 = GetCrtc (sisc, 0x02);
- crtc->_h_blank_end = GetCrtc (sisc, 0x03);
- crtc->h_sync_start_0_7 = GetCrtc (sisc, 0x04);
- crtc->_h_sync_end = GetCrtc (sisc, 0x05);
- crtc->v_total_0_7 = GetCrtc (sisc, 0x06);
- crtc->crtc_overflow = GetCrtc (sisc, 0x07);
- crtc->preset_row_scan = GetCrtc (sisc, 0x08);
- crtc->_max_scan_line = GetCrtc (sisc, 0x09);
- crtc->cursor_start = GetCrtc (sisc, 0x0a);
- crtc->cursor_end = GetCrtc (sisc, 0x0a);
- crtc->start_address_8_15 = GetCrtc (sisc, 0x0c);
- crtc->start_address_0_7 = GetCrtc (sisc, 0x0d);
- crtc->text_cursor_15_8 = GetCrtc (sisc, 0x0e);
- crtc->text_cursor_7_0 = GetCrtc (sisc, 0x0f);
- crtc->v_retrace_start_0_7 = GetCrtc (sisc, 0x10);
- crtc->_v_retrace_end = GetCrtc (sisc, 0x11);
- crtc->v_display_end_0_7 = GetCrtc (sisc, 0x12);
- crtc->screen_off_0_7 = GetCrtc (sisc, 0x13);
- crtc->_underline_location = GetCrtc (sisc, 0x14);
- crtc->v_blank_start_0_7 = GetCrtc (sisc, 0x15);
- crtc->v_blank_end_0_7 = GetCrtc (sisc, 0x16);
- crtc->crtc_mode = GetCrtc (sisc, 0x17);
-
- crtc->line_compare_0_7 = GetCrtc (sisc, 0x18);
-
- crtc->mode_control = GetArtc (sisc, 0x10);
- crtc->screen_border_color = GetArtc (sisc, 0x11);
- crtc->enable_color_plane = GetArtc (sisc, 0x12);
- crtc->horizontal_pixel_pan = GetArtc (sisc, 0x13);
-
- crtc->mode_register = GetGrtc (sisc, 0x5);
- crtc->misc_register = GetGrtc (sisc, 0x6);
- crtc->color_dont_care = GetGrtc (sisc, 0x7);
-
- crtc->clock_mode = GetSrtc (sisc, 0x1);
- crtc->color_plane_w_enable = GetSrtc (sisc, 0x2);
- crtc->memory_mode = GetSrtc (sisc, 0x4);
-
- crtc->graphics_mode = GetSrtc (sisc, 0x6);
- crtc->misc_control_0 = GetSrtc (sisc, 0x7);
- crtc->crt_cpu_threshold_control_0 = GetSrtc (sisc, 0x8);
- crtc->crt_cpu_threshold_control_1 = GetSrtc (sisc, 0x9);
- crtc->extended_crt_overflow = GetSrtc (sisc, 0xa);
- crtc->misc_control_1 = GetSrtc (sisc, 0xb);
- crtc->misc_control_2 = GetSrtc (sisc, 0xc);
-
- crtc->ddc_and_power_control = GetSrtc (sisc, 0x11);
- crtc->extended_horizontal_overflow = GetSrtc (sisc, 0x12);
- crtc->extended_clock_generator = GetSrtc (sisc, 0x13);
- crtc->cursor_0_red = GetSrtc (sisc, 0x14);
- crtc->cursor_0_green = GetSrtc (sisc, 0x15);
- crtc->cursor_0_blue = GetSrtc (sisc, 0x16);
- crtc->cursor_1_red = GetSrtc (sisc, 0x17);
- crtc->cursor_1_green = GetSrtc (sisc, 0x18);
- crtc->cursor_1_blue = GetSrtc (sisc, 0x19);
- crtc->cursor_h_start_0_7 = GetSrtc (sisc, 0x1a);
- crtc->cursor_h_start_1 = GetSrtc (sisc, 0x1b);
- crtc->cursor_h_preset_0_5 = GetSrtc (sisc, 0x1c);
- crtc->cursor_v_start_0_7 = GetSrtc (sisc, 0x1d);
- crtc->cursor_v_start_1 = GetSrtc (sisc, 0x1e);
- crtc->cursor_v_preset_0_5 = GetSrtc (sisc, 0x1f);
- crtc->linear_base_19_26 = GetSrtc (sisc, 0x20);
- crtc->linear_base_1 = GetSrtc (sisc, 0x21);
-
- crtc->graphics_engine_0 = GetSrtc (sisc, 0x26);
- crtc->graphics_engine_1 = GetSrtc (sisc, 0x27);
- crtc->internal_mclk_0 = GetSrtc (sisc, 0x28);
- crtc->internal_mclk_1 = GetSrtc (sisc, 0x29);
- crtc->internal_vclk_0 = GetSrtc (sisc, 0x2A);
- crtc->internal_vclk_1 = GetSrtc (sisc, 0x2B);
-
- crtc->misc_control_7 = GetSrtc (sisc, 0x38);
-
- crtc->misc_control_11 = GetSrtc (sisc, 0x3E);
- crtc->misc_control_12 = GetSrtc (sisc, 0x3F);
-}
-
-static void
-_sisSetBlank (SisCardInfo *sisc, Bool blank)
-{
- CARD8 clock;
-
- clock = GetSrtc (sisc, 0x01);
- if (blank)
- clock |= 0x20;
- else
- clock &= ~0x20;
- PutSrtc (sisc, 0x01, clock);
-}
-
-static void
-_sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
-{
- _sisSetBlank (sisc, TRUE);
- PutCrtc (sisc, 0x00, crtc->h_total_0_7);
- PutCrtc (sisc, 0x01, crtc->h_display_end_0_7);
- PutCrtc (sisc, 0x02, crtc->h_blank_start_0_7);
- PutCrtc (sisc, 0x03, crtc->_h_blank_end);
- PutCrtc (sisc, 0x04, crtc->h_sync_start_0_7);
- PutCrtc (sisc, 0x05, crtc->_h_sync_end);
- PutCrtc (sisc, 0x06, crtc->v_total_0_7);
- PutCrtc (sisc, 0x07, crtc->crtc_overflow);
- PutCrtc (sisc, 0x08, crtc->preset_row_scan);
- PutCrtc (sisc, 0x09, crtc->_max_scan_line);
- PutCrtc (sisc, 0x0a, crtc->cursor_start);
- PutCrtc (sisc, 0x0b, crtc->cursor_end);
- PutCrtc (sisc, 0x0c, crtc->start_address_8_15);
- PutCrtc (sisc, 0x0d, crtc->start_address_0_7);
- PutCrtc (sisc, 0x0e, crtc->text_cursor_15_8);
- PutCrtc (sisc, 0x0f, crtc->text_cursor_7_0);
- PutCrtc (sisc, 0x10, crtc->v_retrace_start_0_7);
- PutCrtc (sisc, 0x11, crtc->_v_retrace_end);
- PutCrtc (sisc, 0x12, crtc->v_display_end_0_7);
- PutCrtc (sisc, 0x13, crtc->screen_off_0_7);
- PutCrtc (sisc, 0x14, crtc->_underline_location);
- PutCrtc (sisc, 0x15, crtc->v_blank_start_0_7);
- PutCrtc (sisc, 0x16, crtc->v_blank_end_0_7);
- PutCrtc (sisc, 0x17, crtc->crtc_mode);
- PutCrtc (sisc, 0x18, crtc->line_compare_0_7);
-
- PutArtc (sisc, 0x10, crtc->mode_control);
- PutArtc (sisc, 0x11, crtc->screen_border_color);
- PutArtc (sisc, 0x12, crtc->enable_color_plane);
- PutArtc (sisc, 0x13, crtc->horizontal_pixel_pan);
-
- PutGrtc (sisc, 0x5, crtc->mode_register);
- PutGrtc (sisc, 0x6, crtc->misc_register);
- PutGrtc (sisc, 0x7, crtc->color_dont_care);
-
- PutSrtc (sisc, 0x1, crtc->clock_mode | 0x20);
- PutSrtc (sisc, 0x2, crtc->color_plane_w_enable);
- PutSrtc (sisc, 0x4, crtc->memory_mode);
-
- PutSrtc (sisc, 0x6, crtc->graphics_mode);
- PutSrtc (sisc, 0x7, crtc->misc_control_0);
- PutSrtc (sisc, 0x8, crtc->crt_cpu_threshold_control_0);
- PutSrtc (sisc, 0x9, crtc->crt_cpu_threshold_control_1);
- PutSrtc (sisc, 0xa, crtc->extended_crt_overflow);
- PutSrtc (sisc, 0xb, crtc->misc_control_1);
- PutSrtc (sisc, 0xc, crtc->misc_control_2);
-
- PutSrtc (sisc, 0x11, crtc->ddc_and_power_control);
- PutSrtc (sisc, 0x12, crtc->extended_horizontal_overflow);
- PutSrtc (sisc, 0x13, crtc->extended_clock_generator);
- PutSrtc (sisc, 0x14, crtc->cursor_0_red);
- PutSrtc (sisc, 0x15, crtc->cursor_0_green);
- PutSrtc (sisc, 0x16, crtc->cursor_0_blue);
- PutSrtc (sisc, 0x17, crtc->cursor_1_red);
- PutSrtc (sisc, 0x18, crtc->cursor_1_green);
- PutSrtc (sisc, 0x19, crtc->cursor_1_blue);
- PutSrtc (sisc, 0x1a, crtc->cursor_h_start_0_7);
- PutSrtc (sisc, 0x1b, crtc->cursor_h_start_1);
- PutSrtc (sisc, 0x1c, crtc->cursor_h_preset_0_5);
- PutSrtc (sisc, 0x1d, crtc->cursor_v_start_0_7);
- PutSrtc (sisc, 0x1e, crtc->cursor_v_start_1);
- PutSrtc (sisc, 0x1f, crtc->cursor_v_preset_0_5);
- PutSrtc (sisc, 0x20, crtc->linear_base_19_26);
- PutSrtc (sisc, 0x21, crtc->linear_base_1);
-
- PutSrtc (sisc, 0x26, crtc->graphics_engine_0);
- PutSrtc (sisc, 0x27, crtc->graphics_engine_1);
- PutSrtc (sisc, 0x28, crtc->internal_mclk_0);
- PutSrtc (sisc, 0x29, crtc->internal_mclk_1);
- PutSrtc (sisc, 0x2A, crtc->internal_vclk_0);
- PutSrtc (sisc, 0x2B, crtc->internal_vclk_1);
-
- PutSrtc (sisc, 0x38, crtc->misc_control_7);
-
- PutSrtc (sisc, 0x3E, crtc->misc_control_11);
- PutSrtc (sisc, 0x3F, crtc->misc_control_12);
-
-#if 0
- PutCrtc (sisc, 0x5b, 0x27);
- PutCrtc (sisc, 0x5c, 0xe1);
- PutCrtc (sisc, 0x5d, 0x00);
-
- PutSrtc (sisc, 0x5a, 0xe6);
- PutSrtc (sisc, 0x5d, 0xa1);
- PutSrtc (sisc, 0x9a, 0xe6);
- PutSrtc (sisc, 0x9d, 0xa1);
- PutSrtc (sisc, 0xda, 0xe6);
- PutSrtc (sisc, 0xdd, 0x6c);
-#endif
-
- _sisOutb(crtc->misc_output, sisc->io_base+0x42);
-
- outw (0x3c4, 0x0100);
- outw (0x3c4, 0x0300);
-
- _sisSetBlank (sisc, FALSE);
-}
-
-CARD8
-_sisReadIndexRegister (CARD32 base, CARD8 index)
-{
- CARD8 ret;
-
- _sisOutb (index, base);
- ret = _sisInb (base+1);
- return ret;
-}
-
-void
-_sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value)
-{
- _sisOutb (index, base);
- _sisOutb (value, base+1);
-}
-
-CARD8
-_sisReadArtc (CARD32 base, CARD8 index)
-{
- CARD8 ret;
-
- _sisInb (base+0x1a);
- _sisOutb (index,base);
- ret = _sisInb (base+1);
- _sisInb (base+0x1a);
- _sisOutb (0x20,base);
- return ret;
-}
-
-void
-_sisWriteArtc (CARD32 base, CARD8 index, CARD8 value)
-{
- _sisInb (base+0x1a);
- _sisOutb (index|0x20,base);
- _sisOutb (value,base);
- _sisInb (base+0x1a);
- _sisOutb (0x20,base);
-}
-
-void
-sisPreserve (KdCardInfo *card)
-{
- SisCardInfo *sisc = card->driver;
- CARD8 *r = sisc->registers;
- int a, i, l;
- CARD8 line[16];
- CARD8 prev[16];
- BOOL gotone;
-
- sisc->save.sr5 = GetSrtc(sisc,0x5);
- if (sisc->save.sr5 != 0x21)
- sisc->save.sr5 = 0x86;
- /* unlock extension registers */
- PutSrtc(sisc,0x5,0x86);
- /* unlock CRTC registers */
- PutCrtc(sisc,0x11,GetCrtc(sisc,0x11)&~0x80);
- /* enable vga */
- _sisOutb(0x1,sisc->io_base+0x43);
-
- /* enable MMIO access to registers */
- sisc->save.srb = GetSrtc(sisc,0xb);
- PutSrtc(sisc, 0xb, sisc->save.srb | 0x60);
- _sisGetCrtc (sisc, &sisc->save.crtc);
- memcpy (sisc->save.text_save, sisc->frameBuffer, SIS_TEXT_SAVE);
-}
-
-Bool
-sisEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- SisCardInfo *sisc = card->driver;
- SisScreenInfo *siss = screen->driver;
- const KdMonitorTiming *t;
- SisCrtc crtc;
- unsigned long pixel;
-
- int hactive;
- int hblank;
- int hfp;
- int hbp;
-
- int vactive;
- int vblank;
- int vfp;
- int vbp;
-
- int h_total;
- int h_display_end;
- int h_blank_start;
- int h_blank_end;
- int h_sync_start;
- int h_sync_end;
- int h_screen_off;
-
- int h_adjust;
-
- int v_total;
- int v_retrace_start;
- int v_retrace_end;
- int v_display_end;
- int v_blank_start;
- int v_blank_end;
-
- crtc = sisc->save.crtc;
-
- t = KdFindMode (screen, sisModeSupported);
-
- /* CR9 */
- crtc.max_scan_line = 0;
-
- /* CRA */
- crtc.cursor_start = 0;
-
- /* CRB */
- crtc.cursor_end = 0;
-
- /* CRE */
- crtc.text_cursor_15_8 = 0;
-
- /* CRF */
- crtc.text_cursor_7_0 = 0;
-
- /* CR11 */
- crtc.disable_v_retrace_int = 1;
-
- /* CR14 */
- crtc.underline_location = 0;
- crtc.count_by_four = 0;
- crtc.doubleword_mode = 1;
-
- /* 3CC/3C2 */
- crtc.io_address_select = 1;
- crtc.display_ram_enable = 1;
- crtc.clock_select = 3;
-
- /* SR1 */
- crtc.clock_mode = 0;
- crtc.dot_clock_8_9 = 1;
-
- /* SR2 */
- crtc.color_plane_w_enable = 0xf;
-
- /* SR4 */
- crtc.memory_mode = 0;
- crtc.chain_4_enable = 1;
- crtc.odd_even_disable = 1;
- crtc.extended_memory_sz = 1;
-
- /* SR6 */
- crtc.graphics_mode_linear = 1;
- crtc.enhanced_graphics_mode = 1;
-
- /* SR9 */
- crtc.crt_cpu_threshold_control_1 = 0;
-
- /* SRB */
-#if 0
- crtc.cpu_bitblt_enable = 1;
-#endif
- crtc.memory_mapped_mode = 3;
-
- /* SRC */
- crtc.graphics_mode_32bit_enable = 1;
- crtc.read_ahead_enable = 1;
-
- /* SR11 */
- crtc.acpi_enable = 0;
- crtc.kbd_cursor_activate = 0;
- crtc.video_memory_activate = 0;
- crtc.vga_standby = 0;
- crtc.vga_suspend = 0;
-
- crtc.cursor_0_red = 0x3f;
- crtc.cursor_0_green = 0x3f;
- crtc.cursor_0_blue = 0x3f;
-
- /* SR20 */
- crtc.linear_base_19_26 = (card->attr.address[0] & 0x07f80000) >> 19;
-
- /* SR21 */
- crtc.linear_base_27_31 = (card->attr.address[0] & 0xf8000000) >> 27;
- crtc.linear_aperture = SIS_LINEAR_APERTURE_4M;
-
- /* SR27 */
- crtc.logical_screen_width = 3;
- crtc.graphics_prog_enable = 1;
-
- /* SR38 */
- crtc.extended_clock_select = 0;
-
- /* AR10 */
- crtc.mode_control = 0;
- crtc.graphics_mode_enable = 1;
- /* AR11 */
- crtc.screen_border_color = 0;
- /* AR12 */
- crtc.enable_color_plane = 0xf;
- /* AR13 */
- crtc.horizontal_pixel_pan = 0;
-
- /* GR5 */
- crtc.mode_register = 0;
-
- /* GR6 */
- crtc.graphics_enable = 1;
- crtc.chain_odd_even = 0;
- crtc.memory_address_select = 1;
-
- /* GR7 */
- crtc.color_dont_care = 0xf;
- if (siss->cursor_base)
- {
- crtc_set_cursor_start_addr (&crtc, siss->cursor_off);
- crtc.graphics_mode_hw_cursor = 0;
- }
-
- hactive = t->horizontal;
- hblank = t->hblank;
- hbp = t->hbp;
- hfp = t->hfp;
-
- vactive = t->vertical;
- vblank = t->vblank;
- vbp = t->vbp;
- vfp = t->vfp;
-
- pixel = (hactive + hblank) * (vactive + vblank) * t->rate;
-
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- crtc.color_mode_256 = 1;
- h_screen_off = hactive;
- h_adjust = 1;
-
- break;
- case 16:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- h_screen_off = hactive * 2;
- h_adjust = 1;
-
- crtc.color_mode_256 = 0;
-
- if (screen->fb[0].depth == 15)
- crtc.graphics_mode_32k = 1;
- else
- crtc.graphics_mode_64k = 1;
- break;
- case 24:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- h_screen_off = hactive * 3;
- h_adjust = 1;
-
- crtc.color_mode_256 = 0;
-
- /* SR6 */
- crtc.graphics_mode_true = 1;
- /* SR7 */
- crtc.direct_color_24bit = 0;
- /* SR9 */
- crtc.true_color_32bpp = 0;
- /* SRB */
- crtc.true_color_order = 1;
- break;
- case 32:
- hactive /= 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
-
- h_screen_off = hactive * 4;
- h_adjust = 1;
-
- crtc.color_mode_256 = 0;
-
- /* SR6 */
- crtc.graphics_mode_true = 1;
- /* SR7 */
- crtc.direct_color_24bit = 0;
- /* SR9 */
- crtc.true_color_32bpp = 1;
- /* SRB */
- crtc.true_color_order = 1;
- break;
- }
-
- sisGetClock (pixel, &crtc);
-
- crtc.high_speed_dac_0 = crtc.high_speed_dac_1 = pixel > 135000000;
-
- sisEngThresh (&crtc, pixel, screen->fb[0].bitsPerPixel);
-
- /*
- * Compute horizontal register values from timings
- */
- h_total = hactive + hblank - 5;
- h_display_end = hactive - 1;
- h_blank_start = h_display_end;
- h_blank_end = h_blank_start + hblank;
-
- h_sync_start = hactive + hfp + h_adjust;
- h_sync_end = h_sync_start + hblank - hbp - hfp;
-
- crtc_set_h_total(&crtc, h_total);
- crtc_set_h_display_end (&crtc, h_display_end);
- crtc_set_h_blank_start (&crtc, h_blank_start);
- crtc_set_h_blank_end (&crtc, h_blank_end);
- crtc_set_h_sync_start (&crtc, h_sync_start);
- crtc_set_h_sync_end (&crtc, h_sync_end);
- crtc_set_screen_off (&crtc, h_screen_off);
-
- v_total = vactive + vblank - 2;
- v_retrace_start = vactive + vfp - 1;
- v_retrace_end = v_retrace_start + vblank - vbp - vfp;
- v_display_end = vactive - 1;
- v_blank_start = vactive - 1;
- v_blank_end = v_blank_start + vblank /* - 1 */;
-
- crtc_set_v_total(&crtc, v_total);
- crtc_set_v_retrace_start (&crtc, v_retrace_start);
- crtc.v_retrace_end_0_3 = v_retrace_end;
- crtc_set_v_display_end (&crtc, v_display_end);
- crtc_set_v_blank_start (&crtc, v_blank_start);
- crtc.v_blank_end_0_7 = v_blank_end;
-
-#if 0
- crtc.h_blank_start_0_7 = 0x6a;
- crtc._h_blank_end = 0x9a;
- crtc.h_sync_start_0_7 = 0x6b;
- crtc._h_sync_end = 0x9a;
-
- crtc.v_retrace_start_0_7 = 0x7d;
- crtc._v_retrace_end = 0x23;
- crtc.v_blank_start_0_7 = 0x7d;
- crtc.v_blank_end_0_7 = 0x84;
-
- crtc.crt_cpu_threshold_control_0 = 0xdf; /* SR8 */
- crtc.crt_cpu_threshold_control_1 = 0x00; /* SR9 */
- crtc.extended_clock_generator = 0x40; /* SR13 */
-
- crtc.cursor_h_start_0_7 = 0x83;
- crtc.cursor_v_start_0_7 = 0x6c;
-
- crtc.internal_vclk_0 = 0x68;
- crtc.internal_vclk_1 = 0xc4;
- crtc.misc_control_7 = 0x70;
-#endif
-
- _sisSetCrtc (sisc, &crtc);
- return TRUE;
-}
-
-Bool
-sisDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- sisCardInfo(pScreenPriv);
- union ddc_and_power_control_u _ddc_and_power_control_u;
-
- ddc_and_power_control = sisc->save.crtc.ddc_and_power_control;
-
- kbd_cursor_activate = 0;
- video_memory_activate = 0;
- vga_standby = 0;
- vga_suspend = 0;
- acpi_enable = 0;
- switch (mode) {
- case KD_DPMS_NORMAL:
- break;
- case KD_DPMS_STANDBY:
- vga_standby = 1;
- break;
- case KD_DPMS_SUSPEND:
- vga_suspend = 1;
- break;
- case KD_DPMS_POWERDOWN:
- acpi_enable = 1;
- break;
- }
- PutSrtc (sisc, 0x11, ddc_and_power_control);
- return TRUE;
-}
-
-void
-sisDisable (ScreenPtr pScreen)
-{
-}
-
-void
-sisRestore (KdCardInfo *card)
-{
- SisCardInfo *sisc = (SisCardInfo *) card->driver;
-
- memcpy (sisc->frameBuffer, sisc->save.text_save, SIS_TEXT_SAVE);
- _sisSetCrtc (sisc, &sisc->save.crtc);
- PutSrtc (sisc, 0xb, sisc->save.srb);
- PutSrtc (sisc, 0x5, sisc->save.sr5);
-}
-
-void
-sisScreenFini (KdScreenInfo *screen)
-{
- SisScreenInfo *siss = (SisScreenInfo *) screen->driver;
-
- xfree (siss);
- screen->driver = 0;
-}
-
-void
-sisCardFini (KdCardInfo *card)
-{
- SisCardInfo *sisc = (SisCardInfo *) card->driver;
-
- KdUnmapDevice (sisc->frameBuffer, sisc->memory);
- KdUnmapDevice (sisc->registers, sizeof (SisRec));
-}
-
-KdCardFuncs sisFuncs = {
- sisCardInit,
- sisScreenInit,
- 0,
- sisPreserve,
- sisEnable,
- sisDPMS,
- sisDisable,
- sisRestore,
- sisScreenFini,
- sisCardFini,
- sisCursorInit,
- sisCursorEnable,
- sisCursorDisable,
- sisCursorFini,
- 0,
- sisDrawInit,
- sisDrawEnable,
- sisDrawSync,
- sisDrawDisable,
- sisDrawFini,
- sisGetColors,
- sisPutColors,
-};
diff --git a/hw/kdrive/sis530/sis.h b/hw/kdrive/sis530/sis.h
deleted file mode 100644
index 2a39d0ba2..000000000
--- a/hw/kdrive/sis530/sis.h
+++ /dev/null
@@ -1,1218 +0,0 @@
-/*
- * Id: sis.h,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sis.h,v 1.4 2000/05/06 22:17:49 keithp Exp $ */
-
-#ifndef _SIS_H_
-#define _SIS_H_
-#include "kdrive.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <asm/io.h>
-#include <stdio.h>
-
-/*
- * Linear Addressing 000 0000 - 0ff ffff (16m)
- * Image data transfer 100 0000 - 100 7fff (32k)
- * Empty 100 8000 - 100 81ff
- * MMIO registers 100 8200 - 100 8480
- *
- * We don't care about the image transfer or PCI regs, so
- * this structure starts at the MMIO regs
- */
-
-typedef volatile CARD32 VOL32;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD8 VOL8;
-
-#define SIS_MMIO_OFFSET 0x8200
-
-typedef struct _sis530General {
- VOL32 src_base; /* 8200 */
- VOL16 src_pitch; /* 8204 */
- VOL16 _pad0; /* 8206 */
- VOL16 src_y; /* 8208 */
- VOL16 src_x; /* 820a */
- VOL16 dst_y; /* 820c */
- VOL16 dst_x; /* 820e */
- VOL32 dst_base; /* 8210 */
- VOL16 dst_pitch; /* 8214 */
- VOL16 dst_height; /* 8216 */
- VOL16 rect_width; /* 8218 */
- VOL16 rect_height; /* 821a */
- VOL32 pattern_fg; /* 821c */
- VOL32 pattern_bg; /* 8220 */
- VOL32 src_fg; /* 8224 */
- VOL32 src_bg; /* 8228 */
- VOL8 mask[8]; /* 822c */
- VOL16 clip_left; /* 8234 */
- VOL16 clip_top; /* 8236 */
- VOL16 clip_right; /* 8238 */
- VOL16 clip_bottom; /* 823a */
- VOL32 command; /* 823c */
- VOL32 status; /* 8240 */
- VOL8 _pad1[0xbc]; /* 8244 */
- VOL8 pattern[256]; /* 8300 */
- /* 8400 */
-} SisGeneral;
-
-typedef struct _sis530Line {
- VOL8 _pad0[8]; /* 8200 */
- VOL16 x0; /* 8208 */
- VOL16 y0; /* 820a */
- VOL16 x1; /* 820c */
- VOL16 y1; /* 820e */
- VOL32 dst_base; /* 8210 */
- VOL16 dst_pitch; /* 8214 */
- VOL16 dst_height; /* 8216 */
- VOL16 count; /* 8218 */
- VOL16 style_period; /* 821a */
- VOL32 fg; /* 821c */
- VOL32 bg; /* 8220 */
- VOL8 _pad1[8]; /* 8224 */
- VOL32 style0; /* 822c */
- VOL32 style1; /* 8228 */
- VOL16 clip_left; /* 8234 */
- VOL16 clip_top; /* 8236 */
- VOL16 clip_right; /* 8238 */
- VOL16 clip_bottom; /* 823a */
- VOL32 command; /* 823c */
- VOL32 status; /* 8240 */
- VOL8 _pad2[0xbc]; /* 8244 */
- struct {
- VOL16 x;
- VOL16 y;
- } data[96]; /* 8300 */
- /* 8480 */
-} SisLine;
-
-typedef struct _sis530Transparent {
- VOL32 src_base; /* 8200 */
- VOL16 src_pitch; /* 8204 */
- VOL16 _pad0; /* 8206 */
- VOL16 src_y; /* 8208 */
- VOL16 src_x; /* 820a */
- VOL16 dst_y; /* 820c */
- VOL16 dst_x; /* 820e */
- VOL32 dst_base; /* 8210 */
- VOL16 dst_pitch; /* 8214 */
- VOL16 dst_height; /* 8216 */
- VOL16 rect_width; /* 8218 */
- VOL16 rect_height; /* 821a */
- VOL32 dst_key_high; /* 821c */
- VOL32 dst_key_low; /* 8220 */
- VOL32 src_key_high; /* 8224 */
- VOL32 src_key_low; /* 8228 */
- VOL8 _pad1[8]; /* 822c */
- VOL16 clip_left; /* 8234 */
- VOL16 clip_top; /* 8236 */
- VOL16 clip_right; /* 8238 */
- VOL16 clip_bottom; /* 823a */
- VOL32 command; /* 823c */
- VOL32 status; /* 8240 */
- /* 8244 */
-} SisTransparent;
-
-typedef struct _sis530Multiple {
- VOL8 _pad0[8]; /* 8200 */
- VOL16 count; /* 8208 */
- VOL16 y; /* 820a */
- VOL16 x0_start; /* 820c */
- VOL16 x0_end; /* 820e */
- VOL32 dst_base; /* 8210 */
- VOL16 dst_pitch; /* 8214 */
- VOL16 dst_height; /* 8216 */
- VOL8 _pad1[4]; /* 8218 */
- VOL32 fg; /* 821c */
- VOL32 bg; /* 8220 */
- VOL8 _pad2[8]; /* 8224 */
- VOL8 mask[8]; /* 822c */
- VOL16 clip_left; /* 8234 */
- VOL16 clip_top; /* 8236 */
- VOL16 clip_right; /* 8238 */
- VOL16 clip_bottom; /* 823a */
- VOL32 command; /* 823c */
- VOL32 status; /* 8240 */
- VOL16 x1_start; /* 8244 */
- VOL16 x1_end; /* 8246 */
- VOL8 _pad3[0xb8]; /* 8248 */
- VOL8 pattern[64]; /* 8300 */
- struct {
- VOL16 x_start;
- VOL16 y_end;
- } data[80]; /* 8340 */
- /* 8480 */
-} SisMultiple;
-
-typedef struct _sis530Trapezoid {
- VOL8 _pad0[8]; /* 8200 */
- VOL16 height; /* 8208 */
- VOL16 y; /* 820a */
- VOL16 left_x; /* 820c */
- VOL16 right_x; /* 820e */
- VOL32 dst_base; /* 8210 */
- VOL16 dst_pitch; /* 8214 */
- VOL16 dst_height; /* 8216 */
- VOL8 _pad1[4]; /* 8218 */
- VOL32 fg; /* 821c */
- VOL32 bg; /* 8220 */
- VOL8 _pad2[8]; /* 8224 */
- VOL8 mask[8]; /* 822c */
- VOL16 clip_left; /* 8234 */
- VOL16 clip_top; /* 8236 */
- VOL16 clip_right; /* 8238 */
- VOL16 clip_bottom; /* 823a */
- VOL32 command; /* 823c */
- VOL32 status; /* 8240 */
- VOL16 left_dx; /* 8244 */
- VOL16 left_dy; /* 8246 */
- VOL16 right_dx; /* 8248 */
- VOL16 right_dy; /* 824a */
- VOL32 left_error; /* 824c */
- VOL32 right_error; /* 8250 */
- /* 8254 */
-} SisTrapezoid;
-
-typedef struct _sisAccel {
- VOL8 pad[0x80]; /* 8200 */
- VOL32 src_addr; /* 8280 */
- VOL32 dst_addr; /* 8284 */
- VOL32 pitch; /* 8288 */
- VOL32 dimension; /* 828c */
- VOL32 fg; /* 8290 */
- VOL32 bg; /* 8294 */
-
-
- VOL32 clip_ul; /* 82a0 */
- VOL32 clip_br; /* 82a4 */
-
- VOL16 cmd; /* 82aa */
-
- VOL8 pattern[256]; /* 82ac */
-
-} SisAccel;
-
-typedef struct _sis530 {
- union {
- SisGeneral general;
- SisLine line;
- SisTransparent transparent;
- SisMultiple multiple;
- SisTrapezoid trapezoid;
- SisAccel accel;
- } u;
-} SisRec, *SisPtr;
-
-typedef struct _sisCursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
-} SisCursor;
-
-#define SIS_CURSOR_WIDTH 64
-#define SIS_CURSOR_HEIGHT 64
-
-typedef struct _sisClock {
- CARD32 vclk_numerator;
- BOOL vclk_divide_by_2;
- CARD32 vclk_denominator;
- CARD32 vclk_post_scale;
- BOOL vclk_post_scale_2;
- BOOL high_speed_dac;
-} SisClockRec, *SisClockPtr;
-
-typedef struct _crtc {
-
- union {
- struct {
- CARD8 _io_address_select : 1;
- CARD8 _display_ram_enable : 1;
- CARD8 _clock_select : 2;
- CARD8 : 1;
- CARD8 _odd_even_page : 1;
- CARD8 _h_sync_polarity : 1;
- CARD8 _v_sync_polarity : 1;
- } _misc_output_s;
- CARD8 _misc_output;
- } _misc_output_u; /* 3CC/3C2 */
-
-#define misc_output _misc_output_u._misc_output
-#define io_address_select _misc_output_u._misc_output_s._io_address_select
-#define display_ram_enable _misc_output_u._misc_output_s._display_ram_enable
-#define clock_select _misc_output_u._misc_output_s._clock_select
-#define odd_even_page _misc_output_u._misc_output_s._odd_even_page
-#define h_sync_polarity _misc_output_u._misc_output_s._h_sync_polarity
-#define v_sync_polarity _misc_output_u._misc_output_s._v_sync_polarity
-
- CARD8 h_total_0_7; /* CR0 */
- CARD8 h_display_end_0_7; /* CR1 */
- CARD8 h_blank_start_0_7; /* CR2 */
- union {
- struct {
- CARD8 _h_blank_end_0_4 : 5;
- CARD8 _display_skew : 2;
- CARD8 : 1;
- } _h_blank_end_s;
- CARD8 __h_blank_end; /* CR3 */
- } _h_blank_end_u;
-#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4
-#define display_skew _h_blank_end_u._h_blank_end_s._display_skew
-#define _h_blank_end _h_blank_end_u.__h_blank_end
-
- CARD8 h_sync_start_0_7; /* CR4 */
-
- union {
- struct {
- CARD8 _h_sync_end_0_4 : 5;
- CARD8 _horizontal_skew : 2;
- CARD8 _h_blank_end_5 : 1;
- } _h_sync_end_s;
- CARD8 __h_sync_end; /* CR5 */
- } _h_sync_end_u;
-
-#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4
-#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew
-#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5
-#define _h_sync_end _h_sync_end_u.__h_sync_end
-
- CARD8 v_total_0_7; /* CR6 */
-
- union {
- struct {
- CARD8 _v_total_8 : 1;
- CARD8 _v_display_end_8 : 1;
- CARD8 _v_retrace_start_8 : 1;
- CARD8 _v_blank_start_8 : 1;
- CARD8 _line_compare_8 : 1;
- CARD8 _v_total_9 : 1;
- CARD8 _v_display_end_9 : 1;
- CARD8 _v_retrace_start_9 : 1;
- } _crtc_overflow_s;
- CARD8 _crtc_overflow; /* CR7 */
- } _crtc_overflow_u;
-
-#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8
-#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8
-#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8
-#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8
-#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8
-#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9
-#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9
-#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9
-#define crtc_overflow _crtc_overflow_u._crtc_overflow
-
- CARD8 preset_row_scan; /* CR8 (unused) */
-
- union {
- struct {
- CARD8 ___max_scan_line : 5;
- CARD8 _v_blank_start_9 : 1;
- CARD8 _line_compare_9 : 1;
- CARD8 _double_scan : 1;
- } _max_scan_line_s;
- CARD8 __max_scan_line; /* CR9 */
- } _max_scan_line_u;
-
-#define max_scan_line _max_scan_line_u._max_scan_line_s.___max_scan_line
-#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9
-#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9
-#define double_scan _max_scan_line_u._max_scan_line_s._double_scan
-#define _max_scan_line _max_scan_line_u.__max_scan_line
-
- CARD8 cursor_start; /* CRA */
- CARD8 cursor_end; /* CRB */
-
- CARD8 start_address_8_15; /* CRC */
- CARD8 start_address_0_7; /* CRD */
-
- CARD8 text_cursor_15_8; /* CRE */
- CARD8 text_cursor_7_0; /* CRF */
-
- CARD8 cursor_loc_high;
- CARD8 cursor_loc_low;
-
- CARD8 v_retrace_start_0_7; /* CR10 */
- union {
- struct {
- CARD8 _v_retrace_end_0_3 : 4;
- CARD8 _clear_v_retrace_int : 1;
- CARD8 _disable_v_retrace_int : 1;
- CARD8 _refresh_cycle_select : 1;
- CARD8 _lock_crtc : 1;
- } _v_retrace_end_s;
- CARD8 __v_retrace_end; /* CR11 */
- } _v_retrace_end_u;
-
-#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3
-#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int
-#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int
-#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select
-#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc
-#define _v_retrace_end _v_retrace_end_u.__v_retrace_end
-
- CARD8 v_display_end_0_7; /* CR12 */
-
- CARD8 screen_off_0_7; /* CR13 */
-
- union {
- struct {
- CARD8 ___underline_location : 5;
- CARD8 _count_by_four : 1;
- CARD8 _doubleword_mode : 1;
- CARD8 : 1;
- } _underline_location_s;
- CARD8 __underline_location; /* CR14 */
- } _underline_location_u;
-
-#define underline_location _underline_location_u._underline_location_s.___underline_location
-#define count_by_four _underline_location_u._underline_location_s._count_by_four
-#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode
-#define _underline_location _underline_location_u.__underline_location
-
- CARD8 v_blank_start_0_7; /* CR15 */
- CARD8 v_blank_end_0_7; /* CR16 */
-
- union {
- struct {
- CARD8 _two_bk_cga : 1;
- CARD8 _four_bk_cga : 1;
- CARD8 _v_total_double : 1;
- CARD8 _count_by_two : 1;
- CARD8 : 1;
- CARD8 _address_wrap : 1;
- CARD8 _byte_mode : 1;
- CARD8 _hardware_reset : 1;
- } _crtc_mode_s;
- CARD8 _crtc_mode; /* CR17 */
- } _crtc_mode_u;
-
-#define crtc_mode _crtc_mode_u._crtc_mode
-#define two_bk_cga _crtc_mode_u._crtc_mode_s._two_bk_cga
-#define four_bk_cga _crtc_mode_u._crtc_mode_s._four_bk_cga
-#define v_total_double _crtc_mode_u._crtc_mode_s._v_total_double
-#define count_by_two _crtc_mode_u._crtc_mode_s._count_by_two
-#define address_wrap _crtc_mode_u._crtc_mode_s._address_wrap
-#define byte_mode _crtc_mode_u._crtc_mode_s._byte_mode
-#define hardware_reset _crtc_mode_u._crtc_mode_s._hardware_reset
-
- CARD8 line_compare_0_7; /* CR18 (unused) */
-
- union {
- struct {
- CARD8 _graphics_mode_enable : 1;
- CARD8 _attribute_byte_mda : 1;
- CARD8 _line_graphics_enable : 1;
- CARD8 _background_blink : 1;
- CARD8 : 1;
- CARD8 _pel_panning_compat : 1;
- CARD8 _pixel_clock_double : 1;
- CARD8 p4_p5_source_select : 1;
- } _mode_control_s;
- CARD8 _mode_control;
- } _mode_control_u; /* AR10 */
-
-#define mode_control _mode_control_u._mode_control
-#define graphics_mode_enable _mode_control_u._mode_control_s._graphics_mode_enable
-#define pixel_clock_double _mode_control_u._mode_control_s._pixel_clock_double
-
- CARD8 screen_border_color; /* AR11 */
- CARD8 enable_color_plane; /* AR12 */
- CARD8 horizontal_pixel_pan; /* AR13 */
-
- union {
- struct {
- CARD8 _write_mode : 2;
- CARD8 : 1;
- CARD8 _read_mode : 1;
- CARD8 _odd_even_addressing : 1;
- CARD8 _shift_register_mode : 1;
- CARD8 _color_mode_256 : 1;
- CARD8 : 1;
- } _mode_register_s;
- CARD8 _mode_register;
- } _mode_register_u; /* GR5 */
-
-#define mode_register _mode_register_u._mode_register
-#define color_mode_256 _mode_register_u._mode_register_s._color_mode_256
-#define odd_even_addressing _mode_register_u._mode_register_s._odd_even_addressing
-
- union {
- struct {
- CARD8 _graphics_enable : 1;
- CARD8 _chain_odd_even : 1;
- CARD8 _memory_address_select : 2;
- CARD8 : 4;
- } _misc_register_s;
- CARD8 _misc_register;
- } _misc_register_u; /* GR6 */
-
-#define misc_register _misc_register_u._misc_register
-#define graphics_enable _misc_register_u._misc_register_s._graphics_enable
-#define chain_odd_even _misc_register_u._misc_register_s._chain_odd_even
-#define memory_address_select _misc_register_u._misc_register_s._memory_address_select
-
- CARD8 color_dont_care; /* GR7 */
-
- union {
- struct {
- CARD8 _dot_clock_8_9 : 1;
- CARD8 : 1;
- CARD8 _shifter_load_16 : 1;
- CARD8 _dot_clock_divide_2 : 1;
- CARD8 _shifter_load_32 : 1;
- CARD8 _display_off : 1;
- CARD8 : 2;
- } _clock_mode_s;
- CARD8 _clock_mode;
- } _clock_mode_u; /* SR1 */
-
-#define clock_mode _clock_mode_u._clock_mode
-#define dot_clock_8_9 _clock_mode_u._clock_mode_s._dot_clock_8_9
-#define shifter_load_16 _clock_mode_u._clock_mode_s._shifter_load_16
-#define dot_clock_divide_2 _clock_mode_u._clock_mode_s._dot_clock_divide_2
-#define shifter_load_32 _clock_mode_u._clock_mode_s._shifter_load_32
-#define display_off _clock_mode_u._clock_mode_s._display_off
-
- CARD8 color_plane_w_enable; /* SR2 */
-
- union {
- struct {
- CARD8 : 1;
- CARD8 _extended_memory_size : 1;
- CARD8 _odd_even_disable : 1;
- CARD8 _chain_4_enable : 1;
- CARD8 : 4;
- } _memory_mode_s;
- CARD8 _memory_mode;
- } _memory_mode_u; /* SR4 */
-
-#define memory_mode _memory_mode_u._memory_mode
-#define extended_memory_sz _memory_mode_u._memory_mode_s._extended_memory_size
-#define odd_even_disable _memory_mode_u._memory_mode_s._odd_even_disable
-#define chain_4_enable _memory_mode_u._memory_mode_s._chain_4_enable
-
- union {
- struct {
- CARD8 _enhanced_text_mode : 1;
- CARD8 _enhanced_graphics_mode : 1;
- CARD8 _graphics_mode_32k : 1;
- CARD8 _graphics_mode_64k : 1;
- CARD8 _graphics_mode_true : 1;
- CARD8 _graphics_mode_interlaced: 1;
- CARD8 _graphics_mode_hw_cursor: 1;
- CARD8 _graphics_mode_linear : 1;
- } _graphics_mode_s;
- CARD8 _graphics_mode;
- } _graphics_mode_u; /* SR6 */
-
-#define graphics_mode _graphics_mode_u._graphics_mode
-#define enhanced_text_mode _graphics_mode_u._graphics_mode_s._enhanced_text_mode
-#define enhanced_graphics_mode _graphics_mode_u._graphics_mode_s._enhanced_graphics_mode
-#define graphics_mode_32k _graphics_mode_u._graphics_mode_s._graphics_mode_32k
-#define graphics_mode_64k _graphics_mode_u._graphics_mode_s._graphics_mode_64k
-#define graphics_mode_true _graphics_mode_u._graphics_mode_s._graphics_mode_true
-#define graphics_mode_interlaced _graphics_mode_u._graphics_mode_s._graphics_mode_interlaced
-#define graphics_mode_hw_cursor _graphics_mode_u._graphics_mode_s._graphics_mode_hw_cursor
-#define graphics_mode_linear _graphics_mode_u._graphics_mode_s._graphics_mode_linear
-
- union {
- struct {
- CARD8 _external_dac_reference : 1;
- CARD8 _high_speed_dac_0 : 1;
- CARD8 _direct_color_24bit : 1;
- CARD8 _multi_line_prefetch : 1;
- CARD8 _extended_video_div_2 : 1;
- CARD8 _ramdac_power_save : 1;
- CARD8 : 1;
- CARD8 _merge_video_fifo : 1;
- } _misc_control_0_s;
- CARD8 _misc_control_0;
- } _misc_control_0_u; /* SR7 */
-
-#define misc_control_0 _misc_control_0_u._misc_control_0
-#define external_dac_reference _misc_control_0_u._misc_control_0_s._external_dac_reference
-#define high_speed_dac_0 _misc_control_0_u._misc_control_0_s._high_speed_dac_0
-#define direct_color_24bit _misc_control_0_u._misc_control_0_s._direct_color_24bit
-#define multi_line_prefetch _misc_control_0_u._misc_control_0_s._multi_line_prefetch
-#define extended_video_div_2 _misc_control_0_u._misc_control_0_s._extended_video_div_2
-#define ramdac_power_save _misc_control_0_u._misc_control_0_s._ramdac_power_save
-#define merge_video_fifo _misc_control_0_u._misc_control_0_s._merge_video_fifo
-
- union {
- struct {
- CARD8 _crt_engine_threshold_high_0_3 : 4;
- CARD8 _crt_cpu_threshold_low_0_3 : 4;
- } _crt_cpu_threshold_control_0_s;
- CARD8 _crt_cpu_threshold_control_0;
- } _crt_cpu_threshold_control_0_u; /* SR8 */
-
-#define crt_cpu_threshold_control_0 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0
-#define crt_engine_threshold_high_0_3 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0_s._crt_engine_threshold_high_0_3
-#define crt_cpu_threshold_low_0_3 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0_s._crt_cpu_threshold_low_0_3
-
- union {
- struct {
- CARD8 _crt_cpu_threshold_high_0_3 : 4;
- CARD8 _ascii_attribute_threshold_0_2 : 3;
- CARD8 _true_color_32bpp : 1;
- } _crt_cpu_threshold_control_1_s;
- CARD8 _crt_cpu_threshold_control_1;
- } _crt_cpu_threshold_control_1_u; /* SR9 */
-
-#define crt_cpu_threshold_control_1 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1
-#define crt_cpu_threshold_high_0_3 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._crt_cpu_threshold_high_0_3
-#define ascii_attribute_threshold_0_2 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._ascii_attribute_threshold_0_2
-#define true_color_32bpp _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._true_color_32bpp
-
- union {
- struct {
- CARD8 _v_total_10 : 1;
- CARD8 _v_display_end_10 : 1;
- CARD8 _v_blank_start_10 : 1;
- CARD8 _v_retrace_start_10 : 1;
- CARD8 _screen_off_8_11 : 4;
- } _extended_crt_overflow_s;
- CARD8 _extended_crt_overflow;
- } _extended_crt_overflow_u; /* SRA */
-
-#define extended_crt_overflow _extended_crt_overflow_u._extended_crt_overflow
-#define v_total_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_total_10
-#define v_display_end_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_display_end_10
-#define v_blank_start_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_blank_start_10
-#define v_retrace_start_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_retrace_start_10
-#define screen_off_8_11 _extended_crt_overflow_u._extended_crt_overflow_s._screen_off_8_11
-
- union {
- struct {
- CARD8 _cpu_bitblt_enable : 1; /* enable CPU bitblt */
- CARD8 _packed_16_color_enable : 1; /* 2 pixels per byte? */
- CARD8 _io_gating : 1; /* when write buffer not empty */
- CARD8 _dual_segment_enable : 1; /* ? */
- CARD8 _true_color_modulation : 1; /* ? */
- CARD8 _memory_mapped_mode : 2; /* mmio enable */
- CARD8 _true_color_order : 1; /* 0: RGB 1: BGR */
- } _misc_control_1_s;
- CARD8 _misc_control_1; /* SRB */
- } _misc_control_1_u;
-
-#define misc_control_1 _misc_control_1_u._misc_control_1
-#define cpu_bitblt_enable _misc_control_1_u._misc_control_1_s._cpu_bitblt_enable
-#define memory_mapped_mode _misc_control_1_u._misc_control_1_s._memory_mapped_mode
-#define true_color_modulation _misc_control_1_u._misc_control_1_s._true_color_modulation
-#define true_color_order _misc_control_1_u._misc_control_1_s._true_color_order
-
- union {
- struct {
- CARD8 _sync_reset_enable : 1;
- CARD8 _memory_configuration : 3;
-#define SIS_MEMORY_CONFIG_1M_1BANK 0
-#define SIS_MEMORY_CONFIG_2M_2BANK 1
-#define SIS_MEMORY_CONFIG_4M_2BANK 2
-#define SIS_MEMORY_CONFIG_2M_1BANK 5
-#define SIS_MEMORY_CONFIG_4M_1BANK 6
-#define SIS_MEMORY_CONFIG_8M_2BANK 7
- CARD8 _test_mode_enable : 1;
- CARD8 _read_ahead_enable : 1;
- CARD8 _text_mode_16bit_enable : 1;
- CARD8 _graphics_mode_32bit_enable : 1;
- } _misc_control_2_s;
- CARD8 _misc_control_2;
- } _misc_control_2_u; /* SRC */
-
-#define misc_control_2 _misc_control_2_u._misc_control_2
-#define sync_reset_enable _misc_control_2_u._misc_control_2_s._sync_reset_enable
-#define memory_configuration _misc_control_2_u._misc_control_2_s._memory_configuration
-#define test_mode_enable _misc_control_2_u._misc_control_2_s._test_mode_enable
-#define read_ahead_enable _misc_control_2_u._misc_control_2_s._read_ahead_enable
-#define text_mode_16bit_enable _misc_control_2_u._misc_control_2_s._text_mode_16bit_enable
-#define graphics_mode_32bit_enable _misc_control_2_u._misc_control_2_s._graphics_mode_32bit_enable
-
- union ddc_and_power_control_u {
- struct {
- CARD8 _ddc_clk_programming : 1;
- CARD8 _ddc_data_programming : 1;
- CARD8 : 1;
- CARD8 _acpi_enable : 1;
- CARD8 _kbd_cursor_activate : 1;
- CARD8 _video_memory_activate : 1;
- CARD8 _vga_standby : 1;
- CARD8 _vga_suspend : 1;
- } _ddc_and_power_control_s;
- CARD8 _ddc_and_power_control;
- } _ddc_and_power_control_u; /* SR11 */
-
-#define ddc_and_power_control _ddc_and_power_control_u._ddc_and_power_control
-#define ddc_clk_programming _ddc_and_power_control_u._ddc_and_power_control_s._ddc_clk_programming
-#define ddc_data_programming _ddc_and_power_control_u._ddc_and_power_control_s._ddc_data_programming
-#define acpi_enable _ddc_and_power_control_u._ddc_and_power_control_s._acpi_enable
-#define kbd_cursor_activate _ddc_and_power_control_u._ddc_and_power_control_s._kbd_cursor_activate
-#define video_memory_activate _ddc_and_power_control_u._ddc_and_power_control_s._video_memory_activate
-#define vga_standby _ddc_and_power_control_u._ddc_and_power_control_s._vga_standby
-#define vga_suspend _ddc_and_power_control_u._ddc_and_power_control_s._vga_suspend
-
- union {
- struct {
- CARD8 _h_total_8 : 1;
- CARD8 _h_display_end_8 : 1;
- CARD8 _h_blank_start_8 : 1;
- CARD8 _h_sync_start_8 : 1;
- CARD8 _h_blank_end_6 : 1;
- CARD8 _h_retrace_skew : 3;
- } _extended_horizontal_overflow_s;
- CARD8 _extended_horizontal_overflow;
- } _extended_horizontal_overflow_u; /* SR12 */
-#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow
-#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8
-#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8
-#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8
-#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8
-#define h_blank_end_6 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_end_6
-#define h_retrace_skew _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_retrace_skew
-
- union {
- struct {
- CARD8 : 6;
- CARD8 _vclk_post_scale_2 : 1;
- CARD8 _mclk_post_scale_2 : 1;
- } _extended_clock_generator_s;
- CARD8 _extended_clock_generator;
- } _extended_clock_generator_u; /* SR13 */
-
-#define extended_clock_generator _extended_clock_generator_u._extended_clock_generator
-#define vclk_post_scale_2 _extended_clock_generator_u._extended_clock_generator_s._vclk_post_scale_2
-#define mclk_post_scale_2 _extended_clock_generator_u._extended_clock_generator_s._mclk_post_scale_2
-
- CARD8 cursor_0_red; /* SR14 */
- CARD8 cursor_0_green; /* SR15 */
- CARD8 cursor_0_blue; /* SR16 */
-
- CARD8 cursor_1_red; /* SR17 */
- CARD8 cursor_1_green; /* SR18 */
- CARD8 cursor_1_blue; /* SR19 */
-
- CARD8 cursor_h_start_0_7; /* SR1A */
- union {
- struct {
- CARD8 _cursor_h_start_8_11 : 4;
- CARD8 : 3;
- CARD8 _cursor_mmio_enable : 1;
- } _cusor_h_start_1_s;
- CARD8 _cursor_h_start_1;
- } _cursor_h_start_1_u; /* SR1B */
-
-#define cursor_h_start_1 _cursor_h_start_1_u._cursor_h_start_1
-#define cursor_h_start_8_11 _cursor_h_start_1_u._cursor_h_start_1_s._cursor_h_start_8_11
-
- CARD8 cursor_h_preset_0_5; /* SR1C */
-
- CARD8 cursor_v_start_0_7; /* SR1D */
-
- union {
- struct {
- CARD8 _cursor_v_start_8_10 : 3;
- CARD8 _cursor_side_pattern : 1;
- CARD8 _cursor_pattern : 4;
- } _cusor_v_start_1_s;
- CARD8 _cursor_v_start_1;
- } _cursor_v_start_1_u; /* SR1E */
-
-#define cursor_v_start_1 _cursor_v_start_1_u._cursor_v_start_1
-
- CARD8 cursor_v_preset_0_5; /* SR1F */
-
- CARD8 linear_base_19_26; /* SR20 */
-
- union {
- struct {
- CARD8 _linear_base_27_31 : 5;
- CARD8 _linear_aperture : 3;
-#define SIS_LINEAR_APERTURE_512K 0
-#define SIS_LINEAR_APERTURE_1M 1
-#define SIS_LINEAR_APERTURE_2M 2
-#define SIS_LINEAR_APERTURE_4M 3
-#define SIS_LINEAR_APERTURE_8M 4
- } _linear_base_1_s;
- CARD8 _linear_base_1;
- } _linear_base_1_u; /* SR21 */
-
-#define linear_base_1 _linear_base_1_u._linear_base_1
-#define linear_base_27_31 _linear_base_1_u._linear_base_1_s._linear_base_27_31
-#define linear_aperture _linear_base_1_u._linear_base_1_s._linear_aperture
-
- union {
- struct {
- CARD8 _screen_start_addr_20 : 1;
- CARD8 : 3;
- CARD8 _continuous_mem_access : 1;
- CARD8 : 1;
- CARD8 _power_down_dac : 1;
- CARD8 : 1;
- } _graphics_engine_0_s;
- CARD8 _graphics_engine_0;
- } _graphics_engine_0_u; /* SR26 */
-
-#define graphics_engine_0 _graphics_engine_0_u._graphics_engine_0
-
-
- union {
- struct {
- CARD8 _screen_start_addr_16_19: 4;
- CARD8 _logical_screen_width : 2;
-#define SIS_LOG_SCREEN_WIDTH_1024 0
-#define SIS_LOG_SCREEN_WIDTH_2048 1
-#define SIS_LOG_SCREEN_WIDTH_4096 2
- CARD8 _graphics_prog_enable : 1;
- CARD8 _turbo_queue_enable : 1;
- } _graphics_engine_1_s;
- CARD8 _graphics_engine_1;
- } _graphics_engine_1_u; /* SR27 */
-
-#define graphics_engine_1 _graphics_engine_1_u._graphics_engine_1
-#define screen_start_addr_16_19 _graphics_engine_1_u._graphics_engine_1_s._screen_start_addr_16_19
-#define logical_screen_width _graphics_engine_1_u._graphics_engine_1_s._logical_screen_width
-#define graphics_prog_enable _graphics_engine_1_u._graphics_engine_1_s._graphics_prog_enable
-#define turbo_queue_enable _graphics_engine_1_u._graphics_engine_1_s._turbo_queue_enable
-
-
- union {
- struct {
- CARD8 _mclk_numerator : 7;
- CARD8 _mclk_divide_by_2 : 1;
- } _internal_mclk_0_s;
- CARD8 _internal_mclk_0;
- } _internal_mclk_0_u; /* SR28 */
-
-#define internal_mclk_0 _internal_mclk_0_u._internal_mclk_0
-#define mclk_numerator _internal_mclk_0_u._internal_mclk_0_s._mclk_numerator
-#define mclk_divide_by_2 _internal_mclk_0_u._internal_mclk_0_s._mclk_divide_by_2
-
- union {
- struct {
- CARD8 _mclk_denominator : 5;
- CARD8 _mclk_post_scale : 2;
-#define SIS_MCLK_POST_SCALE_1 0
-#define SIS_MCLK_POST_SCALE_2 1
-#define SIS_MCLK_POST_SCALE_3 2
-#define SIS_MCLK_POST_SCALE_4 3
- CARD8 _mclk_vco_gain : 1;
- } _internal_mclk_1_s;
- CARD8 _internal_mclk_1;
- } _internal_mclk_1_u; /* SR29 */
-
-#define internal_mclk_1 _internal_mclk_1_u._internal_mclk_1
-#define mclk_denominator _internal_mclk_1_u._internal_mclk_1_s._mclk_denominator
-#define mclk_post_scale _internal_mclk_1_u._internal_mclk_1_s._mclk_post_scale
-#define mclk_vco_gain _internal_mclk_1_u._internal_mclk_1_s._mclk_vco_gain
-
- union {
- struct {
- CARD8 _vclk_numerator : 7;
- CARD8 _vclk_divide_by_2 : 1;
- } _internal_vclk_0_s;
- CARD8 _internal_vclk_0;
- } _internal_vclk_0_u; /* SR2A */
-
-#define internal_vclk_0 _internal_vclk_0_u._internal_vclk_0
-#define vclk_numerator _internal_vclk_0_u._internal_vclk_0_s._vclk_numerator
-#define vclk_divide_by_2 _internal_vclk_0_u._internal_vclk_0_s._vclk_divide_by_2
-
- union {
- struct {
- CARD8 _vclk_denominator : 5;
- CARD8 _vclk_post_scale : 2;
-#define SIS_VCLK_POST_SCALE_1 0
-#define SIS_VCLK_POST_SCALE_2 1
-#define SIS_VCLK_POST_SCALE_3 2
-#define SIS_VCLK_POST_SCALE_4 3
- CARD8 _vclk_vco_gain : 1;
- } _internal_vclk_1_s;
- CARD8 _internal_vclk_1;
- } _internal_vclk_1_u; /* SR2B */
-
-#define internal_vclk_1 _internal_vclk_1_u._internal_vclk_1
-#define vclk_denominator _internal_vclk_1_u._internal_vclk_1_s._vclk_denominator
-#define vclk_post_scale _internal_vclk_1_u._internal_vclk_1_s._vclk_post_scale
-#define vclk_vco_gain _internal_vclk_1_u._internal_vclk_1_s._vclk_vco_gain
-
- union {
- struct {
- CARD8 _extended_clock_select : 2;
-#define SIS_CLOCK_SELECT_INTERNAL 0
-#define SIS_CLOCK_SELECT_25MHZ 1
-#define SIS_CLOCK_SELECT_28MHZ 2
- CARD8 _disable_line_compare : 1;
- CARD8 _disable_pci_read_t_o : 1;
- CARD8 _cursor_start_addr_18_21: 4;
- } _misc_control_7_s;
- CARD8 _misc_control_7;
- } _misc_control_7_u; /* SR38 */
-
-#define misc_control_7 _misc_control_7_u._misc_control_7
-#define extended_clock_select _misc_control_7_u._misc_control_7_s._extended_clock_select
-#define disable_line_compare _misc_control_7_u._misc_control_7_s._disable_line_compare
-#define disable_pci_read_t_o _misc_control_7_u._misc_control_7_s._disable_pci_read_t_o
-#define cursor_start_addr_18_21 _misc_control_7_u._misc_control_7_s._cursor_start_addr_18_21
-
- union {
- struct {
- CARD8 _high_speed_dclk : 1;
- CARD8 _sgram_block_write : 1;
- CARD8 _cursor_start_addr_22 : 1;
- CARD8 _dram_texture_read : 1;
- CARD8 _sgram_16mb : 1;
- CARD8 _agp_signal_delay : 2;
- CARD8 _dclk_off : 1;
- } _misc_control_11_s;
- CARD8 _misc_control_11;
- } _misc_control_11_u; /* SR3E */
-
-#define misc_control_11 _misc_control_11_u._misc_control_11
-#define high_speed_dclk _misc_control_11_u._misc_control_11_s._high_speed_dclk
-#define sgram_block_write _misc_control_11_u._misc_control_11_s.__sgram_block_write
-#define cursor_start_addr_22 _misc_control_11_u._misc_control_11_s._cursor_start_addr_22
-#define dram_texture_read _misc_control_11_u._misc_control_11_s._dram_texture_read
-#define sgram_16mb _misc_control_11_u._misc_control_11_s._sgram_16mb
-#define agp_signal_delay _misc_control_11_u._misc_control_11_s._agp_signal_delay
-#define dclk_off _misc_control_11_u._misc_control_11_s._dclk_off
-
- union {
- struct {
- CARD8 : 1;
- CARD8 _flat_panel_low_enable : 1;
- CARD8 _crt_cpu_threshold_low_4: 1;
- CARD8 _crt_engine_threshold_high_4: 1;
- CARD8 _crt_cpu_threshold_high_4 : 1;
- CARD8 _crt_threshold_full_control : 2;
-#define SIS_CRT_32_STAGE_THRESHOLD 0
-#define SIS_CRT_64_STAGE_THRESHOLD 1
-#define SIS_CRT_63_STAGE_THRESHOLD 2
-#define SIS_CRT_256_STAGE_THRESHOLD 3
- CARD8 _high_speed_dac_1 : 1;
- } _misc_control_12_s;
- CARD8 _misc_control_12;
- } _misc_control_12_u; /* SR3F */
-#define misc_control_12 _misc_control_12_u._misc_control_12
-#define flat_panel_low_enable _misc_control_12_u._misc_control_12_s._flat_panel_low_enable
-#define crt_cpu_threshold_low_4 _misc_control_12_u._misc_control_12_s._crt_cpu_threshold_low_4
-#define crt_engine_threshold_high_4 _misc_control_12_u._misc_control_12_s._crt_engine_threshold_high_4
-#define crt_cpu_threshold_high_4 _misc_control_12_u._misc_control_12_s._crt_cpu_threshold_high_4
-#define crt_threshold_full_control _misc_control_12_u._misc_control_12_s._crt_threshold_full_control
-#define high_speed_dac_1 _misc_control_12_u._misc_control_12_s._high_speed_dac_1
-
- /* computed values */
- CARD16 ge_screen_pitch;
- CARD8 bits_per_pixel;
- CARD8 depth;
- CARD8 double_pixel_mode;
- CARD16 pixel_width;
-} SisCrtc;
-
-#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \
- ((crtc)->v_total_8 << 8) | \
- ((crtc)->v_total_9 << 9) | \
- ((crtc)->v_total_10 << 10))
-
-#define crtc_set_v_total(crtc,v) { \
- ((crtc))->v_total_0_7 = (v); \
- ((crtc))->v_total_8 = (v) >> 8; \
- ((crtc))->v_total_9 = (v) >> 9; \
- ((crtc))->v_total_10 = (v) >> 10; \
-}
-
-#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \
- ((crtc)->v_display_end_8 << 8) | \
- ((crtc)->v_display_end_9 << 9) | \
- ((crtc)->v_display_end_10 << 10))
-
-#define crtc_set_v_display_end(crtc,v) {\
- ((crtc))->v_display_end_0_7 = (v); \
- ((crtc))->v_display_end_8 = (v) >> 8; \
- ((crtc))->v_display_end_9 = (v) >> 9; \
- ((crtc))->v_display_end_10 = (v) >> 10; \
-}
-
-#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \
- ((crtc)->v_retrace_start_8 << 8) | \
- ((crtc)->v_retrace_start_9 << 9) | \
- ((crtc)->v_retrace_start_10 << 10))
-
-#define crtc_set_v_retrace_start(crtc,v) {\
- ((crtc))->v_retrace_start_0_7 = (v); \
- ((crtc))->v_retrace_start_8 = (v) >> 8; \
- ((crtc))->v_retrace_start_9 = (v) >> 9; \
- ((crtc))->v_retrace_start_10 = (v) >> 10; \
-}
-
-#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \
- ((crtc)->v_blank_start_8 << 8) | \
- ((crtc)->v_blank_start_9 << 9) | \
- ((crtc)->v_blank_start_10 << 10))
-
-#define crtc_set_v_blank_start(crtc,v) {\
- ((crtc))->v_blank_start_0_7 = (v); \
- ((crtc))->v_blank_start_8 = (v) >> 8; \
- ((crtc))->v_blank_start_9 = (v) >> 9; \
- ((crtc))->v_blank_start_10 = (v) >> 10; \
-}
-
-#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \
- ((crtc)->h_total_8 << 8))
-
-#define crtc_set_h_total(crtc,v) {\
- ((crtc))->h_total_0_7 = (v); \
- ((crtc))->h_total_8 = (v) >> 8; \
-}
-
-#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \
- ((crtc)->h_display_end_8 << 8))
-
-#define crtc_set_h_display_end(crtc,v) {\
- ((crtc))->h_display_end_0_7 = (v); \
- ((crtc))->h_display_end_8 = (v) >> 8; \
-}
-
-#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \
- ((crtc)->h_blank_start_8 << 8))
-
-#define crtc_set_h_blank_start(crtc,v) {\
- ((crtc))->h_blank_start_0_7 = (v); \
- ((crtc))->h_blank_start_8 = (v) >> 8; \
-}
-
-#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \
- ((crtc)->h_blank_end_5 << 5))
-
-#define crtc_set_h_blank_end(crtc,v) {\
- ((crtc))->h_blank_end_0_4 = (v); \
- ((crtc))->h_blank_end_5 = (v) >> 5; \
-}
-
-#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \
- ((crtc)->h_sync_start_8 << 8))
-
-#define crtc_set_h_sync_start(crtc,v) {\
- ((crtc))->h_sync_start_0_7 = (v); \
- ((crtc))->h_sync_start_8 = (v) >> 8; \
-}
-
-#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4)
-
-#define crtc_set_h_sync_end(crtc,v) {\
- ((crtc))->h_sync_end_0_4 = (v); \
-}
-
-#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \
- ((crtc)->screen_off_8_11 << 8))
-
-#define crtc_set_screen_off(crtc,v) {\
- ((crtc))->screen_off_0_7 = (v); \
- ((crtc))->screen_off_8_11 = (v) >> 8; \
-}
-
-#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \
- ((crtc)->ge_screen_width_2 << 2))
-
-#define crtc_set_ge_screen_width(crtc,v) { \
- (crtc)->ge_screen_width_0_1 = (v); \
- (crtc)->ge_screen_width_2 = (v) >> 2; \
-}
-
-#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \
- ((crtc)->h_start_fifo_fetch_8 << 8))
-
-#define crtc_set_h_start_fifo_fetch(crtc,v) {\
- (crtc)->h_start_fifo_fetch_0_7 = (v); \
- (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \
-}
-
-#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \
- ((crtc)->start_address_8_15 << 8) | \
- ((crtc)->start_address_16_19 << 16))
-
-#define crtc_set_start_address(crtc,v) {\
- (crtc)->start_address_0_7 = (v); \
- (crtc)->start_address_8_15 = (v) >> 8; \
- (crtc)->start_address_16_19 = (v) >> 16; \
-}
-
-#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \
- ((crtc)->line_compare_8 << 8) | \
- ((crtc)->line_compare_9 << 9) | \
- ((crtc)->line_compare_10 << 10))
-
-#define crtc_set_line_compare(crtc,v) { \
- ((crtc))->line_compare_0_7 = (v); \
- ((crtc))->line_compare_8 = (v) >> 8; \
- ((crtc))->line_compare_9 = (v) >> 9; \
- ((crtc))->line_compare_10 = (v) >> 10; \
-}
-
-#define crtc_set_cursor_start_addr(crtc,v) { \
- (crtc)->cursor_start_addr_18_21 = (v) >> 18; \
- (crtc)->cursor_start_addr_22 = (v) >> 22; \
-}
-
-#define _sisOutb(v,r) outb(v,r)
-#define _sisInb(r) inb(r)
-
-#define SIS_DAC_INDEX_READ 0x47
-#define SIS_DAC_INDEX_WRITE 0x48
-#define SIS_DAC_DATA 0x49
-
-#define GetCrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x54,i)
-#define PutCrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x54,i,v)
-
-#define GetSrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x44,i)
-#define PutSrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x44,i,v)
-
-#define GetArtc(sisc,i) _sisReadArtc ((sisc)->io_base+0x40,i)
-#define PutArtc(sisc,i,v) _sisWriteArtc ((sisc)->io_base+0x40,i,v)
-
-#define GetGrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x4e,i)
-#define PutGrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x4e,i,v)
-
-#define _sisWaitVRetrace(sisc)
-
-#define LockSis(sisc)
-#define UnlockSis(sisc)
-
-typedef struct _sisTiming {
- /* label */
- int horizontal;
- int vertical;
- int rate;
- /* horizontal timing */
- int hfp; /* front porch */
- int hbp; /* back porch */
- int hblank; /* blanking */
- /* vertical timing */
- int vfp; /* front porch */
- int vbp; /* back porch */
- int vblank; /* blanking */
-} SisTiming;
-
-#define SIS_TEXT_SAVE (64*1024)
-
-typedef struct _sisSave {
- CARD8 srb;
- CARD8 sr5;
- SisCrtc crtc;
- CARD8 text_save[SIS_TEXT_SAVE];
-} SisSave;
-
-typedef struct _sisCardInfo {
- SisPtr sis;
- int memory;
- CARD8 *frameBuffer;
- CARD8 *registers;
- VOL32 *cpu_bitblt;
- CARD32 io_base;
- SisSave save;
-} SisCardInfo;
-
-typedef struct _sisScreenInfo {
- CARD8 *cursor_base;
- CARD32 cursor_off;
- CARD8 *expand;
- CARD32 expand_off;
- int expand_len;
- SisCursor cursor;
-} SisScreenInfo;
-
-#define getSisCardInfo(kd) ((SisCardInfo *) ((kd)->card->driver))
-#define sisCardInfo(kd) SisCardInfo *sisc = getSisCardInfo(kd)
-
-#define getSisScreenInfo(kd) ((SisScreenInfo *) ((kd)->screen->driver))
-#define sisScreenInfo(kd) SisScreenInfo *siss = getSisScreenInfo(kd)
-
-Bool sisCardInit (KdCardInfo *);
-Bool sisScreenInit (KdScreenInfo *);
-Bool sisEnable (ScreenPtr pScreen);
-void sisDisable (ScreenPtr pScreen);
-void sisFini (ScreenPtr pScreen);
-
-Bool sisCursorInit (ScreenPtr pScreen);
-void sisCursorEnable (ScreenPtr pScreen);
-void sisCursorDisable (ScreenPtr pScreen);
-void sisCursorFini (ScreenPtr pScreen);
-void sisRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
-
-Bool sisDrawInit (ScreenPtr pScreen);
-void sisDrawEnable (ScreenPtr pScreen);
-void sisDrawSync (ScreenPtr pScreen);
-void sisDrawDisable (ScreenPtr pScreen);
-void sisDrawFini (ScreenPtr pScreen);
-
-void sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-void sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-
-void SISInitCard (KdCardAttr *attr);
-
-CARD8 _sisReadIndexRegister (CARD32 base, CARD8 index);
-void _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value);
-CARD8 _sisReadArtc (CARD32 base, CARD8 index);
-void _sisWriteArtc (CARD32 base, CARD8 index, CARD8 value);
-
-extern KdCardFuncs sisFuncs;
-
-/*
- * sisclock.c
- */
-void
-sisGetClock (unsigned long clock, SisCrtc *crtc);
-
-void
-sisEngThresh (SisCrtc *crtc, unsigned long vclk, int bpp);
-
-/*
- * siscurs.c
- */
-
-Bool
-sisCursorInit (ScreenPtr pScreen);
-
-void
-sisCursorEnable (ScreenPtr pScreen);
-
-void
-sisCursorDisable (ScreenPtr pScreen);
-
-void
-sisCursorFini (ScreenPtr pScreen);
-
-/* sisdraw.c */
-Bool
-sisDrawInit (ScreenPtr pScreen);
-
-void
-sisDrawEnable (ScreenPtr pScreen);
-
-void
-sisDrawDisable (ScreenPtr pScreen);
-
-void
-sisDrawFini (ScreenPtr pScreen);
-
-#endif /* _SIS_H_ */
diff --git a/hw/kdrive/sis530/sisclock.c b/hw/kdrive/sis530/sisclock.c
deleted file mode 100644
index 4db2a31b9..000000000
--- a/hw/kdrive/sis530/sisclock.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Id: sisclock.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sisclock.c,v 1.1 1999/11/19 13:53:59 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "sis.h"
-#include <stdio.h>
-
-#define FREF 14318180
-#define MIN_VCO FREF
-#define MAX_VCO 230000000
-#define MAX_PSN 0 /* no pre scaler for this chip */
-#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */
-#define max_VLD 1
-
-/*
- * Compute clock values given target frequency
- */
-void
-sisGetClock (unsigned long clock, SisCrtc *crtc)
-{
- unsigned char reg7, reg13, reg2a, reg2b;
- int M, N, P, VLD;
-
- int bestM, bestN, bestP, bestPSN, bestVLD;
- double bestError, abest = 42.0, bestFout;
-
- double Fvco, Fout;
- double error, aerror;
-
- double target = (double) clock;
-
- int M_min = 2;
- int M_max = 128;
-
- int low_N = 2;
- int high_N = 32;
- int PSN = 1;
-
- /*
- * fd = fref*(Numerator/Denumerator)*(Divider/PostScaler)
- *
- * M = Numerator [1:128]
- * N = DeNumerator [1:32]
- * VLD = Divider (Vco Loop Divider) : divide by 1, 2
- * P = Post Scaler : divide by 1, 2, 3, 4
- * PSN = Pre Scaler (Reference Divisor Select)
- *
- * result in vclk[]
- */
-
- P = 1;
- if (target < MAX_VCO / 2)
- P = 2;
- if (target < MAX_VCO / 3)
- P = 3;
- if (target < MAX_VCO / 4)
- P = 4;
- if (target < MAX_VCO / 6)
- P = 6;
- if (target < MAX_VCO / 8)
- P = 8;
-
- Fvco = P * target;
-
- for (N = low_N; N <= high_N; N++)
- {
- double M_desired = Fvco / FREF * N;
-
- if (M_desired > M_max * max_VLD)
- continue;
-
- if ( M_desired > M_max )
- {
- M = (int)(M_desired / 2 + 0.5);
- VLD = 2;
- }
- else
- {
- M = (int)(M_desired + 0.5);
- VLD = 1;
- }
-
- Fout = (double)FREF * (M * VLD)/(N * P);
- error = (target - Fout) / target;
- aerror = (error < 0) ? -error : error;
- if (aerror < abest)
- {
- abest = aerror;
- bestError = error;
- bestM = M;
- bestN = N;
- bestP = P;
- bestPSN = PSN;
- bestVLD = VLD;
- bestFout = Fout;
- }
- }
-
- crtc->vclk_numerator = bestM - 1;
- crtc->vclk_divide_by_2 = bestVLD == 2;
-
- crtc->vclk_denominator = bestN - 1;
- switch (bestP) {
- case 1:
- crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_1;
- crtc->vclk_post_scale_2 = 0;
- break;
- case 2:
- crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_2;
- crtc->vclk_post_scale_2 = 0;
- break;
- case 3:
- crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_3;
- crtc->vclk_post_scale_2 = 0;
- break;
- case 4:
- crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_4;
- crtc->vclk_post_scale_2 = 0;
- break;
- case 6:
- crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_3;
- crtc->vclk_post_scale_2 = 1;
- break;
- case 8:
- crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_4;
- crtc->vclk_post_scale_2 = 1;
- break;
- }
-
- crtc->vclk_vco_gain = 1;
-
- /*
- * Don't know how to set mclk for local frame buffer; for
- * shared frame buffer, mclk is hardwired to bus speed (100MHz)?
- */
-}
-
-sisCalcMclk (SisCrtc *crtc)
-{
- int mclk, Numer, DeNumer;
- double Divider, Scalar;
-
- Numer = crtc->mclk_numerator;
- DeNumer = crtc->mclk_denominator;
- Divider = crtc->mclk_divide_by_2 ? 2.0 : 1.0;
- Scalar = 1.0;
- if (crtc->mclk_post_scale_2)
- {
- switch (crtc->mclk_post_scale) {
- case 2:
- Scalar = 6.0;
- break;
- case 3:
- Scalar = 8.0;
- break;
- }
- }
- else
- {
- switch (crtc->mclk_post_scale) {
- case 0:
- Scalar = 1.0;
- break;
- case 1:
- Scalar = 2.0;
- break;
- case 2:
- Scalar = 3.0;
- break;
- case 3:
- Scalar = 4.0;
- break;
- }
- }
-
- mclk = (int)(FREF*((double)(Numer+1)/(double)(DeNumer+1))*(Divider/Scalar));
-
- return(mclk);
-}
-
-#define UMA_FACTOR 60
-#define LFB_FACTOR 30 // Only if local frame buffer
-#define SIS_SAYS_SO 0x1F // But how is the performance??
-#define CRT_ENG_THRESH 0x0F // But how is the performance??
-#define BUS_WIDTH 64
-#define DFP_BUS_WIDTH 32 // rumour has it for digital flat panel ??
-#define MEGAHZ (1<<20)
-
-void
-sisEngThresh (SisCrtc *crtc, unsigned long vclk, int bpp)
-{
- int threshlow, mclk;
-
- mclk = sisCalcMclk(crtc) / 1000000;
- vclk = vclk / 1000000;
- threshlow = ((((UMA_FACTOR*vclk*bpp)/
- (mclk*BUS_WIDTH))+1)/2)+4;
-
- crtc->crt_cpu_threshold_low_0_3 = threshlow;
- crtc->crt_cpu_threshold_low_4 = threshlow >> 4;
-
- crtc->crt_cpu_threshold_high_0_3 = (SIS_SAYS_SO & 0xf);
- crtc->crt_cpu_threshold_high_4 = 0;
-
- crtc->crt_engine_threshold_high_0_3 = CRT_ENG_THRESH;
- crtc->crt_engine_threshold_high_4 = 1;
-
- crtc->ascii_attribute_threshold_0_2 = (SIS_SAYS_SO >> 4);
-
- crtc->crt_threshold_full_control = SIS_CRT_64_STAGE_THRESHOLD;
-}
diff --git a/hw/kdrive/sis530/siscmap.c b/hw/kdrive/sis530/siscmap.c
deleted file mode 100644
index e52841e9d..000000000
--- a/hw/kdrive/sis530/siscmap.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Id: siscmap.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/siscmap.c,v 1.1 1999/11/19 13:53:59 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "sis.h"
-
-void
-sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- sisCardInfo(pScreenPriv);
-
- LockSis (sisc);
- while (ndef--)
- {
- _sisOutb (pdefs->pixel, sisc->io_base+SIS_DAC_INDEX_READ);
- pdefs->red = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10;
- pdefs->green = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10;
- pdefs->blue = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10;
- pdefs++;
- }
- UnlockSis (sisc);
-}
-
-void
-sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- sisCardInfo(pScreenPriv);
-
- LockSis(sisc);
- _sisWaitVRetrace (sisc);
- while (ndef--)
- {
- _sisOutb (pdefs->pixel, sisc->io_base+SIS_DAC_INDEX_WRITE);
- _sisOutb (pdefs->red >> 10, sisc->io_base+SIS_DAC_DATA);
- _sisOutb (pdefs->green >> 10, sisc->io_base+SIS_DAC_DATA);
- _sisOutb (pdefs->blue >> 10, sisc->io_base+SIS_DAC_DATA);
- pdefs++;
- }
- UnlockSis(sisc);
-}
-
diff --git a/hw/kdrive/sis530/siscurs.c b/hw/kdrive/sis530/siscurs.c
deleted file mode 100644
index b507188c0..000000000
--- a/hw/kdrive/sis530/siscurs.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Id: siscurs.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/siscurs.c,v 1.1 1999/11/19 13:53:59 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "sis.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- sisCardInfo(pScreenPriv); \
- sisScreenInfo(pScreenPriv); \
- SisPtr sis = sisc->sis; \
- SisCursor *pCurPriv = &siss->cursor
-
-static void
-_sisMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
- PutSrtc (sisc, 0x5, 0x86);
- PutSrtc (sisc, 0x1c, xoff & 0x3f);
- PutSrtc (sisc, 0x1f, yoff & 0x3f);
-
- PutSrtc (sisc, 0x1a, xlow);
- PutSrtc (sisc, 0x1b, xhigh & 0xf);
-
- PutSrtc (sisc, 0x1d, ylow);
- PutSrtc (sisc, 0x1e, yhigh & 0x7);
-}
-
-static void
-sisMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- LockSis(sisc);
- _sisMoveCursor (pScreen, x, y);
- UnlockSis(sisc);
-}
-
-static void
-_sisSetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- /* set foreground */
- PutSrtc (sisc, 0x17, pCursor->foreRed >> 10);
- PutSrtc (sisc, 0x18, pCursor->foreGreen >> 10);
- PutSrtc (sisc, 0x19, pCursor->foreBlue >> 10);
-
- /* set background */
- PutSrtc (sisc, 0x14, pCursor->backRed >> 10);
- PutSrtc (sisc, 0x15, pCursor->backGreen >> 10);
- PutSrtc (sisc, 0x16, pCursor->backBlue >> 10);
-}
-
-static void
-sisLoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- unsigned short *ram, r;
- unsigned char *msk, *mskLine, *src, *srcLine;
- unsigned short m, s;
-
- int i, j;
- int cursor_address;
- int src_stride, src_width;
-
- CARD8 sr6;
-
- /*
- * Lock Sis so the cursor doesn't move while we're setting it
- */
- LockSis(sisc);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (unsigned short *) siss->cursor_base;
- mskLine = (unsigned char *) bits->mask;
- srcLine = (unsigned char *) bits->source;
-
- h = bits->height;
- if (h > SIS_CURSOR_HEIGHT)
- h = SIS_CURSOR_HEIGHT;
-
- src_stride = BitmapBytePad(bits->width); /* bytes per line */
- src_width = (bits->width + 7) >> 3;
-
- for (i = 0; i < SIS_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += src_stride;
- srcLine += src_stride;
- for (j = 0; j < SIS_CURSOR_WIDTH / 8; j++) {
-
- unsigned short m, s;
-
- if (i < h && j < src_width)
- {
- m = *msk++;
- s = *src++ & m;
- m = ~m;
- /* mask off right side */
- if (j == src_width - 1 && (bits->width & 7))
- {
- m |= 0xff << (bits->width & 7);
- }
- }
- else
- {
- m = 0xff;
- s = 0x00;
- }
-
- /*
- * The SIS530 HW cursor format is: source(AND) bit,
- * then a mask(XOR) bit, etc.
- * byte swapping in sis530 is:
- * abcd ==> cdab
- */
-
-#define bit(a,n) (((a) >> (n)) & 0x1)
-
- r = ((bit(m, 0) << 7) | (bit(s, 0) << 6) |
- (bit(m, 1) << 5) | (bit(s, 1) << 4) |
- (bit(m, 2) << 3) | (bit(s, 2) << 2) |
- (bit(m, 3) << 1) | (bit(s, 3) << 0) |
- (bit(m, 4) << 15) | (bit(s, 4) << 14) |
- (bit(m, 5) << 13) | (bit(s, 5) << 12) |
- (bit(m, 6) << 11) | (bit(s, 6) << 10) |
- (bit(m, 7) << 9) | (bit(s, 7) << 8));
-
- *ram++ = r;
- }
- }
-
- /* Set new color */
- _sisSetCursorColors (pScreen);
-
- /* Move to new position */
- _sisMoveCursor (pScreen, x, y);
-
- /* Enable cursor */
- sr6 = GetSrtc (sisc, 0x6);
- sr6 |= 0x40;
- PutSrtc (sisc, 0x6, sr6);
-
- UnlockSis(sisc);
-}
-
-static void
-sisUnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CARD8 sr6;
-
- LockSis (sisc);
-
- /* Disable cursor */
- sr6 = GetSrtc (sisc, 0x6);
- sr6 &= ~0x40;
- PutSrtc (sisc, 0x6, sr6);
- PutSrtc (sisc, 0x1b, 0x00);
-
- UnlockSis (sisc);
-}
-
-static Bool
-sisRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- sisLoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-sisUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-sisSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- sisLoadCursor (pScreen, x, y);
- else
- sisUnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec sisPointerSpriteFuncs = {
- sisRealizeCursor,
- sisUnrealizeCursor,
- sisSetCursor,
- sisMoveCursor,
-};
-
-static void
-sisQueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-sisCursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!siss->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = SIS_CURSOR_WIDTH;
- pCurPriv->height= SIS_CURSOR_HEIGHT;
- pScreen->QueryBestSize = sisQueryBestSize;
- miPointerInitialize (pScreen,
- &sisPointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-sisCursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- sisLoadCursor (pScreen, x, y);
- }
- else
- sisUnloadCursor (pScreen);
- }
-}
-
-void
-sisCursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- sisUnloadCursor (pScreen);
- }
- }
-}
-
-void
-sisCursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/sis530/sisdraw.c b/hw/kdrive/sis530/sisdraw.c
deleted file mode 100644
index 82618acab..000000000
--- a/hw/kdrive/sis530/sisdraw.c
+++ /dev/null
@@ -1,1726 +0,0 @@
-/*
- * Id: sisdraw.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c,v 1.5 2000/08/09 17:52:44 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "sis.h"
-#include "sisdraw.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-
-CARD8 sisPatRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0xa0, /* src AND dst */
- /* GXandReverse */ 0x50, /* src AND NOT dst */
- /* GXcopy */ 0xf0, /* src */
- /* GXandInverted*/ 0x0a, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x5a, /* src XOR dst */
- /* GXor */ 0xfa, /* src OR dst */
- /* GXnor */ 0x05, /* NOT src AND NOT dst */
- /* GXequiv */ 0xa5, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xf5, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x0f, /* NOT src */
- /* GXorInverted */ 0xaf, /* NOT src OR dst */
- /* GXnand */ 0x5f, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-CARD8 sisBltRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0x88, /* src AND dst */
- /* GXandReverse */ 0x44, /* src AND NOT dst */
- /* GXcopy */ 0xcc, /* src */
- /* GXandInverted*/ 0x22, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x66, /* src XOR dst */
- /* GXor */ 0xee, /* src OR dst */
- /* GXnor */ 0x11, /* NOT src AND NOT dst */
- /* GXequiv */ 0x99, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xdd, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x33, /* NOT src */
- /* GXorInverted */ 0xbb, /* NOT src OR dst */
- /* GXnand */ 0x77, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-/* Align blts to this boundary or risk trashing an in-progress expand */
-#define SIS_MIN_PATTERN 8
-
-/* Do plane bits in this increment to balance CPU and graphics engine */
-#define SIS_PATTERN_INC 1024
-
-typedef struct _SisExpand {
- SisCardInfo *sisc;
- SisScreenInfo *siss;
- CARD32 off;
- int last;
-} SisExpand;
-
-static void
-sisExpandInit (ScreenPtr pScreen,
- SisExpand *e)
-{
- KdScreenPriv(pScreen);
- sisCardInfo(pScreenPriv);
- sisScreenInfo(pScreenPriv);
-
- e->sisc = sisc;
- e->siss = siss;
- e->off = siss->expand_off;
- e->last = 0;
-}
-
-static CARD32 *
-sisExpandAlloc (SisExpand *e,
- int nb)
-{
- SisCardInfo *sisc = e->sisc;
- SisScreenInfo *siss = e->siss;
- SisPtr sis = sisc->sis;
- CARD32 off;
-
- /* round up to alignment boundary */
- nb = (nb + SIS_MIN_PATTERN-1) & ~(SIS_MIN_PATTERN-1);
-
- off = e->off + e->last;
- if (off + nb > siss->expand_off + siss->expand_len)
- {
- _sisWaitIdleEmpty (sis);
- off = siss->expand_off;
- }
- e->off = off;
- e->last = nb;
- return (CARD32 *) (sisc->frameBuffer + off);
-}
-
-void
-sisGlyphBltClipped (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- Bool imageBlt)
-{
- SetupSis(pDrawable->pScreen);
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
- int height;
- int width;
- int xBack, yBack;
- int hBack, wBack;
- int nb, bwidth, nl;
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- CARD8 *bits8, b;
- CARD16 *bits16;
- CARD32 *bits32;
- BoxPtr extents;
- BoxRec bbox;
- unsigned char alu;
- CARD32 cmd;
- SisExpand expand;
- CARD32 *dst, d;
- int nbytes;
- int shift;
- int x1, y1, x2, y2;
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pBox;
- int nbox;
- int rect_in;
- int widthBlt;
- CharInfoPtr *ppci;
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- if (imageBlt)
- {
- xBack = x;
- yBack = y - FONTASCENT(pGC->font);
- wBack = 0;
- hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- if (hBack)
- {
- height = nglyph;
- ppci = ppciInit;
- while (height--)
- wBack += (*ppci++)->metrics.characterWidth;
- }
- if (wBack < 0)
- {
- xBack = xBack + wBack;
- wBack = -wBack;
- }
- if (hBack < 0)
- {
- yBack = yBack + hBack;
- hBack = -hBack;
- }
- alu = GXcopy;
- }
- else
- {
- wBack = 0;
- alu = pGC->alu;
- }
-
- if (wBack)
- {
- _sisSetSolidRect (sis, pGC->bgPixel, GXcopy, cmd);
- for (nbox = REGION_NUM_RECTS (pClip),
- pBox = REGION_RECTS (pClip);
- nbox--;
- pBox++)
- {
- x1 = xBack;
- x2 = xBack + wBack;
- y1 = yBack;
- y2 = yBack + hBack;
- if (x1 < pBox->x1) x1 = pBox->x1;
- if (x2 > pBox->x2) x2 = pBox->x2;
- if (y1 < pBox->y1) y1 = pBox->y1;
- if (y2 > pBox->y2) y2 = pBox->y2;
- if (x1 < x2 && y1 < y2)
- {
- _sisRect (sis, x1, y1, x2 - x1, y2 - y1, cmd);
- }
- }
- }
-
- sisExpandInit (pDrawable->pScreen, &expand);
-
- sis->u.general.src_fg = pGC->fgPixel;
- sis->u.general.src_pitch = 0;
- sis->u.general.src_x = 0;
- sis->u.general.src_y = 0;
-
- cmd = (SIS_CMD_ENH_COLOR_EXPAND |
- SIS_CMD_SRC_SCREEN |
- SIS_CMD_PAT_FG |
- (sisBltRop[alu] << 8) |
- SIS_CMD_INC_X |
- SIS_CMD_INC_Y |
- SIS_CMD_RECT_CLIP_ENABLE |
- SIS_CMD_TRANSPARENT);
-
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- height = pci->metrics.ascent + pci->metrics.descent;
- width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- widthBlt = (width + 31) & ~31;
- nb = (widthBlt >> 3) * height;
- if (nb)
- {
- x1 = x + pci->metrics.leftSideBearing;
- y1 = y - pci->metrics.ascent;
- bbox.x1 = x1;
- bbox.y1 = y1;
- bbox.x2 = x1 + width;
- bbox.y2 = y1 + height;
- rect_in = RECT_IN_REGION(pGC->pScreen, pClip, &bbox);
- if (rect_in != rgnOUT)
- {
- dst = sisExpandAlloc (&expand, nb);
-
- sis->u.general.src_base = expand.off;
- sis->u.general.dst_x = x1;
- sis->u.general.dst_y = y1;
- sis->u.general.rect_width = widthBlt;
- sis->u.general.rect_height = height;
- nb >>= 2;
- bits32 = (CARD32 *) pci->bits;
- while (nb--)
- {
- d = *bits32++;
- SisInvertBits32 (d);
- *dst++ = d;
- }
- if (rect_in == rgnPART)
- {
- for (nbox = REGION_NUM_RECTS (pClip),
- pBox = REGION_RECTS (pClip);
- nbox--;
- pBox++)
- {
- _sisClip (sis, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- sis->u.general.command = cmd;
- }
- }
- else
- {
- _sisClip (sis, 0, 0, x1+width, pScreenPriv->screen->height);
- sis->u.general.command = cmd;
- }
- }
- }
- x += pci->metrics.characterWidth;
- }
- _sisClip (sis, 0, 0,
- pScreenPriv->screen->width, pScreenPriv->screen->height);
- KdMarkSync (pDrawable->pScreen);
-}
-
-Bool
-sisTEGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit,
- int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- Bool imageBlt)
-{
- SetupSis(pDrawable->pScreen);
- int x, y;
- int widthGlyphs, widthGlyph;
- int widthBlt;
- FbBits depthMask;
- int glyphsPer;
- FontPtr pfont = pGC->font;
- unsigned long *char1, *char2, *char3, *char4, *char5;
- CARD8 alu;
- CARD32 *dst, tmp;
- CARD8 *dst8, *bits8;
- int nb;
- int bwidth;
- CARD32 cmd;
- int h;
- BoxRec bbox;
- SisExpand expand;
- int lwTmp, lw;
- int extra, n;
-
- widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
- if (!widthGlyph)
- return TRUE;
-
- h = FONTASCENT(pfont) + FONTDESCENT(pfont);
- if (!h)
- return TRUE;
-
- x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x;
- y = yInit - FONTASCENT(pfont) + pDrawable->y;
-
- bbox.x1 = x;
- bbox.x2 = x + (widthGlyph * nglyph);
- bbox.y1 = y;
- bbox.y2 = y + h;
-
- switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox))
- {
- case rgnPART:
- if (x < 0 || y < 0)
- return FALSE;
- sisGlyphBltClipped (pDrawable, pGC, xInit, yInit, nglyph, ppci, imageBlt);
- case rgnOUT:
- return TRUE;
- }
-
- if (widthGlyph <= 6)
- glyphsPer = 5;
- else if (widthGlyph <= 8)
- glyphsPer = 4;
- else if (widthGlyph <= 10)
- glyphsPer = 3;
- else if (widthGlyph <= 16)
- glyphsPer = 2;
- else
- glyphsPer = 1;
-
- widthGlyphs = widthGlyph * glyphsPer;
- widthBlt = widthGlyphs;
-
- /* make sure scanlines are 32-bit aligned */
- if (widthGlyphs <= 24)
- widthBlt = 25;
-
- cmd = (SIS_CMD_ENH_COLOR_EXPAND |
- SIS_CMD_SRC_SCREEN |
- SIS_CMD_PAT_FG |
- SIS_CMD_INC_X |
- SIS_CMD_INC_Y);
-
- if (imageBlt)
- {
- sis->u.general.clip_right = bbox.x2;
- cmd |= ((sisBltRop[GXcopy] << 8) |
- SIS_CMD_OPAQUE |
- SIS_CMD_RECT_CLIP_ENABLE);
- }
- else
- {
- cmd |= ((sisBltRop[pGC->alu] << 8) |
- SIS_CMD_TRANSPARENT |
- SIS_CMD_RECT_CLIP_DISABLE);
- }
-
- sisExpandInit (pDrawable->pScreen, &expand);
-
- sis->u.general.src_fg = pGC->fgPixel;
- sis->u.general.src_bg = pGC->bgPixel;
-
- bwidth = (widthBlt + 7) >> 3;
-
- nb = bwidth * h;
-
-#define LoopIt(count, loadup, fetch) \
- while (nglyph >= count) \
- { \
- nglyph -= count; \
- dst = sisExpandAlloc (&expand, nb); \
- sis->u.general.src_base = expand.off; \
- sis->u.general.src_pitch = 0; \
- sis->u.general.src_x = 0; \
- sis->u.general.src_y = 0; \
- sis->u.general.dst_x = x; \
- sis->u.general.dst_y = y; \
- sis->u.general.rect_width = widthBlt; \
- sis->u.general.rect_height = h; \
- x += widthGlyphs; \
- loadup \
- lwTmp = h; \
- while (lwTmp--) { \
- tmp = fetch; \
- SisInvertBits32(tmp); \
- *dst++ = tmp; \
- } \
- sis->u.general.command = cmd; \
- }
-
- switch (glyphsPer) {
- case 5:
- LoopIt(5,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;
- char4 = (unsigned long *) (*ppci++)->bits;
- char5 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | ((*char3++ | ((*char4++ | (*char5++
- << widthGlyph))
- << widthGlyph))
- << widthGlyph))
- << widthGlyph)));
- break;
- case 4:
- LoopIt(4,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;
- char4 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | ((*char3++ | (*char4++
- << widthGlyph))
- << widthGlyph))
- << widthGlyph)));
- break;
- case 3:
- LoopIt(3,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;
- char3 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | ((*char2++ | (*char3++ << widthGlyph)) << widthGlyph)));
- break;
- case 2:
- LoopIt(2,
- char1 = (unsigned long *) (*ppci++)->bits;
- char2 = (unsigned long *) (*ppci++)->bits;,
- (*char1++ | (*char2++ << widthGlyph)));
- break;
- }
-
- widthBlt = (widthGlyph + 31) & ~31;
-
- bwidth = widthBlt >> 3;
-
- nb = bwidth * h;
-
- lw = (widthBlt >> 5) * h;
-
- while (nglyph--)
- {
- dst = (CARD32 *) sisExpandAlloc (&expand, nb);
- char1 = (CARD32 *) (*ppci++)->bits;
- sis->u.general.src_base = expand.off;
- sis->u.general.src_pitch = 0;
- sis->u.general.src_x = 0;
- sis->u.general.src_y = 0;
- sis->u.general.dst_x = x;
- sis->u.general.dst_y = y;
- sis->u.general.rect_width = widthBlt;
- sis->u.general.rect_height = h;
- lwTmp = lw;
- while (lwTmp--)
- {
- tmp = *char1++;
- SisInvertBits32 (tmp);
- *dst++ = tmp;
- }
- sis->u.general.command = cmd;
- x += widthGlyph;
- }
- if (imageBlt)
- sis->u.general.clip_right = pScreenPriv->screen->width;
- KdMarkSync (pDrawable->pScreen);
- return TRUE;
-}
-
-Bool
-sisGlyphBlt(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- Bool imageBlt)
-{
- SetupSis(pDrawable->pScreen);
- int height;
- int width;
- int xBack, yBack;
- int hBack, wBack;
- int nb, bwidth, nl;
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- CARD8 *bits8, b;
- CARD16 *bits16;
- CARD32 *bits32;
- BoxPtr extents;
- BoxRec bbox;
- CharInfoPtr *ppci;
- unsigned char alu;
- CARD32 cmd;
- SisExpand expand;
- CARD32 *dst, d;
- int nbytes;
- int shift;
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- /* compute an approximate (but covering) bounding box */
- ppci = ppciInit;
- width = 0;
- height = nglyph;
- while (height--)
- width += (*ppci++)->metrics.characterWidth;
- if (width < 0)
- {
- bbox.x1 = x + width;
- bbox.x2 = x;
- }
- else
- {
- bbox.x1 = x;
- bbox.x2 = x + width;
- }
- width = FONTMINBOUNDS(pfont,leftSideBearing);
- if (width < 0)
- bbox.x1 += width;
- width = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth);
- if (width > 0)
- bbox.x2 += width;
- bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent);
- bbox.y2 = y + FONTMAXBOUNDS(pfont,descent);
-
- switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox))
- {
- case rgnPART:
- if (bbox.x1 < 0 || bbox.y1 < 0)
- return FALSE;
- sisGlyphBltClipped (pDrawable, pGC,
- x - pDrawable->x, y - pDrawable->y,
- nglyph, ppciInit, imageBlt);
- case rgnOUT:
- return TRUE;
- }
-
- if (imageBlt)
- {
- xBack = x;
- yBack = y - FONTASCENT(pGC->font);
- wBack = 0;
- hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- if (hBack)
- {
- height = nglyph;
- ppci = ppciInit;
- while (height--)
- wBack += (*ppci++)->metrics.characterWidth;
- }
- if (wBack < 0)
- {
- xBack = xBack + wBack;
- wBack = -wBack;
- }
- if (hBack < 0)
- {
- yBack = yBack + hBack;
- hBack = -hBack;
- }
- alu = GXcopy;
- }
- else
- {
- wBack = 0;
- alu = pGC->alu;
- }
-
- if (wBack)
- {
- _sisSetSolidRect (sis, pGC->bgPixel, GXcopy, cmd);
- _sisRect (sis, xBack, yBack, wBack, hBack, cmd);
- }
-
- sisExpandInit (pDrawable->pScreen, &expand);
-
- sis->u.general.src_fg = pGC->fgPixel;
-
- cmd = (SIS_CMD_ENH_COLOR_EXPAND |
- SIS_CMD_SRC_SCREEN |
- SIS_CMD_PAT_FG |
- (sisBltRop[alu] << 8) |
- SIS_CMD_INC_X |
- SIS_CMD_INC_Y |
- SIS_CMD_RECT_CLIP_DISABLE |
- SIS_CMD_TRANSPARENT);
-
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- height = pci->metrics.ascent + pci->metrics.descent;
- width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- /*
- * For glyphs wider than 16 pixels, expand the blt to the nearest multiple
- * of 32; this allows the scanlines to be padded to a 32-bit boundary
- * instead of requiring byte packing
- */
- if (width > 16)
- width = (width + 31) & ~31;
- bwidth = (width + 7) >> 3;
- nb = bwidth * height;
- if (nb)
- {
- dst = sisExpandAlloc (&expand, nb);
-
- sis->u.general.src_base = expand.off;
- sis->u.general.src_pitch = 0;
- sis->u.general.src_x = 0;
- sis->u.general.src_y = 0;
- sis->u.general.dst_x = x + pci->metrics.leftSideBearing;
- sis->u.general.dst_y = y - pci->metrics.ascent;
- sis->u.general.rect_width = width;
- sis->u.general.rect_height = height;
- switch (bwidth) {
- case 1:
- bits8 = (CARD8 *) pci->bits;
- while (height >= 4)
- {
- d = (bits8[0] | (bits8[4] << 8) |
- (bits8[8] << 16) | (bits8[12] << 24));
- SisInvertBits32(d);
- *dst++ = d;
- bits8 += 16;
- height -= 4;
- }
- if (height)
- {
- switch (height) {
- case 3:
- d = bits8[0] | (bits8[4] << 8) | (bits8[8] << 16);
- break;
- case 2:
- d = bits8[0] | (bits8[4] << 8);
- break;
- case 1:
- d = bits8[0];
- break;
- }
- SisInvertBits32(d);
- *dst++ = d;
- }
- break;
- case 2:
- bits16 = (CARD16 *) pci->bits;
- while (height >= 2)
- {
- d = bits16[0] | (bits16[2] << 16);
- SisInvertBits32(d);
- *dst++ = d;
- bits16 += 4;
- height -= 2;
- }
- if (height)
- {
- d = bits16[0];
- SisInvertBits32(d);
- *dst++ = d;
- }
- break;
- default:
- nb >>= 2;
- bits32 = (CARD32 *) pci->bits;
- while (nb--)
- {
- d = *bits32++;
- SisInvertBits32 (d);
- *dst++ = d;
- }
- }
- sis->u.general.command = cmd;
- }
- x += pci->metrics.characterWidth;
- }
- KdMarkSync (pDrawable->pScreen);
- return TRUE;
-}
-/*
- * Blt glyphs using Sis image transfer register, this does both
- * poly glyph blt and image glyph blt (when pglyphBase == 1)
- */
-
-void
-sisPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- FbBits depthMask;
-
- depthMask = FbFullMask (pDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask &&
- pGC->fillStyle == FillSolid)
- {
- if (TERMINALFONT(pGC->font))
- {
- if (sisTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE))
- return;
- }
- else
- {
- if (sisGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE))
- return;
- }
- }
- KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-sisImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- FbBits depthMask;
-
- depthMask = FbFullMask (pDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask)
- {
- if (TERMINALFONT(pGC->font))
- {
- if (sisTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE))
- return;
- }
- else
- {
- if (sisGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE))
- return;
- }
- }
- KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-#define sisPatternDimOk(d) ((d) <= 8 && (((d) & ((d) - 1)) == 0))
-
-BOOL
-sisFillOk (GCPtr pGC)
-{
- FbBits depthMask;
-
- depthMask = FbFullMask(pGC->depth);
- if ((pGC->planemask & depthMask) != depthMask)
- return FALSE;
- switch (pGC->fillStyle) {
- case FillSolid:
- return TRUE;
- case FillTiled:
- return (sisPatternDimOk (pGC->tile.pixmap->drawable.width) &&
- sisPatternDimOk (pGC->tile.pixmap->drawable.height));
- case FillStippled:
- case FillOpaqueStippled:
- return (sisPatternDimOk (pGC->stipple->drawable.width) &&
- sisPatternDimOk (pGC->stipple->drawable.height));
- }
-}
-
-CARD32
-sisStipplePrepare (DrawablePtr pDrawable, GCPtr pGC)
-{
- SetupSis(pGC->pScreen);
- PixmapPtr pStip = pGC->stipple;
- int stipHeight = pStip->drawable.height;
- int xRot, yRot;
- int rot, stipX, stipY;
- FbStip *stip, *stipEnd, bits;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff; /* XXX assumed to be zero */
- int y;
- CARD32 cmd;
-
- xRot = pGC->patOrg.x + pDrawable->x;
- yRot = pGC->patOrg.y + pDrawable->y;
- modulus (- yRot, stipHeight, stipY);
- modulus (- xRot, FB_UNIT, stipX);
- rot = stipX;
-
- fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- for (y = 0; y < 8; y++)
- {
- bits = stip[stipY<<1];
- FbRotLeft(bits, rot);
- SisInvertBits32(bits);
- sis->u.general.mask[y] = (CARD8) bits;
- stipY++;
- if (stipY == stipHeight)
- stipY = 0;
- }
- sis->u.general.pattern_fg = pGC->fgPixel;
-
- cmd = (SIS_CMD_BITBLT |
- SIS_CMD_SRC_SCREEN |
- SIS_CMD_PAT_MONO |
- (sisPatRop[pGC->alu] << 8) |
- SIS_CMD_INC_X |
- SIS_CMD_INC_Y |
- SIS_CMD_RECT_CLIP_DISABLE |
- SIS_CMD_RECT_CLIP_DONT_MERGE);
- if (pGC->fillStyle == FillOpaqueStippled)
- {
- sis->u.general.pattern_bg = pGC->bgPixel;
- cmd |= SIS_CMD_OPAQUE;
- }
- else
- cmd |= SIS_CMD_TRANSPARENT;
- return cmd;
-}
-
-CARD32
-sisTilePrepare (PixmapPtr pTile, int xRot, int yRot, CARD8 alu)
-{
- SetupSis(pTile->drawable.pScreen);
- int tileHeight = pTile->drawable.height;
- int tileWidth = pTile->drawable.width;
- FbBits *tile;
- FbStride tileStride;
- int tileBpp;
- int tileXoff, tileYoff; /* XXX assumed to be zero */
-
- fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
-
- /*
- * Tile the pattern register
- */
- fbTile ((FbBits *) sis->u.general.pattern,
- (8 * tileBpp) >> FB_SHIFT,
- 0,
-
- 8 * tileBpp, 8,
-
- tile,
- tileStride,
- tileWidth * tileBpp,
- tileHeight,
- GXcopy, FB_ALLONES, tileBpp,
- xRot * tileBpp,
- yRot);
-
- return (SIS_CMD_BITBLT |
- SIS_CMD_SRC_SCREEN |
- SIS_CMD_PAT_PATTERN |
- (sisPatRop[alu] << 8) |
- SIS_CMD_INC_X |
- SIS_CMD_INC_Y |
- SIS_CMD_RECT_CLIP_DISABLE |
- SIS_CMD_RECT_CLIP_DONT_MERGE);
-}
-
-void
-sisFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
- unsigned long pixel, int alu)
-{
- SetupSis(pDrawable->pScreen);
- CARD32 cmd;
-
- _sisSetSolidRect(sis,pixel,alu,cmd);
-
- while (nBox--)
- {
- _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd);
- pBox++;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-void
-sisFillBoxStipple (DrawablePtr pDrawable, GCPtr pGC,
- int nBox, BoxPtr pBox)
-{
- SetupSis(pDrawable->pScreen);
- CARD32 cmd;
-
- cmd = sisStipplePrepare (pDrawable, pGC);
-
- while (nBox--)
- {
- _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd);
- pBox++;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-void
-sisFillBoxTiled (DrawablePtr pDrawable,
- int nBox, BoxPtr pBox,
- PixmapPtr pTile, int xRot, int yRot, CARD8 alu)
-{
- SetupSis (pDrawable->pScreen);
- CARD32 cmd;
-
- cmd = sisTilePrepare (pTile, xRot, yRot, alu);
-
- while (nBox--)
- {
- _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd);
- pBox++;
- }
- KdMarkSync (pDrawable->pScreen);
-}
-
-/*
- sisDoBitBlt
- =============
- Bit Blit for all window to window blits.
-*/
-
-void
-sisCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupSis(pDstDrawable->pScreen);
- int srcX, srcY, dstX, dstY;
- int w, h;
- CARD32 flags;
- CARD32 cmd;
- CARD8 alu;
-
- if (pGC)
- {
- alu = pGC->alu;
- if (sourceInvarient (pGC->alu))
- {
- sisFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu);
- return;
- }
- }
- else
- alu = GXcopy;
-
- _sisSetBlt(sis,alu,cmd);
- while (nbox--)
- {
- w = pbox->x2 - pbox->x1;
- h = pbox->y2 - pbox->y1;
- flags = 0;
- if (reverse)
- {
- dstX = pbox->x2 - 1;
- }
- else
- {
- dstX = pbox->x1;
- flags |= SIS_CMD_INC_X;
- }
- srcX = dstX + dx;
-
- if (upsidedown)
- {
- dstY = pbox->y2 - 1;
- }
- else
- {
- dstY = pbox->y1;
- flags |= SIS_CMD_INC_Y;
- }
- srcY = dstY + dy;
-
- _sisBlt (sis, srcX, srcY, dstX, dstY, w, h, cmd|flags);
- pbox++;
- }
- KdMarkSync (pDstDrawable->pScreen);
-}
-
-RegionPtr
-sisCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- KdScreenPriv(pDstDrawable->pScreen);
- FbBits depthMask;
-
- depthMask = FbFullMask (pDstDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask &&
- pSrcDrawable->type == DRAWABLE_WINDOW &&
- pDstDrawable->type == DRAWABLE_WINDOW)
- {
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, sisCopyNtoN, 0, 0);
- }
- return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty);
-}
-
-typedef struct _sis1toNargs {
- unsigned long copyPlaneFG, copyPlaneBG;
-} sis1toNargs;
-
-void
-_sisStipple (ScreenPtr pScreen,
- FbStip *psrcBase,
- FbStride widthSrc,
- CARD8 alu,
- int srcx,
- int srcy,
- int dstx,
- int dsty,
- int width,
- int height)
-{
- SetupSis(pScreen);
- FbStip *psrcLine, *psrc;
- FbStride widthRest;
- FbStip bits, tmp, lastTmp;
- int leftShift, rightShift;
- int nl, nlMiddle;
- int r;
- SisExpand expand;
- CARD32 *dst;
- int hthis;
- int hper;
- int bwidth;
- CARD32 cmd;
-
- sisExpandInit (pScreen, &expand);
-
- /* Compute blt address and parameters */
- psrc = psrcBase + srcy * widthSrc + (srcx >> 5);
- nlMiddle = (width + 31) >> 5;
- leftShift = srcx & 0x1f;
- rightShift = 32 - leftShift;
- widthRest = widthSrc - nlMiddle;
-
- cmd = (SIS_CMD_ENH_COLOR_EXPAND |
- SIS_CMD_SRC_SCREEN |
- SIS_CMD_PAT_FG |
- (sisBltRop[alu] << 8) |
- SIS_CMD_INC_X |
- SIS_CMD_INC_Y |
- SIS_CMD_OPAQUE |
- SIS_CMD_RECT_CLIP_ENABLE);
-
- if (leftShift != 0)
- widthRest--;
-
- sis->u.general.src_x = 0;
- sis->u.general.src_y = 0;
- sis->u.general.dst_x = dstx;
- sis->u.general.rect_width = (width + 31) & ~31;
- sis->u.general.clip_right = (dstx + width);
-
- bwidth = nlMiddle << 2;
- hper = SIS_PATTERN_INC / bwidth;
- if (hper == 0)
- hper = 1;
-
- while (height)
- {
- hthis = hper;
- if (hthis > height)
- hthis = height;
- dst = sisExpandAlloc (&expand, bwidth * hthis);
- sis->u.general.src_base = expand.off;
- sis->u.general.dst_y = dsty;
- sis->u.general.rect_height = hthis;
-
- dsty += hthis;
- height -= hthis;
-
- if (leftShift == 0)
- {
- while (hthis--)
- {
- nl = nlMiddle;
- while (nl--)
- {
- tmp = *psrc++;
- SisInvertBits32(tmp);
- *dst++ = tmp;
- }
- psrc += widthRest;
- }
- }
- else
- {
- while (hthis--)
- {
- bits = *psrc++;
- nl = nlMiddle;
- while (nl--)
- {
- tmp = FbStipLeft(bits, leftShift);
- bits = *psrc++;
- tmp |= FbStipRight(bits, rightShift);
- SisInvertBits32(tmp);
- *dst++ = tmp;
- }
- psrc += widthRest;
- }
- }
- sis->u.general.command = cmd;
- }
- sis->u.general.clip_right = pScreenPriv->screen->width;
-}
-
-void
-sisCopy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- SetupSis(pDstDrawable->pScreen);
-
- sis1toNargs *args = closure;
- int dstx, dsty;
- FbStip *psrcBase;
- FbStride widthSrc;
- int srcBpp;
- int srcXoff, srcYoff;
-
- if (sourceInvarient (pGC->alu))
- {
- sisFillBoxSolid (pDstDrawable, nbox, pbox,
- pGC->bgPixel, pGC->alu);
- return;
- }
-
- fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff);
-
- sis->u.general.src_fg = args->copyPlaneFG;
- sis->u.general.src_bg = args->copyPlaneBG;
-
- while (nbox--)
- {
- dstx = pbox->x1;
- dsty = pbox->y1;
-
- _sisStipple (pDstDrawable->pScreen,
- psrcBase, widthSrc,
- pGC->alu,
- dstx + dx - srcXoff, dsty + dy - srcYoff,
- dstx, dsty,
- pbox->x2 - dstx, pbox->y2 - dsty);
- pbox++;
- }
- KdMarkSync (pDstDrawable->pScreen);
-}
-
-RegionPtr
-sisCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- KdScreenPriv (pDstDrawable->pScreen);
- RegionPtr ret;
- sis1toNargs args;
- FbBits depthMask;
-
- depthMask = FbFullMask (pDstDrawable->depth);
- if ((pGC->planemask & depthMask) == depthMask &&
- pDstDrawable->type == DRAWABLE_WINDOW &&
- pSrcDrawable->depth == 1)
- {
- args.copyPlaneFG = pGC->fgPixel;
- args.copyPlaneBG = pGC->bgPixel;
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, sisCopy1toN, bitPlane, &args);
- }
- return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, bitPlane);
-}
-
-void
-sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- SetupSis(pDrawable->pScreen);
- DDXPointPtr pptFree;
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
- int *pwidthFree;/* copies of the pointers to free */
- CARD32 cmd;
- int nTmp;
- INT16 x, y;
- int width;
-
- if (!sisFillOk (pGC))
- {
- KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
- }
- nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC));
- pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
- pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) DEALLOCATE_LOCAL(pptFree);
- if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
- return;
- }
- n = miClipSpans(fbGetCompositeClip(pGC),
- ppt, pwidth, n,
- pptFree, pwidthFree, fSorted);
- pwidth = pwidthFree;
- ppt = pptFree;
- switch (pGC->fillStyle) {
- case FillSolid:
- _sisSetSolidRect(sis,pGC->fgPixel,pGC->alu,cmd);
- break;
- case FillTiled:
- cmd = sisTilePrepare (pGC->tile.pixmap,
- pGC->patOrg.x + pDrawable->x,
- pGC->patOrg.y + pDrawable->y,
- pGC->alu);
- break;
- default:
- cmd = sisStipplePrepare (pDrawable, pGC);
- break;
- }
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ppt++;
- width = *pwidth++;
- if (width)
- {
- _sisRect(sis,x,y,width,1,cmd);
- }
- }
- KdMarkSync (pDrawable->pScreen);
- DEALLOCATE_LOCAL(pptFree);
- DEALLOCATE_LOCAL(pwidthFree);
-}
-
-#define NUM_STACK_RECTS 1024
-
-void
-sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
- SetupSis(pDrawable->pScreen);
- xRectangle *prect;
- RegionPtr prgnClip;
- register BoxPtr pbox;
- register BoxPtr pboxClipped;
- BoxPtr pboxClippedBase;
- BoxPtr pextent;
- BoxRec stackRects[NUM_STACK_RECTS];
- FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC);
- int numRects;
- int n;
- int xorg, yorg;
- int x, y;
-
- if (!sisFillOk (pGC))
- {
- KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit);
- return;
- }
- prgnClip = fbGetCompositeClip(pGC);
- 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)
- {
- switch (pGC->fillStyle) {
- case FillSolid:
- sisFillBoxSolid(pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->fgPixel, pGC->alu);
- break;
- case FillTiled:
- sisFillBoxTiled(pDrawable,
- pboxClipped-pboxClippedBase, pboxClippedBase,
- pGC->tile.pixmap,
- pGC->patOrg.x + pDrawable->x,
- pGC->patOrg.y + pDrawable->y,
- pGC->alu);
- break;
- case FillStippled:
- case FillOpaqueStippled:
- sisFillBoxStipple (pDrawable, pGC,
- pboxClipped-pboxClippedBase, pboxClippedBase);
- break;
- }
- }
- if (pboxClippedBase != stackRects)
- DEALLOCATE_LOCAL(pboxClippedBase);
-}
-
-static const GCOps sisOps = {
- sisFillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- sisCopyArea,
- sisCopyPlane,
- KdCheckPolyPoint,
- KdCheckPolylines,
- KdCheckPolySegment,
- miPolyRectangle,
- KdCheckPolyArc,
- miFillPolygon,
- sisPolyFillRect,
- KdCheckPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- sisImageGlyphBlt,
- sisPolyGlyphBlt,
- KdCheckPushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-void
-sisValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
-
- fbValidateGC (pGC, changes, pDrawable);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- pGC->ops = (GCOps *) &sisOps;
- else
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
-}
-
-GCFuncs sisGCFuncs = {
- sisValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-int
-sisCreateGC (GCPtr pGC)
-{
- if (!fbCreateGC (pGC))
- return FALSE;
-
- if (pGC->depth != 1)
- pGC->funcs = &sisGCFuncs;
-
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
-
- return TRUE;
-}
-
-void
-sisCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdScreenPriv(pScreen);
- RegionRec rgnDst;
- int dx, dy;
- WindowPtr pwinRoot;
-
- pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-
- fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- 0,
- &rgnDst, dx, dy, sisCopyNtoN, 0, 0);
-
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-void
-sisPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
-{
- KdScreenPriv(pWin->drawable.pScreen);
- PixmapPtr pTile;
-
- if (!REGION_NUM_RECTS(pRegion))
- return;
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixmap:
- pTile = pWin->background.pixmap;
- if (sisPatternDimOk (pTile->drawable.width) &&
- sisPatternDimOk (pTile->drawable.height))
- {
- sisFillBoxTiled ((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pTile,
- pWin->drawable.x, pWin->drawable.y, GXcopy);
- return;
- }
- break;
- case BackgroundPixel:
- sisFillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->background.pixel, GXcopy);
- return;
- }
- break;
- case PW_BORDER:
- if (pWin->borderIsPixel)
- {
- sisFillBoxSolid((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pWin->border.pixel, GXcopy);
- return;
- }
- else
- {
- pTile = pWin->border.pixmap;
- if (sisPatternDimOk (pTile->drawable.width) &&
- sisPatternDimOk (pTile->drawable.height))
- {
- sisFillBoxTiled ((DrawablePtr)pWin,
- (int)REGION_NUM_RECTS(pRegion),
- REGION_RECTS(pRegion),
- pTile,
- pWin->drawable.x, pWin->drawable.y, GXcopy);
- return;
- }
- }
- break;
- }
- KdCheckPaintWindow (pWin, pRegion, what);
-}
-
-Bool
-sisDrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- sisScreenInfo(pScreenPriv);
-
- /*
- * Hook up asynchronous drawing
- */
- KdScreenInitAsync (pScreen);
- /*
- * Replace various fb screen functions
- */
- pScreen->CreateGC = sisCreateGC;
- pScreen->CopyWindow = sisCopyWindow;
- pScreen->PaintWindowBackground = sisPaintWindow;
- pScreen->PaintWindowBorder = sisPaintWindow;
-
- return TRUE;
-}
-
-void
-sisDrawEnable (ScreenPtr pScreen)
-{
- SetupSis(pScreen);
- sisScreenInfo(pScreenPriv);
- CARD32 cmd;
- CARD32 base;
- CARD16 stride;
- CARD16 op;
-
- base = pScreenPriv->screen->fb[0].frameBuffer - sisc->frameBuffer;
- stride = pScreenPriv->screen->fb[0].byteStride;
-#if 0
- sis->u.general.dst_base = base;
- sis->u.general.dst_pitch = stride;
- sis->u.general.src_pitch = stride;
- sis->u.general._pad0 = stride;
- sis->u.general.dst_height = pScreenPriv->screen->height;
- _sisClip (sis, 0, 0,
- pScreenPriv->screen->width, pScreenPriv->screen->height);
- _sisSetSolidRect(sis, pScreen->blackPixel, GXcopy, cmd);
- _sisRect (sis, 0, 0,
- pScreenPriv->screen->width, pScreenPriv->screen->height,
- cmd);
-#endif
- base = (CARD32) (pScreenPriv->screen->fb[0].frameBuffer);
- fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr);
- sis->u.accel.src_addr = (base & 0x3fffff);
- fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr);
- sis->u.accel.dst_addr = (base & 0x3fffff);
- sis->u.accel.pitch = (stride << 16) | stride;
- sis->u.accel.dimension = ((pScreenPriv->screen->height-1) << 16 |
- (pScreenPriv->screen->width - 1));
- sis->u.accel.fg = (sisBltRop[GXcopy] << 24) | 0xf800;
- sis->u.accel.bg = (sisBltRop[GXcopy] << 24) | 0x00;
-
-#define sisLEFT2RIGHT 0x10
-#define sisRIGHT2LEFT 0x00
-#define sisTOP2BOTTOM 0x20
-#define sisBOTTOM2TOP 0x00
-
-#define sisSRCSYSTEM 0x03
-#define sisSRCVIDEO 0x02
-#define sisSRCFG 0x01
-#define sisSRCBG 0x00
-
-#define sisCMDBLT 0x0000
-#define sisCMDBLTMSK 0x0100
-#define sisCMDCOLEXP 0x0200
-#define sisCMDLINE 0x0300
-
-#define sisCMDENHCOLEXP 0x2000
-
-#define sisXINCREASE 0x10
-#define sisYINCREASE 0x20
-#define sisCLIPENABL 0x40
-#define sisCLIPINTRN 0x80
-#define sisCLIPEXTRN 0x00
-
-
-#define sisPATREG 0x08
-#define sisPATFG 0x04
-#define sisPATBG 0x00
-
-#define sisLASTPIX 0x0800
-#define sisXMAJOR 0x0400
-
- op = sisCMDBLT | sisLEFT2RIGHT | sisTOP2BOTTOM | sisSRCFG | sisPATFG;
-
- sis->u.accel.cmd = op;
-
- KdMarkSync (pScreen);
-}
-
-void
-sisDrawSync (ScreenPtr pScreen)
-{
- SetupSis(pScreen);
-
- _sisWaitIdleEmpty (sis);
-}
-
-void
-sisDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-sisDrawFini (ScreenPtr pScreen)
-{
-}
diff --git a/hw/kdrive/sis530/sisdraw.h b/hw/kdrive/sis530/sisdraw.h
deleted file mode 100644
index 4bf67b2ac..000000000
--- a/hw/kdrive/sis530/sisdraw.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Id: sisdraw.h,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sisdraw.h,v 1.1 1999/11/19 13:53:59 hohndel Exp $ */
-
-#ifndef _SISDRAW_H_
-#define _SISDRAW_H_
-
-#define SetupSis(s) KdScreenPriv(s); \
- sisCardInfo(pScreenPriv); \
- SisPtr sis = sisc->sis
-
-#define SIS_CMD_BITBLT (0)
-#define SIS_CMD_COLOR_EXPAND (1)
-#define SIS_CMD_ENH_COLOR_EXPAND (2)
-#define SIS_CMD_MULTI_SCANLINE (3)
-#define SIS_CMD_LINE (4)
-#define SIS_CMD_TRAPEZOID (5)
-#define SIS_CMD_TRANSPARENT_BITBLT (6)
-
-#define SIS_CMD_SRC_SCREEN (0 << 4)
-#define SIS_CMD_SRC_CPU (1 << 4)
-
-#define SIS_CMD_PAT_FG (0 << 6)
-#define SIS_CMD_PAT_PATTERN (1 << 6)
-#define SIS_CMD_PAT_MONO (2 << 6)
-
-/* 8->15 rop */
-
-#define SIS_CMD_DEC_X (0 << 16)
-#define SIS_CMD_INC_X (1 << 16)
-
-#define SIS_CMD_DEC_Y (0 << 17)
-#define SIS_CMD_INC_Y (1 << 17)
-
-#define SIS_CMD_RECT_CLIP_DISABLE (0 << 18)
-#define SIS_CMD_RECT_CLIP_ENABLE (1 << 18)
-
-#define SIS_CMD_OPAQUE (0 << 20)
-#define SIS_CMD_TRANSPARENT (1 << 20)
-
-#define SIS_CMD_RECT_CLIP_MERGE (0 << 26)
-#define SIS_CMD_RECT_CLIP_DONT_MERGE (1 << 26)
-
-#define SIS_STAT_2D_IDLE (1 << 31)
-#define SIS_STAT_3D_IDLE (1 << 30)
-#define SIS_STAT_EMPTY (1 << 29)
-#define SIS_STAT_CPU_BITBLT (0xf << 24)
-#define SIS_STAT_ENH_COLOR_EXPAND (1 << 23)
-#define SIS_STAT_AVAIL (0x1fff)
-
-extern CARD8 sisPatRop[16];
-extern CARD8 sisBltRop[16];
-
-#define _sisSetSolidRect(sis,pix,alu,cmd) {\
- (sis)->u.general.pattern_fg = (pix); \
- (cmd) = (SIS_CMD_BITBLT | \
- SIS_CMD_SRC_SCREEN | \
- SIS_CMD_PAT_FG | \
- (sisPatRop[alu] << 8) | \
- SIS_CMD_INC_X | \
- SIS_CMD_INC_Y | \
- SIS_CMD_RECT_CLIP_DISABLE | \
- SIS_CMD_OPAQUE | \
- SIS_CMD_RECT_CLIP_DONT_MERGE); \
-}
-
-#define _sisClip(sis,x1,y1,x2,y2) { \
- (sis)->u.general.clip_left = (x1); \
- (sis)->u.general.clip_top = (y1); \
- (sis)->u.general.clip_right = (x2); \
- (sis)->u.general.clip_bottom = (y2); \
-}
-
-#define _sisRect(sis,x,y,w,h,cmd) { \
- (sis)->u.general.dst_x = (x); \
- (sis)->u.general.dst_y = (y); \
- (sis)->u.general.rect_width = (w); \
- (sis)->u.general.rect_height = (h); \
- (sis)->u.general.command = (cmd); \
-}
-
-#define _sisSetTransparentPlaneBlt(sis, alu, fg, cmd) { \
- (sis)->u.general.src_fg = (fg); \
- (cmd) = (SIS_CMD_ENH_COLOR_EXPAND | \
- SIS_CMD_SRC_CPU | \
- SIS_CMD_PAT_FG | \
- (sisBltRop[alu] << 8) | \
- SIS_CMD_INC_X | \
- SIS_CMD_INC_Y | \
- SIS_CMD_RECT_CLIP_DISABLE | \
- SIS_CMD_TRANSPARENT | \
- SIS_CMD_RECT_CLIP_DONT_MERGE); \
-}
-
-#define _sisSetOpaquePlaneBlt(sis, alu, fg, bg, cmd) { \
- (sis)->u.general.src_fg = (fg); \
- (sis)->u.general.src_bg = (bg); \
- (cmd) = (SIS_CMD_ENH_COLOR_EXPAND | \
- SIS_CMD_SRC_CPU | \
- SIS_CMD_PAT_FG | \
- (sisBltRop[alu] << 8) | \
- SIS_CMD_INC_X | \
- SIS_CMD_INC_Y | \
- SIS_CMD_RECT_CLIP_DISABLE | \
- SIS_CMD_OPAQUE | \
- SIS_CMD_RECT_CLIP_DONT_MERGE); \
-}
-
-#define _sisPlaneBlt(sis,x,y,w,h,cmd) _sisSolidRect(sis,x,y,w,h,cmd)
-
-#define _sisSetBlt(sis,alu,cmd) { \
- (sis)->u.general.src_base = (sis)->u.general.dst_base; \
- (sis)->u.general.src_pitch = (sis)->u.general.dst_pitch; \
- (cmd) = (SIS_CMD_RECT_CLIP_DONT_MERGE |\
- (sisBltRop[alu] << 8) |\
- SIS_CMD_PAT_FG |\
- SIS_CMD_SRC_SCREEN |\
- SIS_CMD_BITBLT); \
-}
-
-#define _sisBlt(sis,sx,sy,dx,dy,w,h,cmd) { \
- (sis)->u.general.src_x = (sx); \
- (sis)->u.general.src_y = (sy); \
- (sis)->u.general.dst_x = (dx); \
- (sis)->u.general.dst_y = (dy); \
- (sis)->u.general.rect_width = (w); \
- (sis)->u.general.rect_height = (h); \
- (sis)->u.general.command = (cmd); \
-}
-
-#define SIS_IE (SIS_STAT_2D_IDLE|SIS_STAT_EMPTY)
-
-#define _sisWaitIdleEmpty(sis) \
- while (((sis)->u.general.status & SIS_IE) != SIS_IE)
-
-/*
- * Ok, so the Sis530 is broken -- it expects bitmaps to come MSB bit order,
- * but it's willing to take them in LSB byte order. These macros
- * flip bits around without flipping bytes. Instead of using a table
- * and burning memory bandwidth, do them in place with the CPU.
- */
-
-/* The MIPS compiler automatically places these constants in registers */
-#define SisInvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-#define SisInvertBits16(v) { \
- v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \
- v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \
- v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \
-}
-
-#define SisInvertBits8(v) { \
- v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \
- v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \
- v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \
-}
-
-#endif
diff --git a/hw/kdrive/sis530/sisio.c b/hw/kdrive/sis530/sisio.c
deleted file mode 100644
index 1a636a2f9..000000000
--- a/hw/kdrive/sis530/sisio.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Id: sisio.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sisio.c,v 1.1 1999/11/19 13:54:00 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef linux
-#define extern
-#include <asm/io.h>
-#undef extern
-#endif
diff --git a/hw/kdrive/sis530/sisstub.c b/hw/kdrive/sis530/sisstub.c
deleted file mode 100644
index f1f242b40..000000000
--- a/hw/kdrive/sis530/sisstub.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Id: sisstub.c,v 1.1 1999/11/02 08:20:07 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/sis530/sisstub.c,v 1.4 2000/08/09 17:52:44 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "sis.h"
-
-static const int sisCards[] = { 0x6306, 0x0200 };
-
-#define numSisCards (sizeof (sisCards) / sizeof (sisCards[0]))
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
- int i;
-
- for (i = 0; i < numSisCards; i++)
- if (LinuxFindPci (0x1039, sisCards[i], 0, &attr))
- KdCardInfoAdd (&sisFuncs, &attr, (void *) sisCards[i]);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am
deleted file mode 100644
index 129330587..000000000
--- a/hw/kdrive/smi/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir)/hw/kdrive/fbdev \
- -I$(top_srcdir)/hw/kdrive/vesa \
- @KDRIVE_INCS@ \
- @XSERVER_CFLAGS@
-
-bin_PROGRAMS = Xsmi
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-noinst_LIBRARIES = libsmi.a
-
-# smivideo.c # not ready yet
-
-libsmi_a_SOURCES = \
- smi.c \
- smi.h \
- smidraw.c \
- smidraw.h
-
-Xsmi_SOURCES = \
- smistub.c
-
-Xsmi_LDADD = \
- libsmi.a \
- $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c
deleted file mode 100644
index 635fca4da..000000000
--- a/hw/kdrive/smi/smi.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $XFree86: xc/programs/Xserver/hw/kdrive/smi/smi.c,v 1.11 2002/10/18 06:31:17 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "smi.h"
-#include <sys/io.h>
-
-static Bool
-smiCardInit (KdCardInfo *card)
-{
- SmiCardInfo *smic;
-
- ENTER ();
- smic = (SmiCardInfo *) xalloc (sizeof (SmiCardInfo));
- if (!smic)
- return FALSE;
- memset (smic, '\0', sizeof (SmiCardInfo));
-
- (void) smiMapReg (card, smic);
-
- if (!subInitialize (card, &smic->sub))
- {
- xfree (smic);
- return FALSE;
- }
-
- card->driver = smic;
- LEAVE();
- return TRUE;
-}
-
-static Bool
-smiScreenInit (KdScreenInfo *screen)
-{
- SmiCardInfo *smic = screen->card->driver;
- SmiScreenInfo *smis;
-
- ENTER();
- smis = (SmiScreenInfo *) xalloc (sizeof (SmiScreenInfo));
- if (!smis)
- return FALSE;
- memset (smis, '\0', sizeof (SmiScreenInfo));
- screen->driver = smis;
- if (!subScreenInitialize (screen, &smis->sub))
- {
- xfree (smis);
- return FALSE;
- }
- if (!smic->reg_base)
- screen->dumb = TRUE;
- screen->softCursor = TRUE;
-#if SMI_VESA
- smis->screen = smis->sub.fb;
-#else
- smis->screen = smic->sub.fb;
-#endif
- LEAVE();
- return TRUE;
-}
-
-static Bool
-smiInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
- ENTER ();
-#if 0
-#ifdef XV
- KdScreenPriv(pScreen);
- SmiCardInfo *smic = pScreenPriv->screen->card->driver;
- if (smic->media_reg && smic->reg)
- smiInitVideo(pScreen);
-#endif
-#endif
- ret = subInitScreen (pScreen);
- LEAVE();
- return ret;
-}
-
-#ifdef RANDR
-static Bool
-smiRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
-{
- Bool ret;
-
- ENTER ();
- KdCheckSync (pScreen);
-
- ret = subRandRSetConfig (pScreen, randr, rate, pSize);
- LEAVE();
- return ret;
-}
-
-static Bool
-smiRandRInit (ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
-
- ENTER ();
- pScrPriv->rrSetConfig = smiRandRSetConfig;
- LEAVE ();
- return TRUE;
-}
-#endif
-
-static Bool
-smiFinishInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
- ret = subFinishInitScreen (pScreen);
-#ifdef RANDR
- smiRandRInit (pScreen);
-#endif
- return ret;
-}
-
-void
-smiPreserve (KdCardInfo *card)
-{
- ENTER ();
- subPreserve(card);
- LEAVE();
-}
-
-Bool
-smiMapReg (KdCardInfo *card, SmiCardInfo *smic)
-{
- ENTER ();
- smic->io_base = 0; /* only handles one SMI card at standard VGA address */
- smic->reg_base = (CARD8 *) KdMapDevice (SMI_REG_BASE(card),
- SMI_REG_SIZE(card));
-
- if (!smic->reg_base)
- {
- smic->dpr = 0;
- return FALSE;
- }
-
- KdSetMappedMode (SMI_REG_BASE(card),
- SMI_REG_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- smic->dpr = (DPR *) (smic->reg_base + SMI_DPR_OFF(card));
- LEAVE ();
- return TRUE;
-}
-
-void
-smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic)
-{
- ENTER ();
- if (smic->reg_base)
- {
- KdResetMappedMode (SMI_REG_BASE(card),
- SMI_REG_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- KdUnmapDevice ((void *) smic->reg_base, SMI_REG_SIZE(card));
- smic->reg_base = 0;
- smic->dpr = 0;
- }
- LEAVE ();
-}
-
-void
-smiOutb (CARD16 port, CARD8 val)
-{
- asm volatile ("outb %b0,%w1" : : "a" (val), "d" (port));
-}
-
-CARD8
-smiInb (CARD16 port)
-{
- CARD8 v;
- asm volatile ("inb %w1,%b0" : "=a" (v) : "d" (port));
- return v;
-}
-
-CARD8
-smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id)
-{
- smiOutb (smic->io_base + addr, id);
- return smiInb (smic->io_base + data);
-}
-
-void
-smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val)
-{
- smiOutb (smic->io_base + addr, id);
- smiOutb (smic->io_base + data, val);
-}
-
-void
-smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic)
-{
- ENTER ();
- if (!smic->reg_base)
- smiMapReg (card, smic);
- LEAVE();
-}
-
-void
-smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic)
-{
- smiUnmapReg (card, smic);
-}
-
-static Bool
-smiDPMS (ScreenPtr pScreen, int mode)
-{
- Bool ret;
- ENTER ();
- ret = subDPMS (pScreen, mode);
- LEAVE ();
- return ret;
-}
-
-Bool
-smiEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- SmiCardInfo *smic = pScreenPriv->card->driver;
-
- ENTER ();
- iopl (3);
- if (!subEnable (pScreen))
- return FALSE;
-
- smiSetMMIO (pScreenPriv->card, smic);
- smiDPMS (pScreen, KD_DPMS_NORMAL);
-#if 0
-#ifdef XV
- KdXVEnable (pScreen);
-#endif
-#endif
- LEAVE ();
- return TRUE;
-}
-
-void
-smiDisable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- SmiCardInfo *smic = pScreenPriv->card->driver;
-
- ENTER ();
-#if 0
-#ifdef XV
- KdXVDisable (pScreen);
-#endif
-#endif
- smiResetMMIO (pScreenPriv->card, smic);
- subDisable (pScreen);
- LEAVE ();
-}
-
-static void
-smiRestore (KdCardInfo *card)
-{
- ENTER ();
- subRestore (card);
- LEAVE();
-}
-
-static void
-smiScreenFini (KdScreenInfo *screen)
-{
- SmiScreenInfo *smis = (SmiScreenInfo *) screen->driver;
-
- ENTER ();
- subScreenFini (screen);
- xfree (smis);
- screen->driver = 0;
- LEAVE ();
-}
-
-static void
-smiCardFini (KdCardInfo *card)
-{
- SmiCardInfo *smic = card->driver;
-
- ENTER ();
- smiUnmapReg (card, smic);
- subCardFini (card);
- LEAVE ();
-}
-
-#define smiCursorInit 0 /* initCursor */
-#define smiCursorEnable 0 /* enableCursor */
-#define smiCursorDisable 0 /* disableCursor */
-#define smiCursorFini 0 /* finiCursor */
-#define smiRecolorCursor 0 /* recolorCursor */
-
-KdCardFuncs smiFuncs = {
- smiCardInit, /* cardinit */
- smiScreenInit, /* scrinit */
- smiInitScreen, /* initScreen */
- smiFinishInitScreen, /* finishInitScreen */
- subCreateResources, /* createRes */
- smiPreserve, /* preserve */
- smiEnable, /* enable */
- smiDPMS, /* dpms */
- smiDisable, /* disable */
- smiRestore, /* restore */
- smiScreenFini, /* scrfini */
- smiCardFini, /* cardfini */
-
- smiCursorInit, /* initCursor */
- smiCursorEnable, /* enableCursor */
- smiCursorDisable, /* disableCursor */
- smiCursorFini, /* finiCursor */
- smiRecolorCursor, /* recolorCursor */
-
- smiDrawInit, /* initAccel */
- smiDrawEnable, /* enableAccel */
- smiDrawSync, /* syncAccel */
- smiDrawDisable, /* disableAccel */
- smiDrawFini, /* finiAccel */
-
- subGetColors, /* getColors */
- subPutColors, /* putColors */
-};
diff --git a/hw/kdrive/smi/smi.h b/hw/kdrive/smi/smi.h
deleted file mode 100644
index abee819bf..000000000
--- a/hw/kdrive/smi/smi.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Id: smi.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $XFree86: xc/programs/Xserver/hw/kdrive/smi/smi.h,v 1.6 2001/07/24 19:06:03 keithp Exp $ */
-
-#ifndef _SMI_H_
-#define _SMI_H_
-
-#define SMI_VESA 0
-
-#if SMI_VESA
-#include <vesa.h>
-#define subGetColors vesaGetColors
-#define subPutColors vesaPutColors
-#define subInitialize vesaInitialize
-#define subScreenInitialize vesaScreenInitialize
-#define subInitScreen vesaInitScreen
-#define subFinishInitScreen vesaFinishInitScreen
-#define subCreateResources vesaCreateResources
-#define subRandRSetConfig vesaRandRSetConfig
-#define subPreserve vesaPreserve
-#define subEnable vesaEnable
-#define subDPMS vesaDPMS
-#define subRestore vesaRestore
-#define subScreenFini vesaScreenFini
-#define subCardFini vesaCardFini
-#define subDisable vesaDisable
-#define SubCardPrivRec VesaCardPrivRec
-#define SubScreenPrivRec VesaScreenPrivRec
-#define subProcessArgument(c,v,i) vesaProcessArgument(c,v,i)
-#else
-#include <fbdev.h>
-#define subGetColors fbdevGetColors
-#define subPutColors fbdevPutColors
-#define subInitialize fbdevInitialize
-#define subScreenInitialize fbdevScreenInitialize
-#define subInitScreen fbdevInitScreen
-#define subFinishInitScreen fbdevFinishInitScreen
-#define subCreateResources fbdevCreateResources
-#define subRandRSetConfig fbdevRandRSetConfig
-#define subPreserve fbdevPreserve
-#define subEnable fbdevEnable
-#define subDPMS fbdevDPMS
-#define subRestore fbdevRestore
-#define subScreenFini fbdevScreenFini
-#define subCardFini fbdevCardFini
-#define subDisable fbdevDisable
-#define SubCardPrivRec FbdevPriv
-#define SubScreenPrivRec FbdevScrPriv
-#define subProcessArgument(c,v,i) 0
-#endif
-
-#include "kxv.h"
-
-#define SMI_DEBUG 0
-#if SMI_DEBUG
-#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
-#else
-#define DBGOUT(fmt,a...)
-#endif
-
-#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
-#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
-
-/*
- * offset from ioport beginning
- */
-
-#define SMI_IO_BASE(c) ((c)->attr.io)
-#define SMI_REG_BASE(c) ((c)->attr.address[0])
-#define SMI_REG_SIZE(c) (4096)
-
-#define SMI_DPR_OFF(c) (0x00000)
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-/* DPR reg */
-typedef struct _DPR {
- VOL32 src_xy; /* 0x00 */
- VOL32 dst_xy; /* 0x04 */
- VOL32 dst_wh; /* 0x08 */
- VOL32 accel_cmd; /* 0x0c */
- VOL32 src_stride; /* 0x10 */
- VOL32 fg; /* 0x14 */
- VOL32 bg; /* 0x18 */
- VOL32 data_format; /* 0x1c */
- VOL32 transparent; /* 0x20 */
- VOL32 mask1; /* 0x24 ? */
- VOL32 mask2; /* 0x28 ? */
- VOL32 scissors_ul; /* 0x2c */
- VOL32 scissors_lr; /* 0x30 */
- VOL32 mask3; /* 0x34 */
- VOL32 mask4; /* 0x38 */
- VOL32 dst_stride; /* 0x3c */
- VOL32 unknown_40; /* 0x40 */
- VOL32 unknown_44; /* 0x44 */
-} DPR;
-
-#define SMI_XY(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16))
-
-/* 2D Engine commands */
-#define SMI_TRANSPARENT_SRC 0x00000100
-#define SMI_TRANSPARENT_DEST 0x00000300
-
-#define SMI_OPAQUE_PXL 0x00000000
-#define SMI_TRANSPARENT_PXL 0x00000400
-
-#define SMI_MONO_PACK_8 0x00001000
-#define SMI_MONO_PACK_16 0x00002000
-#define SMI_MONO_PACK_32 0x00003000
-
-#define SMI_ROP2_SRC 0x00008000
-#define SMI_ROP2_PAT 0x0000C000
-#define SMI_ROP3 0x00000000
-
-#define SMI_BITBLT 0x00000000
-#define SMI_RECT_FILL 0x00010000
-#define SMI_TRAPEZOID_FILL 0x00030000
-#define SMI_SHORT_STROKE 0x00060000
-#define SMI_BRESENHAM_LINE 0x00070000
-#define SMI_HOSTBLT_WRITE 0x00080000
-#define SMI_HOSTBLT_READ 0x00090000
-#define SMI_ROTATE_BLT 0x000B0000
-
-#define SMI_SRC_COLOR 0x00000000
-#define SMI_SRC_MONOCHROME 0x00400000
-
-#define SMI_GRAPHICS_STRETCH 0x00800000
-
-#define SMI_ROTATE_CW 0x01000000
-#define SMI_ROTATE_CCW 0x02000000
-
-#define SMI_MAJOR_X 0x00000000
-#define SMI_MAJOR_Y 0x04000000
-
-#define SMI_LEFT_TO_RIGHT 0x00000000
-#define SMI_RIGHT_TO_LEFT 0x08000000
-
-#define SMI_COLOR_PATTERN 0x40000000
-#define SMI_MONO_PATTERN 0x00000000
-
-#define SMI_QUICK_START 0x10000000
-#define SMI_START_ENGINE 0x80000000
-
-#define VGA_SEQ_INDEX 0x3C4
-#define VGA_SEQ_DATA 0x3C5
-
-typedef struct _smiCardInfo {
- SubCardPrivRec sub;
- CARD16 io_base;
- CARD8 *reg_base;
- DPR *dpr;
- int avail;
-} SmiCardInfo;
-
-#define getSmiCardInfo(kd) ((SmiCardInfo *) ((kd)->card->driver))
-#define smiCardInfo(kd) SmiCardInfo *smic = getSmiCardInfo(kd)
-
-typedef struct _smiScreenInfo {
- SubScreenPrivRec sub;
- CARD8 *screen;
- CARD32 stride;
- CARD32 data_format;
- CARD8 dpr_vpr_enable;
-} SmiScreenInfo;
-
-#define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver))
-#define smiScreenInfo(kd) SmiScreenInfo *smis = getSmiScreenInfo(kd)
-
-void
-smiPreserve (KdCardInfo *card);
-
-Bool
-smiMapReg (KdCardInfo *card, SmiCardInfo *smic);
-
-void
-smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic);
-
-void
-smiOutb (CARD16 port, CARD8 val);
-
-CARD8
-smiInb (CARD16 port);
-
-CARD8
-smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id);
-
-void
-smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val);
-
-void
-smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic);
-
-void
-smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic);
-
-Bool
-smiEnable (ScreenPtr pScreen);
-
-void
-smiDisable (ScreenPtr pScreen);
-
-void
-smiWaitAvail(SmiCardInfo *smic, int n);
-
-void
-smiWaitIdle (SmiCardInfo *smic);
-
-Bool
-smiDrawSetup (ScreenPtr pScreen);
-
-Bool
-smiDrawInit (ScreenPtr pScreen);
-
-void
-smiDrawReinit (ScreenPtr pScreen);
-
-void
-smiDrawEnable (ScreenPtr pScreen);
-
-void
-smiDrawSync (ScreenPtr pScreen);
-
-void
-smiDrawDisable (ScreenPtr pScreen);
-
-void
-smiDrawFini (ScreenPtr pScreen);
-
-CARD8
-smiReadIndex (SmiCardInfo *smic, CARD16 port, CARD8 index);
-
-void
-smiWriteIndex (SmiCardInfo *smic, CARD16 port, CARD8 index, CARD8 value);
-
-extern KdCardFuncs smiFuncs;
-
-#endif /* _SMI_H_ */
diff --git a/hw/kdrive/smi/smidraw.c b/hw/kdrive/smi/smidraw.c
deleted file mode 100644
index d1691fce0..000000000
--- a/hw/kdrive/smi/smidraw.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Id: smidraw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $XFree86: xc/programs/Xserver/hw/kdrive/smi/smidraw.c,v 1.7 2001/07/24 19:06:03 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "smi.h"
-#include "smidraw.h"
-
-#include <X11/Xmd.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-#include "picturestr.h"
-
-CARD8 smiBltRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0x88, /* src AND dst */
- /* GXandReverse */ 0x44, /* src AND NOT dst */
- /* GXcopy */ 0xcc, /* src */
- /* GXandInverted*/ 0x22, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x66, /* src XOR dst */
- /* GXor */ 0xee, /* src OR dst */
- /* GXnor */ 0x11, /* NOT src AND NOT dst */
- /* GXequiv */ 0x99, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xdd, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x33, /* NOT src */
- /* GXorInverted */ 0xbb, /* NOT src OR dst */
- /* GXnand */ 0x77, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-CARD8 smiSolidRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0xa0, /* src AND dst */
- /* GXandReverse */ 0x50, /* src AND NOT dst */
- /* GXcopy */ 0xf0, /* src */
- /* GXandInverted*/ 0x0a, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x5a, /* src XOR dst */
- /* GXor */ 0xfa, /* src OR dst */
- /* GXnor */ 0x05, /* NOT src AND NOT dst */
- /* GXequiv */ 0xa5, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xf5, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x0f, /* NOT src */
- /* GXorInverted */ 0xaf, /* NOT src OR dst */
- /* GXnand */ 0x5f, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-
-#define GET_STATUS(smic) smiGetIndex (smic, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16)
-
-#define ENGINE_IDLE_EMPTY(smic) ((GET_STATUS(smic) & 0x18) == 0x10)
-#define FIFO_EMPTY(smic) ((GET_STATUS(smic) & 0x10) == 0x10)
-
-#define MAX_FIFO 16
-
-void
-smiWaitAvail(SmiCardInfo *smic, int n)
-{
- if (smic->avail < n)
- {
- while (!FIFO_EMPTY (smic))
- ;
- smic->avail = MAX_FIFO;
- }
- smic->avail -= n;
-}
-
-void
-smiWaitIdle (SmiCardInfo *smic)
-{
- while (!ENGINE_IDLE_EMPTY (smic))
- ;
- smic->avail = MAX_FIFO;
-}
-
-static SmiCardInfo *smic;
-static SmiScreenInfo *smis;
-static DPR *dpr;
-static CARD32 accel_cmd;
-
-static Bool
-smiSetup (ScreenPtr pScreen, int wait)
-{
- KdScreenPriv(pScreen);
-
- smis = getSmiScreenInfo (pScreenPriv);
- smic = getSmiCardInfo(pScreenPriv);
- dpr = smic->dpr;
-
- if (!dpr)
- return FALSE;
-
- /* enable DPR/VPR registers */
- smiSetIndex (smic, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21,
- smis->dpr_vpr_enable);
-
- smiWaitAvail (smic, wait + 9);
- dpr->src_stride = (smis->stride << 16) | smis->stride;
- dpr->data_format = smis->data_format;
- dpr->mask1 = 0xffffffff;
- dpr->mask2 = 0xffffffff;
- dpr->dst_stride = (smis->stride << 16) | smis->stride;
- dpr->unknown_40 = 0x0;
- dpr->unknown_44 = 0x0;
- dpr->scissors_ul = 0x0;
- dpr->scissors_lr = SMI_XY(4095,4095);
-
- return TRUE;
-}
-
-static Bool
-smiPrepareSolid (PixmapPtr pPixmap,
- int alu,
- Pixel pm,
- Pixel fg)
-{
- if (~pm & FbFullMask(pPixmap->drawable.depth))
- return FALSE;
-
- if (!smiSetup (pPixmap->drawable.pScreen, 3))
- return FALSE;
-
- accel_cmd = smiSolidRop[alu] | SMI_BITBLT | SMI_START_ENGINE;
- dpr->fg = fg;
- dpr->mask3 = 0xffffffff;
- dpr->mask4 = 0xffffffff;
- return TRUE;
-}
-
-static void
-smiSolid (int x1, int y1, int x2, int y2)
-{
- smiWaitAvail(smic,3);
- dpr->dst_xy = SMI_XY(x1,y1);
- dpr->dst_wh = SMI_XY(x2-x1,y2-y1);
- dpr->accel_cmd = accel_cmd;
-}
-
-static void
-smiDoneSolid (void)
-{
-}
-
-static int copyDx;
-static int copyDy;
-
-static Bool
-smiPrepareCopy (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- int dx,
- int dy,
- int alu,
- Pixel pm)
-{
- if (~pm & FbFullMask(pSrcPixmap->drawable.depth))
- return FALSE;
-
- if (!smiSetup (pSrcPixmap->drawable.pScreen, 0))
- return FALSE;
-
- accel_cmd = smiBltRop[alu] | SMI_BITBLT | SMI_START_ENGINE;
-
- copyDx = dx;
- copyDy = dy;
- if (dy < 0 || (dy == 0 && dx < 0))
- accel_cmd |= SMI_RIGHT_TO_LEFT;
- return TRUE;
-}
-
-static void
-smiCopy (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int w,
- int h)
-{
- if (accel_cmd & SMI_RIGHT_TO_LEFT)
- {
- srcX += w - 1;
- dstX += w - 1;
- srcY += h - 1;
- dstY += h - 1;
- }
- smiWaitAvail (smic, 4);
- dpr->src_xy = SMI_XY (srcX, srcY);
- dpr->dst_xy = SMI_XY (dstX, dstY);
- dpr->dst_wh = SMI_XY (w, h);
- dpr->accel_cmd = accel_cmd;
-}
-
-static void
-smiDoneCopy (void)
-{
-}
-
-KaaScreenInfoRec smiKaa = {
- smiPrepareSolid,
- smiSolid,
- smiDoneSolid,
-
- smiPrepareCopy,
- smiCopy,
- smiDoneCopy,
-};
-
-Bool
-smiDrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- smiCardInfo (pScreenPriv);
-
- ENTER ();
- if (pScreenPriv->screen->fb[0].depth == 4)
- {
- LEAVE ();
- return FALSE;
- }
-
- if (!smic->dpr)
- {
- LEAVE ();
- return FALSE;
- }
-
- if (!kaaDrawInit (pScreen, &smiKaa))
- {
- LEAVE ();
- return FALSE;
- }
-
- LEAVE ();
- return TRUE;
-}
-
-void
-smiDrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- int i;
- static const int xyAddress[] = { 320, 400, 512, 640, 800, 1024, 1280, 1600, 2048 };
-
- ENTER ();
- smis = getSmiScreenInfo (pScreenPriv);
- smic = getSmiCardInfo(pScreenPriv);
- dpr = smic->dpr;
-
- smis->stride = pScreenPriv->screen->fb[0].byteStride;
- smis->dpr_vpr_enable = smiGetIndex (smic, VGA_SEQ_INDEX,
- VGA_SEQ_DATA, 0x21) & ~0x03;
-
- switch (pScreenPriv->screen->fb[0].depth) {
- case 8:
- smis->data_format = 0x00000000;
- break;
- case 15:
- case 16:
- smis->data_format = 0x00100000;
- smis->stride >>= 1;
- break;
- case 24:
- smis->data_format = 0x00300000;
- break;
- case 32:
- smis->data_format = 0x00200000;
- smis->stride >>= 2;
- break;
- }
- for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++)
- {
- if (xyAddress[i] == pScreenPriv->screen->fb[0].pixelStride)
- {
- smis->data_format |= i << 16;
- break;
- }
- }
-
- smiSetup (pScreen, 0);
- KdMarkSync (pScreen);
- LEAVE ();
-}
-
-void
-smiDrawDisable (ScreenPtr pScreen)
-{
- ENTER ();
- smic = 0;
- smis = 0;
- dpr = 0;
- accel_cmd = 0;
- LEAVE ();
-}
-
-void
-smiDrawFini (ScreenPtr pScreen)
-{
- ENTER ();
- LEAVE ();
-}
-
-void
-smiDrawSync (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- smic = getSmiCardInfo(pScreenPriv);
-
- smiWaitIdle (smic);
-}
diff --git a/hw/kdrive/smi/smidraw.h b/hw/kdrive/smi/smidraw.h
deleted file mode 100644
index 3ec0831fc..000000000
--- a/hw/kdrive/smi/smidraw.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Id: smidraw.h,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64draw.h,v 1.1 2001/06/03 18:48:19 keithp Exp $ */
-
-#ifndef _SMIDRAW_H_
-#define _SMIDRAW_H_
-
-#define SetupSmi(s) KdScreenPriv(s); \
- smiCardInfo(pScreenPriv); \
- Cop *cop = smic->cop
-
-#define SmiAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
-
-#define _smiInit(cop,smic) { \
- if ((cop)->status == 0xffffffff) smiSetMMIO(smic); \
- (cop)->multi = (smic)->cop_depth; \
- (cop)->multi = (smic)->cop_stride; \
- (cop)->multi = SmiAlpha; \
-} \
-
-#define _smiSetSolidRect(cop,pix,alu,cmd) {\
- cop->multi = COP_MULTI_PATTERN; \
- cop->multi = COP_MULTI_ROP | smiRop[alu]; \
- cop->fg = (pix); \
- cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
-}
-
-#define _smiRect(cop,x1,y1,x2,y2,cmd) { \
- (cop)->dst_start_xy = TRI_XY (x1,y1); \
- (cop)->dst_end_xy = TRI_XY(x2,y2); \
- _smiWaitDone(cop); \
- (cop)->command = (cmd); \
-}
-
-#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
- COP_STATUS_DPE_BUSY | \
- COP_STATUS_MI_BUSY)
-
-#define _smiWaitDone(cop) { \
- int __q__ = 500000; \
- while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
- ; \
- if (!__q__) \
- (cop)->status = 0; \
-}
-
-#define _smiWaitIdleEmpty(cop) _smiWaitDone(cop)
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-#endif
diff --git a/hw/kdrive/smi/smistub.c b/hw/kdrive/smi/smistub.c
deleted file mode 100644
index fb4e1bad7..000000000
--- a/hw/kdrive/smi/smistub.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Id: smistub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $XFree86: xc/programs/Xserver/hw/kdrive/smi/smistub.c,v 1.4 2002/10/08 21:25:35 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "smi.h"
-#include "klinux.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x126f, 0x0720, 0, &attr))
- KdCardInfoAdd (&smiFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = subProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/smi/smivideo.c b/hw/kdrive/smi/smivideo.c
deleted file mode 100644
index 2395ebec7..000000000
--- a/hw/kdrive/smi/smivideo.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64video.c,v 1.10 2003/04/23 21:51:18 tsi Exp $ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mach64.h"
-
-#include "Xv.h"
-#include "../../xfree86/common/fourcc.h"
-
-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
-
-static Atom xvBrightness, xvSaturation, xvColorKey;
-
-#define IMAGE_MAX_WIDTH 720
-#define IMAGE_MAX_HEIGHT 576
-
-static void
-mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- Reg *reg = mach64c->reg;
- MediaReg *media = mach64c->media_reg;
-
- REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
-
- if (!media)
- return;
-
- if(pPortPriv->videoOn)
- {
- mach64WaitIdle (reg);
- /* wait for buffer to be displayed */
- while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
- ;
- /* wait for buffer to be finished */
- while (((media->TRIG_CNTL >> 6) & 1) != 0)
- ;
- mach64WaitAvail (reg, 1);
- media->OVERLAY_SCALE_CNTL = 0;
- pPortPriv->videoOn = FALSE;
- mach64WaitIdle (reg);
- }
-}
-
-static int
-mach64SetPortAttribute(KdScreenInfo *screen,
- Atom attribute,
- int value,
- pointer data)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- MediaReg *media = mach64c->media_reg;
-
- if(attribute == xvBrightness)
- {
- if(value < -1000)
- value = -1000;
- if (value > 1000)
- value = 1000;
- pPortPriv->brightness = value;
- }
- else if(attribute == xvSaturation)
- {
- if (value < -1000)
- value = -1000;
- if (value > 1000)
- value = 1000;
- pPortPriv->saturation = value;
- }
- else if(attribute == xvColorKey)
- {
- if (pPortPriv->colorKey != value)
- {
- pPortPriv->colorKey = value;
- REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
- }
- }
- else
- return BadMatch;
-
- return Success;
-}
-
-static int
-mach64GetPortAttribute(KdScreenInfo *screen,
- Atom attribute,
- int *value,
- pointer data)
-{
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
-
- if(attribute == xvBrightness)
- *value = pPortPriv->brightness;
- else if(attribute == xvSaturation)
- *value = pPortPriv->saturation;
- else if(attribute == xvColorKey)
- *value = pPortPriv->colorKey;
- else
- return BadMatch;
-
- return Success;
-}
-
-static void
-mach64QueryBestSize(KdScreenInfo *screen,
- Bool motion,
- short vid_w,
- short vid_h,
- short drw_w,
- short drw_h,
- unsigned int *p_w,
- unsigned int *p_h,
- pointer data)
-{
- *p_w = drw_w;
- *p_h = drw_h;
-}
-
-
-static void
-mach64CopyPackedData(KdScreenInfo *screen,
- unsigned char *buf,
- int randr,
- int srcPitch,
- int dstPitch,
- int srcW,
- int srcH,
- int top,
- int left,
- int h,
- int w)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- CARD8 *src, *dst;
- int srcDown, srcRight, srcNext;
- int p;
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- src = buf;
- srcDown = srcPitch;
- srcRight = 2;
- break;
- case RR_Rotate_90:
- src = buf + (srcH - 1) * 2;
- srcDown = -2;
- srcRight = srcPitch;
- break;
- case RR_Rotate_180:
- src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2;
- srcDown = -srcPitch;
- srcRight = -2;
- break;
- case RR_Rotate_270:
- src = buf + srcPitch * (srcW - 1);
- srcDown = 2;
- srcRight = -srcPitch;
- break;
- }
-
- src = src + top*srcDown + left*srcRight;
-
- if (pPortPriv->currentBuf == 0)
- dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset;
- else
- dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset;
-
- w >>= 1;
- srcRight >>= 1;
- srcNext = srcRight >> 1;
- while(h--)
- {
- CARD16 *s = (CARD16 *) src;
- CARD32 *d = (CARD32 *) dst;
- p = w;
- while (p--)
- {
- *d++ = s[0] | (s[srcNext] << 16);
- s += srcRight;
- }
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-static void
-mach64CopyPlanarData(KdScreenInfo *screen,
- unsigned char *buf,
- int randr,
- int srcPitch,
- int srcPitch2,
- int dstPitch, /* of chroma */
- int srcW,
- int srcH,
- int height,
- int top,
- int left,
- int h,
- int w,
- int id)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- int i, j;
- CARD8 *src1, *src2, *src3, *dst1;
- int srcDown, srcDown2, srcRight, srcRight2, srcNext;
-
- /* compute source data pointers */
- src1 = buf;
- src2 = src1 + height * srcPitch;
- src3 = src2 + (height >> 1) * srcPitch2;
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcDown2 = srcPitch2;
- srcRight = 2;
- srcRight2 = 1;
- srcNext = 1;
- break;
- case RR_Rotate_90:
- src1 = src1 + srcH - 1;
- src2 = src2 + (srcH >> 1) - 1;
- src3 = src3 + (srcH >> 1) - 1;
- srcDown = -1;
- srcDown2 = -1;
- srcRight = srcPitch * 2;
- srcRight2 = srcPitch2;
- srcNext = srcPitch;
- break;
- case RR_Rotate_180:
- src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- srcDown = -srcPitch;
- srcDown2 = -srcPitch2;
- srcRight = -2;
- srcRight2 = -1;
- srcNext = -1;
- break;
- case RR_Rotate_270:
- src1 = src1 + srcPitch * (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
- srcDown = 1;
- srcDown2 = 1;
- srcRight = -srcPitch * 2;
- srcRight2 = -srcPitch2;
- srcNext = -srcPitch;
- break;
- }
-
- /* adjust for origin */
- src1 += top * srcDown + left * srcNext;
- src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
- src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
-
- if (id == FOURCC_I420)
- {
- CARD8 *srct = src2;
- src2 = src3;
- src3 = srct;
- }
-
- if (pPortPriv->currentBuf == 0)
- dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset;
- else
- dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset;
-
- w >>= 1;
- for (j = 0; j < h; j++)
- {
- CARD32 *dst = (CARD32 *) dst1;
- CARD8 *s1l = src1;
- CARD8 *s1r = src1 + srcNext;
- CARD8 *s2 = src2;
- CARD8 *s3 = src3;
-
- for (i = 0; i < w; i++)
- {
- *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
- s1l += srcRight;
- s1r += srcRight;
- s2 += srcRight2;
- s3 += srcRight2;
- }
- src1 += srcDown;
- dst1 += dstPitch;
- if (j & 1)
- {
- src2 += srcDown2;
- src3 += srcDown2;
- }
- }
-}
-
-static void
-mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
-{
- WindowPtr pRoot = WindowTable[pScreen->myNum];
- GCPtr pGC;
- CARD32 val[2];
- xRectangle *rects, *r;
- BoxPtr pBox = REGION_RECTS (pRgn);
- int nBox = REGION_NUM_RECTS (pRgn);
-
- rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
- if (!rects)
- goto bail0;
- r = rects;
- while (nBox--)
- {
- r->x = pBox->x1;
- r->y = pBox->y1;
- r->width = pBox->x2 - pBox->x1;
- r->height = pBox->y2 - pBox->y1;
- r++;
- pBox++;
- }
-
- pGC = GetScratchGC (pRoot->drawable.depth, pScreen);
- if (!pGC)
- goto bail1;
-
- val[0] = fg;
- val[1] = IncludeInferiors;
- ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
-
- ValidateGC (&pRoot->drawable, pGC);
-
- (*pGC->ops->PolyFillRect) (&pRoot->drawable, pGC,
- REGION_NUM_RECTS (pRgn), rects);
-
- FreeScratchGC (pGC);
-bail1:
- DEALLOCATE_LOCAL (rects);
-bail0:
- ;
-}
-
-/* Mach64ClipVideo -
-
- 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.
-*/
-
-static void
-Mach64ClipVideo(BoxPtr dst,
- INT32 *x1,
- INT32 *x2,
- INT32 *y1,
- INT32 *y2,
- BoxPtr extents, /* extents of the clip region */
- INT32 width,
- INT32 height)
-{
- INT32 vscale, hscale, delta;
- int diff;
-
- hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
- vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
-
- *x1 <<= 16; *x2 <<= 16;
- *y1 <<= 16; *y2 <<= 16;
-
- diff = extents->x1 - dst->x1;
- if(diff > 0) {
- dst->x1 = extents->x1;
- *x1 += diff * hscale;
- }
- diff = dst->x2 - extents->x2;
- if(diff > 0) {
- dst->x2 = extents->x2;
- *x2 -= diff * hscale;
- }
- diff = extents->y1 - dst->y1;
- if(diff > 0) {
- dst->y1 = extents->y1;
- *y1 += diff * vscale;
- }
- diff = dst->y2 - extents->y2;
- if(diff > 0) {
- dst->y2 = extents->y2;
- *y2 -= diff * vscale;
- }
-
- if(*x1 < 0) {
- diff = (- *x1 + hscale - 1)/ hscale;
- dst->x1 += diff;
- *x1 += diff * hscale;
- }
- delta = *x2 - (width << 16);
- if(delta > 0) {
- diff = (delta + hscale - 1)/ hscale;
- dst->x2 -= diff;
- *x2 -= diff * hscale;
- }
- if(*y1 < 0) {
- diff = (- *y1 + vscale - 1)/ vscale;
- dst->y1 += diff;
- *y1 += diff * vscale;
- }
- delta = *y2 - (height << 16);
- if(delta > 0) {
- diff = (delta + vscale - 1)/ vscale;
- dst->y2 -= diff;
- *y2 -= diff * vscale;
- }
-}
-
-static void
-mach64DisplayVideo(KdScreenInfo *screen,
- int id,
- int dstPitch, /* of chroma for 4:2:0 */
- int x1,
- int y1,
- int x2,
- int y2,
- int dst_x1,
- int dst_y1,
- int dst_x2,
- int dst_y2,
- short src_w,
- short src_h,
- short drw_w,
- short drw_h)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- Reg *reg = mach64c->reg;
- MediaReg *media = mach64c->media_reg;
- int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
- int xscaleIntUV = 0, xscaleFractUV = 0;
- int yscaleIntUV = 0, yscaleFractUV = 0;
- int randr = mach64s->vesa.randr;
- int HORZ_INC, VERT_INC;
- CARD32 SCALER_IN;
- CARD32 OVERLAY_SCALE_CNTL;
- int tmp;
- int left;
- int bright;
- int sat;
-
- if (id == FOURCC_UYVY)
- SCALER_IN = SCALER_IN_YVYU422;
- else
- SCALER_IN = SCALER_IN_VYUY422;
-
- mach64WaitAvail (reg, 4);
-
- media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422;
-
- /* color key */
- media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1;
- media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey;
- /* set key control to obey only graphics color key */
- media->OVERLAY_KEY_CNTL = 0x50;
-
- mach64WaitAvail (reg, 9);
- media->CAPTURE_DEBUG = 0;
- /* no exclusive video region */
- media->OVERLAY_EXCLUSIVE_HORZ = 0;
- media->OVERLAY_EXCLUSIVE_VERT = 0;
- /* scaling coefficients */
- media->SCALER_H_COEFF0 = 0x00002000;
- media->SCALER_H_COEFF1 = 0x0D06200D;
- media->SCALER_H_COEFF2 = 0x0D0A1C0D;
- media->SCALER_H_COEFF3 = 0x0C0E1A0C;
- media->SCALER_H_COEFF4 = 0x0C14140C;
- media->SCALER_TEST = 0;
-
- mach64WaitAvail (reg, 2);
- media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND |
- SCALE_GAMMA_BRIGHT |
- SCALE_BANDWIDTH |
- SCALE_OVERLAY_EN |
- SCALE_EN);
-
- bright = (pPortPriv->brightness * 64 / 1000);
- if (bright < -0x40)
- bright = -0x40;
- if (bright > 0x3f)
- bright = 0x3f;
- bright = bright & 0x7f;
- sat = ((pPortPriv->saturation * 31 + 31000) / 2000);
- if (sat > 0x1f)
- sat = 0x1f;
- if (sat < 0)
- sat = 0;
-
- media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */
- (sat << 8) | /* SATURATION_U */
- (sat << 16) | /* SATURATION_V */
- (0 << 21) | /* SCALER_VERT_ADJ_UV */
- (0 << 28)); /* SCALER_HORZ_ADJ_UV */
-
- VERT_INC = (src_h << 12) / drw_h;
- HORZ_INC = (src_w << 12) / drw_w;
-
- mach64WaitAvail (reg, 13);
-
- /* lock registers to prevent non-atomic update */
- media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1);
- /* ending screen coordinate */
- media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2);
-
- media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC);
-
- media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset;
- media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset;
-
- media->SCALER_BUF_PITCH = dstPitch >> 1;
- media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16));
-
- media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28;
-
- /* set XY location and unlock */
- media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1);
-}
-
-static int
-mach64PutImage(KdScreenInfo *screen,
- 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)
-{
- KdCardInfo *card = screen->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
- Reg *reg = mach64c->reg;
- MediaReg *media = mach64c->media_reg;
- INT32 x1, x2, y1, y2;
- int randr = mach64s->vesa.randr;
- int srcPitch, srcPitch2, dstPitch;
- int top, left, npixels, nlines, size;
- BoxRec dstBox;
- int dst_width = width, dst_height = height;
- int rot_x1, rot_y1, rot_x2, rot_y2;
- int dst_x1, dst_y1, dst_x2, dst_y2;
- int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
-
- /* Clip */
- x1 = src_x;
- x2 = src_x + src_w;
- y1 = src_y;
- y2 = src_y + src_h;
-
- dstBox.x1 = drw_x;
- dstBox.x2 = drw_x + drw_w;
- dstBox.y1 = drw_y;
- dstBox.y2 = drw_y + drw_h;
-
- Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2,
- REGION_EXTENTS(pScreen, clipBoxes), width, height);
-
- if((x1 >= x2) || (y1 >= y2))
- return Success;
-
- if (!media)
- return BadAlloc;
-
- if (randr & (RR_Rotate_0|RR_Rotate_180))
- {
- dst_width = width;
- dst_height = height;
- rot_src_w = src_w;
- rot_src_h = src_h;
- rot_drw_w = drw_w;
- rot_drw_h = drw_h;
- }
- else
- {
- dst_width = height;
- dst_height = width;
- rot_src_w = src_h;
- rot_src_h = src_w;
- rot_drw_w = drw_h;
- rot_drw_h = drw_w;
- }
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- dst_x1 = dstBox.x1;
- dst_y1 = dstBox.y1;
- dst_x2 = dstBox.x2;
- dst_y2 = dstBox.y2;
- rot_x1 = x1;
- rot_y1 = y1;
- rot_x2 = x2;
- rot_y2 = y2;
- break;
- case RR_Rotate_90:
- dst_x1 = dstBox.y1;
- dst_y1 = screen->height - dstBox.x2;
- dst_x2 = dstBox.y2;
- dst_y2 = screen->height - dstBox.x1;
-
- rot_x1 = y1;
- rot_y1 = (src_w << 16) - x2;
- rot_x2 = y2;
- rot_y2 = (src_w << 16) - x1;
- break;
- case RR_Rotate_180:
- dst_x1 = screen->width - dstBox.x2;
- dst_y1 = screen->height - dstBox.y2;
- dst_x2 = screen->width - dstBox.x1;
- dst_y2 = screen->height - dstBox.y1;
- rot_x1 = (src_w << 16) - x2;
- rot_y1 = (src_h << 16) - y2;
- rot_x2 = (src_w << 16) - x1;
- rot_y2 = (src_h << 16) - y1;
- break;
- case RR_Rotate_270:
- dst_x1 = screen->width - dstBox.y2;
- dst_y1 = dstBox.x1;
- dst_x2 = screen->width - dstBox.y1;
- dst_y2 = dstBox.x2;
- rot_x1 = (src_h << 16) - y2;
- rot_y1 = x1;
- rot_x2 = (src_h << 16) - y1;
- rot_y2 = x2;
- break;
- }
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- dstPitch = ((dst_width << 1) + 15) & ~15;
- srcPitch = (width + 3) & ~3;
- srcPitch2 = ((width >> 1) + 3) & ~3;
- size = dstPitch * (int) dst_height;
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- dstPitch = ((dst_width << 1) + 15) & ~15;
- srcPitch = (width << 1);
- size = dstPitch * (int) dst_height;
- break;
- }
-
- pPortPriv->offset = mach64s->off_screen - (CARD8 *) mach64s->vesa.fb;
- /* fixup pointers */
-
- pPortPriv->YBuf0Offset = pPortPriv->offset;
- pPortPriv->YBuf1Offset = pPortPriv->offset + size;
-
-#if 0
- mach64WaitIdle (reg);
-
- if (pPortPriv->videoOn)
- {
- /* wait for buffer to be displayed */
- while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
- ;
- }
-#endif
- /*
- * Use the other buffer
- */
- pPortPriv->currentBuf = 1 - pPortPriv->currentBuf;
-
- /* copy data */
- top = rot_y1 >> 16;
- left = (rot_x1 >> 16) & ~1;
- npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
-
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- top &= ~1;
- nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
- mach64CopyPlanarData(screen, buf, randr,
- srcPitch, srcPitch2, dstPitch,
- rot_src_w, rot_src_h, height,
- top, left, nlines, npixels, id);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- nlines = ((rot_y2 + 0xffff) >> 16) - top;
- mach64CopyPackedData(screen, buf, randr,
- srcPitch, dstPitch,
- rot_src_w, rot_src_h,
- top, left, nlines,
- npixels);
- break;
- }
-
- mach64DisplayVideo(screen, id, dstPitch,
- rot_x1, rot_y1, rot_x2, rot_y2,
- dst_x1, dst_y1,
- dst_x2, dst_y2,
- rot_src_w, rot_src_h, rot_drw_w, rot_drw_h);
-
- /* update cliplist */
- if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
- {
- REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
- mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey);
- }
-
- pPortPriv->videoOn = TRUE;
-
- return Success;
-}
-
-static int
-mach64QueryImageAttributes(KdScreenInfo *screen,
- int id,
- unsigned short *w,
- unsigned short *h,
- int *pitches,
- int *offsets)
-{
- int size, tmp;
-
- if(*w > IMAGE_MAX_WIDTH)
- *w = IMAGE_MAX_WIDTH;
- if(*h > IMAGE_MAX_HEIGHT)
- *h = IMAGE_MAX_HEIGHT;
-
- *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;
-}
-
-
-/* client libraries expect an encoding */
-static KdVideoEncodingRec DummyEncoding[1] =
-{
- {
- 0,
- "XV_IMAGE",
- IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
- {1, 1}
- }
-};
-
-#define NUM_FORMATS 3
-
-static KdVideoFormatRec Formats[NUM_FORMATS] =
-{
- {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
-};
-
-#define NUM_ATTRIBUTES 3
-
-static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
-{
- {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"},
- {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
- {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}
-};
-
-#define NUM_IMAGES 4
-
-static KdImageRec Images[NUM_IMAGES] =
-{
- XVIMAGE_YUY2,
- XVIMAGE_YV12,
- XVIMAGE_I420,
- XVIMAGE_UYVY
-};
-
-static void mach64ResetVideo(KdScreenInfo *screen)
-{
- ScreenPtr pScreen = screen->pScreen;
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
- Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
- MediaReg *media = mach64c->media_reg;
-
- /*
- * Default to maximum image size in YV12
- */
-
-}
-
-static int
-mach64ReputImage (KdScreenInfo *screen,
- short drw_x,
- short drw_y,
- RegionPtr clipBoxes,
- pointer data)
-{
- ScreenPtr pScreen = screen->pScreen;
- Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
- BoxPtr pOldExtents = REGION_EXTENTS (pScreen, &pPortPriv->clip);
- BoxPtr pNewExtents = REGION_EXTENTS (pScreen, clipBoxes);
-
- if (pOldExtents->x1 == pNewExtents->x1 &&
- pOldExtents->x2 == pNewExtents->x2 &&
- pOldExtents->y1 == pNewExtents->y1 &&
- pOldExtents->y2 == pNewExtents->y2)
- {
- /* update cliplist */
- if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
- {
- REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
- mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey);
- }
- return Success;
- }
- return BadMatch;
-}
-
-static KdVideoAdaptorPtr
-mach64SetupImageVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- mach64CardInfo(pScreenPriv);
- mach64ScreenInfo(pScreenPriv);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- KdVideoAdaptorPtr adapt;
- Mach64PortPrivPtr pPortPriv;
-
- if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) +
- sizeof(Mach64PortPrivRec) +
- sizeof(DevUnion))))
- return NULL;
-
- adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
- adapt->name = "Mach64 Video Overlay";
- adapt->nEncodings = 1;
- adapt->pEncodings = DummyEncoding;
- adapt->nFormats = NUM_FORMATS;
- adapt->pFormats = Formats;
- adapt->nPorts = 1;
- adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
-
- pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]);
-
- adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv);
- adapt->pAttributes = Attributes;
- adapt->nImages = NUM_IMAGES;
- adapt->nAttributes = NUM_ATTRIBUTES;
- adapt->pImages = Images;
- adapt->PutVideo = NULL;
- adapt->PutStill = NULL;
- adapt->GetVideo = NULL;
- adapt->GetStill = NULL;
- adapt->StopVideo = mach64StopVideo;
- adapt->SetPortAttribute = mach64SetPortAttribute;
- adapt->GetPortAttribute = mach64GetPortAttribute;
- adapt->QueryBestSize = mach64QueryBestSize;
- adapt->PutImage = mach64PutImage;
- adapt->ReputImage = mach64ReputImage;
- adapt->QueryImageAttributes = mach64QueryImageAttributes;
-
- pPortPriv->colorKey = mach64s->colorKey;
- pPortPriv->videoOn = FALSE;
- pPortPriv->brightness = 0;
- pPortPriv->saturation = 0;
- pPortPriv->currentBuf = 0;
-
- /* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
-
- mach64s->pAdaptor = adapt;
-
- xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
- xvSaturation = MAKE_ATOM("XV_SATURATION");
- xvColorKey = MAKE_ATOM("XV_COLORKEY");
-
- mach64ResetVideo(screen);
-
- return adapt;
-}
-
-Bool mach64InitVideo(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
- KdVideoAdaptorPtr newAdaptor = NULL;
- int num_adaptors;
- KdCardInfo *card = pScreenPriv->card;
- Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
- Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
-
- if (!mach64c->media_reg)
- return FALSE;
-
- newAdaptor = mach64SetupImageVideo(pScreen);
-
- num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
-
- if(newAdaptor)
- {
- if(!num_adaptors)
- {
- num_adaptors = 1;
- adaptors = &newAdaptor;
- }
- else
- {
- newAdaptors = xalloc((num_adaptors + 1) *
- sizeof(KdVideoAdaptorPtr*));
- if(newAdaptors)
- {
- memcpy(newAdaptors, adaptors,
- num_adaptors * sizeof(KdVideoAdaptorPtr));
- newAdaptors[num_adaptors] = newAdaptor;
- adaptors = newAdaptors;
- num_adaptors++;
- }
- }
- }
-
- if(num_adaptors)
- KdXVScreenInit(pScreen, adaptors, num_adaptors);
-
- if(newAdaptors)
- xfree(newAdaptors);
- return TRUE;
-}
diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
deleted file mode 100644
index 103ec4ef2..000000000
--- a/hw/kdrive/src/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- @XSERVER_CFLAGS@
-
-noinst_LIBRARIES = libkdrive.a
-
-libkdrive_a_SOURCES = \
- kaa.c \
- kasync.c \
- kcmap.c \
- kcurscol.c \
- kdrive.c \
- kdrive.h \
- kinfo.c \
- kinput.c \
- kkeymap.h \
- kmap.c \
- kmode.c \
- knoop.c \
- koffscreen.c \
- kpict.c \
- kshadow.c \
- ktest.c \
- kxv.c \
- kxv.h \
- vga.c \
- vga.h
diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c
deleted file mode 100644
index d861a232a..000000000
--- a/hw/kdrive/src/kaa.c
+++ /dev/null
@@ -1,1076 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kaa.c,v 1.4 2001/06/04 09:45:41 keithp Exp $
- *
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © The XFree86 Project Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-
-#define DEBUG_MIGRATE 0
-#define DEBUG_PIXMAP 0
-#if DEBUG_MIGRATE
-#define DBG_MIGRATE(a) ErrorF a
-#else
-#define DBG_MIGRATE(a)
-#endif
-#if DEBUG_PIXMAP
-#define DBG_PIXMAP(a) ErrorF a
-#else
-#define DBG_PIXMAP(a)
-#endif
-
-int kaaGeneration;
-int kaaScreenPrivateIndex;
-int kaaPixmapPrivateIndex;
-
-typedef struct {
- KaaScreenInfoPtr info;
-} KaaScreenPrivRec, *KaaScreenPrivPtr;
-
-typedef struct {
- KdOffscreenArea *area;
- int score;
- int devKind;
- DevUnion devPrivate;
-} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
-
-#define KAA_PIXMAP_SCORE_MOVE_IN 10
-#define KAA_PIXMAP_SCORE_MAX 20
-#define KAA_PIXMAP_SCORE_MOVE_OUT -10
-#define KAA_PIXMAP_SCORE_MIN -20
-
-#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr)
-#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
-
-#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
-#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
-#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
-#define KaaPixmapPitch(w) (((w) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1))
-
-#define MIN_OFFPIX_SIZE (4096)
-
-static void
-kaaPixmapSave (KdOffscreenArea *area)
-{
- PixmapPtr pPixmap = area->privData;
- KaaPixmapPriv(pPixmap);
- int dst_pitch, src_pitch, bytes;
- unsigned char *dst, *src;
- int i;
-
- DBG_MIGRATE (("Save 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
-
- KdCheckSync (pPixmap->drawable.pScreen);
-
- src_pitch = pPixmap->devKind;
- dst_pitch = pKaaPixmap->devKind;
-
- src = pPixmap->devPrivate.ptr;
- dst = pKaaPixmap->devPrivate.ptr;
-
- pPixmap->devKind = dst_pitch;
- pPixmap->devPrivate.ptr = dst;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pKaaPixmap->area = NULL;
-
- bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
- i = pPixmap->drawable.height;
- while (i--) {
- memcpy (dst, src, bytes);
- dst += dst_pitch;
- src += src_pitch;
- }
-}
-
-static Bool
-kaaPixmapAllocArea (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- KaaScreenPriv (pScreen);
- KaaPixmapPriv (pPixmap);
- KdScreenPriv (pScreen);
- int bpp = pPixmap->drawable.bitsPerPixel;
- CARD16 h = pPixmap->drawable.height;
- CARD16 w = pPixmap->drawable.width;
- int pitch = KaaPixmapPitch (w);
-
- pKaaPixmap->devKind = pPixmap->devKind;
- pKaaPixmap->devPrivate = pPixmap->devPrivate;
- pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h * (bpp >> 3),
- pKaaScr->info->offscreenByteAlign,
- FALSE,
- kaaPixmapSave, (pointer) pPixmap);
- if (!pKaaPixmap->area)
- return FALSE;
-
- DBG_PIXMAP(("++ 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- pPixmap->devKind = pitch * (bpp >> 3);
- pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset);
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- return TRUE;
-}
-
-static void
-kaaMoveInPixmap (PixmapPtr pPixmap)
-{
- int dst_pitch, src_pitch, bytes;
- unsigned char *dst, *src;
- int i;
-
- return;
- KdCheckSync (pPixmap->drawable.pScreen);
-
- DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
-
- src = pPixmap->devPrivate.ptr;
- src_pitch = pPixmap->devKind;
-
- if (!kaaPixmapAllocArea (pPixmap))
- return;
-
- dst = pPixmap->devPrivate.ptr;
- dst_pitch = pPixmap->devKind;
-
- bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
- i = pPixmap->drawable.height;
- while (i--) {
- memcpy (dst, src, bytes);
- dst += dst_pitch;
- src += src_pitch;
- }
-}
-
-static void
-kaaMoveOutPixmap (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
- KdOffscreenArea *area = pKaaPixmap->area;
-
- DBG_MIGRATE (("<- 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- if (area)
- {
- kaaPixmapSave (area);
- KdOffscreenFree (area);
- }
-}
-
-static void
-kaaPixmapUseScreen (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
-
- if (pKaaPixmap->score < KAA_PIXMAP_SCORE_MAX)
- {
- pKaaPixmap->score++;
- if (!pKaaPixmap->area &&
- pKaaPixmap->score >= KAA_PIXMAP_SCORE_MOVE_IN)
- kaaMoveInPixmap (pPixmap);
- }
-}
-
-static void
-kaaPixmapUseMemory (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
-
- if (pKaaPixmap->score > KAA_PIXMAP_SCORE_MIN)
- {
- pKaaPixmap->score--;
- if (pKaaPixmap->area &&
- pKaaPixmap->score <= KAA_PIXMAP_SCORE_MOVE_OUT)
- kaaMoveOutPixmap (pPixmap);
- }
-}
-
-static Bool
-kaaDestroyPixmap (PixmapPtr pPixmap)
-{
- if (pPixmap->refcnt == 1)
- {
- KaaPixmapPriv (pPixmap);
- if (pKaaPixmap->area)
- {
- DBG_PIXMAP(("-- 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area->offset,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- /* Free the offscreen area */
- KdOffscreenFree (pKaaPixmap->area);
- pPixmap->devPrivate = pKaaPixmap->devPrivate;
- pPixmap->devKind = pKaaPixmap->devKind;
- }
- }
- return fbDestroyPixmap (pPixmap);
-}
-
-static PixmapPtr
-kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
-{
- PixmapPtr pPixmap;
- KaaPixmapPrivPtr pKaaPixmap;
- int bpp;
-
- bpp = BitsPerPixel (depth);
- if (bpp == 32 && depth == 24)
- {
- int fb;
- KdScreenPriv (pScreen);
-
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- if (pScreenPriv->screen->fb[fb].depth == 24)
- {
- bpp = pScreenPriv->screen->fb[fb].bitsPerPixel;
- break;
- }
- }
- pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
- if (!pPixmap)
- return NULL;
- pKaaPixmap = KaaGetPixmapPriv(pPixmap);
- pKaaPixmap->score = 0;
- pKaaPixmap->area = NULL;
-
- if (depth == pScreen->rootDepth &&
- (pPixmap->devKind * h) >= MIN_OFFPIX_SIZE)
- kaaPixmapAllocArea (pPixmap);
- return pPixmap;
-}
-
-static Bool
-kaaPixmapIsOffscreen(PixmapPtr p)
-{
- ScreenPtr pScreen = p->drawable.pScreen;
- KdScreenPriv(pScreen);
-
- return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
- (CARD8 *) pScreenPriv->screen->memory_base) <
- pScreenPriv->screen->memory_size);
-}
-
-static PixmapPtr
-kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
-{
- PixmapPtr pPixmap;
- int x, y;
-
- if (pDrawable->type == DRAWABLE_WINDOW) {
- pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
-#ifdef COMPOSITE
- x = -pPixmap->screen_x;
- y = -pPixmap->screen_y;
-#else
- x = 0;
- y = 0;
-#endif
- }
- else
- {
- pPixmap = (PixmapPtr) pDrawable;
- x = 0;
- y = 0;
- }
- if (kaaPixmapIsOffscreen (pPixmap))
- {
- *xp = x;
- *yp = y;
- return pPixmap;
- }
- return NULL;
-}
-
-static Bool
-kaaDrawableIsOffscreen (DrawablePtr pDrawable)
-{
- PixmapPtr pPixmap;
- if (pDrawable->type == DRAWABLE_WINDOW)
- pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
- else
- pPixmap = (PixmapPtr) pDrawable;
- return kaaPixmapIsOffscreen (pPixmap);
-}
-
-static void
-kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- KdScreenPriv (pScreen);
- KaaScreenPriv (pScreen);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr pPixmap;
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
- int off_x, off_y;
-
- if (!pScreenPriv->enabled ||
- pGC->fillStyle != FillSolid ||
- !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) ||
- !(*pKaaScr->info->PrepareSolid) (pPixmap,
- pGC->alu,
- pGC->planemask,
- pGC->fgPixel))
- {
- KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
- }
-
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (n--)
- {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int) *pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = REGION_NUM_RECTS (pClip);
- if (nbox == 1)
- {
- (*pKaaScr->info->Solid) (fullX1 + off_x, fullY1 + off_y,
- fullX2 + off_x, fullY1 + 1 + off_y);
- }
- else
- {
- pbox = REGION_RECTS(pClip);
- while(nbox--)
- {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1)
- (*pKaaScr->info->Solid) (partX1 + off_x, fullY1 + off_y,
- partX2 + off_x, fullY1 + 1 + off_y);
- }
- pbox++;
- }
- }
- }
- (*pKaaScr->info->DoneSolid) ();
- KdMarkSync(pDrawable->pScreen);
-}
-
-static void
-kaaCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- KdScreenPriv (pDstDrawable->pScreen);
- KaaScreenPriv (pDstDrawable->pScreen);
- PixmapPtr pSrcPixmap, pDstPixmap;
- int src_off_x, src_off_y;
- int dst_off_x, dst_off_y;
-
- /* Migrate pixmaps to same place as destination */
- if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if (kaaDrawableIsOffscreen (pDstDrawable))
- kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable);
- else
- kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable);
- }
-
- if (pScreenPriv->enabled &&
- (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
- (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) &&
- (*pKaaScr->info->PrepareCopy) (pSrcPixmap,
- pDstPixmap,
- dx,
- dy,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask : FB_ALLONES))
- {
- while (nbox--)
- {
- (*pKaaScr->info->Copy) (pbox->x1 + dx + src_off_x,
- pbox->y1 + dy + src_off_y,
- pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
- }
- (*pKaaScr->info->DoneCopy) ();
- KdMarkSync(pDstDrawable->pScreen);
- }
- else
- {
- KdCheckSync (pDstDrawable->pScreen);
- fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
- pbox, nbox, dx, dy, reverse, upsidedown,
- bitplane, closure);
- }
-}
-
-static RegionPtr
-kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, kaaCopyNtoN, 0, 0);
-}
-
-static void
-kaaPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- KdScreenPriv (pDrawable->pScreen);
- KaaScreenPriv (pDrawable->pScreen);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr pPixmap;
- register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
- int xoff, yoff;
- int xorg, yorg;
- int n;
-
- if (!pScreenPriv->enabled ||
- pGC->fillStyle != FillSolid ||
- !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
- !(*pKaaScr->info->PrepareSolid) (pPixmap,
- pGC->alu,
- pGC->planemask,
- pGC->fgPixel))
- {
- KdCheckPolyFillRect (pDrawable, pGC, nrect, prect);
- return;
- }
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (nrect--)
- {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
- prect++;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullY1 < extentY1)
- fullY1 = extentY1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullY2 > extentY2)
- fullY2 = extentY2;
-
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = REGION_NUM_RECTS (pClip);
- if (n == 1)
- {
- (*pKaaScr->info->Solid) (fullX1 + xoff, fullY1 + yoff,
- fullX2 + xoff, fullY2 + yoff);
- }
- else
- {
- pbox = REGION_RECTS(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect()
- */
- while(n--)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2)
- (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
- partX2 + xoff, partY2 + yoff);
- }
- }
- }
- (*pKaaScr->info->DoneSolid) ();
- KdMarkSync(pDrawable->pScreen);
-}
-
-static void
-kaaSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- FbBits pm,
- FbBits fg,
- int x1,
- int y1,
- int x2,
- int y2)
-{
- KdScreenPriv (pDrawable->pScreen);
- KaaScreenPriv (pDrawable->pScreen);
- PixmapPtr pPixmap;
- BoxPtr pbox;
- int nbox;
- int xoff, yoff;
- int partX1, partX2, partY1, partY2;
-
- if (!pScreenPriv->enabled ||
- !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
- !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
- {
- KdCheckSync (pDrawable->pScreen);
- fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
- fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2,
- fbAnd (GXcopy, fg, pm),
- fbXor (GXcopy, fg, pm));
- return;
- }
- for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
- nbox--;
- pbox++)
- {
- partX1 = pbox->x1;
- if (partX1 < x1)
- partX1 = x1;
-
- partX2 = pbox->x2;
- if (partX2 > x2)
- partX2 = x2;
-
- if (partX2 <= partX1)
- continue;
-
- partY1 = pbox->y1;
- if (partY1 < y1)
- partY1 = y1;
-
- partY2 = pbox->y2;
- if (partY2 > y2)
- partY2 = y2;
-
- if (partY2 <= partY1)
- continue;
-
- (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
- partX2 + xoff, partY2 + yoff);
- }
- (*pKaaScr->info->DoneSolid) ();
- KdMarkSync(pDrawable->pScreen);
-}
-
-static void
-kaaImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- Bool opaque;
- int n;
- int gx, gy;
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbBits depthMask;
-
- depthMask = FbFullMask(pDrawable->depth);
- if ((pGC->planemask & depthMask) != depthMask)
- {
- KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
- return;
- }
- glyph = 0;
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
- case 24: glyph = fbGlyph24; break;
- case 32: glyph = fbGlyph32; break;
- }
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- if (TERMINALFONT (pGC->font) && !glyph)
- {
- opaque = TRUE;
- }
- else
- {
- int xBack, widthBack;
- int yBack, heightBack;
-
- ppci = ppciInit;
- n = nglyph;
- widthBack = 0;
- while (n--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
- xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT(pGC->font);
- heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- kaaSolidBoxClipped (pDrawable,
- fbGetCompositeClip(pGC),
- pGC->planemask,
- pGC->bgPixel,
- xBack,
- yBack,
- xBack + widthBack,
- yBack + heightBack);
- opaque = FALSE;
- }
-
- KdCheckSync (pDrawable->pScreen);
-
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->fg,
- gx + dstXoff,
- gHeight);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- GXcopy,
- opaque,
-
- gx,
- gy,
- gWidth, gHeight,
-
- (FbStip *) pglyph,
- gStride,
- 0);
- }
- }
- x += pci->metrics.characterWidth;
- }
-}
-
-static const GCOps kaaOps = {
- kaaFillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- kaaCopyArea,
- KdCheckCopyPlane,
- KdCheckPolyPoint,
- KdCheckPolylines,
- KdCheckPolySegment,
- miPolyRectangle,
- KdCheckPolyArc,
- miFillPolygon,
- kaaPolyFillRect,
- miPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- kaaImageGlyphBlt,
- KdCheckPolyGlyphBlt,
- KdCheckPushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-static void
-kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- fbValidateGC (pGC, changes, pDrawable);
-
- if (kaaDrawableIsOffscreen (pDrawable))
- pGC->ops = (GCOps *) &kaaOps;
- else
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
-}
-
-GCFuncs kaaGCFuncs = {
- kaaValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-static int
-kaaCreateGC (GCPtr pGC)
-{
- if (!fbCreateGC (pGC))
- return FALSE;
-
- pGC->funcs = &kaaGCFuncs;
-
- return TRUE;
-}
-
-
-static void
-kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- RegionRec rgnDst;
- int dx, dy;
- PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-#ifdef COMPOSITE
- if (pPixmap->screen_x || pPixmap->screen_y)
- REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
-#endif
-
- fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
- 0,
- &rgnDst, dx, dy, kaaCopyNtoN, 0, 0);
-
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-static void
-kaaFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- Pixel pixel)
-{
- KdScreenPriv(pDrawable->pScreen);
- KaaScreenPriv(pDrawable->pScreen);
- PixmapPtr pPixmap;
- int xoff, yoff;
-
- if (pScreenPriv->enabled &&
- (pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
- (*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
- {
- int nbox = REGION_NUM_RECTS (pRegion);
- BoxPtr pBox = REGION_RECTS (pRegion);
-
- while (nbox--)
- {
- (*pKaaScr->info->Solid) (pBox->x1 + xoff, pBox->y1 + yoff,
- pBox->x2 + xoff, pBox->y2 + yoff);
- pBox++;
- }
- (*pKaaScr->info->DoneSolid) ();
- KdMarkSync(pDrawable->pScreen);
- }
- else
- {
- KdCheckSync (pDrawable->pScreen);
- fbFillRegionSolid (pDrawable, pRegion, 0,
- fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
- }
-}
-
-static void
-kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
-{
-
- if (!REGION_NUM_RECTS(pRegion))
- return;
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixel:
- kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel);
- return;
- }
- break;
- case PW_BORDER:
- if (pWin->borderIsPixel)
- {
- kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel);
- return;
- }
- break;
- }
- KdCheckPaintWindow (pWin, pRegion, what);
-}
-
-#ifdef RENDER
-#include "mipict.h"
-
-static void
-kaaComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- if (op == PictOpSrc && !pMask)
- {
- /*
- * Check for two special cases -- solid fill and copy area
- */
- if (pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1 &&
- pSrc->repeat)
- {
- ;
- }
- else if (!pSrc->repeat && pSrc->format == pDst->format)
- {
- RegionRec region;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
- if (pMask)
- {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- }
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return;
-
-
- kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0,
- REGION_RECTS(&region), REGION_NUM_RECTS(&region),
- xSrc - xDst, ySrc - yDst,
- FALSE, FALSE, 0, 0);
- return;
- }
- }
- if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
- if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable);
-#if 0
- if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable);
-#endif
-
- KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height);
-}
-#endif
-
-Bool
-kaaDrawInit (ScreenPtr pScreen,
- KaaScreenInfoPtr pScreenInfo)
-{
- KaaScreenPrivPtr pKaaScr;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-#ifdef RENDER
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
-
- if (kaaGeneration != serverGeneration)
- {
- kaaScreenPrivateIndex = AllocateScreenPrivateIndex();
- kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- kaaGeneration = serverGeneration;
- }
-
- pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
-
- if (!pKaaScr)
- return FALSE;
-
- pKaaScr->info = pScreenInfo;
-
- pScreen->devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr;
-
- /*
- * Hook up asynchronous drawing
- */
- KdScreenInitAsync (pScreen);
- /*
- * Replace various fb screen functions
- */
- pScreen->CreateGC = kaaCreateGC;
- pScreen->CopyWindow = kaaCopyWindow;
- pScreen->PaintWindowBackground = kaaPaintWindow;
- pScreen->PaintWindowBorder = kaaPaintWindow;
-#ifdef RENDER
- if (ps)
- ps->Composite = kaaComposite;
-#endif
-
- /*
- * Hookup offscreen pixmaps
- */
- if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
- screen->off_screen_base < screen->memory_size)
- {
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex,
- sizeof (KaaPixmapPrivRec)))
- return FALSE;
- pScreen->CreatePixmap = kaaCreatePixmap;
- pScreen->DestroyPixmap = kaaDestroyPixmap;
- }
- else
- {
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0))
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-kaaDrawFini (ScreenPtr pScreen)
-{
- KaaScreenPriv(pScreen);
-
- xfree (pKaaScr);
-}
diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c
deleted file mode 100644
index a2807e899..000000000
--- a/hw/kdrive/src/kasync.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Id: kasync.c,v 1.3 1999/11/24 04:29:28 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kasync.c,v 1.8 2001/03/30 02:15:19 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-/*
- * These functions wrap the low-level fb rendering functions and
- * synchronize framebuffer/accelerated drawing by stalling until
- * the accelerator is idle
- */
-
-void
-KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- KdCheckSync (pDrawable->pScreen);
- fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
-}
-
-void
-KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
-{
- KdCheckSync (pDrawable->pScreen);
- fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
-}
-
-void
-KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *bits)
-{
- KdCheckSync (pDrawable->pScreen);
- fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
-}
-
-RegionPtr
-KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty)
-{
- KdCheckSync (pSrc->pScreen);
- return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
-}
-
-RegionPtr
-KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitPlane)
-{
- KdCheckSync (pSrc->pScreen);
- return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
- bitPlane);
-}
-
-void
-KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit)
-{
- KdCheckSync (pDrawable->pScreen);
- fbPolyPoint (pDrawable, pGC, mode, npt, pptInit);
-}
-
-void
-KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt)
-{
-
- if (pGC->lineWidth == 0)
- KdCheckSync (pDrawable->pScreen);
- fbPolyLine (pDrawable, pGC, mode, npt, ppt);
-}
-
-void
-KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit)
-{
- if (pGC->lineWidth == 0)
- KdCheckSync(pDrawable->pScreen);
- fbPolySegment (pDrawable, pGC, nsegInit, pSegInit);
-}
-
-void
-KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
- int nrects, xRectangle *prect)
-{
- if (pGC->lineWidth == 0)
- KdCheckSync(pDrawable->pScreen);
- fbPolyRectangle (pDrawable, pGC, nrects, prect);
-}
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
-{
- if (pGC->lineWidth == 0)
- {
- KdCheckSync(pDrawable->pScreen);
- fbPolyArc (pDrawable, pGC, narcs, pArcs);
- }
- else
- miPolyArc (pDrawable, pGC, narcs, pArcs);
-}
-
-#if 0
-void
-KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count, DDXPointPtr pPts)
-{
- KdCheckSync(pDrawable->pScreen);
- fbFillPolygon (pDrawable, pGC, mode, count, pPts);
-}
-#endif
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect)
-{
- KdCheckSync(pDrawable->pScreen);
- fbPolyFillRect (pDrawable, pGC, nrect, prect);
-}
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
-{
- KdCheckSync(pDrawable->pScreen);
- fbPolyFillArc (pDrawable, pGC, narcs, pArcs);
-}
-
-void
-KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- KdCheckSync(pDrawable->pScreen);
- fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- KdCheckSync(pDrawable->pScreen);
- fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y)
-{
- KdCheckSync(pDrawable->pScreen);
- fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
-}
-
-void
-KdCheckGetImage (DrawablePtr pDrawable,
- int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *d)
-{
- KdCheckSync(pDrawable->pScreen);
- fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
-}
-
-void
-KdCheckGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart)
-{
- KdCheckSync(pDrawable->pScreen);
- fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
-}
-
-void
-KdCheckSaveAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
- KdCheckSync(pWin->drawable.pScreen);
- fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin);
-}
-
-void
-KdCheckRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
- KdCheckSync(pWin->drawable.pScreen);
- fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin);
-}
-
-void
-KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what)
-{
- KdCheckSync (pWin->drawable.pScreen);
- fbPaintWindow (pWin, pRegion, what);
-}
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- KdCheckSync (pWin->drawable.pScreen);
- fbCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-
-#if KD_MAX_FB > 1
-void
-KdCheckPaintKey(DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer)
-{
- KdCheckSync (pDrawable->pScreen);
- fbOverlayPaintKey (pDrawable, pRegion, pixel, layer);
-}
-
-void
-KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- KdCheckSync (pWin->drawable.pScreen);
- fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-#endif
-
-void
-KdScreenInitAsync (ScreenPtr pScreen)
-{
- pScreen->GetImage = KdCheckGetImage;
- pScreen->GetSpans = KdCheckGetSpans;
- pScreen->PaintWindowBackground = KdCheckPaintWindow;
- pScreen->PaintWindowBorder = KdCheckPaintWindow;
- pScreen->CopyWindow = KdCheckCopyWindow;
-
-#ifndef FB_OLD_SCREEN
- pScreen->BackingStoreFuncs.SaveAreas = KdCheckSaveAreas;
- pScreen->BackingStoreFuncs.RestoreAreas = KdCheckRestoreAreas;
-#else
- pScreenPriv->BackingStoreFuncs.SaveAreas = KdCheckSaveAreas;
- pScreenPriv->BackingStoreFuncs.RestoreAreas = KdCheckRestoreAreas;
-#endif
-#ifdef RENDER
- KdPictureInitAsync (pScreen);
-#endif
-}
-
-/*
- * Only need to stall for copyarea/copyplane
- */
-const GCOps kdAsyncPixmapGCOps = {
- fbFillSpans,
- fbSetSpans,
- fbPutImage,
- KdCheckCopyArea,
- KdCheckCopyPlane,
- fbPolyPoint,
- fbPolyLine,
- fbPolySegment,
- fbPolyRectangle,
- fbPolyArc,
- fbFillPolygon,
- fbPolyFillRect,
- fbPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- fbImageGlyphBlt,
- fbPolyGlyphBlt,
- fbPushPixels
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
deleted file mode 100644
index 855dc6f02..000000000
--- a/hw/kdrive/src/kcmap.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Id: kcmap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kcmap.c,v 1.4 2000/05/24 23:57:56 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-/*
- * Put the entire colormap into the DAC
- */
-
-void
-KdSetColormap (ScreenPtr pScreen, int fb)
-{
- KdScreenPriv(pScreen);
- ColormapPtr pCmap = pScreenPriv->pInstalledmap[fb];
- Pixel pixels[KD_MAX_PSEUDO_SIZE];
- xrgb colors[KD_MAX_PSEUDO_SIZE];
- xColorItem defs[KD_MAX_PSEUDO_SIZE];
- int i;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
- if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (!pCmap)
- return;
-
- /*
- * Make DIX convert pixels into RGB values -- this handles
- * true/direct as well as pseudo/static visuals
- */
-
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- pixels[i] = i;
-
- QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, colors);
-
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- {
- defs[i].pixel = i;
- defs[i].red = colors[i].red;
- defs[i].green = colors[i].green;
- defs[i].blue = colors[i].blue;
- defs[i].flags = DoRed|DoGreen|DoBlue;
- }
-
- (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- defs);
-
- /* recolor hardware cursor */
- if (pScreenPriv->card->cfuncs->recolorCursor)
- (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0);
-}
-
-/*
- * When the hardware is enabled, save the hardware colors and store
- * the current colormap
- */
-void
-KdEnableColormap (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- int i;
- int fb;
- Bool done = FALSE;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
- {
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- pScreenPriv->systemPalette[i].pixel = i;
- (*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- pScreenPriv->systemPalette);
- done = TRUE;
- }
- KdSetColormap (pScreen, fb);
- }
-}
-
-void
-KdDisableColormap (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- int fb;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
- {
- (*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- pScreenPriv->systemPalette);
- break;
- }
- }
-}
-
-static int
-KdColormapFb (ColormapPtr pCmap)
-{
- ScreenPtr pScreen = pCmap->pScreen;
- KdScreenPriv (pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int d;
- DepthPtr depth;
- int v;
- VisualID vid = pCmap->pVisual->vid;
- int fb;
-
- if (screen->fb[1].depth)
- {
- for (d = 0; d < pScreen->numDepths; d++)
- {
- depth = &pScreen->allowedDepths[d];
- for (v = 0; v < depth->numVids; v++)
- {
- if (depth->vids[v] == vid)
- {
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (depth->depth == screen->fb[fb].depth)
- return fb;
- }
- }
- }
- }
- }
- return 0;
-}
-
-/*
- * KdInstallColormap
- *
- * This function is called when the server receives a request to install a
- * colormap or when the server needs to install one on its own, like when
- * there's no window manager running and the user has moved the pointer over
- * an X client window. It needs to build an identity Windows palette for the
- * colormap and realize it into the Windows system palette.
- */
-void
-KdInstallColormap (ColormapPtr pCmap)
-{
- KdScreenPriv(pCmap->pScreen);
- int fb = KdColormapFb (pCmap);
-
- if (pCmap == pScreenPriv->pInstalledmap[fb])
- return;
-
- /* Tell X clients that the installed colormap is going away. */
- if (pScreenPriv->pInstalledmap[fb])
- WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
- (pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
-
- /* Take note of the new installed colorscreen-> */
- pScreenPriv->pInstalledmap[fb] = pCmap;
-
- KdSetColormap (pCmap->pScreen, fb);
-
- /* Tell X clients of the new colormap */
- WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
-}
-
-/*
- * KdUninstallColormap
- *
- * This function uninstalls a colormap by either installing
- * the default X colormap or erasing the installed colormap pointer.
- * The default X colormap itself cannot be uninstalled.
- */
-void
-KdUninstallColormap (ColormapPtr pCmap)
-{
- KdScreenPriv(pCmap->pScreen);
- int fb = KdColormapFb (pCmap);
- Colormap defMapID;
- ColormapPtr defMap;
-
- /* ignore if not installed */
- if (pCmap != pScreenPriv->pInstalledmap[fb])
- return;
-
- /* ignore attempts to uninstall default colormap */
- defMapID = pCmap->pScreen->defColormap;
- if ((Colormap) pCmap->mid == defMapID)
- return;
-
- /* install default if on same fb */
- defMap = (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP);
- if (defMap && KdColormapFb (defMap) == fb)
- (*pCmap->pScreen->InstallColormap)(defMap);
- else
- {
- /* uninstall and clear colormap pointer */
- WalkTree(pCmap->pScreen, TellLostMap,
- (pointer) &(pCmap->mid));
- pScreenPriv->pInstalledmap[fb] = 0;
- }
-}
-
-int
-KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
-{
- KdScreenPriv(pScreen);
- int fb;
- int n = 0;
-
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->pInstalledmap[fb])
- {
- *pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
- n++;
- }
- }
- return n;
-}
-
-/*
- * KdStoreColors
- *
- * This function is called whenever the server receives a request to store
- * color values into one or more entries in the currently installed X
- * colormap; it can be either the default colormap or a private colorscreen->
- */
-void
-KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pCmap->pScreen);
- VisualPtr pVisual;
- xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
- int fb = KdColormapFb (pCmap);
-
- if (pCmap != pScreenPriv->pInstalledmap[fb])
- return;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
-
- if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- /* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
- pVisual = pCmap->pVisual;
- if ((pVisual->class | DynamicClass) == DirectColor)
- {
- /*
- * Expand DirectColor or TrueColor color values into a PseudoColor
- * format. Defer to the Color Framebuffer (CFB) code to do that.
- */
- ndef = fbExpandDirectColors(pCmap, ndef, pdefs, expanddefs);
- pdefs = expanddefs;
- }
-
- (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
-
- /* recolor hardware cursor */
- if (pScreenPriv->card->cfuncs->recolorCursor)
- (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, pdefs);
-}
diff --git a/hw/kdrive/src/kcolor.c b/hw/kdrive/src/kcolor.c
deleted file mode 100644
index bfff3a52c..000000000
--- a/hw/kdrive/src/kcolor.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/*
- * Id: kcolor.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kcolor.c,v 1.2 1999/12/30 03:03:05 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <stdio.h>
-#include "os.h"
-#include "opaque.h"
-#include <X11/keysym.h>
-
-unsigned char
-KdToLower (unsigned char a)
-{
- if ((a >= XK_A) && (a <= XK_Z))
- return a + (XK_a - XK_A);
- else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
- return a + (XK_agrave - XK_Agrave);
- else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
- return a + (XK_oslash - XK_Ooblique);
- else
- return a;
-}
-
-int
-KdStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2)
-{
- unsigned char c1, c2;
-
- for (;;)
- {
- c1 = KdToLower (*s1++);
- if (l2 == 0)
- c2 = '\0';
- else
- c2 = KdToLower (*s2++);
- if (!c1 || !c2)
- break;
- if (c1 != c2)
- break;
- l2--;
- }
- return c2 - c1;
-}
-
-typedef struct _kdNamedColor {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- const unsigned char *name;
-} KdNamedColor;
-
-#define C 0x101
-
-const KdNamedColor KdColors[] = {
- { 240*C, 248*C, 255*C, "alice blue" },
- { 240*C, 248*C, 255*C, "AliceBlue" },
- { 250*C, 235*C, 215*C, "antique white" },
- { 250*C, 235*C, 215*C, "AntiqueWhite" },
- { 255*C, 239*C, 219*C, "AntiqueWhite1" },
- { 238*C, 223*C, 204*C, "AntiqueWhite2" },
- { 205*C, 192*C, 176*C, "AntiqueWhite3" },
- { 139*C, 131*C, 120*C, "AntiqueWhite4" },
- { 127*C, 255*C, 212*C, "aquamarine" },
- { 127*C, 255*C, 212*C, "aquamarine1" },
- { 118*C, 238*C, 198*C, "aquamarine2" },
- { 102*C, 205*C, 170*C, "aquamarine3" },
- { 69*C, 139*C, 116*C, "aquamarine4" },
- { 240*C, 255*C, 255*C, "azure" },
- { 240*C, 255*C, 255*C, "azure1" },
- { 224*C, 238*C, 238*C, "azure2" },
- { 193*C, 205*C, 205*C, "azure3" },
- { 131*C, 139*C, 139*C, "azure4" },
- { 245*C, 245*C, 220*C, "beige" },
- { 255*C, 228*C, 196*C, "bisque" },
- { 255*C, 228*C, 196*C, "bisque1" },
- { 238*C, 213*C, 183*C, "bisque2" },
- { 205*C, 183*C, 158*C, "bisque3" },
- { 139*C, 125*C, 107*C, "bisque4" },
- { 0*C, 0*C, 0*C, "black" },
- { 255*C, 235*C, 205*C, "blanched almond" },
- { 255*C, 235*C, 205*C, "BlanchedAlmond" },
- { 0*C, 0*C, 255*C, "blue" },
- { 138*C, 43*C, 226*C, "blue violet" },
- { 0*C, 0*C, 255*C, "blue1" },
- { 0*C, 0*C, 238*C, "blue2" },
- { 0*C, 0*C, 205*C, "blue3" },
- { 0*C, 0*C, 139*C, "blue4" },
- { 138*C, 43*C, 226*C, "BlueViolet" },
- { 165*C, 42*C, 42*C, "brown" },
- { 255*C, 64*C, 64*C, "brown1" },
- { 238*C, 59*C, 59*C, "brown2" },
- { 205*C, 51*C, 51*C, "brown3" },
- { 139*C, 35*C, 35*C, "brown4" },
- { 222*C, 184*C, 135*C, "burlywood" },
- { 255*C, 211*C, 155*C, "burlywood1" },
- { 238*C, 197*C, 145*C, "burlywood2" },
- { 205*C, 170*C, 125*C, "burlywood3" },
- { 139*C, 115*C, 85*C, "burlywood4" },
- { 95*C, 158*C, 160*C, "cadet blue" },
- { 95*C, 158*C, 160*C, "CadetBlue" },
- { 152*C, 245*C, 255*C, "CadetBlue1" },
- { 142*C, 229*C, 238*C, "CadetBlue2" },
- { 122*C, 197*C, 205*C, "CadetBlue3" },
- { 83*C, 134*C, 139*C, "CadetBlue4" },
- { 127*C, 255*C, 0*C, "chartreuse" },
- { 127*C, 255*C, 0*C, "chartreuse1" },
- { 118*C, 238*C, 0*C, "chartreuse2" },
- { 102*C, 205*C, 0*C, "chartreuse3" },
- { 69*C, 139*C, 0*C, "chartreuse4" },
- { 210*C, 105*C, 30*C, "chocolate" },
- { 255*C, 127*C, 36*C, "chocolate1" },
- { 238*C, 118*C, 33*C, "chocolate2" },
- { 205*C, 102*C, 29*C, "chocolate3" },
- { 139*C, 69*C, 19*C, "chocolate4" },
- { 255*C, 127*C, 80*C, "coral" },
- { 255*C, 114*C, 86*C, "coral1" },
- { 238*C, 106*C, 80*C, "coral2" },
- { 205*C, 91*C, 69*C, "coral3" },
- { 139*C, 62*C, 47*C, "coral4" },
- { 100*C, 149*C, 237*C, "cornflower blue" },
- { 100*C, 149*C, 237*C, "CornflowerBlue" },
- { 255*C, 248*C, 220*C, "cornsilk" },
- { 255*C, 248*C, 220*C, "cornsilk1" },
- { 238*C, 232*C, 205*C, "cornsilk2" },
- { 205*C, 200*C, 177*C, "cornsilk3" },
- { 139*C, 136*C, 120*C, "cornsilk4" },
- { 0*C, 255*C, 255*C, "cyan" },
- { 0*C, 255*C, 255*C, "cyan1" },
- { 0*C, 238*C, 238*C, "cyan2" },
- { 0*C, 205*C, 205*C, "cyan3" },
- { 0*C, 139*C, 139*C, "cyan4" },
- { 0*C, 0*C, 139*C, "dark blue" },
- { 0*C, 139*C, 139*C, "dark cyan" },
- { 184*C, 134*C, 11*C, "dark goldenrod" },
- { 169*C, 169*C, 169*C, "dark gray" },
- { 0*C, 100*C, 0*C, "dark green" },
- { 169*C, 169*C, 169*C, "dark grey" },
- { 189*C, 183*C, 107*C, "dark khaki" },
- { 139*C, 0*C, 139*C, "dark magenta" },
- { 85*C, 107*C, 47*C, "dark olive green" },
- { 255*C, 140*C, 0*C, "dark orange" },
- { 153*C, 50*C, 204*C, "dark orchid" },
- { 139*C, 0*C, 0*C, "dark red" },
- { 233*C, 150*C, 122*C, "dark salmon" },
- { 143*C, 188*C, 143*C, "dark sea green" },
- { 72*C, 61*C, 139*C, "dark slate blue" },
- { 47*C, 79*C, 79*C, "dark slate gray" },
- { 47*C, 79*C, 79*C, "dark slate grey" },
- { 0*C, 206*C, 209*C, "dark turquoise" },
- { 148*C, 0*C, 211*C, "dark violet" },
- { 0*C, 0*C, 139*C, "DarkBlue" },
- { 0*C, 139*C, 139*C, "DarkCyan" },
- { 184*C, 134*C, 11*C, "DarkGoldenrod" },
- { 255*C, 185*C, 15*C, "DarkGoldenrod1" },
- { 238*C, 173*C, 14*C, "DarkGoldenrod2" },
- { 205*C, 149*C, 12*C, "DarkGoldenrod3" },
- { 139*C, 101*C, 8*C, "DarkGoldenrod4" },
- { 169*C, 169*C, 169*C, "DarkGray" },
- { 0*C, 100*C, 0*C, "DarkGreen" },
- { 169*C, 169*C, 169*C, "DarkGrey" },
- { 189*C, 183*C, 107*C, "DarkKhaki" },
- { 139*C, 0*C, 139*C, "DarkMagenta" },
- { 85*C, 107*C, 47*C, "DarkOliveGreen" },
- { 202*C, 255*C, 112*C, "DarkOliveGreen1" },
- { 188*C, 238*C, 104*C, "DarkOliveGreen2" },
- { 162*C, 205*C, 90*C, "DarkOliveGreen3" },
- { 110*C, 139*C, 61*C, "DarkOliveGreen4" },
- { 255*C, 140*C, 0*C, "DarkOrange" },
- { 255*C, 127*C, 0*C, "DarkOrange1" },
- { 238*C, 118*C, 0*C, "DarkOrange2" },
- { 205*C, 102*C, 0*C, "DarkOrange3" },
- { 139*C, 69*C, 0*C, "DarkOrange4" },
- { 153*C, 50*C, 204*C, "DarkOrchid" },
- { 191*C, 62*C, 255*C, "DarkOrchid1" },
- { 178*C, 58*C, 238*C, "DarkOrchid2" },
- { 154*C, 50*C, 205*C, "DarkOrchid3" },
- { 104*C, 34*C, 139*C, "DarkOrchid4" },
- { 139*C, 0*C, 0*C, "DarkRed" },
- { 233*C, 150*C, 122*C, "DarkSalmon" },
- { 143*C, 188*C, 143*C, "DarkSeaGreen" },
- { 193*C, 255*C, 193*C, "DarkSeaGreen1" },
- { 180*C, 238*C, 180*C, "DarkSeaGreen2" },
- { 155*C, 205*C, 155*C, "DarkSeaGreen3" },
- { 105*C, 139*C, 105*C, "DarkSeaGreen4" },
- { 72*C, 61*C, 139*C, "DarkSlateBlue" },
- { 47*C, 79*C, 79*C, "DarkSlateGray" },
- { 151*C, 255*C, 255*C, "DarkSlateGray1" },
- { 141*C, 238*C, 238*C, "DarkSlateGray2" },
- { 121*C, 205*C, 205*C, "DarkSlateGray3" },
- { 82*C, 139*C, 139*C, "DarkSlateGray4" },
- { 47*C, 79*C, 79*C, "DarkSlateGrey" },
- { 0*C, 206*C, 209*C, "DarkTurquoise" },
- { 148*C, 0*C, 211*C, "DarkViolet" },
- { 255*C, 20*C, 147*C, "deep pink" },
- { 0*C, 191*C, 255*C, "deep sky blue" },
- { 255*C, 20*C, 147*C, "DeepPink" },
- { 255*C, 20*C, 147*C, "DeepPink1" },
- { 238*C, 18*C, 137*C, "DeepPink2" },
- { 205*C, 16*C, 118*C, "DeepPink3" },
- { 139*C, 10*C, 80*C, "DeepPink4" },
- { 0*C, 191*C, 255*C, "DeepSkyBlue" },
- { 0*C, 191*C, 255*C, "DeepSkyBlue1" },
- { 0*C, 178*C, 238*C, "DeepSkyBlue2" },
- { 0*C, 154*C, 205*C, "DeepSkyBlue3" },
- { 0*C, 104*C, 139*C, "DeepSkyBlue4" },
- { 105*C, 105*C, 105*C, "dim gray" },
- { 105*C, 105*C, 105*C, "dim grey" },
- { 105*C, 105*C, 105*C, "DimGray" },
- { 105*C, 105*C, 105*C, "DimGrey" },
- { 30*C, 144*C, 255*C, "dodger blue" },
- { 30*C, 144*C, 255*C, "DodgerBlue" },
- { 30*C, 144*C, 255*C, "DodgerBlue1" },
- { 28*C, 134*C, 238*C, "DodgerBlue2" },
- { 24*C, 116*C, 205*C, "DodgerBlue3" },
- { 16*C, 78*C, 139*C, "DodgerBlue4" },
- { 178*C, 34*C, 34*C, "firebrick" },
- { 255*C, 48*C, 48*C, "firebrick1" },
- { 238*C, 44*C, 44*C, "firebrick2" },
- { 205*C, 38*C, 38*C, "firebrick3" },
- { 139*C, 26*C, 26*C, "firebrick4" },
- { 255*C, 250*C, 240*C, "floral white" },
- { 255*C, 250*C, 240*C, "FloralWhite" },
- { 34*C, 139*C, 34*C, "forest green" },
- { 34*C, 139*C, 34*C, "ForestGreen" },
- { 220*C, 220*C, 220*C, "gainsboro" },
- { 248*C, 248*C, 255*C, "ghost white" },
- { 248*C, 248*C, 255*C, "GhostWhite" },
- { 255*C, 215*C, 0*C, "gold" },
- { 255*C, 215*C, 0*C, "gold1" },
- { 238*C, 201*C, 0*C, "gold2" },
- { 205*C, 173*C, 0*C, "gold3" },
- { 139*C, 117*C, 0*C, "gold4" },
- { 218*C, 165*C, 32*C, "goldenrod" },
- { 255*C, 193*C, 37*C, "goldenrod1" },
- { 238*C, 180*C, 34*C, "goldenrod2" },
- { 205*C, 155*C, 29*C, "goldenrod3" },
- { 139*C, 105*C, 20*C, "goldenrod4" },
- { 190*C, 190*C, 190*C, "gray" },
- { 0*C, 0*C, 0*C, "gray0" },
- { 3*C, 3*C, 3*C, "gray1" },
- { 26*C, 26*C, 26*C, "gray10" },
- { 255*C, 255*C, 255*C, "gray100" },
- { 28*C, 28*C, 28*C, "gray11" },
- { 31*C, 31*C, 31*C, "gray12" },
- { 33*C, 33*C, 33*C, "gray13" },
- { 36*C, 36*C, 36*C, "gray14" },
- { 38*C, 38*C, 38*C, "gray15" },
- { 41*C, 41*C, 41*C, "gray16" },
- { 43*C, 43*C, 43*C, "gray17" },
- { 46*C, 46*C, 46*C, "gray18" },
- { 48*C, 48*C, 48*C, "gray19" },
- { 5*C, 5*C, 5*C, "gray2" },
- { 51*C, 51*C, 51*C, "gray20" },
- { 54*C, 54*C, 54*C, "gray21" },
- { 56*C, 56*C, 56*C, "gray22" },
- { 59*C, 59*C, 59*C, "gray23" },
- { 61*C, 61*C, 61*C, "gray24" },
- { 64*C, 64*C, 64*C, "gray25" },
- { 66*C, 66*C, 66*C, "gray26" },
- { 69*C, 69*C, 69*C, "gray27" },
- { 71*C, 71*C, 71*C, "gray28" },
- { 74*C, 74*C, 74*C, "gray29" },
- { 8*C, 8*C, 8*C, "gray3" },
- { 77*C, 77*C, 77*C, "gray30" },
- { 79*C, 79*C, 79*C, "gray31" },
- { 82*C, 82*C, 82*C, "gray32" },
- { 84*C, 84*C, 84*C, "gray33" },
- { 87*C, 87*C, 87*C, "gray34" },
- { 89*C, 89*C, 89*C, "gray35" },
- { 92*C, 92*C, 92*C, "gray36" },
- { 94*C, 94*C, 94*C, "gray37" },
- { 97*C, 97*C, 97*C, "gray38" },
- { 99*C, 99*C, 99*C, "gray39" },
- { 10*C, 10*C, 10*C, "gray4" },
- { 102*C, 102*C, 102*C, "gray40" },
- { 105*C, 105*C, 105*C, "gray41" },
- { 107*C, 107*C, 107*C, "gray42" },
- { 110*C, 110*C, 110*C, "gray43" },
- { 112*C, 112*C, 112*C, "gray44" },
- { 115*C, 115*C, 115*C, "gray45" },
- { 117*C, 117*C, 117*C, "gray46" },
- { 120*C, 120*C, 120*C, "gray47" },
- { 122*C, 122*C, 122*C, "gray48" },
- { 125*C, 125*C, 125*C, "gray49" },
- { 13*C, 13*C, 13*C, "gray5" },
- { 127*C, 127*C, 127*C, "gray50" },
- { 130*C, 130*C, 130*C, "gray51" },
- { 133*C, 133*C, 133*C, "gray52" },
- { 135*C, 135*C, 135*C, "gray53" },
- { 138*C, 138*C, 138*C, "gray54" },
- { 140*C, 140*C, 140*C, "gray55" },
- { 143*C, 143*C, 143*C, "gray56" },
- { 145*C, 145*C, 145*C, "gray57" },
- { 148*C, 148*C, 148*C, "gray58" },
- { 150*C, 150*C, 150*C, "gray59" },
- { 15*C, 15*C, 15*C, "gray6" },
- { 153*C, 153*C, 153*C, "gray60" },
- { 156*C, 156*C, 156*C, "gray61" },
- { 158*C, 158*C, 158*C, "gray62" },
- { 161*C, 161*C, 161*C, "gray63" },
- { 163*C, 163*C, 163*C, "gray64" },
- { 166*C, 166*C, 166*C, "gray65" },
- { 168*C, 168*C, 168*C, "gray66" },
- { 171*C, 171*C, 171*C, "gray67" },
- { 173*C, 173*C, 173*C, "gray68" },
- { 176*C, 176*C, 176*C, "gray69" },
- { 18*C, 18*C, 18*C, "gray7" },
- { 179*C, 179*C, 179*C, "gray70" },
- { 181*C, 181*C, 181*C, "gray71" },
- { 184*C, 184*C, 184*C, "gray72" },
- { 186*C, 186*C, 186*C, "gray73" },
- { 189*C, 189*C, 189*C, "gray74" },
- { 191*C, 191*C, 191*C, "gray75" },
- { 194*C, 194*C, 194*C, "gray76" },
- { 196*C, 196*C, 196*C, "gray77" },
- { 199*C, 199*C, 199*C, "gray78" },
- { 201*C, 201*C, 201*C, "gray79" },
- { 20*C, 20*C, 20*C, "gray8" },
- { 204*C, 204*C, 204*C, "gray80" },
- { 207*C, 207*C, 207*C, "gray81" },
- { 209*C, 209*C, 209*C, "gray82" },
- { 212*C, 212*C, 212*C, "gray83" },
- { 214*C, 214*C, 214*C, "gray84" },
- { 217*C, 217*C, 217*C, "gray85" },
- { 219*C, 219*C, 219*C, "gray86" },
- { 222*C, 222*C, 222*C, "gray87" },
- { 224*C, 224*C, 224*C, "gray88" },
- { 227*C, 227*C, 227*C, "gray89" },
- { 23*C, 23*C, 23*C, "gray9" },
- { 229*C, 229*C, 229*C, "gray90" },
- { 232*C, 232*C, 232*C, "gray91" },
- { 235*C, 235*C, 235*C, "gray92" },
- { 237*C, 237*C, 237*C, "gray93" },
- { 240*C, 240*C, 240*C, "gray94" },
- { 242*C, 242*C, 242*C, "gray95" },
- { 245*C, 245*C, 245*C, "gray96" },
- { 247*C, 247*C, 247*C, "gray97" },
- { 250*C, 250*C, 250*C, "gray98" },
- { 252*C, 252*C, 252*C, "gray99" },
- { 0*C, 255*C, 0*C, "green" },
- { 173*C, 255*C, 47*C, "green yellow" },
- { 0*C, 255*C, 0*C, "green1" },
- { 0*C, 238*C, 0*C, "green2" },
- { 0*C, 205*C, 0*C, "green3" },
- { 0*C, 139*C, 0*C, "green4" },
- { 173*C, 255*C, 47*C, "GreenYellow" },
- { 190*C, 190*C, 190*C, "grey" },
- { 0*C, 0*C, 0*C, "grey0" },
- { 3*C, 3*C, 3*C, "grey1" },
- { 26*C, 26*C, 26*C, "grey10" },
- { 255*C, 255*C, 255*C, "grey100" },
- { 28*C, 28*C, 28*C, "grey11" },
- { 31*C, 31*C, 31*C, "grey12" },
- { 33*C, 33*C, 33*C, "grey13" },
- { 36*C, 36*C, 36*C, "grey14" },
- { 38*C, 38*C, 38*C, "grey15" },
- { 41*C, 41*C, 41*C, "grey16" },
- { 43*C, 43*C, 43*C, "grey17" },
- { 46*C, 46*C, 46*C, "grey18" },
- { 48*C, 48*C, 48*C, "grey19" },
- { 5*C, 5*C, 5*C, "grey2" },
- { 51*C, 51*C, 51*C, "grey20" },
- { 54*C, 54*C, 54*C, "grey21" },
- { 56*C, 56*C, 56*C, "grey22" },
- { 59*C, 59*C, 59*C, "grey23" },
- { 61*C, 61*C, 61*C, "grey24" },
- { 64*C, 64*C, 64*C, "grey25" },
- { 66*C, 66*C, 66*C, "grey26" },
- { 69*C, 69*C, 69*C, "grey27" },
- { 71*C, 71*C, 71*C, "grey28" },
- { 74*C, 74*C, 74*C, "grey29" },
- { 8*C, 8*C, 8*C, "grey3" },
- { 77*C, 77*C, 77*C, "grey30" },
- { 79*C, 79*C, 79*C, "grey31" },
- { 82*C, 82*C, 82*C, "grey32" },
- { 84*C, 84*C, 84*C, "grey33" },
- { 87*C, 87*C, 87*C, "grey34" },
- { 89*C, 89*C, 89*C, "grey35" },
- { 92*C, 92*C, 92*C, "grey36" },
- { 94*C, 94*C, 94*C, "grey37" },
- { 97*C, 97*C, 97*C, "grey38" },
- { 99*C, 99*C, 99*C, "grey39" },
- { 10*C, 10*C, 10*C, "grey4" },
- { 102*C, 102*C, 102*C, "grey40" },
- { 105*C, 105*C, 105*C, "grey41" },
- { 107*C, 107*C, 107*C, "grey42" },
- { 110*C, 110*C, 110*C, "grey43" },
- { 112*C, 112*C, 112*C, "grey44" },
- { 115*C, 115*C, 115*C, "grey45" },
- { 117*C, 117*C, 117*C, "grey46" },
- { 120*C, 120*C, 120*C, "grey47" },
- { 122*C, 122*C, 122*C, "grey48" },
- { 125*C, 125*C, 125*C, "grey49" },
- { 13*C, 13*C, 13*C, "grey5" },
- { 127*C, 127*C, 127*C, "grey50" },
- { 130*C, 130*C, 130*C, "grey51" },
- { 133*C, 133*C, 133*C, "grey52" },
- { 135*C, 135*C, 135*C, "grey53" },
- { 138*C, 138*C, 138*C, "grey54" },
- { 140*C, 140*C, 140*C, "grey55" },
- { 143*C, 143*C, 143*C, "grey56" },
- { 145*C, 145*C, 145*C, "grey57" },
- { 148*C, 148*C, 148*C, "grey58" },
- { 150*C, 150*C, 150*C, "grey59" },
- { 15*C, 15*C, 15*C, "grey6" },
- { 153*C, 153*C, 153*C, "grey60" },
- { 156*C, 156*C, 156*C, "grey61" },
- { 158*C, 158*C, 158*C, "grey62" },
- { 161*C, 161*C, 161*C, "grey63" },
- { 163*C, 163*C, 163*C, "grey64" },
- { 166*C, 166*C, 166*C, "grey65" },
- { 168*C, 168*C, 168*C, "grey66" },
- { 171*C, 171*C, 171*C, "grey67" },
- { 173*C, 173*C, 173*C, "grey68" },
- { 176*C, 176*C, 176*C, "grey69" },
- { 18*C, 18*C, 18*C, "grey7" },
- { 179*C, 179*C, 179*C, "grey70" },
- { 181*C, 181*C, 181*C, "grey71" },
- { 184*C, 184*C, 184*C, "grey72" },
- { 186*C, 186*C, 186*C, "grey73" },
- { 189*C, 189*C, 189*C, "grey74" },
- { 191*C, 191*C, 191*C, "grey75" },
- { 194*C, 194*C, 194*C, "grey76" },
- { 196*C, 196*C, 196*C, "grey77" },
- { 199*C, 199*C, 199*C, "grey78" },
- { 201*C, 201*C, 201*C, "grey79" },
- { 20*C, 20*C, 20*C, "grey8" },
- { 204*C, 204*C, 204*C, "grey80" },
- { 207*C, 207*C, 207*C, "grey81" },
- { 209*C, 209*C, 209*C, "grey82" },
- { 212*C, 212*C, 212*C, "grey83" },
- { 214*C, 214*C, 214*C, "grey84" },
- { 217*C, 217*C, 217*C, "grey85" },
- { 219*C, 219*C, 219*C, "grey86" },
- { 222*C, 222*C, 222*C, "grey87" },
- { 224*C, 224*C, 224*C, "grey88" },
- { 227*C, 227*C, 227*C, "grey89" },
- { 23*C, 23*C, 23*C, "grey9" },
- { 229*C, 229*C, 229*C, "grey90" },
- { 232*C, 232*C, 232*C, "grey91" },
- { 235*C, 235*C, 235*C, "grey92" },
- { 237*C, 237*C, 237*C, "grey93" },
- { 240*C, 240*C, 240*C, "grey94" },
- { 242*C, 242*C, 242*C, "grey95" },
- { 245*C, 245*C, 245*C, "grey96" },
- { 247*C, 247*C, 247*C, "grey97" },
- { 250*C, 250*C, 250*C, "grey98" },
- { 252*C, 252*C, 252*C, "grey99" },
- { 240*C, 255*C, 240*C, "honeydew" },
- { 240*C, 255*C, 240*C, "honeydew1" },
- { 224*C, 238*C, 224*C, "honeydew2" },
- { 193*C, 205*C, 193*C, "honeydew3" },
- { 131*C, 139*C, 131*C, "honeydew4" },
- { 255*C, 105*C, 180*C, "hot pink" },
- { 255*C, 105*C, 180*C, "HotPink" },
- { 255*C, 110*C, 180*C, "HotPink1" },
- { 238*C, 106*C, 167*C, "HotPink2" },
- { 205*C, 96*C, 144*C, "HotPink3" },
- { 139*C, 58*C, 98*C, "HotPink4" },
- { 205*C, 92*C, 92*C, "indian red" },
- { 205*C, 92*C, 92*C, "IndianRed" },
- { 255*C, 106*C, 106*C, "IndianRed1" },
- { 238*C, 99*C, 99*C, "IndianRed2" },
- { 205*C, 85*C, 85*C, "IndianRed3" },
- { 139*C, 58*C, 58*C, "IndianRed4" },
- { 255*C, 255*C, 240*C, "ivory" },
- { 255*C, 255*C, 240*C, "ivory1" },
- { 238*C, 238*C, 224*C, "ivory2" },
- { 205*C, 205*C, 193*C, "ivory3" },
- { 139*C, 139*C, 131*C, "ivory4" },
- { 240*C, 230*C, 140*C, "khaki" },
- { 255*C, 246*C, 143*C, "khaki1" },
- { 238*C, 230*C, 133*C, "khaki2" },
- { 205*C, 198*C, 115*C, "khaki3" },
- { 139*C, 134*C, 78*C, "khaki4" },
- { 230*C, 230*C, 250*C, "lavender" },
- { 255*C, 240*C, 245*C, "lavender blush" },
- { 255*C, 240*C, 245*C, "LavenderBlush" },
- { 255*C, 240*C, 245*C, "LavenderBlush1" },
- { 238*C, 224*C, 229*C, "LavenderBlush2" },
- { 205*C, 193*C, 197*C, "LavenderBlush3" },
- { 139*C, 131*C, 134*C, "LavenderBlush4" },
- { 124*C, 252*C, 0*C, "lawn green" },
- { 124*C, 252*C, 0*C, "LawnGreen" },
- { 255*C, 250*C, 205*C, "lemon chiffon" },
- { 255*C, 250*C, 205*C, "LemonChiffon" },
- { 255*C, 250*C, 205*C, "LemonChiffon1" },
- { 238*C, 233*C, 191*C, "LemonChiffon2" },
- { 205*C, 201*C, 165*C, "LemonChiffon3" },
- { 139*C, 137*C, 112*C, "LemonChiffon4" },
- { 173*C, 216*C, 230*C, "light blue" },
- { 240*C, 128*C, 128*C, "light coral" },
- { 224*C, 255*C, 255*C, "light cyan" },
- { 238*C, 221*C, 130*C, "light goldenrod" },
- { 250*C, 250*C, 210*C, "light goldenrod yellow" },
- { 211*C, 211*C, 211*C, "light gray" },
- { 144*C, 238*C, 144*C, "light green" },
- { 211*C, 211*C, 211*C, "light grey" },
- { 255*C, 182*C, 193*C, "light pink" },
- { 255*C, 160*C, 122*C, "light salmon" },
- { 32*C, 178*C, 170*C, "light sea green" },
- { 135*C, 206*C, 250*C, "light sky blue" },
- { 132*C, 112*C, 255*C, "light slate blue" },
- { 119*C, 136*C, 153*C, "light slate gray" },
- { 119*C, 136*C, 153*C, "light slate grey" },
- { 176*C, 196*C, 222*C, "light steel blue" },
- { 255*C, 255*C, 224*C, "light yellow" },
- { 173*C, 216*C, 230*C, "LightBlue" },
- { 191*C, 239*C, 255*C, "LightBlue1" },
- { 178*C, 223*C, 238*C, "LightBlue2" },
- { 154*C, 192*C, 205*C, "LightBlue3" },
- { 104*C, 131*C, 139*C, "LightBlue4" },
- { 240*C, 128*C, 128*C, "LightCoral" },
- { 224*C, 255*C, 255*C, "LightCyan" },
- { 224*C, 255*C, 255*C, "LightCyan1" },
- { 209*C, 238*C, 238*C, "LightCyan2" },
- { 180*C, 205*C, 205*C, "LightCyan3" },
- { 122*C, 139*C, 139*C, "LightCyan4" },
- { 238*C, 221*C, 130*C, "LightGoldenrod" },
- { 255*C, 236*C, 139*C, "LightGoldenrod1" },
- { 238*C, 220*C, 130*C, "LightGoldenrod2" },
- { 205*C, 190*C, 112*C, "LightGoldenrod3" },
- { 139*C, 129*C, 76*C, "LightGoldenrod4" },
- { 250*C, 250*C, 210*C, "LightGoldenrodYellow" },
- { 211*C, 211*C, 211*C, "LightGray" },
- { 144*C, 238*C, 144*C, "LightGreen" },
- { 211*C, 211*C, 211*C, "LightGrey" },
- { 255*C, 182*C, 193*C, "LightPink" },
- { 255*C, 174*C, 185*C, "LightPink1" },
- { 238*C, 162*C, 173*C, "LightPink2" },
- { 205*C, 140*C, 149*C, "LightPink3" },
- { 139*C, 95*C, 101*C, "LightPink4" },
- { 255*C, 160*C, 122*C, "LightSalmon" },
- { 255*C, 160*C, 122*C, "LightSalmon1" },
- { 238*C, 149*C, 114*C, "LightSalmon2" },
- { 205*C, 129*C, 98*C, "LightSalmon3" },
- { 139*C, 87*C, 66*C, "LightSalmon4" },
- { 32*C, 178*C, 170*C, "LightSeaGreen" },
- { 135*C, 206*C, 250*C, "LightSkyBlue" },
- { 176*C, 226*C, 255*C, "LightSkyBlue1" },
- { 164*C, 211*C, 238*C, "LightSkyBlue2" },
- { 141*C, 182*C, 205*C, "LightSkyBlue3" },
- { 96*C, 123*C, 139*C, "LightSkyBlue4" },
- { 132*C, 112*C, 255*C, "LightSlateBlue" },
- { 119*C, 136*C, 153*C, "LightSlateGray" },
- { 119*C, 136*C, 153*C, "LightSlateGrey" },
- { 176*C, 196*C, 222*C, "LightSteelBlue" },
- { 202*C, 225*C, 255*C, "LightSteelBlue1" },
- { 188*C, 210*C, 238*C, "LightSteelBlue2" },
- { 162*C, 181*C, 205*C, "LightSteelBlue3" },
- { 110*C, 123*C, 139*C, "LightSteelBlue4" },
- { 255*C, 255*C, 224*C, "LightYellow" },
- { 255*C, 255*C, 224*C, "LightYellow1" },
- { 238*C, 238*C, 209*C, "LightYellow2" },
- { 205*C, 205*C, 180*C, "LightYellow3" },
- { 139*C, 139*C, 122*C, "LightYellow4" },
- { 50*C, 205*C, 50*C, "lime green" },
- { 50*C, 205*C, 50*C, "LimeGreen" },
- { 250*C, 240*C, 230*C, "linen" },
- { 255*C, 0*C, 255*C, "magenta" },
- { 255*C, 0*C, 255*C, "magenta1" },
- { 238*C, 0*C, 238*C, "magenta2" },
- { 205*C, 0*C, 205*C, "magenta3" },
- { 139*C, 0*C, 139*C, "magenta4" },
- { 176*C, 48*C, 96*C, "maroon" },
- { 255*C, 52*C, 179*C, "maroon1" },
- { 238*C, 48*C, 167*C, "maroon2" },
- { 205*C, 41*C, 144*C, "maroon3" },
- { 139*C, 28*C, 98*C, "maroon4" },
- { 102*C, 205*C, 170*C, "medium aquamarine" },
- { 0*C, 0*C, 205*C, "medium blue" },
- { 186*C, 85*C, 211*C, "medium orchid" },
- { 147*C, 112*C, 219*C, "medium purple" },
- { 60*C, 179*C, 113*C, "medium sea green" },
- { 123*C, 104*C, 238*C, "medium slate blue" },
- { 0*C, 250*C, 154*C, "medium spring green" },
- { 72*C, 209*C, 204*C, "medium turquoise" },
- { 199*C, 21*C, 133*C, "medium violet red" },
- { 102*C, 205*C, 170*C, "MediumAquamarine" },
- { 0*C, 0*C, 205*C, "MediumBlue" },
- { 186*C, 85*C, 211*C, "MediumOrchid" },
- { 224*C, 102*C, 255*C, "MediumOrchid1" },
- { 209*C, 95*C, 238*C, "MediumOrchid2" },
- { 180*C, 82*C, 205*C, "MediumOrchid3" },
- { 122*C, 55*C, 139*C, "MediumOrchid4" },
- { 147*C, 112*C, 219*C, "MediumPurple" },
- { 171*C, 130*C, 255*C, "MediumPurple1" },
- { 159*C, 121*C, 238*C, "MediumPurple2" },
- { 137*C, 104*C, 205*C, "MediumPurple3" },
- { 93*C, 71*C, 139*C, "MediumPurple4" },
- { 60*C, 179*C, 113*C, "MediumSeaGreen" },
- { 123*C, 104*C, 238*C, "MediumSlateBlue" },
- { 0*C, 250*C, 154*C, "MediumSpringGreen" },
- { 72*C, 209*C, 204*C, "MediumTurquoise" },
- { 199*C, 21*C, 133*C, "MediumVioletRed" },
- { 25*C, 25*C, 112*C, "midnight blue" },
- { 25*C, 25*C, 112*C, "MidnightBlue" },
- { 245*C, 255*C, 250*C, "mint cream" },
- { 245*C, 255*C, 250*C, "MintCream" },
- { 255*C, 228*C, 225*C, "misty rose" },
- { 255*C, 228*C, 225*C, "MistyRose" },
- { 255*C, 228*C, 225*C, "MistyRose1" },
- { 238*C, 213*C, 210*C, "MistyRose2" },
- { 205*C, 183*C, 181*C, "MistyRose3" },
- { 139*C, 125*C, 123*C, "MistyRose4" },
- { 255*C, 228*C, 181*C, "moccasin" },
- { 255*C, 222*C, 173*C, "navajo white" },
- { 255*C, 222*C, 173*C, "NavajoWhite" },
- { 255*C, 222*C, 173*C, "NavajoWhite1" },
- { 238*C, 207*C, 161*C, "NavajoWhite2" },
- { 205*C, 179*C, 139*C, "NavajoWhite3" },
- { 139*C, 121*C, 94*C, "NavajoWhite4" },
- { 0*C, 0*C, 128*C, "navy" },
- { 0*C, 0*C, 128*C, "navy blue" },
- { 0*C, 0*C, 128*C, "NavyBlue" },
- { 253*C, 245*C, 230*C, "old lace" },
- { 253*C, 245*C, 230*C, "OldLace" },
- { 107*C, 142*C, 35*C, "olive drab" },
- { 107*C, 142*C, 35*C, "OliveDrab" },
- { 192*C, 255*C, 62*C, "OliveDrab1" },
- { 179*C, 238*C, 58*C, "OliveDrab2" },
- { 154*C, 205*C, 50*C, "OliveDrab3" },
- { 105*C, 139*C, 34*C, "OliveDrab4" },
- { 255*C, 165*C, 0*C, "orange" },
- { 255*C, 69*C, 0*C, "orange red" },
- { 255*C, 165*C, 0*C, "orange1" },
- { 238*C, 154*C, 0*C, "orange2" },
- { 205*C, 133*C, 0*C, "orange3" },
- { 139*C, 90*C, 0*C, "orange4" },
- { 255*C, 69*C, 0*C, "OrangeRed" },
- { 255*C, 69*C, 0*C, "OrangeRed1" },
- { 238*C, 64*C, 0*C, "OrangeRed2" },
- { 205*C, 55*C, 0*C, "OrangeRed3" },
- { 139*C, 37*C, 0*C, "OrangeRed4" },
- { 218*C, 112*C, 214*C, "orchid" },
- { 255*C, 131*C, 250*C, "orchid1" },
- { 238*C, 122*C, 233*C, "orchid2" },
- { 205*C, 105*C, 201*C, "orchid3" },
- { 139*C, 71*C, 137*C, "orchid4" },
- { 238*C, 232*C, 170*C, "pale goldenrod" },
- { 152*C, 251*C, 152*C, "pale green" },
- { 175*C, 238*C, 238*C, "pale turquoise" },
- { 219*C, 112*C, 147*C, "pale violet red" },
- { 238*C, 232*C, 170*C, "PaleGoldenrod" },
- { 152*C, 251*C, 152*C, "PaleGreen" },
- { 154*C, 255*C, 154*C, "PaleGreen1" },
- { 144*C, 238*C, 144*C, "PaleGreen2" },
- { 124*C, 205*C, 124*C, "PaleGreen3" },
- { 84*C, 139*C, 84*C, "PaleGreen4" },
- { 175*C, 238*C, 238*C, "PaleTurquoise" },
- { 187*C, 255*C, 255*C, "PaleTurquoise1" },
- { 174*C, 238*C, 238*C, "PaleTurquoise2" },
- { 150*C, 205*C, 205*C, "PaleTurquoise3" },
- { 102*C, 139*C, 139*C, "PaleTurquoise4" },
- { 219*C, 112*C, 147*C, "PaleVioletRed" },
- { 255*C, 130*C, 171*C, "PaleVioletRed1" },
- { 238*C, 121*C, 159*C, "PaleVioletRed2" },
- { 205*C, 104*C, 137*C, "PaleVioletRed3" },
- { 139*C, 71*C, 93*C, "PaleVioletRed4" },
- { 255*C, 239*C, 213*C, "papaya whip" },
- { 255*C, 239*C, 213*C, "PapayaWhip" },
- { 255*C, 218*C, 185*C, "peach puff" },
- { 255*C, 218*C, 185*C, "PeachPuff" },
- { 255*C, 218*C, 185*C, "PeachPuff1" },
- { 238*C, 203*C, 173*C, "PeachPuff2" },
- { 205*C, 175*C, 149*C, "PeachPuff3" },
- { 139*C, 119*C, 101*C, "PeachPuff4" },
- { 205*C, 133*C, 63*C, "peru" },
- { 255*C, 192*C, 203*C, "pink" },
- { 255*C, 181*C, 197*C, "pink1" },
- { 238*C, 169*C, 184*C, "pink2" },
- { 205*C, 145*C, 158*C, "pink3" },
- { 139*C, 99*C, 108*C, "pink4" },
- { 221*C, 160*C, 221*C, "plum" },
- { 255*C, 187*C, 255*C, "plum1" },
- { 238*C, 174*C, 238*C, "plum2" },
- { 205*C, 150*C, 205*C, "plum3" },
- { 139*C, 102*C, 139*C, "plum4" },
- { 176*C, 224*C, 230*C, "powder blue" },
- { 176*C, 224*C, 230*C, "PowderBlue" },
- { 160*C, 32*C, 240*C, "purple" },
- { 155*C, 48*C, 255*C, "purple1" },
- { 145*C, 44*C, 238*C, "purple2" },
- { 125*C, 38*C, 205*C, "purple3" },
- { 85*C, 26*C, 139*C, "purple4" },
- { 255*C, 0*C, 0*C, "red" },
- { 255*C, 0*C, 0*C, "red1" },
- { 238*C, 0*C, 0*C, "red2" },
- { 205*C, 0*C, 0*C, "red3" },
- { 139*C, 0*C, 0*C, "red4" },
- { 188*C, 143*C, 143*C, "rosy brown" },
- { 188*C, 143*C, 143*C, "RosyBrown" },
- { 255*C, 193*C, 193*C, "RosyBrown1" },
- { 238*C, 180*C, 180*C, "RosyBrown2" },
- { 205*C, 155*C, 155*C, "RosyBrown3" },
- { 139*C, 105*C, 105*C, "RosyBrown4" },
- { 65*C, 105*C, 225*C, "royal blue" },
- { 65*C, 105*C, 225*C, "RoyalBlue" },
- { 72*C, 118*C, 255*C, "RoyalBlue1" },
- { 67*C, 110*C, 238*C, "RoyalBlue2" },
- { 58*C, 95*C, 205*C, "RoyalBlue3" },
- { 39*C, 64*C, 139*C, "RoyalBlue4" },
- { 139*C, 69*C, 19*C, "saddle brown" },
- { 139*C, 69*C, 19*C, "SaddleBrown" },
- { 250*C, 128*C, 114*C, "salmon" },
- { 255*C, 140*C, 105*C, "salmon1" },
- { 238*C, 130*C, 98*C, "salmon2" },
- { 205*C, 112*C, 84*C, "salmon3" },
- { 139*C, 76*C, 57*C, "salmon4" },
- { 244*C, 164*C, 96*C, "sandy brown" },
- { 244*C, 164*C, 96*C, "SandyBrown" },
- { 46*C, 139*C, 87*C, "sea green" },
- { 46*C, 139*C, 87*C, "SeaGreen" },
- { 84*C, 255*C, 159*C, "SeaGreen1" },
- { 78*C, 238*C, 148*C, "SeaGreen2" },
- { 67*C, 205*C, 128*C, "SeaGreen3" },
- { 46*C, 139*C, 87*C, "SeaGreen4" },
- { 255*C, 245*C, 238*C, "seashell" },
- { 255*C, 245*C, 238*C, "seashell1" },
- { 238*C, 229*C, 222*C, "seashell2" },
- { 205*C, 197*C, 191*C, "seashell3" },
- { 139*C, 134*C, 130*C, "seashell4" },
- { 160*C, 82*C, 45*C, "sienna" },
- { 255*C, 130*C, 71*C, "sienna1" },
- { 238*C, 121*C, 66*C, "sienna2" },
- { 205*C, 104*C, 57*C, "sienna3" },
- { 139*C, 71*C, 38*C, "sienna4" },
- { 135*C, 206*C, 235*C, "sky blue" },
- { 135*C, 206*C, 235*C, "SkyBlue" },
- { 135*C, 206*C, 255*C, "SkyBlue1" },
- { 126*C, 192*C, 238*C, "SkyBlue2" },
- { 108*C, 166*C, 205*C, "SkyBlue3" },
- { 74*C, 112*C, 139*C, "SkyBlue4" },
- { 106*C, 90*C, 205*C, "slate blue" },
- { 112*C, 128*C, 144*C, "slate gray" },
- { 112*C, 128*C, 144*C, "slate grey" },
- { 106*C, 90*C, 205*C, "SlateBlue" },
- { 131*C, 111*C, 255*C, "SlateBlue1" },
- { 122*C, 103*C, 238*C, "SlateBlue2" },
- { 105*C, 89*C, 205*C, "SlateBlue3" },
- { 71*C, 60*C, 139*C, "SlateBlue4" },
- { 112*C, 128*C, 144*C, "SlateGray" },
- { 198*C, 226*C, 255*C, "SlateGray1" },
- { 185*C, 211*C, 238*C, "SlateGray2" },
- { 159*C, 182*C, 205*C, "SlateGray3" },
- { 108*C, 123*C, 139*C, "SlateGray4" },
- { 112*C, 128*C, 144*C, "SlateGrey" },
- { 255*C, 250*C, 250*C, "snow" },
- { 255*C, 250*C, 250*C, "snow1" },
- { 238*C, 233*C, 233*C, "snow2" },
- { 205*C, 201*C, 201*C, "snow3" },
- { 139*C, 137*C, 137*C, "snow4" },
- { 0*C, 255*C, 127*C, "spring green" },
- { 0*C, 255*C, 127*C, "SpringGreen" },
- { 0*C, 255*C, 127*C, "SpringGreen1" },
- { 0*C, 238*C, 118*C, "SpringGreen2" },
- { 0*C, 205*C, 102*C, "SpringGreen3" },
- { 0*C, 139*C, 69*C, "SpringGreen4" },
- { 70*C, 130*C, 180*C, "steel blue" },
- { 70*C, 130*C, 180*C, "SteelBlue" },
- { 99*C, 184*C, 255*C, "SteelBlue1" },
- { 92*C, 172*C, 238*C, "SteelBlue2" },
- { 79*C, 148*C, 205*C, "SteelBlue3" },
- { 54*C, 100*C, 139*C, "SteelBlue4" },
- { 210*C, 180*C, 140*C, "tan" },
- { 255*C, 165*C, 79*C, "tan1" },
- { 238*C, 154*C, 73*C, "tan2" },
- { 205*C, 133*C, 63*C, "tan3" },
- { 139*C, 90*C, 43*C, "tan4" },
- { 216*C, 191*C, 216*C, "thistle" },
- { 255*C, 225*C, 255*C, "thistle1" },
- { 238*C, 210*C, 238*C, "thistle2" },
- { 205*C, 181*C, 205*C, "thistle3" },
- { 139*C, 123*C, 139*C, "thistle4" },
- { 255*C, 99*C, 71*C, "tomato" },
- { 255*C, 99*C, 71*C, "tomato1" },
- { 238*C, 92*C, 66*C, "tomato2" },
- { 205*C, 79*C, 57*C, "tomato3" },
- { 139*C, 54*C, 38*C, "tomato4" },
- { 64*C, 224*C, 208*C, "turquoise" },
- { 0*C, 245*C, 255*C, "turquoise1" },
- { 0*C, 229*C, 238*C, "turquoise2" },
- { 0*C, 197*C, 205*C, "turquoise3" },
- { 0*C, 134*C, 139*C, "turquoise4" },
- { 238*C, 130*C, 238*C, "violet" },
- { 208*C, 32*C, 144*C, "violet red" },
- { 208*C, 32*C, 144*C, "VioletRed" },
- { 255*C, 62*C, 150*C, "VioletRed1" },
- { 238*C, 58*C, 140*C, "VioletRed2" },
- { 205*C, 50*C, 120*C, "VioletRed3" },
- { 139*C, 34*C, 82*C, "VioletRed4" },
- { 245*C, 222*C, 179*C, "wheat" },
- { 255*C, 231*C, 186*C, "wheat1" },
- { 238*C, 216*C, 174*C, "wheat2" },
- { 205*C, 186*C, 150*C, "wheat3" },
- { 139*C, 126*C, 102*C, "wheat4" },
- { 255*C, 255*C, 255*C, "white" },
- { 245*C, 245*C, 245*C, "white smoke" },
- { 245*C, 245*C, 245*C, "WhiteSmoke" },
- { 255*C, 255*C, 0*C, "yellow" },
- { 154*C, 205*C, 50*C, "yellow green" },
- { 255*C, 255*C, 0*C, "yellow1" },
- { 238*C, 238*C, 0*C, "yellow2" },
- { 205*C, 205*C, 0*C, "yellow3" },
- { 139*C, 139*C, 0*C, "yellow4" },
- { 154*C, 205*C, 50*C, "YellowGreen" }
-};
-
-#undef C
-
-#define NUM_KD_COLORS (sizeof (KdColors) / sizeof (KdColors[0]))
-
-Bool
-OsInitColors()
-{
- return TRUE;
-}
-
-Bool
-OsLookupColor(int screen,
- char *s_name,
- unsigned int len,
- unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue)
-{
- const KdNamedColor *c;
- unsigned char *name = (unsigned char *) s_name;
- int low, mid, high;
- int r;
-
- low = 0;
- high = NUM_KD_COLORS;
- while (high - low > 0)
- {
- mid = (low + high) / 2;
- c = &KdColors[mid];
- r = KdStrCaseCmp (c->name, name, len);
- if (r == 0)
- {
- *pred = c->red;
- *pgreen = c->green;
- *pblue = c->blue;
- return TRUE;
- }
- if (r < 0)
- {
- if (high == mid)
- break;
- high = mid;
- }
- else
- {
- if (low == mid)
- break;
- low = mid;
- }
- }
- return FALSE;
-}
diff --git a/hw/kdrive/src/kcurscol.c b/hw/kdrive/src/kcurscol.c
deleted file mode 100644
index 50edf1735..000000000
--- a/hw/kdrive/src/kcurscol.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kcurscol.c,v 1.4 2000/05/11 18:14:13 tsi Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "cursorstr.h"
-
-static int
-KdComputeCmapShift (unsigned long mask)
-{
- int shift;
- unsigned long bit;
-
- shift = 16;
- bit = 0x80000000;
- while (!(mask & bit))
- {
- shift--;
- bit >>= 1;
- }
- return shift;
-}
-
-#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
-
-void
-KdAllocateCursorPixels (ScreenPtr pScreen,
- int fb,
- CursorPtr pCursor,
- Pixel *source,
- Pixel *mask)
-{
- xColorItem sourceColor, maskColor;
- int r, g, b;
- KdScreenPriv(pScreen);
-
- if (pScreenPriv->screen->fb[fb].redMask)
- {
-
- r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
- g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
- b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
- *source = ((Shift(pCursor->foreRed,r) & pScreenPriv->screen->fb[fb].redMask) |
- (Shift(pCursor->foreGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
- (Shift(pCursor->foreBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
- *mask = ((Shift(pCursor->backRed,r) & pScreenPriv->screen->fb[fb].redMask) |
- (Shift(pCursor->backGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
- (Shift(pCursor->backBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
- }
- else
- {
- /*
- * Set these to an invalid pixel value so that
- * when the store colors comes through, the cursor
- * won't get recolored
- */
- *source = ~0;
- *mask = ~0;
-
- sourceColor.red = pCursor->foreRed;
- sourceColor.green = pCursor->foreGreen;
- sourceColor.blue = pCursor->foreBlue;
- FakeAllocColor(pScreenPriv->pInstalledmap[fb], &sourceColor);
- maskColor.red = pCursor->backRed;
- maskColor.green = pCursor->backGreen;
- maskColor.blue = pCursor->backBlue;
- FakeAllocColor(pScreenPriv->pInstalledmap[fb], &maskColor);
- FakeFreeColor(pScreenPriv->pInstalledmap[fb], sourceColor.pixel);
- FakeFreeColor(pScreenPriv->pInstalledmap[fb], maskColor.pixel);
- *source = sourceColor.pixel;
- *mask = maskColor.pixel;
- }
-}
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
deleted file mode 100644
index a6065f6f4..000000000
--- a/hw/kdrive/src/kdrive.c
+++ /dev/null
@@ -1,1471 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.29 2002/10/31 18:29:50 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#ifdef PSEUDO8
-#include "pseudo8/pseudo8.h"
-#endif
-#include <mivalidate.h>
-#include <dixstruct.h>
-#ifdef RANDR
-#include <randrstr.h>
-#endif
-
-#ifdef XV
-#include "kxv.h"
-#endif
-
-#ifdef DPMSExtension
-#include "dpmsproc.h"
-#endif
-
-CARD8 kdBpp[] = { 1, 4, 8, 16, 24, 32 };
-
-#define NUM_KD_BPP (sizeof (kdBpp) / sizeof (kdBpp[0]))
-
-int kdScreenPrivateIndex;
-unsigned long kdGeneration;
-
-Bool kdVideoTest;
-unsigned long kdVideoTestTime;
-Bool kdEmulateMiddleButton;
-Bool kdRawPointerCoordinates;
-Bool kdDisableZaphod;
-Bool kdEnabled;
-int kdSubpixelOrder;
-int kdVirtualTerminal = -1;
-Bool kdSwitchPending;
-char *kdSwitchCmd;
-DDXPointRec kdOrigin;
-
-/*
- * Carry arguments from InitOutput through driver initialization
- * to KdScreenInit
- */
-
-KdOsFuncs *kdOsFuncs;
-extern WindowPtr *WindowTable;
-
-void
-KdSetRootClip (ScreenPtr pScreen, BOOL enable)
-{
-#ifndef FB_OLD_SCREEN
- WindowPtr pWin = WindowTable[pScreen->myNum];
- WindowPtr pChild;
- Bool WasViewable;
- Bool anyMarked = FALSE;
- RegionPtr pOldClip = 0, bsExposed;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (!pWin)
- return;
- WasViewable = (Bool)(pWin->viewable);
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
- }
-
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- REGION_INIT (pScreen, &pWin->winSize, &box, 1);
- REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
- REGION_RESET(pScreen, &pWin->borderClip, &box);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
- else
- {
- REGION_EMPTY(pScreen, &pWin->borderClip);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->backStorage)
- {
- pOldClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, pOldClip, &pWin->clipList);
- }
-
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
- }
-#endif /* DO_SAVE_UNDERS */
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (pWin->backStorage &&
- ((pWin->backingStore == Always) || WasViewable))
- {
- if (!WasViewable)
- pOldClip = &pWin->clipList; /* a convenient empty region */
- bsExposed = (*pScreen->TranslateBackingStore)
- (pWin, 0, 0, pOldClip,
- pWin->drawable.x, pWin->drawable.y);
- if (WasViewable)
- REGION_DESTROY(pScreen, pOldClip);
- if (bsExposed)
- {
- RegionPtr valExposed = NullRegion;
-
- if (pWin->valdata)
- valExposed = &pWin->valdata->after.exposed;
- (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
- if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
- }
- }
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
-#endif /* DO_SAVE_UNDERS */
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-#endif /* !FB_OLD_SCREEN */
-}
-
-void
-KdDisableScreen (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
-
- if (!pScreenPriv->enabled)
- return;
- KdCheckSync (pScreen);
- if (!pScreenPriv->closed)
- KdSetRootClip (pScreen, FALSE);
- KdDisableColormap (pScreen);
- KdOffscreenSwapOut (pScreen);
- if (!pScreenPriv->screen->dumb)
- (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
- if (!pScreenPriv->screen->softCursor)
- (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
- if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
- pScreenPriv->enabled = FALSE;
- (*pScreenPriv->card->cfuncs->disable) (pScreen);
-}
-
-static void
-KdDoSwitchCmd (char *reason)
-{
- if (kdSwitchCmd)
- {
- char *command = xalloc (strlen (kdSwitchCmd) +
- 1 +
- strlen (reason) +
- 1);
- if (!command)
- return;
- strcpy (command, kdSwitchCmd);
- strcat (command, " ");
- strcat (command, reason);
- system (command);
- xfree (command);
- }
-}
-
-void
-KdSuspend (void)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdDisableScreen (screen->pScreen);
- if (card->driver)
- (*card->cfuncs->restore) (card);
- }
- KdDisableInput ();
- KdDoSwitchCmd ("suspend");
- }
-}
-
-void
-KdDisableScreens (void)
-{
- KdSuspend ();
- if (kdEnabled)
- {
- (*kdOsFuncs->Disable) ();
- kdEnabled = FALSE;
- }
-}
-
-Bool
-KdEnableScreen (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
-
- if (pScreenPriv->enabled)
- return TRUE;
- if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
- return FALSE;
- pScreenPriv->enabled = TRUE;
- pScreenPriv->card->selected = pScreenPriv->screen->mynum;
- if (!pScreenPriv->screen->softCursor)
- (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
- if (!pScreenPriv->screen->dumb)
- (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
- KdOffscreenSwapIn (pScreen);
- KdEnableColormap (pScreen);
- KdSetRootClip (pScreen, TRUE);
- if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
- return TRUE;
-}
-
-void
-KdResume (void)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- KdDoSwitchCmd ("resume");
- for (card = kdCardInfo; card; card = card->next)
- {
- (*card->cfuncs->preserve) (card);
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdEnableScreen (screen->pScreen);
- }
- KdEnableInput ();
- KdReleaseAllKeys ();
- }
-}
-
-void
-KdEnableScreens (void)
-{
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
- (*kdOsFuncs->Enable) ();
- }
- KdResume ();
-}
-
-void
-KdProcessSwitch (void)
-{
- if (kdEnabled)
- KdDisableScreens ();
- else
- KdEnableScreens ();
-}
-
-void
-AbortDDX(void)
-{
- KdDisableScreens ();
- if (kdOsFuncs)
- {
- if (kdEnabled)
- (*kdOsFuncs->Disable) ();
- (*kdOsFuncs->Fini) ();
- KdDoSwitchCmd ("stop");
- }
-}
-
-void
-ddxUseMsg()
-{
- ErrorF("\nTinyX Device Dependent Usage:\n");
- ErrorF("-card pcmcia Use PCMCIA card as additional screen\n");
- ErrorF("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP{,DEPTH/BPP}[xFREQ]] Specify screen characteristics\n");
- ErrorF("-zaphod Disable cursor screen switching\n");
- ErrorF("-2button Emulate 3 button mouse\n");
- ErrorF("-3button Disable 3 button mouse emulation\n");
- ErrorF("-rawcoord Don't transform pointer coordinates on rotation\n");
- ErrorF("-dumb Disable hardware acceleration\n");
- ErrorF("-softCursor Force software cursor\n");
- ErrorF("-videoTest Start the server, pause momentarily and exit\n");
- ErrorF("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
- ErrorF("-mouse path[,n] Filename of mouse device, n is number of buttons\n");
- ErrorF("-switchCmd Command to execute on vt switch\n");
- ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
- ErrorF("\n");
-}
-
-void
-ddxGiveUp ()
-{
- AbortDDX ();
-}
-
-Bool kdDumbDriver;
-Bool kdSoftCursor;
-
-static char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last)
-{
- while (*cur && !strchr (delim, *cur))
- {
- *save++ = *cur++;
- }
- *save = 0;
- *last = *cur;
- if (*cur)
- cur++;
- return cur;
-}
-
-Rotation
-KdAddRotation (Rotation a, Rotation b)
-{
- Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
-
- if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
- return reflect | rotate;
-}
-
-Rotation
-KdSubRotation (Rotation a, Rotation b)
-{
- Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
-
- if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
- return reflect | rotate;
-}
-
-void
-KdParseScreen (KdScreenInfo *screen,
- char *arg)
-{
- char delim;
- char save[1024];
- int fb;
- int i;
- int pixels, mm;
-
- screen->dumb = kdDumbDriver;
- screen->softCursor = kdSoftCursor;
- screen->origin = kdOrigin;
- screen->randr = RR_Rotate_0;
- screen->width = 0;
- screen->height = 0;
- screen->width_mm = 0;
- screen->height_mm = 0;
- screen->subpixel_order = kdSubpixelOrder;
- screen->rate = 0;
- for (fb = 0; fb < KD_MAX_FB; fb++)
- screen->fb[fb].depth = 0;
- if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
-
- for (i = 0; i < 2; i++)
- {
- arg = KdParseFindNext (arg, "x/@XY", save, &delim);
- if (!save[0])
- return;
-
- pixels = atoi(save);
- mm = 0;
-
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x@XY", save, &delim);
- if (!save[0])
- return;
- mm = atoi(save);
- }
-
- if (i == 0)
- {
- screen->width = pixels;
- screen->width_mm = mm;
- }
- else
- {
- screen->height = pixels;
- screen->height_mm = mm;
- }
- if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
- return;
- }
-
- kdOrigin.x += screen->width;
- kdOrigin.y = 0;
- kdDumbDriver = FALSE;
- kdSoftCursor = FALSE;
- kdSubpixelOrder = SubPixelUnknown;
-
- if (delim == '@')
- {
- arg = KdParseFindNext (arg, "xXY", save, &delim);
- if (save[0])
- {
- int rotate = atoi (save);
- if (rotate < 45)
- screen->randr = RR_Rotate_0;
- else if (rotate < 135)
- screen->randr = RR_Rotate_90;
- else if (rotate < 225)
- screen->randr = RR_Rotate_180;
- else if (rotate < 315)
- screen->randr = RR_Rotate_270;
- else
- screen->randr = RR_Rotate_0;
- }
- }
- if (delim == 'X')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_X;
- }
-
- if (delim == 'Y')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_Y;
- }
-
- fb = 0;
- while (fb < KD_MAX_FB)
- {
- arg = KdParseFindNext (arg, "x/,", save, &delim);
- if (!save[0])
- break;
- screen->fb[fb].depth = atoi(save);
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x,", save, &delim);
- if (!save[0])
- break;
- screen->fb[fb].bitsPerPixel = atoi (save);
- }
- else
- screen->fb[fb].bitsPerPixel = 0;
- if (delim != ',')
- break;
- fb++;
- }
-
- if (delim == 'x')
- {
- arg = KdParseFindNext (arg, "x", save, &delim);
- if (save[0])
- screen->rate = atoi(save);
- }
-}
-
-/*
- * Mouse argument syntax:
- *
- * device,protocol,options...
- *
- * Options are any of:
- * 1-5 n button mouse
- * 2button emulate middle button
- * {NMO} Reorder buttons
- */
-
-char *
-KdSaveString (char *str)
-{
- char *n = (char *) xalloc (strlen (str) + 1);
-
- if (!n)
- return 0;
- strcpy (n, str);
- return n;
-}
-
-/*
- * Parse mouse information. Syntax:
- *
- * <device>,<nbutton>,<protocol>{,<option>}...
- *
- * options: {nmo} pointer mapping (e.g. {321})
- * 2button emulate middle button
- * 3button dont emulate middle button
- */
-
-void
-KdParseMouse (char *arg)
-{
- char save[1024];
- char delim;
- KdMouseInfo *mi;
- int i;
-
- mi = KdMouseInfoAdd ();
- if (!mi)
- return;
- mi->name = 0;
- mi->prot = 0;
- mi->emulateMiddleButton = kdEmulateMiddleButton;
- mi->transformCoordinates = !kdRawPointerCoordinates;
- mi->nbutton = 3;
- for (i = 0; i < KD_MAX_BUTTON; i++)
- mi->map[i] = i + 1;
-
- if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
- mi->name = KdSaveString (save);
- if (delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
-
- if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
- {
- mi->nbutton = save[0] - '0';
- if (mi->nbutton > KD_MAX_BUTTON)
- {
- UseMsg ();
- return;
- }
- }
-
- if (!delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
-
- if (save[0])
- mi->prot = KdSaveString (save);
-
- while (delim == ',')
- {
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (save[0] == '{')
- {
- char *s = save + 1;
- i = 0;
- while (*s && *s != '}')
- {
- if ('1' <= *s && *s <= '0' + mi->nbutton)
- mi->map[i] = *s - '0';
- else
- UseMsg ();
- s++;
- }
- }
- else if (!strcmp (save, "2button"))
- mi->emulateMiddleButton = TRUE;
- else if (!strcmp (save, "3button"))
- mi->emulateMiddleButton = FALSE;
- else if (!strcmp (save, "rawcoord"))
- mi->transformCoordinates = FALSE;
- else if (!strcmp (save, "transform"))
- mi->transformCoordinates = TRUE;
- else
- UseMsg ();
- }
-}
-
-void
-KdParseRgba (char *rgba)
-{
- if (!strcmp (rgba, "rgb"))
- kdSubpixelOrder = SubPixelHorizontalRGB;
- else if (!strcmp (rgba, "bgr"))
- kdSubpixelOrder = SubPixelHorizontalBGR;
- else if (!strcmp (rgba, "vrgb"))
- kdSubpixelOrder = SubPixelVerticalRGB;
- else if (!strcmp (rgba, "vbgr"))
- kdSubpixelOrder = SubPixelVerticalBGR;
- else if (!strcmp (rgba, "none"))
- kdSubpixelOrder = SubPixelNone;
- else
- kdSubpixelOrder = SubPixelUnknown;
-}
-
-int
-KdProcessArgument (int argc, char **argv, int i)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!strcmp (argv[i], "-card"))
- {
- if ((i+1) < argc)
- InitCard (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-screen"))
- {
- if ((i+1) < argc)
- {
- card = KdCardInfoLast ();
- if (!card)
- {
- InitCard (0);
- card = KdCardInfoLast ();
- }
- if (card) {
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, argv[i+1]);
- } else
- ErrorF("No matching card found!\n");
- }
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-zaphod"))
- {
- kdDisableZaphod = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-3button"))
- {
- kdEmulateMiddleButton = FALSE;
- return 1;
- }
- if (!strcmp (argv[i], "-2button"))
- {
- kdEmulateMiddleButton = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-rawcoord"))
- {
- kdRawPointerCoordinates = 1;
- return 1;
- }
- if (!strcmp (argv[i], "-dumb"))
- {
- kdDumbDriver = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-softCursor"))
- {
- kdSoftCursor = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-videoTest"))
- {
- kdVideoTest = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-origin"))
- {
- if ((i+1) < argc)
- {
- char *x = argv[i+1];
- char *y = strchr (x, ',');
- if (x)
- kdOrigin.x = atoi (x);
- else
- kdOrigin.x = 0;
- if (y)
- kdOrigin.y = atoi(y+1);
- else
- kdOrigin.y = 0;
- }
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-mouse"))
- {
- if ((i+1) < argc)
- KdParseMouse (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-rgba"))
- {
- if ((i+1) < argc)
- KdParseRgba (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-switchCmd"))
- {
- if ((i+1) < argc)
- kdSwitchCmd = argv[i+1];
- else
- UseMsg ();
- return 2;
- }
- if (!strncmp (argv[i], "vt", 2) &&
- sscanf (argv[i], "vt%2d", &kdVirtualTerminal) == 1)
- {
- return 1;
- }
-#ifdef PSEUDO8
- return p8ProcessArgument (argc, argv, i);
-#else
- return 0;
-#endif
-}
-
-/*
- * These are getting tossed in here until I can think of where
- * they really belong
- */
-
-void
-KdOsInit (KdOsFuncs *pOsFuncs)
-{
- kdOsFuncs = pOsFuncs;
- if (pOsFuncs)
- {
- if (serverGeneration == 1)
- {
- KdDoSwitchCmd ("start");
- (*pOsFuncs->Init) ();
- }
- }
-}
-
-Bool
-KdAllocatePrivates (ScreenPtr pScreen)
-{
- KdPrivScreenPtr pScreenPriv;
-
- if (kdGeneration != serverGeneration)
- {
- kdScreenPrivateIndex = AllocateScreenPrivateIndex();
- kdGeneration = serverGeneration;
- }
- pScreenPriv = (KdPrivScreenPtr) xalloc(sizeof (*pScreenPriv));
- if (!pScreenPriv)
- return FALSE;
- memset (pScreenPriv, '\0', sizeof (KdPrivScreenRec));
- KdSetScreenPriv (pScreen, pScreenPriv);
- return TRUE;
-}
-
-Bool
-KdCreateScreenResources (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Bool ret;
-
- pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources;
- ret = (*pScreen->CreateScreenResources) (pScreen);
- pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = KdCreateScreenResources;
- if (ret && card->cfuncs->createRes)
- ret = (*card->cfuncs->createRes) (pScreen);
- return ret;
-}
-
-Bool
-KdCloseScreen (int index, ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- Bool ret;
-
- pScreenPriv->closed = TRUE;
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- ret = (*pScreen->CloseScreen) (index, pScreen);
-
- if (screen->off_screen_base < screen->memory_size)
- KdOffscreenFini (pScreen);
-
- if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
- (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
-
- if (screen->mynum == card->selected)
- KdDisableScreen (pScreen);
-
- /*
- * Restore video hardware when last screen is closed
- */
- if (screen == card->screenList)
- {
- if (kdEnabled)
- (*card->cfuncs->restore) (card);
- }
-
- if (!pScreenPriv->screen->dumb)
- (*card->cfuncs->finiAccel) (pScreen);
-
- if (!pScreenPriv->screen->softCursor)
- (*card->cfuncs->finiCursor) (pScreen);
-
- (*card->cfuncs->scrfini) (screen);
-
- /*
- * Clean up card when last screen is closed, DIX closes them in
- * reverse order, thus we check for when the first in the list is closed
- */
- if (screen == card->screenList)
- {
- (*card->cfuncs->cardfini) (card);
- /*
- * Clean up OS when last card is closed
- */
- if (card == kdCardInfo)
- {
- if (kdEnabled)
- {
- kdEnabled = FALSE;
- (*kdOsFuncs->Disable) ();
- }
- }
- }
-
- pScreenPriv->screen->pScreen = 0;
-
- xfree ((pointer) pScreenPriv);
- return ret;
-}
-
-Bool
-KdSaveScreen (ScreenPtr pScreen, int on)
-{
- KdScreenPriv(pScreen);
- int dpmsState;
-
- if (!pScreenPriv->card->cfuncs->dpms)
- return FALSE;
-
- dpmsState = pScreenPriv->dpmsState;
- switch (on) {
- case SCREEN_SAVER_OFF:
- dpmsState = KD_DPMS_NORMAL;
- break;
- case SCREEN_SAVER_ON:
- if (dpmsState == KD_DPMS_NORMAL)
- dpmsState = KD_DPMS_NORMAL+1;
- break;
- case SCREEN_SAVER_CYCLE:
- if (dpmsState < KD_DPMS_MAX)
- dpmsState++;
- break;
- case SCREEN_SAVER_FORCER:
- break;
- }
- if (dpmsState != pScreenPriv->dpmsState)
- {
- if (pScreenPriv->enabled)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
- pScreenPriv->dpmsState = dpmsState;
- }
- return TRUE;
-}
-
-static Bool
-KdCreateWindow (WindowPtr pWin)
-{
-#ifndef PHOENIX
- if (!pWin->parent)
- {
- KdScreenPriv(pWin->drawable.pScreen);
-
- if (!pScreenPriv->enabled)
- {
- REGION_EMPTY (pWin->drawable.pScreen, &pWin->borderClip);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
- }
-#endif
- return fbCreateWindow (pWin);
-}
-
-void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int subpixel_order = screen->subpixel_order;
- Rotation subpixel_dir;
- int i;
-
- static struct {
- int subpixel_order;
- Rotation direction;
- } orders[] = {
- { SubPixelHorizontalRGB, RR_Rotate_0 },
- { SubPixelHorizontalBGR, RR_Rotate_180 },
- { SubPixelVerticalRGB, RR_Rotate_270 },
- { SubPixelVerticalBGR, RR_Rotate_90 },
- };
-
- static struct {
- int bit;
- int normal;
- int reflect;
- } reflects[] = {
- { RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR },
- { RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB },
- };
-
- /* map subpixel to direction */
- for (i = 0; i < 4; i++)
- if (orders[i].subpixel_order == subpixel_order)
- break;
- if (i < 4)
- {
- subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
-
- /* map back to subpixel order */
- for (i = 0; i < 4; i++)
- if (orders[i].direction & subpixel_dir)
- {
- subpixel_order = orders[i].subpixel_order;
- break;
- }
- /* reflect */
- for (i = 0; i < 4; i++)
- if ((randr & reflects[i].bit) &&
- reflects[i].normal == subpixel_order)
- {
- subpixel_order = reflects[i].reflect;
- break;
- }
- }
- PictureSetSubpixelOrder (pScreen, subpixel_order);
-}
-
-/* Pass through AddScreen, which doesn't take any closure */
-static KdScreenInfo *kdCurrentScreen;
-
-Bool
-KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
-{
- KdScreenInfo *screen = kdCurrentScreen;
- KdCardInfo *card = screen->card;
- KdPrivScreenPtr pScreenPriv;
- int fb;
- /*
- * note that screen->fb is set up for the nominal orientation
- * of the screen; that means if randr is rotated, the values
- * there should reflect a rotated frame buffer (or shadow).
- */
- Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0;
- int width, height, *width_mmp, *height_mmp;
-
- KdAllocatePrivates (pScreen);
-
- pScreenPriv = KdGetScreenPriv(pScreen);
-
- if (!rotated)
- {
- width = screen->width;
- height = screen->height;
- width_mmp = &screen->width_mm;
- height_mmp = &screen->height_mm;
- }
- else
- {
- width = screen->height;
- height = screen->width;
- width_mmp = &screen->height_mm;
- height_mmp = &screen->width_mm;
- }
- screen->pScreen = pScreen;
- pScreenPriv->screen = screen;
- pScreenPriv->card = card;
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
- pScreenPriv->dpmsState = KD_DPMS_NORMAL;
-#ifdef PANORAMIX
- dixScreenOrigins[pScreen->myNum] = screen->origin;
-#endif
-
- if (!monitorResolution)
- monitorResolution = 75;
- /*
- * This is done in this order so that backing store wraps
- * our GC functions; fbFinishScreenInit initializes MI
- * backing store
- */
- if (!fbSetupScreen (pScreen,
- screen->fb[0].frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb[0].pixelStride,
- screen->fb[0].bitsPerPixel))
- {
- return FALSE;
- }
-
- /*
- * Set colormap functions
- */
- pScreen->InstallColormap = KdInstallColormap;
- pScreen->UninstallColormap = KdUninstallColormap;
- pScreen->ListInstalledColormaps = KdListInstalledColormaps;
- pScreen->StoreColors = KdStoreColors;
-
- pScreen->SaveScreen = KdSaveScreen;
- pScreen->CreateWindow = KdCreateWindow;
-
-#ifdef FB_OLD_SCREEN
- pScreenPriv->BackingStoreFuncs.SaveAreas = fbSaveAreas;
- pScreenPriv->BackingStoreFuncs.RestoreAreas = fbSaveAreas;
- pScreenPriv->BackingStoreFuncs.SetClipmaskRgn = 0;
- pScreenPriv->BackingStoreFuncs.GetImagePixmap = 0;
- pScreenPriv->BackingStoreFuncs.GetSpansPixmap = 0;
-#endif
-
-#if KD_MAX_FB > 1
- if (screen->fb[1].depth)
- {
- if (!fbOverlayFinishScreenInit (pScreen,
- screen->fb[0].frameBuffer,
- screen->fb[1].frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb[0].pixelStride,
- screen->fb[1].pixelStride,
- screen->fb[0].bitsPerPixel,
- screen->fb[1].bitsPerPixel,
- screen->fb[0].depth,
- screen->fb[1].depth))
- {
- return FALSE;
- }
- }
- else
-#endif
- {
- if (!fbFinishScreenInit (pScreen,
- screen->fb[0].frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb[0].pixelStride,
- screen->fb[0].bitsPerPixel))
- {
- return FALSE;
- }
- }
-
- /*
- * Fix screen sizes; for some reason mi takes dpi instead of mm.
- * Rounding errors are annoying
- */
- if (*width_mmp)
- pScreen->mmWidth = *width_mmp;
- else
- *width_mmp = pScreen->mmWidth;
- if (*height_mmp)
- pScreen->mmHeight = *height_mmp;
- else
- *height_mmp = pScreen->mmHeight;
-
- /*
- * Plug in our own block/wakeup handlers.
- * miScreenInit installs NoopDDA in both places
- */
- pScreen->BlockHandler = KdBlockHandler;
- pScreen->WakeupHandler = KdWakeupHandler;
-
-#ifdef RENDER
- if (!fbPictureInit (pScreen, 0, 0))
- return FALSE;
-#endif
- if (card->cfuncs->initScreen)
- if (!(*card->cfuncs->initScreen) (pScreen))
- return FALSE;
-
- if (!screen->dumb && card->cfuncs->initAccel)
- if (!(*card->cfuncs->initAccel) (pScreen))
- screen->dumb = TRUE;
-
- if (screen->off_screen_base < screen->memory_size)
- KdOffscreenInit (pScreen);
-
-#ifdef PSEUDO8
- (void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
-#endif
-
- if (card->cfuncs->finishInitScreen)
- if (!(*card->cfuncs->finishInitScreen) (pScreen))
- return FALSE;
-
-#if 0
- fbInitValidateTree (pScreen);
-#endif
-
-#if 0
- pScreen->backingStoreSupport = Always;
-#ifdef FB_OLD_SCREEN
- miInitializeBackingStore (pScreen, &pScreenPriv->BackingStoreFuncs);
-#else
- miInitializeBackingStore (pScreen);
-#endif
-#endif
-
-
- /*
- * Wrap CloseScreen, the order now is:
- * KdCloseScreen
- * miBSCloseScreen
- * fbCloseScreen
- */
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = KdCloseScreen;
-
- pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = KdCreateScreenResources;
-
- if (screen->softCursor ||
- !card->cfuncs->initCursor ||
- !(*card->cfuncs->initCursor) (pScreen))
- {
- /* Use MI for cursor display and event queueing. */
- screen->softCursor = TRUE;
- miDCInitialize(pScreen, &kdPointerScreenFuncs);
- }
-
-
- if (!fbCreateDefColormap (pScreen))
- {
- return FALSE;
- }
-
- KdSetSubpixelOrder (pScreen, screen->randr);
-
- /*
- * Enable the hardware
- */
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
- (*kdOsFuncs->Enable) ();
- }
-
- if (screen->mynum == card->selected)
- {
- (*card->cfuncs->preserve) (card);
- if (!(*card->cfuncs->enable) (pScreen))
- return FALSE;
- pScreenPriv->enabled = TRUE;
- if (!screen->softCursor)
- (*card->cfuncs->enableCursor) (pScreen);
- KdEnableColormap (pScreen);
- if (!screen->dumb)
- (*card->cfuncs->enableAccel) (pScreen);
- }
-
- return TRUE;
-}
-
-void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
-{
- KdCardInfo *card = screen->card;
-
- (*card->cfuncs->scrinit) (screen);
-
- if (!card->cfuncs->initAccel)
- screen->dumb = TRUE;
- if (!card->cfuncs->initCursor)
- screen->softCursor = TRUE;
-}
-
-static Bool
-KdSetPixmapFormats (ScreenInfo *pScreenInfo)
-{
- CARD8 depthToBpp[33]; /* depth -> bpp map */
- KdCardInfo *card;
- KdScreenInfo *screen;
- int i;
- int bpp;
- int fb;
- PixmapFormatRec *format;
-
- for (i = 1; i <= 32; i++)
- depthToBpp[i] = 0;
-
- /*
- * Generate mappings between bitsPerPixel and depth,
- * also ensure that all screens comply with protocol
- * restrictions on equivalent formats for the same
- * depth on different screens
- */
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- {
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- bpp = screen->fb[fb].bitsPerPixel;
- if (bpp == 24)
- bpp = 32;
- if (!depthToBpp[screen->fb[fb].depth])
- depthToBpp[screen->fb[fb].depth] = bpp;
- else if (depthToBpp[screen->fb[fb].depth] != bpp)
- return FALSE;
- }
- }
- }
-
- /*
- * Fill in additional formats
- */
- for (i = 0; i < NUM_KD_BPP; i++)
- if (!depthToBpp[kdBpp[i]])
- depthToBpp[kdBpp[i]] = kdBpp[i];
-
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-
- pScreenInfo->numPixmapFormats = 0;
-
- for (i = 1; i <= 32; i++)
- {
- if (depthToBpp[i])
- {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
- format->depth = i;
- format->bitsPerPixel = depthToBpp[i];
- format->scanlinePad = BITMAP_SCANLINE_PAD;
- }
- }
-
- return TRUE;
-}
-
-static void
-KdAddScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
-{
- int i;
- /*
- * Fill in fb visual type masks for this screen
- */
- for (i = 0; i < pScreenInfo->numPixmapFormats; i++)
- {
- unsigned long visuals;
- Pixel rm, gm, bm;
- int fb;
-
- visuals = 0;
- rm = gm = bm = 0;
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (pScreenInfo->formats[i].depth == screen->fb[fb].depth)
- {
- visuals = screen->fb[fb].visuals;
- rm = screen->fb[fb].redMask;
- gm = screen->fb[fb].greenMask;
- bm = screen->fb[fb].blueMask;
- break;
- }
- }
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals,
- 8,
- rm, gm, bm);
- }
-
- kdCurrentScreen = screen;
-
- AddScreen (KdScreenInit, argc, argv);
-}
-
-#if 0 /* This function is not used currently */
-
-int
-KdDepthToFb (ScreenPtr pScreen, int depth)
-{
- KdScreenPriv(pScreen);
- int fb;
-
- for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb[fb].frameBuffer; fb++)
- if (pScreenPriv->screen->fb[fb].depth == depth)
- return fb;
-}
-
-#endif
-
-void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!kdCardInfo)
- {
- InitCard (0);
- if (!(card = KdCardInfoLast ()))
- FatalError("No matching cards found!\n");
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, 0);
- }
- /*
- * Initialize all of the screens for all of the cards
- */
- for (card = kdCardInfo; card; card = card->next)
- {
- if ((*card->cfuncs->cardinit) (card))
- {
- for (screen = card->screenList; screen; screen = screen->next)
- KdInitScreen (pScreenInfo, screen, argc, argv);
- }
- }
-
- /*
- * Merge the various pixmap formats together, this can fail
- * when two screens share depth but not bitsPerPixel
- */
- if (!KdSetPixmapFormats (pScreenInfo))
- return;
-
- /*
- * Add all of the screens
- */
- for (card = kdCardInfo; card; card = card->next)
- for (screen = card->screenList; screen; screen = screen->next)
- KdAddScreen (pScreenInfo, screen, argc, argv);
-}
-
-#ifdef XTESTEXT1
-void
-XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
- int dev_type;
- int keycode;
- int keystate;
- int mousex;
- int mousey;
-{
-}
-
-void
-XTestGetPointerPos(fmousex, fmousey)
- short *fmousex, *fmousey;
-{
-}
-
-void
-XTestJumpPointer(jx, jy, dev_type)
- int jx;
- int jy;
- int dev_type;
-{
-}
-#endif
-
-#ifdef DPMSExtension
-void
-DPMSSet(int level)
-{
-}
-
-int
-DPMSGet (int *level)
-{
- return -1;
-}
-
-Bool
-DPMSSupported (void)
-{
- return FALSE;
-}
-#endif
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
deleted file mode 100644
index 8969e6f83..000000000
--- a/hw/kdrive/src/kdrive.h
+++ /dev/null
@@ -1,828 +0,0 @@
-/*
- * Id: kdrive.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.29 2002/11/13 16:37:39 keithp Exp $ */
-
-#include <stdio.h>
-#include <X11/X.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "mibstore.h"
-#include "colormapst.h"
-#include "gcstruct.h"
-#include "input.h"
-#include "mipointer.h"
-#include "mi.h"
-#include "dix.h"
-#include "fb.h"
-#include "fboverlay.h"
-#include "shadow.h"
-#include "randrstr.h"
-
-extern WindowPtr *WindowTable;
-
-#define KD_DPMS_NORMAL 0
-#define KD_DPMS_STANDBY 1
-#define KD_DPMS_SUSPEND 2
-#define KD_DPMS_POWERDOWN 3
-#define KD_DPMS_MAX KD_DPMS_POWERDOWN
-
-#ifndef KD_MAX_FB
-#define KD_MAX_FB FB_OVERLAY_MAX
-#endif
-
-#ifndef KD_MAX_CARD_ADDRESS
-#define KD_MAX_CARD_ADDRESS 8
-#endif
-
-/*
- * Configuration information per video card
- */
-
-typedef struct _KdCardAttr {
- CARD32 io;
- CARD32 address[KD_MAX_CARD_ADDRESS];
- int naddr;
- int bus;
-} KdCardAttr;
-
-typedef struct _KdCardInfo {
- struct _KdCardFuncs *cfuncs;
- void *closure;
- KdCardAttr attr;
- void *driver;
- struct _KdScreenInfo *screenList;
- int selected;
- struct _KdCardInfo *next;
- Bool needSync;
-} KdCardInfo;
-
-extern KdCardInfo *kdCardInfo;
-
-/*
- * Configuration information per X screen
- */
-typedef struct _KdFrameBuffer {
- CARD8 *frameBuffer;
- int depth;
- int bitsPerPixel;
- int pixelStride;
- int byteStride;
- Bool shadow;
- unsigned long visuals;
- Pixel redMask, greenMask, blueMask;
- void *closure;
-} KdFrameBuffer;
-
-#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
-#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
-
-typedef struct _KdScreenInfo {
- struct _KdScreenInfo *next;
- KdCardInfo *card;
- ScreenPtr pScreen;
- void *driver;
- Rotation randr; /* rotation and reflection */
- int width;
- int height;
- int rate;
- int width_mm;
- int height_mm;
- int subpixel_order;
- Bool dumb;
- Bool softCursor;
- int mynum;
- DDXPointRec origin;
- KdFrameBuffer fb[KD_MAX_FB];
- CARD8 *memory_base;
- unsigned long memory_size;
- unsigned long off_screen_base;
- struct _RealOffscreenArea *off_screen_areas;
-} KdScreenInfo;
-
-typedef struct _KdCardFuncs {
- Bool (*cardinit) (KdCardInfo *); /* detect and map device */
- Bool (*scrinit) (KdScreenInfo *);/* initialize screen information */
- Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */
- Bool (*finishInitScreen) (ScreenPtr pScreen);
- Bool (*createRes) (ScreenPtr); /* create screen resources */
- void (*preserve) (KdCardInfo *); /* save graphics card state */
- Bool (*enable) (ScreenPtr); /* set up for rendering */
- Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */
- void (*disable) (ScreenPtr); /* turn off rendering */
- void (*restore) (KdCardInfo *); /* restore graphics card state */
- void (*scrfini) (KdScreenInfo *);/* close down screen */
- void (*cardfini) (KdCardInfo *); /* close down */
-
- Bool (*initCursor) (ScreenPtr); /* detect and map cursor */
- void (*enableCursor) (ScreenPtr); /* enable cursor */
- void (*disableCursor) (ScreenPtr); /* disable cursor */
- void (*finiCursor) (ScreenPtr); /* close down */
- void (*recolorCursor) (ScreenPtr, int, xColorItem *);
-
- Bool (*initAccel) (ScreenPtr);
- void (*enableAccel) (ScreenPtr);
- void (*syncAccel) (ScreenPtr);
- void (*disableAccel) (ScreenPtr);
- void (*finiAccel) (ScreenPtr);
-
- void (*getColors) (ScreenPtr, int, int, xColorItem *);
- void (*putColors) (ScreenPtr, int, int, xColorItem *);
-
-} KdCardFuncs;
-
-#define KD_MAX_PSEUDO_DEPTH 8
-#define KD_MAX_PSEUDO_SIZE (1 << KD_MAX_PSEUDO_DEPTH)
-
-typedef struct {
- KdScreenInfo *screen;
- KdCardInfo *card;
-
- Bool enabled;
- Bool closed;
- int bytesPerPixel[KD_MAX_FB];
-
- int dpmsState;
-
- ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
- xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
-
- CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
-#ifdef FB_OLD_SCREEN
- miBSFuncRec BackingStoreFuncs;
-#endif
-} KdPrivScreenRec, *KdPrivScreenPtr;
-
-typedef enum _kdMouseState {
- start,
- button_1_pend,
- button_1_down,
- button_2_down,
- button_3_pend,
- button_3_down,
- synth_2_down_13,
- synth_2_down_3,
- synth_2_down_1,
- num_input_states
-} KdMouseState;
-
-#define KD_MAX_BUTTON 7
-
-typedef struct _KdMouseInfo {
- struct _KdMouseInfo *next;
- void *driver;
- void *closure;
- char *name;
- char *prot;
- char map[KD_MAX_BUTTON];
- int nbutton;
- Bool emulateMiddleButton;
- unsigned long emulationTimeout;
- Bool timeoutPending;
- KdMouseState mouseState;
- Bool eventHeld;
- xEvent heldEvent;
- unsigned char buttonState;
- int emulationDx, emulationDy;
- int inputType;
- Bool transformCoordinates;
-} KdMouseInfo;
-
-extern KdMouseInfo *kdMouseInfo;
-
-extern int KdCurScreen;
-
-KdMouseInfo *KdMouseInfoAdd (void);
-void KdMouseInfoDispose (KdMouseInfo *mi);
-void KdParseMouse (char *);
-
-typedef struct _KdMouseFuncs {
- Bool (*Init) (void);
- void (*Fini) (void);
-} KdMouseFuncs;
-
-typedef struct _KdKeyboardFuncs {
- void (*Load) (void);
- int (*Init) (void);
- void (*Leds) (int);
- void (*Bell) (int, int, int);
- void (*Fini) (void);
- int LockLed;
-} KdKeyboardFuncs;
-
-typedef struct _KdOsFuncs {
- int (*Init) (void);
- void (*Enable) (void);
- Bool (*SpecialKey) (KeySym);
- void (*Disable) (void);
- void (*Fini) (void);
-} KdOsFuncs;
-
-typedef enum _KdSyncPolarity {
- KdSyncNegative, KdSyncPositive
-} KdSyncPolarity;
-
-typedef struct _KdMonitorTiming {
- /* label */
- int horizontal;
- int vertical;
- int rate;
- /* pixel clock */
- int clock; /* in KHz */
- /* horizontal timing */
- int hfp; /* front porch */
- int hbp; /* back porch */
- int hblank; /* blanking */
- KdSyncPolarity hpol; /* polarity */
- /* vertical timing */
- int vfp; /* front porch */
- int vbp; /* back porch */
- int vblank; /* blanking */
- KdSyncPolarity vpol; /* polarity */
-} KdMonitorTiming;
-
-typedef struct _KdOffscreenArea {
- ScreenPtr screen;
- int offset;
- int size;
- pointer privData;
-} KdOffscreenArea;
-
-extern const KdMonitorTiming kdMonitorTimings[];
-extern const int kdNumMonitorTimings;
-
-typedef struct _KdMouseMatrix {
- int matrix[2][3];
-} KdMouseMatrix;
-
-typedef struct _KaaScreenInfo {
- Bool (*PrepareSolid) (PixmapPtr pPixmap,
- int alu,
- Pixel planemask,
- Pixel fg);
- void (*Solid) (int x1, int y1, int x2, int y2);
- void (*DoneSolid) (void);
-
- Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- Bool upsidedown,
- Bool reverse,
- int alu,
- Pixel planemask);
- void (*Copy) (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height);
- void (*DoneCopy) (void);
-
- int offscreenByteAlign;
- int offscreenPitch;
- int flags;
-} KaaScreenInfoRec, *KaaScreenInfoPtr;
-
-#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
-
-/*
- * This is the only completely portable way to
- * compute this info.
- */
-
-#ifndef BitsPerPixel
-#define BitsPerPixel(d) (\
- PixmapWidthPaddingInfo[d].notPower2 ? \
- (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
- ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
- (PixmapWidthPaddingInfo[d].padRoundUp+1)))
-#endif
-
-extern int kdScreenPrivateIndex;
-extern unsigned long kdGeneration;
-extern Bool kdEnabled;
-extern Bool kdSwitchPending;
-extern Bool kdEmulateMiddleButton;
-extern Bool kdDisableZaphod;
-extern int kdVirtualTerminal;
-extern char *kdSwitchCmd;
-extern KdOsFuncs *kdOsFuncs;
-
-#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
- (pScreen)->devPrivates[kdScreenPrivateIndex].ptr)
-#define KdSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[kdScreenPrivateIndex].ptr = \
- (pointer) v)
-#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
-
-#define KdCheckSync(s) { \
- KdScreenPriv(s); \
- KdCardInfo *card = pScreenPriv->card; \
- if (card->needSync) { \
- card->needSync = FALSE; \
- (*card->cfuncs->syncAccel) (s); \
- } \
-}
-
-#define KdMarkSync(s) (KdGetScreenPriv(s)->card->needSync = TRUE)
-
-/* kaa.c */
-Bool
-kaaDrawInit (ScreenPtr pScreen,
- KaaScreenInfoPtr pScreenInfo);
-
-void
-kaaDrawFini (ScreenPtr pScreen);
-
-void
-kaaWrapGC (GCPtr pGC);
-
-void
-kaaUnwrapGC (GCPtr pGC);
-
-/* kasync.c */
-void
-KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
- DDXPointPtr ppt, int *pwidth, int fSorted);
-
-void
-KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
-
-void
-KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *bits);
-
-RegionPtr
-KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty);
-
-RegionPtr
-KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitPlane);
-
-void
-KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit);
-
-void
-KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt);
-
-void
-KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit);
-
-void
-KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
- int nrects, xRectangle *prect);
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs);
-
-#define KdCheckFillPolygon miFillPolygon
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect);
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs);
-
-void
-KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
-
-void
-KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
-
-void
-KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y);
-
-void
-KdCheckGetImage (DrawablePtr pDrawable,
- int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *d);
-
-void
-KdCheckGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart);
-
-void
-KdCheckSaveAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin);
-
-void
-KdCheckRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin);
-
-void
-KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-KdCheckPaintKey(DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer);
-
-void
-KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-KdScreenInitAsync (ScreenPtr pScreen);
-
-void
-KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
-
-extern const GCOps kdAsyncPixmapGCOps;
-
-/* knoop.c */
-extern GCOps kdNoopOps;
-
-/* kcmap.c */
-void
-KdSetColormap (ScreenPtr pScreen, int fb);
-
-void
-KdEnableColormap (ScreenPtr pScreen);
-
-void
-KdDisableColormap (ScreenPtr pScreen);
-
-void
-KdInstallColormap (ColormapPtr pCmap);
-
-void
-KdUninstallColormap (ColormapPtr pCmap);
-
-int
-KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps);
-
-void
-KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
-
-/* kcurscol.c */
-void
-KdAllocateCursorPixels (ScreenPtr pScreen,
- int fb,
- CursorPtr pCursor,
- Pixel *source,
- Pixel *mask);
-
-/* kdrive.c */
-extern miPointerScreenFuncRec kdPointerScreenFuncs;
-
-void
-KdSetRootClip (ScreenPtr pScreen, BOOL enable);
-
-void
-KdDisableScreen (ScreenPtr pScreen);
-
-void
-KdDisableScreens (void);
-
-Bool
-KdEnableScreen (ScreenPtr pScreen);
-
-void
-KdEnableScreens (void);
-
-void
-KdSuspend (void);
-
-void
-KdResume (void);
-
-void
-KdProcessSwitch (void);
-
-Rotation
-KdAddRotation (Rotation a, Rotation b);
-
-Rotation
-KdSubRotation (Rotation a, Rotation b);
-
-void
-KdParseScreen (KdScreenInfo *screen,
- char *arg);
-
-char *
-KdSaveString (char *str);
-
-void
-KdParseMouse (char *arg);
-
-void
-KdParseRgba (char *rgba);
-
-int
-KdProcessArgument (int argc, char **argv, int i);
-
-void
-KdOsInit (KdOsFuncs *pOsFuncs);
-
-Bool
-KdAllocatePrivates (ScreenPtr pScreen);
-
-Bool
-KdCreateScreenResources (ScreenPtr pScreen);
-
-Bool
-KdCloseScreen (int index, ScreenPtr pScreen);
-
-Bool
-KdSaveScreen (ScreenPtr pScreen, int on);
-
-Bool
-KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
-
-void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv);
-
-void
-KdInitCard (ScreenInfo *pScreenInfo,
- KdCardInfo *card,
- int argc,
- char **argv);
-
-void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv);
-
-
-
-void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc, char **argv);
-
-void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
-
-/* kinfo.c */
-KdCardInfo *
-KdCardInfoAdd (KdCardFuncs *funcs,
- KdCardAttr *attr,
- void *closure);
-
-KdCardInfo *
-KdCardInfoLast (void);
-
-void
-KdCardInfoDispose (KdCardInfo *ci);
-
-KdScreenInfo *
-KdScreenInfoAdd (KdCardInfo *ci);
-
-void
-KdScreenInfoDispose (KdScreenInfo *si);
-
-
-/* kinput.c */
-void
-KdInitInput(KdMouseFuncs *, KdKeyboardFuncs *);
-
-int
-KdAllocInputType (void);
-
-Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure);
-
-void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure));
-
-void
-KdUnregisterFds (int type, Bool do_close);
-
-#ifdef TOUCHSCREEN
-void
-KdInitTouchScreen(KdMouseFuncs *pTsFuncs);
-#endif
-
-void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up);
-
-#define KD_BUTTON_1 0x01
-#define KD_BUTTON_2 0x02
-#define KD_BUTTON_3 0x04
-#define KD_BUTTON_4 0x08
-#define KD_BUTTON_5 0x10
-#define KD_MOUSE_DELTA 0x80000000
-
-void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int x, int y);
-
-void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y);
-
-void
-KdReleaseAllKeys (void);
-
-void
-KdSetLed (int led, Bool on);
-
-void
-KdSetMouseMatrix (KdMouseMatrix *matrix);
-
-void
-KdComputeMouseMatrix (KdMouseMatrix *matrix, Rotation randr, int width, int height);
-
-void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask);
-
-void
-KdWakeupHandler (int screen,
- pointer data,
- unsigned long result,
- pointer readmask);
-
-void
-KdDisableInput (void);
-
-void
-KdEnableInput (void);
-
-void
-ProcessInputEvents (void);
-
-extern KdMouseFuncs LinuxMouseFuncs;
-extern KdMouseFuncs Ps2MouseFuncs;
-extern KdMouseFuncs BusMouseFuncs;
-extern KdMouseFuncs MsMouseFuncs;
-#ifdef TOUCHSCREEN
-extern KdMouseFuncs TsFuncs;
-#endif
-extern KdKeyboardFuncs LinuxKeyboardFuncs;
-extern KdOsFuncs LinuxFuncs;
-
-extern KdMouseFuncs VxWorksMouseFuncs;
-extern KdKeyboardFuncs VxWorksKeyboardFuncs;
-extern KdOsFuncs VxWorksFuncs;
-
-/* kmap.c */
-
-#define KD_MAPPED_MODE_REGISTERS 0
-#define KD_MAPPED_MODE_FRAMEBUFFER 1
-
-void *
-KdMapDevice (CARD32 addr, CARD32 size);
-
-void
-KdUnmapDevice (void *addr, CARD32 size);
-
-void
-KdSetMappedMode (CARD32 addr, CARD32 size, int mode);
-
-void
-KdResetMappedMode (CARD32 addr, CARD32 size, int mode);
-
-/* kmode.c */
-const KdMonitorTiming *
-KdFindMode (KdScreenInfo *screen,
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *));
-
-Bool
-KdTuneMode (KdScreenInfo *screen,
- Bool (*usable) (KdScreenInfo *),
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *));
-
-#ifdef RANDR
-Bool
-KdRandRGetInfo (ScreenPtr pScreen,
- int randr,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *));
-
-const KdMonitorTiming *
-KdRandRGetTiming (ScreenPtr pScreen,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *),
- int rate,
- RRScreenSizePtr pSize);
-#endif
-
-/* kpict.c */
-void
-KdPictureInitAsync (ScreenPtr pScreen);
-
-#ifdef RENDER
-void
-KdCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-#endif
-
-/* kshadow.c */
-Bool
-KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
-
-void
-KdShadowFbFree (KdScreenInfo *screen, int fb);
-
-Bool
-KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
-
-void
-KdShadowUnset (ScreenPtr pScreen);
-
-/* ktest.c */
-Bool
-KdFrameBufferValid (CARD8 *base, int size);
-
-int
-KdFrameBufferSize (CARD8 *base, int max);
-
-/* koffscreen.c */
-typedef void (*KdOffscreenSaveProc) (KdOffscreenArea *area);
-
-Bool
-KdOffscreenInit (ScreenPtr pScreen);
-
-KdOffscreenArea *
-KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
- Bool locked,
- KdOffscreenSaveProc save,
- pointer privData);
-
-void
-KdOffscreenFree (KdOffscreenArea *area);
-
-void
-KdOffscreenSwapOut (ScreenPtr pScreen);
-
-void
-KdOffscreenSwapIn (ScreenPtr pScreen);
-
-void
-KdOffscreenFini (ScreenPtr pScreen);
-
-/* function prototypes to be implemented by the drivers */
-void
-InitCard (char *name);
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
deleted file mode 100644
index 883f7e56c..000000000
--- a/hw/kdrive/src/kinfo.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Id: kinfo.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kinfo.c,v 1.2 2000/02/23 20:29:53 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-KdCardInfo *kdCardInfo;
-
-KdCardInfo *
-KdCardInfoAdd (KdCardFuncs *funcs,
- KdCardAttr *attr,
- void *closure)
-{
- KdCardInfo *ci, **prev;
-
- ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
- if (!ci)
- return 0;
- bzero (ci, sizeof (KdCardInfo));
- for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
- *prev = ci;
- ci->cfuncs = funcs;
- ci->attr = *attr;
- ci->closure = closure;
- ci->screenList = 0;
- ci->selected = 0;
- ci->next = 0;
- return ci;
-}
-
-KdCardInfo *
-KdCardInfoLast (void)
-{
- KdCardInfo *ci;
-
- if (!kdCardInfo)
- return 0;
- for (ci = kdCardInfo; ci->next; ci = ci->next);
- return ci;
-}
-
-void
-KdCardInfoDispose (KdCardInfo *ci)
-{
- KdCardInfo **prev;
-
- for (prev = &kdCardInfo; *prev; prev = &(*prev)->next)
- if (*prev == ci)
- {
- *prev = ci->next;
- xfree (ci);
- break;
- }
-}
-
-KdScreenInfo *
-KdScreenInfoAdd (KdCardInfo *ci)
-{
- KdScreenInfo *si, **prev;
- int n;
-
- si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
- if (!si)
- return 0;
- bzero (si, sizeof (KdScreenInfo));
- for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
- *prev = si;
- si->next = 0;
- si->card = ci;
- si->mynum = n;
- return si;
-}
-
-void
-KdScreenInfoDispose (KdScreenInfo *si)
-{
- KdCardInfo *ci = si->card;
- KdScreenInfo **prev;
-
- for (prev = &ci->screenList; *prev; prev = &(*prev)->next)
- if (*prev == si)
- {
- *prev = si->next;
- xfree (si);
- if (!ci->screenList)
- KdCardInfoDispose (ci);
- break;
- }
-}
-
-KdMouseInfo *kdMouseInfo;
-
-KdMouseInfo *
-KdMouseInfoAdd (void)
-{
- KdMouseInfo *mi, **prev;
-
- mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
- if (!mi)
- return 0;
- bzero (mi, sizeof (KdMouseInfo));
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
- *prev = mi;
- return mi;
-}
-
-void
-KdMouseInfoDispose (KdMouseInfo *mi)
-{
- KdMouseInfo **prev;
-
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
- if (*prev == mi)
- {
- *prev = mi->next;
- if (mi->name)
- xfree (mi->name);
- if (mi->prot)
- xfree (mi->prot);
- xfree (mi);
- break;
- }
-}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
deleted file mode 100644
index eb65cb98a..000000000
--- a/hw/kdrive/src/kinput.c
+++ /dev/null
@@ -1,1649 +0,0 @@
-/*
- * Id: kinput.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.30 2002/11/13 16:37:39 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "inputstr.h"
-
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#if HAVE_X11_XF86KEYSYM_H
-#include <X11/XF86keysym.h>
-#endif
-#include "kkeymap.h"
-#include <signal.h>
-#include <stdio.h>
-
-static DeviceIntPtr pKdKeyboard, pKdPointer;
-
-static KdMouseFuncs *kdMouseFuncs;
-static KdKeyboardFuncs *kdKeyboardFuncs;
-static int kdBellPitch;
-static int kdBellDuration;
-static int kdLeds;
-static Bool kdInputEnabled;
-static Bool kdOffScreen;
-static unsigned long kdOffScreenTime;
-static KdMouseMatrix kdMouseMatrix = {
- { { 1, 0, 0 },
- { 0, 1, 0 } }
-};
-
-#ifdef TOUCHSCREEN
-static KdMouseFuncs *kdTsFuncs;
-#endif
-
-int kdMouseButtonCount;
-int kdMinScanCode;
-int kdMaxScanCode;
-int kdMinKeyCode;
-int kdMaxKeyCode;
-int kdKeymapWidth = KD_MAX_WIDTH;
-KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-CARD8 kdModMap[MAP_LENGTH];
-KeySymsRec kdKeySyms;
-
-
-void
-KdResetInputMachine (void);
-
-#define KD_KEY_COUNT 248
-
-CARD8 kdKeyState[KD_KEY_COUNT/8];
-
-#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1)
-
-#define KD_MAX_INPUT_FDS 8
-
-typedef struct _kdInputFd {
- int type;
- int fd;
- void (*read) (int fd, void *closure);
- int (*enable) (int fd, void *closure);
- void (*disable) (int fd, void *closure);
- void *closure;
-} KdInputFd;
-
-KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
-int kdNumInputFds;
-int kdInputTypeSequence;
-
-static void
-KdSigio (int sig)
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
-}
-
-static void
-KdBlockSigio (void)
-{
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, 0);
-}
-
-static void
-KdUnblockSigio (void)
-{
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, 0);
-}
-
-#undef VERIFY_SIGIO
-#ifdef VERIFY_SIGIO
-
-void
-KdAssertSigioBlocked (char *where)
-{
- sigset_t set, old;
-
- sigemptyset (&set);
- sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO))
- ErrorF ("SIGIO not blocked at %s\n", where);
-}
-
-#else
-
-#define KdAssertSigioBlocked(s)
-
-#endif
-
-static int kdnFds;
-
-#ifdef FNONBLOCK
-#define NOBLOCK FNONBLOCK
-#else
-#define NOBLOCK FNDELAY
-#endif
-
-static void
-KdNonBlockFd (int fd)
-{
- int flags;
- flags = fcntl (fd, F_GETFL);
- flags |= FASYNC|NOBLOCK;
- fcntl (fd, F_SETFL, flags);
-}
-
-static void
-KdAddFd (int fd)
-{
- struct sigaction act;
- sigset_t set;
-
- kdnFds++;
- fcntl (fd, F_SETOWN, getpid());
- KdNonBlockFd (fd);
- AddEnabledDevice (fd);
- memset (&act, '\0', sizeof act);
- act.sa_handler = KdSigio;
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGIO);
- sigaddset (&act.sa_mask, SIGALRM);
- sigaddset (&act.sa_mask, SIGVTALRM);
- sigaction (SIGIO, &act, 0);
- sigemptyset (&set);
- sigprocmask (SIG_SETMASK, &set, 0);
-}
-
-static void
-KdRemoveFd (int fd)
-{
- struct sigaction act;
- int flags;
-
- kdnFds--;
- RemoveEnabledDevice (fd);
- flags = fcntl (fd, F_GETFL);
- flags &= ~(FASYNC|NOBLOCK);
- fcntl (fd, F_SETFL, flags);
- if (kdnFds == 0)
- {
- memset (&act, '\0', sizeof act);
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- sigaction (SIGIO, &act, 0);
- }
-}
-
-int
-KdAllocInputType (void)
-{
- return ++kdInputTypeSequence;
-}
-
-Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure)
-{
- if (kdNumInputFds == KD_MAX_INPUT_FDS)
- return FALSE;
- kdInputFds[kdNumInputFds].type = type;
- kdInputFds[kdNumInputFds].fd = fd;
- kdInputFds[kdNumInputFds].read = read;
- kdInputFds[kdNumInputFds].enable = 0;
- kdInputFds[kdNumInputFds].disable = 0;
- kdInputFds[kdNumInputFds].closure = closure;
- ++kdNumInputFds;
- if (kdInputEnabled)
- KdAddFd (fd);
- return TRUE;
-}
-
-void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure))
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- if (kdInputFds[i].fd == fd)
- {
- kdInputFds[i].enable = enable;
- kdInputFds[i].disable = disable;
- break;
- }
-}
-
-void
-KdUnregisterFds (int type, Bool do_close)
-{
- int i, j;
-
- for (i = 0; i < kdNumInputFds;)
- {
- if (kdInputFds[i].type == type)
- {
- if (kdInputEnabled)
- KdRemoveFd (kdInputFds[i].fd);
- if (do_close)
- close (kdInputFds[i].fd);
- --kdNumInputFds;
- for (j = i; j < kdNumInputFds; j++)
- kdInputFds[j] = kdInputFds[j+1];
- }
- else
- i++;
- }
-}
-
-void
-KdDisableInput (void)
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdRemoveFd (kdInputFds[i].fd);
- if (kdInputFds[i].disable)
- (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure);
- }
- kdInputEnabled = FALSE;
-}
-
-void
-KdEnableInput (void)
-{
- xEvent xE;
- int i;
-
- kdInputEnabled = TRUE;
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdNonBlockFd (kdInputFds[i].fd);
- if (kdInputFds[i].enable)
- kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdAddFd (kdInputFds[i].fd);
- }
-
- /* reset screen saver */
- xE.u.keyButtonPointer.time = GetTimeInMillis ();
- NoticeEventTime (&xE);
-}
-
-static int
-KdMouseProc(DeviceIntPtr pDevice, int onoff)
-{
- BYTE map[KD_MAX_BUTTON];
- DevicePtr pDev = (DevicePtr)pDevice;
- int i;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- for (i = 1; i <= kdMouseButtonCount; i++)
- map[i] = i;
- InitPointerDeviceStruct(pDev, map, kdMouseButtonCount,
- miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA,
- miPointerGetMotionBufferSize());
- break;
-
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdPointer = pDevice;
-#ifdef TOUCHSCREEN
- if (kdTsFuncs)
- (*kdTsFuncs->Init) ();
-#endif
- if (kdMouseFuncs)
- (*kdMouseFuncs->Init) ();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- if (pDev->on)
- {
- pDev->on = FALSE;
- pKdPointer = 0;
- if (kdMouseFuncs)
- (*kdMouseFuncs->Fini) ();
-#ifdef TOUCHSCREEN
- if (kdTsFuncs)
- (*kdTsFuncs->Fini) ();
-#endif
- }
- break;
- }
- return Success;
-}
-
-Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
-{
- return TRUE;
-}
-
-static void
-KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
-{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
-}
-
-
-static void
-KdSetLeds (void)
-{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Leds) (kdLeds);
-}
-
-void
-KdSetLed (int led, Bool on)
-{
- NoteLedState (pKdKeyboard, led, on);
- kdLeds = pKdKeyboard->kbdfeed->ctrl.leds;
- KdSetLeds ();
-}
-
-void
-KdSetMouseMatrix (KdMouseMatrix *matrix)
-{
- kdMouseMatrix = *matrix;
-}
-
-void
-KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
-{
- int x_dir = 1, y_dir = 1;
- int i, j;
- int size[2];
-
- size[0] = width; size[1] = height;
- if (randr & RR_Reflect_X)
- x_dir = -1;
- if (randr & RR_Reflect_Y)
- y_dir = -1;
- switch (randr & (RR_Rotate_All)) {
- case RR_Rotate_0:
- m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
- break;
- case RR_Rotate_90:
- m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
- m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
- break;
- case RR_Rotate_180:
- m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
- break;
- case RR_Rotate_270:
- m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
- m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
- break;
- }
- for (i = 0; i < 2; i++)
- {
- m->matrix[i][2] = 0;
- for (j = 0 ; j < 2; j++)
- if (m->matrix[i][j] < 0)
- m->matrix[i][2] = size[j] - 1;
- }
-}
-
-static void
-KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
-{
- kdLeds = ctrl->leds;
- kdBellPitch = ctrl->bell_pitch;
- kdBellDuration = ctrl->bell_duration;
- KdSetLeds ();
-}
-
-static int
-KdKeybdProc(DeviceIntPtr pDevice, int onoff)
-{
- Bool ret;
- DevicePtr pDev = (DevicePtr)pDevice;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice())
- {
- return !Success;
- }
- ret = InitKeyboardDeviceStruct(pDev,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
- if (!ret)
- return BadImplementation;
- break;
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdKeyboard = pDevice;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Init) ();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pKdKeyboard = 0;
- if (pDev->on)
- {
- pDev->on = FALSE;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Fini) ();
- }
- break;
- }
- return Success;
-}
-
-extern KeybdCtrl defaultKeyboardControl;
-
-static void
-KdInitAutoRepeats (void)
-{
- int key_code;
- unsigned char mask;
- int i;
- unsigned char *repeats;
-
- repeats = defaultKeyboardControl.autoRepeats;
- memset (repeats, '\0', 32);
- for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
- {
- if (!kdModMap[key_code])
- {
- i = key_code >> 3;
- mask = 1 << (key_code & 7);
- repeats[i] |= mask;
- }
- }
-}
-
-const KdKeySymModsRec kdKeySymMods[] = {
- { XK_Control_L, ControlMask },
- { XK_Control_R, ControlMask },
- { XK_Shift_L, ShiftMask },
- { XK_Shift_R, ShiftMask },
- { XK_Caps_Lock, LockMask },
- { XK_Shift_Lock, LockMask },
- { XK_Alt_L, Mod1Mask },
- { XK_Alt_R, Mod1Mask },
- { XK_Meta_L, Mod1Mask },
- { XK_Meta_R, Mod1Mask },
- { XK_Num_Lock, Mod2Mask },
- { XK_Super_L, Mod3Mask },
- { XK_Super_R, Mod3Mask },
- { XK_Hyper_L, Mod3Mask },
- { XK_Hyper_R, Mod3Mask },
- { XK_Mode_switch, Mod4Mask },
-#ifdef TOUCHSCREEN
- /* PDA specific hacks */
-#ifdef XF86XK_Start
- { XF86XK_Start, ControlMask },
-#endif
- { XK_Menu, ShiftMask },
- { XK_telephone, Mod1Mask },
-#ifdef XF86XK_AudioRecord
- { XF86XK_AudioRecord, Mod2Mask },
-#endif
-#ifdef XF86XK_Calendar
- { XF86XK_Calendar, Mod3Mask }
-#endif
-#endif
-};
-
-#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
-
-static void
-KdInitModMap (void)
-{
- int key_code;
- int row;
- int width;
- KeySym *syms;
- int i;
-
- width = kdKeySyms.mapWidth;
- for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++)
- {
- kdModMap[key_code] = 0;
- syms = kdKeymap + (key_code - kdMinKeyCode) * width;
- for (row = 0; row < width; row++, syms++)
- {
- for (i = 0; i < NUM_SYM_MODS; i++)
- {
- if (*syms == kdKeySymMods[i].modsym)
- kdModMap[key_code] |= kdKeySymMods[i].modbit;
- }
- }
- }
-}
-
-void
-KdInitInput(KdMouseFuncs *pMouseFuncs,
- KdKeyboardFuncs *pKeyboardFuncs)
-{
- DeviceIntPtr pKeyboard, pPointer;
- KdMouseInfo *mi;
-
- if (!kdMouseInfo)
- KdParseMouse (0);
- kdMouseButtonCount = 0;
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->nbutton > kdMouseButtonCount)
- kdMouseButtonCount = mi->nbutton;
- }
-
- kdMouseFuncs = pMouseFuncs;
- kdKeyboardFuncs = pKeyboardFuncs;
- memset (kdKeyState, '\0', sizeof (kdKeyState));
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Load) ();
- kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET;
- kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET;
- kdKeySyms.map = kdKeymap;
- kdKeySyms.minKeyCode = kdMinKeyCode;
- kdKeySyms.maxKeyCode = kdMaxKeyCode;
- kdKeySyms.mapWidth = kdKeymapWidth;
- kdLeds = 0;
- kdBellPitch = 1000;
- kdBellDuration = 200;
- kdInputEnabled = TRUE;
- KdInitModMap ();
- KdInitAutoRepeats ();
- KdResetInputMachine ();
- pPointer = AddInputDevice(KdMouseProc, TRUE);
- pKeyboard = AddInputDevice(KdKeybdProc, TRUE);
- RegisterPointerDevice(pPointer);
- RegisterKeyboardDevice(pKeyboard);
- miRegisterPointerDevice(screenInfo.screens[0], pPointer);
- mieqInit(&pKeyboard->public, &pPointer->public);
-#ifdef XINPUT
- {
- static long zero1, zero2;
-
- SetExtInputCheck (&zero1, &zero2);
- }
-#endif
-}
-
-#ifdef TOUCHSCREEN
-void
-KdInitTouchScreen(KdMouseFuncs *pTsFuncs)
-{
- kdTsFuncs = pTsFuncs;
-}
-#endif
-
-/*
- * Middle button emulation state machine
- *
- * Possible transitions:
- * Button 1 press v1
- * Button 1 release ^1
- * Button 2 press v2
- * Button 2 release ^2
- * Button 3 press v3
- * Button 3 release ^3
- * Button other press vo
- * Button other release ^o
- * Mouse motion <>
- * Keyboard event k
- * timeout ...
- * outside box <->
- *
- * States:
- * start
- * button_1_pend
- * button_1_down
- * button_2_down
- * button_3_pend
- * button_3_down
- * synthetic_2_down_13
- * synthetic_2_down_3
- * synthetic_2_down_1
- *
- * Transition diagram
- *
- * start
- * v1 -> (hold) (settimeout) button_1_pend
- * ^1 -> (deliver) start
- * v2 -> (deliver) button_2_down
- * ^2 -> (deliever) start
- * v3 -> (hold) (settimeout) button_3_pend
- * ^3 -> (deliver) start
- * vo -> (deliver) start
- * ^o -> (deliver) start
- * <> -> (deliver) start
- * k -> (deliver) start
- *
- * button_1_pend (button 1 is down, timeout pending)
- * ^1 -> (release) (deliver) start
- * v2 -> (release) (deliver) button_1_down
- * ^2 -> (release) (deliver) button_1_down
- * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13
- * ^3 -> (release) (deliver) button_1_down
- * vo -> (release) (deliver) button_1_down
- * ^o -> (release) (deliver) button_1_down
- * <-> -> (release) (deliver) button_1_down
- * <> -> (deliver) button_1_pend
- * k -> (release) (deliver) button_1_down
- * ... -> (release) button_1_down
- *
- * button_1_down (button 1 is down)
- * ^1 -> (deliver) start
- * v2 -> (deliver) button_1_down
- * ^2 -> (deliver) button_1_down
- * v3 -> (deliver) button_1_down
- * ^3 -> (deliver) button_1_down
- * vo -> (deliver) button_1_down
- * ^o -> (deliver) button_1_down
- * <> -> (deliver) button_1_down
- * k -> (deliver) button_1_down
- *
- * button_2_down (button 2 is down)
- * v1 -> (deliver) button_2_down
- * ^1 -> (deliver) button_2_down
- * ^2 -> (deliver) start
- * v3 -> (deliver) button_2_down
- * ^3 -> (deliver) button_2_down
- * vo -> (deliver) button_2_down
- * ^o -> (deliver) button_2_down
- * <> -> (deliver) button_2_down
- * k -> (deliver) button_2_down
- *
- * button_3_pend (button 3 is down, timeout pending)
- * v1 -> (generate v2) synthetic_2_down
- * ^1 -> (release) (deliver) button_3_down
- * v2 -> (release) (deliver) button_3_down
- * ^2 -> (release) (deliver) button_3_down
- * ^3 -> (release) (deliver) start
- * vo -> (release) (deliver) button_3_down
- * ^o -> (release) (deliver) button_3_down
- * <-> -> (release) (deliver) button_3_down
- * <> -> (deliver) button_3_pend
- * k -> (release) (deliver) button_3_down
- * ... -> (release) button_3_down
- *
- * button_3_down (button 3 is down)
- * v1 -> (deliver) button_3_down
- * ^1 -> (deliver) button_3_down
- * v2 -> (deliver) button_3_down
- * ^2 -> (deliver) button_3_down
- * ^3 -> (deliver) start
- * vo -> (deliver) button_3_down
- * ^o -> (deliver) button_3_down
- * <> -> (deliver) button_3_down
- * k -> (deliver) button_3_down
- *
- * synthetic_2_down_13 (button 1 and 3 are down)
- * ^1 -> (generate ^2) synthetic_2_down_3
- * v2 -> synthetic_2_down_13
- * ^2 -> synthetic_2_down_13
- * ^3 -> (generate ^2) synthetic_2_down_1
- * vo -> (deliver) synthetic_2_down_13
- * ^o -> (deliver) synthetic_2_down_13
- * <> -> (deliver) synthetic_2_down_13
- * k -> (deliver) synthetic_2_down_13
- *
- * synthetic_2_down_3 (button 3 is down)
- * v1 -> (deliver) synthetic_2_down_3
- * ^1 -> (deliver) synthetic_2_down_3
- * v2 -> synthetic_2_down_3
- * ^2 -> synthetic_2_down_3
- * ^3 -> start
- * vo -> (deliver) synthetic_2_down_3
- * ^o -> (deliver) synthetic_2_down_3
- * <> -> (deliver) synthetic_2_down_3
- * k -> (deliver) synthetic_2_down_3
- *
- * synthetic_2_down_1 (button 1 is down)
- * ^1 -> start
- * v2 -> synthetic_2_down_1
- * ^2 -> synthetic_2_down_1
- * v3 -> (deliver) synthetic_2_down_1
- * ^3 -> (deliver) synthetic_2_down_1
- * vo -> (deliver) synthetic_2_down_1
- * ^o -> (deliver) synthetic_2_down_1
- * <> -> (deliver) synthetic_2_down_1
- * k -> (deliver) synthetic_2_down_1
- */
-
-typedef enum _inputClass {
- down_1, up_1,
- down_2, up_2,
- down_3, up_3,
- down_o, up_o,
- motion, outside_box,
- keyboard, timeout,
- num_input_class
-} KdInputClass;
-
-typedef enum _inputAction {
- noop,
- hold,
- setto,
- deliver,
- release,
- clearto,
- gen_down_2,
- gen_up_2
-} KdInputAction;
-
-#define MAX_ACTIONS 2
-
-typedef struct _inputTransition {
- KdInputAction actions[MAX_ACTIONS];
- KdMouseState nextState;
-} KdInputTransition;
-
-KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
- /* start */
- {
- { { hold, setto }, button_1_pend }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { hold, setto }, button_3_pend }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, start }, /* vo */
- { { deliver, noop }, start }, /* ^o */
- { { deliver, noop }, start }, /* <> */
- { { deliver, noop }, start }, /* <-> */
- { { noop, noop }, start }, /* k */
- { { noop, noop }, start }, /* ... */
- },
- /* button_1_pend */
- {
- { { noop, noop }, button_1_pend }, /* v1 */
- { { release, deliver }, start }, /* ^1 */
- { { release, deliver }, button_1_down }, /* v2 */
- { { release, deliver }, button_1_down }, /* ^2 */
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */
- { { release, deliver }, button_1_down }, /* ^3 */
- { { release, deliver }, button_1_down }, /* vo */
- { { release, deliver }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_pend }, /* <> */
- { { release, deliver }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { release, noop }, button_1_down }, /* ... */
- },
- /* button_1_down */
- {
- { { noop, noop }, button_1_down }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_1_down }, /* v2 */
- { { deliver, noop }, button_1_down }, /* ^2 */
- { { deliver, noop }, button_1_down }, /* v3 */
- { { deliver, noop }, button_1_down }, /* ^3 */
- { { deliver, noop }, button_1_down }, /* vo */
- { { deliver, noop }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_down }, /* <> */
- { { deliver, noop }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { noop, noop }, button_1_down }, /* ... */
- },
- /* button_2_down */
- {
- { { deliver, noop }, button_2_down }, /* v1 */
- { { deliver, noop }, button_2_down }, /* ^1 */
- { { noop, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { deliver, noop }, button_2_down }, /* v3 */
- { { deliver, noop }, button_2_down }, /* ^3 */
- { { deliver, noop }, button_2_down }, /* vo */
- { { deliver, noop }, button_2_down }, /* ^o */
- { { deliver, noop }, button_2_down }, /* <> */
- { { deliver, noop }, button_2_down }, /* <-> */
- { { noop, noop }, button_2_down }, /* k */
- { { noop, noop }, button_2_down }, /* ... */
- },
- /* button_3_pend */
- {
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */
- { { release, deliver }, button_3_down }, /* ^1 */
- { { release, deliver }, button_3_down }, /* v2 */
- { { release, deliver }, button_3_down }, /* ^2 */
- { { release, deliver }, button_3_down }, /* v3 */
- { { release, deliver }, start }, /* ^3 */
- { { release, deliver }, button_3_down }, /* vo */
- { { release, deliver }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_pend }, /* <> */
- { { release, deliver }, button_3_down }, /* <-> */
- { { release, noop }, button_3_down }, /* k */
- { { release, noop }, button_3_down }, /* ... */
- },
- /* button_3_down */
- {
- { { deliver, noop }, button_3_down }, /* v1 */
- { { deliver, noop }, button_3_down }, /* ^1 */
- { { deliver, noop }, button_3_down }, /* v2 */
- { { deliver, noop }, button_3_down }, /* ^2 */
- { { noop, noop }, button_3_down }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, button_3_down }, /* vo */
- { { deliver, noop }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_down }, /* <> */
- { { deliver, noop }, button_3_down }, /* <-> */
- { { noop, noop }, button_3_down }, /* k */
- { { noop, noop }, button_3_down }, /* ... */
- },
- /* synthetic_2_down_13 */
- {
- { { noop, noop }, synth_2_down_13 }, /* v1 */
- { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */
- { { noop, noop }, synth_2_down_13 }, /* v2 */
- { { noop, noop }, synth_2_down_13 }, /* ^2 */
- { { noop, noop }, synth_2_down_13 }, /* v3 */
- { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_13 }, /* vo */
- { { deliver, noop }, synth_2_down_13 }, /* ^o */
- { { deliver, noop }, synth_2_down_13 }, /* <> */
- { { deliver, noop }, synth_2_down_13 }, /* <-> */
- { { noop, noop }, synth_2_down_13 }, /* k */
- { { noop, noop }, synth_2_down_13 }, /* ... */
- },
- /* synthetic_2_down_3 */
- {
- { { deliver, noop }, synth_2_down_3 }, /* v1 */
- { { deliver, noop }, synth_2_down_3 }, /* ^1 */
- { { deliver, noop }, synth_2_down_3 }, /* v2 */
- { { deliver, noop }, synth_2_down_3 }, /* ^2 */
- { { noop, noop }, synth_2_down_3 }, /* v3 */
- { { noop, noop }, start }, /* ^3 */
- { { deliver, noop }, synth_2_down_3 }, /* vo */
- { { deliver, noop }, synth_2_down_3 }, /* ^o */
- { { deliver, noop }, synth_2_down_3 }, /* <> */
- { { deliver, noop }, synth_2_down_3 }, /* <-> */
- { { noop, noop }, synth_2_down_3 }, /* k */
- { { noop, noop }, synth_2_down_3 }, /* ... */
- },
- /* synthetic_2_down_1 */
- {
- { { noop, noop }, synth_2_down_1 }, /* v1 */
- { { noop, noop }, start }, /* ^1 */
- { { deliver, noop }, synth_2_down_1 }, /* v2 */
- { { deliver, noop }, synth_2_down_1 }, /* ^2 */
- { { deliver, noop }, synth_2_down_1 }, /* v3 */
- { { deliver, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_1 }, /* vo */
- { { deliver, noop }, synth_2_down_1 }, /* ^o */
- { { deliver, noop }, synth_2_down_1 }, /* <> */
- { { deliver, noop }, synth_2_down_1 }, /* <-> */
- { { noop, noop }, synth_2_down_1 }, /* k */
- { { noop, noop }, synth_2_down_1 }, /* ... */
- },
-};
-
-#define EMULATION_WINDOW 10
-#define EMULATION_TIMEOUT 100
-
-#define EventX(e) ((e)->u.keyButtonPointer.rootX)
-#define EventY(e) ((e)->u.keyButtonPointer.rootY)
-
-static int
-KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev)
-{
- if (ev->u.keyButtonPointer.pad1)
- {
- mi->emulationDx += EventX(ev);
- mi->emulationDy += EventY(ev);
- }
- else
- {
- mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev);
- mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev);
- }
- return (abs (mi->emulationDx) < EMULATION_WINDOW &&
- abs (mi->emulationDy) < EMULATION_WINDOW);
-}
-
-static KdInputClass
-KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
-{
- switch (ev->u.u.type) {
- case ButtonPress:
- switch (ev->u.u.detail) {
- case 1: return down_1;
- case 2: return down_2;
- case 3: return down_3;
- default: return down_o;
- }
- break;
- case ButtonRelease:
- switch (ev->u.u.detail) {
- case 1: return up_1;
- case 2: return up_2;
- case 3: return up_3;
- default: return up_o;
- }
- break;
- case MotionNotify:
- if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev))
- return outside_box;
- else
- return motion;
- default:
- return keyboard;
- }
- return keyboard;
-}
-
-#ifndef NDEBUG
-char *kdStateNames[] = {
- "start",
- "button_1_pend",
- "button_1_down",
- "button_2_down",
- "button_3_pend",
- "button_3_down",
- "synth_2_down_13",
- "synth_2_down_3",
- "synthetic_2_down_1",
- "num_input_states"
-};
-
-char *kdClassNames[] = {
- "down_1", "up_1",
- "down_2", "up_2",
- "down_3", "up_3",
- "motion", "ouside_box",
- "keyboard", "timeout",
- "num_input_class"
-};
-
-char *kdActionNames[] = {
- "noop",
- "hold",
- "setto",
- "deliver",
- "release",
- "clearto",
- "gen_down_2",
- "gen_up_2",
-};
-#endif
-
-static void
-KdQueueEvent (xEvent *ev)
-{
- KdAssertSigioBlocked ("KdQueueEvent");
- if (ev->u.u.type == MotionNotify)
- {
- if (ev->u.keyButtonPointer.pad1)
- {
- ev->u.keyButtonPointer.pad1 = 0;
- miPointerDeltaCursor (ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- else
- {
- miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- }
- else
- {
- mieqEnqueue (ev);
- }
-}
-
-static void
-KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev)
-{
- KdInputTransition *t;
- int a;
-
- t = &kdInputMachine[mi->mouseState][c];
- for (a = 0; a < MAX_ACTIONS; a++)
- {
- switch (t->actions[a]) {
- case noop:
- break;
- case hold:
- mi->eventHeld = TRUE;
- mi->emulationDx = 0;
- mi->emulationDy = 0;
- mi->heldEvent = *ev;
- break;
- case setto:
- mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
- mi->timeoutPending = TRUE;
- break;
- case deliver:
- KdQueueEvent (ev);
- break;
- case release:
- mi->eventHeld = FALSE;
- mi->timeoutPending = FALSE;
- KdQueueEvent (&mi->heldEvent);
- break;
- case clearto:
- mi->timeoutPending = FALSE;
- break;
- case gen_down_2:
- ev->u.u.detail = 2;
- mi->eventHeld = FALSE;
- KdQueueEvent (ev);
- break;
- case gen_up_2:
- ev->u.u.detail = 2;
- KdQueueEvent (ev);
- break;
- }
- }
- mi->mouseState = t->nextState;
-}
-
-void
-KdResetInputMachine (void)
-{
- KdMouseInfo *mi;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- mi->mouseState = start;
- mi->eventHeld = FALSE;
- }
-}
-
-static void
-KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev)
-{
- if (mi->emulateMiddleButton)
- KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev);
- else
- KdQueueEvent (ev);
-}
-
-static void
-KdReceiveTimeout (KdMouseInfo *mi)
-{
- KdRunMouseMachine (mi, timeout, 0);
-}
-
-#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
-#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
-#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
-#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
-#define KEYMAP (pKdKeyboard->key->curKeySyms)
-#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth])
-
-CARD32 KdSpecialKeys = 0;
-
-extern char dispatchException;
-
-/*
- * kdCheckTermination
- *
- * This function checks for the key sequence that terminates the server. When
- * detected, it sets the dispatchException flag and returns. The key sequence
- * is:
- * Control-Alt
- * It's assumed that the server will be waken up by the caller when this
- * function returns.
- */
-
-extern int nClients;
-
-static void
-KdCheckSpecialKeys(xEvent *xE)
-{
- KeySym sym = KEYCOL1(xE->u.u.detail);
-
- if (!pKdKeyboard) return;
-
- /*
- * Ignore key releases
- */
-
- if (xE->u.u.type == KeyRelease) return;
-
-#ifdef XIPAQ
- /*
- * Check for buttons 1, 2 and 3 on the iPAQ
- */
- if (sym == XK_Pointer_Button1 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button2 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button3 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0);
- return;
- }
-#endif
-
- /*
- * Check for control/alt pressed
- */
- if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) !=
- (ControlMask|Mod1Mask))
- return;
-
-
- /*
- * Let OS function see keysym first
- */
-
- if (kdOsFuncs->SpecialKey)
- if ((*kdOsFuncs->SpecialKey) (sym))
- return;
-
- /*
- * Now check for backspace or delete; these signal the
- * X server to terminate
- */
- switch (sym) {
- case XK_BackSpace:
- case XK_Delete:
- case XK_KP_Delete:
- /*
- * Set the dispatch exception flag so the server will terminate the
- * next time through the dispatch loop.
- */
- dispatchException |= DE_TERMINATE;
- break;
- }
-}
-
-/*
- * kdEnqueueKeyboardEvent
- *
- * This function converts hardware keyboard event information into an X event
- * and enqueues it using MI. It wakes up the server before returning so that
- * the event will be processed normally.
- *
- */
-
-static void
-KdHandleKeyboardEvent (xEvent *ev)
-{
- int key = ev->u.u.detail;
- int byte;
- CARD8 bit;
- KdMouseInfo *mi;
-
- byte = key >> 3;
- bit = 1 << (key & 7);
- switch (ev->u.u.type) {
- case KeyPress:
- kdKeyState[byte] |= bit;
- break;
- case KeyRelease:
- kdKeyState[byte] &= ~bit;
- break;
- }
- for (mi = kdMouseInfo; mi; mi = mi->next)
- KdRunMouseMachine (mi, keyboard, 0);
- KdQueueEvent (ev);
-}
-
-void
-KdReleaseAllKeys (void)
-{
- xEvent xE;
- int key;
-
- KdBlockSigio ();
- for (key = 0; key < KD_KEY_COUNT; key++)
- if (IsKeyDown(key))
- {
- xE.u.keyButtonPointer.time = GetTimeInMillis();
- xE.u.u.type = KeyRelease;
- xE.u.u.detail = key;
- KdHandleKeyboardEvent (&xE);
- }
- KdUnblockSigio ();
-}
-
-static void
-KdCheckLock (void)
-{
- KeyClassPtr keyc = pKdKeyboard->key;
- Bool isSet, shouldBeSet;
-
- if (kdKeyboardFuncs->LockLed)
- {
- isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0;
- shouldBeSet = (keyc->state & LockMask) != 0;
- if (isSet != shouldBeSet)
- {
- KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet);
- }
- }
-}
-
-void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up)
-{
- unsigned char key_code;
- xEvent xE;
- KeyClassPtr keyc;
-
- if (!pKdKeyboard)
- return;
- keyc = pKdKeyboard->key;
-
- xE.u.keyButtonPointer.time = GetTimeInMillis();
-
- if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode)
- {
- key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode;
-
- /*
- * Set up this event -- the type may be modified below
- */
- if (is_up)
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
- xE.u.u.detail = key_code;
-
- switch (KEYCOL1(key_code))
- {
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- case XK_Caps_Lock:
- if (xE.u.u.type == KeyRelease)
- return;
- if (IsKeyDown (key_code))
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
- }
-
- /*
- * Check pressed keys which are already down
- */
- if (IsKeyDown (key_code) && xE.u.u.type == KeyPress)
- {
- KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl;
-
- /*
- * Check auto repeat
- */
- if (!ctrl->autoRepeat || keyc->modifierMap[key_code] ||
- !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7))))
- {
- return;
- }
- /*
- * X delivers press/release even for autorepeat
- */
- xE.u.u.type = KeyRelease;
- KdHandleKeyboardEvent (&xE);
- xE.u.u.type = KeyPress;
- }
- /*
- * Check released keys which are already up
- */
- else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease)
- {
- return;
- }
- KdCheckSpecialKeys (&xE);
- KdHandleKeyboardEvent (&xE);
- }
-}
-
-#define SetButton(mi, b, v, s) \
-{\
- xE.u.u.detail = mi->map[b]; \
- xE.u.u.type = v; \
- KdHandleMouseEvent (mi, &xE); \
-}
-
-#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down")
-#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up")
-
-/*
- * kdEnqueueMouseEvent
- *
- * This function converts hardware mouse event information into X event
- * information. A mouse movement event is passed off to MI to generate
- * a MotionNotify event, if appropriate. Button events are created and
- * passed off to MI for enqueueing.
- */
-
-static void
-KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy)
-{
- PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
- double speed = sqrt (*dx * *dx + *dy * *dy);
- double accel;
- double m;
-
- /*
- * Ok, so we want it moving num/den times faster at threshold*2
- *
- * accel = m *threshold + b
- * 1 = m * 0 + b -> b = 1
- *
- * num/den = m * (threshold * 2) + 1
- *
- * num / den - 1 = m * threshold * 2
- * (num / den - 1) / threshold * 2 = m
- */
- m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
- ((double) pCtrl->threshold * 2.0));
- accel = m * speed + 1;
- *dx = accel * *dx;
- *dy = accel * *dy;
-}
-
-void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry)
-{
- CARD32 ms;
- xEvent xE;
- unsigned char buttons;
- int x, y;
- int (*matrix)[3] = kdMouseMatrix.matrix;
- unsigned long button;
- int n;
-
- if (!pKdPointer)
- return;
-
- ms = GetTimeInMillis();
-
- if (flags & KD_MOUSE_DELTA)
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry;
- y = matrix[1][0] * rx + matrix[1][1] * ry;
- }
- else
- {
- x = rx;
- y = ry;
- }
- KdMouseAccelerate (pKdPointer, &x, &y);
- xE.u.keyButtonPointer.pad1 = 1;
- }
- else
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
- y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
- }
- else
- {
- x = rx;
- y = ry;
- }
- xE.u.keyButtonPointer.pad1 = 0;
- }
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
-
- xE.u.u.type = MotionNotify;
- xE.u.u.detail = 0;
- KdHandleMouseEvent (mi, &xE);
-
- buttons = flags;
-
- for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++)
- {
- if ((mi->buttonState & button) ^ (buttons & button))
- {
- if (buttons & button)
- {
- Press(mi, n);
- }
- else
- {
- Release(mi, n);
- }
- }
- }
- mi->buttonState = buttons;
-}
-
-void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y)
-{
- xEvent xE;
- CARD32 ms;
-
- ms = GetTimeInMillis();
-
- xE.u.u.type = MotionNotify;
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
-
- KdHandleMouseEvent (mi, &xE);
-}
-
-void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask)
-{
- KdMouseInfo *mi;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->timeoutPending)
- {
- int ms;
-
- ms = mi->emulationTimeout - GetTimeInMillis ();
- if (ms < 0)
- ms = 0;
- AdjustWaitForDelay (timeout, ms);
- }
- }
-}
-
-void
-KdWakeupHandler (int screen,
- pointer data,
- unsigned long lresult,
- pointer readmask)
-{
- int result = (int) lresult;
- fd_set *pReadmask = (fd_set *) readmask;
- int i;
- KdMouseInfo *mi;
-
- if (kdInputEnabled && result > 0)
- {
- for (i = 0; i < kdNumInputFds; i++)
- if (FD_ISSET (kdInputFds[i].fd, pReadmask))
- {
- KdBlockSigio ();
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdUnblockSigio ();
- }
- }
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->timeoutPending)
- {
- if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0)
- {
- mi->timeoutPending = FALSE;
- KdBlockSigio ();
- KdReceiveTimeout (mi);
- KdUnblockSigio ();
- }
- }
- }
- if (kdSwitchPending)
- KdProcessSwitch ();
-}
-
-#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin))
-
-static Bool
-KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
- ScreenPtr pScreen = *ppScreen;
- ScreenPtr pNewScreen;
- int n;
- int dx, dy;
- int best_x, best_y;
- int n_best_x, n_best_y;
- CARD32 ms;
-
- if (kdDisableZaphod || screenInfo.numScreens <= 1)
- return FALSE;
-
- if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
- return FALSE;
-
- ms = GetTimeInMillis ();
- if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
- return FALSE;
- kdOffScreen = TRUE;
- kdOffScreenTime = ms;
- n_best_x = -1;
- best_x = 32767;
- n_best_y = -1;
- best_y = 32767;
- for (n = 0; n < screenInfo.numScreens; n++)
- {
- pNewScreen = screenInfo.screens[n];
- if (pNewScreen == pScreen)
- continue;
- dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
- dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
- if (*x < 0)
- {
- if (dx <= 0 && -dx < best_x)
- {
- best_x = -dx;
- n_best_x = n;
- }
- }
- else if (*x >= pScreen->width)
- {
- if (dx >= 0 && dx < best_x)
- {
- best_x = dx;
- n_best_x = n;
- }
- }
- if (*y < 0)
- {
- if (dy <= 0 && -dy < best_y)
- {
- best_y = -dy;
- n_best_y = n;
- }
- }
- else if (*y >= pScreen->height)
- {
- if (dy >= 0 && dy < best_y)
- {
- best_y = dy;
- n_best_y = n;
- }
- }
- }
- if (best_y < best_x)
- n_best_x = n_best_y;
- if (n_best_x == -1)
- return FALSE;
- pNewScreen = screenInfo.screens[n_best_x];
-
- if (*x < 0)
- *x += pNewScreen->width;
- if (*y < 0)
- *y += pNewScreen->height;
-
- if (*x >= pScreen->width)
- *x -= pScreen->width;
- if (*y >= pScreen->height)
- *y -= pScreen->height;
-
- *ppScreen = pNewScreen;
- return TRUE;
-}
-
-static void
-KdCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-#ifndef XIPAQ
- if (entering)
- KdEnableScreen (pScreen);
- else
- KdDisableScreen (pScreen);
-#endif
-}
-
-int KdCurScreen; /* current event screen */
-
-static void
-KdWarpCursor (ScreenPtr pScreen, int x, int y)
-{
- KdBlockSigio ();
- KdCurScreen = pScreen->myNum;
- miPointerWarpCursor (pScreen, x, y);
- KdUnblockSigio ();
-}
-
-miPointerScreenFuncRec kdPointerScreenFuncs =
-{
- KdCursorOffScreen,
- KdCrossScreen,
- KdWarpCursor
-};
-
-void
-ProcessInputEvents ()
-{
- mieqProcessInputEvents();
- miPointerUpdate();
- if (kdSwitchPending)
- KdProcessSwitch ();
- KdCheckLock ();
-}
diff --git a/hw/kdrive/src/kkeymap.c b/hw/kdrive/src/kkeymap.c
deleted file mode 100644
index bfab84038..000000000
--- a/hw/kdrive/src/kkeymap.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Id: kkeymap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kkeymap.c,v 1.1 1999/11/19 13:53:49 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <X11/keysym.h>
-#include "kkeymap.h"
-
-/*
- * Map scan codes (both regular and synthesized from extended keys)
- * to X keysyms
- */
-
-KeySym kdKeymap[(MAX_SCANCODE - MIN_SCANCODE + 1) * MAX_WIDTH] = {
-/* These are directly mapped from DOS scanset 0 */
-/* 1 8 */ XK_Escape, NoSymbol,
-/* 2 9 */ XK_1, XK_exclam,
-/* 3 10 */ XK_2, XK_at,
-/* 4 11 */ XK_3, XK_numbersign,
-/* 5 12 */ XK_4, XK_dollar,
-/* 6 13 */ XK_5, XK_percent,
-/* 7 14 */ XK_6, XK_asciicircum,
-/* 8 15 */ XK_7, XK_ampersand,
-/* 9 16 */ XK_8, XK_asterisk,
-/* 10 17 */ XK_9, XK_parenleft,
-/* 11 18 */ XK_0, XK_parenright,
-/* 12 19 */ XK_minus, XK_underscore,
-/* 13 20 */ XK_equal, XK_plus,
-/* 14 21 */ XK_BackSpace, NoSymbol,
-/* 15 22 */ XK_Tab, NoSymbol,
-/* 16 23 */ XK_Q, NoSymbol,
-/* 17 24 */ XK_W, NoSymbol,
-/* 18 25 */ XK_E, NoSymbol,
-/* 19 26 */ XK_R, NoSymbol,
-/* 20 27 */ XK_T, NoSymbol,
-/* 21 28 */ XK_Y, NoSymbol,
-/* 22 29 */ XK_U, NoSymbol,
-/* 23 30 */ XK_I, NoSymbol,
-/* 24 31 */ XK_O, NoSymbol,
-/* 25 32 */ XK_P, NoSymbol,
-/* 26 33 */ XK_bracketleft, XK_braceleft,
-/* 27 34 */ XK_bracketright, XK_braceright,
-/* 28 35 */ XK_Return, NoSymbol,
-/* 29 36 */ XK_Control_L, NoSymbol,
-/* 30 37 */ XK_A, NoSymbol,
-/* 31 38 */ XK_S, NoSymbol,
-/* 32 39 */ XK_D, NoSymbol,
-/* 33 40 */ XK_F, NoSymbol,
-/* 34 41 */ XK_G, NoSymbol,
-/* 35 42 */ XK_H, NoSymbol,
-/* 36 43 */ XK_J, NoSymbol,
-/* 37 44 */ XK_K, NoSymbol,
-/* 38 45 */ XK_L, NoSymbol,
-/* 39 46 */ XK_semicolon, XK_colon,
-/* 40 47 */ XK_apostrophe, XK_quotedbl,
-/* 41 48 */ XK_grave, XK_asciitilde,
-/* 42 49 */ XK_Shift_L, NoSymbol,
-/* 43 50 */ XK_backslash, XK_bar,
-/* 44 51 */ XK_Z, NoSymbol,
-/* 45 52 */ XK_X, NoSymbol,
-/* 46 53 */ XK_C, NoSymbol,
-/* 47 54 */ XK_V, NoSymbol,
-/* 48 55 */ XK_B, NoSymbol,
-/* 49 56 */ XK_N, NoSymbol,
-/* 50 57 */ XK_M, NoSymbol,
-/* 51 58 */ XK_comma, XK_less,
-/* 52 59 */ XK_period, XK_greater,
-/* 53 60 */ XK_slash, XK_question,
-/* 54 61 */ XK_Shift_R, NoSymbol,
-/* 55 62 */ XK_KP_Multiply, NoSymbol,
-/* 56 63 */ XK_Alt_L, XK_Meta_L,
-/* 57 64 */ XK_space, NoSymbol,
-/* 58 65 */ XK_Caps_Lock, NoSymbol,
-/* 59 66 */ XK_F1, NoSymbol,
-/* 60 67 */ XK_F2, NoSymbol,
-/* 61 68 */ XK_F3, NoSymbol,
-/* 62 69 */ XK_F4, NoSymbol,
-/* 63 70 */ XK_F5, NoSymbol,
-/* 64 71 */ XK_F6, NoSymbol,
-/* 65 72 */ XK_F7, NoSymbol,
-/* 66 73 */ XK_F8, NoSymbol,
-/* 67 74 */ XK_F9, NoSymbol,
-/* 68 75 */ XK_F10, NoSymbol,
-/* 69 76 */ XK_Break, XK_Pause,
-/* 70 77 */ XK_Scroll_Lock, NoSymbol,
-/* 71 78 */ XK_KP_Home, XK_KP_7,
-/* 72 79 */ XK_KP_Up, XK_KP_8,
-/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
-/* 74 81 */ XK_KP_Subtract, NoSymbol,
-/* 75 82 */ XK_KP_Left, XK_KP_4,
-/* 76 83 */ XK_KP_5, NoSymbol,
-/* 77 84 */ XK_KP_Right, XK_KP_6,
-/* 78 85 */ XK_KP_Add, NoSymbol,
-/* 79 86 */ XK_KP_End, XK_KP_1,
-/* 80 87 */ XK_KP_Down, XK_KP_2,
-/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
-/* 82 89 */ XK_KP_Insert, XK_KP_0,
-/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
-/* 84 91 */ NoSymbol, NoSymbol,
-/* 85 92 */ NoSymbol, NoSymbol,
-/* 86 93 */ NoSymbol, NoSymbol,
-/* 87 94 */ XK_F11, NoSymbol,
-/* 88 95 */ XK_F12, NoSymbol,
-
-/* These are remapped from the extended set (using ExtendMap) */
-
-/* 89 96 */ XK_Control_R, NoSymbol,
-/* 90 97 */ XK_KP_Enter, NoSymbol,
-/* 91 98 */ XK_KP_Divide, NoSymbol,
-/* 92 99 */ XK_Sys_Req, XK_Print,
-/* 93 100 */ XK_Alt_R, XK_Meta_R,
-/* 94 101 */ XK_Num_Lock, NoSymbol,
-/* 95 102 */ XK_Home, NoSymbol,
-/* 96 103 */ XK_Up, NoSymbol,
-/* 97 104 */ XK_Page_Up, NoSymbol,
-/* 98 105 */ XK_Left, NoSymbol,
-/* 99 106 */ XK_Right, NoSymbol,
-/* 100 107 */ XK_End, NoSymbol,
-/* 101 108 */ XK_Down, NoSymbol,
-/* 102 109 */ XK_Page_Down, NoSymbol,
-/* 103 110 */ XK_Insert, NoSymbol,
-/* 104 111 */ XK_Delete, NoSymbol,
-/* 105 112 */ XK_Super_L, NoSymbol,
-/* 106 113 */ XK_Super_R, NoSymbol,
-/* 107 114 */ XK_Menu, NoSymbol,
-/* 108 115 */ NoSymbol, NoSymbol,
-/* 109 116 */ NoSymbol, NoSymbol,
-/* 110 117 */ NoSymbol, NoSymbol,
-/* 111 118 */ NoSymbol, NoSymbol,
-/* 112 119 */ NoSymbol, NoSymbol,
-;
-
-/*
- * Map extended keys to additional scancodes
- */
-KdExtendMap kdExtendMap[] = {
- 0x1d, 89, /* Control_R */
- 0x1c, 90, /* KP_Enter */
- 0x35, 91, /* KP_Divide */
- 0x37, 92, /* Sys_Req */
- 0x38, 93, /* Alt_R */
- 0x45, 94, /* Num_Lock */
- 0x47, 95, /* Home */
- 0x48, 96, /* Up */
- 0x49, 97, /* Page_Up */
- 0x4b, 98, /* Left */
- 0x4d, 99, /* Right */
- 0x4f, 100, /* End */
- 0x50, 101, /* Down */
- 0x51, 102, /* Page_Down */
- 0x52, 103, /* Insert */
- 0x53, 104, /* Delete */
- 0x5b, 105, /* Super_L (Windows_L) */
- 0x5c, 106, /* Super_R (Windows_R) */
- 0x5d, 107, /* Menu */
- 0x46, 69, /* Break (with control pressed) */
-};
-
-#define NUM_EXTEND (sizeof (kdExtendMap)/ sizeof (kdExtendMap[0]))
-
-int kdNumExtend = NUM_EXTEND;
-
-/*
- * Map keys on Japanese keyboard far from zero back to reasonable values
- */
-KdExtendMap kdJapanMap[] = {
- 0x70, 108, /* next to Alt key */
- 0x73, 109, /* dash/vbar */
- 0x79, 110, /* right of space bar */
- 0x7b, 111, /* left of space bar */
- 0x7d, 112, /* Yen */
-};
-
-#define NUM_JAPAN (sizeof (kdJapanMap)/sizeof (kdJapanMap[0]))
-
-int kdNumJapan = NUM_JAPAN;
-
-/*
- * List of locking key codes
- */
-
-CARD8 kdLockMap[] = {
- 65,
- 101,
- 77,
-};
-
-#define NUM_LOCK (sizeof (kdLockMap) / sizeof (kdLockMap[0]))
-
-int kdNumLock = NUM_LOCK;
-
-/*
- * Map containing list of keys which the X server makes locking when
- * the KEYMAP_LOCKING_ALTGR flag is set in CEKeymapFlags
- */
-
-CARD8 kdOptionalLockMap[] = {
- 100,
-};
-
-#define NUM_OPTIONAL_LOCK (sizeof (kdOptionalLockMap) / sizeof (kdOptionalLockMap[0]))
-
-int kdNumOptionalLock = NUM_OPTIONAL_LOCK;
-
-CARD8 kdModMap[MAP_LENGTH];
-
-unsigned long kdKeymapFlags = 0;
-
-KeySymsRec kdKeySyms = {
- kdKeymap,
- MIN_KEYCODE,
- MAX_KEYCODE,
- 2
-};
diff --git a/hw/kdrive/src/kkeymap.h b/hw/kdrive/src/kkeymap.h
deleted file mode 100644
index ccc5e86f8..000000000
--- a/hw/kdrive/src/kkeymap.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Id: kkeymap.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kkeymap.h,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-/*
- * All global variables and functions pertaining to keyboard key mapping
- * live in this header file.
- */
-
-#ifndef _KKEYMAP_H
-#define _KKEYMAP_H
-
-/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */
-#define KD_KEY_OFFSET (8 - kdMinScanCode)
-
-#define KD_MIN_KEYCODE 8
-#define KD_MAX_KEYCODE 254
-#define KD_MAX_WIDTH 4
-#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
-
-extern int kdMinScanCode;
-extern int kdMaxScanCode;
-extern int kdMinKeyCode;
-extern int kdMaxKeyCode;
-extern int kdKeymapWidth;
-
-extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-
-extern CARD8 kdModMap[MAP_LENGTH];
-
-extern KeySymsRec kdKeySyms;
-
-typedef struct {
- KeySym modsym;
- int modbit;
-} KdKeySymModsRec;
-
-#endif /* _KKEYMAP_H */
diff --git a/hw/kdrive/src/kloadmap.c b/hw/kdrive/src/kloadmap.c
deleted file mode 100644
index 17ec880dd..000000000
--- a/hw/kdrive/src/kloadmap.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Id: kloadmap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kloadmap.c,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kkeymap.h"
-
-#ifdef WINDOWS
-#define KM_BUF 1024
-#define KM_EOF -1
-
-typedef struct _km_file {
- HANDLE handle;
- char buf[KM_BUF];
- char *bufptr;
- DWORD remain;
-} km_file;
-
-int
-km_fill (km_file *kf)
-{
- BOOL r;
-
- NCD_DEBUG ((DEBUG_INIT, "km_fill"));
- r = ReadFile (kf->handle, kf->buf, KM_BUF,
- &kf->remain, NULL);
- NCD_DEBUG ((DEBUG_INIT, "Got %d", kf->remain));
- if (!r || !kf->remain)
- return KM_EOF;
- kf->bufptr = kf->buf;
- --kf->remain;
- return *kf->bufptr++;
-}
-
-#define km_getchar(kf) ((kf)->remain-- ? *kf->bufptr++ : km_fill (kf))
-#else
-#define km_getchar(kf) getc(kf)
-#endif
-
-BOOL
-km_word (km_file *kf, char *buf, int len)
-{
- int c;
-
- for (;;)
- {
- switch (c = km_getchar (kf)) {
- case KM_EOF:
- return FALSE;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- continue;
- }
- break;
- }
- len--;
- while (len--)
- {
- *buf++ = c;
- switch (c = km_getchar (kf)) {
- case KM_EOF:
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- *buf++ = '\0';
- return TRUE;
- }
- }
- return FALSE;
-}
-
-BOOL
-km_int (km_file *kf, int *r)
-{
- char word[64];
-
- if (km_word (kf, word, sizeof (word)))
- {
- *r = strtol (word, NULL, 0);
- return TRUE;
- }
- return FALSE;
-}
-
-WCHAR *winKbdExtensions[] = {
- L".xku",
- L".xkb"
-};
-
-#define NUM_KBD_EXTENSIONS (sizeof (winKbdExtensions) / sizeof (winKbdExtensions[0]))
-
-BOOL
-winLoadKeymap (void)
-{
- WCHAR file[32 + KL_NAMELENGTH];
- WCHAR name[KL_NAMELENGTH];
- HKL layout;
- km_file kf;
- int width;
- BOOL ret;
- KeySym *m;
- int scancode;
- int w;
- int e;
-
- layout = GetKeyboardLayout (0);
- /*
- * Pre-build 46 versions of ThinSTAR software return 0
- * for all layouts
- */
- if (!layout)
- return FALSE;
- NCD_DEBUG ((DEBUG_INIT, "Keyboard layout 0x%x", layout));
- for (e = 0; e < NUM_KBD_EXTENSIONS; e++)
- {
- wstrcpy (file, L"\\Storage Card\\");
- wsprintf (name, TEXT("%08x"), layout);
- wstrcat (file, name);
- wstrcat (file, winKbdExtensions[e]);
- NCD_DEBUG ((DEBUG_INIT, "Loading keymap from %S", file));
- kf.handle = CreateFile (file,
- GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (kf.handle != INVALID_HANDLE_VALUE)
- break;
- }
- if (kf.handle == INVALID_HANDLE_VALUE)
- {
- NCD_DEBUG ((DEBUG_INIT, "No such file"));
- return FALSE;
- }
- ret = FALSE;
- kf.remain = 0;
- /*
- * Keymap format:
- *
- * flags (optional)
- * width
- * keycode -> keysym array (num_keycodes * width)
- */
- if (!km_int (&kf, &width))
- goto bail1;
- if (width & KEYMAP_FLAGS)
- {
- CEKeymapFlags = (unsigned long) width;
- if (!km_int (&kf, &width))
- goto bail1;
- }
- else
- CEKeymapFlags = 0;
- if (width > MAX_WIDTH)
- goto bail1;
- NCD_DEBUG ((DEBUG_INIT, "Keymap width %d flags 0x%x",
- width, CEKeymapFlags));
- m = CEKeymap;
- for (scancode = MIN_SCANCODE; scancode <= MAX_SCANCODE; scancode++)
- {
- for (w = 0; w < width; w++)
- {
- if (!km_int (&kf, m))
- break;
- m++;
- }
- if (w != width)
- break;
- }
- CEKeySyms.mapWidth = width;
- ret = TRUE;
-bail1:
- CloseHandle (kf.handle);
- return ret;
-}
diff --git a/hw/kdrive/src/kmap.c b/hw/kdrive/src/kmap.c
deleted file mode 100644
index bd506996b..000000000
--- a/hw/kdrive/src/kmap.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Id: kmap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kmap.c,v 1.10 2001/07/24 21:26:17 keithp Exp $ */
-
-#include <config.h>
-#include "kdrive.h"
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#ifdef HAVE_ASM_MTRR_H
-#include <asm/mtrr.h>
-#endif
-
-#include <sys/ioctl.h>
-
-void *
-KdMapDevice (CARD32 addr, CARD32 size)
-{
-#ifdef WINDOWS
- void *a;
- void *d;
-
- d = VirtualAlloc (NULL, size, MEM_RESERVE, PAGE_NOACCESS);
- if (!d)
- return NULL;
- DRAW_DEBUG ((DEBUG_S3INIT, "Virtual address of 0x%x is 0x%x", addr, d));
- a = VirtualCopyAddr (addr);
- DRAW_DEBUG ((DEBUG_S3INIT, "Translated address is 0x%x", a));
- if (!VirtualCopy (d, a, size,
- PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL))
- {
- DRAW_DEBUG ((DEBUG_FAILURE, "VirtualCopy failed %d",
- GetLastError ()));
- return NULL;
- }
- DRAW_DEBUG ((DEBUG_S3INIT, "Device mapped successfully"));
- return d;
-#endif
-#ifdef linux
- void *a;
- int fd;
-
-#ifdef __arm__
- fd = open ("/dev/mem", O_RDWR|O_SYNC);
-#else
- fd = open ("/dev/mem", O_RDWR);
-#endif
- if (fd < 0)
- FatalError ("KdMapDevice: failed to open /dev/mem (%s)\n",
- strerror (errno));
-
- a = mmap ((caddr_t) 0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, addr);
- close (fd);
- if ((long) a == -1)
- FatalError ("KdMapDevice: failed to map frame buffer (%s)\n",
- strerror (errno));
- return a;
-#endif
-#ifdef VXWORKS
- return (void *) addr;
-#endif
-}
-
-void
-KdUnmapDevice (void *addr, CARD32 size)
-{
-#ifdef WINDOWS
- VirtualFree (addr, size, MEM_DECOMMIT);
- VirtualFree (addr, 0, MEM_RELEASE);
-#endif
-#ifdef linux
- munmap (addr, size);
-#endif
-#ifdef VXWORKS
- ;
-#endif
-}
-
-#ifdef HAVE_ASM_MTRR_H
-static int mtrr;
-#endif
-
-void
-KdSetMappedMode (CARD32 addr, CARD32 size, int mode)
-{
-#ifdef HAVE_ASM_MTRR_H
- struct mtrr_sentry sentry;
- unsigned long base, bound;
- unsigned int type = MTRR_TYPE_WRBACK;
-
- if (addr < 0x100000)
- return;
- if (!mtrr)
- mtrr = open ("/proc/mtrr", 2);
- if (mtrr > 0)
- {
- unsigned long nsize;
- base = addr & ~((1<<22)-1);
- bound = ((addr + size) + ((1<<22) - 1)) & ~((1<<22) - 1);
- nsize = 1;
- while (nsize < (bound - base))
- nsize <<= 1;
- switch (mode) {
- case KD_MAPPED_MODE_REGISTERS:
- type = MTRR_TYPE_UNCACHABLE;
- break;
- case KD_MAPPED_MODE_FRAMEBUFFER:
- type = MTRR_TYPE_WRCOMB;
- break;
- }
- sentry.base = base;
- sentry.size = nsize;
- sentry.type = type;
-
- if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0)
- ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (errno %d)\n",
- base, bound - base, type, errno);
- }
-#endif
-}
-
-void
-KdResetMappedMode (CARD32 addr, CARD32 size, int mode)
-{
-#ifdef HAVE_ASM_MTRR_H
- struct mtrr_sentry sentry;
- unsigned long base, bound;
- unsigned int type = MTRR_TYPE_WRBACK;
-
- if (addr < 0x100000)
- return;
- if (!mtrr)
- mtrr = open ("/proc/mtrr", 2);
- if (mtrr > 0)
- {
- unsigned long nsize;
- base = addr & ~((1<<22)-1);
- bound = ((addr + size) + ((1<<22) - 1)) & ~((1<<22) - 1);
- nsize = 1;
- while (nsize < (bound - base))
- nsize <<= 1;
- switch (mode) {
- case KD_MAPPED_MODE_REGISTERS:
- type = MTRR_TYPE_UNCACHABLE;
- break;
- case KD_MAPPED_MODE_FRAMEBUFFER:
- type = MTRR_TYPE_WRCOMB;
- break;
- }
- sentry.base = base;
- sentry.size = nsize;
- sentry.type = type;
-
- if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0)
- ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (errno %d)\n",
- base, bound - base, type, errno);
- }
-#endif
-}
diff --git a/hw/kdrive/src/kmode.c b/hw/kdrive/src/kmode.c
deleted file mode 100644
index e1e82dce7..000000000
--- a/hw/kdrive/src/kmode.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kmode.c,v 1.7 2002/10/14 18:01:40 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-const KdMonitorTiming kdMonitorTimings[] = {
- /* H V Hz KHz */
- /* FP BP BLANK POLARITY */
- /* Other VESA modes */
- { 640, 350, 85, 31500, /* VESA */
- 32, 96, 192, KdSyncPositive, /* 26.413 */
- 32, 60, 95, KdSyncNegative, /* 59.354 */
- },
- { 640, 400, 60, 31500, /* VESA */
- 32, 96, 192, KdSyncNegative, /* 26.413 */
- 1, 41, 45, KdSyncPositive, /* 59.354 */
- },
- { 720, 400, 85, 35500, /* VESA */
- 36, 108, 216, KdSyncNegative, /* 37.927 */
- 1, 42, 46, KdSyncPositive, /* 85.039 */
- },
-
-
- /* Modeline "720x576" 29.000 720 736 800 880 576 577 580 625 */
- {
- 720, 576, 52, 32954, /* PAL Video */
- 16, 80, 160, KdSyncPositive, /* 32.954 */
- 1, 45, 49, KdSyncPositive, /* 52.727 */
- },
-
- /* 640x480 modes */
- { 640, 480, 85, 36000, /* VESA */
- 56, 80, 192, KdSyncNegative, /* 43.269 */
- 1, 25, 29, KdSyncNegative, /* 85.008 */
- },
- { 640, 480, 75, 31500, /* VESA */
- 16, 120, 200, KdSyncNegative, /* 37.500 */
- 1, 16, 20, KdSyncNegative, /* 75.000 */
- },
- { 640, 480, 72, 31500, /* VESA */
- 16, 120, 176, KdSyncNegative, /* 37.861 */
- 1, 20, 24, KdSyncNegative, /* 72.809 */
- },
- { 640, 480, 60, 25175, /* VESA */
- 16, 48, 160, KdSyncNegative, /* 31.469 */
- 10, 33, 45, KdSyncNegative, /* 59.940 */
- },
-
- /* 800x600 modes */
- { 800, 600, 85, 56250, /* VESA */
- 32, 152, 248, KdSyncPositive, /* 53.674 */
- 1, 27, 31, KdSyncPositive, /* 85.061 */
- },
- { 800, 600, 75, 49500, /* VESA */
- 16, 160, 256, KdSyncPositive, /* 46.875 */
- 1, 21, 25, KdSyncPositive, /* 75.000 */
- },
- /* DEFAULT */
-#define MONITOR_TIMING_DEFAULT 9
- { 800, 600, 72, 50000, /* VESA */
- 56, 64, 240, KdSyncPositive, /* 48.077 */
- 37, 23, 66, KdSyncPositive, /* 72.188 */
- },
- { 800, 600, 60, 40000, /* VESA */
- 40, 88, 256, KdSyncPositive, /* 37.879 */
- 1, 23, 28, KdSyncPositive, /* 60.317 */
- },
- { 800, 600, 56, 36000, /* VESA */
- 24, 128, 224, KdSyncPositive, /* 35.156 */
- 1, 22, 25, KdSyncPositive, /* 56.250 */
- },
-
- /* 1024x768 modes */
- { 1024, 768, 85, 94500, /* VESA */
- 48, 208, 352, KdSyncPositive, /* 68.677 */
- 1, 36, 40, KdSyncPositive, /* 84.997 */
- },
- { 1024, 768, 75, 78750, /* VESA */
- 16, 176, 288, KdSyncPositive, /* 60.023 */
- 1, 28, 32, KdSyncPositive, /* 75.029 */
- },
- { 1024, 768, 70, 75000, /* VESA */
- 24, 144, 304, KdSyncNegative, /* 56.476 */
- 3, 29, 38, KdSyncNegative, /* 70.069 */
- },
- { 1024, 768, 60, 65000, /* VESA */
- 24, 160, 320, KdSyncNegative, /* 48.363 */
- 3, 29, 38, KdSyncNegative, /* 60.004 */
- },
-
- /* 1152x864 mode */
- { 1152, 864, 75, 108000, /* VESA */
- 64, 256, 448, KdSyncPositive, /* 67.500 */
- 1, 32, 36, KdSyncPositive, /* 75.000 */
- },
-
- /* 1152x900 modes */
- { 1152, 900, 85, 122500, /* ADDED */
- 48, 208, 384, KdSyncPositive, /* 79.753 */
- 1, 32, 38, KdSyncPositive, /* 85.024 */
- },
- { 1152, 900, 75, 108250, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 70.475 */
- 1, 32, 38, KdSyncPositive, /* 75.133 */
- },
- { 1152, 900, 70, 100250, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 65.267 */
- 2, 32, 38, KdSyncPositive, /* 69.581 */
- },
- { 1152, 900, 66, 95000, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 61.849 */
- 1, 32, 38, KdSyncPositive, /* 65.937 */
- },
-
- /* 1280x960 modes */
- { 1280, 960, 85, 148500, /* VESA */
- 64, 224, 448, KdSyncPositive, /* 85.938 */
- 1, 47, 51, KdSyncPositive, /* 85.002 */
- },
- { 1280, 960, 60, 108000, /* VESA */
- 96, 312, 520, KdSyncPositive, /* 60.000 */
- 1, 36, 40, KdSyncPositive, /* 60.000 */
- },
-
- /* 1280x1024 modes */
- { 1280, 1024, 85, 157500, /* VESA */
- 64, 224, 448, KdSyncPositive, /* 91.146 */
- 1, 44, 48, KdSyncPositive, /* 85.024 */
- },
- { 1280, 1024, 75, 135000, /* VESA */
- 16, 248, 408, KdSyncPositive, /* 79.976 */
- 1, 38, 42, KdSyncPositive, /* 75.025 */
- },
- { 1280, 1024, 60, 108000, /* VESA */
- 48, 248, 408, KdSyncPositive, /* 63.981 */
- 1, 38, 42, KdSyncPositive, /* 60.020 */
- },
-
- /* 1600x1200 modes */
- { 1600, 1200, 85, 229500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 106.250 */
- 1, 46, 50, KdSyncPositive, /* 85.000 */
- },
- { 1600, 1200, 75, 202500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 93.750 */
- 1, 46, 50, KdSyncPositive, /* 75.000 */
- },
- { 1600, 1200, 70, 189000, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 87.500 */
- 1, 46, 50, KdSyncPositive, /* 70.000 */
- },
- { 1600, 1200, 65, 175500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 81.250 */
- 1, 46, 50, KdSyncPositive, /* 65.000 */
- },
- { 1600, 1200, 60, 162000, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 75.000 */
- 1, 46, 50, KdSyncPositive, /* 60.000 */
- },
-
- /* 1792x1344 modes */
- { 1792, 1344, 85, 301500, /* ADDED */
- 96, 352, 672, KdSyncNegative, /* 122.362 */
- 1, 92, 96, KdSyncPositive, /* 84.974 */
- },
- { 1792, 1344, 75, 261000, /* VESA */
- 96, 352, 664, KdSyncNegative, /* 106.270 */
- 1, 69, 73, KdSyncPositive, /* 74.997 */
- },
- { 1792, 1344, 60, 204750, /* VESA */
- 128, 328, 656, KdSyncNegative, /* 83.640 */
- 1, 46, 50, KdSyncPositive, /* 60.000 */
- },
-
-#if 0
- { 1800, 1012, 75 },
- { 1906, 1072, 68 },
-#endif
-
- /* 1856x1392 modes */
- { 1856, 1392, 85, 330500, /* ADDED */
- 160, 352, 736, KdSyncNegative, /* 127.508 */
- 1, 104, 108, KdSyncPositive, /* 85.001 */
- },
- { 1856, 1392, 75, 288000, /* VESA */
- 128, 352, 704, KdSyncNegative, /* 112.500 */
- 1, 104, 108, KdSyncPositive, /* 75.000 */
- },
- { 1856, 1392, 60, 218250, /* VESA */
- 96, 352, 672, KdSyncNegative, /* 86.333 */
- 1, 43, 47, KdSyncPositive, /* 59.995 */
- },
-
- /* 1920x1440 modes */
- { 1920, 1440, 85, 341750, /* ADDED */
- 160, 352, 760, KdSyncNegative, /* 127.512 */
- 1, 56, 60, KdSyncPositive, /* 85.012 */
- },
- { 1920, 1440, 75, 297000, /* VESA */
- 144, 352, 720, KdSyncNegative, /* 112.500 */
- 1, 56, 60, KdSyncPositive, /* 75.000 */
- },
- { 1920, 1440, 60, 234000, /* VESA */
- 128, 244, 680, KdSyncNegative, /* 90.000 */
- 1, 56, 60, KdSyncPositive, /* 60.000 */
- },
-};
-
-#define NUM_MONITOR_TIMINGS (sizeof kdMonitorTimings/sizeof kdMonitorTimings[0])
-
-const int kdNumMonitorTimings = NUM_MONITOR_TIMINGS;
-
-const KdMonitorTiming *
-KdFindMode (KdScreenInfo *screen,
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *))
-{
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if ((*supported) (screen, t) &&
- t->horizontal == screen->width &&
- t->vertical == screen->height &&
- (!screen->rate || t->rate <= screen->rate))
- {
- return t;
- }
- }
- return &kdMonitorTimings[MONITOR_TIMING_DEFAULT];
-}
-
-static const KdMonitorTiming *
-kdFindPrevSize (const KdMonitorTiming *old)
-{
- const KdMonitorTiming *new, *prev;
-
- if (old == kdMonitorTimings)
- return 0;
- new = old;
- /*
- * Search for the previous size
- */
- while (new != kdMonitorTimings)
- {
- new--;
- if (new->horizontal != old->horizontal &&
- new->vertical != old->vertical)
- {
- break;
- }
- }
- /*
- * Match the refresh rate (<=)
- */
- while (new != kdMonitorTimings)
- {
- prev = new - 1;
- if (prev->horizontal == new->horizontal &&
- prev->vertical == new->vertical &&
- prev->rate > old->rate)
- {
- break;
- }
- new--;
- }
- return new;
-}
-
-Bool
-KdTuneMode (KdScreenInfo *screen,
- Bool (*usable) (KdScreenInfo *),
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *))
-{
- const KdMonitorTiming *t;
-
- while (!(*usable) (screen))
- {
- /*
- * Fix requested depth and geometry until it works
- */
- if (screen->fb[1].depth)
- screen->fb[1].depth = 0;
- else if (screen->fb[0].depth > 16)
- screen->fb[0].depth = 16;
- else if (screen->fb[0].depth > 8)
- screen->fb[0].depth = 8;
- else
- {
- t = kdFindPrevSize (KdFindMode (screen, supported));
- if (!t)
- return FALSE;
- screen->width = t->horizontal;
- screen->height = t->vertical;
- screen->rate = t->rate;
- }
- }
- return TRUE;
-}
-
-#ifdef RANDR
-Bool
-KdRandRGetInfo (ScreenPtr pScreen,
- int randr,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *))
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if ((*supported) (pScreen, t))
- {
- RRScreenSizePtr pSize;
-
- pSize = RRRegisterSize (pScreen,
- t->horizontal,
- t->vertical,
- screen->width_mm,
- screen->height_mm);
- if (!pSize)
- return FALSE;
- if (!RRRegisterRate (pScreen, pSize, t->rate))
- return FALSE;
- if (t->horizontal == screen->width &&
- t->vertical == screen->height &&
- t->rate == screen->rate)
- RRSetCurrentConfig (pScreen, randr, t->rate, pSize);
- }
- }
-
- return TRUE;
-}
-
-const KdMonitorTiming *
-KdRandRGetTiming (ScreenPtr pScreen,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *),
- int rate,
- RRScreenSizePtr pSize)
-{
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if (t->horizontal == pSize->width &&
- t->vertical == pSize->height &&
- t->rate == rate &&
- (*supported) (pScreen, t))
- return t;
- }
- return 0;
-}
-#endif
diff --git a/hw/kdrive/src/knoop.c b/hw/kdrive/src/knoop.c
deleted file mode 100644
index 26d7642f9..000000000
--- a/hw/kdrive/src/knoop.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Id: knoop.c,v 1.2 1999/11/02 06:16:28 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/knoop.c,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-
-/*
- * GC ops that don't do anything
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <gcstruct.h>
-
-typedef void (* typeFillSpans)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-#endif
-);
-
-typedef void (* typeSetSpans)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- char * /*psrc*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- int /*nspans*/,
- int /*fSorted*/
-#endif
-);
-
-typedef void (* typePutImage)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*depth*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*leftPad*/,
- int /*format*/,
- char * /*pBits*/
-#endif
-);
-
-typedef RegionPtr (* typeCopyArea)(
-#if NeedNestedPrototypes
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*w*/,
- int /*h*/,
- int /*dstx*/,
- int /*dsty*/
-#endif
-);
-
-typedef RegionPtr (* typeCopyPlane)(
-#if NeedNestedPrototypes
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*bitPlane*/
-#endif
-);
-typedef void (* typePolyPoint)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-#endif
-);
-
-typedef void (* typePolylines)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-#endif
-);
-
-typedef void (* typePolySegment)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegs*/
-#endif
-);
-
-typedef void (* typePolyRectangle)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrects*/,
- xRectangle * /*pRects*/
-#endif
-);
-
-typedef void (* typePolyArc)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-#endif
-);
-
-typedef void (* typeFillPolygon)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*pPts*/
-#endif
-);
-
-typedef void (* typePolyFillRect)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrectFill*/,
- xRectangle * /*prectInit*/
-#endif
-);
-
-typedef void (* typePolyFillArc)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-#endif
-);
-
-typedef int (* typePolyText8)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-#endif
-);
-
-typedef int (* typePolyText16)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-#endif
-);
-
-typedef void (* typeImageText8)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-#endif
-);
-
-typedef void (* typeImageText16)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-#endif
-);
-
-typedef void (* typeImageGlyphBlt)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-#endif
-);
-
-typedef void (* typePolyGlyphBlt)(
-#if NeedNestedPrototypes
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-#endif
-);
-
-typedef void (* typePushPixels)(
-#if NeedNestedPrototypes
- GCPtr /*pGC*/,
- PixmapPtr /*pBitMap*/,
- DrawablePtr /*pDst*/,
- int /*w*/,
- int /*h*/,
- int /*x*/,
- int /*y*/
-#endif
-);
-
-static RegionPtr
-KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- return NullRegion;
-}
-
-static RegionPtr
-KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- return NullRegion;
-}
-
-GCOps kdNoopOps = {
- (typeFillSpans) NoopDDA, /* fill spans */
- (typeSetSpans) NoopDDA, /* set spans */
- (typePutImage) NoopDDA, /* put image */
- KdNoopCopyArea, /* copy area */
- KdNoopCopyPlane, /* copy plane */
- (typePolyPoint) NoopDDA, /* poly point */
- (typePolylines) NoopDDA, /* poly lines */
- (typePolySegment) NoopDDA, /* poly segment */
- (typePolyRectangle) NoopDDA, /* poly rectangle */
- (typePolyArc) NoopDDA, /* poly arc */
- (typeFillPolygon) NoopDDA, /* fill polygon */
- (typePolyFillRect) NoopDDA, /* poly fillrect */
- (typePolyFillArc) NoopDDA, /* poly fillarc */
- (typePolyText8) NoopDDA, /* text 8 */
- (typePolyText16) NoopDDA, /* text 16 */
- (typeImageText8) NoopDDA, /* itext 8 */
- (typeImageText16) NoopDDA, /* itext 16 */
- (typePolyGlyphBlt) NoopDDA, /* glyph blt */
- (typeImageGlyphBlt) NoopDDA, /* iglyph blt */
- (typePushPixels) NoopDDA, /* push pixels */
-#ifdef NEED_LINEHELPER
- (typeLineHelper) NULL,
-#endif
-};
diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c
deleted file mode 100644
index 71dfa6bb0..000000000
--- a/hw/kdrive/src/koffscreen.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-#define DEBUG_OFFSCREEN 0
-#if DEBUG_OFFSCREEN
-#define DBG_OFFSCREEN(a) ErrorF a
-#else
-#define DBG_OFFSCREEN(a)
-#endif
-
-typedef struct _RealOffscreenArea {
- KdOffscreenArea area;
-
- KdOffscreenSaveProc save;
-
- Bool locked;
-
- struct _RealOffscreenArea *prev;
- struct _RealOffscreenArea *next;
-} RealOffscreenArea;
-
-#if DEBUG_OFFSCREEN
-static void
-KdOffscreenValidate (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- RealOffscreenArea *prev = 0, *area;
-
- assert (pScreenPriv->screen->off_screen_areas->area.offset == 0);
- for (area = pScreenPriv->screen->off_screen_areas; area; area = area->next)
- {
- if (prev)
- assert (prev->area.offset + prev->area.size == area->area.offset);
-
- prev = area;
- }
- assert (prev->area.offset + prev->area.size == pScreenPriv->screen->memory_size);
-}
-#else
-#define KdOffscreenValidate(s)
-#endif
-
-static void
-KdOffscreenKickOut (KdOffscreenArea *area)
-{
- RealOffscreenArea *real_area = (RealOffscreenArea *) area;
- if (real_area->save)
- (*real_area->save) (area);
- KdOffscreenFree (area);
-}
-
-KdOffscreenArea *
-KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
- Bool locked,
- KdOffscreenSaveProc save,
- pointer privData)
-{
- RealOffscreenArea *area, **prev;
- KdScreenPriv (pScreen);
- int tmp, real_size = 0;
-
- KdOffscreenValidate (pScreen);
- if (!align)
- align = 1;
-
- if (!size)
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size));
- return NULL;
- }
-
- /* throw out requests that cannot fit */
- if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base))
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size));
- return NULL;
- }
-
- /* Go through the areas */
- for (area = pScreenPriv->screen->off_screen_areas; area; area = area->next)
- {
- /* skip allocated areas */
- if (area->area.screen)
- continue;
-
- /* adjust size to match alignment requirement */
- real_size = size;
- tmp = area->area.offset % align;
- if (tmp)
- real_size += (align - tmp);
-
- /* does it fit? */
- if (real_size <= area->area.size)
- break;
- }
-
- if (!area)
- {
- /*
- * Kick out existing users to make space.
- *
- * First, locate a region which can hold the desired object.
- */
-
- /* prev points at the first object to boot */
- prev = (RealOffscreenArea **) &pScreenPriv->screen->off_screen_areas;
- while ((area = *prev))
- {
- int avail;
- RealOffscreenArea *scan;
-
- /* adjust size to match alignment requirement */
- real_size = size;
- tmp = area->area.offset % align;
- if (tmp)
- real_size += (align - tmp);
-
- avail = 0;
- /* now see if we can make room here */
- for (scan = area; scan; scan = scan->next)
- {
- if (scan->locked)
- break;
- avail += scan->area.size;
- if (avail >= real_size)
- break;
- }
- /* space? */
- if (avail >= real_size)
- break;
-
- /* nope, try the next area */
- prev = &scan->next;
- }
- if (!area)
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
- /* Could not allocate memory */
- KdOffscreenValidate (pScreen);
- return NULL;
- }
-
- /*
- * Kick out first area if in use
- */
- if (area->area.screen)
- KdOffscreenKickOut (&area->area);
- /*
- * Now get the system to merge the other needed areas together
- */
- while (area->area.size < real_size)
- {
- assert (area->next && area->next->area.screen);
- KdOffscreenKickOut (&area->next->area);
- }
- }
-
- /* save extra space in new area */
- if (real_size < area->area.size)
- {
- RealOffscreenArea *new_area = xalloc (sizeof (RealOffscreenArea));
- if (!new_area)
- return NULL;
- new_area->area.offset = area->area.offset + real_size;
- new_area->area.size = area->area.size - real_size;
- new_area->area.screen = 0;
- new_area->locked = FALSE;
- new_area->save = 0;
- if ((new_area->next = area->next))
- new_area->next->prev = new_area;
- new_area->prev = area;
- area->next = new_area;
- area->area.size = real_size;
- }
- /*
- * Mark this area as in use
- */
- area->area.screen = pScreen;
- area->area.privData = privData;
- area->locked = locked;
- area->save = save;
-
- KdOffscreenValidate (pScreen);
-
- DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x\n", size, area->area.offset));
- return &area->area;
-}
-
-void
-KdOffscreenSwapOut (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
-
- KdOffscreenValidate (pScreen);
- /* loop until a single free area spans the space */
- for (;;)
- {
- RealOffscreenArea *area = pScreenPriv->screen->off_screen_areas;
-
- if (!area)
- break;
- if (!area->area.screen)
- {
- area = area->next;
- if (!area)
- break;
- }
- assert (area->area.screen);
- KdOffscreenKickOut (&area->area);
- KdOffscreenValidate (pScreen);
- }
- KdOffscreenValidate (pScreen);
- KdOffscreenFini (pScreen);
-}
-
-void
-KdOffscreenSwapIn (ScreenPtr pScreen)
-{
- KdOffscreenInit (pScreen);
-}
-
-/* merge the next free area into this one */
-static void
-KdOffscreenMerge (KdOffscreenArea *area)
-{
- RealOffscreenArea *real_area = (RealOffscreenArea *) area;
- RealOffscreenArea *next = real_area->next;
-
- /* account for space */
- real_area->area.size += next->area.size;
- /* frob pointers */
- if ((real_area->next = next->next))
- real_area->next->prev = real_area;
- xfree (next);
-}
-
-void
-KdOffscreenFree (KdOffscreenArea *area)
-{
- RealOffscreenArea *real_area = (RealOffscreenArea *) area;
- RealOffscreenArea *next = real_area->next;
- RealOffscreenArea *prev = real_area->prev;
-
- DBG_OFFSCREEN (("Free 0x%x -> 0x%x\n", area->size, area->offset));
- KdOffscreenValidate (pScreen);
-
- area->screen = NULL;
-
- /* link with next area if free */
- if (next && !next->area.screen)
- KdOffscreenMerge (&real_area->area);
-
- /* link with prev area if free */
- if (prev && !prev->area.screen)
- KdOffscreenMerge (&prev->area);
-
- KdOffscreenValidate (pScreen);
-}
-
-Bool
-KdOffscreenInit (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- RealOffscreenArea *area;
-
- /* Allocate a big free area */
- area = xalloc (sizeof (RealOffscreenArea));
-
- if (!area)
- return FALSE;
-
- area->area.screen = NULL;
- area->area.offset = pScreenPriv->screen->off_screen_base;
- area->area.size = pScreenPriv->screen->memory_size - area->area.offset;
- area->save = 0;
- area->locked = FALSE;
- area->next = NULL;
- area->prev = NULL;
-
- /* Add it to the free areas */
- pScreenPriv->screen->off_screen_areas = area;
-
- KdOffscreenValidate (pScreen);
-
- return TRUE;
-}
-
-void
-KdOffscreenFini (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- RealOffscreenArea *area;
-
- /* just free all of the area records */
- while ((area = pScreenPriv->screen->off_screen_areas))
- {
- pScreenPriv->screen->off_screen_areas = area->next;
- xfree (area);
- }
-}
diff --git a/hw/kdrive/src/kpict.c b/hw/kdrive/src/kpict.c
deleted file mode 100644
index 25fb449a0..000000000
--- a/hw/kdrive/src/kpict.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <picturestr.h>
-#include <mipict.h>
-#include <fbpict.h>
-
-void
-KdCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- KdCheckSync (pDst->pDrawable->pScreen);
- fbComposite (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
-}
-
-void
-KdPictureInitAsync (ScreenPtr pScreen)
-{
- PictureScreenPtr ps;
-
- ps = GetPictureScreen(pScreen);
- ps->Composite = KdCheckComposite;
-}
diff --git a/hw/kdrive/src/kshadow.c b/hw/kdrive/src/kshadow.c
deleted file mode 100644
index f4b593f26..000000000
--- a/hw/kdrive/src/kshadow.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-Bool
-KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate)
-{
- int paddedWidth;
- void *buf;
- int width = rotate ? screen->height : screen->width;
- int height = rotate ? screen->width : screen->height;
- int bpp = screen->fb[fb].bitsPerPixel;
-
- /* use fb computation for width */
- paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
- buf = xalloc (paddedWidth * height);
- if (!buf)
- return FALSE;
- if (screen->fb[fb].shadow)
- xfree (screen->fb[fb].frameBuffer);
- screen->fb[fb].shadow = TRUE;
- screen->fb[fb].frameBuffer = buf;
- screen->fb[fb].byteStride = paddedWidth;
- screen->fb[fb].pixelStride = paddedWidth * 8 / bpp;
- return TRUE;
-}
-
-void
-KdShadowFbFree (KdScreenInfo *screen, int fb)
-{
- if (screen->fb[fb].shadow)
- {
- xfree (screen->fb[fb].frameBuffer);
- screen->fb[fb].frameBuffer = 0;
- screen->fb[fb].shadow = FALSE;
- }
-}
-
-Bool
-KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int fb;
-
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (screen->fb[fb].shadow)
- return shadowSet (pScreen, (*pScreen->GetScreenPixmap) (pScreen),
- update, window, randr, 0);
- else
- shadowUnset (pScreen);
- }
- return TRUE;
-}
-
-void
-KdShadowUnset (ScreenPtr pScreen)
-{
- shadowUnset (pScreen);
-}
diff --git a/hw/kdrive/src/ktest.c b/hw/kdrive/src/ktest.c
deleted file mode 100644
index 3fe3739a5..000000000
--- a/hw/kdrive/src/ktest.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Id: ktest.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/ktest.c,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-
-static CARD8 memoryPatterns[] = { 0xff, 0x00, 0x5a, 0xa5, 0xaa, 0x55 };
-
-#define NUM_PATTERNS (sizeof (memoryPatterns) / sizeof (memoryPatterns[0]))
-
-Bool
-KdFrameBufferValid (CARD8 *base, int size)
-{
- volatile CARD8 *b = (volatile CARD8 *) base;
- CARD8 save, test, compare;
- int i, j;
-
- b = base + (size - 1);
- save = *b;
-
- for (i = 0; i < NUM_PATTERNS; i++)
- {
- test = memoryPatterns[i];
- *b = test;
- for (j = 0; j < 1000; j++)
- {
- compare = *b;
- if (compare != test)
- return FALSE;
- }
- }
- *b = save;
- return TRUE;
-}
-
-int
-KdFrameBufferSize (CARD8 *base, int max)
-{
- int min, cur;
-
- min = 0;
- while (min + 1 < max)
- {
- cur = (max + min) / 2;
- if (KdFrameBufferValid (base, cur))
- min = cur;
- else
- max = cur;
- }
- if (KdFrameBufferValid (base, max))
- return max;
- else
- return min;
-}
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
deleted file mode 100644
index ea36bc788..000000000
--- a/hw/kdrive/src/kxv.c
+++ /dev/null
@@ -1,1779 +0,0 @@
-/*
-
- XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
- Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
-
- Copyright (C) 2000, 2001 - Nokia Home Communications
- Copyright (C) 1998, 1999 - 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 in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-*/
-
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kxv.c,v 1.3 2001/08/09 09:08:54 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mivalidate.h"
-#include "validate.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
-
-#include "kxv.h"
-
-
-/* XvScreenRec fields */
-
-static Bool KdXVCloseScreen(int, ScreenPtr);
-static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
-
-/* XvAdaptorRec fields */
-
-static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
-static int KdXVFreePort(XvPortPtr);
-static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
-static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
-static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
- CARD16, CARD16,CARD16, CARD16,
- unsigned int*, unsigned int*);
-static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16,
- XvImagePtr, unsigned char*, Bool,
- CARD16, CARD16);
-static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
- CARD16*, CARD16*, int*, int*);
-
-
-/* ScreenRec fields */
-
-static Bool KdXVCreateWindow(WindowPtr pWin);
-static Bool KdXVDestroyWindow(WindowPtr pWin);
-static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
-static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
-
-/* misc */
-static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
-
-
-int KdXVWindowIndex = -1;
-int KdXvScreenIndex = -1;
-static unsigned long KdXVGeneration = 0;
-static unsigned long PortResource = 0;
-
-int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex;
-unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
-int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
-
-#define GET_XV_SCREEN(pScreen) \
- ((XvScreenPtr)((pScreen)->devPrivates[KdXvScreenIndex].ptr))
-
-#define GET_KDXV_SCREEN(pScreen) \
- ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
-
-#define GET_KDXV_WINDOW(pWin) \
- ((KdXVWindowPtr)((pWin)->devPrivates[KdXVWindowIndex].ptr))
-
-static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
-static int NumGenDrivers = 0;
-
-int
-KdXVRegisterGenericAdaptorDriver(
- KdXVInitGenericAdaptorPtr InitFunc
-){
- KdXVInitGenericAdaptorPtr *newdrivers;
-
-/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
-
- newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
- (1 + NumGenDrivers));
- if (!newdrivers)
- return 0;
- GenDrivers = newdrivers;
-
- GenDrivers[NumGenDrivers++] = InitFunc;
-
- return 1;
-}
-
-int
-KdXVListGenericAdaptors(
- KdScreenInfo * screen,
- KdVideoAdaptorPtr **adaptors
-){
- int i,j,n,num;
- KdVideoAdaptorPtr *DrivAdap,*new;
-
- num = 0;
- *adaptors = NULL;
- for (i = 0; i < NumGenDrivers; i++) {
- n = GenDrivers[i](screen,&DrivAdap);
- if (0 == n)
- continue;
- new = xrealloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n));
- if (NULL == new)
- continue;
- *adaptors = new;
- for (j = 0; j < n; j++, num++)
- (*adaptors)[num] = DrivAdap[j];
- }
- return num;
-}
-
-KdVideoAdaptorPtr
-KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
-{
- return xcalloc(1, sizeof(KdVideoAdaptorRec));
-}
-
-void
-KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
-{
- xfree(ptr);
-}
-
-
-Bool
-KdXVScreenInit(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *adaptors,
- int num
-){
- KdXVScreenPtr ScreenPriv;
- XvScreenPtr pxvs;
-
-/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
-
- if(KdXVGeneration != serverGeneration) {
- if((KdXVWindowIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
- KdXVGeneration = serverGeneration;
- }
-
- if(!AllocateWindowPrivate(pScreen,KdXVWindowIndex,0))
- return FALSE;
-
- if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
-
- if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
-
- KdXvScreenIndex = (*XvGetScreenIndexProc)();
- PortResource = (*XvGetRTPortProc)();
-
- pxvs = GET_XV_SCREEN(pScreen);
-
-
- /* Anyone initializing the Xv layer must provide these two.
- The Xv di layer calls them without even checking if they exist! */
-
- pxvs->ddCloseScreen = KdXVCloseScreen;
- pxvs->ddQueryAdaptors = KdXVQueryAdaptors;
-
- /* The Xv di layer provides us with a private hook so that we don't
- have to allocate our own screen private. They also provide
- a CloseScreen hook so that we don't have to wrap it. I'm not
- sure that I appreciate that. */
-
- ScreenPriv = xalloc(sizeof(KdXVScreenRec));
- pxvs->devPriv.ptr = (pointer)ScreenPriv;
-
- if(!ScreenPriv) return FALSE;
-
-
- ScreenPriv->CreateWindow = pScreen->CreateWindow;
- ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- ScreenPriv->WindowExposures = pScreen->WindowExposures;
- ScreenPriv->ClipNotify = pScreen->ClipNotify;
-
-/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
-
- pScreen->CreateWindow = KdXVCreateWindow;
- pScreen->DestroyWindow = KdXVDestroyWindow;
- pScreen->WindowExposures = KdXVWindowExposures;
- pScreen->ClipNotify = KdXVClipNotify;
-
- if(!KdXVInitAdaptors(pScreen, adaptors, num))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
-{
- int i;
-
- if(pAdaptor->name)
- xfree(pAdaptor->name);
-
- if(pAdaptor->pEncodings) {
- XvEncodingPtr pEncode = pAdaptor->pEncodings;
-
- for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
- if(pEncode->name) xfree(pEncode->name);
- }
- xfree(pAdaptor->pEncodings);
- }
-
- if(pAdaptor->pFormats)
- xfree(pAdaptor->pFormats);
-
- if(pAdaptor->pPorts) {
- XvPortPtr pPort = pAdaptor->pPorts;
- XvPortRecPrivatePtr pPriv;
-
- for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv) {
- if(pPriv->clientClip)
- REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
- xfree(pPriv);
- }
- }
- xfree(pAdaptor->pPorts);
- }
-
- if(pAdaptor->nAttributes) {
- XvAttributePtr pAttribute = pAdaptor->pAttributes;
-
- for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
- if(pAttribute->name) xfree(pAttribute->name);
- }
-
- xfree(pAdaptor->pAttributes);
- }
-
- if(pAdaptor->nImages)
- xfree(pAdaptor->pImages);
-
- if(pAdaptor->devPriv.ptr)
- xfree(pAdaptor->devPriv.ptr);
-}
-
-static Bool
-KdXVInitAdaptors(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *infoPtr,
- int number
-) {
- KdScreenPriv(pScreen);
- KdScreenInfo * screen = pScreenPriv->screen;
-
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- KdVideoAdaptorPtr adaptorPtr;
- XvAdaptorPtr pAdaptor, pa;
- XvAdaptorRecPrivatePtr adaptorPriv;
- int na, numAdaptor;
- XvPortRecPrivatePtr portPriv;
- XvPortPtr pPort, pp;
- int numPort;
- KdAttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
- KdVideoFormatPtr formatPtr;
- XvFormatPtr pFormat, pf;
- int numFormat, totFormat;
- KdVideoEncodingPtr encodingPtr;
- XvEncodingPtr pEncode, pe;
- KdImagePtr imagePtr;
- XvImagePtr pImage, pi;
- int numVisuals;
- VisualPtr pVisual;
- int i;
-
- pxvs->nAdaptors = 0;
- pxvs->pAdaptors = NULL;
-
- if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
- return FALSE;
-
- for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
- adaptorPtr = infoPtr[na];
-
- if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
- !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
- continue;
-
- /* client libs expect at least one encoding */
- if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
- continue;
-
- pa->type = adaptorPtr->type;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
- pa->type &= ~XvVideoMask;
-
- if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
- pa->type &= ~XvStillMask;
-
- if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
- pa->type &= ~XvImageMask;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
- !adaptorPtr->PutStill)
- pa->type &= ~XvInputMask;
-
- if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
- pa->type &= ~XvOutputMask;
-
- if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
- continue;
- if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
- continue;
-
- pa->pScreen = pScreen;
- pa->ddAllocatePort = KdXVAllocatePort;
- pa->ddFreePort = KdXVFreePort;
- pa->ddPutVideo = KdXVPutVideo;
- pa->ddPutStill = KdXVPutStill;
- pa->ddGetVideo = KdXVGetVideo;
- pa->ddGetStill = KdXVGetStill;
- pa->ddStopVideo = KdXVStopVideo;
- pa->ddPutImage = KdXVPutImage;
- pa->ddSetPortAttribute = KdXVSetPortAttribute;
- pa->ddGetPortAttribute = KdXVGetPortAttribute;
- pa->ddQueryBestSize = KdXVQueryBestSize;
- pa->ddQueryImageAttributes = KdXVQueryImageAttributes;
- if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
- strcpy(pa->name, adaptorPtr->name);
-
- if(adaptorPtr->nEncodings &&
- (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
-
- for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
- i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
- {
- pe->id = encodingPtr->id;
- pe->pScreen = pScreen;
- if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
- strcpy(pe->name, encodingPtr->name);
- pe->width = encodingPtr->width;
- pe->height = encodingPtr->height;
- pe->rate.numerator = encodingPtr->rate.numerator;
- pe->rate.denominator = encodingPtr->rate.denominator;
- }
- pa->nEncodings = adaptorPtr->nEncodings;
- pa->pEncodings = pEncode;
- }
-
- if(adaptorPtr->nImages &&
- (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++)
- {
- pi->id = imagePtr->id;
- pi->type = imagePtr->type;
- pi->byte_order = imagePtr->byte_order;
- memcpy(pi->guid, imagePtr->guid, 16);
- pi->bits_per_pixel = imagePtr->bits_per_pixel;
- pi->format = imagePtr->format;
- pi->num_planes = imagePtr->num_planes;
- pi->depth = imagePtr->depth;
- pi->red_mask = imagePtr->red_mask;
- pi->green_mask = imagePtr->green_mask;
- pi->blue_mask = imagePtr->blue_mask;
- pi->y_sample_bits = imagePtr->y_sample_bits;
- pi->u_sample_bits = imagePtr->u_sample_bits;
- pi->v_sample_bits = imagePtr->v_sample_bits;
- pi->horz_y_period = imagePtr->horz_y_period;
- pi->horz_u_period = imagePtr->horz_u_period;
- pi->horz_v_period = imagePtr->horz_v_period;
- pi->vert_y_period = imagePtr->vert_y_period;
- pi->vert_u_period = imagePtr->vert_u_period;
- pi->vert_v_period = imagePtr->vert_v_period;
- memcpy(pi->component_order, imagePtr->component_order, 32);
- pi->scanline_order = imagePtr->scanline_order;
- }
- pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
- }
-
- if(adaptorPtr->nAttributes &&
- (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
- {
- for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
- i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
- {
- pat->flags = attributePtr->flags;
- pat->min_value = attributePtr->min_value;
- pat->max_value = attributePtr->max_value;
- if((pat->name = xalloc(strlen(attributePtr->name) + 1)))
- strcpy(pat->name, attributePtr->name);
- }
- pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
- }
-
-
- totFormat = adaptorPtr->nFormats;
-
- if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
- for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
- i < adaptorPtr->nFormats; i++, formatPtr++)
- {
- numVisuals = pScreen->numVisuals;
- pVisual = pScreen->visuals;
-
- while(numVisuals--) {
- if((pVisual->class == formatPtr->class) &&
- (pVisual->nplanes == formatPtr->depth)) {
-
- if(numFormat >= totFormat) {
- void *moreSpace;
- totFormat *= 2;
- moreSpace = xrealloc(pFormat,
- totFormat * sizeof(XvFormatRec));
- if(!moreSpace) break;
- pFormat = moreSpace;
- pf = pFormat + numFormat;
- }
-
- pf->visual = pVisual->vid;
- pf->depth = formatPtr->depth;
-
- pf++;
- numFormat++;
- }
- pVisual++;
- }
- }
- pa->nFormats = numFormat;
- pa->pFormats = pFormat;
- if(!numFormat) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- adaptorPriv->flags = adaptorPtr->flags;
- adaptorPriv->PutVideo = adaptorPtr->PutVideo;
- adaptorPriv->PutStill = adaptorPtr->PutStill;
- adaptorPriv->GetVideo = adaptorPtr->GetVideo;
- adaptorPriv->GetStill = adaptorPtr->GetStill;
- adaptorPriv->StopVideo = adaptorPtr->StopVideo;
- adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
- adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
- adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
- adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
- adaptorPriv->PutImage = adaptorPtr->PutImage;
- adaptorPriv->ReputImage = adaptorPtr->ReputImage;
-
- pa->devPriv.ptr = (pointer)adaptorPriv;
-
- if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
- for(pp = pPort, i = 0, numPort = 0;
- i < adaptorPtr->nPorts; i++) {
-
- if(!(pp->id = FakeClientID(0)))
- continue;
-
- if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
- continue;
-
- if(!AddResource(pp->id, PortResource, pp)) {
- xfree(portPriv);
- continue;
- }
-
- pp->pAdaptor = pa;
- pp->pNotify = (XvPortNotifyPtr)NULL;
- pp->pDraw = (DrawablePtr)NULL;
- pp->client = (ClientPtr)NULL;
- pp->grab.client = (ClientPtr)NULL;
- pp->time = currentTime;
- pp->devPriv.ptr = portPriv;
-
- portPriv->screen = screen;
- portPriv->AdaptorRec = adaptorPriv;
- portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
-
- pp++;
- numPort++;
- }
- pa->nPorts = numPort;
- pa->pPorts = pPort;
- if(!numPort) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- pa->base_id = pPort->id;
-
- pa++;
- numAdaptor++;
- }
-
- if(numAdaptor) {
- pxvs->nAdaptors = numAdaptor;
- pxvs->pAdaptors = pAdaptor;
- } else {
- xfree(pAdaptor);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Video should be clipped to the intersection of the window cliplist
- and the client cliplist specified in the GC for which the video was
- initialized. When we need to reclip a window, the GC that started
- the video may not even be around anymore. That's why we save the
- client clip from the GC when the video is initialized. We then
- use KdXVUpdateCompositeClip to calculate the new composite clip
- when we need it. This is different from what DEC did. They saved
- the GC and used it's clip list when they needed to reclip the window,
- even if the client clip was different from the one the video was
- initialized with. If the original GC was destroyed, they had to stop
- the video. I like the new method better (MArk).
-
- This function only works for windows. Will need to rewrite when
- (if) we support pixmap rendering.
-*/
-
-static void
-KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
-{
- RegionPtr pregWin, pCompositeClip;
- WindowPtr pWin;
- Bool freeCompClip = FALSE;
-
- if(portPriv->pCompositeClip)
- return;
-
- pWin = (WindowPtr)portPriv->pDraw;
-
- /* get window clip list */
- if(portPriv->subWindowMode == IncludeInferiors) {
- pregWin = NotClippedByChildren(pWin);
- freeCompClip = TRUE;
- } else
- pregWin = &pWin->clipList;
-
- if(!portPriv->clientClip) {
- portPriv->pCompositeClip = pregWin;
- portPriv->FreeCompositeClip = freeCompClip;
- return;
- }
-
- pCompositeClip = REGION_CREATE(pWin->pScreen, NullBox, 1);
- REGION_COPY(pWin->pScreen, pCompositeClip, portPriv->clientClip);
- REGION_TRANSLATE(pWin->pScreen, pCompositeClip,
- portPriv->pDraw->x + portPriv->clipOrg.x,
- portPriv->pDraw->y + portPriv->clipOrg.y);
- REGION_INTERSECT(pWin->pScreen, pCompositeClip, pregWin, pCompositeClip);
-
- portPriv->pCompositeClip = pCompositeClip;
- portPriv->FreeCompositeClip = TRUE;
-
- if(freeCompClip) {
- REGION_DESTROY(pWin->pScreen, pregWin);
- }
-}
-
-/* Save the current clientClip and update the CompositeClip whenever
- we have a fresh GC */
-
-static void
-KdXVCopyClip(
- XvPortRecPrivatePtr portPriv,
- GCPtr pGC
-){
- /* copy the new clip if it exists */
- if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
- if(!portPriv->clientClip)
- portPriv->clientClip = REGION_CREATE(pGC->pScreen, NullBox, 1);
- /* Note: this is in window coordinates */
- REGION_COPY(pGC->pScreen, portPriv->clientClip, pGC->clientClip);
- } else if(portPriv->clientClip) { /* free the old clientClip */
- REGION_DESTROY(pGC->pScreen, portPriv->clientClip);
- portPriv->clientClip = NULL;
- }
-
- /* get rid of the old clip list */
- if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
- REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip);
- }
-
- portPriv->clipOrg = pGC->clipOrg;
- portPriv->pCompositeClip = pGC->pCompositeClip;
- portPriv->FreeCompositeClip = FALSE;
- portPriv->subWindowMode = pGC->subWindowMode;
-}
-
-static int
-KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if(ret == Success)
- portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- REGION_UNINIT(portPriv->pDraw->pScreen, &WinRegion);
- REGION_UNINIT(portPriv->pDraw->pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVReputVideo(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if(ret == Success) portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-static int
-KdXVReputImage(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->screen, portPriv->pDraw,
- WinBox.x1, WinBox.y1,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVReputAllVideo(WindowPtr pWin, pointer data)
-{
- KdXVWindowPtr WinPriv;
-
- if (pWin->drawable.type != DRAWABLE_WINDOW)
- return WT_DONTWALKCHILDREN;
-
- WinPriv = GET_KDXV_WINDOW(pWin);
-
- while(WinPriv) {
- if(WinPriv->PortRec->type == XvInputMask)
- KdXVReputVideo(WinPriv->PortRec);
- else
- KdXVRegetVideo(WinPriv->PortRec);
- WinPriv = WinPriv->next;
- }
-
- return WT_WALKCHILDREN;
-}
-
-static int
-KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
-{
- KdXVWindowPtr winPriv, PrivRoot;
-
- winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
-
- /* Enlist our port in the window private */
- while(winPriv) {
- if(winPriv->PortRec == portPriv) /* we're already listed */
- break;
- winPriv = winPriv->next;
- }
-
- if(!winPriv) {
- winPriv = xalloc(sizeof(KdXVWindowRec));
- if(!winPriv) return BadAlloc;
- winPriv->PortRec = portPriv;
- winPriv->next = PrivRoot;
- pWin->devPrivates[KdXVWindowIndex].ptr = (pointer)winPriv;
- }
- return Success;
-}
-
-
-static void
-KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
-{
- KdXVWindowPtr winPriv, prevPriv = NULL;
-
- winPriv = GET_KDXV_WINDOW(pWin);
-
- while(winPriv) {
- if(winPriv->PortRec == portPriv) {
- if(prevPriv)
- prevPriv->next = winPriv->next;
- else
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)winPriv->next;
- xfree(winPriv);
- break;
- }
- prevPriv = winPriv;
- winPriv = winPriv->next;
- }
- portPriv->pDraw = NULL;
-}
-
-/**** ScreenRec fields ****/
-
-
-static Bool
-KdXVCreateWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- int ret;
-
- pScreen->CreateWindow = ScreenPriv->CreateWindow;
- ret = (*pScreen->CreateWindow)(pWin);
- pScreen->CreateWindow = KdXVCreateWindow;
-
- if(ret) pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
-
- return ret;
-}
-
-
-static Bool
-KdXVDestroyWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
- int ret;
-
- while(WinPriv) {
- XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
-
- if(pPriv->isOn > XV_OFF) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
- }
-
- pPriv->pDraw = NULL;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- xfree(tmp);
- }
-
- pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
-
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- ret = (*pScreen->DestroyWindow)(pWin);
- pScreen->DestroyWindow = KdXVDestroyWindow;
-
- return ret;
-}
-
-
-static void
-KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
- KdXVWindowPtr pPrev;
- XvPortRecPrivatePtr pPriv;
- Bool AreasExposed;
-
- AreasExposed = (WinPriv && reg1 && REGION_NOTEMPTY(pScreen, reg1));
-
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- (*pScreen->WindowExposures)(pWin, reg1, reg2);
- pScreen->WindowExposures = KdXVWindowExposures;
-
- /* filter out XClearWindow/Area */
- if (!pWin->valdata) return;
-
- pPrev = NULL;
-
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
-
- /* Reput anyone with a reput function */
-
- switch(pPriv->type) {
- case XvInputMask:
- KdXVReputVideo(pPriv);
- break;
- case XvOutputMask:
- KdXVRegetVideo(pPriv);
- break;
- default: /* overlaid still/image*/
- if (pPriv->AdaptorRec->ReputImage)
- KdXVReputImage(pPriv);
- else if(AreasExposed) {
- KdXVWindowPtr tmp;
-
- if (pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
- pPriv->pDraw = NULL;
-
- if(!pPrev)
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)(WinPriv->next);
- else
- pPrev->next = WinPriv->next;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- xfree(tmp);
- continue;
- }
- break;
- }
- pPrev = WinPriv;
- WinPriv = WinPriv->next;
- }
-}
-
-
-static void
-KdXVClipNotify(WindowPtr pWin, int dx, int dy)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
- KdXVWindowPtr tmp, pPrev = NULL;
- XvPortRecPrivatePtr pPriv;
- Bool visible = (pWin->visibility == VisibilityUnobscured) ||
- (pWin->visibility == VisibilityPartiallyObscured);
-
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
-
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- REGION_DESTROY(pScreen, pPriv->pCompositeClip);
-
- pPriv->pCompositeClip = NULL;
-
- /* Stop everything except images, but stop them too if the
- window isn't visible. But we only remove the images. */
-
- if(pPriv->type || !visible) {
- if(pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
-
- if(!pPriv->type) { /* overlaid still/image */
- pPriv->pDraw = NULL;
-
- if(!pPrev)
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)(WinPriv->next);
- else
- pPrev->next = WinPriv->next;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- xfree(tmp);
- continue;
- }
- }
-
- pPrev = WinPriv;
- WinPriv = WinPriv->next;
- }
-
- if(ScreenPriv->ClipNotify) {
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
- (*pScreen->ClipNotify)(pWin, dx, dy);
- pScreen->ClipNotify = KdXVClipNotify;
- }
-}
-
-
-
-/**** Required XvScreenRec fields ****/
-
-static Bool
-KdXVCloseScreen(int i, ScreenPtr pScreen)
-{
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- XvAdaptorPtr pa;
- int c;
-
- if(!ScreenPriv) return TRUE;
-
- pScreen->CreateWindow = ScreenPriv->CreateWindow;
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
-
-/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
-
- for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
- KdXVFreeAdaptor(pa);
- }
-
- if(pxvs->pAdaptors)
- xfree(pxvs->pAdaptors);
-
- xfree(ScreenPriv);
-
-
- return TRUE;
-}
-
-
-static int
-KdXVQueryAdaptors(
- ScreenPtr pScreen,
- XvAdaptorPtr *p_pAdaptors,
- int *p_nAdaptors
-){
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
-
- *p_nAdaptors = pxvs->nAdaptors;
- *p_pAdaptors = pxvs->pAdaptors;
-
- return (Success);
-}
-
-static Bool
-KdXVRunning (ScreenPtr pScreen)
-{
- return (KdXVGeneration == serverGeneration &&
- GET_XV_SCREEN(pScreen) != 0);
-}
-
-Bool
-KdXVEnable(ScreenPtr pScreen)
-{
- if (!KdXVRunning (pScreen))
- return TRUE;
-
- WalkTree(pScreen, KdXVReputAllVideo, 0);
-
- return TRUE;
-}
-
-void
-KdXVDisable(ScreenPtr pScreen)
-{
- XvScreenPtr pxvs;
- KdXVScreenPtr ScreenPriv;
- XvAdaptorPtr pAdaptor;
- XvPortPtr pPort;
- XvPortRecPrivatePtr pPriv;
- int i, j;
-
- if (!KdXVRunning (pScreen))
- return;
-
- pxvs = GET_XV_SCREEN(pScreen);
- ScreenPriv = GET_KDXV_SCREEN(pScreen);
-
- for(i = 0; i < pxvs->nAdaptors; i++) {
- pAdaptor = &pxvs->pAdaptors[i];
- for(j = 0; j < pAdaptor->nPorts; j++) {
- pPort = &pAdaptor->pPorts[j];
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv->isOn > XV_OFF) {
-
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
-
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- REGION_DESTROY(pScreen, pPriv->pCompositeClip);
-
- pPriv->pCompositeClip = NULL;
-
- if(!pPriv->type && pPriv->pDraw) { /* still */
- KdXVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
- }
- }
- }
- }
-}
-
-/**** XvAdaptorRec fields ****/
-
-static int
-KdXVAllocatePort(
- unsigned long port,
- XvPortPtr pPort,
- XvPortPtr *ppPort
-){
- *ppPort = pPort;
- return Success;
-}
-
-static int
-KdXVFreePort(XvPortPtr pPort)
-{
- return Success;
-}
-
-static int
-KdXVPutVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- KdScreenPriv(portPriv->screen->pScreen);
- int result;
-
- /* No dumping video to pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->pDraw = pDraw;
- portPriv->type = XvInputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- KdXVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if (!pScreenPriv->enabled) return Success;
-
- return(KdXVReputVideo(portPriv));
-}
-
-static int
-KdXVPutStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if (!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutStill)(portPriv->screen, pDraw,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
-
- KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->pDraw = pDraw;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-static int
-KdXVGetVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- int result;
- KdScreenPriv(portPriv->screen->pScreen);
-
- /* No pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->pDraw = pDraw;
- portPriv->type = XvOutputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- KdXVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if(!pScreenPriv->enabled) return Success;
-
- return(KdXVRegetVideo(portPriv));
-}
-
-static int
-KdXVGetStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto GET_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetStill)(portPriv->screen, pDraw,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
-GET_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-
-static int
-KdXVStopVideo(
- ClientPtr client,
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- KdScreenPriv(portPriv->screen->pScreen);
-
- if(pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
-
- if(!pScreenPriv->enabled) return Success;
-
- /* Must free resources. */
-
- if(portPriv->isOn > XV_OFF) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, TRUE);
- portPriv->isOn = XV_OFF;
- }
-
- return Success;
-}
-
-static int
-KdXVSetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
- attribute, value, portPriv->DevPriv.ptr));
-}
-
-
-static int
-KdXVGetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 *p_value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
- attribute, (int *) p_value, portPriv->DevPriv.ptr));
-}
-
-
-
-static int
-KdXVQueryBestSize(
- ClientPtr client,
- XvPortPtr pPort,
- CARD8 motion,
- CARD16 vid_w, CARD16 vid_h,
- CARD16 drw_w, CARD16 drw_h,
- unsigned int *p_w, unsigned int *p_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
- (Bool)motion, vid_w, vid_h, drw_w, drw_h,
- p_w, p_h, portPriv->DevPriv.ptr);
-
- return Success;
-}
-
-
-static int
-KdXVPutImage(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 src_x, INT16 src_y,
- CARD16 src_w, CARD16 src_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h,
- XvImagePtr format,
- unsigned char* data,
- Bool sync,
- CARD16 width, CARD16 height
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = pScreen->width;
- VPBox.y2 = pScreen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutImage)(portPriv->screen, pDraw,
- src_x, src_y, WinBox.x1, WinBox.y1,
- src_w, src_h, drw_w, drw_h, format->id, data, width, height,
- sync, &ClipRegion, portPriv->DevPriv.ptr);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
-
- KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->pDraw = pDraw;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_IMAGE_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVQueryImageAttributes(
- ClientPtr client,
- XvPortPtr pPort,
- XvImagePtr format,
- CARD16 *width,
- CARD16 *height,
- int *pitches,
- int *offsets
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
- format->id, width, height, pitches, offsets);
-}
-
-
-/**************** Offscreen surface stuff *******************/
-
-typedef struct {
- KdOffscreenImagePtr images;
- int num;
-} OffscreenImageRec;
-
-static OffscreenImageRec OffscreenImages[MAXSCREENS];
-static Bool offscreenInited = FALSE;
-
-Bool
-KdXVRegisterOffscreenImages(
- ScreenPtr pScreen,
- KdOffscreenImagePtr images,
- int num
-){
- if(!offscreenInited) {
- bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS]));
- offscreenInited = TRUE;
- }
-
- OffscreenImages[pScreen->myNum].num = num;
- OffscreenImages[pScreen->myNum].images = images;
-
- return TRUE;
-}
-
-KdOffscreenImagePtr
-KdXVQueryOffscreenImages(
- ScreenPtr pScreen,
- int *num
-){
- if(!offscreenInited) {
- *num = 0;
- return NULL;
- }
-
- *num = OffscreenImages[pScreen->myNum].num;
- return OffscreenImages[pScreen->myNum].images;
-}
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
deleted file mode 100644
index 6335f7cb5..000000000
--- a/hw/kdrive/src/kxv.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
-
- XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
- Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
-
- Copyright (C) 2000, 2001 - Nokia Home Communications
- Copyright (C) 1998, 1999 - 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 in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS 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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-*/
-
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kxv.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
-
-#ifndef _XVDIX_H_
-#define _XVDIX_H_
-
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mivalidate.h"
-#include "validate.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include "../../Xext/xvdix.h"
-
-#define VIDEO_NO_CLIPPING 0x00000001
-#define VIDEO_INVERT_CLIPLIST 0x00000002
-#define VIDEO_OVERLAID_IMAGES 0x00000004
-#define VIDEO_OVERLAID_STILLS 0x00000008
-#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-
-typedef struct {
- int id;
- int type;
- int byte_order;
- unsigned char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
-} KdImageRec, *KdImagePtr;
-
-
-typedef struct {
- KdScreenInfo * screen;
- int id;
- unsigned short width, height;
- int *pitches; /* bytes */
- int *offsets; /* in bytes from start of framebuffer */
- DevUnion devPrivate;
-} KdSurfaceRec, *KdSurfacePtr;
-
-
-typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* PutStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* GetStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit);
-typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
- int value, pointer data);
-typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
- int *value, pointer data);
-typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
- short vid_w, short vid_h, short drw_w, short drw_h,
- unsigned int *p_w, unsigned int *p_h, pointer data);
-typedef int (* PutImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- 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 image, unsigned char* buf, short width, short height, Bool Sync,
- RegionPtr clipBoxes, pointer data );
-typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short drw_x, short drw_y,
- RegionPtr clipBoxes, pointer data );
-typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen,
- int image, unsigned short *width, unsigned short *height,
- int *pitches, int *offsets);
-
-typedef enum {
- XV_OFF,
- XV_PENDING,
- XV_ON
-} XvStatus;
-
-/*** this is what the driver needs to fill out ***/
-
-typedef struct {
- int id;
- char *name;
- unsigned short width, height;
- XvRationalRec rate;
-} KdVideoEncodingRec, *KdVideoEncodingPtr;
-
-typedef struct {
- char depth;
- short class;
-} KdVideoFormatRec, *KdVideoFormatPtr;
-
-typedef struct {
- int flags;
- int min_value;
- int max_value;
- char *name;
-} KdAttributeRec, *KdAttributePtr;
-
-typedef struct {
- unsigned int type;
- int flags;
- char *name;
- int nEncodings;
- KdVideoEncodingPtr pEncodings;
- int nFormats;
- KdVideoFormatPtr pFormats;
- int nPorts;
- DevUnion *pPortPrivates;
- int nAttributes;
- KdAttributePtr pAttributes;
- int nImages;
- KdImagePtr pImages;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage;
- QueryImageAttributesFuncPtr QueryImageAttributes;
-} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
-
-typedef struct {
- KdImagePtr image;
- int flags;
- int (*alloc_surface)(KdScreenInfo * screen,
- int id,
- unsigned short width,
- unsigned short height,
- KdSurfacePtr surface);
- int (*free_surface)(KdSurfacePtr surface);
- int (*display) (KdSurfacePtr surface,
- short vid_x, short vid_y,
- short drw_x, short drw_y,
- short vid_w, short vid_h,
- short drw_w, short drw_h,
- RegionPtr clipBoxes);
- int (*stop) (KdSurfacePtr surface);
- int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
- int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
- int max_width;
- int max_height;
- int num_attributes;
- KdAttributePtr attributes;
-} KdOffscreenImageRec, *KdOffscreenImagePtr;
-
-Bool
-KdXVScreenInit(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *Adaptors,
- int num
-);
-
-typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen,
- KdVideoAdaptorPtr **Adaptors);
-
-int
-KdXVRegisterGenericAdaptorDriver(
- KdXVInitGenericAdaptorPtr InitFunc
-);
-
-int
-KdXVListGenericAdaptors(
- KdScreenInfo * screen,
- KdVideoAdaptorPtr **Adaptors
-);
-
-Bool
-KdXVRegisterOffscreenImages(
- ScreenPtr pScreen,
- KdOffscreenImagePtr images,
- int num
-);
-
-KdOffscreenImagePtr
-KdXVQueryOffscreenImages(
- ScreenPtr pScreen,
- int *num
-);
-
-KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
-
-void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
-
-/* Must be called from KdCardInfo functions, can be called without Xv enabled */
-Bool KdXVEnable(ScreenPtr);
-void KdXVDisable(ScreenPtr);
-
-/*** These are DDX layer privates ***/
-
-
-typedef struct {
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- ClipNotifyProcPtr ClipNotify;
- WindowExposuresProcPtr WindowExposures;
-} KdXVScreenRec, *KdXVScreenPtr;
-
-typedef struct {
- int flags;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage;
- QueryImageAttributesFuncPtr QueryImageAttributes;
-} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
-
-typedef struct {
- KdScreenInfo * screen;
- DrawablePtr pDraw;
- unsigned char type;
- unsigned int subWindowMode;
- DDXPointRec clipOrg;
- RegionPtr clientClip;
- RegionPtr pCompositeClip;
- Bool FreeCompositeClip;
- XvAdaptorRecPrivatePtr AdaptorRec;
- XvStatus isOn;
- Bool moved;
- int vid_x, vid_y, vid_w, vid_h;
- int drw_x, drw_y, drw_w, drw_h;
- DevUnion DevPriv;
-} XvPortRecPrivate, *XvPortRecPrivatePtr;
-
-typedef struct _KdXVWindowRec{
- XvPortRecPrivatePtr PortRec;
- struct _KdXVWindowRec *next;
-} KdXVWindowRec, *KdXVWindowPtr;
-
-#endif /* _XVDIX_H_ */
-
diff --git a/hw/kdrive/src/vga.c b/hw/kdrive/src/vga.c
deleted file mode 100644
index 7975d5c5c..000000000
--- a/hw/kdrive/src/vga.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Id: vga.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vga.c,v 1.2 1999/12/30 03:03:07 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vga.h"
-#include <stdio.h>
-
-#ifdef linux
-#ifdef __i386__
-#define extern static
-#include <asm/io.h>
-#undef extern
-
-#define _VgaInb(r) inb(r)
-#define _VgaOutb(v,r) outb(v,r)
-#else
-#define _VgaInb(r) 0
-#define _VgaOutb(v,r)
-#endif
-
-#define _VgaByteAddr(a) ((VGAVOL8 *) (a))
-#define _VgaBytePort(a) (a)
-#endif
-
-#ifdef VXWORKS
-#define _VgaInb(r) 0
-#define _VgaOutb(v,r) 0
-
-#define _VgaByteAddr(a) ((VGAVOL8 *) ((VGA32) (a) ^ 3))
-#define _VgaBytePort(a) 0
-
-#undef stderr
-#define stderr stdout
-
-#endif
-
-#undef VGA_DEBUG_REGISTERS
-#ifdef VGA_DEBUG_REGISTERS
-#define VGA_DEBUG(a) fprintf a
-#else
-#define VGA_DEBUG(a)
-#endif
-
-VGA8
-VgaInb (VGA16 r)
-{
- return _VgaInb(r);
-}
-
-void
-VgaOutb (VGA8 v, VGA16 r)
-{
- _VgaOutb (v,r);
-}
-
-VGA8
-VgaReadMemb (VGA32 addr)
-{
- return *_VgaByteAddr(addr);
-}
-
-void
-VgaWriteMemb (VGA8 v, VGA32 addr)
-{
- *_VgaByteAddr(addr) = v;
-}
-
-VGA8
-VgaFetch (VgaCard *card, VGA16 reg)
-{
- VgaMap map;
- VGA8 value = 0;
-
- (*card->map) (card, reg, &map, VGAFALSE);
- switch (map.access) {
- case VgaAccessMem:
- value = VgaReadMemb (map.port);
- VGA_DEBUG ((stderr, "%08x -> %2x\n", map.port, value));
- break;
- case VgaAccessIo:
- value = _VgaInb (map.port);
- VGA_DEBUG ((stderr, "%4x -> %2x\n", map.port, value));
- break;
- case VgaAccessIndMem:
- VgaWriteMemb (map.index, map.port + map.addr);
- value = VgaReadMemb (map.port + map.value);
- VGA_DEBUG ((stderr, "%4x/%2x -> %2x\n", map.port, map.index, value));
- break;
- case VgaAccessIndIo:
- _VgaOutb (map.index, map.port + map.addr);
- value = _VgaInb (map.port + map.value);
- VGA_DEBUG ((stderr, "%4x/%2x -> %2x\n", map.port, map.index, value));
- break;
- case VgaAccessDone:
- value = map.value;
- VGA_DEBUG ((stderr, "direct %4x -> %2x\n", reg, value));
- break;
- }
- return value;
-}
-
-void
-VgaStore (VgaCard *card, VGA16 reg, VGA8 value)
-{
- VgaMap map;
-
- map.value = value;
- (*card->map) (card, reg, &map, VGATRUE);
- switch (map.access) {
- case VgaAccessMem:
- VGA_DEBUG ((stderr, "%8x <- %2x\n", map.port, value));
- VgaWriteMemb (map.value, map.port);
- break;
- case VgaAccessIo:
- VGA_DEBUG ((stderr, "%4x <- %2x\n", map.port, value));
- _VgaOutb (value, map.port);
- break;
- case VgaAccessIndMem:
- VgaWriteMemb (map.index, map.port + map.addr);
- VgaWriteMemb (value, map.port + map.value);
- VGA_DEBUG ((stderr, "%4x/%2x <- %2x\n", map.port, map.index, value));
- break;
- case VgaAccessIndIo:
- VGA_DEBUG ((stderr, "%4x/%2x <- %2x\n", map.port, map.index, value));
- _VgaOutb (map.index, map.port + map.addr);
- _VgaOutb (value, map.port + map.value);
- break;
- case VgaAccessDone:
- VGA_DEBUG ((stderr, "direct %4x <- %2x\n", reg, value));
- break;
- }
-}
-
-void
-VgaPreserve (VgaCard *card)
-{
- VgaSave *s;
- VGA16 id;
-
- for (s = card->saves; s->first != VGA_REG_NONE; s++)
- {
- for (id = s->first; id <= s->last; id++)
- {
- card->values[id].cur = VgaFetch (card, id);
- card->values[id].save = card->values[id].cur;
- card->values[id].flags = VGA_VALUE_VALID | VGA_VALUE_SAVED;
- }
- }
-}
-
-void
-VgaRestore (VgaCard *card)
-{
- VgaSave *s;
- VGA16 id;
-
- for (s = card->saves; s->first != VGA_REG_NONE; s++)
- {
- for (id = s->first; id <= s->last; id++)
- {
- if (card->values[id].flags & VGA_VALUE_SAVED)
- {
- VgaStore (card, id, card->values[id].save);
- card->values[id].cur = card->values[id].save;
- }
- }
- }
-}
-
-void
-VgaFinish (VgaCard *card)
-{
- VGA16 id;
-
- for (id = 0; id < card->max; id++)
- card->values[id].flags = 0;
-}
-
-void
-VgaInvalidate (VgaCard *card)
-{
- VGA16 id;
-
- for (id = 0; id < card->max; id++)
- card->values[id].flags &= ~VGA_VALUE_VALID;
-}
-
-
-static void
-_VgaSync (VgaCard *card, VGA16 id)
-{
- if (!(card->values[id].flags & VGA_VALUE_VALID))
- {
- card->values[id].cur = VgaFetch (card, id);
- card->values[id].flags |= VGA_VALUE_VALID;
- }
-}
-
-void
-VgaSet (VgaCard *card, VgaReg *reg, VGA32 value)
-{
- VGA8 v, mask, new;
-
- while (reg->len)
- {
- if (reg->id != VGA_REG_NONE)
- {
- _VgaSync (card, reg->id);
- mask = ((1 << reg->len) - 1);
- new = value & mask;
- mask <<= reg->base;
- new <<= reg->base;
- v = card->values[reg->id].cur;
- v = (v & ~mask) | new;
- card->values[reg->id].cur = v;
- card->values[reg->id].flags |= VGA_VALUE_MODIFIED|VGA_VALUE_DIRTY;
- }
- value >>= reg->len;
- reg++;
- }
-}
-
-void
-VgaFlushReg (VgaCard *card, VgaReg *reg)
-{
- while (reg->len)
- {
- if (reg->id != VGA_REG_NONE)
- {
- if (card->values[reg->id].flags & VGA_VALUE_DIRTY)
- {
- VgaStore (card, reg->id, card->values[reg->id].cur);
- card->values[reg->id].flags &= ~VGA_VALUE_DIRTY;
- }
- }
- reg++;
- }
-
-}
-
-void
-VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value)
-{
- VgaSet (card, reg, value);
- VgaFlushReg (card, reg);
-}
-
-VGA32
-VgaGet (VgaCard *card, VgaReg *reg)
-{
- VGA32 value, offset, v;
- VGA8 mask;
-
- value = 0;
- offset = 0;
- while (reg->len)
- {
- if (reg->id != VGA_REG_NONE)
- {
- _VgaSync (card, reg->id);
- mask = ((1 << reg->len) - 1);
- v = (card->values[reg->id].cur >> reg->base) & mask;
- value |= (v << offset);
- }
- offset += reg->len;
- reg++;
- }
- return value;
-}
-
-VGA32
-VgaGetImm (VgaCard *card, VgaReg *reg)
-{
- VgaReg *r = reg;
-
- while (r->len)
- {
- if (r->id != VGA_REG_NONE)
- card->values[r->id].flags &= ~VGA_VALUE_VALID;
- r++;
- }
- return VgaGet (card, reg);
-}
-
-void
-VgaFlush (VgaCard *card)
-{
- VGA16 id;
-
- for (id = 0; id < card->max; id++)
- {
- if (card->values[id].flags & VGA_VALUE_DIRTY)
- {
- VgaStore (card, id, card->values[id].cur);
- card->values[id].flags &= ~VGA_VALUE_DIRTY;
- }
- }
-}
-
-void
-VgaFill (VgaCard *card, VGA16 low, VGA16 high)
-{
- VGA16 id;
-
- for (id = low; id < high; id++)
- _VgaSync (card, id);
-}
diff --git a/hw/kdrive/src/vga.h b/hw/kdrive/src/vga.h
deleted file mode 100644
index 5d7e77307..000000000
--- a/hw/kdrive/src/vga.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Id: vga.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vga.h,v 1.2 1999/12/30 03:03:07 robin Exp $ */
-
-#ifndef _VGA_H_
-#define _VGA_H_
-
-typedef unsigned long VGA32;
-typedef unsigned short VGA16;
-typedef unsigned char VGA8;
-typedef int VGABOOL;
-typedef volatile VGA8 VGAVOL8;
-
-#define VGATRUE 1
-#define VGAFALSE 0
-
-typedef struct _vgaReg {
- VGA16 id;
- VGA8 base;
- VGA8 len;
-} VgaReg;
-
-#define VGA_REG_NONE 0xffff
-#define VGA_REG_END VGA_REG_NONE, 0, 0
-
-typedef struct _vgaValue {
- VGA8 save;
- VGA8 cur;
- VGA16 flags;
-} VgaValue;
-
-#define VGA_VALUE_VALID 1 /* value ever fetched */
-#define VGA_VALUE_MODIFIED 2 /* value ever changed */
-#define VGA_VALUE_DIRTY 4 /* value needs syncing */
-#define VGA_VALUE_SAVED 8 /* value preserved */
-
-typedef enum _vgaAccess {
- VgaAccessMem, VgaAccessIo, VgaAccessIndMem, VgaAccessIndIo,
- VgaAccessDone
-} VgaAccess;
-
-typedef struct _vgaMap {
- VgaAccess access;
- VGA32 port;
- VGA8 addr; /* for Ind access; addr offset from port */
- VGA8 value; /* for Ind access; value offset from port */
- VGA8 index; /* for Ind access; index value */
-} VgaMap;
-
-#define VGA_UNLOCK_FIXED 1 /* dont save current value */
-#define VGA_UNLOCK_LOCK 2 /* execute only on relock */
-#define VGA_UNLOCK_UNLOCK 4 /* execute only on unlock */
-
-typedef struct _vgaSave {
- VGA16 first;
- VGA16 last;
-} VgaSave;
-
-#define VGA_SAVE_END VGA_REG_NONE, VGA_REG_NONE
-
-typedef struct _vgaCard {
- void (*map) (struct _vgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write);
- void *closure;
- int max;
- VgaValue *values;
- VgaSave *saves;
-} VgaCard;
-
-VGA8
-VgaInb (VGA16 r);
-
-void
-VgaOutb (VGA8 v, VGA16 r);
-
-VGA8
-VgaReadMemb (VGA32 addr);
-
-void
-VgaWriteMemb (VGA8 v, VGA32 addr);
-
-void
-VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value);
-
-VGA32
-VgaGetImm (VgaCard *card, VgaReg *reg);
-
-void
-VgaSet (VgaCard *card, VgaReg *reg, VGA32 value);
-
-VGA32
-VgaGet (VgaCard *card, VgaReg *reg);
-
-void
-VgaFlush (VgaCard *card);
-
-void
-VgaFill (VgaCard *card, VGA16 low, VGA16 high);
-
-void
-VgaPreserve (VgaCard *card);
-
-void
-VgaInvalidate (VgaCard *card);
-
-void
-VgaRestore (VgaCard *card);
-
-void
-VgaFinish (VgaCard *card);
-
-void
-VgaFlushReg (VgaCard *card, VgaReg *reg);
-
-VGA8
-VgaFetch (VgaCard *card, VGA16 id);
-
-void
-VgaStore (VgaCard *card, VGA16 id, VGA8 value);
-
-VGA8
-_VgaFetchInd (VGA16 port, VGA8 reg);
-
-void
-_VgaStoreInd (VGA16 port, VGA8 reg, VGA8 value);
-
-#endif /* _VGA_H_ */
diff --git a/hw/kdrive/trident/Imakefile b/hw/kdrive/trident/Imakefile
deleted file mode 100644
index 0dff5e91b..000000000
--- a/hw/kdrive/trident/Imakefile
+++ /dev/null
@@ -1,16 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/trident/Imakefile,v 1.5 2000/09/19 23:49:55 keithp Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = trident.c tridentdraw.c tridentcurs.c tridentstub.c
-
-OBJS = trident.o tridentdraw.o tridentcurs.o tridentstub.o
-
-DEFINES = -DVESA /* -DUSE_PCI*/
-
-INCLUDES = -I. $(KDINCS) -I$(KDRIVE)/fbdev -I$(KDRIVE)/vesa
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(trident,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/trident/trident.c b/hw/kdrive/trident/trident.c
deleted file mode 100644
index 9423f90e0..000000000
--- a/hw/kdrive/trident/trident.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.17 2001/06/03 18:48:19 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "trident.h"
-#include <sys/io.h>
-
-#undef TRI_DEBUG
-
-int trident_clk = 0;
-int trident_mclk = 0;
-
-#define CLOCK 14318 /* KHz */
-#define CLK_N(a,b) (a & 0xff)
-#define CLK_M(a,b) ((b) & 0x3f)
-#define CLK_K(a,b) (((b) >> 6) & 3)
-#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b)))
-
-Bool
-tridentCardInit (KdCardInfo *card)
-{
- int k;
- char *pixels;
- TridentCardInfo *tridentc;
- CARD8 r39;
-
- tridentc = (TridentCardInfo *) xalloc (sizeof (TridentCardInfo));
- if (!tridentc)
- return FALSE;
-
- iopl (3);
- tridentc->cop_base = (CARD8 *) KdMapDevice (TRIDENT_COP_BASE(card),
- TRIDENT_COP_SIZE(card));
-
- if (tridentc->cop_base)
- {
- KdSetMappedMode (TRIDENT_COP_BASE(card),
- TRIDENT_COP_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- }
- tridentc->cop = (Cop *) (tridentc->cop_base + TRIDENT_COP_OFF(card));
- tridentc->mmio = FALSE;
- r39 = tridentReadIndex (tridentc, 0x3d4, 0x39);
- if (r39 & 1)
- {
- tridentc->mmio = TRUE;
- r39 = tridentReadIndex (tridentc, 0x3d4, 0x39);
- if ((r39 & 1) == 0)
- {
- ErrorF ("Trident: inconsisent IO mapping values\n");
- return FALSE;
- }
- }
-
-#ifdef VESA
- if (!vesaInitialize (card, &tridentc->vesa))
-#else
- if (!fbdevInitialize (card, &tridentc->fb))
-#endif
- {
- xfree (tridentc);
- return FALSE;
- }
-
-#ifdef USE_PCI
- tridentc->window = (CARD32 *) (tridentc->cop_base + 0x10000);
-#else
- tridentc->window = 0;
-#endif
- card->driver = tridentc;
-
- return TRUE;
-}
-
-Bool
-tridentScreenInit (KdScreenInfo *screen)
-{
- TridentCardInfo *tridentc = screen->card->driver;
- TridentScreenInfo *tridents;
- int screen_size, memory;
-
- tridents = (TridentScreenInfo *) xalloc (sizeof (TridentScreenInfo));
- if (!tridents)
- return FALSE;
- memset (tridents, '\0', sizeof (TridentScreenInfo));
-#ifdef VESA
- if (!vesaScreenInitialize (screen, &tridents->vesa))
-#else
- if (!fbdevScreenInitialize (screen, &tridents->fbdev))
-#endif
- {
- xfree (tridents);
- return FALSE;
- }
- if (!tridentc->cop)
- screen->dumb = TRUE;
-#ifdef VESA
- if (tridents->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
- tridents->screen = tridents->vesa.fb;
- memory = tridents->vesa.fb_size;
-#else
- tridents->screen = tridentc->fb.fb;
- memory = (2048 + 512) * 1024;
-#endif
- screen_size = screen->fb[0].byteStride * screen->height;
- if (tridents->screen && memory >= screen_size + 2048)
- {
- memory -= 2048;
- tridents->cursor_base = tridents->screen + memory - 2048;
- }
- else
- tridents->cursor_base = 0;
- memory -= screen_size;
- if (memory > screen->fb[0].byteStride)
- {
- tridents->off_screen = tridents->screen + screen_size;
- tridents->off_screen_size = memory;
- }
- else
- {
- tridents->off_screen = 0;
- tridents->off_screen_size = 0;
- }
- screen->driver = tridents;
- return TRUE;
-}
-
-Bool
-tridentInitScreen (ScreenPtr pScreen)
-{
-#ifdef VESA
- return vesaInitScreen (pScreen);
-#else
- return fbdevInitScreen (pScreen);
-#endif
-}
-
-Bool
-tridentFinishInitScreen (ScreenPtr pScreen)
-{
-#ifdef VESA
- return vesaFinishInitScreen (pScreen);
-#endif
-}
-
-CARD8
-tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index)
-{
- CARD8 value;
-
- if (tridentc->mmio)
- {
- tridentc->cop_base[port] = index;
- value = tridentc->cop_base[port+1];
- }
- else
- {
- outb (index, port);
- value = inb (port+1);
- }
- return value;
-}
-
-void
-tridentWriteIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index, CARD8 value)
-{
- if (tridentc->mmio)
- {
- tridentc->cop_base[port] = index;
- tridentc->cop_base[port+1] = value;
- }
- else
- {
- outb (index, port);
- outb (value, port+1);
- }
-}
-
-CARD8
-tridentReadReg (TridentCardInfo *tridentc, CARD16 port)
-{
- CARD8 value;
-
- if (tridentc->mmio)
- {
- value = tridentc->cop_base[port];
- }
- else
- {
- value = inb (port);
- }
- return value;
-}
-
-void
-tridentWriteReg (TridentCardInfo *tridentc, CARD16 port, CARD8 value)
-{
- if (tridentc->mmio)
- {
- tridentc->cop_base[port] = value;
- }
- else
- {
- outb (value, port);
- }
-}
-
-
-void
-tridentPause ()
-{
- struct timeval tv;
-
- tv.tv_sec = 0;
- tv.tv_usec = 50 * 1000;
- select (1, 0, 0, 0, &tv);
-}
-
-void
-tridentPreserve (KdCardInfo *card)
-{
- TridentCardInfo *tridentc = card->driver;
-
-#ifdef VESA
- vesaPreserve(card);
-#else
- fbdevPreserve (card);
-#endif
- tridentPause ();
- tridentc->save.reg_3c4_0e = tridentReadIndex (tridentc, 0x3c4, 0x0e);
- tridentc->save.reg_3d4_36 = tridentReadIndex (tridentc, 0x3d4, 0x36);
- tridentc->save.reg_3d4_39 = tridentReadIndex (tridentc, 0x3d4, 0x39);
- tridentc->save.reg_3d4_62 = tridentReadIndex (tridentc, 0x3d4, 0x62);
- tridentc->save.reg_3ce_21 = tridentReadIndex (tridentc, 0x3ce, 0x21);
- tridentc->save.reg_3c2 = tridentReadReg (tridentc, 0x3cc);
- tridentc->save.reg_3c4_16 = tridentReadIndex (tridentc, 0x3c4, 0x16);
- tridentc->save.reg_3c4_17 = tridentReadIndex (tridentc, 0x3c4, 0x17);
- tridentc->save.reg_3c4_18 = tridentReadIndex (tridentc, 0x3c4, 0x18);
- tridentc->save.reg_3c4_19 = tridentReadIndex (tridentc, 0x3c4, 0x19);
- ErrorF ("clk low 0x%x high 0x%x freq %d\n",
- tridentc->save.reg_3c4_18,
- tridentc->save.reg_3c4_19,
- CLK_FREQ(tridentc->save.reg_3c4_18,
- tridentc->save.reg_3c4_19));
-#ifdef TRI_DEBUG
- fprintf (stderr, "3c4 0e: %02x\n", tridentc->save.reg_3c4_0e);
- fprintf (stderr, "3d4 36: %02x\n", tridentc->save.reg_3d4_36);
- fprintf (stderr, "3d4 39: %02x\n", tridentc->save.reg_3d4_39);
- fprintf (stderr, "3d4 62: %02x\n", tridentc->save.reg_3d4_62);
- fprintf (stderr, "3ce 21: %02x\n", tridentc->save.reg_3ce_21);
- fflush (stderr);
-#endif
- tridentPause ();
-}
-
-void
-tridentSetCLK(int clock, CARD8 *a, CARD8 *b)
-{
- int powerup[4] = { 1,2,4,8 };
- int clock_diff = 750;
- int freq, ffreq;
- int m, n, k;
- int p, q, r, s;
- int startn, endn;
- int endm, endk;
-
- p = q = r = s = 0;
-
- startn = 64;
- endn = 255;
- endm = 63;
- endk = 3;
-
- freq = clock;
-
- for (k=0;k<=endk;k++)
- for (n=startn;n<=endn;n++)
- for (m=1;m<=endm;m++)
- {
- ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) ));
- if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff))
- {
- clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq;
- p = n; q = m; r = k; s = ffreq;
- }
- }
-
- ErrorF ("ffreq %d clock %d\n", s, clock);
- if (s == 0)
- {
- FatalError("Unable to set programmable clock.\n"
- "Frequency %d is not a valid clock.\n"
- "Please modify XF86Config for a new clock.\n",
- freq);
- }
-
- /* N is all 8bits */
- *a = p;
- /* M is first 6bits, with K last 2bits */
- *b = (q & 0x3F) | (r << 6);
-}
-
-void
-tridentSetMCLK(int clock, CARD8 *a, CARD8 *b)
-{
- int powerup[4] = { 1,2,4,8 };
- int clock_diff = 750;
- int freq, ffreq;
- int m,n,k;
- int p, q, r, s;
- int startn, endn;
- int endm, endk;
-
- p = q = r = s = 0;
-
- startn = 64;
- endn = 255;
- endm = 63;
- endk = 3;
-
- freq = clock;
-
- for (k=0;k<=endk;k++)
- for (n=startn;n<=endn;n++)
- for (m=1;m<=endm;m++) {
- ffreq = ((((n+8)*CLOCK)/((m+2)*powerup[k])));
- if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff))
- {
- clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq;
- p = n; q = m; r = k; s = ffreq;
- }
- }
-
- if (s == 0)
- {
- FatalError("Unable to set memory clock.\n"
- "Frequency %d is not a valid clock.\n"
- "Please modify XF86Config for a new clock.\n",
- freq);
- }
-
- /* N is all 8bits */
- *a = p;
- /* M is first 6bits, with K last 2bits */
- *b = (q & 0x3F) | (r << 6);
-}
-
-void
-tridentSetMMIO (TridentCardInfo *tridentc)
-{
- int tries;
- CARD8 v;
-
-#ifdef TRI_DEBUG
- fprintf (stderr, "Set MMIO\n");
-#endif
- /* enable config port writes */
- for (tries = 0; tries < 3; tries++)
- {
- /* enable direct read when GE busy, enable PCI retries */
- tridentWriteIndex (tridentc, 0x3d4, 0x62,
- tridentc->save.reg_3d4_62 | 0x70);
- /* make sure the chip is in new mode */
- tridentReadIndex (tridentc, 0x3c4, 0xb);
- /* enable access to upper registers */
- tridentWriteIndex (tridentc, 0x3c4, 0xe,
- tridentc->save.reg_3c4_0e | 0x80);
- v = tridentReadIndex (tridentc, 0x3c4, 0xe);
- if (!(v & 0x80))
- {
- fprintf (stderr, "Trident GE not enabled 0x%x\n", v);
- continue;
- }
- /* enable screen */
- tridentWriteIndex (tridentc, 0x3ce, 0x21, 0x80);
-#ifdef USE_PCI
- /* enable burst r/w, enable memory mapped ports */
- tridentWriteIndex (tridentc, 0x3d4, 0x39, 7);
- tridentc->mmio = TRUE;
- /* reset GE, enable GE, set GE to pci 1 */
- tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x90);
-#else
- /* enable burst r/w, disable memory mapped ports */
- tridentWriteIndex (tridentc, 0x3d4, 0x39, 0x6);
- /* reset GE, enable GE, set GE to 0xbff00 */
- tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x92);
-#endif
- /* set clock */
- if (trident_clk)
- {
- CARD8 a, b;
-
- a = tridentReadIndex (tridentc, 0x3c4, 0x18);
- b = tridentReadIndex (tridentc, 0x3c4, 0x19);
- ErrorF ("old clock 0x%x 0x%x %d\n",
- a, b, CLK_FREQ(a,b));
- tridentSetCLK (trident_clk, &a, &b);
- ErrorF ("clk %d-> 0x%x 0x%x %d\n", trident_clk, a, b,
- CLK_FREQ(a,b));
-#if 1
- tridentWriteIndex (tridentc, 0x3c4, 0x18, a);
- tridentWriteIndex (tridentc, 0x3c4, 0x19, b);
-#endif
- }
- if (trident_mclk)
- {
- CARD8 a, b;
-
- tridentSetMCLK (trident_mclk, &a, &b);
- ErrorF ("mclk %d -> 0x%x 0x%x\n", trident_mclk, a, b);
-#if 0
- tridentWriteIndex (tridentc, 0x3c4, 0x16, a);
- tridentWriteIndex (tridentc, 0x3c4, 0x17, b);
-#endif
- }
- if (trident_clk || trident_mclk)
- {
- CARD8 mode;
-
- mode = tridentReadReg (tridentc, 0x3cc);
- ErrorF ("old mode 0x%x\n", mode);
- mode = (mode & 0xf3) | 0x08;
- ErrorF ("new mode 0x%x\n", mode);
-#if 1
- tridentWriteReg (tridentc, 0x3c2, mode);
-#endif
- }
-#ifdef TRI_DEBUG
- fprintf (stderr, "0x36: 0x%02x\n",
- tridentReadIndex (tridentc, 0x3d4, 0x36));
-#endif
- if (tridentc->cop->status != 0xffffffff)
- break;
- }
-#ifdef TRI_DEBUG
- fprintf (stderr, "COP status 0x%x\n", tridentc->cop->status);
-#endif
- if (tridentc->cop->status == 0xffffffff)
- FatalError ("Trident COP not visible\n");
-}
-
-void
-tridentResetMMIO (TridentCardInfo *tridentc)
-{
-#ifdef TRI_DEBUG
- fprintf (stderr, "Reset MMIO\n");
-#endif
- tridentPause ();
-#if 0
- tridentWriteIndex (tridentc, 0x3c4, 0x16, tridentc->save.reg_3c4_16);
- tridentWriteIndex (tridentc, 0x3c4, 0x17, tridentc->save.reg_3c4_17);
-#endif
- tridentWriteIndex (tridentc, 0x3c4, 0x18, tridentc->save.reg_3c4_18);
- tridentWriteIndex (tridentc, 0x3c4, 0x19, tridentc->save.reg_3c4_19);
- tridentWriteReg (tridentc, 0x3c2, tridentc->save.reg_3c2);
- tridentPause ();
- tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentc->save.reg_3ce_21);
- tridentPause ();
- tridentWriteIndex (tridentc, 0x3d4, 0x62, tridentc->save.reg_3d4_62);
- tridentWriteIndex (tridentc, 0x3d4, 0x39, tridentc->save.reg_3d4_39);
- tridentc->mmio = FALSE;
- tridentWriteIndex (tridentc, 0x3d4, 0x36, tridentc->save.reg_3d4_36);
- tridentWriteIndex (tridentc, 0x3c4, 0x0e, tridentc->save.reg_3c4_0e);
- tridentPause ();
-}
-
-Bool
-tridentEnable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- TridentCardInfo *tridentc = pScreenPriv->card->driver;
-
-#ifdef VESA
- if (!vesaEnable (pScreen))
- return FALSE;
-#else
- if (!fbdevEnable (pScreen))
- return FALSE;
-#endif
- tridentSetMMIO (tridentc);
- return TRUE;
-}
-
-void
-tridentDisable (ScreenPtr pScreen)
-{
-#ifdef VESA
- vesaDisable (pScreen);
-#else
- fbdevDisable (pScreen);
-#endif
-}
-
-const CARD8 tridentDPMSModes[4] = {
- 0x80, /* KD_DPMS_NORMAL */
- 0x8c, /* KD_DPMS_STANDBY */
- 0x8c, /* KD_DPMS_STANDBY */
- 0x8c, /* KD_DPMS_STANDBY */
-/* 0xb0, /* KD_DPMS_SUSPEND */
-/* 0xbc, /* KD_DPMS_POWERDOWN */
-};
-
-Bool
-tridentDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- TridentCardInfo *tridentc = pScreenPriv->card->driver;
-
- tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentDPMSModes[mode]);
- tridentPause ();
- return TRUE;
-}
-
-void
-tridentRestore (KdCardInfo *card)
-{
- TridentCardInfo *tridentc = card->driver;
-
- tridentResetMMIO (tridentc);
-#ifdef VESA
- vesaRestore (card);
-#else
- fbdevRestore (card);
-#endif
-}
-
-void
-tridentScreenFini (KdScreenInfo *screen)
-{
- TridentScreenInfo *tridents = (TridentScreenInfo *) screen->driver;
-
-#ifdef VESA
- vesaScreenFini (screen);
-#endif
- xfree (tridents);
- screen->driver = 0;
-}
-
-void
-tridentCardFini (KdCardInfo *card)
-{
- TridentCardInfo *tridentc = card->driver;
-
- if (tridentc->cop_base)
- {
- KdUnmapDevice ((void *) tridentc->cop_base, TRIDENT_COP_SIZE(card));
- KdResetMappedMode (TRIDENT_COP_BASE(card),
- TRIDENT_COP_SIZE(card),
- KD_MAPPED_MODE_REGISTERS);
- }
-#ifdef VESA
- vesaCardFini (card);
-#else
- fbdevCardFini (card);
-#endif
-}
-
-KdCardFuncs tridentFuncs = {
- tridentCardInit, /* cardinit */
- tridentScreenInit, /* scrinit */
- tridentInitScreen, /* initScreen */
- tridentPreserve, /* preserve */
- tridentEnable, /* enable */
- tridentDPMS, /* dpms */
- tridentDisable, /* disable */
- tridentRestore, /* restore */
- tridentScreenFini, /* scrfini */
- tridentCardFini, /* cardfini */
-
- tridentCursorInit, /* initCursor */
- tridentCursorEnable, /* enableCursor */
- tridentCursorDisable, /* disableCursor */
- tridentCursorFini, /* finiCursor */
- tridentRecolorCursor, /* recolorCursor */
-
- tridentDrawInit, /* initAccel */
- tridentDrawEnable, /* enableAccel */
- tridentDrawSync, /* syncAccel */
- tridentDrawDisable, /* disableAccel */
- tridentDrawFini, /* finiAccel */
-
-#ifdef VESA
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-#else
- fbdevGetColors, /* getColors */
- fbdevPutColors, /* putColors */
-#endif
- tridentFinishInitScreen /* finishInitScreen */
-};
diff --git a/hw/kdrive/trident/trident.h b/hw/kdrive/trident/trident.h
deleted file mode 100644
index 0b0d8cb48..000000000
--- a/hw/kdrive/trident/trident.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Id: trident.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/trident.h,v 1.8 2000/10/20 00:19:51 keithp Exp $ */
-
-#ifndef _TRIDENT_H_
-#define _TRIDENT_H_
-#ifdef VESA
-#include <vesa.h>
-#else
-#include <fbdev.h>
-#endif
-
-/*
- * offset from ioport beginning
- */
-
-#ifdef USE_PCI
-#define TRIDENT_COP_BASE(c) (c->attr.address[1])
-#define TRIDENT_COP_OFF(c) 0x2100
-#define TRIDENT_COP_SIZE(c) 0x20000
-#else
-#define TRIDENT_COP_BASE(c) 0xbf000
-#define TRIDENT_COP_OFF(c) 0x00f00
-#define TRIDENT_COP_SIZE(c) (0x2000)
-#endif
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _cop {
- VOL32 src_start_xy; /* 0x00 */
- VOL32 src_end_xy; /* 0x04 */
- VOL32 dst_start_xy; /* 0x08 */
- VOL32 dst_end_xy; /* 0x0c */
- VOL32 alpha; /* 0x10 */
- CARD8 pad14[0xc]; /* 0x14 */
- VOL32 multi; /* 0x20 */
-
-#define COP_MULTI_CLIP_TOP_LEFT 0x10000000
-#define COP_MULTI_DEPTH 0x40000000
-#define COP_MULTI_COLOR_KEY 0x70000000
-#define COP_MULTI_STYLE 0x50000000
-#define COP_MULTI_PATTERN 0x80000000
-#define COP_MULTI_ROP 0x90000000
-#define COP_MULTI_STRIDE 0x60000000
-#define COP_MULTI_Z 0xa0000000
-#define COP_MULTI_ALPHA 0xb0000000
-#define COP_MULTI_TEXTURE 0xd0000000
-#define COP_MULTI_TEXTURE_BOUND 0xe0000000
-#define COP_MULTI_TEXTURE_ADVANCED 0x20000000
-#define COP_MULTI_MASK 0xf0000000
-
-#define COP_DEPTH_8 0x00000000
-#define COP_DEPTH_16 0x00000001
-#define COP_DEPTH_24_32 0x00000002
-#define COP_DEPTH_15 0x00000005
-#define COP_DEPTH_DITHER_DISABLE 0x00000008
-
-
-#define COP_ALPHA_SRC_BLEND_0 0x00000000
-#define COP_ALPHA_SRC_BLEND_1 0x00000001
-#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002
-#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003
-#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004
-#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005
-#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006
-#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007
-#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008
-#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009
-#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A
-#define COP_ALPHA_SRC_BLEND_BG 0x0000000B
-
-#define COP_ALPHA_DST_BLEND_0 0x00000000
-#define COP_ALPHA_DST_BLEND_1 0x00000010
-#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020
-#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030
-#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040
-#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050
-#define COP_ALPHA_DST_BLEND_DST_A 0x00000060
-#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070
-#define COP_ALPHA_DST_BLEND_DST_C 0x00000080
-#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090
-#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0
-
-#define COP_ALPHA_RESULT_ALPHA 0x00100000
-#define COP_ALPHA_DEST_ALPHA 0x00200000
-#define COP_ALPHA_SOURCE_ALPHA 0x00400000
-#define COP_ALPHA_WRITE_ENABLE 0x00800000
-#define COP_ALPHA_TEST_ENABLE 0x01000000
-#define COP_ALPHA_BLEND_ENABLE 0x02000000
-#define COP_ALPHA_DEST_VALUE 0x04000000
-#define COP_ALPHA_SOURCE_VALUE 0x08000000
-
- VOL32 command; /* 0x24 */
-#define COP_OP_NULL 0x00000000
-#define COP_OP_LINE 0x20000000
-#define COP_OP_BLT 0x80000000
-#define COP_OP_TEXT 0x90000000
-#define COP_OP_POLY 0xb0000000
-#define COP_OP_POLY2 0xe0000000
-#define COP_SCL_EXPAND 0x00800000
-#define COP_SCL_OPAQUE 0x00400000
-#define COP_SCL_REVERSE 0x00200000
-#define COP_SCL_MONO_OFF 0x001c0000
-#define COP_LIT_TEXTURE 0x00004000
-#define COP_BILINEAR 0x00002000
-#define COP_OP_ZBUF 0x00000800
-#define COP_OP_ROP 0x00000400
-#define COP_OP_FG 0x00000200
-#define COP_OP_FB 0x00000080
-#define COP_X_REVERSE 0x00000004
-#define COP_CLIP 0x00000001
- VOL32 texture_format; /* 0x28 */
- CARD8 pad2c[0x4]; /* 0x2c */
-
- VOL32 clip_bottom_right; /* 0x30 */
- VOL32 dataIII; /* 0x34 */
- VOL32 dataIV; /* 0x38 */
- CARD8 pad3c[0x8]; /* 0x3c */
-
- VOL32 fg; /* 0x44 */
- VOL32 bg; /* 0x48 */
- CARD8 pad4c[0x4]; /* 0x4c */
-
- VOL32 pattern_fg; /* 0x50 */
- VOL32 pattern_bg; /* 0x54 */
- CARD8 pad58[0xc]; /* 0x58 */
-
- VOL32 status; /* 0x64 */
-#define COP_STATUS_BE_BUSY 0x80000000
-#define COP_STATUS_DPE_BUSY 0x20000000
-#define COP_STATUS_MI_BUSY 0x10000000
-#define COP_STATUS_FIFO_BUSY 0x08000000
-#define COP_STATUS_WB_BUSY 0x00800000
-#define COP_STATUS_Z_FAILED 0x00400000
-#define COP_STATUS_EFFECTIVE 0x00200000
-#define COP_STATUS_LEFT_VIEW 0x00080000
-
- CARD8 pad68[0x4]; /* 0x68 */
-
- VOL32 src_offset; /* 0x6c */
- VOL32 z_offset; /* 0x70 */
- CARD8 pad74[0x4]; /* 0x74 */
-
- VOL32 display_offset; /* 0x78 */
- VOL32 dst_offset; /* 0x7c */
- CARD8 pad80[0x34]; /* 0x80 */
-
- VOL32 semaphore; /* 0xb4 */
-} Cop;
-
-#define TRI_XY(x,y) ((y) << 16 | (x))
-
-typedef struct _tridentSave {
- CARD8 reg_3c4_0e; /* config port value */
- CARD8 reg_3d4_36;
- CARD8 reg_3d4_39;
- CARD8 reg_3d4_62; /* GE setup */
- CARD8 reg_3ce_21; /* DPMS */
- CARD8 reg_3c2; /* clock config */
- CARD8 reg_3c4_16; /* MCLKLow */
- CARD8 reg_3c4_17; /* MCLKHigh */
- CARD8 reg_3c4_18; /* ClockLow */
- CARD8 reg_3c4_19; /* ClockHigh */
-} TridentSave;
-
-typedef struct _tridentCardInfo {
-#ifdef VESA
- VesaCardPrivRec vesa;
-#else
- FbdevPriv fb;
-#endif
- CARD8 *cop_base;
- Cop *cop;
- CARD32 *window;
- CARD32 cop_depth;
- CARD32 cop_stride;
- Bool mmio;
- TridentSave save;
-} TridentCardInfo;
-
-#define getTridentCardInfo(kd) ((TridentCardInfo *) ((kd)->card->driver))
-#define tridentCardInfo(kd) TridentCardInfo *tridentc = getTridentCardInfo(kd)
-
-typedef struct _tridentCursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} TridentCursor;
-
-#define TRIDENT_CURSOR_WIDTH 64
-#define TRIDENT_CURSOR_HEIGHT 64
-
-typedef struct _tridentScreenInfo {
-#ifdef VESA
- VesaScreenPrivRec vesa;
-#else
- FbdevScrPriv fbdev;
-#endif
- CARD8 *cursor_base;
- CARD8 *screen;
- CARD8 *off_screen;
- int off_screen_size;
- TridentCursor cursor;
-} TridentScreenInfo;
-
-#define getTridentScreenInfo(kd) ((TridentScreenInfo *) ((kd)->screen->driver))
-#define tridentScreenInfo(kd) TridentScreenInfo *tridents = getTridentScreenInfo(kd)
-
-Bool
-tridentDrawInit (ScreenPtr pScreen);
-
-void
-tridentDrawEnable (ScreenPtr pScreen);
-
-void
-tridentDrawSync (ScreenPtr pScreen);
-
-void
-tridentDrawDisable (ScreenPtr pScreen);
-
-void
-tridentDrawFini (ScreenPtr pScreen);
-
-CARD8
-tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index);
-
-void
-tridentWriteIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index, CARD8 value);
-
-Bool
-tridentCursorInit (ScreenPtr pScreen);
-
-void
-tridentCursorEnable (ScreenPtr pScreen);
-
-void
-tridentCursorDisable (ScreenPtr pScreen);
-
-void
-tridentCursorFini (ScreenPtr pScreen);
-
-void
-tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
-
-extern KdCardFuncs tridentFuncs;
-
-#endif /* _TRIDENT_H_ */
diff --git a/hw/kdrive/trident/tridentcurs.c b/hw/kdrive/trident/tridentcurs.c
deleted file mode 100644
index 5f62294fb..000000000
--- a/hw/kdrive/trident/tridentcurs.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Id: tridentcurs.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentcurs.c,v 1.5 2000/08/29 17:20:15 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "trident.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- tridentCardInfo(pScreenPriv); \
- tridentScreenInfo(pScreenPriv); \
- TridentCursor *pCurPriv = &tridents->cursor
-
-static void
-_tridentMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
-
- /* This is the recommended order to move the cursor */
-
- tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh);
- tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow);
- tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow);
- tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff);
- tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff);
- tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh);
-}
-
-static void
-tridentMoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- _tridentMoveCursor (pScreen, x, y);
-}
-
-static void
-tridentAllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
-
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
-}
-
-static void
-tridentSetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CARD32 fg, bg;
-
- fg = pCurPriv->source;
- bg = pCurPriv->mask;
- tridentWriteIndex (tridentc, 0x3d4, 0x48, fg);
- tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8);
- tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16);
-
- tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg);
- tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8);
- tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16);
-}
-
-void
-tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- tridentAllocCursorColors (pScreen);
- tridentSetCursorColors (pScreen);
-}
-
-#define InvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-static void
-tridentLoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- CARD32 *ram, *msk, *mskLine, *src, *srcLine;
- int i, j;
- int cursor_address;
- int lwsrc;
- unsigned char ramdac_control_;
- CARD32 offset;
-
- /*
- * Allocate new colors
- */
- tridentAllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (CARD32 *) tridents->cursor_base;
- mskLine = (CARD32 *) bits->mask;
- srcLine = (CARD32 *) bits->source;
-
- h = bits->height;
- if (h > TRIDENT_CURSOR_HEIGHT)
- h = TRIDENT_CURSOR_HEIGHT;
-
- lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
-
- for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) {
- msk = mskLine;
- src = srcLine;
- mskLine += lwsrc;
- srcLine += lwsrc;
- for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) {
-
- CARD32 m, s;
-
-#if 1
- if (i < h && j < lwsrc)
- {
- m = *msk++;
- s = *src++;
- InvertBits32(m);
- InvertBits32(s);
- }
- else
- {
- m = 0;
- s = 0;
- }
-#endif
- *ram++ = m;
- *ram++ = s;
- }
- }
-
- /* Set address for cursor bits */
- offset = tridents->cursor_base - (CARD8 *) tridents->screen;
- offset >>= 10;
- tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff));
- tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8));
-
- /* Set new color */
- tridentSetCursorColors (pScreen);
-
- /* Enable the cursor */
- tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1);
-
- /* Move to new position */
- tridentMoveCursor (pScreen, x, y);
-}
-
-static void
-tridentUnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- /* Disable cursor */
- tridentWriteIndex (tridentc, 0x3d4, 0x50, 0);
-}
-
-static Bool
-tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- tridentLoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- tridentLoadCursor (pScreen, x, y);
- else
- tridentUnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec tridentPointerSpriteFuncs = {
- tridentRealizeCursor,
- tridentUnrealizeCursor,
- tridentSetCursor,
- tridentMoveCursor,
-};
-
-static void
-tridentQueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-tridentCursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!tridents->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = TRIDENT_CURSOR_WIDTH;
- pCurPriv->height= TRIDENT_CURSOR_HEIGHT;
- pScreen->QueryBestSize = tridentQueryBestSize;
- miPointerInitialize (pScreen,
- &tridentPointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-tridentCursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- int x, y;
-
- miPointerPosition (&x, &y);
- tridentLoadCursor (pScreen, x, y);
- }
- else
- tridentUnloadCursor (pScreen);
- }
-}
-
-void
-tridentCursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- tridentUnloadCursor (pScreen);
- }
- }
-}
-
-void
-tridentCursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/trident/tridentdraw.c b/hw/kdrive/trident/tridentdraw.c
deleted file mode 100644
index 641d9239b..000000000
--- a/hw/kdrive/trident/tridentdraw.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Id: tridentdraw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.c,v 1.10 2001/06/03 18:48:19 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "trident.h"
-#include "tridentdraw.h"
-
-#include "Xmd.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mistruct.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-#include "fb.h"
-#include "migc.h"
-#include "miline.h"
-#include "picturestr.h"
-
-CARD8 tridentRop[16] = {
- /* GXclear */ 0x00, /* 0 */
- /* GXand */ 0x88, /* src AND dst */
- /* GXandReverse */ 0x44, /* src AND NOT dst */
- /* GXcopy */ 0xcc, /* src */
- /* GXandInverted*/ 0x22, /* NOT src AND dst */
- /* GXnoop */ 0xaa, /* dst */
- /* GXxor */ 0x66, /* src XOR dst */
- /* GXor */ 0xee, /* src OR dst */
- /* GXnor */ 0x11, /* NOT src AND NOT dst */
- /* GXequiv */ 0x99, /* NOT src XOR dst */
- /* GXinvert */ 0x55, /* NOT dst */
- /* GXorReverse */ 0xdd, /* src OR NOT dst */
- /* GXcopyInverted*/ 0x33, /* NOT src */
- /* GXorInverted */ 0xbb, /* NOT src OR dst */
- /* GXnand */ 0x77, /* NOT src OR NOT dst */
- /* GXset */ 0xff, /* 1 */
-};
-
-#define tridentFillPix(bpp,pixel) {\
- if (bpp == 8) \
- { \
- pixel = pixel & 0xff; \
- pixel = pixel | pixel << 8; \
- } \
- if (bpp <= 16) \
- { \
- pixel = pixel & 0xffff; \
- pixel = pixel | pixel << 16; \
- } \
-}
-
-static Cop *cop;
-static CARD32 cmd;
-
-Bool
-tridentPrepareSolid (DrawablePtr pDrawable,
- int alu,
- Pixel pm,
- Pixel fg)
-{
- FbBits depthMask = FbFullMask(pDrawable->depth);
-
- if ((pm & depthMask) != depthMask)
- return FALSE;
- else
- {
- KdScreenPriv(pDrawable->pScreen);
- tridentCardInfo(pScreenPriv);
- cop = tridentc->cop;
-
- tridentFillPix(pDrawable->bitsPerPixel,fg);
- _tridentInit(cop,tridentc);
- _tridentSetSolidRect(cop,fg,alu,cmd);
- return TRUE;
- }
-}
-
-void
-tridentSolid (int x1, int y1, int x2, int y2)
-{
- _tridentRect (cop, x1, y1, x2 - 1, y2 - 1, cmd);
-}
-
-void
-tridentDoneSolid (void)
-{
-}
-
-Bool
-tridentPrepareCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- int dx,
- int dy,
- int alu,
- Pixel pm)
-{
- FbBits depthMask = FbFullMask(pDstDrawable->depth);
-
- if ((pm & depthMask) == depthMask)
- {
- KdScreenPriv(pDstDrawable->pScreen);
- tridentCardInfo(pScreenPriv);
- cop = tridentc->cop;
- _tridentInit(cop,tridentc);
- cop->multi = COP_MULTI_PATTERN;
- cop->multi = COP_MULTI_ROP | tridentRop[alu];
- cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FB;
- if (dx < 0 || dy < 0)
- cmd |= COP_X_REVERSE;
- return TRUE;
- }
- else
- return FALSE;
-}
-
-void
-tridentCopy (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int w,
- int h)
-{
- if (cmd & COP_X_REVERSE)
- {
- cop->src_start_xy = TRI_XY (srcX + w - 1, srcY + h - 1);
- cop->src_end_xy = TRI_XY (srcX, srcY);
- cop->dst_start_xy = TRI_XY (dstX + w - 1, dstY + h - 1);
- cop->dst_end_xy = TRI_XY (dstX, dstY);
- }
- else
- {
- cop->src_start_xy = TRI_XY (srcX, srcY);
- cop->src_end_xy = TRI_XY (srcX + w - 1, srcY + h - 1);
- cop->dst_start_xy = TRI_XY (dstX, dstY);
- cop->dst_end_xy = TRI_XY (dstX + w - 1, dstY + h - 1);
- }
- _tridentWaitDone (cop);
- cop->command = cmd;
-}
-
-void
-tridentDoneCopy (void)
-{
-}
-
-void
-tridentComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- SetupTrident (pDst->pDrawable->pScreen);
- tridentScreenInfo(pScreenPriv);
- RegionRec region;
- int n;
- BoxPtr pbox;
- CARD32 rgb;
- CARD8 *msk, *mskLine;
- FbBits *mskBits;
- FbStride mskStride;
- int mskBpp;
- int mskXoff, mskYoff;
- CARD32 *src, *srcLine;
- CARD32 *off, *offLine;
- FbBits *srcBits;
- FbStride srcStride;
- int srcXoff, srcYoff;
- FbStride offStride;
- int srcBpp;
- int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
- int x2;
- int w, h, w_this, h_this, w_remain;
- CARD32 *off_screen;
- int off_size = tridents->off_screen_size >> 2;
- int off_width, off_height;
- int stride = pScreenPriv->screen->fb[0].pixelStride;
- int mskExtra;
- CARD32 off_screen_offset = tridents->off_screen - tridents->screen;
- int mode;
-
-#define MODE_NONE 0
-#define MODE_IMAGE 1
-#define MODE_MASK 2
-
- rgb = *((CARD32 *) ((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr);
- if (pMask &&
- !pMask->repeat &&
- pMask->format == PICT_a8 &&
- op == PictOpOver &&
- pSrc->repeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1 &&
- PICT_FORMAT_BPP(pSrc->format) == 32 &&
- (PICT_FORMAT_A(pSrc->format) == 0 ||
- (rgb & 0xff000000) == 0xff000000) &&
- pDst->pDrawable->bitsPerPixel == 32 &&
- pDst->pDrawable->type == DRAWABLE_WINDOW)
- {
- mode = MODE_MASK;
- }
- else if (!pMask &&
- op == PictOpOver &&
- !pSrc->repeat &&
- PICT_FORMAT_A(pSrc->format) == 8 &&
- PICT_FORMAT_BPP(pSrc->format) == 32 &&
- pDst->pDrawable->bitsPerPixel == 32 &&
- pDst->pDrawable->type == DRAWABLE_WINDOW)
- {
- mode = MODE_IMAGE;
- }
- else
- mode = MODE_NONE;
-
- if (mode != MODE_NONE)
- {
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- fbGetDrawable (pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
-
- if (pMask)
- {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- fbGetDrawable (pMask->pDrawable, mskBits, mskStride, mskBpp, mskXoff, mskYoff);
- mskStride = mskStride * sizeof (FbBits) / sizeof (CARD8);
- }
-
- if (!miComputeCompositeRegion (&region,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height))
- return;
-
- _tridentInit(cop,tridentc);
-
- cop->multi = COP_MULTI_PATTERN;
- cop->src_offset = off_screen_offset;
-
- if (mode == MODE_IMAGE)
- {
- cop->multi = (COP_MULTI_ALPHA |
- COP_ALPHA_BLEND_ENABLE |
- COP_ALPHA_WRITE_ENABLE |
- 0x7 << 16 |
- COP_ALPHA_DST_BLEND_1_SRC_A |
- COP_ALPHA_SRC_BLEND_1);
- }
- else
- {
- rgb &= 0xffffff;
- cop->multi = (COP_MULTI_ALPHA |
- COP_ALPHA_BLEND_ENABLE |
- COP_ALPHA_WRITE_ENABLE |
- 0x7 << 16 |
- COP_ALPHA_DST_BLEND_1_SRC_A |
- COP_ALPHA_SRC_BLEND_SRC_A);
- }
-
- n = REGION_NUM_RECTS (&region);
- pbox = REGION_RECTS (&region);
-
- while (n--)
- {
- h = pbox->y2 - pbox->y1;
- w = pbox->x2 - pbox->x1;
-
- offStride = (w + 7) & ~7;
- off_height = off_size / offStride;
- if (off_height > h)
- off_height = h;
-
- cop->multi = COP_MULTI_STRIDE | (stride << 16) | offStride;
-
- y_dst = pbox->y1;
- y_src = y_dst - yDst + ySrc;
- y_msk = y_dst - yDst + yMask;
-
- x_dst = pbox->x1;
- x_src = x_dst - xDst + xSrc;
- x_msk = x_dst - xDst + xMask;
-
- if (mode == MODE_IMAGE)
- srcLine = (CARD32 *) srcBits + (y_src - srcYoff) * srcStride + (x_src - srcXoff);
- else
- mskLine = (CARD8 *) mskBits + (y_msk - mskYoff) * mskStride + (x_msk - mskXoff);
-
- while (h)
- {
- h_this = h;
- if (h_this > off_height)
- h_this = off_height;
- h -= h_this;
-
- offLine = (CARD32 *) tridents->off_screen;
-
- _tridentWaitDone(cop);
-
- cop->dst_start_xy = TRI_XY(x_dst, y_dst);
- cop->dst_end_xy = TRI_XY(x_dst + w - 1, y_dst + h_this - 1);
- cop->src_start_xy = TRI_XY(0,0);
- cop->src_end_xy = TRI_XY(w - 1, h_this - 1);
-
- if (mode == MODE_IMAGE)
- {
- while (h_this--)
- {
- w_remain = w;
- src = srcLine;
- srcLine += srcStride;
- off = offLine;
- offLine += offStride;
- while (w_remain--)
- *off++ = *src++;
- }
- }
- else
- {
- while (h_this--)
- {
- w_remain = w;
- msk = mskLine;
- mskLine += mskStride;
- off = offLine;
- offLine += offStride;
- while (w_remain--)
- *off++ = rgb | (*msk++ << 24);
- }
- }
-
- cop->command = (COP_OP_BLT |
- COP_SCL_OPAQUE |
- COP_OP_FB);
- }
- pbox++;
- }
- cop->src_offset = 0;
-
- KdMarkSync (pDst->pDrawable->pScreen);
- }
- else
- {
- KdCheckComposite (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
- }
-}
-
-KaaScreenPrivRec tridentKaa = {
- tridentPrepareSolid,
- tridentSolid,
- tridentDoneSolid,
-
- tridentPrepareCopy,
- tridentCopy,
- tridentDoneCopy,
-};
-
-Bool
-tridentDrawInit (ScreenPtr pScreen)
-{
- SetupTrident(pScreen);
- tridentScreenInfo(pScreenPriv);
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- if (!kaaDrawInit (pScreen, &tridentKaa))
- return FALSE;
-
- if (ps && tridents->off_screen)
- ps->Composite = tridentComposite;
-
- return TRUE;
-}
-
-void
-tridentDrawEnable (ScreenPtr pScreen)
-{
- SetupTrident(pScreen);
- CARD32 cmd;
- CARD32 base;
- CARD16 stride;
- CARD32 format;
- CARD32 alpha;
- int tries;
- int nwrite;
-
- stride = pScreenPriv->screen->fb[0].pixelStride;
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 8:
- format = COP_DEPTH_8;
- break;
- case 16:
- format = COP_DEPTH_16;
- break;
- case 24:
- format = COP_DEPTH_24_32;
- break;
- case 32:
- format = COP_DEPTH_24_32;
- break;
- }
- /*
- * compute a few things which will be set every time the
- * accelerator is used; this avoids problems with APM
- */
- tridentc->cop_depth = COP_MULTI_DEPTH | format;
- tridentc->cop_stride = COP_MULTI_STRIDE | (stride << 16) | (stride);
-
-#define NUM_TRIES 100000
- for (tries = 0; tries < NUM_TRIES; tries++)
- if (!(cop->status & COP_STATUS_BUSY))
- break;
- if (cop->status & COP_STATUS_BUSY)
- FatalError ("Can't initialize graphics coprocessor");
- cop->multi = COP_MULTI_CLIP_TOP_LEFT;
- cop->multi = COP_MULTI_MASK | 0;
- cop->src_offset = 0;
- cop->dst_offset = 0;
- cop->z_offset = 0;
- cop->clip_bottom_right = 0x0fff0fff;
-
- _tridentInit(cop,tridentc);
- _tridentSetSolidRect(cop, pScreen->blackPixel, GXcopy, cmd);
- _tridentRect (cop, 0, 0,
- pScreenPriv->screen->width, pScreenPriv->screen->height,
- cmd);
- KdMarkSync (pScreen);
-}
-
-void
-tridentDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-tridentDrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-tridentDrawSync (ScreenPtr pScreen)
-{
- SetupTrident(pScreen);
-
- _tridentWaitIdleEmpty(cop);
-}
diff --git a/hw/kdrive/trident/tridentdraw.h b/hw/kdrive/trident/tridentdraw.h
deleted file mode 100644
index ec09167a8..000000000
--- a/hw/kdrive/trident/tridentdraw.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Id: tridentdraw.h,v 1.1 1999/11/02 03:54:47 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.h,v 1.2 1999/12/30 03:03:18 robin Exp $ */
-
-#ifndef _TRIDENTDRAW_H_
-#define _TRIDENTDRAW_H_
-
-#define SetupTrident(s) KdScreenPriv(s); \
- tridentCardInfo(pScreenPriv); \
- Cop *cop = tridentc->cop
-
-#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
-
-#define _tridentInit(cop,tridentc) { \
- if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \
- (cop)->multi = (tridentc)->cop_depth; \
- (cop)->multi = (tridentc)->cop_stride; \
- (cop)->multi = TridentAlpha; \
-} \
-
-#define _tridentSetSolidRect(cop,pix,alu,cmd) {\
- cop->multi = COP_MULTI_PATTERN; \
- cop->multi = COP_MULTI_ROP | tridentRop[alu]; \
- cop->fg = (pix); \
- cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
-}
-
-#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \
- (cop)->dst_start_xy = TRI_XY (x1,y1); \
- (cop)->dst_end_xy = TRI_XY(x2,y2); \
- _tridentWaitDone(cop); \
- (cop)->command = (cmd); \
-}
-
-#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
- COP_STATUS_DPE_BUSY | \
- COP_STATUS_MI_BUSY)
-
-#define _tridentWaitDone(cop) { \
- int __q__ = 500000; \
- while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
- ; \
- if (!__q__) \
- (cop)->status = 0; \
-}
-
-#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop)
-
-#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
-
-#endif
diff --git a/hw/kdrive/trident/tridentstub.c b/hw/kdrive/trident/tridentstub.c
deleted file mode 100644
index 1e9761141..000000000
--- a/hw/kdrive/trident/tridentstub.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Id: tridentstub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentstub.c,v 1.5 2000/11/29 08:42:25 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "trident.h"
-
-extern int trident_clk, trident_mclk;
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x1023, 0x9525, 0, &attr))
- KdCardInfoAdd (&tridentFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!strcmp (argv[i], "-clk"))
- {
- if (i+1 < argc)
- trident_clk = atoi (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-mclk"))
- {
- if (i+1 < argc)
- trident_mclk = atoi (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
-
-#ifdef VESA
- if (!(ret = vesaProcessArgument (argc, argv, i)))
-#endif
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/trio/Imakefile b/hw/kdrive/trio/Imakefile
deleted file mode 100644
index 1cc1ecaac..000000000
--- a/hw/kdrive/trio/Imakefile
+++ /dev/null
@@ -1,20 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/nvfb/Imakefile,v 3.8 1996/12/23 06:30:19 dawes Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = s3.c s3clock.c s3cmap.c s3curs.c s3draw.c s3gc.c s3stub.c
-
-OBJS = s3.o s3clock.o s3cmap.o s3curs.o s3draw.o s3gc.o s3stub.o
-
-INCLUDES = -I. $(KDINCS)
-
-DEFINES = -DS3_TRIO
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(trio,$(OBJS))
-DependTarget()
-
-LinkSourceFile(s3draw.h,../savage)
-LinkSourceFile(s3draw.c,../savage)
-LinkSourceFile(s3gc.c,../savage)
diff --git a/hw/kdrive/trio/s3.c b/hw/kdrive/trio/s3.c
deleted file mode 100644
index c8359733b..000000000
--- a/hw/kdrive/trio/s3.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
- * Id: s3.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3.c,v 1.4 2000/05/06 22:17:52 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-#define REGISTERS_OFFSET (0x1000000)
-#define PACKED_OFFSET (0x8100)
-
-
-CARD8
-_s3ReadIndexRegister (volatile CARD8 *base, CARD8 index)
-{
- CARD8 ret;
- *base = index;
- ret = *(base + 1);
- DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x -> 0x%02x",
- ((int) base) & 0xfff, index, ret));
- return ret;
-}
-
-void
-_s3WriteIndexRegister (volatile CARD8 *base, CARD8 index, CARD8 value)
-{
- DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x <- 0x%02x",
- ((int) base) & 0xfff, index, value));
- *base = index;
- *(base + 1) = value;
-}
-
-/*
- * Map the S3 card and detect its configuration. Do not touch the card
- */
-
-static void
-_s3LoadCrtc (S3Ptr s3, S3Crtc *crtc)
-{
- crtc->h_total_0_7 = GetCrtc (s3, 0x00);
- crtc->h_display_end_0_7 = GetCrtc (s3, 0x01);
- crtc->h_blank_start_0_7 = GetCrtc (s3, 0x02);
- crtc->_h_blank_end = GetCrtc (s3, 0x03);
- crtc->h_sync_start_0_7 = GetCrtc (s3, 0x04);
- crtc->_h_sync_end = GetCrtc (s3, 0x05);
- crtc->v_total_0_7 = GetCrtc (s3, 0x06);
- crtc->crtc_overflow = GetCrtc (s3, 0x07);
- crtc->preset_row_scan = GetCrtc (s3, 0x08);
- crtc->_max_scan_line = GetCrtc (s3, 0x09);
-
- crtc->start_address_8_15 = GetCrtc (s3, 0x0c);
- crtc->start_address_0_7 = GetCrtc (s3, 0x0d);
-
- crtc->v_retrace_start_0_7 = GetCrtc (s3, 0x10);
- crtc->_v_retrace_end = GetCrtc (s3, 0x11);
- crtc->v_display_end_0_7 = GetCrtc (s3, 0x12);
- crtc->screen_off_0_7 = GetCrtc (s3, 0x13);
-
- crtc->v_blank_start_0_7 = GetCrtc (s3, 0x15);
- crtc->v_blank_end_0_7 = GetCrtc (s3, 0x16);
-
- crtc->line_compare_0_7 = GetCrtc (s3, 0x18);
-
- crtc->memory_configuration = GetCrtc (s3, 0x31);
-
- crtc->misc_1 = GetCrtc (s3, 0x3a);
- crtc->h_start_fifo_fetch_0_7 = GetCrtc (s3, 0x3b);
-
- crtc->mode_control = GetCrtc (s3, 0x42);
-
- crtc->hardware_cursor_mode = GetCrtc (s3, 0x45);
- crtc->cursor_address_8_15 = GetCrtc (s3, 0x4C);
- crtc->cursor_address_0_7 = GetCrtc (s3, 0x4D);
-
- crtc->extended_system_control_1 = GetCrtc (s3, 0x50);
- crtc->extended_system_control_2 = GetCrtc (s3, 0x51);
-
- crtc->extended_memory_control = GetCrtc (s3, 0x53);
-
- crtc->extended_ramdac_control = GetCrtc (s3, 0x55);
-
- crtc->extended_horizontal_overflow = GetCrtc (s3, 0x5d);
- crtc->extended_vertical_overflow = GetCrtc (s3, 0x5e);
-
- crtc->l_parm_0_7 = GetCrtc (s3, 0x62);
-
- crtc->extended_misc_control = GetCrtc (s3, 0x65);
-
- crtc->extended_misc_control_2 = GetCrtc (s3, 0x67);
-
- crtc->configuration_3 = GetCrtc (s3, 0x68);
-
- crtc->extended_system_control_3 = GetCrtc (s3, 0x69);
-
- crtc->extended_bios_5 = GetCrtc (s3, 0x6d);
-
- crtc->extended_sequencer_b = GetSrtc (s3, 0x0b);
- crtc->extended_sequencer_d = GetSrtc (s3, 0x0d);
- crtc->dclk_value_low = GetSrtc (s3, 0x12);
- crtc->dclk_value_high = GetSrtc (s3, 0x13);
- crtc->control_2 = GetSrtc (s3, 0x15);
- crtc->ramdac_control = GetSrtc (s3, 0x18);
-
-/* combine values */
-
- switch (crtc_ge_screen_width(crtc)) {
- case 0:
- if (crtc->enable_two_page)
- crtc->ge_screen_pitch = 2048;
- else
- crtc->ge_screen_pitch = 1024;
- break;
- case 1:
- crtc->ge_screen_pitch = 640;
- break;
- case 2:
- /* ignore magic 1600x1200x4 mode */
- crtc->ge_screen_pitch = 800;
- break;
- case 3:
- crtc->ge_screen_pitch = 1280;
- break;
- case 4:
- crtc->ge_screen_pitch = 1152;
- break;
- case 5:
- crtc->ge_screen_pitch = 0; /* reserved */
- break;
- case 6:
- crtc->ge_screen_pitch = 1600;
- break;
- case 7:
- crtc->ge_screen_pitch = 0; /* reserved */
- break;
- }
- switch (crtc->pixel_length) {
- case 0:
- crtc->bits_per_pixel = 8;
- crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8;
- break;
- case 1:
- crtc->bits_per_pixel = 16;
- crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 4;
- break;
- case 3:
- crtc->bits_per_pixel = 32;
- crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8;
- break;
- }
- crtc->double_pixel_mode = 0;
- switch (crtc->color_mode) {
- case 0x0:
- crtc->depth = 8; break;
- case 0x1:
- crtc->depth = 8; crtc->double_pixel_mode = 1; break;
- case 0x3:
- crtc->depth = 15; break;
- case 0x5:
- crtc->depth = 16; break;
- case 0x7:
- crtc->depth = 24; break; /* unused */
- case 0xd:
- crtc->depth = 24; break;
- }
-}
-
-static void
-_s3SetBlank (S3Ptr s3, Bool blank)
-{
- CARD8 clock_mode;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "3c4 at 0x%x\n", &s3->crt_vga_3c4));
- clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01);
- if (blank)
- clock_mode |= 0x20;
- else
- clock_mode &= ~0x20;
- _s3WaitVRetrace (s3);
- _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, clock_mode);
- DRAW_DEBUG ((DEBUG_S3INIT, "blank is set to 0x%x", clock_mode));
-}
-
-static void
-_s3SetDepth (S3Ptr s3, S3Crtc *crtc)
-{
- CARD8 save_3c2;
- _s3SetBlank (s3, TRUE);
- PutCrtc(s3, 0x38, 0x48);
- PutCrtc(s3, 0x39, 0xA0);
- PutCrtc(s3, 0x00, crtc->h_total_0_7);
- PutCrtc(s3, 0x01, crtc->h_display_end_0_7);
- PutCrtc(s3, 0x02, crtc->h_blank_start_0_7);
- PutCrtc(s3, 0x03, crtc->_h_blank_end);
- PutCrtc(s3, 0x04, crtc->h_sync_start_0_7);
- PutCrtc(s3, 0x05, crtc->_h_sync_end);
- PutCrtc(s3, 0x06, crtc->v_total_0_7);
- PutCrtc(s3, 0x07, crtc->crtc_overflow);
- PutCrtc(s3, 0x09, crtc->_max_scan_line);
- PutCrtc(s3, 0x0c, crtc->start_address_8_15);
- PutCrtc(s3, 0x0d, crtc->start_address_0_7);
- PutCrtc(s3, 0x10, crtc->v_retrace_start_0_7);
- PutCrtc(s3, 0x11, crtc->_v_retrace_end);
- PutCrtc(s3, 0x12, crtc->v_display_end_0_7);
- PutCrtc(s3, 0x13, crtc->screen_off_0_7);
- PutCrtc(s3, 0x15, crtc->v_blank_start_0_7);
- PutCrtc(s3, 0x16, crtc->v_blank_end_0_7);
- PutCrtc(s3, 0x18, crtc->line_compare_0_7);
- PutCrtc(s3, 0x31, crtc->memory_configuration);
- PutCrtc(s3, 0x3a, crtc->misc_1);
- PutCrtc(s3, 0x3b, crtc->h_start_fifo_fetch_0_7);
- PutCrtc(s3, 0x42, crtc->mode_control);
- PutCrtc(s3, 0x45, crtc->hardware_cursor_mode);
- PutCrtc(s3, 0x4c, crtc->cursor_address_8_15);
- PutCrtc(s3, 0x4d, crtc->cursor_address_0_7);
- PutCrtc(s3, 0x50, crtc->extended_system_control_1);
- PutCrtc(s3, 0x51, crtc->extended_system_control_2);
- PutCrtc(s3, 0x53, crtc->extended_memory_control);
- PutCrtc(s3, 0x55, crtc->extended_ramdac_control);
- PutCrtc(s3, 0x5d, crtc->extended_horizontal_overflow);
- PutCrtc(s3, 0x5e, crtc->extended_vertical_overflow);
- PutCrtc(s3, 0x62, crtc->l_parm_0_7);
- PutCrtc(s3, 0x65, crtc->extended_misc_control);
- PutCrtc(s3, 0x67, crtc->extended_misc_control_2);
- PutCrtc(s3, 0x68, crtc->configuration_3);
- PutCrtc(s3, 0x69, crtc->extended_system_control_3);
- PutCrtc(s3, 0x6d, crtc->extended_bios_5);
- PutCrtc(s3, 0x39, 0x00);
- PutCrtc(s3, 0x38, 0x00);
- PutSrtc(s3, 0x0b, crtc->extended_sequencer_b);
- PutSrtc(s3, 0x0d, crtc->extended_sequencer_d);
- /*
- * Move new dclk/mclk values into PLL
- */
- save_3c2 = s3->crt_vga_3cc;
- DRAW_DEBUG ((DEBUG_S3INIT, "save_3c2 0x%x", save_3c2));
- s3->crt_vga_3c2 = save_3c2 | 0x0c;
-
- PutSrtc(s3, 0x12, crtc->dclk_value_low);
- PutSrtc(s3, 0x13, crtc->dclk_value_high);
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Set PLL load enable, frobbing clk_load..."));
- crtc->dfrq_en = 1;
- PutSrtc(s3, 0x15, crtc->control_2);
- PutSrtc(s3, 0x18, crtc->ramdac_control);
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Clk load frobbed, restoring 3c2 to 0x%x", save_3c2));
- s3->crt_vga_3c2 = save_3c2;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Enabling display"));
- _s3SetBlank (s3, FALSE);
-}
-
-void
-_s3RestoreCrtc (S3Ptr s3, S3Crtc *crtc)
-{
- _s3SetDepth (s3, crtc);
-}
-
-s3Reset (S3CardInfo *s3c)
-{
- S3Ptr s3 = s3c->s3;
- S3Save *save = &s3c->save;
- CARD8 *cursor_base;
-
- LockS3 (s3c);
-
- _s3UnlockExt (s3);
-
- _s3RestoreCrtc (s3, &save->crtc);
-
- /* set foreground */
- /* Reset cursor color stack pointers */
- (void) GetCrtc(s3, 0x45);
- PutCrtc(s3, 0x4a, save->cursor_fg);
- /* XXX for deeper screens? */
-
- /* set background */
- /* Reset cursor color stack pointers */
- (void) GetCrtc(s3, 0x45);
- PutCrtc(s3, 0x4b, save->cursor_bg);
-
- _s3LockExt (s3);
-
- /* graphics engine state */
- s3->alt_mix = save->alt_mix;
- s3->write_mask = save->write_mask;
- s3->fg = save->fg;
- s3->bg = save->bg;
- /* XXX should save and restore real values? */
- s3->scissors_tl = 0x00000000;
- s3->scissors_br = 0x0fff0fff;
-
- _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, save->clock_mode);
- PutCrtc(s3, 0x39, save->lock2);
- PutCrtc(s3, 0x38, save->lock1);
-
- UnlockS3 (s3c);
-}
-
-void
-s3Save (S3CardInfo *s3c)
-{
- S3Ptr s3 = s3c->s3;
- S3Save *save = &s3c->save;
- S3Crtc newCrtc;
- CARD8 t1, t2;
- CARD8 *cursor_base;
-
- LockS3 (s3c);
-
- save->alt_mix = s3->alt_mix;
- save->write_mask = s3->write_mask;
- save->fg = s3->fg;
- save->bg = s3->bg;
-
- save->lock1 = GetCrtc(s3, 0x38);
- save->lock2 = GetCrtc(s3, 0x39);
- save->clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01);
-
- _s3UnlockExt (s3);
- save->cursor_fg = GetCrtc(s3, 0x4a);
- save->cursor_bg = GetCrtc(s3, 0x4b);
-
- _s3LoadCrtc (s3, &save->crtc);
-
- _s3LockExt (s3);
-
- UnlockS3 (s3c);
-}
-Bool
-s3CardInit (KdCardInfo *card)
-{
- S3CardInfo *s3c;
- S3Ptr s3;
- int size;
- CARD8 *registers;
- CARD32 s3Address = card->attr.address[0];
- CARD8 *temp_buffer;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "s3CardInit"));
- s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo));
- if (!s3c)
- {
- DRAW_DEBUG ((DEBUG_FAILURE, "can't alloc s3 card info"));
- goto bail0;
- }
-
- memset (s3c, '\0', sizeof (S3CardInfo));
-
- card->driver = s3c;
-
- fprintf (stderr, "S3 at 0x%x\n", s3Address);
- registers = KdMapDevice (s3Address + REGISTERS_OFFSET,
- sizeof (S3) + PACKED_OFFSET);
- if (!registers)
- {
- ErrorF ("Can't map s3 device\n");
- goto bail2;
- }
- s3 = (S3Ptr) (registers + PACKED_OFFSET);
- s3c->registers = registers;
- s3c->s3 = s3;
-
- s3->crt_vga_3c3 = 1; /* wake up part from deep sleep */
- s3->crt_vga_3c2 = 0x01 | 0x02 | 0x0c;
-
- s3->crt_vga_3c4 = 0x58;
- s3->crt_vga_3c5 = 0x10 | 0x3;
-
- /*
- * Can't trust S3 register value for frame buffer amount, must compute
- */
- temp_buffer = KdMapDevice (s3Address, 4096 * 1024);
-
- s3c->memory = KdFrameBufferSize (temp_buffer, 4096 * 1024);
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Detected frame buffer %d", s3c->memory));
-
- KdUnmapDevice (temp_buffer, 4096 * 1024);
-
- if (!s3c->memory)
- {
- ErrorF ("Can't detect s3 frame buffer\n");
- goto bail3;
- }
-
- s3c->frameBuffer = KdMapDevice (s3Address, s3c->memory);
- if (!s3c->frameBuffer)
- {
- ErrorF ("Can't map s3 frame buffer\n");
- goto bail3;
- }
-
- card->driver = s3c;
-
- return TRUE;
-bail3:
- KdUnmapDevice ((void *) s3, sizeof (S3));
-bail2:
-bail1:
- xfree (s3c);
-bail0:
- return FALSE;
-}
-
-Bool
-s3ModeSupported (KdScreenInfo *screen,
- const KdMonitorTiming *t)
-{
- if (t->horizontal != 1600 &&
- t->horizontal != 1280 &&
- t->horizontal != 1152 &&
- t->horizontal != 1024 &&
- t->horizontal != 800 &&
- t->horizontal != 640)
- return FALSE;
- if (t->clock > S3_MAX_CLOCK * 2)
- return FALSE;
- return TRUE;
-}
-
-Bool
-s3ModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
- int screen_size;
- int pixel_width;
- int byte_width;
-
- if (screen->fb[0].depth >= 24)
- {
- screen->fb[0].depth = 24;
- screen->fb[0].bitsPerPixel = 32;
- }
- else if (screen->fb[0].depth >= 16)
- {
- screen->fb[0].depth = 16;
- screen->fb[0].bitsPerPixel = 16;
- }
- else if (screen->fb[0].depth >= 15)
- {
- screen->fb[0].depth = 15;
- screen->fb[0].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[0].depth = 8;
- screen->fb[0].bitsPerPixel = 8;
- }
-
- byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
- pixel_width = screen->width;
- screen->fb[0].pixelStride = pixel_width;
- screen->fb[0].byteStride = byte_width;
-
- screen_size = byte_width * screen->height;
-
- return screen_size <= s3c->memory;
-}
-
-Bool
-s3ScreenInit (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
- S3ScreenInfo *s3s;
- int screen_size;
- int memory;
- int requested_memory;
- int v_total, h_total;
- int byte_width;
- int pixel_width;
- int m, n, r;
- int i;
- const KdMonitorTiming *t;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "s3ScreenInit"));
- s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo));
- if (!s3s)
- return FALSE;
-
- memset (s3s, '\0', sizeof (S3ScreenInfo));
-
- if (!screen->width || !screen->height)
- {
- screen->width = 800;
- screen->height = 600;
- screen->rate = 72;
- }
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 8;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Requested parameters %dx%dx%d",
- screen->width, screen->height, screen->rate));
- t = KdFindMode (screen, s3ModeSupported);
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
- s3GetClock (t->clock, &m, &n, &r, 127, 31, 3);
-#if 0
- fprintf (stderr, "computed %d,%d,%d (%d) provided %d,%d,%d (%d)\n",
- m, n, r, S3_CLOCK(m,n,r),
- t->dac_m, t->dac_n, t->dac_r,
- S3_CLOCK(t->dac_m, t->dac_n, t->dac_r));
-#endif
- /*
- * Can only operate in pixel-doubled mode at 8 bits per pixel
- */
- if (screen->fb[0].depth > 8 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK)
- screen->fb[0].depth = 8;
-
- if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported))
- {
- xfree (s3s);
- return FALSE;
- }
-
- memory = s3c->memory - screen_size;
-
- /*
- * Stick frame buffer at start of memory
- */
- screen->fb[0].frameBuffer = s3c->frameBuffer;
-
- /*
- * Stick cursor at end of memory
- */
- if (memory >= 2048)
- {
- s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048);
- memory -= 2048;
- }
- else
- s3s->cursor_base = 0;
-
- /*
- * Use remaining memory for off-screen storage, but only use
- * one piece (either right or bottom).
- */
- if (memory >= byte_width * S3_TILE_SIZE)
- {
- s3s->fb[0].offscreen = s3c->frameBuffer + screen_size;
- s3s->fb[0].offscreen_x = 0;
- s3s->fb[0].offscreen_y = screen_size / byte_width;
- s3s->fb[0].offscreen_width = pixel_width;
- s3s->fb[0].offscreen_height = memory / byte_width;
- memory -= s3s->fb[0].offscreen_height * byte_width;
- }
- else if (pixel_width - screen->width >= S3_TILE_SIZE)
- {
- s3s->fb[0].offscreen = s3c->frameBuffer + screen->width;
- s3s->fb[0].offscreen_x = screen->width;
- s3s->fb[0].offscreen_y = 0;
- s3s->fb[0].offscreen_width = pixel_width - screen->width;
- s3s->fb[0].offscreen_height = screen->height;
- }
- else
- s3s->fb[0].offscreen = 0;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "depth %d bits %d", screen->fb[0].depth, screen->fb[0].bitsPerPixel));
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Screen size %dx%d memory %d",
- screen->width, screen->height, s3c->memory));
- DRAW_DEBUG ((DEBUG_S3INIT, "frame buffer 0x%x cursor 0x%x offscreen 0x%x",
- s3c->frameBuffer, s3s->cursor_base, s3s->offscreen));
- DRAW_DEBUG ((DEBUG_S3INIT, "offscreen %dx%d+%d+%d",
- s3s->offscreen_width, s3s->offscreen_height,
- s3s->offscreen_x, s3s->offscreen_y));
-
- switch (screen->fb[0].depth) {
- case 8:
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case 15:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x03e0;
- screen->fb[0].redMask = 0x7c00;
- break;
- case 16:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x07e0;
- screen->fb[0].redMask = 0xf800;
- break;
- case 24:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x0000ff;
- screen->fb[0].greenMask = 0x00ff00;
- screen->fb[0].redMask = 0xff0000;
- break;
- }
-
- screen->driver = s3s;
-
- return TRUE;
-}
-
-void
-s3Preserve (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
-
- s3Save (s3c);
-}
-
-/*
- * Enable the card for rendering. Manipulate the initial settings
- * of the card here.
- */
-Bool
-s3Enable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- KdScreenInfo *screen = pScreenPriv->screen;
- s3CardInfo (pScreenPriv);
- s3ScreenInfo (pScreenPriv);
-
- S3Crtc crtcR, *crtc;
- int hactive, hblank, hfp, hbp;
- int vactive, vblank, vfp, vbp;
- int hsize;
-
- int h_total;
- int h_display_end;
- int h_blank_start;
- int h_blank_end;
- int h_sync_start;
- int h_sync_end;
- int h_screen_off;
- int h_start_fifo_fetch;
-
- int v_total;
- int v_retrace_start;
- int v_retrace_end;
- int v_display_end;
- int v_blank_start;
- int v_blank_end;
-
- int h_adjust;
- int h_sync_extend_;
- int h_blank_extend_;
- int i;
- CARD16 cursor_address;
- const KdMonitorTiming *t;
- int m, n, r;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "s3Enable"));
-
- DRAW_DEBUG ((DEBUG_S3INIT, "requested bpp %d current %d",
- pScreenPriv->bitsPerPixel, s3c->save.crtc.bits_per_pixel));
-
- t = KdFindMode (screen, s3ModeSupported);
-
- hfp = t->hfp;
- hbp = t->hbp;
- hblank = t->hblank;
- hactive = t->horizontal;
-
- vfp = t->vfp;
- vbp = t->vbp;
- vblank = t->vblank;
- vactive = t->vertical;
-
- crtcR = s3c->save.crtc;
- crtc = &crtcR;
-
- s3GetClock (t->clock, &m, &n, &r, 127, 31, 3);
- crtc->dclk_pll_m_trio = m;
- crtc->dclk_pll_n_trio = n;
- crtc->dclk_pll_r_trio = r;
-
- crtc->alt_refresh_count = 0x02;
- crtc->enable_alt_refresh = 1;
- crtc->enable_256_or_more = 1;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "memory_bus_size %d\n", crtc->memory_bus_size));
- crtc->memory_bus_size = 1;
-
- crtc->dclk_over_2 = 0;
- crtc->dclk_invert = 0;
- crtc->enable_clock_double = 0;
- crtc->delay_blank = 0;
- crtc->extended_bios_5 = 0;
- /*
- * Compute character lengths for horizontal timing values
- */
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- hactive = screen->width / 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- h_screen_off = hactive;
- crtc->pixel_length = 0;
- crtc->color_mode = 0;
- /*
- * Set up for double-pixel mode, switch color modes,
- * divide the dclk and delay h blank by 2 dclks
- */
- if (S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio,
- crtc->dclk_pll_r_trio) > S3_MAX_CLOCK)
- {
- DRAW_DEBUG ((DEBUG_S3INIT, "S3 clock %g > 80MHz, using pixel double mode",
- S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio,
- crtc->dclk_pll_r_trio)));
- crtc->color_mode = 1;
- crtc->dclk_over_2 = 1;
- crtc->enable_clock_double = 1;
- crtc->delay_blank = 2;
- crtc->extended_bios_5 = 2;
- }
- h_adjust = 1;
- break;
- case 16:
- hactive = screen->width / 4;
- hblank /= 4;
- hfp /= 4;
- hbp /= 4;
- h_screen_off = hactive;
- crtc->pixel_length = 1;
- crtc->extended_bios_5 = 2;
- if (crtc->depth == 15)
- crtc->color_mode = 3;
- else
- crtc->color_mode = 5;
- h_adjust = 2;
- break;
- case 32:
- hactive = screen->width / 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- h_screen_off = hactive * 4;
- crtc->pixel_length = 3;
- crtc->color_mode = 0xd;
- h_adjust = 1;
- break;
- }
-
- /*
- * X server starts frame buffer at top of memory
- */
- DRAW_DEBUG ((DEBUG_S3INIT, "Old start address 0x%x\n",
- crtc_start_address (crtc)));
- crtc_set_start_address (crtc, 0);
-
- /*
- * Compute horizontal register values from timings
- */
- h_total = hactive + hblank - 5;
- h_display_end = hactive - 1;
- h_blank_start = h_display_end;
- h_blank_end = h_blank_start + hblank - h_adjust;
- h_sync_start = hactive + hfp + h_adjust;
- h_sync_end = h_sync_start + hblank - hbp - hfp;
- h_start_fifo_fetch = h_total - 5;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x sync_start 0x%x\n",
- h_blank_end, h_sync_end, h_sync_start));
-
- if (h_blank_end - h_blank_start > 0x40)
- h_blank_extend_ = 1;
- else
- h_blank_extend_ = 0;
-
- if (h_sync_end - h_sync_start > 0x20)
- h_sync_extend_ = 1;
- else
- h_sync_extend_ = 0;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x extend %d\n",
- h_blank_end, h_sync_end, h_sync_extend_));
-
- crtc_set_h_total(crtc, h_total);
- crtc_set_h_display_end (crtc, h_display_end);
- crtc_set_h_blank_start (crtc, h_blank_start);
- crtc_set_h_blank_end (crtc, h_blank_end);
- crtc_set_h_sync_start (crtc, h_sync_start);
- crtc_set_h_sync_end (crtc, h_sync_end);
- crtc_set_screen_off (crtc, h_screen_off);
- crtc_set_h_start_fifo_fetch (crtc, h_start_fifo_fetch);
- crtc->h_sync_extend = h_sync_extend_;
- crtc->h_blank_extend = h_blank_extend_;
-
-
- v_total = vactive + vblank - 2;
- v_retrace_start = vactive + vfp - 1;
- v_retrace_end = v_retrace_start + vblank - vbp - 1;
- v_display_end = vactive - 1;
- v_blank_start = vactive - 1;
- v_blank_end = v_blank_start + vblank - 1;
-
- crtc_set_v_total(crtc, v_total);
- crtc_set_v_retrace_start (crtc, v_retrace_start);
- crtc->v_retrace_end_0_3 = v_retrace_end;
- crtc_set_v_display_end (crtc, v_display_end);
- crtc_set_v_blank_start (crtc, v_blank_start);
- crtc->v_blank_end_0_7 = v_blank_end;
-
- /*
- * Set cursor
- */
- if (!screen->softCursor)
- {
- cursor_address = (s3s->cursor_base - screen->fb[0].frameBuffer) / 1024;
-
- crtc->cursor_address_0_7 = cursor_address;
- crtc->cursor_address_8_15 = cursor_address >> 8;
- crtc->hardware_cursor_ms_x11 = 0;
- crtc->hardware_cursor_enable = 1;
- }
- else
- crtc->hardware_cursor_enable = 0;
-
- /*
- * Set accelerator
- */
- switch (screen->width) {
- case 640: crtc_set_ge_screen_width(crtc,1); break;
- case 800: crtc_set_ge_screen_width(crtc,2); break;
- case 1024: crtc_set_ge_screen_width(crtc,0); break;
- case 1152: crtc_set_ge_screen_width(crtc,4); break;
- case 1280: crtc_set_ge_screen_width(crtc,3); break;
- case 1600: crtc_set_ge_screen_width(crtc,6); break;
- }
-
- /*
- * Set depth values
- */
- crtc->bits_per_pixel = screen->fb[0].bitsPerPixel;
- crtc->depth = screen->fb[0].depth;
-
- crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */
-
- crtc->disable_v_retrace_int = 1; /* don't let retrace interrupt */
-
- DRAW_DEBUG ((DEBUG_S3INIT, "new h total %d display_end %d",
- crtc_h_total(crtc),
- crtc_h_display_end(crtc)));
- DRAW_DEBUG ((DEBUG_S3INIT, " sync_start %d sync_end %d (%d)",
- crtc_h_sync_start(crtc),
- crtc_h_sync_end(crtc), h_sync_end));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d",
- crtc_h_blank_start(crtc),
- crtc_h_blank_end(crtc)));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " screen_off %d start_fifo %d",
- crtc_screen_off(crtc), crtc_h_start_fifo_fetch(crtc)));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d",
- hactive, hblank, hfp, hbp));
-
- DRAW_DEBUG ((DEBUG_S3INIT, "new v total %d display_end %d",
- crtc_v_total(crtc),
- crtc_v_display_end(crtc)));
- DRAW_DEBUG ((DEBUG_S3INIT, " retrace_start %d retrace_end %d (%d)",
- crtc_v_retrace_start(crtc),
- crtc->v_retrace_end,
- v_retrace_end));
- DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d",
- crtc_v_blank_start(crtc),
- crtc->v_blank_end_0_7));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d",
- vactive, vblank, vfp, vbp));
-
- /*
- * Set DPMS to normal
- */
- crtc->hsync_control = 0;
- crtc->vsync_control = 0;
-
- LockS3 (s3c);
- _s3SetDepth (s3c->s3, crtc);
- UnlockS3 (s3c);
- return TRUE;
-}
-
-void
-s3Disable (ScreenPtr pScreen)
-{
-}
-
-void
-s3Restore (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
-
- s3Reset (s3c);
-}
-
-void
-_s3SetSync (S3CardInfo *s3c, int hsync, int vsync)
-{
- /* this abuses the macros defined to access the crtc structure */
- union extended_sequencer_d_u _extended_sequencer_d_u;
- S3Ptr s3 = s3c->s3;
-
- extended_sequencer_d = s3c->save.crtc.extended_sequencer_d;
- hsync_control = hsync;
- vsync_control = vsync;
- PutSrtc (s3, 0x0d, extended_sequencer_d);
-}
-
-Bool
-s3DPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
-
- switch (mode) {
- case KD_DPMS_NORMAL:
- _s3SetSync (s3c, 0, 0);
- _s3SetBlank (s3c->s3, FALSE);
- break;
- case KD_DPMS_STANDBY:
- _s3SetBlank (s3c->s3, TRUE);
- _s3SetSync (s3c, 1, 0);
- break;
- case KD_DPMS_SUSPEND:
- _s3SetBlank (s3c->s3, TRUE);
- _s3SetSync (s3c, 0, 1);
- break;
- case KD_DPMS_POWERDOWN:
- _s3SetBlank (s3c->s3, TRUE);
- _s3SetSync (s3c, 1, 1);
- break;
- }
- return TRUE;
-}
-
-void
-s3ScreenFini (KdScreenInfo *screen)
-{
- S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver;
-
- xfree (s3s);
- screen->driver = 0;
-}
-
-void
-s3CardFini (KdCardInfo *card)
-{
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
-
- KdUnmapDevice (s3c->frameBuffer, s3c->memory);
- KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET);
-/* DeleteCriticalSection (&s3c->lock); */
- xfree (s3c);
- card->driver = 0;
-}
-
-KdCardFuncs s3Funcs = {
- s3CardInit,
- s3ScreenInit,
- 0,
- s3Preserve,
- s3Enable,
- s3DPMS,
- s3Disable,
- s3Restore,
- s3ScreenFini,
- s3CardFini,
- s3CursorInit,
- s3CursorEnable,
- s3CursorDisable,
- s3CursorFini,
- s3RecolorCursor,
- s3DrawInit,
- s3DrawEnable,
- s3DrawSync,
- s3DrawDisable,
- s3DrawFini,
- s3GetColors,
- s3PutColors,
-};
-
-void
-S3InitCard (KdCardAttr *attr)
-{
- KdCardInfoAdd (&s3Funcs, attr, 0);
-}
diff --git a/hw/kdrive/trio/s3.h b/hw/kdrive/trio/s3.h
deleted file mode 100644
index 6f443ea97..000000000
--- a/hw/kdrive/trio/s3.h
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*
- * Id: s3.h,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3.h,v 1.4 2000/05/06 22:17:53 keithp Exp $ */
-
-#ifndef _S3_H_
-#define _S3_H_
-
-#include "kdrive.h"
-
-#define PLATFORM 300
-
-#define DRAW_DEBUG(a)
-
-#define DEBUG_S3INIT (DEBUG_ACCEL)
-#define DEBUG_CRTC (DEBUG_ACCEL+1)
-#define DEBUG_PATTERN (DEBUG_ACCEL+2)
-#define DEBUG_RECT (DEBUG_ACCEL+3)
-#define DEBUG_PAINT_WINDOW (DEBUG_ACCEL+4)
-#define DEBUG_SET (DEBUG_ACCEL+5)
-#define DEBUG_RENDER (DEBUG_ACCEL+6)
-#define DEBUG_REGISTERS (DEBUG_ACCEL+7)
-#define DEBUG_ARCS (DEBUG_ACCEL+8)
-#define DEBUG_TEXT (DEBUG_ACCEL+9)
-#define DEBUG_POLYGON (DEBUG_ACCEL+10)
-#define DEBUG_CLIP (DEBUG_ACCEL+11)
-
-/* VESA Approved Register Definitions */
-
-/*
- * Linear Addressing 000 0000 - 0ff ffff (16m)
- * Image data transfer 100 0000 - 100 7fff (32k)
- * PCI config 100 8000 - 100 8043
- * Packed enhanced regs 100 8100 - 100 814a
- * Streams regs 100 8180 - 100 81ff
- * Current Y pos 100 82e8
- * CRT VGA 3b? regs 100 83b0 - 100 83bf
- * CRT VGA 3c? regs 100 83c0 - 100 83cf
- * CRT VGA 3d? regs 100 83d0 - 100 83df
- * Subsystem status (42e8h) 100 8504
- * Advanced function (42e8h) 100 850c
- * Enhanced regs 100 86e8 - 100 eeea
- * Local peripheral bus 100 ff00 - 100 ff5c
- *
- * We don't care about the image transfer or PCI regs, so
- * this structure starts at the packed enhanced regs
- */
-
-typedef volatile CARD32 VOL32;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD8 VOL8;
-
-typedef volatile struct _s3 {
- VOL32 alt_curxy; /* 8100 */
- VOL32 _pad0; /* 8104 */
- VOL32 alt_step; /* 8108 */
- VOL32 _pad1; /* 810c */
- VOL32 err_term; /* 8110 */
- VOL32 _pad2; /* 8114 */
- VOL32 cmd_gp_stat; /* 8118 */
- VOL32 short_stroke; /* 811c */
- VOL32 bg; /* 8120 */
- VOL32 fg; /* 8124 */
- VOL32 write_mask; /* 8128 */
- VOL32 read_mask; /* 812c */
- VOL32 color_cmp; /* 8130 */
- VOL32 alt_mix; /* 8134 */
- VOL32 scissors_tl; /* 8138 */
- VOL32 scissors_br; /* 813c */
- VOL32 pix_cntl_mult_misc2; /* 8140 */
- VOL32 mult_misc_read_sel; /* 8144 */
- VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */
- VOL8 _pad3[0x19c]; /* 814c */
- VOL16 cur_y; /* 82e8 */
- VOL8 _pad4[0xc6]; /* 82ea */
-
- VOL8 crt_vga_3b0; /* 83b0 */
- VOL8 crt_vga_3b1; /* 83b1 */
- VOL8 crt_vga_3b2; /* 83b2 */
- VOL8 crt_vga_3b3; /* 83b3 */
- VOL8 crt_vga_3b4; /* 83b4 */
- VOL8 crt_vga_3b5; /* 83b5 */
- VOL8 crt_vga_3b6; /* 83b6 */
- VOL8 crt_vga_3b7; /* 83b7 */
- VOL8 crt_vga_3b8; /* 83b8 */
- VOL8 crt_vga_3b9; /* 83b9 */
- VOL8 crt_vga_3ba; /* 83ba */
- VOL8 crt_vga_3bb; /* 83bb */
- VOL8 crt_vga_3bc; /* 83bc */
- VOL8 crt_vga_3bd; /* 83bd */
- VOL8 crt_vga_3be; /* 83be */
- VOL8 crt_vga_3bf; /* 83bf */
-
- VOL8 crt_vga_3c0; /* 83c0 */
- VOL8 crt_vga_3c1; /* 83c1 */
- VOL8 crt_vga_3c2; /* 83c2 */
- VOL8 crt_vga_3c3; /* 83c3 */
- VOL8 crt_vga_3c4; /* 83c4 */
- VOL8 crt_vga_3c5; /* 83c5 */
- VOL8 crt_vga_dac_ad_mk; /* 83c6 */
- VOL8 crt_vga_dac_rd_ad; /* 83c7 */
- VOL8 crt_vga_dac_wt_ad; /* 83c8 */
- VOL8 crt_vga_dac_data; /* 83c9 */
- VOL8 crt_vga_3ca; /* 83ca */
- VOL8 crt_vga_3cb; /* 83cb */
- VOL8 crt_vga_3cc; /* 83cc */
- VOL8 crt_vga_3cd; /* 83cd */
- VOL8 crt_vga_3ce; /* 83ce */
- VOL8 crt_vga_3cf; /* 83cf */
-
- VOL8 crt_vga_3d0; /* 83d0 */
- VOL8 crt_vga_3d1; /* 83d1 */
- VOL8 crt_vga_3d2; /* 83d2 */
- VOL8 crt_vga_3d3; /* 83d3 */
- VOL8 crt_vga_3d4; /* 83d4 */
- VOL8 crt_vga_3d5; /* 83d5 */
- VOL8 crt_vga_3d6; /* 83d6 */
- VOL8 crt_vga_3d7; /* 83d7 */
- VOL8 crt_vga_3d8; /* 83d8 */
- VOL8 crt_vga_3d9; /* 83d9 */
- VOL8 crt_vga_status_1; /* 83da */
- VOL8 crt_vga_3db; /* 83db */
- VOL8 crt_vga_3dc; /* 83dc */
- VOL8 crt_vga_3dd; /* 83dd */
- VOL8 crt_vga_3de; /* 83de */
- VOL8 crt_vga_3df; /* 83df */
-
- VOL8 _pad5[0x124]; /* 83e0 */
- VOL16 subsys_status; /* 8504 */
- VOL8 _pad6[0x6]; /* 8506 */
- VOL16 adv_control; /* 850c */
- VOL8 _pad7[0x1da]; /* 850e */
- VOL16 cur_x; /* 86e8 */
- VOL8 _pad8[0x3fe]; /* 86ea */
- VOL16 desty_axstp; /* 8ae8 */
- VOL8 _pad9[0x3fe]; /* 8aea */
- VOL16 destx_diastp; /* 8ee8 */
- VOL8 _pad10[0x3fe]; /* 8eea */
- VOL16 enh_err_term; /* 92e8 */
- VOL8 _pad11[0x3fe]; /* 92ea */
- VOL16 maj_axis_pcnt; /* 96e8 */
- VOL8 _pad12[0x3fe]; /* 96ea */
- VOL16 enh_cmd_gp_stat; /* 9ae8 */
- VOL8 _pad13[0x3fe]; /* 9aea */
- VOL16 enh_short_stroke; /* 9ee8 */
- VOL8 _pad14[0x3fe]; /* 9eea */
- VOL16 enh_bg; /* a2e8 */
- VOL8 _pad15[0x3fe]; /* a2ea */
- VOL16 enh_fg; /* a6e8 */
- VOL8 _pad16[0x3fe]; /* a6ea */
- VOL16 enh_wrt_mask; /* aae8 */
- VOL8 _pad17[0x3fe]; /* aaea */
- VOL16 enh_rd_mask; /* aee8 */
- VOL8 _pad18[0x3fe]; /* aeea */
- VOL16 enh_color_cmp; /* b2e8 */
- VOL8 _pad19[0x3fe]; /* b2ea */
- VOL16 enh_bg_mix; /* b6e8 */
- VOL8 _pad20[0x3fe]; /* b6ea */
- VOL16 enh_fg_mix; /* bae8 */
- VOL8 _pad21[0x3fe]; /* baea */
- VOL16 enh_rd_reg_dt; /* bee8 */
- VOL8 _pad22[0x23fe]; /* beea */
- VOL32 pix_trans; /* e2e8 */
-} S3, *S3Ptr;
-
-#define VGA_STATUS_1_DTM 0x01
-#define VGA_STATUS_1_VSY 0x08
-
-#define DAC_MASK 0x03c6
-#define DAC_R_INDEX 0x03c7
-#define DAC_W_INDEX 0x03c8
-#define DAC_DATA 0x03c9
-#define DISP_STAT 0x02e8
-#define H_TOTAL 0x02e8
-#define H_DISP 0x06e8
-#define H_SYNC_STRT 0x0ae8
-#define H_SYNC_WID 0x0ee8
-#define V_TOTAL 0x12e8
-#define V_DISP 0x16e8
-#define V_SYNC_STRT 0x1ae8
-#define V_SYNC_WID 0x1ee8
-#define DISP_CNTL 0x22e8
-#define ADVFUNC_CNTL 0x4ae8
-#define SUBSYS_STAT 0x42e8
-#define SUBSYS_CNTL 0x42e8
-#define ROM_PAGE_SEL 0x46e8
-#define CUR_Y 0x82e8
-#define CUR_X 0x86e8
-#define DESTY_AXSTP 0x8ae8
-#define DESTX_DIASTP 0x8ee8
-#define ERR_TERM 0x92e8
-#define MAJ_AXIS_PCNT 0x96e8
-#define GP_STAT 0x9ae8
-#define CMD 0x9ae8
-#define SHORT_STROKE 0x9ee8
-#define BKGD_COLOR 0xa2e8
-#define FRGD_COLOR 0xa6e8
-#define WRT_MASK 0xaae8
-#define RD_MASK 0xaee8
-#define COLOR_CMP 0xb2e8
-#define BKGD_MIX 0xb6e8
-#define FRGD_MIX 0xbae8
-#define MULTIFUNC_CNTL 0xbee8
-#define MIN_AXIS_PCNT 0x0000
-#define SCISSORS_T 0x1000
-#define SCISSORS_L 0x2000
-#define SCISSORS_B 0x3000
-#define SCISSORS_R 0x4000
-#define MEM_CNTL 0x5000
-#define PATTERN_L 0x8000
-#define PATTERN_H 0x9000
-#define PIX_CNTL 0xa000
-#define CONTROL_MISC2 0xd000
-#define PIX_TRANS 0xe2e8
-
-/* Advanced Function Control Regsiter */
-#define CLKSEL 0x0004
-#define DISABPASSTHRU 0x0001
-
-/* Graphics Processor Status Register */
-
-#define GPNSLOT 13
-
-#define GPBUSY_1 0x0080
-#define GPBUSY_2 0x0040
-#define GPBUSY_3 0x0020
-#define GPBUSY_4 0x0010
-#define GPBUSY_5 0x0008
-#define GPBUSY_6 0x0004
-#define GPBUSY_7 0x0002
-#define GPBUSY_8 0x0001
-#define GPBUSY_9 0x8000
-#define GPBUSY_10 0x4000
-#define GPBUSY_11 0x2000
-#define GPBUSY_12 0x1000
-#define GPBUSY_13 0x0800
-
-#define GPEMPTY 0x0400
-#define GPBUSY 0x0200
-#define DATDRDY 0x0100
-
-/* Command Register */
-#define CMD_NOP 0x0000
-#define CMD_LINE 0x2000
-#define CMD_RECT 0x4000
-#define CMD_RECTV1 0x6000
-#define CMD_RECTV2 0x8000
-#define CMD_LINEAF 0xa000
-#define CMD_BITBLT 0xc000
-#define CMD_PATBLT 0xe000
-#define CMD_OP_MSK 0xe000
-#define BYTSEQ 0x1000
-#define _32BITNOPAD 0x0600
-#define _32BIT 0x0400
-#define _16BIT 0x0200
-#define _8BIT 0x0000
-#define PCDATA 0x0100
-#define INC_Y 0x0080
-#define YMAJAXIS 0x0040
-#define INC_X 0x0020
-#define DRAW 0x0010
-#define LINETYPE 0x0008
-#define LASTPIX 0x0004 /* Draw last pixel in line */
-#define PLANAR 0x0002
-#define WRTDATA 0x0001
-
-/* Background Mix Register */
-#define BSS_BKGDCOL 0x0000
-#define BSS_FRGDCOL 0x0020
-#define BSS_PCDATA 0x0040
-#define BSS_BITBLT 0x0060
-
-/* Foreground Mix Register */
-#define FSS_BKGDCOL 0x0000
-#define FSS_FRGDCOL 0x0020
-#define FSS_PCDATA 0x0040
-#define FSS_BITBLT 0x0060
-
-/* The Mixes */
-#define MIX_MASK 0x001f
-
-#define MIX_NOT_DST 0x0000
-#define MIX_0 0x0001
-#define MIX_1 0x0002
-#define MIX_DST 0x0003
-#define MIX_NOT_SRC 0x0004
-#define MIX_XOR 0x0005
-#define MIX_XNOR 0x0006
-#define MIX_SRC 0x0007
-#define MIX_NAND 0x0008
-#define MIX_NOT_SRC_OR_DST 0x0009
-#define MIX_SRC_OR_NOT_DST 0x000a
-#define MIX_OR 0x000b
-#define MIX_AND 0x000c
-#define MIX_SRC_AND_NOT_DST 0x000d
-#define MIX_NOT_SRC_AND_DST 0x000e
-#define MIX_NOR 0x000f
-
-#define MIX_MIN 0x0010
-#define MIX_DST_MINUS_SRC 0x0011
-#define MIX_SRC_MINUS_DST 0x0012
-#define MIX_PLUS 0x0013
-#define MIX_MAX 0x0014
-#define MIX_HALF__DST_MINUS_SRC 0x0015
-#define MIX_HALF__SRC_MINUS_DST 0x0016
-#define MIX_AVERAGE 0x0017
-#define MIX_DST_MINUS_SRC_SAT 0x0018
-#define MIX_SRC_MINUS_DST_SAT 0x001a
-#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c
-#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e
-#define MIX_AVERAGE_SAT 0x001f
-
-/* Pixel Control Register */
-#define MIXSEL_FRGDMIX 0x0000
-#define MIXSEL_PATT 0x0040
-#define MIXSEL_EXPPC 0x0080
-#define MIXSEL_EXPBLT 0x00c0
-#define COLCMPOP_F 0x0000
-#define COLCMPOP_T 0x0008
-#define COLCMPOP_GE 0x0010
-#define COLCMPOP_LT 0x0018
-#define COLCMPOP_NE 0x0020
-#define COLCMPOP_EQ 0x0028
-#define COLCMPOP_LE 0x0030
-#define COLCMPOP_GT 0x0038
-#define PLANEMODE 0x0004
-
-#define FIFO_SLOTS 13
-
-#define GPSLOT(n) (1 << ((n) > 8 ? (15 - ((n) - 9)) : (8 - (n))))
-
-/* Wait for n slots to become available */
-#if 0
-#define _s3WaitSlots(s3,n) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitSlots 0x%x %d", (s3)->cmd_gp_stat, n)); \
- while (((s3)->cmd_gp_stat & GPSLOT(n)) != 0); \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 0x%x %d slots ready", (s3)->cmd_gp_stat, n)); \
-}
-#else
-/* let PCI retries solve this problem */
-#define _s3WaitSlots(s3,n)
-#endif
-
-/* Wait until queue is empty */
-#define _s3WaitEmpty(s3) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitEmpty 0x%x", (s3)->cmd_gp_stat)); \
- while (!((s3)->cmd_gp_stat & GPEMPTY)) ; \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 empty")); \
-}
-
-/* Wait until GP is idle and queue is empty */
-#define _s3WaitIdleEmpty(s3) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdleEmpty 0x%x", (s3)->cmd_gp_stat)); \
- while (((s3)->cmd_gp_stat & (GPBUSY|GPEMPTY)) != GPEMPTY) ; \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 idle empty")); \
-}
-
-/* Wait until GP is idle */
-#define _s3WaitIdle(s3) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdle 0x%x", (s3)->cmd_gp_stat)); \
- while ((s3)->cmd_gp_stat & GPBUSY) ; \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 idle")); \
-}
-
-typedef struct _s3Cursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} S3Cursor;
-
-typedef struct _s3PatternCache {
- int id;
- int x, y;
-} S3PatternCache;
-
-typedef struct _s3Patterns {
- S3PatternCache *cache;
- int ncache;
- int last_used;
- int last_id;
-} S3Patterns;
-
-typedef struct _crtc {
- CARD8 h_total_0_7; /* CR0 */
- CARD8 h_display_end_0_7; /* CR1 */
- CARD8 h_blank_start_0_7; /* CR2 */
- union {
- struct {
- CARD8 _h_blank_end_0_4 : 5;
- CARD8 _display_skew : 2;
- CARD8 : 1;
- } _h_blank_end_s;
- CARD8 __h_blank_end; /* CR3 */
- } _h_blank_end_u;
-#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4
-#define display_skew _h_blank_end_u._h_blank_end_s._display_skew
-#define _h_blank_end _h_blank_end_u.__h_blank_end
-
- CARD8 h_sync_start_0_7; /* CR4 */
-
- union {
- struct {
- CARD8 _h_sync_end_0_4 : 5;
- CARD8 _horizontal_skew : 2;
- CARD8 _h_blank_end_5 : 1;
- } _h_sync_end_s;
- CARD8 __h_sync_end; /* CR5 */
- } _h_sync_end_u;
-
-#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4
-#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew
-#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5
-#define _h_sync_end _h_sync_end_u.__h_sync_end
-
- CARD8 v_total_0_7; /* CR6 */
-
- union {
- struct {
- CARD8 _v_total_8 : 1;
- CARD8 _v_display_end_8 : 1;
- CARD8 _v_retrace_start_8 : 1;
- CARD8 _v_blank_start_8 : 1;
- CARD8 _line_compare_8 : 1;
- CARD8 _v_total_9 : 1;
- CARD8 _v_display_end_9 : 1;
- CARD8 _v_retrace_start_9 : 1;
- } _crtc_overflow_s;
- CARD8 _crtc_overflow; /* CR7 */
- } _crtc_overflow_u;
-
-#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8
-#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8
-#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8
-#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8
-#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8
-#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9
-#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9
-#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9
-#define crtc_overflow _crtc_overflow_u._crtc_overflow
-
- CARD8 preset_row_scan; /* CR8 (unused) */
-
- union {
- struct {
- CARD8 _max_scan_line : 5;
- CARD8 _v_blank_start_9 : 1;
- CARD8 _line_compare_9 : 1;
- CARD8 _double_scan : 1;
- } _max_scan_line_s;
- CARD8 __max_scan_line; /* CR9 */
- } _max_scan_line_u;
-
-#define max_scan_line _max_scan_line_u._max_scan_line_s._max_scan_line
-#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9
-#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9
-#define double_scan _max_scan_line_u._max_scan_line_s._double_scan
-#define _max_scan_line _max_scan_line_u.__max_scan_line
-
- CARD8 cursor_start;
- CARD8 cursor_end;
-
- CARD8 start_address_8_15; /* CRC */
- CARD8 start_address_0_7; /* CRD */
-
- CARD8 cursor_loc_high;
- CARD8 cursor_loc_low;
-
- CARD8 v_retrace_start_0_7; /* CR10 */
- union {
- struct {
- CARD8 _v_retrace_end_0_3 : 4;
- CARD8 _clear_v_retrace_int : 1;
- CARD8 _disable_v_retrace_int : 1;
- CARD8 _refresh_cycle_select : 1;
- CARD8 _lock_crtc : 1;
- } _v_retrace_end_s;
- CARD8 __v_retrace_end; /* CR11 */
- } _v_retrace_end_u;
-
-#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3
-#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int
-#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int
-#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select
-#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc
-#define _v_retrace_end _v_retrace_end_u.__v_retrace_end
-
- CARD8 v_display_end_0_7; /* CR12 */
-
- CARD8 screen_off_0_7; /* CR13 */
-
- union {
- struct {
- CARD8 _underline_location : 5;
- CARD8 _count_by_four : 1;
- CARD8 _doubleword_mode : 1;
- CARD8 : 1;
- } _underline_location_s;
- CARD8 __underline_location; /* CR14 (unused) */
- } _underline_location_u;
-
-#define underline_location _underline_location_u._underline_location_s._underline_location
-#define count_by_four _underline_location_u._underline_location_s._count_by_four
-#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode
-#define _underline_location _underline_location_u.__underline_location
-
- CARD8 v_blank_start_0_7; /* CR15 */
- CARD8 v_blank_end_0_7; /* CR16 */
-
- union {
- struct {
- CARD8 _two_bk_cga : 1;
- CARD8 _four_bk_cga : 1;
- CARD8 _v_total_double : 1;
- CARD8 _word_mode : 1;
- CARD8 : 1;
- CARD8 _address_wrap : 1;
- CARD8 _byte_mode : 1;
- CARD8 _hardware_reset : 1;
- } _crtc_mode_s;
- CARD8 _crtc_mode; /* CR17 (unused) */
- } _crtc_mode_u;
-
- CARD8 line_compare_0_7; /* CR18 (unused) */
-
- union {
- struct {
- CARD8 _enable_base_offset : 1;
- CARD8 _enable_two_page : 1;
- CARD8 _enable_vga_16_bit : 1;
- CARD8 _enhanced_mode_mapping : 1;
- CARD8 _old_display_start : 2;
- CARD8 _enable_high_speed_text : 1;
- CARD8 : 1;
- } _memory_configuration_s;
- CARD8 _memory_configuration; /* CR31 (unused) */
- } _memory_configuration_u;
-
-#define memory_configuration _memory_configuration_u._memory_configuration
-#define enable_base_offset _memory_configuration_u._memory_configuration_s._enable_base_offset
-#define enable_two_page _memory_configuration_u._memory_configuration_s._enable_two_page
-#define enable_vga_16_bit _memory_configuration_u._memory_configuration_s._enable_vga_16_bit
-#define enhanved_mode_mapping _memory_configuration_u._memory_configuration_s._enhanced_mode_mapping
-#define old_display_start _memory_configuration_u._memory_configuration_s._old_display_start
-#define enable_high_speed_text _memory_configuration_u._memory_configuration_s._enable_high_speed_text
-
- union {
- struct {
- CARD8 _alt_refresh_count : 2;
- CARD8 _enable_alt_refresh : 1;
- CARD8 _enable_top_memory : 1;
- CARD8 _enable_256_or_more : 1;
- CARD8 _high_speed_text : 1;
- CARD8 : 1;
- CARD8 _pci_burst_disabled : 1;
- } _misc_1_s;
- CARD8 _misc_1; /* CR3A */
- } _misc_1_u;
-#define misc_1 _misc_1_u._misc_1
-#define alt_refresh_count _misc_1_u._misc_1_s._alt_refresh_count
-#define enable_alt_refresh _misc_1_u._misc_1_s._enable_alt_refresh
-#define enable_top_memory _misc_1_u._misc_1_s._enable_top_memory
-#define enable_256_or_more _misc_1_u._misc_1_s._enable_256_or_more
-#define high_speed_text _misc_1_u._misc_1_s._high_speed_text
-#define pci_burst_disabled _misc_1_u._misc_1_s._pci_burst_disabled
-
- CARD8 h_start_fifo_fetch_0_7; /* CR3B */
-
- union {
- struct {
- CARD8 : 5;
- CARD8 interlace : 1;
- CARD8 : 2;
- } _mode_control_s;
- CARD8 _mode_control; /* CR42 */
- } _mode_control_u;
-
-#define mode_control _mode_control_u._mode_control
-
- union {
- struct {
- CARD8 : 2;
- CARD8 _old_screen_off_8 : 1;
- CARD8 : 4;
- CARD8 h_counter_double_mode : 1;
- } _extended_mode_s;
- CARD8 _extended_mode; /* CR43 (unused) */
- } _extended_mode_u;
-
-#define extended_mode _extended_mode_u._extended_mode
-#define old_screen_off_8 _extended_mode_u._extended_mode_s._old_screen_off_8
-
- union {
- struct {
- CARD8 _hardware_cursor_enable : 1;
- CARD8 : 3;
- CARD8 _hardware_cursor_right : 1;
- CARD8 : 3;
- } _hardware_cursor_mode_s;
- CARD8 _hardware_cursor_mode; /* CR45 */
- } _hardware_cursor_mode_u;
-
-#define hardware_cursor_mode _hardware_cursor_mode_u._hardware_cursor_mode
-#define hardware_cursor_enable _hardware_cursor_mode_u._hardware_cursor_mode_s._hardware_cursor_enable
-
- CARD8 cursor_address_8_15; /* CR4C */
- CARD8 cursor_address_0_7; /* CR4D */
-
- union {
- struct {
- CARD8 _ge_screen_width_2 : 1;
- CARD8 : 3;
- CARD8 _pixel_length : 2;
- CARD8 _ge_screen_width_0_1 : 2;
- } _extended_system_control_1_s;
- CARD8 _extended_system_control_1; /* CR50 */
- } _extended_system_control_1_u;
-#define ge_screen_width_2 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_2
-#define pixel_length _extended_system_control_1_u._extended_system_control_1_s._pixel_length
-#define ge_screen_width_0_1 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_0_1
-#define extended_system_control_1 _extended_system_control_1_u._extended_system_control_1
-
- union {
- struct {
- CARD8 : 4;
- CARD8 _screen_off_8_9 : 2;
- CARD8 : 2;
- } _extended_system_control_2_s;
- CARD8 _extended_system_control_2; /* CR51 */
- } _extended_system_control_2_u;
-#define extended_system_control_2 _extended_system_control_2_u._extended_system_control_2
-#define screen_off_8_9 _extended_system_control_2_u._extended_system_control_2_s._screen_off_8_9
-
- union {
- struct {
- CARD8 : 1;
- CARD8 big_endian_linear : 2;
- CARD8 mmio_select : 2;
- CARD8 mmio_window : 1;
- CARD8 swap_nibbles : 1;
- CARD8 : 1;
- } _extended_memory_control_s;
- CARD8 _extended_memory_control; /* CR53 */
- } _extended_memory_control_u;
-#define extended_memory_control _extended_memory_control_u._extended_memory_control
-
- union {
- struct {
- CARD8 : 2;
- CARD8 _enable_gir : 1;
- CARD8 : 1;
- CARD8 _hardware_cursor_ms_x11 : 1;
- CARD8 : 2;
- CARD8 _tri_state_off_vclk : 1;
- } _extended_ramdac_control_s;
- CARD8 _extended_ramdac_control; /* CR55 */
- } _extended_ramdac_control_u;
-#define extended_ramdac_control _extended_ramdac_control_u._extended_ramdac_control
-#define hardware_cursor_ms_x11 _extended_ramdac_control_u._extended_ramdac_control_s._hardware_cursor_ms_x11
-
-
- union {
- struct {
- CARD8 _h_total_8 : 1;
- CARD8 _h_display_end_8 : 1;
- CARD8 _h_blank_start_8 : 1;
- CARD8 _h_blank_extend : 1; /* extend h_blank by 64 */
- CARD8 _h_sync_start_8 : 1;
- CARD8 _h_sync_extend : 1; /* extend h_sync by 32 */
- CARD8 _h_start_fifo_fetch_8 : 1;
- CARD8 : 1;
- } _extended_horizontal_overflow_s;
- CARD8 _extended_horizontal_overflow; /* CR5D */
- } _extended_horizontal_overflow_u;
-#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow
-#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8
-#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8
-#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8
-#define h_blank_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_extend
-#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8
-#define h_sync_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_extend
-#define h_start_fifo_fetch_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_start_fifo_fetch_8
-
-
- union {
- struct {
- CARD8 _v_total_10 : 1;
- CARD8 _v_display_end_10 : 1;
- CARD8 _v_blank_start_10 : 1;
- CARD8 : 1;
- CARD8 _v_retrace_start_10 : 1;
- CARD8 : 1;
- CARD8 _line_compare_10 : 1;
- CARD8 : 1;
- } _extended_vertical_overflow_s;
- CARD8 _extended_vertical_overflow; /* CR5E */
- } _extended_vertical_overflow_u;
-#define extended_vertical_overflow _extended_vertical_overflow_u._extended_vertical_overflow
-#define v_total_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_total_10
-#define v_display_end_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_display_end_10
-#define v_blank_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_blank_start_10
-#define v_retrace_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_retrace_start_10
-#define line_compare_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._line_compare_10
-
-
- CARD8 l_parm_0_7; /* CR62 (undocumented) */
-
- union {
- struct {
- CARD8 : 3;
- CARD8 _delay_blank : 2;
- CARD8 : 3;
- } _extended_misc_control_s;
- CARD8 _extended_misc_control; /* CR65 */
- } _extended_misc_control_u;
-#define extended_misc_control _extended_misc_control_u._extended_misc_control
-#define delay_blank _extended_misc_control_u._extended_misc_control_s._delay_blank
-
- union {
- struct {
- CARD8 _v_clock_phase : 1;
- CARD8 : 3;
- CARD8 _color_mode : 4;
- } _extended_misc_control_2_s;
- CARD8 _extended_misc_control_2; /* CR67 */
- } _extended_misc_control_2_u;
-
-#define v_clock_phase _extended_misc_control_2_u._extended_misc_control_2_s._v_clock_phase
-#define color_mode _extended_misc_control_2_u._extended_misc_control_2_s._color_mode
-#define extended_misc_control_2 _extended_misc_control_2_u._extended_misc_control_2
-
-
- union {
- struct {
- CARD8 cas_oe_str : 2;
- CARD8 ras_low : 1;
- CARD8 ras_precharge : 1;
- CARD8 : 3;
- CARD8 _memory_bus_size : 1; /* 0 = 32, 1 = 32/64 */
- } _configuration_3_s;
- CARD8 _configuration_3; /* CR68 */
- } _configuration_3_u;
-#define configuration_3 _configuration_3_u._configuration_3
-#define memory_bus_size _configuration_3_u._configuration_3_s._memory_bus_size
-
- union {
- struct {
- CARD8 _start_address_16_19 : 4;
- CARD8 : 4;
- } _extended_system_control_3_s;
- CARD8 _extended_system_control_3; /* CR69 */
- } _extended_system_control_3_u;
-#define extended_system_control_3 _extended_system_control_3_u._extended_system_control_3
-#define start_address_16_19 _extended_system_control_3_u._extended_system_control_3_s._start_address_16_19
-
- CARD8 extended_bios_5; /* CR6D */
-
- union {
- struct {
- CARD8 dot_clock_vclki : 1; /* testing only */
- CARD8 vclki_with_vafc : 1; /* feature connector */
- CARD8 : 1;
- CARD8 bpp_24_mode : 1; /* 24 bpp mode */
- CARD8 alt_color_mode : 4; /* feature connector mode */
- } _extended_sequencer_b_s;
- CARD8 _extended_sequencer_b; /* SRB */
- } _extended_sequencer_b_u;
-
-#define extended_sequencer_b _extended_sequencer_b_u._extended_sequencer_b
-
- union extended_sequencer_d_u {
- struct {
- CARD8 enable_feature : 1;
- CARD8 lpb_feature : 1;
- CARD8 : 2;
- CARD8 _hsync_control : 2;
- CARD8 _vsync_control : 2;
- } _extended_sequencer_d_s;
- CARD8 _extended_sequencer_d;
- } _extended_sequencer_d_u;
-
-#define extended_sequencer_d _extended_sequencer_d_u._extended_sequencer_d
-#define hsync_control _extended_sequencer_d_u._extended_sequencer_d_s._hsync_control
-#define vsync_control _extended_sequencer_d_u._extended_sequencer_d_s._vsync_control
-
- union {
- struct {
- CARD8 _dclk_pll_n : 5;
- CARD8 _dclk_pll_r : 2;
- CARD8 : 1;
- } _dclk_value_low_s;
- CARD8 _dclk_value_low; /* SR12 */
- } _dclk_value_low_u;
-
-#define dclk_value_low _dclk_value_low_u._dclk_value_low
-#define dclk_pll_n_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_n
-#define dclk_pll_r_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_r
-
- union {
- struct {
- CARD8 _dclk_pll_m : 7;
- CARD8 : 1;
- } _dclk_value_high_s;
- CARD8 _dclk_value_high; /* SR13 */
- } _dclk_value_high_u;
-
-#define dclk_value_high _dclk_value_high_u._dclk_value_high
-#define dclk_pll_m_trio _dclk_value_high_u._dclk_value_high_s._dclk_pll_m
-
- union {
- struct {
- CARD8 _mfrq_en : 1;
- CARD8 _dfrq_en : 1;
- CARD8 _mclk_out : 1;
- CARD8 _vclk_out : 1;
- CARD8 _dclk_over_2 : 1;
- CARD8 _clk_load : 1;
- CARD8 _dclk_invert : 1;
- CARD8 _ena_2_cycle_write : 1;
- } _control_2_s;
- CARD8 _control_2; /* SR15 */
- } _control_2_u;
-
-#define control_2 _control_2_u._control_2
-#define mfrq_en _control_2_u._control_2_s._mfrq_en
-#define dfrq_en _control_2_u._control_2_s._dfrq_en
-#define mclk_out _control_2_u._control_2_s._mclk_out
-#define vclk_out _control_2_u._control_2_s._vclk_out
-#define dclk_over_2 _control_2_u._control_2_s._dclk_over_2
-#define clk_load _control_2_u._control_2_s._clk_load
-#define dclk_invert _control_2_u._control_2_s._dclk_invert
-#define ena_2_cycle_write _control_2_u._control_2_s._ena_2_cycle_write
-
- union {
- struct {
- CARD8 : 5;
- CARD8 _dac_power_down : 1;
- CARD8 _lut_write_control : 1;
- CARD8 _enable_clock_double : 1;
- } _ramdac_control_s;
- CARD8 _ramdac_control; /* SR18 */
- } _ramdac_control_u;
-
-#define ramdac_control _ramdac_control_u._ramdac_control
-#define enable_clock_double _ramdac_control_u._ramdac_control_s._enable_clock_double
-
- union {
- struct {
- CARD8 _dclk_pll_n : 6;
- CARD8 _dclk_pll_r : 2;
- } _dclk_value_low_s;
- CARD8 _dclk_value_low; /* SR36 */
- } _dclk_value_low_savage_u;
-
-#define dclk_value_low_savage _dclk_value_low_savage_u._dclk_value_low
-#define dclk_pll_n_savage_0_5 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_n
-#define dclk_pll_r_savage_0_1 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_r
-
- CARD8 dclk_pll_m0_savage_0_7; /* SR37 */
- CARD8 dclk_pll_m1_savage_0_7; /* SR38 */
-
- struct {
- CARD8 _dclk_pll_m : 8;
- } _dclk_value_high_s_savage;
-
- union {
- struct {
- CARD8 _dclk_select : 1;
- CARD8 : 1;
- CARD8 _dclk_pll_r_2 : 1;
- CARD8 _dclk_pll_m_8 : 1;
- CARD8 _dclk_pll_n_6 : 1;
- CARD8 _pce : 1;
- CARD8 _ccg : 1;
- CARD8 _csp : 1;
- } _extended_seq_39_s;
- CARD8 _extended_seq_39; /* SR39 */
- } _extended_seq_39_u;
-
-#define extended_seq_39 _extended_seq_39_u._extended_seq_39
-#define dclk_pll_select_savage _extended_seq_39_u._extended_seq_39_s._dclk_select
-#define dclk_pll_r_savage_2 _extended_seq_39_u._extended_seq_39_s._dclk_pll_r_2
-#define dclk_pll_m_savage_8 _extended_seq_39_u._extended_seq_39_s._dclk_pll_m_8
-#define dclk_pll_n_savage_6 _extended_seq_39_u._extended_seq_39_s._dclk_pll_n_6
-
- /* computed values */
- CARD16 ge_screen_pitch;
- CARD8 bits_per_pixel;
- CARD8 depth;
- CARD8 double_pixel_mode;
- CARD16 pixel_width;
-} S3Crtc;
-
-#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \
- ((crtc)->v_total_8 << 8) | \
- ((crtc)->v_total_9 << 9) | \
- ((crtc)->v_total_10 << 10))
-
-#define crtc_set_v_total(crtc,v) { \
- ((crtc))->v_total_0_7 = (v); \
- ((crtc))->v_total_8 = (v) >> 8; \
- ((crtc))->v_total_9 = (v) >> 9; \
- ((crtc))->v_total_10 = (v) >> 10; \
-}
-
-#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \
- ((crtc)->v_display_end_8 << 8) | \
- ((crtc)->v_display_end_9 << 9) | \
- ((crtc)->v_display_end_10 << 10))
-
-#define crtc_set_v_display_end(crtc,v) {\
- ((crtc))->v_display_end_0_7 = (v); \
- ((crtc))->v_display_end_8 = (v) >> 8; \
- ((crtc))->v_display_end_9 = (v) >> 9; \
- ((crtc))->v_display_end_10 = (v) >> 10; \
-}
-
-#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \
- ((crtc)->v_retrace_start_8 << 8) | \
- ((crtc)->v_retrace_start_9 << 9) | \
- ((crtc)->v_retrace_start_10 << 10))
-
-#define crtc_set_v_retrace_start(crtc,v) {\
- ((crtc))->v_retrace_start_0_7 = (v); \
- ((crtc))->v_retrace_start_8 = (v) >> 8; \
- ((crtc))->v_retrace_start_9 = (v) >> 9; \
- ((crtc))->v_retrace_start_10 = (v) >> 10; \
-}
-
-#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \
- ((crtc)->v_blank_start_8 << 8) | \
- ((crtc)->v_blank_start_9 << 9) | \
- ((crtc)->v_blank_start_10 << 10))
-
-#define crtc_set_v_blank_start(crtc,v) {\
- ((crtc))->v_blank_start_0_7 = (v); \
- ((crtc))->v_blank_start_8 = (v) >> 8; \
- ((crtc))->v_blank_start_9 = (v) >> 9; \
- ((crtc))->v_blank_start_10 = (v) >> 10; \
-}
-
-#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \
- ((crtc)->h_total_8 << 8))
-
-#define crtc_set_h_total(crtc,v) {\
- ((crtc))->h_total_0_7 = (v); \
- ((crtc))->h_total_8 = (v) >> 8; \
-}
-
-#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \
- ((crtc)->h_display_end_8 << 8))
-
-#define crtc_set_h_display_end(crtc,v) {\
- ((crtc))->h_display_end_0_7 = (v); \
- ((crtc))->h_display_end_8 = (v) >> 8; \
-}
-
-#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \
- ((crtc)->h_blank_start_8 << 8))
-
-#define crtc_set_h_blank_start(crtc,v) {\
- ((crtc))->h_blank_start_0_7 = (v); \
- ((crtc))->h_blank_start_8 = (v) >> 8; \
-}
-
-#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \
- ((crtc)->h_blank_end_5 << 5))
-
-#define crtc_set_h_blank_end(crtc,v) {\
- ((crtc))->h_blank_end_0_4 = (v); \
- ((crtc))->h_blank_end_5 = (v) >> 5; \
-}
-
-#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \
- ((crtc)->h_sync_start_8 << 8))
-
-#define crtc_set_h_sync_start(crtc,v) {\
- ((crtc))->h_sync_start_0_7 = (v); \
- ((crtc))->h_sync_start_8 = (v) >> 8; \
-}
-
-#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4)
-
-#define crtc_set_h_sync_end(crtc,v) {\
- ((crtc))->h_sync_end_0_4 = (v); \
-}
-
-#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \
- (((crtc)->screen_off_8_9 ? \
- ((crtc))->screen_off_8_9 : \
- ((crtc))->old_screen_off_8) << 8))
-
-#define crtc_set_screen_off(crtc,v) {\
- ((crtc))->screen_off_0_7 = (v); \
- ((crtc))->old_screen_off_8 = 0; \
- ((crtc))->screen_off_8_9 = (v) >> 8; \
-}
-
-#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \
- ((crtc)->ge_screen_width_2 << 2))
-
-#define crtc_set_ge_screen_width(crtc,v) { \
- (crtc)->ge_screen_width_0_1 = (v); \
- (crtc)->ge_screen_width_2 = (v) >> 2; \
-}
-
-#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \
- ((crtc)->h_start_fifo_fetch_8 << 8))
-
-#define crtc_set_h_start_fifo_fetch(crtc,v) {\
- (crtc)->h_start_fifo_fetch_0_7 = (v); \
- (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \
-}
-
-#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \
- ((crtc)->start_address_8_15 << 8) | \
- ((crtc)->start_address_16_19 << 16))
-
-#define crtc_set_start_address(crtc,v) {\
- (crtc)->start_address_0_7 = (v); \
- (crtc)->start_address_8_15 = (v) >> 8; \
- (crtc)->start_address_16_19 = (v) >> 16; \
-}
-
-#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \
- ((crtc)->line_compare_8 << 8) | \
- ((crtc)->line_compare_9 << 9) | \
- ((crtc)->line_compare_10 << 10))
-
-#define crtc_set_line_compare(crtc,v) { \
- ((crtc))->line_compare_0_7 = (v); \
- ((crtc))->line_compare_8 = (v) >> 8; \
- ((crtc))->line_compare_9 = (v) >> 9; \
- ((crtc))->line_compare_10 = (v) >> 10; \
-}
-
-
-#define GetCrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3d4, (i))
-#define PutCrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3d4, (i), (v))
-
-#define GetSrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3c4, (i))
-#define PutSrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3c4, (i), (v))
-
-#define S3_CLOCK_REF 14318 /* KHz */
-
-#define S3_CLOCK(m,n,r) (S3_CLOCK_REF * ((m) + 2) / (((n) + 2) * (1 << (r))))
-
-#if PLATFORM == 200
-#define S3_MAX_CLOCK 80000 /* KHz */
-#endif
-#if PLATFORM == 300
-#define S3_MAX_CLOCK 135000 /* KHz */
-#endif
-
-typedef struct _s3Save {
- CARD8 cursor_fg;
- CARD8 cursor_bg;
- CARD8 lock1;
- CARD8 lock2;
- CARD8 locksrtc;
- CARD8 clock_mode;
- CARD32 alt_mix;
- CARD32 write_mask;
- CARD32 fg;
- CARD32 bg;
- S3Crtc crtc;
-} S3Save;
-
-typedef struct _s3CardInfo {
- S3Ptr s3; /* pointer to register structure */
- int memory; /* amount of memory */
- CARD8 *frameBuffer; /* pointer to frame buffer */
- CARD8 *registers; /* pointer to register map */
- S3Save save;
- Bool savage;
- Bool need_sync;
-} S3CardInfo;
-
-typedef struct _s3FbInfo {
- CARD8 *offscreen; /* pointer to offscreen area */
- int offscreen_y; /* top y coordinate of offscreen area */
- int offscreen_x; /* top x coordinate of offscreen area */
- int offscreen_width; /* width of offscreen area */
- int offscreen_height; /* height of offscreen area */
- S3Patterns patterns;
- CARD32 bitmap_offset;
- int accel_stride;
- int accel_bpp;
-} S3FBInfo;
-
-typedef struct _s3ScreenInfo {
- CARD8 *cursor_base; /* pointer to cursor area */
- S3Cursor cursor;
- S3FBInfo fb[1];
-} S3ScreenInfo;
-
-#define LockS3(s3c)
-#define UnlockS3(s3c)
-
-#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver))
-#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd)
-
-#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver))
-#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd)
-
-Bool s3CardInit (KdCardInfo *);
-Bool s3ScreenInit (KdScreenInfo *);
-Bool s3Enable (ScreenPtr pScreen);
-void s3Disable (ScreenPtr pScreen);
-void s3Fini (ScreenPtr pScreen);
-
-Bool s3CursorInit (ScreenPtr pScreen);
-void s3CursorEnable (ScreenPtr pScreen);
-void s3CursorDisable (ScreenPtr pScreen);
-void s3CursorFini (ScreenPtr pScreen);
-void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
-
-Bool s3DrawInit (ScreenPtr pScreen);
-void s3DrawEnable (ScreenPtr pScreen);
-void s3DrawSync (ScreenPtr pScreen);
-void s3DrawDisable (ScreenPtr pScreen);
-void s3DrawFini (ScreenPtr pScreen);
-
-void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-
-void S3InitCard (KdCardAttr *attr);
-
-void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR);
-
-CARD8 _s3ReadIndexRegister (VOL8 *base, CARD8 index);
-void _s3WriteIndexRegister (VOL8 *base, CARD8 index, CARD8 value);
-
-extern KdCardFuncs s3Funcs;
-
-/*
- * Wait for the begining of the retrace interval
- */
-
-#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\
- DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \
- __FILE__, __LINE__)); \
- break; \
-}
-
-#define _s3WaitVRetrace(s3) { \
- VOL8 *_status = &s3->crt_vga_status_1; \
- int _loop_count; \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetrace 0x%x", *_status)); \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \
-}
-/*
- * Wait for the begining of the retrace interval
- */
-#define _s3WaitVRetraceEnd(s3) { \
- VOL8 *_status = &s3->crt_vga_status_1; \
- int _loop_count; \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetraceEnd 0x%x", *_status)); \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \
-}
-
-/*
- * This extension register must contain a magic bit pattern to enable
- * the remaining extended registers
- */
-
-#define _s3UnlockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0xa0)
-#define _s3LockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0x00)
-
-#define S3_CURSOR_WIDTH 64
-#define S3_CURSOR_HEIGHT 64
-#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8)
-
-#define S3_TILE_SIZE 8
-
-#endif /* _S3_H_ */
diff --git a/hw/kdrive/trio/s3clock.c b/hw/kdrive/trio/s3clock.c
deleted file mode 100644
index f79dfa92d..000000000
--- a/hw/kdrive/trio/s3clock.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Id: s3clock.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3clock.c,v 1.2 1999/12/30 03:03:19 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-/*
- * Clock synthesis:
- *
- * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R)))
- *
- * Constraints:
- *
- * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz
- * 2. N >= 1
- *
- * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank))
- * Horizontal refresh rate = clock / (hsize + hblank)
- */
-
-/* all in kHz */
-#define MIN_VCO 180000.0
-#define MAX_VCO 360000.0
-
-void
-s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR)
-{
- int M, N, R, bestM, bestN;
- int f_vco, f_out;
- int err, abserr, besterr;
-
- /*
- * Compute correct R value to keep VCO in range
- */
- for (R = 0; R <= maxR; R++)
- {
- f_vco = target * (1 << R);
- if (MIN_VCO <= f_vco && f_vco < MAX_VCO)
- break;
- }
-
- /* M = f_out / f_ref * ((N + 2) * (1 << R)); */
- besterr = target;
- for (N = 0; N <= maxN; N++)
- {
- M = (target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) / S3_CLOCK_REF - 2;
- if (0 <= M && M <= maxM)
- {
- f_out = S3_CLOCK(M,N,R);
- err = target - f_out;
- if (err < 0)
- err = -err;
- if (err < besterr)
- {
- besterr = err;
- bestM = M;
- bestN = N;
- }
- }
- }
- *Mp = bestM;
- *Np = bestN;
- *Rp = R;
-}
diff --git a/hw/kdrive/trio/s3cmap.c b/hw/kdrive/trio/s3cmap.c
deleted file mode 100644
index 19e192ed0..000000000
--- a/hw/kdrive/trio/s3cmap.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Id: s3cmap.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3cmap.c,v 1.1 1999/11/19 13:54:05 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-void
-s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- S3Ptr s3 = s3c->s3;
- VOL8 *dac_rd_ad = &s3->crt_vga_dac_rd_ad;
- VOL8 *dac_data = &s3->crt_vga_dac_data;
-
- LockS3 (s3c);
- while (ndef--)
- {
- *dac_rd_ad = pdefs->pixel;
- pdefs->red = *dac_data << 10;
- pdefs->green = *dac_data << 10;
- pdefs->blue = *dac_data << 10;
- pdefs++;
- }
- UnlockS3(s3c);
-}
-
-void
-s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- S3Ptr s3 = s3c->s3;
- VOL8 *dac_wt_ad = &s3->crt_vga_dac_wt_ad;
- VOL8 *dac_data = &s3->crt_vga_dac_data;
-
- LockS3(s3c);
- _s3WaitVRetrace (s3);
- while (ndef--)
- {
- *dac_wt_ad = pdefs->pixel;
- *dac_data = pdefs->red >> 10;
- *dac_data = pdefs->green >> 10;
- *dac_data = pdefs->blue >> 10;
- pdefs++;
- }
- UnlockS3(s3c);
-}
-
diff --git a/hw/kdrive/trio/s3curs.c b/hw/kdrive/trio/s3curs.c
deleted file mode 100644
index 9416b4398..000000000
--- a/hw/kdrive/trio/s3curs.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Id: s3curs.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3curs.c,v 1.2 1999/12/30 03:03:19 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-#include "s3draw.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- s3CardInfo(pScreenPriv); \
- s3ScreenInfo(pScreenPriv); \
- S3Ptr s3 = s3c->s3; \
- S3Cursor *pCurPriv = &s3s->cursor
-
-static void
-_s3MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
-
- /* This is the recommended order to move the cursor */
-
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x46, xhigh);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x47, xlow);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x49, ylow);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4e, xoff);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4f, yoff);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x48, yhigh);
-}
-
-static void
-s3MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- LockS3(s3c);
- _s3UnlockExt(s3);
- _s3MoveCursor (pScreen, x, y);
- _s3LockExt(s3);
- UnlockS3(s3c);
-}
-
-static void
-s3AllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
-}
-
-static void
-_s3SetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- /* set foreground */
- /* Reset cursor color stack pointers */
- (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 8);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 16);
-
- /* set background */
- /* Reset cursor color stack pointers */
- (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 8);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 16);
-}
-
-void
-s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- s3AllocCursorColors (pScreen);
- LockS3 (s3c);
- _s3UnlockExt(s3);
- _s3SetCursorColors (pScreen);
- _s3LockExt (s3);
- UnlockS3 (s3c);
-}
-
-static void
-s3LoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- unsigned char r[2], g[2], b[2];
- unsigned long *ram;
- unsigned long *msk, *mskLine, *src, *srcLine;
- unsigned long and, xor;
- int i, j;
- int cursor_address;
- int wsrc;
- unsigned char ramdac_control_;
-
- /*
- * Allocate new colors
- */
- s3AllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (unsigned long *) s3s->cursor_base;
- mskLine = (unsigned long *) bits->mask;
- srcLine = (unsigned long *) bits->source;
-
- h = bits->height;
- if (h > S3_CURSOR_HEIGHT)
- h = S3_CURSOR_HEIGHT;
-
- wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */
-
- for (i = 0; i < S3_CURSOR_HEIGHT; i++)
- {
- msk = mskLine;
- src = srcLine;
- mskLine += wsrc;
- srcLine += wsrc;
- for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) {
-
- unsigned long m, s;
-
- if (i < h && j < wsrc)
- {
- m = *msk++;
- s = *src++;
- xor = m & s;
- and = ~m;
- }
- else
- {
- and = 0xffffffff;
- xor = 0x00000000;
- }
-
- S3AdjustBits32(and);
- S3AdjustBits32(xor);
- *ram++ = (and & 0xffff) | (xor << 16);
- *ram++ = (and >> 16) | (xor & 0xffff0000);
- }
- }
-
- _s3WaitIdle (s3);
- _s3UnlockExt (s3);
-
- /* Set new color */
- _s3SetCursorColors (pScreen);
-
- /* Enable the cursor */
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0x01);
-
- /* Wait for VRetrace to make sure the position is read */
- _s3WaitVRetrace (s3);
-
- /* Move to new position */
- _s3MoveCursor (pScreen, x, y);
-
- _s3LockExt (s3);
- UnlockS3(s3c);
-}
-
-static void
-s3UnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- LockS3 (s3c);
- _s3UnlockExt(s3);
-
- /* Disable cursor */
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0);
-
- _s3LockExt(s3);
- UnlockS3 (s3c);
-}
-
-static Bool
-s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
-#ifdef FB_OLD_SCREEN
- short x, y;
-#else
- int x, y;
-#endif
-
- miPointerPosition (&x, &y);
- s3LoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- s3LoadCursor (pScreen, x, y);
- else
- s3UnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec s3PointerSpriteFuncs = {
- s3RealizeCursor,
- s3UnrealizeCursor,
- s3SetCursor,
- s3MoveCursor,
-};
-
-static void
-s3QueryBestSize (int class,
- unsigned short *pwidth, unsigned short *pheight,
- ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- switch (class)
- {
- case CursorShape:
- if (*pwidth > pCurPriv->width)
- *pwidth = pCurPriv->width;
- if (*pheight > pCurPriv->height)
- *pheight = pCurPriv->height;
- if (*pwidth > pScreen->width)
- *pwidth = pScreen->width;
- if (*pheight > pScreen->height)
- *pheight = pScreen->height;
- break;
- default:
- fbQueryBestSize (class, pwidth, pheight, pScreen);
- break;
- }
-}
-
-Bool
-s3CursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!s3s->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = S3_CURSOR_WIDTH;
- pCurPriv->height= S3_CURSOR_HEIGHT;
- pScreen->QueryBestSize = s3QueryBestSize;
- miPointerInitialize (pScreen,
- &s3PointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-s3CursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
-#ifdef FB_OLD_SCREEN
- short x, y;
-#else
- int x, y;
-#endif
-
- miPointerPosition (&x, &y);
- s3LoadCursor (pScreen, x, y);
- }
- else
- s3UnloadCursor (pScreen);
- }
-}
-
-void
-s3CursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- s3UnloadCursor (pScreen);
- }
- }
-}
-
-void
-s3CursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/trio/s3stub.c b/hw/kdrive/trio/s3stub.c
deleted file mode 100644
index 80d8fd56a..000000000
--- a/hw/kdrive/trio/s3stub.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Id: s3stub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
- *
- * Copyright 1999 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * 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.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3stub.c,v 1.3 2000/02/23 20:30:13 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
- CARD32 count;
-
- count = 0;
- while (LinuxFindPci (0x5333, 0x8904, count, &attr))
- {
- KdCardInfoAdd (&s3Funcs, &attr, 0);
- count++;
- }
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/ts300/Imakefile b/hw/kdrive/ts300/Imakefile
deleted file mode 100644
index 329b4825b..000000000
--- a/hw/kdrive/ts300/Imakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/nvfb/Imakefile,v 3.8 1996/12/23 06:30:19 dawes Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = ts300.c
-
-OBJS = ts300.o
-
-INCLUDES = -I. $(KDINCS) -I../trio -I../sis530
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(ts300,$(OBJS))
-DependTarget()
diff --git a/hw/kdrive/ts300/ts300.c b/hw/kdrive/ts300/ts300.c
deleted file mode 100644
index bd239d9fa..000000000
--- a/hw/kdrive/ts300/ts300.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Id: ts300.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/ts300/ts300.c,v 1.3 2000/02/23 20:30:14 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-extern KdCardFuncs sisFuncs;
-extern KdCardFuncs s3Funcs;
-
-/*
- * Kludgy code to parse the ascii /proc/pci file as the TS300
- * is running a 2.0 kernel
- */
-BOOL
-HasPCI (char *name, KdCardAttr *attr)
-{
- FILE *f;
- char line[1024];
- BOOL waiting;
- BOOL found = FALSE;
- char *mem;
-
- f = fopen ("/proc/pci", "r");
- if (!f)
- return FALSE;
- waiting = FALSE;
- attr->naddr = 0;
- while (fgets (line, sizeof (line), f))
- {
- if (waiting)
- {
-
- if (mem = strstr (line, "memory at "))
- {
- mem += strlen ("memory at ");
- attr->address[attr->naddr++] = strtoul (mem, NULL, 0);
- found = TRUE;
- }
- else if (mem = strstr (line, "I/O at "))
- {
- mem += strlen ("I/O at ");
- attr->io = strtoul (mem, NULL, 0);
- found = TRUE;
- }
- else if (strstr (line, "Bus") && strstr (line, "device") &&
- strstr (line, "function"))
- break;
- }
- else if (strstr (line, "VGA compatible controller"))
- {
- if (strstr (line, name))
- waiting = TRUE;
- }
- }
- fclose (f);
- return found;
-}
-
-typedef struct _PCICard {
- char *user;
- char *name;
- KdCardFuncs *funcs;
-} PCICard;
-
-PCICard PCICards[] = {
- "sis", "Silicon Integrated Systems", &sisFuncs,
- "s3", "S3 Inc.", &s3Funcs,
-};
-
-#define NUM_PCI_CARDS (sizeof (PCICards) / sizeof (PCICards[0]))
-
-void
-InitCard (char *name)
-{
- KdCardInfo *card;
- CARD32 fb;
- int i;
- KdCardAttr attr;
-
- for (i = 0; i < NUM_PCI_CARDS; i++)
- {
- if (!name || !strcmp (name, PCICards[i].user))
- {
- if (HasPCI (PCICards[i].name, &attr))
- {
- KdCardInfoAdd (PCICards[i].funcs, &attr, 0);
- return;
- }
- }
- }
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- return KdProcessArgument (argc, argv, i);
-}
diff --git a/hw/kdrive/vesa/Imakefile b/hw/kdrive/vesa/Imakefile
deleted file mode 100644
index 785ef9927..000000000
--- a/hw/kdrive/vesa/Imakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/vesa/Imakefile,v 1.2 2000/09/03 05:11:22 keithp Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = vesa.c vesainit.c vbe.c vga.c vm86.c
-
-OBJS = vesa.o vesainit.o vbe.o vga.o vm86.o
-
-INCLUDES = -I. $(KDINCS)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(vesa,$(OBJS))
-InstallManPage(Xvesa,$(MANDIR))
-DependTarget()
diff --git a/hw/kdrive/vesa/Makefile.am b/hw/kdrive/vesa/Makefile.am
deleted file mode 100644
index bdcb10c0e..000000000
--- a/hw/kdrive/vesa/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- @XSERVER_CFLAGS@
-
-noinst_LIBRARIES = libvesa.a
-
-bin_PROGRAMS = Xvesa
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-
-libvesa_a_SOURCES = \
- vesa.c \
- vesa.h \
- vbe.c \
- vbe.h \
- vga.c \
- vga.h \
- vm86.c \
- vm86.h
-
-Xvesa_SOURCES = \
- vesainit.c
-
-Xvesa_LDADD = \
- libvesa.a \
- @KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-Xvesa_DEPENDENCIES = \
- libvesa.a \
- @KDRIVE_LIBS@
diff --git a/hw/kdrive/vesa/Xvesa.man b/hw/kdrive/vesa/Xvesa.man
deleted file mode 100644
index fdac902ca..000000000
--- a/hw/kdrive/vesa/Xvesa.man
+++ /dev/null
@@ -1,101 +0,0 @@
-.\" $RCSId: xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man,v 1.5 2001/01/24 00:06:10 dawes Exp $
-.TH Xvesa 1 __vendorversion__
-.SH NAME
-Xvesa \- VESA Bios Extensions tiny X server
-.SH SYNOPSIS
-.B Xvesa
-.RI [ :display ]
-.RI [ option ...]
-.SH DESCRIPTION
-.B Xvesa
-is a generic X server for Linux on the x86 platform.
-.B Xvesa
-doesn't know about any particular hardware, and sets the video mode by
-running the video BIOS in VM86 mode.
-.B Xvesa
-can use both standard VGA BIOS modes and any modes advertised by a
-VESA BIOS if available.
-
-.B Xvesa
-runs untrusted code with full privileges, and is therefore a fairly
-insecure X server.
-.B Run at your own risk.
-.SH OPTIONS
-In addition to the normal KDrive server's options (see Xkdrive(1)),
-.B Xvesa
-accepts the following command line switches:
-.TP 8
-.B -mode \fIn\fB
-specifies the VESA video mode to use. If mode
-.I n
-is not supported by your BIOS and hardware,
-.B Xvesa
-will fail, hang your system, damage your hardware, or cause a global
-thermonuclear war; you are on your own. This option overrides any
-.B -screen
-options.
-.TP 8
-.B -listmodes
-list all supported video modes. If
-.B -force
-was specified before
-.BR -listmodes ,
-lists all the modes that your BIOS claims to support, even those that
-the
-.B Xvesa
-server won't be able to use.
-.TP 8
-.B -force
-disable some sanity checks and use the specified mode even if the
-BIOS claims not to support it.
-.TP 8
-.B -shadow
-use a shadow framebuffer even if it is not strictly necessary. This
-may dramatically improve performance on some hardware.
-.TP 8
-.B -nolinear
-don't use a linear framebuffer even if one is available. You don't
-want to use this option.
-.TP 8
-.B -swaprgb
-pass RGB values in the order that works on broken BIOSes. Use this if
-the colours are wrong in PseudoColor and 16 colour modes.
-.TP 8
-.B -map-holes
-use a contiguous (hole-less) memory map. This fixes a segmentation
-violation with some rare BIOSes that violate the VESA specification,
-but may cause slightly higher memory usage on systems that overcommit
-memory.
-.TP 8
-.B -verbose
-emit diagnostic messages during BIOS initialization and teardown.
-.SH KEYBOARD
-Multiple key presses recognized directly by
-.B Xvesa
-are:
-.TP 8
-.B Ctrl+Alt+Backspace
-Immediately kill the server.
-.TP 8
-.B Ctrl+Alt+F1...F12
-Switch to virtual console 1 through 12.
-.SH BUGS
-.B Xvesa
-opens all IO ports and runs your VESA BIOS, which may be assumed to be
-buggy. Allowing your users to run
-.B Xvesa
-is probably a security hole.
-
-.B Xvesa
-records the current BIOS mode when it starts and restores that mode on
-termination; if the video card has been reprogrammed by another application,
-the display will almost certainly be trashed. The alternative of saving and
-restoring the complete video card state has proven unreliable on most video
-cards.
-.SH SEE ALSO
-X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1).
-.SH AUTHORS
-The VESA driver was written by Juliusz Chroboczek who didn't realise
-what he was doing until it was too late. Keith Packard then added
-support for standard VGA BIOS modes and is especially proud of 320x200
-16 colour mode.
diff --git a/hw/kdrive/vesa/vbe.c b/hw/kdrive/vesa/vbe.c
deleted file mode 100644
index 4bcedf08d..000000000
--- a/hw/kdrive/vesa/vbe.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vbe.c,v 1.9 2001/05/29 04:54:12 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vesa.h"
-
-int
-VbeGetVib (Vm86InfoPtr vi, VbeInfoBlock *vib)
-{
- int code;
- int mark;
- int vib_base;
- VbeInfoBlock *vib_low;
-
- mark = Vm86MarkMemory (vi);
- vib_base = Vm86AllocateMemory (vi, sizeof (VbeInfoBlock));
- vib_low = (VbeInfoBlock*)&(LM(vi, vib_base));
- vi->vms.regs.eax = 0x4F00;
- vi->vms.regs.es = POINTER_SEGMENT(vib_base);
- vi->vms.regs.edi = POINTER_OFFSET(vib_base);
- memcpy(vib_low->VbeSignature, "VBE2", 4);
- code = VbeDoInterrupt10(vi);
- if(code >= 0)
- {
- if(memcmp(vib_low->VbeSignature, "VESA", 4) == 0)
- *vib = *vib_low;
- else
- code = -1;
- }
- Vm86ReleaseMemory (vi, mark);
- return code;
-}
-
-int
-VbeGetVmib (Vm86InfoPtr vi, int mode, VbeModeInfoBlock *vmib)
-{
- int code;
- int mark;
- int vmib_base;
- VbeModeInfoBlock *vmib_low;
-
- mark = Vm86MarkMemory (vi);
-
- vmib_base = Vm86AllocateMemory (vi, sizeof (VbeModeInfoBlock));
- vmib_low = (VbeModeInfoBlock*)&(LM(vi, vmib_base));
-
- vi->vms.regs.eax = 0x4F01;
- vi->vms.regs.ecx = mode&0xFFFF;
- vi->vms.regs.es = POINTER_SEGMENT(vmib_base);
- vi->vms.regs.edi = POINTER_OFFSET(vmib_base);
- code = VbeDoInterrupt10(vi);
-
- if(code >= 0)
- *vmib = *vmib_low;
- Vm86ReleaseMemory (vi, mark);
- return code;
-}
-
-static int
-VbeReportVib(Vm86InfoPtr vi, VbeInfoBlock *vib)
-{
- U32 i, p;
- unsigned char c;
- int error = 0;
-
- ErrorF("VBE version %c.%c (",
- ((vib->VbeVersion >> 8) & 0xFF) + '0',
- (vib->VbeVersion & 0xFF)+'0');
- p = vib->OemStringPtr;
- for(i = 0; 1; i++) {
- c = Vm86Memory(vi, MAKE_POINTER_1(p+i));
- if(!c) break;
- if (c >= ' ')
- ErrorF("%c", c);
- if (i > 32000) {
- error = 1;
- break;
- }
- }
- ErrorF(")\n");
- ErrorF("DAC is %s, controller is %sVGA compatible%s\n",
- (vib->Capabilities[0]&1)?"fixed":"switchable",
- (vib->Capabilities[0]&2)?"not ":"",
- (vib->Capabilities[0]&3)?", RAMDAC causes snow":"");
- ErrorF("Total memory: %lu kilobytes\n", 64L*vib->TotalMemory);
- if(error)
- return -1;
- return 0;
-}
-
-#if 0
-static int
-VbeReportModeInfo(Vm86InfoPtr vi, U16 mode, VbeModeInfoBlock *vmib)
-{
- int supported = (vmib->ModeAttributes&0x1)?1:0;
- int colour = (vmib->ModeAttributes&0x8)?1:0;
- int graphics = (vmib->ModeAttributes&0x10)?1:0;
- int vga_compatible = !((vmib->ModeAttributes&0x20)?1:0);
- int linear_fb = (vmib->ModeAttributes&0x80)?1:0;
-
- ErrorF("0x%04X: %dx%dx%d%s",
- (unsigned)mode,
- (int)vmib->XResolution, (int)vmib->YResolution,
- (int)vmib->BitsPerPixel,
- colour?"":" (monochrome)",
- graphics?"":" (graphics)",
- vga_compatible?"":" (vga compatible)",
- linear_fb?"":" (linear frame buffer)");
- switch(vmib->MemoryModel) {
- case 0:
- ErrorF(" text mode (%dx%d)",
- (int)vmib->XCharSize, (int)vmib->YCharSize);
- break;
- case 1:
- ErrorF(" CGA graphics");
- break;
- case 2:
- ErrorF(" Hercules graphics");
- break;
- case 3:
- ErrorF(" Planar (%d planes)", vmib->NumberOfPlanes);
- break;
- case 4:
- ErrorF(" PseudoColor");
- break;
- case 5:
- ErrorF(" Non-chain 4, 256 colour");
- break;
- case 6:
- if(vmib->DirectColorModeInfo & 1)
- ErrorF(" DirectColor");
- else
- ErrorF(" TrueColor");
- ErrorF(" [%d:%d:%d:%d]",
- vmib->RedMaskSize, vmib->GreenMaskSize, vmib->BlueMaskSize,
- vmib->RsvdMaskSize);
- if(vmib->DirectColorModeInfo & 2)
- ErrorF(" (reserved bits are reserved)");
- break;
- case 7: ErrorF("YUV");
- break;
- default:
- ErrorF("unknown MemoryModel 0x%X ", vmib->MemoryModel);
- }
- if(!supported)
- ErrorF(" (unsupported)");
- else if(!linear_fb)
- ErrorF(" (no linear framebuffer)");
- ErrorF("\n");
- return 0;
-}
-#endif
-
-void
-VbeReportInfo (Vm86InfoPtr vi)
-{
- VbeInfoBlock vib;
- int code;
-
- code = VbeGetVib (vi, &vib);
- if (code >= 0)
- VbeReportVib(vi, &vib);
-}
-
-int
-VbeGetNmode (Vm86InfoPtr vi)
-{
- VbeInfoBlock vib;
- int code;
- unsigned int p;
- int n;
- int mode;
-
- code = VbeGetVib (vi, &vib);
- if (code >= 0)
- {
- p = MAKE_POINTER_1(vib.VideoModePtr);
- for (n = 0; ; n++)
- {
- mode = Vm86MemoryW(vi, p);
- if (mode == 0xffff)
- break;
- p += 2;
- }
- code = n;
- }
- return code;
-}
-
-int
-VbeGetModes (Vm86InfoPtr vi, VesaModePtr modes, int nmode)
-{
- VbeInfoBlock vib;
- int code;
- unsigned int p;
- int n;
- int mode;
- VbeModeInfoBlock vmib;
-
- code = VbeGetVib (vi, &vib);
- if (code < 0)
- return code;
-
- memset (modes, '\0', nmode * sizeof (VesaModeRec));
-
- p = MAKE_POINTER_1(vib.VideoModePtr);
- for (n = 0; n < nmode; n++)
- {
- mode = Vm86MemoryW(vi, p);
- if (mode == 0xffff)
- break;
- modes[n].mode = mode;
- modes[n].vbe = 1;
- p += 2;
- }
-
- nmode = n;
-
- for (n = 0; n < nmode; n++)
- {
- code = VbeGetVmib (vi, modes[n].mode, &vmib);
- if (code >= 0)
- {
- modes[n].ModeAttributes = vmib.ModeAttributes;
- modes[n].NumberOfPlanes = vmib.NumberOfPlanes;
- modes[n].BitsPerPixel = vmib.BitsPerPixel;
- modes[n].MemoryModel = vmib.MemoryModel;
- modes[n].RedMaskSize = vmib.RedMaskSize;
- modes[n].RedFieldPosition = vmib.RedFieldPosition;
- modes[n].GreenMaskSize = vmib.GreenMaskSize;
- modes[n].GreenFieldPosition = vmib.GreenFieldPosition;
- modes[n].BlueMaskSize = vmib.BlueMaskSize;
- modes[n].BlueFieldPosition = vmib.BlueFieldPosition;
- modes[n].RsvdMaskSize = vmib.RsvdMaskSize;
- modes[n].RsvdFieldPosition = vmib.RsvdFieldPosition;
- modes[n].DirectColorModeInfo = vmib.DirectColorModeInfo;
- modes[n].XResolution = vmib.XResolution;
- modes[n].YResolution = vmib.YResolution;
- modes[n].BytesPerScanLine = vmib.BytesPerScanLine;
- }
- }
-
- return nmode;
-}
-
-VbeInfoPtr
-VbeInit (Vm86InfoPtr vi)
-{
- VbeInfoPtr vbe;
- int code;
- VbeInfoBlock vib;
-
- code = VbeGetVib (vi, &vib);
- if (code < 0)
- return 0;
-
- vbe = xalloc (sizeof (VbeInfoRec));
- if (!vbe)
- return 0;
- vbe->palette_format = 6;
- vbe->palette_wait = TRUE;
- return vbe;
-}
-
-void
-VbeCleanup (Vm86InfoPtr vi, VbeInfoPtr vbe)
-{
- xfree (vbe);
-}
-
-int
-VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear, int direct)
-{
- int code;
- VbeInfoBlock vib;
- int palette_wait = 0, palette_hi = 0;
-
- code = VbeGetVib (vi, &vib);
- if (code < 0)
- return -1;
-
- code = VbeGetVmib (vi, mode, &vbe->vmib);
- if (code < 0)
- return -1;
-
- mode = (mode & 0xffff) &~ 0x8000;
- if (linear)
- mode |= 0x4000;
-
- vi->vms.regs.eax = 0x4F02;
- vi->vms.regs.ebx = mode;
- code = VbeDoInterrupt10(vi);
- if(code < 0)
- return -1;
-
- vbe->windowA_offset = vbe->windowB_offset = -1;
- vbe->last_window = 1;
-
- if (!direct)
- {
- if(vib.Capabilities[0] & 1)
- palette_hi = 1;
- if(vib.Capabilities[0] & 4)
- palette_wait = 1;
-
- if(palette_hi || palette_wait)
- VbeSetPaletteOptions(vi, vbe, palette_hi?8:6, palette_wait);
- }
-
- return 0;
-}
-
-int
-VbeGetMode(Vm86InfoPtr vi, int *mode)
-{
- int code;
-
- vi->vms.regs.eax = 0x4F03;
- code = VbeDoInterrupt10(vi);
- if(code < 0)
- return - 1;
- *mode = vi->vms.regs.ebx & 0xFFFF;
- return 0;
-}
-
-void *
-VbeMapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int *ret_size, CARD32 *ret_phys)
-{
- U8 *fb;
- VbeInfoBlock vib;
- VbeModeInfoBlock vmib;
- int size;
- int pagesize = getpagesize();
- int before, after;
-
- if (VbeGetVib (vi, &vib) < 0)
- return 0;
-
- if (VbeGetVmib (vi, mode, &vmib) < 0)
- return 0;
-
- size = 1024 * 64L * vib.TotalMemory;
-
- *ret_size = size;
- *ret_phys = vmib.PhysBasePtr;
-
- before = vmib.PhysBasePtr % pagesize;
- after = pagesize - ((vmib.PhysBasePtr + size) % pagesize);
- if(after == pagesize)
- after = 0;
-
- fb = KdMapDevice (vmib.PhysBasePtr - before, before + size + after);
-
- if(fb == 0)
- {
- ErrorF("Failed to map framebuffer\n");
- return NULL;
- }
-
- KdSetMappedMode (vmib.PhysBasePtr - before, before + size + after,
- KD_MAPPED_MODE_FRAMEBUFFER);
-
- return fb + before;
-}
-
-void
-VbeUnmapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, void *fb)
-{
- VbeInfoBlock vib;
- VbeModeInfoBlock vmib;
- int size;
- int pagesize = getpagesize();
- int before, after;
-
- if (VbeGetVib (vi, &vib) < 0)
- return;
-
- if (VbeGetVmib (vi, mode, &vmib) < 0)
- return;
-
- size = 1024 * 64L * vib.TotalMemory;
-
- before = vmib.PhysBasePtr % pagesize;
- after = pagesize - ((vmib.PhysBasePtr + size) % pagesize);
- if(after == pagesize)
- after = 0;
-
- fb = (void *) ((char *) fb - before);
-
- KdUnmapDevice (fb, before + size + after);
- KdResetMappedMode (vmib.PhysBasePtr - before, before + size + after,
- KD_MAPPED_MODE_FRAMEBUFFER);
-}
-
-int
-VbeSetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries)
-{
- U8 *palette_scratch;
- int mark;
- int palette_base;
- int i, code;
-
- if(number == 0)
- return 0;
-
- if(first < 0 || number < 0 || first + number > 256) {
- ErrorF("Cannot set %d, %d palette entries\n", first, number);
- return -1;
- }
- if(vbe->palette_format < 6 || vbe->palette_format > 8) {
- ErrorF("Impossible palette format %d\n", vbe->palette_format);
- return -1;
- }
-
- mark = Vm86MarkMemory (vi);
- palette_base = Vm86AllocateMemory (vi, 4 * 256);
-
- palette_scratch = &LM(vi, palette_base);
-
- for(i=0; i<number*4; i++)
- palette_scratch[i] = entries[i] >> (8 - vbe->palette_format);
-
- vi->vms.regs.eax = 0x4F09;
- if(vbe->palette_wait)
- vi->vms.regs.ebx = 0x80;
- else
- vi->vms.regs.ebx = 0x00;
- vi->vms.regs.ecx = number;
- vi->vms.regs.edx = first;
- vi->vms.regs.es = POINTER_SEGMENT(palette_base);
- vi->vms.regs.edi = POINTER_OFFSET(palette_base);
- code = VbeDoInterrupt10(vi);
- Vm86ReleaseMemory (vi, mark);
-
- if(code < 0)
- return -1;
- return 0;
-}
-
-int
-VbeGetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries)
-{
- U8 *palette_scratch;
- int mark;
- int palette_base;
- int i, code;
-
- if(number == 0)
- return 0;
-
- if(first < 0 || number < 0 || first + number > 256) {
- ErrorF("Cannot get %d, %d palette entries\n", first, number);
- return -1;
- }
- if(vbe->palette_format < 6 || vbe->palette_format > 8) {
- ErrorF("Impossible palette format %d\n", vbe->palette_format);
- return -1;
- }
-
- mark = Vm86MarkMemory (vi);
- palette_base = Vm86AllocateMemory (vi, 4 * 256);
-
- palette_scratch = &LM(vi, palette_base);
-
- vi->vms.regs.eax = 0x4F09;
- vi->vms.regs.ebx = 0x01;
- vi->vms.regs.ecx = number;
- vi->vms.regs.edx = first;
- vi->vms.regs.es = POINTER_SEGMENT(palette_base);
- vi->vms.regs.edi = POINTER_OFFSET(palette_base);
- code = VbeDoInterrupt10(vi);
- if(code >= 0)
- {
- for(i=0; i<number*4; i++)
- entries[i] = palette_scratch[i] << (8-vbe->palette_format);
- }
- Vm86ReleaseMemory (vi, mark);
-
- return 0;
-}
-
-int
-VbeSetPaletteOptions(Vm86InfoPtr vi, VbeInfoPtr vbe, U8 bits, int wait)
-{
- int code;
-
- if(bits < 6 || bits > 8) {
- ErrorF("Impossible palette format %d\n", bits);
- return -1;
- }
- if(bits != vbe->palette_format)
- {
- vbe->palette_format = 0;
- vi->vms.regs.eax = 0x4F08;
- vi->vms.regs.ebx = bits << 8;
- code = VbeDoInterrupt10(vi);
- if(code < 0)
- return -1;
- vbe->palette_format = bits;
- }
- vbe->palette_wait = wait;
- return 0;
-}
-
-static int
-VbeReallySetWindow(Vm86InfoPtr vi, U8 window, U16 winnum)
-{
- int code;
- vi->vms.regs.eax = 0x4F05;
- vi->vms.regs.ebx = window;
- vi->vms.regs.edx = winnum;
- code = VbeDoInterrupt10(vi);
- if(code < 0)
- return -1;
- return 0;
-}
-
-void *
-VbeSetWindow(Vm86InfoPtr vi, VbeInfoPtr vbe, int offset, int purpose, int *size_return)
-{
- int window_size = vbe->vmib.WinSize * 1024;
- int code;
- int winnum;
-
- if(vbe->windowA_offset >= 0)
- if(vbe->windowA_offset <= offset && vbe->windowA_offset + window_size > offset)
- if(vbe->vmib.WinAAttributes & purpose)
- goto windowA;
-
- if(vbe->windowB_offset >= 0)
- if(vbe->windowB_offset <= offset && vbe->windowB_offset + window_size > offset)
- if(vbe->vmib.WinBAttributes & purpose)
- goto windowB;
-
- if(!(vbe->vmib.WinBAttributes & purpose) ||
- !(vbe->vmib.WinBAttributes & VBE_WINDOW_RELOCATE))
- goto set_windowA;
-
- if(!(vbe->vmib.WinAAttributes & purpose) ||
- !(vbe->vmib.WinAAttributes & VBE_WINDOW_RELOCATE))
- goto set_windowB;
-
- if(vbe->last_window)
- goto set_windowA;
- else
- goto set_windowB;
-
-set_windowA:
- winnum = offset / (vbe->vmib.WinGranularity * 1024);
- code = VbeReallySetWindow(vi, 0, winnum);
- if(code < 0) {
- ErrorF("Couldn't set window A to %d*%d\n",
- (int)winnum, (int)vbe->vmib.WinGranularity);
- return NULL;
- }
- vbe->windowA_offset = winnum * vbe->vmib.WinGranularity * 1024;
-windowA:
- vbe->last_window = 0;
- *size_return = vbe->vmib.WinSize * 1024 - (offset - vbe->windowA_offset);
- return ((U8*)&(LM(vi, MAKE_POINTER(vbe->vmib.WinASegment, 0)))) + offset - vbe->windowA_offset;
-
-set_windowB:
- winnum = offset / (vbe->vmib.WinGranularity * 1024);
- code = VbeReallySetWindow(vi, 1, winnum);
- if(code < 0) {
- ErrorF("Couldn't set window B to %d*%d\n",
- (int)winnum, (int)vbe->vmib.WinGranularity);
- return NULL;
- }
- vbe->windowB_offset = winnum * vbe->vmib.WinGranularity * 1024;
-windowB:
- vbe->last_window = 1;
- *size_return = vbe->vmib.WinSize * 1024 - (offset - vbe->windowB_offset);
- return ((U8*)&(LM(vi, MAKE_POINTER(vbe->vmib.WinBSegment, 0)))) + offset - vbe->windowB_offset;
-}
-
-static const int VbeDPMSModes[4] = {
- 0x00, /* KD_DPMS_NORMAL */
- 0x01, /* KD_DPMS_STANDBY */
- 0x02, /* KD_DPMS_SUSPEND */
- 0x04, /* KD_DPMS_POWERDOWN */
-};
-
-Bool
-VbeDPMS(Vm86InfoPtr vi, int mode)
-{
- int code;
-
- /*
- * Check which modes are supported
- */
- vi->vms.regs.eax = 0x4f10;
- vi->vms.regs.ebx = 0x0000;
- vi->vms.regs.es = 0;
- vi->vms.regs.edi = 0;
- code = VbeDoInterrupt10 (vi);
- if (code < 0)
- {
- ErrorF ("No DPMS Support %d\n", code);
- return FALSE;
- }
- /* Skip this stage if it's not supported */
- if (((vi->vms.regs.ebx >> 4) & VbeDPMSModes[mode]) != VbeDPMSModes[mode])
- return FALSE;
-
- /* Select this mode */
- vi->vms.regs.eax = 0x4f10;
- vi->vms.regs.ebx = (VbeDPMSModes[mode] << 8) | 0x01;
- code = VbeDoInterrupt10 (vi);
- if (code < 0)
- {
- ErrorF ("DPMS failed %d\n", code);
- return FALSE;
- }
-
- return TRUE;
-}
-
-int
-VbeDoInterrupt10(Vm86InfoPtr vi)
-{
- int code;
- int oldax;
-
- oldax = vi->vms.regs.eax & 0xFFFF;
-
- code = Vm86DoInterrupt(vi, 0x10);
- if(code < 0)
- return -1;
-
- if((vi->vms.regs.eax & 0xFFFF) != 0x4F && (oldax & 0xFF00) == 0x4F00) {
- ErrorF("Int 10h (0x%04X) failed: 0x%04X",
- oldax, vi->vms.regs.eax & 0xFFFF);
- if((oldax & 0xFF00) == 0x4F00) {
- switch((vi->vms.regs.eax & 0xFF00)>>8) {
- case 0:
- ErrorF(" (success)\n");
- return 0;
- case 1:
- ErrorF(" (function call failed)\n");
- break;
- case 2:
- ErrorF(" (function not supported on this hardware)\n");
- break;
- case 3:
- ErrorF(" (function call invalid in this video mode)\n");
- break;
- default:
- ErrorF(" (unknown error)\n");
- break;
- } return -1;
- } else {
- ErrorF("\n");
- }
- }
- return code;
-}
diff --git a/hw/kdrive/vesa/vbe.h b/hw/kdrive/vesa/vbe.h
deleted file mode 100644
index 8aa3276d8..000000000
--- a/hw/kdrive/vesa/vbe.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vbe.h,v 1.6 2001/05/29 04:54:12 keithp Exp $ */
-
-#ifndef _VBE_H
-#define _VBE_H
-
-#define VBE_WINDOW_RELOCATE 1
-#define VBE_WINDOW_READ 2
-#define VBE_WINDOW_WRITE 4
-
-typedef struct _VbeInfoBlock {
- U8 VbeSignature[4]; /* VBE Signature */
- U16 VbeVersion; /* VBE Version */
- U32 OemStringPtr; /* Pointer to OEM String */
- U8 Capabilities[4]; /* Capabilities of graphics controller */
- U32 VideoModePtr; /* Pointer to VideoModeList */
- U16 TotalMemory; /* Number of 64kb memory blocks */
-/* Added for VBE 2.0 */
- U16 OemSoftwareRev; /* VBE implementation Software revision */
- U32 OemVendorNamePtr; /* Pointer to Vendor Name String */
- U32 OemProductNamePtr; /* Pointer to Product Name String */
- U32 OemProductRevPtr; /* Pointer to Product Revision String */
- U8 Reserved[222]; /* Reserved for VBE implementation */
- U8 OemData[256]; /* Data Area for OEM Strings*/
-} __attribute__((packed)) VbeInfoBlock;
-
-typedef struct _VbeModeInfoBlock {
-/* Mandatory information for all VBE revisions */
- U16 ModeAttributes; /* mode attributes */
- U8 WinAAttributes; /* window A attributes */
- U8 WinBAttributes; /* window B attributes */
- U16 WinGranularity; /* window granularity */
- U16 WinSize; /* window size */
- U16 WinASegment; /* window A start segment */
- U16 WinBSegment; /* window B start segment */
- U32 WinFuncPtr; /* pointer to window function */
- U16 BytesPerScanLine; /* bytes per scan line */
-/* Mandatory information for VBE 1.2 and above */
- U16 XResolution; /* horizontal resolution */
- U16 YResolution; /* vertical resolution */
- U8 XCharSize; /* character cell width in pixels */
- U8 YCharSize; /* character cell height in pixels */
- U8 NumberOfPlanes; /* number of memory planes */
- U8 BitsPerPixel; /* bits per pixel */
- U8 NumberOfBanks; /* number of banks */
- U8 MemoryModel; /* memory model type */
- U8 BankSize; /* bank size in KB */
- U8 NumberOfImagePages; /* number of images */
- U8 Reserved; /* reserved for page function */
-/* Direct Color fields (required for direct/6 and YUV/7 memory models) */
- U8 RedMaskSize; /* size of direct color red mask in bits */
- U8 RedFieldPosition; /* bit position of lsb of red mask */
- U8 GreenMaskSize; /* size of direct color green mask in bits */
- U8 GreenFieldPosition; /* bit position of lsb of green mask */
- U8 BlueMaskSize; /* size of direct color blue mask in bits */
- U8 BlueFieldPosition; /* bit position of lsb of blue mask */
- U8 RsvdMaskSize; /* size of direct color reserved mask bits*/
- U8 RsvdFieldPosition; /* bit position of lsb of reserved mask */
- U8 DirectColorModeInfo; /* direct color mode attributes */
-/* Mandatory information for VBE 2.0 and above */
- U32 PhysBasePtr; /* physical address for flat memory fb */
- U32 OffScreenMemOffset; /* pointer to start of off screen memory */
- U16 OffScreenMemSize; /* amount of off screen memory in 1k units */
- U8 Reserved2[206]; /* remainder of ModeInfoBlock */
-} __attribute__((packed)) VbeModeInfoBlock;
-
-typedef struct _VbeInfoRec {
- U8 palette_format;
- int palette_wait;
- int windowA_offset;
- int windowB_offset;
- int window_size;
- int last_window;
- VbeModeInfoBlock vmib;
-} VbeInfoRec, *VbeInfoPtr;
-
-typedef struct _SupVbeInfoBlock {
- U8 SupVbeSignature[7]; /* Supplemental VBE Signature */
- U16 SupVbeVersion; /* Supplemental VBE Version*/
- U8 SupVbeSubFunc[8]; /* Bitfield of supported subfunctions */
- U16 OemSoftwareRev; /* OEM Software revision */
- U32 OemVendorNamePtr; /* Pointer to Vendor Name String */
- U32 OemProductNamePtr; /* Pointer to Product Name String */
- U32 OemProductRevPtr; /* Pointer to Product Revision String */
- U32 OemStringPtr; /* Pointer to OEM String */
- U8 Reserved[221]; /* Reserved */
-} __attribute__((packed)) SupVbeInfoBlock;
-
-int
-VbeGetVib (Vm86InfoPtr vi, VbeInfoBlock *vib);
-
-int
-VbeGetVmib (Vm86InfoPtr vi, int mode, VbeModeInfoBlock *vmib);
-
-void
-VbeReportInfo (Vm86InfoPtr vi);
-
-int
-VbeGetNmode (Vm86InfoPtr vi);
-
-int
-VbeGetModes (Vm86InfoPtr vi, VesaModePtr modes, int nmode);
-
-VbeInfoPtr
-VbeInit (Vm86InfoPtr vi);
-
-void
-VbeCleanup (Vm86InfoPtr vi, VbeInfoPtr vbe);
-
-int
-VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear, int direct);
-
-int
-VbeGetMode(Vm86InfoPtr vi, int *mode);
-
-void *
-VbeMapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int *ret_size, CARD32 *ret_phys);
-
-void
-VbeUnmapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, void *fb);
-
-int
-VbeSetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries);
-
-int
-VbeGetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries);
-
-int
-VbeSetPaletteOptions(Vm86InfoPtr vi, VbeInfoPtr vbe, U8 bits, int wait);
-
-void *
-VbeSetWindow(Vm86InfoPtr vi, VbeInfoPtr vbe, int offset, int purpose, int *size_return);
-
-Bool
-VbeDPMS(Vm86InfoPtr vi, int mode);
-
-int
-VbeDoInterrupt10(Vm86InfoPtr vi);
-
-#endif
diff --git a/hw/kdrive/vesa/vesa.c b/hw/kdrive/vesa/vesa.c
deleted file mode 100644
index 74bfb857e..000000000
--- a/hw/kdrive/vesa/vesa.c
+++ /dev/null
@@ -1,1782 +0,0 @@
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vesa.h"
-#include "vga.h"
-#include "vbe.h"
-#ifdef RANDR
-#include <randrstr.h>
-#endif
-
-int vesa_video_mode = 0;
-Bool vesa_force_mode = FALSE;
-Bool vesa_swap_rgb = FALSE;
-Bool vesa_shadow = FALSE;
-Bool vesa_linear_fb = TRUE;
-Bool vesa_restore = FALSE;
-Bool vesa_verbose = FALSE;
-Bool vesa_force_text = FALSE;
-Bool vesa_restore_font = TRUE;
-Bool vesa_map_holes = TRUE;
-
-#define VesaPriv(scr) ((VesaScreenPrivPtr) (scr)->driver)
-
-#define vesaWidth(scr,vmib) ((vmib)->XResolution)
-#define vesaHeight(scr,vmib) ((vmib)->YResolution)
-
-static Bool
-vesaModeSupportable (VesaModePtr mode, Bool complain)
-{
- if((mode->ModeAttributes & 0x10) == 0) {
- if(complain)
- ErrorF("Text mode specified.\n");
- return FALSE;
- }
- if(mode->MemoryModel != 0x06 && mode->MemoryModel != 0x04 && mode->MemoryModel != 0x03) {
- if(complain)
- ErrorF("Unsupported memory model 0x%X\n", mode->MemoryModel);
- return FALSE;
- }
- if((mode->ModeAttributes & 0x80) == 0) {
- if ((mode->ModeAttributes & 0x40) != 0) {
- if(complain)
- ErrorF("Neither linear nor windowed framebuffer available in this mode\n");
- return FALSE;
- }
- }
- if(!(mode->ModeAttributes & 1)) {
- if(complain)
- ErrorF("Mode not supported on this hardware\n");
- return FALSE;
- }
- return TRUE;
-}
-
-static Bool
-vesaModeSupported (VesaCardPrivPtr priv, VesaModePtr mode, Bool complain)
-{
- if (!priv->vbeInfo && mode->vbe) {
- if (complain)
- ErrorF("VBE bios mode not usable.\n");
- return FALSE;
- }
- return vesaModeSupportable (mode, complain);
-}
-
-void
-vesaReportMode (VesaModePtr mode)
-{
- int supported = (mode->ModeAttributes&MODE_SUPPORTED)?1:0;
- int colour = (mode->ModeAttributes&MODE_COLOUR)?1:0;
- int graphics = (mode->ModeAttributes&MODE_GRAPHICS)?1:0;
- int vga_compatible = !((mode->ModeAttributes&MODE_VGA)?1:0);
- int linear_fb = (mode->ModeAttributes&MODE_LINEAR)?1:0;
-
- ErrorF("0x%04X: %dx%dx%d%s%s",
- (unsigned)mode->mode,
- (int)mode->XResolution, (int)mode->YResolution,
- vesaDepth (mode),
- colour?"":" (monochrome)",
- graphics?"":" (graphics)",
- vga_compatible?"":" (vga compatible)",
- linear_fb?"":" (linear frame buffer)");
- switch(mode->MemoryModel) {
- case MEMORY_TEXT:
- ErrorF(" text mode");
- break;
- case MEMORY_CGA:
- ErrorF(" CGA graphics");
- break;
- case MEMORY_HERCULES:
- ErrorF(" Hercules graphics");
- break;
- case MEMORY_PLANAR:
- ErrorF(" Planar (%d planes)", mode->NumberOfPlanes);
- break;
- case MEMORY_PSEUDO:
- ErrorF(" PseudoColor");
- break;
- case MEMORY_NONCHAIN:
- ErrorF(" Non-chain 4, 256 colour");
- break;
- case MEMORY_DIRECT:
- if(mode->DirectColorModeInfo & MODE_DIRECT)
- ErrorF(" DirectColor");
- else
- ErrorF(" TrueColor");
- ErrorF(" [%d:%d:%d:%d]",
- mode->RedMaskSize, mode->GreenMaskSize, mode->BlueMaskSize,
- mode->RsvdMaskSize);
- if(mode->DirectColorModeInfo & 2)
- ErrorF(" (reserved bits are reserved)");
- break;
- case MEMORY_YUV:
- ErrorF("YUV");
- break;
- default:
- ErrorF("unknown MemoryModel 0x%X ", mode->MemoryModel);
- }
- if(!supported)
- ErrorF(" (unsupported)");
- else if(!linear_fb)
- ErrorF(" (no linear framebuffer)");
- ErrorF("\n");
-}
-
-VesaModePtr
-vesaGetModes (Vm86InfoPtr vi, int *ret_nmode)
-{
- VesaModePtr modes;
- int nmode, nmodeVbe, nmodeVga;
- int code;
-
- code = VgaGetNmode (vi);
- if (code <= 0)
- nmodeVga = 0;
- else
- nmodeVga = code;
-
- code = VbeGetNmode (vi);
- if (code <= 0)
- nmodeVbe = 0;
- else
- nmodeVbe = code;
-
- nmode = nmodeVga + nmodeVbe;
- if (nmode <= 0)
- return 0;
-
- modes = xalloc (nmode * sizeof (VesaModeRec));
-
- memset (modes, '\0', nmode * sizeof (VesaModeRec));
-
- if (nmodeVga)
- {
- code = VgaGetModes (vi, modes, nmodeVga);
- if (code <= 0)
- nmodeVga = 0;
- else
- nmodeVga = code;
- }
-
- if (nmodeVbe)
- {
- code = VbeGetModes (vi, modes + nmodeVga, nmodeVbe);
- if (code <= 0)
- nmodeVbe = 0;
- else
- nmodeVbe = code;
- }
-
- nmode = nmodeVga + nmodeVbe;
-
- if (nmode == 0)
- {
- xfree (modes);
- modes = 0;
- return 0;
- }
- *ret_nmode = nmode;
- return modes;
-}
-
-Bool
-vesaInitialize (KdCardInfo *card, VesaCardPrivPtr priv)
-{
- priv->vi = Vm86Setup(vesa_map_holes);
- if(!priv->vi)
- goto fail;
-
- priv->modes = vesaGetModes (priv->vi, &priv->nmode);
-
- if (!priv->modes)
- goto fail;
-
- priv->vbeInfo = VbeInit (priv->vi);
-
- card->driver = priv;
-
- return TRUE;
-
-fail:
- if(priv->vi)
- Vm86Cleanup(priv->vi);
- return FALSE;
-}
-
-void
-vesaListModes (void)
-{
- Vm86InfoPtr vi;
- VesaModePtr modes;
- int nmode;
- int n;
-
- vi = Vm86Setup (vesa_map_holes);
- if (!vi)
- {
- ErrorF ("Can't setup vm86\n");
- }
- else
- {
- modes = vesaGetModes (vi, &nmode);
- if (!modes)
- {
- ErrorF ("No modes available\n");
- }
- else
- {
- VbeReportInfo (vi);
- for (n = 0; n < nmode; n++)
- {
- if (vesa_force_mode || vesaModeSupportable (modes+n, 0))
- vesaReportMode (modes+n);
- }
- xfree (modes);
- }
- Vm86Cleanup (vi);
- }
-}
-
-void
-vesaTestMode (void)
-{
- Vm86InfoPtr vi;
- VesaModePtr modes;
- VesaModePtr mode;
- VbeInfoPtr vbeInfo;
- int nmode;
- int n;
-
- vi = Vm86Setup (vesa_map_holes);
- if (!vi)
- {
- ErrorF ("Can't setup vm86\n");
- return;
- }
- modes = vesaGetModes (vi, &nmode);
- if (!modes)
- {
- ErrorF ("No modes available\n");
- return;
- }
- VbeReportInfo (vi);
- vbeInfo = VbeInit (vi);
- for (n = 0; n < nmode; n++)
- {
- if (modes[n].mode == vesa_video_mode)
- break;
- }
- if (n == nmode)
- {
- ErrorF ("no mode specified\n");
- return;
- }
- mode = &modes[n];
- if (mode->vbe)
- {
- ErrorF ("Enable VBE mode 0x%x\n", mode->mode);
- VbeSetMode(vi, vbeInfo, mode->mode, FALSE, FALSE);
- }
- else
- {
- ErrorF ("Enable BIOS mode 0x%x\n", mode->mode);
- VgaSetMode (vi, mode->mode);
- }
- sleep (2);
- ErrorF ("Restore BIOS mode 0x%x\n", 3);
- VgaSetMode (vi, 3);
- xfree (modes);
- Vm86Cleanup (vi);
-}
-
-Bool
-vesaCardInit(KdCardInfo *card)
-{
- VesaCardPrivPtr priv;
-
- priv = xalloc(sizeof(VesaCardPrivRec));
- if(!priv)
- return FALSE;
-
- if (!vesaInitialize (card, priv))
- {
- xfree(priv);
- return FALSE;
- }
-
- return TRUE;
-}
-
-int
-vesaDepth (VesaModePtr mode)
-{
- if (mode->MemoryModel == MEMORY_DIRECT)
- return (mode->RedMaskSize +
- mode->GreenMaskSize +
- mode->BlueMaskSize);
- else
- return mode->BitsPerPixel;
-}
-
-Bool
-vesaModeGood (KdScreenInfo *screen,
- VesaModePtr a)
-{
- if (vesaWidth(screen,a) <= screen->width &&
- vesaHeight(screen,a) <= screen->height &&
- vesaDepth (a) >= screen->fb[0].depth)
- {
- return TRUE;
- }
- return FALSE;
-}
-
-#define vabs(a) ((a) >= 0 ? (a) : -(a))
-
-int
-vesaSizeError (KdScreenInfo *screen,
- VesaModePtr a)
-{
- int xdist, ydist;
- xdist = vabs (screen->width - vesaWidth(screen,a));
- ydist = vabs (screen->height - vesaHeight(screen,a));
- return xdist * xdist + ydist * ydist;
-}
-
-Bool
-vesaModeBetter (KdScreenInfo *screen,
- VesaModePtr a,
- VesaModePtr b)
-{
- int aerr, berr;
-
- if (vesaModeGood (screen, a))
- {
- if (!vesaModeGood (screen, b))
- return TRUE;
- }
- else
- {
- if (vesaModeGood (screen, b))
- return FALSE;
- }
- aerr = vesaSizeError (screen, a);
- berr = vesaSizeError (screen, b);
- if (aerr < berr)
- return TRUE;
- if (berr < aerr)
- return FALSE;
- if (vabs (screen->fb[0].depth - vesaDepth (a)) <
- vabs (screen->fb[0].depth - vesaDepth (b)))
- return TRUE;
- return FALSE;
-}
-
-VesaModePtr
-vesaSelectMode (KdScreenInfo *screen)
-{
- VesaCardPrivPtr priv = screen->card->driver;
- int i, best;
-
- if (vesa_video_mode)
- {
- for (best = 0; best < priv->nmode; best++)
- if (priv->modes[best].mode == vesa_video_mode &&
- (vesaModeSupported (priv, &priv->modes[best], FALSE) ||
- vesa_force_mode))
- return &priv->modes[best];
- }
- for (best = 0; best < priv->nmode; best++)
- {
- if (vesaModeSupported (priv, &priv->modes[best], FALSE))
- break;
- }
- if (best == priv->nmode)
- return 0;
- for (i = best + 1; i < priv->nmode; i++)
- if (vesaModeSupported (priv, &priv->modes[i], FALSE) &&
- vesaModeBetter (screen, &priv->modes[i],
- &priv->modes[best]))
- best = i;
- return &priv->modes[best];
-}
-
-Bool
-vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr)
-{
- VesaModePtr mode;
-
- screen->driver = pscr;
-
- if (!screen->width || !screen->height)
- {
- screen->width = 640;
- screen->height = 480;
- }
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 4;
-
- if (vesa_verbose)
- ErrorF ("Mode requested %dx%dx%d\n",
- screen->width, screen->height, screen->fb[0].depth);
-
- mode = vesaSelectMode (screen);
-
- if (!mode)
- {
- if (vesa_verbose)
- ErrorF ("No selectable mode\n");
- return FALSE;
- }
- pscr->mode = *mode;
-
- if (vesa_verbose)
- {
- ErrorF ("\t");
- vesaReportMode (&pscr->mode);
- }
-
- pscr->randr = screen->randr;
- pscr->shadow = vesa_shadow;
- pscr->origDepth = screen->fb[0].depth;
- /*
- * Compute visual support for the selected depth
- */
-
- switch (pscr->mode.MemoryModel) {
- case MEMORY_DIRECT:
- /* TrueColor or DirectColor */
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].redMask =
- FbStipMask(pscr->mode.RedFieldPosition, pscr->mode.RedMaskSize);
- screen->fb[0].greenMask =
- FbStipMask(pscr->mode.GreenFieldPosition, pscr->mode.GreenMaskSize);
- screen->fb[0].blueMask =
- FbStipMask(pscr->mode.BlueFieldPosition, pscr->mode.BlueMaskSize);
- break;
- case MEMORY_PSEUDO:
- /* PseudoColor */
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case MEMORY_PLANAR:
- /* 4 plane planar */
- if (pscr->mode.ModeAttributes & MODE_COLOUR)
- screen->fb[0].visuals = (1 << StaticColor);
- else
- screen->fb[0].visuals = (1 << StaticGray);
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- default:
- ErrorF("Unsupported VESA MemoryModel 0x%02X\n",
- pscr->mode.MemoryModel);
- return FALSE;
- }
- screen->rate = 72;
-
- return vesaMapFramebuffer (screen);
-}
-
-Bool
-vesaScreenInit(KdScreenInfo *screen)
-{
- VesaScreenPrivPtr pscr;
-
- pscr = xcalloc (1, sizeof (VesaScreenPrivRec));
- if (!pscr)
- return FALSE;
- if (!vesaScreenInitialize (screen, pscr))
- return FALSE;
- return TRUE;
-}
-
-void *
-vesaSetWindowPlanar(ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size)
-{
- KdScreenPriv(pScreen);
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- static int plane;
- int winSize;
- void *base;
-
- plane = offset & 3;
- VgaSetWritePlaneMask (priv->vi, (1 << plane));
- offset = offset >> 2;
- if (pscr->mode.vbe)
- {
- base = VbeSetWindow (priv->vi,
- priv->vbeInfo,
- pscr->mode.BytesPerScanLine * row + offset,
- mode,
- &winSize);
- }
- else
- {
- base = VgaSetWindow (priv->vi,
- pscr->mode.mode,
- pscr->mode.BytesPerScanLine * row + offset,
- mode,
- &winSize);
- }
- *size = (CARD32) winSize;
- return base;
-}
-
-void *
-vesaSetWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size)
-{
- KdScreenPriv(pScreen);
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
-
- *size = pscr->mode.BytesPerScanLine;
- return (CARD8 *) pscr->fb + row * pscr->mode.BytesPerScanLine + offset;
-}
-
-void *
-vesaSetWindowWindowed (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size)
-{
- KdScreenPriv(pScreen);
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- int winSize;
- void *base;
-
- if (pscr->mode.vbe)
- {
- base = VbeSetWindow (priv->vi,
- priv->vbeInfo,
- pscr->mode.BytesPerScanLine * row + offset,
- mode,
- &winSize);
- }
- else
- {
- base = VgaSetWindow (priv->vi,
- pscr->mode.mode,
- pscr->mode.BytesPerScanLine * row + offset,
- mode,
- &winSize);
- }
- *size = (CARD32) winSize;
- return base;
-}
-
-void *
-vesaWindowPlanar (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
-
- if (!pScreenPriv->enabled)
- return 0;
- return vesaSetWindowPlanar (pScreen, row, offset, mode, size);
-}
-
-void *
-vesaWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
-
- if (!pScreenPriv->enabled)
- return 0;
- return vesaSetWindowLinear (pScreen, row, offset, mode, size);
-}
-
-void *
-vesaWindowWindowed (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
-
- if (!pScreenPriv->enabled)
- return 0;
- return vesaSetWindowWindowed (pScreen, row, offset, mode, size);
-}
-
-#define vesaInvertBits32(v) { \
- v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
- v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
- v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
-}
-
-void *
-vesaWindowCga (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- int line;
-
- if (!pScreenPriv->enabled)
- return 0;
- *size = pscr->mode.BytesPerScanLine;
- line = ((row & 1) << 13) + (row >> 1) * pscr->mode.BytesPerScanLine;
- return (CARD8 *) pscr->fb + line + offset;
-}
-
-void
-vesaUpdateMono (ScreenPtr pScreen,
- shadowBufPtr pBuf)
-{
- RegionPtr damage = shadowDamage(pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = REGION_NUM_RECTS (damage);
- BoxPtr pbox = REGION_RECTS (damage);
- FbBits *shaBase, *shaLine, *sha;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- int shaXoff, shaYoff; /* XXX assumed to be zero */
- int x, y, w, h, width;
- int i;
- FbBits *winBase = 0, *win;
- CARD32 winSize;
- FbBits bits;
-
- fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
- while (nbox--)
- {
- x = pbox->x1 * shaBpp;
- y = pbox->y1;
- w = (pbox->x2 - pbox->x1) * shaBpp;
- h = pbox->y2 - pbox->y1;
-
- scrLine = (x >> FB_SHIFT);
- shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
-
- x &= FB_MASK;
- w = (w + x + FB_MASK) >> FB_SHIFT;
-
- while (h--)
- {
- winSize = 0;
- scrBase = 0;
- width = w;
- scr = scrLine;
- sha = shaLine;
- while (width) {
- /* how much remains in this window */
- i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
- winBase = (FbBits *) (*pBuf->window) (pScreen,
- y,
- scr * sizeof (FbBits),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
- return;
- scrBase = scr;
- winSize /= sizeof (FbBits);
- i = winSize;
- }
- win = winBase + (scr - scrBase);
- if (i > width)
- i = width;
- width -= i;
- scr += i;
- while (i--)
- {
- bits = *sha++;
- vesaInvertBits32(bits);
- *win++ = bits;
- }
- }
- shaLine += shaStride;
- y++;
- }
- pbox++;
- }
-}
-
-static const CARD16 vga16Colors[16][3] = {
- { 0, 0, 0, }, /* 0 */
- { 0, 0, 0xAA,}, /* 1 */
- { 0, 0xAA,0, }, /* 2 */
- { 0, 0xAA,0xAA,}, /* 3 */
- { 0xAA,0, 0, }, /* 4 */
- { 0xAA,0, 0xAA,}, /* 5 */
- { 0xAA,0x55,0, }, /* 6 */
- { 0xAA,0xAA,0xAA,}, /* 7 */
- { 0x55,0x55,0x55,}, /* 8 */
- { 0x55,0x55,0xFF,}, /* 9 */
- { 0x55,0xFF,0x55,}, /* 10 */
- { 0x55,0xFF,0xFF,}, /* 11 */
- { 0xFF,0x55,0x55,}, /* 12 */
- { 0xFF,0x55,0xFF,}, /* 13 */
- { 0xFF,0xFF,0x55,}, /* 14 */
- { 0xFF,0xFF,0xFF,}, /* 15 */
-};
-
-Bool
-vesaCreateColormap16 (ColormapPtr pmap)
-{
- int i, j;
-
- if (pmap->pVisual->ColormapEntries == 16)
- for (i = 0; i < pmap->pVisual->ColormapEntries; i++)
- {
- j = i & 0xf;
- pmap->red[i].co.local.red = (vga16Colors[j][0]<<8)|vga16Colors[j][0];
- pmap->red[i].co.local.green = (vga16Colors[j][1]<<8)|vga16Colors[j][1];
- pmap->red[i].co.local.blue = (vga16Colors[j][2]<<8)|vga16Colors[j][2];
- }
- return TRUE;
-}
-
-void
-vesaSetScreenSizes (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- VesaScreenPrivPtr pscr = screen->driver;
-
- if (pscr->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- pScreen->width = pscr->mode.XResolution;
- pScreen->height = pscr->mode.YResolution;
- pScreen->mmWidth = screen->width_mm;
- pScreen->mmHeight = screen->height_mm;
- }
- else
- {
- pScreen->width = pscr->mode.YResolution;
- pScreen->height = pscr->mode.XResolution;
- pScreen->mmWidth = screen->height_mm;
- pScreen->mmHeight = screen->width_mm;
- }
-}
-
-Bool
-vesaSetShadow (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- ShadowUpdateProc update;
- ShadowWindowProc window = 0;
-
- if (pscr->randr != RR_Rotate_0)
- update = shadowUpdateRotatePacked;
- else
- update = shadowUpdatePacked;
- switch (pscr->mapping) {
- case VESA_LINEAR:
- window = vesaWindowLinear;
- break;
- case VESA_WINDOWED:
- window = vesaWindowWindowed;
- break;
- case VESA_PLANAR:
- pScreen->CreateColormap = vesaCreateColormap16;
- if (pScreenPriv->screen->fb[0].bitsPerPixel == 8)
- update = shadowUpdatePlanar4x8;
- else
- update = shadowUpdatePlanar4;
- window = vesaWindowPlanar;
- break;
- case VESA_MONO:
- update = vesaUpdateMono;
- if (pscr->mode.mode < 8)
- window = vesaWindowCga;
- else
- window = vesaWindowLinear;
- break;
- }
-
- return KdShadowSet (pScreen, pscr->randr, update, window);
-}
-
-Bool
-vesaMapFramebuffer (KdScreenInfo *screen)
-{
- VesaCardPrivPtr priv = screen->card->driver;
- VesaScreenPrivPtr pscr = screen->driver;
- int depth, bpp, fbbpp;
- Pixel allbits;
- KdMouseMatrix m;
-
- if (vesa_linear_fb)
- {
- pscr->mapping = VESA_LINEAR;
- pscr->shadow = FALSE;
- }
- else
- {
- pscr->mapping = VESA_WINDOWED;
- pscr->shadow = TRUE;
- }
-
- depth = vesaDepth (&pscr->mode);
- bpp = pscr->mode.BitsPerPixel;
-
- if (bpp > 24)
- bpp = 32;
- else if (bpp > 16)
- bpp = 24;
- else if (bpp > 8)
- bpp = 16;
- else if (bpp > 4)
- bpp = 8;
- else if (bpp > 1)
- bpp = 4;
- else
- bpp = 1;
- fbbpp = bpp;
-
- switch (pscr->mode.MemoryModel) {
- case MEMORY_DIRECT:
- allbits = (screen->fb[0].redMask |
- screen->fb[0].greenMask |
- screen->fb[0].blueMask);
- depth = 32;
- while (depth && !(allbits & (1 << (depth - 1))))
- depth--;
- if (vesa_verbose)
- ErrorF ("\tTrue Color red 0x%x green 0x%x blue 0x%x\n",
- bpp, depth,
- screen->fb[0].redMask,
- screen->fb[0].greenMask,
- screen->fb[0].blueMask);
- break;
- case MEMORY_PSEUDO:
- if (vesa_verbose)
- ErrorF ("\tPseudo Color bpp %d depth %d\n",
- bpp, depth);
- break;
- case MEMORY_PLANAR:
- if (bpp == 4)
- {
- bpp = screen->fb[0].bitsPerPixel;
- if (bpp != 8)
- bpp = 4;
- depth = bpp;
- }
- if (bpp == 1)
- {
- pscr->mapping = VESA_MONO;
- if (vesa_verbose)
- ErrorF ("\tMonochrome\n");
- }
- else
- {
- pscr->mapping = VESA_PLANAR;
- if (vesa_verbose)
- ErrorF ("\tStatic color bpp %d depth %d\n",
- bpp, depth);
- }
- pscr->randr = RR_Rotate_0;
- pscr->shadow = TRUE;
- break;
- default:
- return FALSE;
- }
-
- switch (fbbpp) {
- case 8:
- case 16:
- case 32:
- break;
- default:
- pscr->randr = RR_Rotate_0;
- break;
- }
-
- if (pscr->randr != RR_Rotate_0)
- pscr->shadow = TRUE;
-
- if (vesa_shadow)
- pscr->shadow = vesa_shadow;
-
- if (pscr->mapping == VESA_LINEAR && !(pscr->mode.ModeAttributes & MODE_LINEAR))
- {
- pscr->mapping = VESA_WINDOWED;
- pscr->shadow = TRUE;
- }
-
- screen->softCursor = TRUE;
-
- switch (pscr->mapping) {
- case VESA_MONO:
- case VESA_LINEAR:
- if (pscr->mode.vbe)
- pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo,
- pscr->mode.mode,
- &pscr->fb_size,
- &pscr->fb_phys);
- else
- pscr->fb = VgaMapFramebuffer (priv->vi,
- pscr->mode.mode,
- &pscr->fb_size,
- &pscr->fb_phys);
- if (!pscr->fb)
- return FALSE;
- break;
- case VESA_WINDOWED:
- pscr->fb = NULL;
- break;
- case VESA_PLANAR:
- pscr->fb = NULL;
- break;
- }
-
- KdComputeMouseMatrix (&m, pscr->randr,
- pscr->mode.XResolution, pscr->mode.YResolution);
-
- KdSetMouseMatrix (&m);
-
- screen->width = pscr->mode.XResolution;
- screen->height = pscr->mode.YResolution;
- screen->memory_base = pscr->fb;
- screen->memory_size = pscr->fb_size;
- screen->fb[0].depth = depth;
- screen->fb[0].bitsPerPixel = bpp;
-
- if (pscr->shadow)
- {
- if (!KdShadowFbAlloc (screen, 0,
- pscr->randr & (RR_Rotate_90|RR_Rotate_270)))
- return FALSE;
- screen->off_screen_base = screen->memory_size;
- }
- else
- {
- screen->fb[0].frameBuffer = (CARD8 *) (pscr->fb);
- screen->fb[0].byteStride = pscr->mode.BytesPerScanLine;
- screen->fb[0].pixelStride = ((pscr->mode.BytesPerScanLine * 8) /
- screen->fb[0].bitsPerPixel);
- screen->off_screen_base = screen->fb[0].byteStride * screen->height;
- }
-
- return TRUE;
-}
-
-void
-vesaUnmapFramebuffer (KdScreenInfo *screen)
-{
- VesaCardPrivPtr priv = screen->card->driver;
- VesaScreenPrivPtr pscr = screen->driver;
-
- KdShadowFbFree (screen, 0);
- if (pscr->fb)
- {
- if (pscr->mode.vbe)
- VbeUnmapFramebuffer(priv->vi, priv->vbeInfo, pscr->mode.mode, pscr->fb);
- else
- VgaUnmapFramebuffer (priv->vi);
- pscr->fb = 0;
- }
-}
-
-#ifdef RANDR
-Bool
-vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
-{
- KdScreenPriv(pScreen);
- VesaModePtr modes, mode;
- KdScreenInfo *screen = pScreenPriv->screen;
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- int nmode;
- int n;
- RRScreenSizePtr pSize;
-
- *rotations = (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270|
- RR_Reflect_X|RR_Reflect_Y);
- /*
- * Get mode information from BIOS -- every time in case
- * something changes, like an external monitor is plugged in
- */
- modes = vesaGetModes (priv->vi, &nmode);
- if (!modes)
- return FALSE;
- if (priv->modes)
- xfree (priv->modes);
- priv->modes = modes;
- priv->nmode = nmode;
- for (n = 0; n < nmode; n++)
- {
- mode = &priv->modes[n];
- if (vesaModeSupported (priv, mode, FALSE))
- {
- /*
- * XXX limit reported modes to those matching the current
- * format
- */
- if (mode->NumberOfPlanes == pscr->mode.NumberOfPlanes &&
- mode->BitsPerPixel == pscr->mode.BitsPerPixel &&
- mode->MemoryModel == pscr->mode.MemoryModel &&
- mode->RedMaskSize == pscr->mode.RedMaskSize &&
- mode->RedFieldPosition == pscr->mode.RedFieldPosition &&
- mode->GreenMaskSize == pscr->mode.GreenMaskSize &&
- mode->GreenFieldPosition == pscr->mode.GreenFieldPosition &&
- mode->BlueMaskSize == pscr->mode.BlueMaskSize &&
- mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
- {
- int width, height, width_mm, height_mm;
- if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- width = mode->XResolution;
- height = mode->YResolution;
- width_mm = screen->width_mm;
- height_mm = screen->height_mm;
- }
- else
- {
- width = mode->YResolution;
- height = mode->XResolution;
- width_mm = screen->height_mm;
- height_mm = screen->width_mm;
- }
- pSize = RRRegisterSize (pScreen,
- width, height,
- width_mm, height_mm);
- if (mode->XResolution == screen->width &&
- mode->YResolution == screen->height)
- {
- int randr = KdSubRotation (pscr->randr, screen->randr);
- RRSetCurrentConfig (pScreen, randr, 0, pSize);
- }
- }
- }
- }
- return TRUE;
-}
-
-Bool
-vesaRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
-{
- KdScreenPriv(pScreen);
- VesaModePtr mode = 0;
- KdScreenInfo *screen = pScreenPriv->screen;
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- int n;
- Bool wasEnabled = pScreenPriv->enabled;
- Bool ret = FALSE;
- VesaScreenPrivRec oldscr;
- int oldwidth;
- int oldheight;
- int oldmmwidth;
- int oldmmheight;
- int newwidth, newheight;
-
- if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- newwidth = pSize->width;
- newheight = pSize->height;
- }
- else
- {
- newwidth = pSize->height;
- newheight = pSize->width;
- }
- for (n = 0; n < priv->nmode; n++)
- {
- mode = &priv->modes[n];
- if (vesaModeSupported (priv, mode, FALSE))
- {
- /*
- * XXX all we have to match is the size
- */
- if (mode->XResolution == newwidth &&
- mode->YResolution == newheight &&
- mode->NumberOfPlanes == pscr->mode.NumberOfPlanes &&
- mode->BitsPerPixel == pscr->mode.BitsPerPixel &&
- mode->RedMaskSize == pscr->mode.RedMaskSize &&
- mode->RedFieldPosition == pscr->mode.RedFieldPosition &&
- mode->GreenMaskSize == pscr->mode.GreenMaskSize &&
- mode->GreenFieldPosition == pscr->mode.GreenFieldPosition &&
- mode->BlueMaskSize == pscr->mode.BlueMaskSize &&
- mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
- break;
- }
- }
- if (n == priv->nmode)
- goto bail0;
-
- if (wasEnabled)
- KdDisableScreen (pScreen);
-
- if (mode->mode != pscr->mode.mode)
- {
- ret = vesaSetMode (pScreen, mode);
- if (!ret)
- goto bail1;
- }
-
- oldscr = *pscr;
-
- oldwidth = screen->width;
- oldheight = screen->height;
- oldmmwidth = pScreen->mmWidth;
- oldmmheight = pScreen->mmHeight;
-
- /*
- * Set new configuration
- */
-
- pscr->mode = *mode;
- pscr->randr = KdAddRotation (screen->randr, randr);
-
- /*
- * Can't rotate some formats
- */
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- case 16:
- case 32:
- break;
- default:
- if (pscr->randr)
- goto bail2;
- break;
- }
-
- KdOffscreenSwapOut (screen->pScreen);
-
- vesaUnmapFramebuffer (screen);
-
- if (!vesaMapFramebuffer (screen))
- goto bail3;
-
- vesaSetScreenSizes (screen->pScreen);
-
- if (!vesaSetShadow (screen->pScreen))
- goto bail4;
-
- /*
- * Set frame buffer mapping
- */
- (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
- pScreen->width,
- pScreen->height,
- screen->fb[0].depth,
- screen->fb[0].bitsPerPixel,
- screen->fb[0].byteStride,
- screen->fb[0].frameBuffer);
-
- /* set the subpixel order */
- KdSetSubpixelOrder (pScreen, pscr->randr);
-
- if (wasEnabled)
- KdEnableScreen (pScreen);
-
- return TRUE;
-
-bail4:
- vesaUnmapFramebuffer (screen);
- *pscr = oldscr;
- (void) vesaMapFramebuffer (screen);
-
-bail3:
- pScreen->width = oldwidth;
- pScreen->height = oldheight;
- pScreen->mmWidth = oldmmwidth;
- pScreen->mmHeight = oldmmheight;
-
-bail2:
- *pscr = oldscr;
-
- (void) vesaSetMode (pScreen, &pscr->mode);
-bail1:
- if (wasEnabled)
- KdEnableScreen (pScreen);
-bail0:
-
- return FALSE;
-}
-
-Bool
-vesaRandRInit (ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen))
- return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = vesaRandRGetInfo;
- pScrPriv->rrSetConfig = vesaRandRSetConfig;
- return TRUE;
-}
-#endif
-
-Bool
-vesaInitScreen(ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-Bool
-vesaFinishInitScreen (ScreenPtr pScreen)
-{
- if (!shadowSetup (pScreen))
- return FALSE;
-
-#ifdef RANDR
- if (!vesaRandRInit (pScreen))
- return FALSE;
-#endif
-
- return TRUE;
-}
-
-Bool
-vesaCreateResources (ScreenPtr pScreen)
-{
- return vesaSetShadow (pScreen);
-}
-
-Bool
-vesaSetMode (ScreenPtr pScreen,
- VesaModePtr mode)
-{
- KdScreenPriv(pScreen);
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- int code;
-
- if (mode->vbe)
- {
- if (vesa_verbose)
- ErrorF ("Enable VBE mode 0x%x\n", mode->mode);
- code = VbeSetMode(priv->vi, priv->vbeInfo, mode->mode,
- pscr->mapping == VESA_LINEAR,
- mode->MemoryModel == MEMORY_DIRECT);
- }
- else
- {
- if (vesa_verbose)
- ErrorF ("Enable BIOS mode 0x%x\n", mode->mode);
- code = VgaSetMode (priv->vi, mode->mode);
- }
-
- if(code < 0)
- return FALSE;
-
- return TRUE;
-}
-
-Bool
-vesaEnable(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- KdScreenInfo *screen = pScreenPriv->screen;
- int i;
- CARD32 size;
- char *p;
-
- if (!vesaSetMode (pScreen, &pscr->mode))
- return FALSE;
-
- switch (pscr->mapping) {
- case VESA_MONO:
- VgaSetWritePlaneMask (priv->vi, 0x1);
- case VESA_LINEAR:
- /*
- * Remap the frame buffer if necessary
- */
- if (!pscr->fb)
- {
- if (pscr->mode.vbe)
- pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo,
- pscr->mode.mode,
- &pscr->fb_size,
- &pscr->fb_phys);
- else
- pscr->fb = VgaMapFramebuffer (priv->vi,
- pscr->mode.mode,
- &pscr->fb_size,
- &pscr->fb_phys);
- if (!pscr->fb)
- return FALSE;
- screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb);
- /*
- * Set frame buffer mapping
- */
- if (!pscr->shadow)
- {
- (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
- pScreen->width,
- pScreen->height,
- screen->fb[0].depth,
- screen->fb[0].bitsPerPixel,
- screen->fb[0].byteStride,
- screen->fb[0].frameBuffer);
- }
- }
- if (vesa_restore_font)
- memcpy (priv->text, pscr->fb, VESA_TEXT_SAVE);
- break;
- case VESA_WINDOWED:
- if (vesa_restore_font)
- {
- for (i = 0; i < VESA_TEXT_SAVE;)
- {
- p = vesaSetWindowWindowed (pScreen, 0, i, VBE_WINDOW_READ, &size);
- if(!p) {
- ErrorF("Couldn't set window for saving VGA font\n");
- break;
- }
- if(i + size > VESA_TEXT_SAVE)
- size = VESA_TEXT_SAVE - i;
- memcpy(((char*)priv->text) + i, p, size);
- i += size;
- }
- }
- break;
- case VESA_PLANAR:
- if (vesa_restore_font)
- {
- for (i = 0; i < 4; i++)
- {
- p = vesaSetWindowPlanar (pScreen, 0, i, VBE_WINDOW_READ, &size);
- memcpy (((char *)priv->text) + i * (VESA_TEXT_SAVE/4), p,
- (VESA_TEXT_SAVE/4));
- }
- }
- break;
- }
- return TRUE;
-}
-
-#ifndef TOSHIBA_SMM
-
-# ifdef linux
-# define TOSHIBA_SMM 1
-# endif
-
-# ifndef TOSHIBA_SMM
-# define TOSHIBA_SMM 0
-# endif
-
-#endif
-
-#if TOSHIBA_SMM
-/*
- * Toshiba laptops use a special interface to operate the backlight
- */
-#include <sys/ioctl.h>
-#define TOSH_PROC "/proc/toshiba"
-#define TOSH_DEVICE "/dev/toshiba"
-#define TOSH_SMM _IOWR('t', 0x90, SMMRegisters)
-
-typedef struct {
- unsigned int eax;
- unsigned int ebx __attribute__ ((packed));
- unsigned int ecx __attribute__ ((packed));
- unsigned int edx __attribute__ ((packed));
- unsigned int esi __attribute__ ((packed));
- unsigned int edi __attribute__ ((packed));
-} SMMRegisters;
-
-#define HCI_BACKLIGHT 0x0002
-#define HCI_DISABLE 0x0000
-#define HCI_ENABLE 0x0001
-#define HCI_GET 0xfe00,
-#define HCI_SET 0xff00
-
-Bool
-toshibaDPMS (ScreenPtr pScreen, int mode)
-{
- SMMRegisters regs;
- static int fd;
-
- if (!fd)
- fd = open (TOSH_DEVICE, 2);
- if (fd < 0)
- return FALSE;
- regs.eax = HCI_SET;
- regs.ebx = HCI_BACKLIGHT;
- regs.ecx = mode ? HCI_DISABLE : HCI_ENABLE;
- if (ioctl (fd, TOSH_SMM, &regs) < 0)
- return FALSE;
- return TRUE;
-}
-#endif /* TOSHIBA_SMM */
-
-Bool
-vesaDPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
-
-#if TOSHIBA_SMM
- if (toshibaDPMS (pScreen, mode))
- return TRUE;
-#endif
- if (pscr->mode.vbe)
- return VbeDPMS (priv->vi, mode);
- return FALSE;
-}
-
-void
-vesaDisable(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- VesaScreenPrivPtr pscr = screen->driver;
- int i=0;
- CARD32 size;
- char *p;
-
- if (vesa_restore_font) {
- switch (pscr->mapping) {
- case VESA_LINEAR:
- case VESA_MONO:
- memcpy(pscr->fb, priv->text, VESA_TEXT_SAVE);
- break;
- case VESA_WINDOWED:
- while(i < VESA_TEXT_SAVE) {
- p = vesaSetWindowWindowed (pScreen, 0, i, VBE_WINDOW_WRITE, &size);
- if(!p) {
- ErrorF("Couldn't set window for restoring VGA font\n");
- break;
- }
- if(i + size > VESA_TEXT_SAVE)
- size = VESA_TEXT_SAVE - i;
- memcpy(p, ((char*)priv->text) + i, size);
- i += size;
- }
- break;
- case VESA_PLANAR:
- for (i = 0; i < 4; i++)
- {
- p = vesaSetWindowPlanar (pScreen, 0, i, VBE_WINDOW_WRITE, &size);
- memcpy (p,
- ((char *)priv->text) + i * (VESA_TEXT_SAVE/4),
- (VESA_TEXT_SAVE/4));
- }
- break;
- }
- }
- vesaUnmapFramebuffer (screen);
-}
-
-void
-vesaPreserve(KdCardInfo *card)
-{
- VesaCardPrivPtr priv = card->driver;
-
- /* The framebuffer might not be valid at this point, so we cannot
- save the VGA fonts now; we do it in vesaEnable. */
-
- if (VbeGetMode (priv->vi, &priv->old_vbe_mode) < 0)
- priv->old_vbe_mode = -1;
-
- if (VgaGetMode (priv->vi, &priv->old_vga_mode) < 0)
- priv->old_vga_mode = -1;
-
- if (vesa_verbose)
- ErrorF ("Previous modes: VBE 0x%x BIOS 0x%x\n",
- priv->old_vbe_mode, priv->old_vga_mode);
-}
-
-void
-vesaRestore(KdCardInfo *card)
-{
- VesaCardPrivPtr priv = card->driver;
- int n;
-
- if (vesa_force_text)
- {
- if (vesa_verbose)
- ErrorF ("Forcing switch back to mode 3 text\n");
- priv->old_vbe_mode = -1;
- priv->old_vga_mode = 3;
- }
- for (n = 0; n < priv->nmode; n++)
- if (priv->modes[n].vbe && priv->modes[n].mode == (priv->old_vbe_mode&0x3fff))
- break;
-
- if (n < priv->nmode)
- {
- if (vesa_verbose)
- ErrorF ("Restore VBE mode 0x%x\n", priv->old_vbe_mode);
- VbeSetMode (priv->vi, priv->vbeInfo, priv->old_vbe_mode, 0, 0);
- }
- else
- {
- if (vesa_verbose)
- ErrorF ("Restore BIOS mode 0x%x\n", priv->old_vga_mode);
- VgaSetMode (priv->vi, priv->old_vga_mode);
- }
-}
-
-void
-vesaCardFini(KdCardInfo *card)
-{
- VesaCardPrivPtr priv = card->driver;
-
- if (priv->vbeInfo)
- VbeCleanup (priv->vi, priv->vbeInfo);
- if (priv->modes)
- xfree (priv->modes);
- Vm86Cleanup(priv->vi);
-}
-
-void
-vesaScreenFini(KdScreenInfo *screen)
-{
- VesaScreenPrivPtr pscr = screen->driver;
-
- KdShadowFbFree (screen, 0);
- vesaUnmapFramebuffer (screen);
- screen->fb[0].depth = pscr->origDepth;
-}
-
-int
-vesaSetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries)
-{
- if (priv->vga_palette)
- return VgaSetPalette (priv->vi, first, number, entries);
- else
- return VbeSetPalette (priv->vi, priv->vbeInfo, first, number, entries);
-}
-
-
-int
-vesaGetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries)
-{
- int code;
-
- if (priv->vga_palette)
- code = VgaGetPalette (priv->vi, first, number, entries);
- else
- {
- code = VbeGetPalette (priv->vi, priv->vbeInfo, first, number, entries);
- if (code < 0)
- {
- priv->vga_palette = 1;
- code = VgaGetPalette (priv->vi, first, number, entries);
- }
- }
- return code;
-}
-
-void
-vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- int p;
- CARD8 *scratch;
- int red, green, blue;
- int min, max;
-
- if (vesa_swap_rgb)
- {
- red = 2;
- green = 1;
- blue = 0;
- }
- else
- {
- red = 0;
- green = 1;
- blue = 2;
- }
-
- min = 256;
- max = 0;
- while (n--)
- {
- p = pdefs->pixel;
- if (p < min)
- min = p;
- if (p > max)
- max = p;
- scratch = priv->cmap + (p * 4);
- scratch[red] = pdefs->red >> 8;
- scratch[green] = pdefs->green >> 8;
- scratch[blue] = pdefs->blue >> 8;
- scratch[3] = 0;
- pdefs++;
- if (pscr->mapping == VESA_PLANAR)
- {
- /*
- * VGA modes are strange; this code covers all
- * possible modes by duplicating the color information
- * however the attribute registers might be set
- */
- if (p < 16)
- {
- vesaSetPalette (priv, p, 1, scratch);
- if (p >= 8)
- vesaSetPalette (priv, p+0x30, 1, scratch);
- else if (p == 6)
- vesaSetPalette (priv, 0x14, 1, scratch);
- }
- }
- }
- if (pscr->mapping != VESA_PLANAR)
- vesaSetPalette (priv, min, max-min+1, priv->cmap + min * 4);
-}
-
-void
-vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
- VesaCardPrivPtr priv = pScreenPriv->card->driver;
- int i;
- int red, green, blue;
- int min, max;
- int p;
- CARD8 *scratch;
-
- if (vesa_swap_rgb)
- {
- red = 2;
- green = 1;
- blue = 0;
- }
- else
- {
- red = 0;
- green = 1;
- blue = 2;
- }
-
- min = 256;
- max = 0;
- for(i = 0; i < n; i++)
- {
- p = pdefs[i].pixel;
- if (p < min)
- min = p;
- if (p > max)
- max = p;
- if (pscr->mapping == VESA_PLANAR)
- vesaGetPalette (priv, p, 1, priv->cmap + p * 4);
- }
- if (pscr->mapping != VESA_PLANAR)
- vesaGetPalette (priv, min, max - min + 1, priv->cmap + min * 4);
- for (i = 0; i < n; i++)
- {
- p = pdefs[i].pixel;
- scratch = priv->cmap + p * 4;
- pdefs[i].red = scratch[red]<<8;
- pdefs[i].green = scratch[green]<<8;
- pdefs[i].blue = scratch[blue]<<8;
- }
-}
-
-int
-vesaProcessArgument (int argc, char **argv, int i)
-{
- if(!strcmp(argv[i], "-mode")) {
- if(i+1 < argc) {
- vesa_video_mode = strtol(argv[i+1], NULL, 0);
- } else
- UseMsg();
- return 2;
- } else if(!strcmp(argv[i], "-force")) {
- vesa_force_mode = TRUE;
- return 1;
- } else if(!strcmp(argv[i], "-listmodes")) {
- vesaListModes();
- exit(0);
- } else if(!strcmp(argv[i], "-vesatest")) {
- vesaTestMode();
- exit (0);
- } else if(!strcmp(argv[i], "-swaprgb")) {
- vesa_swap_rgb = TRUE;
- return 1;
- } else if(!strcmp(argv[i], "-shadow")) {
- vesa_shadow = TRUE;
- return 1;
- } else if(!strcmp(argv[i], "-nolinear")) {
- vesa_linear_fb = FALSE;
- return 1;
- } else if(!strcmp(argv[i], "-verbose")) {
- vesa_verbose = TRUE;
- return 1;
- } else if(!strcmp(argv[i], "-force-text")) {
- vesa_force_text = TRUE;
- return 1;
- } else if(!strcmp(argv[i], "-map-holes")) {
- vesa_map_holes = TRUE;
- return 1;
- } else if(!strcmp(argv[i], "-no-map-holes")) {
- vesa_map_holes = FALSE;
- return 1;
- } else if(!strcmp(argv[i], "-trash-font")) {
- vesa_restore_font = FALSE;
- return 1;
- }
-
- return 0;
-}
diff --git a/hw/kdrive/vesa/vesa.h b/hw/kdrive/vesa/vesa.h
deleted file mode 100644
index 4cad3ac2a..000000000
--- a/hw/kdrive/vesa/vesa.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.13 2002/09/29 23:39:47 keithp Exp $ */
-
-#ifndef _VESA_H_
-#define _VESA_H_
-
-#include "kdrive.h"
-#include "shadow.h"
-#include "vm86.h"
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-#define VESA_TEXT_SAVE (64*1024)
-
-#define MODE_SUPPORTED 0x01
-#define MODE_COLOUR 0x08
-#define MODE_GRAPHICS 0x10
-#define MODE_VGA 0x20
-#define MODE_LINEAR 0x80
-
-#define MODE_DIRECT 0x1
-
-#define MEMORY_TEXT 0
-#define MEMORY_CGA 1
-#define MEMORY_HERCULES 2
-#define MEMORY_PLANAR 3
-#define MEMORY_PSEUDO 4
-#define MEMORY_NONCHAIN 5
-#define MEMORY_DIRECT 6
-#define MEMORY_YUV 7
-
-typedef struct _VesaMode {
- int mode; /* mode number */
- int vbe; /* a VBE mode */
- int ModeAttributes; /* mode attributes */
- int NumberOfPlanes; /* number of memory planes */
- int BitsPerPixel; /* bits per pixel */
- int MemoryModel; /* memory model type */
- int RedMaskSize; /* size of direct color red mask in bits */
- int RedFieldPosition; /* bit position of lsb of red mask */
- int GreenMaskSize; /* size of direct color green mask in bits */
- int GreenFieldPosition; /* bit position of lsb of green mask */
- int BlueMaskSize; /* size of direct color blue mask in bits */
- int BlueFieldPosition; /* bit position of lsb of blue mask */
- int RsvdMaskSize; /* size of direct color reserved mask bits*/
- int RsvdFieldPosition; /* bit position of lsb of reserved mask */
- int DirectColorModeInfo; /* direct color mode attributes */
- int XResolution; /* horizontal resolution */
- int YResolution; /* vertical resolution */
- int BytesPerScanLine; /* bytes per scan line */
-} VesaModeRec, *VesaModePtr;
-
-#include "vbe.h"
-#include "vga.h"
-
-typedef struct _VesaCardPriv {
- int vbe;
- VesaModePtr modes;
- int nmode;
- Vm86InfoPtr vi;
- int vga_palette;
- int old_vbe_mode;
- int old_vga_mode;
- VbeInfoPtr vbeInfo;
- char text[VESA_TEXT_SAVE];
- CARD8 cmap[256*4];
-} VesaCardPrivRec, *VesaCardPrivPtr;
-
-#define VESA_LINEAR 0
-#define VESA_WINDOWED 1
-#define VESA_PLANAR 2
-#define VESA_MONO 3
-
-typedef struct _VesaScreenPriv {
- VesaModeRec mode;
- Bool shadow;
- Rotation randr;
- int mapping;
- int origDepth;
- void *fb;
- int fb_size;
- CARD32 fb_phys;
- PixmapPtr pShadow;
-} VesaScreenPrivRec, *VesaScreenPrivPtr;
-
-extern int vesa_video_mode;
-extern Bool vesa_force_mode;
-
-void
-vesaReportMode (VesaModePtr mode);
-
-VesaModePtr
-vesaGetModes (Vm86InfoPtr vi, int *ret_nmode);
-
-void
-vesaTestMode (void);
-
-void *
-vesaSetWindowPlanar(ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size);
-
-void *
-vesaSetWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size);
-
-void *
-vesaSetWindowWindowed (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size);
-
-void *
-vesaWindowPlanar (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
-
-void *
-vesaWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
-
-void *
-vesaWindowWindowed (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
-
-void *
-vesaWindowCga (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
-
-void
-vesaUpdateMono (ScreenPtr pScreen,
- shadowBufPtr pBuf);
-
-Bool
-vesaCreateColormap16 (ColormapPtr pmap);
-
-void
-vesaSetScreenSizes (ScreenPtr pScreen);
-
-Bool
-vesaSetShadow (ScreenPtr pScreen);
-
-
-void
-vesaListModes(void);
-
-Bool
-vesaInitialize(KdCardInfo *card, VesaCardPrivPtr priv);
-
-Bool
-vesaCardInit(KdCardInfo *card);
-
-int
-vesaDepth (VesaModePtr mode);
-
-Bool
-vesaModeGood (KdScreenInfo *screen,
- VesaModePtr a);
-
-int
-vesaSizeError (KdScreenInfo *screen,
- VesaModePtr a);
-
-Bool
-vesaModeBetter (KdScreenInfo *screen,
- VesaModePtr a,
- VesaModePtr b);
-
-VesaModePtr
-vesaSelectMode (KdScreenInfo *screen);
-
-Bool
-vesaInitialize (KdCardInfo *card, VesaCardPrivPtr priv);
-
-Bool
-vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr);
-
-Bool
-vesaScreenInit(KdScreenInfo *screen);
-
-PixmapPtr
-vesaGetPixmap (ScreenPtr pScreen);
-
-Bool
-vesaMapFramebuffer (KdScreenInfo *screen);
-
-void
-vesaUnmapFramebuffer (KdScreenInfo *screen);
-
-Bool
-vesaInitScreen(ScreenPtr pScreen);
-
-Bool
-vesaFinishInitScreen(ScreenPtr pScreen);
-
-Bool
-vesaCreateResources (ScreenPtr pScreen);
-
-Bool
-vesaSetMode (ScreenPtr pScreen,
- VesaModePtr mode);
-
-Bool
-vesaEnable(ScreenPtr pScreen);
-
-Bool
-vesaDPMS (ScreenPtr pScreen, int mode);
-
-void
-vesaDisable(ScreenPtr pScreen);
-
-void
-vesaPreserve(KdCardInfo *card);
-
-void
-vesaRestore(KdCardInfo *card);
-
-void
-vesaCardFini(KdCardInfo *card);
-
-void
-vesaScreenFini(KdScreenInfo *screen);
-
-int
-vesaSetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries);
-
-int
-vesaGetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries);
-
-void
-vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-
-void
-vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-
-int
-vesaProcessArgument (int argc, char **argv, int i);
-
-#ifdef RANDR
-Bool
-vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
-
-Bool
-vesaRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize);
-Bool
-vesaRandRInit (ScreenPtr pScreen);
-
-#endif
-
-Bool
-toshibaDPMS (ScreenPtr pScreen, int mode);
-
-#endif /* _VESA_H_ */
diff --git a/hw/kdrive/vesa/vesainit.c b/hw/kdrive/vesa/vesainit.c
deleted file mode 100644
index 45092add0..000000000
--- a/hw/kdrive/vesa/vesainit.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vesainit.c,v 1.7 2001/09/05 07:12:43 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vesa.h"
-
-const KdCardFuncs vesaFuncs = {
- vesaCardInit, /* cardinit */
- vesaScreenInit, /* scrinit */
- vesaInitScreen, /* initScreen */
- vesaFinishInitScreen, /* finishInitScreen */
- vesaCreateResources, /* createRes */
- vesaPreserve, /* preserve */
- vesaEnable, /* enable */
- vesaDPMS, /* dpms */
- vesaDisable, /* disable */
- vesaRestore, /* restore */
- vesaScreenFini, /* scrfini */
- vesaCardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- 0, /* initAccel */
- 0, /* enableAccel */
- 0, /* syncAccel */
- 0, /* disableAccel */
- 0, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-};
-
-void
-InitCard(char *name)
-{
- KdCardAttr attr;
- KdCardInfoAdd((KdCardFuncs *) &vesaFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}
diff --git a/hw/kdrive/vesa/vga.c b/hw/kdrive/vesa/vga.c
deleted file mode 100644
index 500746774..000000000
--- a/hw/kdrive/vesa/vga.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vga.c,v 1.1 2000/10/20 00:19:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vesa.h"
-
-static const VesaModeRec vgaModes[] = {
- {
- 6, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_LINEAR,
- 1, 1, MEMORY_PLANAR,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 640, 200, 80,
- },
- {
- 0xd, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
- 4, 4, MEMORY_PLANAR,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 320, 200, 40,
- },
- {
- 0xe, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
- 4, 4, MEMORY_PLANAR,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 640, 200, 80,
- },
- {
- 0x10, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
- 4, 4, MEMORY_PLANAR,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 640, 350, 80,
- },
- {
- 0x11, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_LINEAR,
- 1, 1, MEMORY_PLANAR,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 640, 480, 80,
- },
- {
- 0x12, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
- 4, 4, MEMORY_PLANAR,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 640, 480, 80,
- },
- {
- 0x13, 0,
- MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR | MODE_LINEAR,
- 8, 8, MEMORY_PSEUDO,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 320, 200, 320,
- },
-};
-
-#define NUM_VGA_MODE (sizeof vgaModes / sizeof vgaModes[0])
-
-int
-VgaGetNmode (Vm86InfoPtr vi)
-{
- return NUM_VGA_MODE;
-}
-
-int
-VgaGetModes (Vm86InfoPtr vi, VesaModePtr mode, int nmode)
-{
- if (nmode > NUM_VGA_MODE)
- nmode = NUM_VGA_MODE;
- memcpy (mode, vgaModes, nmode * sizeof (VesaModeRec));
- return nmode;
-}
-
-int
-VgaSetMode(Vm86InfoPtr vi, int mode)
-{
- int code;
-
- vi->vms.regs.eax = mode & 0x7f;
- code = Vm86DoInterrupt (vi, 0x10);
- if(code < 0)
- return -1;
- return 0;
-}
-
-int
-VgaGetMode (Vm86InfoPtr vi, int *mode)
-{
- *mode = Vm86Memory (vi, 0x449);
- return 0;
-}
-
-void
-VgaSetWritePlaneMask(Vm86InfoPtr vi, int mask)
-{
- asm volatile ("outb %b0,%w1" : : "a" (2), "d" (0x3c4));
- asm volatile ("outb %b0,%w1" : : "a" (mask), "d" (0x3c5));
-}
-
-void
-VgaSetReadPlaneMap(Vm86InfoPtr vi, int map)
-{
- asm volatile ("outb %b0,%w1" : : "a" (4), "d" (0x3ce));
- asm volatile ("outb %b0,%w1" : : "a" (map), "d" (0x3cf));
-}
-
-int
-VgaSetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries)
-{
- U8 *palette_scratch;
- int mark;
- int palette_base;
- int i, j, code;
-
- if(number == 0)
- return 0;
-
- if(first < 0 || number < 0 || first + number > 256) {
- ErrorF("Cannot set %d, %d palette entries\n", first, number);
- return -1;
- }
-
- mark = Vm86MarkMemory (vi);
- palette_base = Vm86AllocateMemory (vi, 3 * 256);
-
- palette_scratch = &LM(vi, palette_base);
-
- vi->vms.regs.eax = 0x1012;
- vi->vms.regs.ebx = first;
- vi->vms.regs.ecx = number;
- vi->vms.regs.es = POINTER_SEGMENT(palette_base);
- vi->vms.regs.edx = POINTER_OFFSET(palette_base);
- j = 0;
- i = 0;
- while (number--)
- {
- palette_scratch[j++] = entries[i++] >> 2;
- palette_scratch[j++] = entries[i++] >> 2;
- palette_scratch[j++] = entries[i++] >> 2;
- i++;
- }
- code = Vm86DoInterrupt(vi, 0x10);
- Vm86ReleaseMemory (vi, mark);
-
- if(code < 0)
- return -1;
- return 0;
-}
-
-int
-VgaGetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries)
-{
- U8 *palette_scratch;
- int mark;
- int palette_base;
- int i, j, code;
-
- if(number == 0)
- return 0;
-
- if(first < 0 || number < 0 || first + number > 256) {
- ErrorF("Cannot get %d, %d palette entries\n", first, number);
- return -1;
- }
-
- mark = Vm86MarkMemory (vi);
- palette_base = Vm86AllocateMemory (vi, 3 * 256);
-
- palette_scratch = &LM(vi, palette_base);
-
- vi->vms.regs.eax = 0x1017;
- vi->vms.regs.ebx = first;
- vi->vms.regs.ecx = number;
- vi->vms.regs.es = POINTER_SEGMENT(palette_base);
- vi->vms.regs.edx = POINTER_OFFSET(palette_base);
-
- code = VbeDoInterrupt10(vi);
- if(code < 0)
- return -1;
-
- j = 0;
- i = 0;
- while (number--)
- {
- entries[i++] = palette_scratch[j++] << 2;
- entries[i++] = palette_scratch[j++] << 2;
- entries[i++] = palette_scratch[j++] << 2;
- entries[i++] = 0;
- }
-
- Vm86ReleaseMemory (vi, mark);
-
- return 0;
-}
-
-#define VGA_FB(vm) ((vm) < 8 ? 0xb8000 : 0xa0000)
-
-void *
-VgaSetWindow (Vm86InfoPtr vi, int vmode, int bytes, int mode, int *size)
-{
- *size = 0x10000 - bytes;
- return &LM(vi,VGA_FB(vmode) + bytes);
-}
-
-void *
-VgaMapFramebuffer (Vm86InfoPtr vi, int vmode, int *size, CARD32 *ret_phys)
-{
- if (VGA_FB(vmode) == 0xa0000)
- *size = 0x10000;
- else
- *size = 0x4000;
- *ret_phys = VGA_FB(vmode);
- return &LM(vi,VGA_FB(vmode));
-}
-
-void
-VgaUnmapFramebuffer (Vm86InfoPtr vi)
-{
-}
diff --git a/hw/kdrive/vesa/vga.h b/hw/kdrive/vesa/vga.h
deleted file mode 100644
index ca000904b..000000000
--- a/hw/kdrive/vesa/vga.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vga.h,v 1.1 2000/10/20 00:19:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 _VGA_H_
-#define _VGA_H_
-
-int
-VgaGetNmode (Vm86InfoPtr vi);
-
-int
-VgaGetModes (Vm86InfoPtr vi, VesaModePtr mode, int nmode);
-
-int
-VgaSetMode(Vm86InfoPtr vi, int mode);
-
-int
-VgaGetMode (Vm86InfoPtr vi, int *mode);
-
-void
-VgaSetWritePlaneMask(Vm86InfoPtr vi, int mask);
-
-void
-VgaSetReadPlaneMap(Vm86InfoPtr vi, int map);
-
-int
-VgaSetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries);
-
-int
-VgaGetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries);
-
-void *
-VgaSetWindow (Vm86InfoPtr vi, int vmode, int bytes, int mode, int *size);
-
-void *
-VgaMapFramebuffer (Vm86InfoPtr vi, int vmode, int *size, CARD32 *phys);
-
-void
-VgaUnmapFramebuffer (Vm86InfoPtr vi);
-
-#endif /* _VGA_H_ */
diff --git a/hw/kdrive/vesa/vm86.c b/hw/kdrive/vesa/vm86.c
deleted file mode 100644
index 85200fdad..000000000
--- a/hw/kdrive/vesa/vm86.c
+++ /dev/null
@@ -1,730 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/vesa/vm86.c,v 1.2 2002/02/19 00:18:05 keithp Exp $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vm86.h"
-
-#define PUSHW(vi, i) \
-{ vi->vms.regs.esp -= 2;\
- LMW(vi,MAKE_POINTER(vi->vms.regs.ss, vi->vms.regs.esp)) = i;}
-
-static int vm86old(struct vm86_struct *vms);
-static int vm86_loop(Vm86InfoPtr vi);
-
-static const U8 rev_ints[32] =
-{ 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0x80,
-};
-
-static const U8 retcode_data[2] =
-{ 0xCD, 0xFF };
-
-Vm86InfoPtr
-Vm86Setup(int mapHoles)
-{
- int devmem = -1, devzero = -1;
- void *magicMem, *loMem, *hiMem;
- void *hole1, *hole2;
- U32 stack_base, ret_code;
- Vm86InfoPtr vi = NULL;
-
- devmem = open("/dev/mem", O_RDWR);
- if(devmem < 0) {
- perror("open /dev/mem");
- goto fail;
- }
-
- devzero = open("/dev/zero", O_RDWR);
- if(devmem < 0) {
- perror("open /dev/zero");
- goto fail;
- }
-
- magicMem = MAP_FAILED;
- loMem = MAP_FAILED;
- hiMem = MAP_FAILED;
- hole1 = MAP_FAILED;
- hole2 = MAP_FAILED;
-
-
- magicMem = mmap((void*)MAGICMEM_BASE, MAGICMEM_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_FIXED, devmem, MAGICMEM_BASE);
-
- if(magicMem == MAP_FAILED) {
- ErrorF("Couldn't map magic memory\n");
- goto unmapfail;
- }
-
- if(mapHoles) {
- hole1 = mmap((void*)HOLE1_BASE, HOLE1_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_FIXED, devzero, HOLE1_BASE);
-
- if(hole1 == MAP_FAILED) {
- ErrorF("Couldn't map first hole\n");
- goto unmapfail;
- }
- }
-
- loMem = mmap((void*)LOMEM_BASE, LOMEM_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_FIXED, devzero, LOMEM_BASE);
- if(loMem == MAP_FAILED) {
- ErrorF("Couldn't map low memory\n");
- munmap(magicMem, MAGICMEM_SIZE);
- goto unmapfail;
- }
-
- if(mapHoles) {
- hole2 = mmap((void*)HOLE2_BASE, HOLE2_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_FIXED, devzero, HOLE2_BASE);
-
- if(hole2 == MAP_FAILED) {
- ErrorF("Couldn't map first hole\n");
- goto unmapfail;
- }
- }
-
- hiMem = mmap((void*)HIMEM_BASE, HIMEM_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED,
- devmem, HIMEM_BASE);
- if(hiMem == MAP_FAILED) {
- ErrorF("Couldn't map high memory\n");
- goto unmapfail;
- }
-
- vi = xalloc(sizeof(Vm86InfoRec));
- if (!vi)
- goto unmapfail;
-
- vi->magicMem = magicMem;
- vi->hole1 = hole1;
- vi->loMem = loMem;
- vi->hole2 = hole2;
- vi->hiMem = hiMem;
- vi->brk = LOMEM_BASE;
-
- stack_base = Vm86AllocateMemory(vi, STACK_SIZE);
- if(stack_base == ALLOC_FAIL)
- goto unmapfail;
- ret_code = Vm86AllocateMemory(vi, sizeof(retcode_data));
- if(ret_code == ALLOC_FAIL)
- goto unmapfail;
-
- vi->stack_base = stack_base;
- vi->ret_code = ret_code;
-
- memset(&vi->vms, 0, sizeof(struct vm86_struct));
- vi->vms.flags = 0;
- vi->vms.screen_bitmap = 0;
- vi->vms.cpu_type = CPU_586;
- memcpy(&vi->vms.int_revectored, rev_ints, sizeof(rev_ints));
-
- iopl(3);
-
- if(devmem >= 0)
- close(devmem);
- if(devzero >= 0)
- close(devzero);
-
- return vi;
-
-unmapfail:
- if(magicMem != MAP_FAILED) munmap(magicMem, MAGICMEM_SIZE);
- if(hole1 != MAP_FAILED) munmap(magicMem, HOLE1_SIZE);
- if(loMem != MAP_FAILED) munmap(loMem, LOMEM_SIZE);
- if(hole2 != MAP_FAILED) munmap(magicMem, HOLE2_SIZE);
- if(hiMem != MAP_FAILED) munmap(hiMem, HIMEM_SIZE);
-fail:
- if(devmem >= 0)
- close(devmem);
- if(devzero >= 0)
- close(devzero);
- if(vi)
- xfree(vi);
- return NULL;
-}
-
-void
-Vm86Cleanup(Vm86InfoPtr vi)
-{
- if(vi->magicMem != MAP_FAILED) munmap(vi->magicMem, MAGICMEM_SIZE);
- if(vi->hole1 != MAP_FAILED) munmap(vi->magicMem, HOLE1_SIZE);
- if(vi->loMem != MAP_FAILED) munmap(vi->loMem, LOMEM_SIZE);
- if(vi->hole2 != MAP_FAILED) munmap(vi->magicMem, HOLE2_SIZE);
- if(vi->hiMem != MAP_FAILED) munmap(vi->hiMem, HIMEM_SIZE);
- xfree(vi);
-}
-
-int
-Vm86DoInterrupt(Vm86InfoPtr vi, int num)
-{
- U16 seg, off;
- int code;
-
- if(num < 0 || num>256) {
- ErrorF("Interrupt %d doesn't exist\n");
- return -1;
- }
- seg = MMW(vi,num * 4 + 2);
- off = MMW(vi,num * 4);
- if(MAKE_POINTER(seg, off) < ROM_BASE ||
- MAKE_POINTER(seg, off) >= ROM_BASE + ROM_SIZE) {
- ErrorF("Interrupt pointer doesn't point at ROM\n");
- return -1;
- }
- memcpy(&(LM(vi,vi->ret_code)), retcode_data, sizeof(retcode_data));
- vi->vms.regs.eflags = IF_MASK | IOPL_MASK;
- vi->vms.regs.ss = POINTER_SEGMENT(vi->stack_base);
- vi->vms.regs.esp = STACK_SIZE;
- PUSHW(vi, IF_MASK | IOPL_MASK);
- PUSHW(vi, POINTER_SEGMENT(vi->ret_code));
- PUSHW(vi, POINTER_OFFSET(vi->ret_code));
- vi->vms.regs.cs = seg;
- vi->vms.regs.eip = off;
- OsBlockSignals ();
- code = vm86_loop(vi);
- OsReleaseSignals ();
- if(code < 0) {
- ErrorF("vm86 failed (errno %d)\n", errno);
- return -1;
- } else if(code != 0) {
- ErrorF("vm86 returned 0x%04X\n", code);
- return -1;
- } else
- return 0;
-}
-
-#define DEBUG_VBE 0
-#if DEBUG_VBE
-#define DBG(x) ErrorF x; usleep(10*1000)
-#else
-#define DBG(x)
-#endif
-
-static inline U8
-vm86_inb(U16 port)
-{
- U8 value;
-
- if (port != 0x3da)
- {
- DBG(("inb 0x%04x", port));
- }
- asm volatile ("inb %w1,%b0" : "=a" (value) : "d" (port));
- if (port != 0x3da)
- {
- DBG((" = 0x%02x\n", value));
- }
- return value;
-}
-
-static inline U16
-vm86_inw(U16 port)
-{
- U16 value;
- DBG(("inw 0x%04x", port));
- asm volatile ("inw %w1,%w0" : "=a" (value) : "d" (port));
- DBG((" = 0x%04x\n", value));
- return value;
-}
-
-static inline U32
-vm86_inl(U16 port)
-{
- U32 value;
- DBG(("inl 0x%04x", port));
- asm volatile ("inl %w1,%0" : "=a" (value) : "d" (port));
- DBG((" = 0x%08x\n", value));
- return value;
-}
-
-static inline void
-vm86_outb(U16 port, U8 value)
-{
-#if 0
- static U8 CR;
-
- if (port == 0x3d4)
- CR = value;
- if (port == 0x3d5 && CR == 0xa4)
- {
- DBG(("outb 0x%04x = 0x%02x (skipped)\n", port, value));
- return;
- }
-#endif
- DBG(("outb 0x%04x = 0x%02x\n", port, value));
- asm volatile ("outb %b0,%w1" : : "a" (value), "d" (port));
-}
-
-static inline void
-vm86_outw(U16 port, U16 value)
-{
- DBG(("outw 0x%04x = 0x%04x\n", port, value));
- asm volatile ("outw %w0,%w1" : : "a" (value), "d" (port));
-}
-
-static inline void
-vm86_outl(U16 port, U32 value)
-{
- DBG(("outl 0x%04x = 0x%08x\n", port, value));
- asm volatile ("outl %0,%w1" : : "a" (value), "d" (port));
-}
-
-#define SEG_CS 1
-#define SEG_DS 2
-#define SEG_ES 3
-#define SEG_SS 4
-#define SEG_GS 5
-#define SEG_FS 6
-#define REP 1
-#define REPNZ 2
-#define SET_8(_x, _y) (_x) = ((_x) & ~0xFF) | ((_y) & 0xFF);
-#define SET_16(_x, _y) (_x) = ((_x) & ~0xFFFF) | ((_y) & 0xFFFF);
-#define INC_IP(_i) SET_16(regs->eip, (regs->eip + _i))
-#define AGAIN INC_IP(1); goto again;
-
-static int
-vm86_emulate(Vm86InfoPtr vi)
-{
- struct vm86_regs *regs = &vi->vms.regs;
- U8 opcode;
- int size;
- int pref_seg = 0, pref_rep = 0, pref_66 = 0, pref_67 = 0;
-
- again:
- if(!Vm86IsMemory(vi, MAKE_POINTER(regs->cs, regs->eip))) {
- ErrorF("Trying to execute unmapped memory\n");
- return -1;
- }
- opcode = Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip));
- switch(opcode) {
- case 0x2E: pref_seg = SEG_CS; AGAIN;
- case 0x3E: pref_seg = SEG_DS; AGAIN;
- case 0x26: pref_seg = SEG_ES; AGAIN;
- case 0x36: pref_seg = SEG_SS; AGAIN;
- case 0x65: pref_seg = SEG_GS; AGAIN;
- case 0x64: pref_seg = SEG_FS; AGAIN;
- case 0x66: pref_66 = 1; AGAIN;
- case 0x67: pref_67 = 1; AGAIN;
- case 0xF2: pref_rep = REPNZ; AGAIN;
- case 0xF3: pref_rep = REP; AGAIN;
-
- case 0xEC: /* IN AL, DX */
- SET_8(regs->eax, vm86_inb(regs->edx & 0xFFFF));
- INC_IP(1);
- break;
- case 0xED: /* IN AX, DX */
- if(pref_66)
- regs->eax = vm86_inl(regs->edx & 0xFFFF);
- else
- SET_16(regs->eax, vm86_inw(regs->edx & 0xFFFF));
- INC_IP(1);
- break;
- case 0xE4: /* IN AL, imm8 */
- SET_8(regs->eax,
- vm86_inb(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1))));
- INC_IP(2);
- break;
- case 0xE5: /* IN AX, imm8 */
- if(pref_66)
- regs->eax =
- vm86_inl(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)));
- else
- SET_16(regs->eax,
- vm86_inw(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1))));
- INC_IP(2);
- break;
- case 0x6C: /* INSB */
- case 0x6D: /* INSW */
- if(opcode == 0x6C) {
- Vm86WriteMemory(vi, MAKE_POINTER(regs->es, regs->edi),
- vm86_inb(regs->edx & 0xFFFF));
- size = 1;
- } else if(pref_66) {
- Vm86WriteMemoryL(vi, MAKE_POINTER(regs->es, regs->edi),
- vm86_inl(regs->edx & 0xFFFF));
- size = 4;
- } else {
- Vm86WriteMemoryW(vi, MAKE_POINTER(regs->es, regs->edi),
- vm86_inw(regs->edx & 0xFFFF));
- size = 2;
- }
- if(regs->eflags & (1<<10))
- regs->edi -= size;
- else
- regs->edi += size;
- if(pref_rep) {
- if(pref_66) {
- regs->ecx--;
- if(regs->ecx != 0)
- goto again;
- } else {
- SET_16(regs->ecx, regs->ecx - 1);
- if((regs->ecx & 0xFFFF) != 0)
- goto again;
- }
- }
- INC_IP(1);
- break;
-
- case 0xEE: /* OUT DX, AL */
- vm86_outb(regs->edx & 0xFFFF, regs->eax & 0xFF);
- INC_IP(1);
- break;
- case 0xEF: /* OUT DX, AX */
- if(pref_66)
- vm86_outl(regs->edx & 0xFFFF, regs->eax);
- else
- vm86_outw(regs->edx & 0xFFFF, regs->eax & 0xFFFF);
- INC_IP(1);
- break;
- case 0xE6: /* OUT imm8, AL */
- vm86_outb(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)),
- regs->eax & 0xFF);
- INC_IP(2);
- break;
- case 0xE7: /* OUT imm8, AX */
- if(pref_66)
- vm86_outl(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)),
- regs->eax);
- else
- vm86_outw(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)),
- regs->eax & 0xFFFF);
- INC_IP(2);
- break;
- case 0x6E: /* OUTSB */
- case 0x6F: /* OUTSW */
- if(opcode == 0x6E) {
- vm86_outb(regs->edx & 0xFFFF,
- Vm86Memory(vi, MAKE_POINTER(regs->es, regs->edi)));
- size = 1;
- } else if(pref_66) {
- vm86_outl(regs->edx & 0xFFFF,
- Vm86Memory(vi, MAKE_POINTER(regs->es, regs->edi)));
- size = 4;
- } else {
- vm86_outw(regs->edx & 0xFFFF,
- Vm86Memory(vi, MAKE_POINTER(regs->es, regs->edi)));
- size = 2;
- }
- if(regs->eflags & (1<<10))
- regs->edi -= size;
- else
- regs->edi += size;
- if(pref_rep) {
- if(pref_66) {
- regs->ecx--;
- if(regs->ecx != 0)
- goto again;
- } else {
- SET_16(regs->ecx, regs->ecx - 1);
- if((regs->ecx & 0xFFFF) != 0)
- goto again;
- }
- }
- INC_IP(1);
- break;
-
- case 0x0F:
- ErrorF("Hit 0F trap in VM86 code\n");
- return -1;
- case 0xF0:
- ErrorF("Hit lock prefix in VM86 code\n");
- return -1;
- case 0xF4:
- ErrorF("Hit HLT in VM86 code\n");
- return -1;
-
- default:
- ErrorF("Unhandled GP fault in VM86 code (opcode = 0x%02X)\n",
- opcode);
- return -1;
- }
- return 0;
-}
-#undef SEG_CS
-#undef SEG_DS
-#undef SEG_ES
-#undef SEG_SS
-#undef SEG_GS
-#undef SEG_FS
-#undef REP
-#undef REPNZ
-#undef SET_8
-#undef SET_16
-#undef INC_IP
-#undef AGAIN
-
-static int
-vm86_loop(Vm86InfoPtr vi)
-{
- int code;
-
- while(1) {
- code = vm86old(&vi->vms);
- switch(VM86_TYPE(code)) {
- case VM86_SIGNAL:
- continue;
- case VM86_UNKNOWN:
- code = vm86_emulate(vi);
- if(code < 0) {
- Vm86Debug(vi);
- return -1;
- }
- break;
- case VM86_INTx:
- if(VM86_ARG(code) == 0xFF)
- return 0;
- else {
- PUSHW(vi, vi->vms.regs.eflags)
- PUSHW(vi, vi->vms.regs.cs);
- PUSHW(vi, vi->vms.regs.eip);
- vi->vms.regs.cs = MMW(vi,VM86_ARG(code) * 4 + 2);
- vi->vms.regs.eip = MMW(vi,VM86_ARG(code) * 4);
- }
- break;
- case VM86_STI:
- ErrorF("VM86 code enabled interrupts\n");
- Vm86Debug(vi);
- return -1;
- default:
- ErrorF("Unexpected result code 0x%X from vm86\n", code);
- Vm86Debug(vi);
- return -1;
- }
- }
-}
-
-int
-Vm86IsMemory(Vm86InfoPtr vi, U32 i)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- return 1;
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- return 1;
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- return 1;
- else
- return 0;
-}
-
-U8
-Vm86Memory(Vm86InfoPtr vi, U32 i)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- return MM(vi, i);
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- return LM(vi, i);
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- return HM(vi, i);
- else {
- ErrorF("Reading unmapped memory at 0x%08X\n", i);
- return 0;
- }
-}
-
-U16
-Vm86MemoryW(Vm86InfoPtr vi, U32 i)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- return MMW(vi, i);
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- return LMW(vi, i);
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- return HMW(vi, i);
- else {
- ErrorF("Reading unmapped memory at 0x%08X\n", i);
- return 0;
- }
-}
-
-U32
-Vm86MemoryL(Vm86InfoPtr vi, U32 i)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- return MML(vi, i);
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- return LML(vi, i);
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- return HML(vi, i);
- else {
- ErrorF("Reading unmapped memory at 0x%08X\n", i);
- return 0;
- }
-}
-
-void
-Vm86WriteMemory(Vm86InfoPtr vi, U32 i, U8 val)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- MM(vi, i) = val;
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- LM(vi, i) = val;
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- HM(vi, i) = val;
- else {
- ErrorF("Writing unmapped memory at 0x%08X\n", i);
- }
-}
-
-void
-Vm86WriteMemoryW(Vm86InfoPtr vi, U32 i, U16 val)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- MMW(vi, i) = val;
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- LMW(vi, i) = val;
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- HMW(vi, i) = val;
- else {
- ErrorF("Writing unmapped memory at 0x%08X\n", i);
- }
-}
-
-void
-Vm86WriteMemoryL(Vm86InfoPtr vi, U32 i, U32 val)
-{
- if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
- MML(vi, i) = val;
- else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
- LML(vi, i) = val;
- else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
- HML(vi, i) = val;
- else {
- ErrorF("Writing unmapped memory at 0x%08X\n", i);
- }
-}
-
-int
-Vm86AllocateMemory(Vm86InfoPtr vi, int n)
-{
- int ret;
- if(n<0) {
- ErrorF("Asked to allocate negative amount of memory\n");
- return vi->brk;
- }
-
- n = (n + 15) & ~15;
- if(vi->brk + n > LOMEM_BASE + LOMEM_SIZE) {
- ErrorF("Out of low memory\n");
- exit(2);
- }
- ret = vi->brk;
- vi->brk += n;
- return ret;
-}
-
-int
-Vm86MarkMemory (Vm86InfoPtr vi)
-{
- return vi->brk;
-}
-
-void
-Vm86ReleaseMemory (Vm86InfoPtr vi, int mark)
-{
- vi->brk = mark;
-}
-
-static int
-vm86old(struct vm86_struct *vm)
-{
- int res;
-
- asm volatile (
- "pushl %%ebx\n\t"
- "movl %2, %%ebx\n\t"
- "movl %1,%%eax\n\t"
- "int $0x80\n\t"
- "popl %%ebx"
- : "=a" (res) : "n" (113), "r" (vm));
- if(res < 0) {
- errno = -res;
- res = -1;
- } else
- errno = 0;
- return res;
-}
-
-void
-Vm86Debug(Vm86InfoPtr vi)
-{
- struct vm86_regs *regs = &vi->vms.regs;
- int i;
-
- ErrorF("eax=0x%08lX ebx=0x%08lX ecx=0x%08lX edx=0x%08lX\n",
- regs->eax, regs->ebx, regs->ecx, regs->edx);
- ErrorF("esi=0x%08lX edi=0x%08lX ebp=0x%08lX\n",
- regs->esi, regs->edi, regs->ebp);
- ErrorF("eip=0x%08lX esp=0x%08lX eflags=0x%08lX\n",
- regs->eip, regs->esp, regs->eflags);
- ErrorF("cs=0x%04lX ds=0x%04lX es=0x%04lX fs=0x%04lX gs=0x%04lX\n",
- regs->cs, regs->ds, regs->es, regs->fs, regs->gs);
- for(i=-7; i<8; i++) {
- ErrorF(" %s%02X",
- i==0?"->":"",
- Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip + i)));
- }
- ErrorF("\n");
-}
-
-#ifdef NOT_IN_X_SERVER
-static void
-ErrorF(char *f, ...)
-{
- va_list args;
- va_start(args, f);
- vfprintf(stderr, f, args);
- va_end(args);
-}
-#endif
diff --git a/hw/kdrive/vesa/vm86.h b/hw/kdrive/vesa/vm86.h
deleted file mode 100644
index dce777b39..000000000
--- a/hw/kdrive/vesa/vm86.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 2000 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/*
-Copyright (c) 2000 by Juliusz Chroboczek
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef _VM86_H_
-#define _VM86_H_
-
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/vm86.h>
-#include <sys/io.h>
-
-#ifdef NOT_IN_X_SERVER
-#include <stdio.h>
-#include <stdarg.h>
-#include <malloc.h>
-static void ErrorF(char*, ...);
-#define xalloc(a) malloc(a)
-#define xcalloc(a,b) calloc(a,b)
-#define xfree(a) free(a)
-#else
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "os.h"
-#endif
-
-typedef unsigned char U8;
-typedef unsigned short U16;
-typedef unsigned int U32;
-
-/* The whole addressable memory */
-#define SYSMEM_BASE 0x00000
-#define SYSMEM_SIZE 0x100000
-
-/* Interrupt vectors and BIOS data area */
-/* This is allocated privately from /dev/mem */
-#define MAGICMEM_BASE 0x00000
-#define MAGICMEM_SIZE 0x01000
-
-/* The low memory, allocated privately from /dev/zero */
-/* 64KB should be enough for anyone, as they used to say */
-#define LOMEM_BASE 0x10000
-#define LOMEM_SIZE 0x10000
-
-/* The video memory and BIOS ROM, allocated shared from /dev/mem */
-#define HIMEM_BASE 0xA0000
-#define HIMEM_SIZE (SYSMEM_BASE + SYSMEM_SIZE - HIMEM_BASE)
-
-#define HOLE1_BASE (MAGICMEM_BASE + MAGICMEM_SIZE)
-#define HOLE1_SIZE (LOMEM_BASE - HOLE1_BASE)
-
-#define HOLE2_BASE (LOMEM_BASE + LOMEM_SIZE)
-#define HOLE2_SIZE (HIMEM_BASE - HOLE2_BASE)
-
-/* The BIOS ROM */
-#define ROM_BASE 0xC0000
-#define ROM_SIZE 0x30000
-
-#define STACK_SIZE 0x1000
-
-#define POINTER_SEGMENT(ptr) (((unsigned int)ptr)>>4)
-#define POINTER_OFFSET(ptr) (((unsigned int)ptr)&0x000F)
-#define MAKE_POINTER(seg, off) (((((unsigned int)(seg))<<4) + (unsigned int)(off)))
-#define MAKE_POINTER_1(lw) MAKE_POINTER(((lw)&0xFFFF0000)/0x10000, (lw)&0xFFFF)
-#define ALLOC_FAIL ((U32)-1)
-
-typedef struct _Vm86InfoRec {
- void *magicMem, *loMem, *hiMem;
- void *hole1, *hole2;
- U32 brk;
- struct vm86_struct vms;
- U32 ret_code, stack_base;
-} Vm86InfoRec, *Vm86InfoPtr;
-
-#define LM(vi,i) (((char*)vi->loMem)[i-LOMEM_BASE])
-#define LMW(vi,i) (*(U16*)(&LM(vi,i)))
-#define LML(vi,i) (*(U32*)(&LM(vi,i)))
-#define MM(vi,i) (((char*)vi->magicMem)[i-MAGICMEM_BASE])
-#define MMW(vi,i) (*(U16*)(&MM(vi,i)))
-#define MML(vi,i) (*(U32*)(&MM(vi,i)))
-#define HM(vi,i) (((char*)vi->hiMem)[i-HIMEM_BASE])
-#define HMW(vi,i) (*(U16*)(&MM(vi,i)))
-#define HML(vi,i) (*(U32*)(&MM(vi,i)))
-
-Vm86InfoPtr
-Vm86Setup(int);
-
-void
-Vm86Cleanup(Vm86InfoPtr vi);
-
-int
-Vm86DoInterrupt(Vm86InfoPtr vi, int num);
-
-int
-Vm86IsMemory(Vm86InfoPtr vi, U32 i);
-
-U8
-Vm86Memory(Vm86InfoPtr, U32);
-
-U16
-Vm86MemoryW(Vm86InfoPtr, U32);
-
-U32
-Vm86MemoryL(Vm86InfoPtr, U32);
-
-void
-Vm86WriteMemory(Vm86InfoPtr, U32, U8);
-
-void
-Vm86WriteMemoryW(Vm86InfoPtr, U32, U16);
-
-void
-Vm86WriteMemoryL(Vm86InfoPtr, U32, U32);
-
-int
-Vm86AllocateMemory(Vm86InfoPtr, int);
-
-int
-Vm86MarkMemory (Vm86InfoPtr vi);
-
-void
-Vm86ReleaseMemory (Vm86InfoPtr vi, int mark);
-
-void
-Vm86Debug(Vm86InfoPtr vi);
-
-#endif /* _VM86_H_ */
diff --git a/hw/kdrive/vxworks/Imakefile b/hw/kdrive/vxworks/Imakefile
deleted file mode 100644
index fea4f3416..000000000
--- a/hw/kdrive/vxworks/Imakefile
+++ /dev/null
@@ -1,15 +0,0 @@
-XCOMM $RCSId: $
-#include <Server.tmpl>
-
-SRCS = vxworks.c vxkbd.c vxkmouse.c
-
-OBJS = vxworks.o vxkbd.o vxkmouse.o
-
-INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
- -I../../../fb -I../../../mi -I../../../include -I../../../os \
- -I$(EXTINCSRC) -I$(XINCLUDESRC)
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(vxworks,$(OBJS))
-
-DependTarget()
diff --git a/hw/kdrive/vxworks/vxkbd.c b/hw/kdrive/vxworks/vxkbd.c
deleted file mode 100644
index 4bcca02b1..000000000
--- a/hw/kdrive/vxworks/vxkbd.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Id: vxkbd.c,v 1.1 1999/11/24 08:35:24 keithp Exp $
- *
- * Copyright © 1999 Network Computing Devices, Inc. All rights reserved.
- *
- * Author: Keith Packard
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kkeymap.h"
-#include <X11/keysym.h>
-#include <inputstr.h>
-
-#define VXWORKS_WIDTH 2
-
-KeySym VxWorksKeymap[] = {
-/*7 f1 */ XK_F1, NoSymbol,
-/*8 escape */ XK_Escape, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
-/*13 tab */ XK_Tab, NoSymbol,
-/*14 ` */ XK_grave, XK_asciitilde,
-/*15 f2 */ XK_F2, NoSymbol,
- NoSymbol, NoSymbol,
-/*17 lctrl */ XK_Control_L, NoSymbol,
-/*18 lshift */ XK_Shift_L, NoSymbol,
- NoSymbol, NoSymbol,
-/*20 lock */ XK_Caps_Lock, NoSymbol,
-/*21 q */ XK_Q, NoSymbol,
-/*22 1 */ XK_1, XK_exclam,
-/*23 f3 */ XK_F3, NoSymbol,
- NoSymbol, NoSymbol,
-/*25 lalt */ XK_Meta_L, XK_Alt_L,
-/*26 z */ XK_Z, NoSymbol,
-/*27 s */ XK_S, NoSymbol,
-/*28 a */ XK_A, NoSymbol,
-/*29 w */ XK_W, NoSymbol,
-/*30 2 */ XK_2, XK_at,
-/*31 f4 */ XK_F4, NoSymbol,
- NoSymbol, NoSymbol,
-/*33 c */ XK_C, NoSymbol,
-/*34 x */ XK_X, NoSymbol,
-/*35 d */ XK_D, NoSymbol,
-/*36 e */ XK_E, NoSymbol,
-/*37 4 */ XK_4, XK_dollar,
-/*38 3 */ XK_3, XK_numbersign,
-/*39 f5 */ XK_F5, NoSymbol,
- NoSymbol, NoSymbol,
-/*41 space */ XK_space, NoSymbol,
-/*42 v */ XK_V, NoSymbol,
-/*43 f */ XK_F, NoSymbol,
-/*44 t */ XK_T, NoSymbol,
-/*45 r */ XK_R, NoSymbol,
-/*46 5 */ XK_5, XK_percent,
-/*47 f6 */ XK_F6, NoSymbol,
- NoSymbol, NoSymbol,
-/*49 n */ XK_N, NoSymbol,
-/*50 b */ XK_B, NoSymbol,
-/*51 h */ XK_H, NoSymbol,
-/*52 g */ XK_G, NoSymbol,
-/*53 y */ XK_Y, NoSymbol,
-/*54 6 */ XK_6, XK_asciicircum,
-/*55 f7 */ XK_F7, NoSymbol,
- NoSymbol, NoSymbol,
-/*57 ralt */ XK_Meta_R, XK_Alt_R,
-/*58 m */ XK_M, NoSymbol,
-/*59 j */ XK_J, NoSymbol,
-/*60 u */ XK_U, NoSymbol,
-/*61 7 */ XK_7, XK_ampersand,
-/*62 8 */ XK_8, XK_asterisk,
-/*63 f8 */ XK_F8, NoSymbol,
- NoSymbol, NoSymbol,
-/*65 , */ XK_comma, XK_less,
-/*66 k */ XK_K, NoSymbol,
-/*67 i */ XK_I, NoSymbol,
-/*68 o */ XK_O, NoSymbol,
-/*69 0 */ XK_0, XK_parenright,
-/*70 9 */ XK_9, XK_parenleft,
-/*71 f9 */ XK_F9, NoSymbol,
- NoSymbol, NoSymbol,
-/*73 . */ XK_period, XK_greater,
-/*74 / */ XK_slash, XK_question,
-/*75 l */ XK_L, NoSymbol,
-/*76 ; */ XK_semicolon, XK_colon,
-/*77 p */ XK_P, NoSymbol,
-/*78 - */ XK_minus, XK_underscore,
-/*79 f10 */ XK_F10, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
-/*82 ' */ XK_apostrophe, XK_quotedbl,
- NoSymbol, NoSymbol,
-/*84 [ */ XK_bracketleft, XK_braceleft,
-/*85 = */ XK_equal, XK_plus,
-/*86 f11 */ XK_F11, NoSymbol,
-/*87 sysrq */ XK_Sys_Req, XK_Print,
-/*88 rctrl */ XK_Control_R, NoSymbol,
-/*89 rshift */ XK_Shift_R, NoSymbol,
-/*90 enter */ XK_Return, NoSymbol,
-/*91 ] */ XK_bracketright, XK_braceright,
-/*92 \ */ XK_backslash, XK_bar,
- NoSymbol, NoSymbol,
-/*94 f12 */ XK_F12, NoSymbol,
-/*95 scrolllock*/ XK_Scroll_Lock, NoSymbol,
-/*96 down */ XK_Down, NoSymbol,
-/*97 left */ XK_Left, NoSymbol,
-/*98 pause */ XK_Break, XK_Pause,
-/*99 up */ XK_Up, NoSymbol,
-/*100 delete */ XK_Delete, NoSymbol,
-/*101 end */ XK_End, NoSymbol,
-/*102 bs */ XK_BackSpace, NoSymbol,
-/*103 insert */ XK_Insert, NoSymbol,
- NoSymbol, NoSymbol,
-/*105 np 1 */ XK_KP_End, XK_KP_1,
-/*106 right */ XK_Right, NoSymbol,
-/*107 np 4 */ XK_KP_Left, XK_KP_4,
-/*108 np 7 */ XK_KP_Home, XK_KP_7,
-/*109 pgdn */ XK_Page_Down, NoSymbol,
-/*110 home */ XK_Home, NoSymbol,
-/*111 pgup */ XK_Page_Up, NoSymbol,
-/*112 np 0 */ XK_KP_Insert, XK_KP_0,
-/*113 np . */ XK_KP_Delete, XK_KP_Decimal,
-/*114 np 2 */ XK_KP_Down, XK_KP_2,
-/*115 np 5 */ XK_KP_5, NoSymbol,
-/*116 np 6 */ XK_KP_Right, XK_KP_6,
-/*117 np 8 */ XK_KP_Up, XK_KP_8,
-/*118 numlock */ XK_Num_Lock, NoSymbol,
-/*119 np / */ XK_KP_Divide, NoSymbol,
- NoSymbol, NoSymbol,
-/*121 np enter */ XK_KP_Enter, NoSymbol,
-/*122 np 3 */ XK_KP_Page_Down, XK_KP_3,
- NoSymbol, NoSymbol,
-/*124 np + */ XK_KP_Add, NoSymbol,
-/*125 np 9 */ XK_KP_Page_Up, XK_KP_9,
-/*126 np * */ XK_KP_Multiply, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
-/*132 np - */ XK_KP_Subtract, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
- NoSymbol, NoSymbol,
-/*139 lwin */ XK_Super_L, NoSymbol,
-/*140 rwin */ XK_Super_R, NoSymbol,
-/*141 menu */ XK_Menu, NoSymbol,
-};
-
-void
-VxWorksKeyboardLoad (void)
-{
- KeySym *k;
-
- kdMinScanCode = 7;
- kdKeymapWidth = VXWORKS_WIDTH;
- kdMaxScanCode = 141;
- memcpy (kdKeymap, VxWorksKeymap, sizeof (VxWorksKeymap));
-}
-
-static int kbdFd = -1;
-
-#include <errno.h>
-#include <event.h>
-#include <kbd_ioctl.h>
-
-extern KeybdCtrl defaultKeyboardControl;
-
-static void
-VxWorksSetAutorepeat (unsigned char *repeats, Bool on)
-{
- int i;
- unsigned char mask;
- int scan_code;
- int key_code;
- unsigned char realkc;
-
- if (on)
- {
- realkc = 1;
- ioctl (kbdFd, KBD_ALL_REPEAT, &realkc);
- for (scan_code = 7; scan_code <= 141; scan_code++)
- {
- key_code = scan_code + 1;
- i = key_code >> 3;
- mask = 1 << (key_code & 7);
- if ((repeats[i] & mask) == 0)
- {
- realkc = scan_code;
- ioctl (kbdFd, KBD_NO_REPEAT, &realkc);
- }
- }
- }
- else
- {
- realkc = 0;
- ioctl (kbdFd, KBD_ALL_REPEAT, &realkc);
- }
-}
-
-int
-VxWorksKeyboardInit (void)
-{
-
- kbdFd = open ("/dev/kbd", O_RDONLY, 0);
- if (kbdFd < 0)
- ErrorF ("keyboard open failure %d\n", errno);
- VxWorksSetAutorepeat (defaultKeyboardControl.autoRepeats, TRUE);
- return -1;
-}
-
-void
-VxWorksKeyboardFini (int fd)
-{
- if (kbdFd >= 0)
- {
- close (kbdFd);
- kbdFd = -1;
- }
-}
-
-void
-VxWorksKeyboardRead (int fd)
-{
-}
-
-void
-VxWorksKeyboardLeds (int leds)
-{
- DeviceIntPtr pKeyboard = (DeviceIntPtr) LookupKeyboardDevice ();
- KeybdCtrl *ctrl = &pKeyboard->kbdfeed->ctrl;
- led_ioctl_info led_info;
- int i;
-
- VxWorksSetAutorepeat (ctrl->autoRepeats, ctrl->autoRepeat);
- for (i = 0; i < 3; i++)
- {
- led_info.bit_n = 1 << i;
- led_info.OFF_or_ON = (leds & (1 << i)) != 0;
- led_info.reversed = 0;
- ioctl (kbdFd, KBD_SET_LED, &led_info);
- }
-}
-
-void
-VxWorksKeyboardBell (int volume, int frequency, int duration)
-{
-}
-
-KdKeyboardFuncs VxWorksKeyboardFuncs = {
- VxWorksKeyboardLoad,
- VxWorksKeyboardInit,
- VxWorksKeyboardRead,
- VxWorksKeyboardLeds,
- VxWorksKeyboardBell,
- VxWorksKeyboardFini,
- 3,
-};
diff --git a/hw/kdrive/vxworks/vxmouse.c b/hw/kdrive/vxworks/vxmouse.c
deleted file mode 100644
index 75ed39bd0..000000000
--- a/hw/kdrive/vxworks/vxmouse.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Id: vxmouse.c,v 1.1 1999/11/24 08:35:24 keithp Exp $
- *
- * Copyright © 1999 Network Computing Devices, Inc. All rights reserved.
- *
- * Author: Keith Packard
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-#include "Xpoll.h"
-#include <event.h>
-#include <smem.h>
-
-static unsigned long mouseState;
-
-#define BUTTON1 0x01
-#define BUTTON2 0x02
-#define BUTTON3 0x04
-
-#include <errno.h>
-
-static int mouseFd = -1;
-
-static eventqueue *eventQueue;
-
-void
-VxMouseRead (int mousePort)
-{
- Event ev;
- int dx, dy;
- unsigned long flags;
- unsigned long mask;
- int n;
-
- while (eventQueue->head != eventQueue->tail)
- {
- ev = *eventQueue->head;
- if (eventQueue->head >= &eventQueue->events[eventQueue->size-1])
- eventQueue->head = &eventQueue->events[0];
- else
- eventQueue->head++;
- switch (ev.e_type) {
- case E_BUTTON:
- switch (ev.e_device) {
- case E_MOUSE:
- switch (ev.e_key) {
- case BUTTON1:
- mask = KD_BUTTON_1;
- break;
- case BUTTON2:
- mask = KD_BUTTON_2;
- break;
- case BUTTON3:
- mask = KD_BUTTON_3;
- break;
- default:
- mask = 0;
- break;
- }
- if (ev.e_direction == E_KBUP)
- mouseState &= ~mask;
- else
- mouseState |= mask;
- KdEnqueueMouseEvent (mouseState | KD_MOUSE_DELTA, 0, 0);
- break;
- case E_DKB:
- KdEnqueueKeyboardEvent (ev.e_key, ev.e_direction == E_KBUP);
- break;
- }
- break;
- case E_MMOTION:
- KdEnqueueMouseEvent (mouseState | KD_MOUSE_DELTA,
- ev.e_x, ev.e_y);
- break;
- }
- }
-}
-
-int
-VxMouseInit (void)
-{
- int mousePort;
- unsigned long ev_size;
-
- mouseState = 0;
- mousePort = open ("/dev/xdev", O_RDONLY, 0);
- if (mousePort < 0)
- ErrorF ("event port open failure %d\n", errno);
- mouseFd = open ("/dev/mouse", O_RDONLY, 0);
- if (mouseFd < 0)
- ErrorF ("mouse open failure %d\n", errno);
- if (eventQueue == 0)
- {
- ioctl (mousePort, EVENT_QUEUE_SMSIZE, &ev_size);
- eventQueue = (eventqueue *) smem_get ("event", ev_size, (SM_READ|SM_WRITE));
- }
- return mousePort;
-}
-
-void
-VxMouseFini (int mousePort)
-{
- if (mousePort >= 0)
- close (mousePort);
- if (mouseFd >= 0)
- {
- close (mouseFd);
- mouseFd = -1;
- }
-}
-
-KdMouseFuncs VxWorksMouseFuncs = {
- VxMouseInit,
- VxMouseRead,
- VxMouseFini
-};
diff --git a/hw/kdrive/vxworks/vxworks.c b/hw/kdrive/vxworks/vxworks.c
deleted file mode 100644
index 9bfc9e278..000000000
--- a/hw/kdrive/vxworks/vxworks.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Id: vxworks.c,v 1.1 1999/11/24 08:35:24 keithp Exp $
- *
- * Copyright © 1999 Network Computing Devices, Inc. All rights reserved.
- *
- * Author: Keith Packard
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <X11/keysym.h>
-
-int
-VxWorksInit (void)
-{
- return 1;
-}
-
-void
-VxWorksEnable (void)
-{
-}
-
-Bool
-VxWorksSpecialKey (KeySym sym)
-{
- switch (sym) {
- case XK_Sys_Req:
- download(1, "setup", 0);
- return TRUE;
- case XK_Break:
- download(1, "launcher", 0);
- return TRUE;
- case XK_Delete:
- dispatchException |= DE_REBOOT;
- return TRUE;
- case XK_BackSpace:
- dispatchException |= DE_RESET;
- return TRUE;
- }
- return FALSE;
-}
-
-void
-VxWorksDisable (void)
-{
-}
-
-void
-VxWorksFini (void)
-{
-}
-
-KdOsFuncs VxWorksFuncs = {
- VxWorksInit,
- VxWorksEnable,
- VxWorksSpecialKey,
- VxWorksDisable,
- VxWorksFini,
-};
-
-void
-OsVendorInit (void)
-{
- KdOsInit (&VxWorksFuncs);
-}
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 255c56f8e..71d879fa7 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -26,9 +26,11 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/hw/vfb/InitInput.c,v 3.9 2001/12/14 19:59:45 dawes Exp $ */
#include "X11/X.h"
#define NEED_EVENTS
+#include "mi.h"
#include "X11/Xproto.h"
#include "scrnintstr.h"
#include "inputstr.h"
@@ -261,7 +263,6 @@ vfbKeybdProc(pDevice, onoff)
{
KeySymsRec keySyms;
CARD8 modMap[MAP_LENGTH];
- int i;
DevicePtr pDev = (DevicePtr)pDevice;
switch (onoff)
@@ -320,13 +321,13 @@ InitInput(argc, argv)
int argc;
char *argv[];
{
- DevicePtr p, k;
+ DeviceIntPtr p, k;
p = AddInputDevice(vfbMouseProc, TRUE);
k = AddInputDevice(vfbKeybdProc, TRUE);
RegisterPointerDevice(p);
RegisterKeyboardDevice(k);
miRegisterPointerDevice(screenInfo.screens[0], p);
- (void)mieqInit (k, p);
+ (void)mieqInit ((DevicePtr) k, (DevicePtr) p);
}
#ifdef XTESTEXT1
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index c2334e745..378728c0c 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -26,8 +26,9 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/hw/vfb/InitOutput.c,v 3.22 2003/01/15 02:34:07 torrey Exp $ */
-#ifdef WIN32
+#if defined(WIN32)
#include <X11/Xwinsock.h>
#endif
#include <stdio.h>
@@ -38,7 +39,7 @@ from The Open Group.
#include "scrnintstr.h"
#include "servermd.h"
#define PSZ 8
-#include "cfb.h"
+#include "fb.h"
#include "mibstore.h"
#include "colormapst.h"
#include "gcstruct.h"
@@ -63,6 +64,7 @@ from The Open Group.
#endif /* HAS_SHM */
#include "dix.h"
#include "miline.h"
+#include "mfb.h"
extern char *display;
@@ -104,11 +106,14 @@ typedef struct
static int vfbNumScreens;
static vfbScreenInfo vfbScreens[MAXSCREENS];
static Bool vfbPixmapDepths[33];
+#ifdef HAS_MMAP
static char *pfbdir = NULL;
+#endif
typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType;
static fbMemType fbmemtype = NORMAL_MEMORY_FB;
static char needswap = 0;
static int lastScreen = -1;
+static Bool Render = TRUE;
#define swapcopy16(_dst, _src) \
if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \
@@ -178,6 +183,9 @@ ddxGiveUp()
}
}
break;
+#else /* HAS_MMAP */
+ case MMAPPED_FILE_FB:
+ break;
#endif /* HAS_MMAP */
#ifdef HAS_SHM
@@ -191,6 +199,9 @@ ddxGiveUp()
}
}
break;
+#else /* HAS_SHM */
+ case SHARED_MEMORY_FB:
+ break;
#endif /* HAS_SHM */
case NORMAL_MEMORY_FB:
@@ -208,16 +219,48 @@ AbortDDX()
ddxGiveUp();
}
+#ifdef __DARWIN__
+void
+DarwinHandleGUI(int argc, char *argv[])
+{
+}
+
+void GlxExtensionInit();
+void GlxWrapInitVisuals(void *procPtr);
+
+void
+DarwinGlxExtensionInit()
+{
+ GlxExtensionInit();
+}
+
+void
+DarwinGlxWrapInitVisuals(
+ void *procPtr)
+{
+ GlxWrapInitVisuals(procPtr);
+}
+#endif
+
void
OsVendorInit()
{
}
void
+OsVendorFatalError()
+{
+}
+
+void
ddxUseMsg()
{
ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
ErrorF("-pixdepths list-of-int support given pixmap depths\n");
+#ifdef RENDER
+ ErrorF("+/-render turn on/of RENDER extension support"
+ "(default on)\n");
+#endif
ErrorF("-linebias n adjust thin line pixelization\n");
ErrorF("-blackpixel n pixel value for black\n");
ErrorF("-whitepixel n pixel value for white\n");
@@ -289,6 +332,18 @@ ddxProcessArgument (argc, argv, i)
return ret;
}
+ if (strcmp (argv[i], "+render") == 0) /* +render */
+ {
+ Render = TRUE;
+ return 1;
+ }
+
+ if (strcmp (argv[i], "-render") == 0) /* -render */
+ {
+ Render = FALSE;
+ return 1;
+ }
+
if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */
{
Pixel pix;
@@ -389,9 +444,9 @@ vfbMultiDepthCreateGC(pGC)
switch (vfbBitsPerPixel(pGC->depth))
{
case 1: return mfbCreateGC (pGC);
- case 8: return cfbCreateGC (pGC);
- case 16: return cfb16CreateGC (pGC);
- case 32: return cfb32CreateGC (pGC);
+ case 8:
+ case 16:
+ case 32: return fbCreateGC (pGC);
default: return FALSE;
}
}
@@ -410,13 +465,9 @@ vfbMultiDepthGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
break;
case 8:
- cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
- break;
case 16:
- cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
- break;
case 32:
- cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ fbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
break;
}
return;
@@ -436,13 +487,9 @@ vfbMultiDepthGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
break;
case 8:
- cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
- break;
case 16:
- cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
- break;
case 32:
- cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ fbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
break;
}
}
@@ -546,21 +593,32 @@ vfbStoreColors(pmap, ndef, pdefs)
XWDColor *pXWDCmap;
int i;
- if (pmap != InstalledMaps[pmap->pScreen->myNum]) return;
+ if (pmap != InstalledMaps[pmap->pScreen->myNum])
+ {
+ return;
+ }
pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ {
return;
+ }
for (i = 0; i < ndef; i++)
{
if (pdefs[i].flags & DoRed)
+ {
swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
+ }
if (pdefs[i].flags & DoGreen)
+ {
swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
+ }
if (pdefs[i].flags & DoBlue)
+ {
swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
+ }
}
}
@@ -649,7 +707,7 @@ vfbAllocateMmappedFramebuffer(pvfb)
PROT_READ|PROT_WRITE,
MAP_FILE|MAP_SHARED,
pvfb->mmap_fd, 0);
- if (-1 == (int)pvfb->pXWDHeader)
+ if (-1 == (long)pvfb->pXWDHeader)
{
perror("mmap");
ErrorF("mmap %s failed, errno %d", pvfb->mmap_file, errno);
@@ -684,7 +742,7 @@ vfbAllocateSharedMemoryFramebuffer(pvfb)
/* try to attach it */
pvfb->pXWDHeader = (XWDFileHeader *)shmat(pvfb->shmid, 0, 0);
- if (-1 == (int)pvfb->pXWDHeader)
+ if (-1 == (long)pvfb->pXWDHeader)
{
perror("shmat");
ErrorF("shmat failed, errno %d", errno);
@@ -735,10 +793,14 @@ vfbAllocateFramebufferMemory(pvfb)
{
#ifdef HAS_MMAP
case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break;
+#else
+ case MMAPPED_FILE_FB: break;
#endif
#ifdef HAS_SHM
case SHARED_MEMORY_FB: vfbAllocateSharedMemoryFramebuffer(pvfb); break;
+#else
+ case SHARED_MEMORY_FB: break;
#endif
case NORMAL_MEMORY_FB:
@@ -751,6 +813,7 @@ vfbAllocateFramebufferMemory(pvfb)
pvfb->pXWDCmap = (XWDColor *)((char *)pvfb->pXWDHeader
+ SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN);
pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors);
+
return pvfb->pfbMemory;
}
else
@@ -765,7 +828,6 @@ vfbWriteXWDFileHeader(pScreen)
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
XWDFileHeader *pXWDHeader = pvfb->pXWDHeader;
char hostname[XWD_WINDOW_NAME_LEN];
- VisualPtr pVisual;
unsigned long swaptest = 1;
int i;
@@ -867,6 +929,8 @@ vfbScreenInit(index, pScreen, argc, argv)
pbits = vfbAllocateFramebufferMemory(pvfb);
if (!pbits) return FALSE;
+ /* miSetPixmapDepths ();*/
+
switch (pvfb->bitsPerPixel)
{
case 1:
@@ -874,16 +938,14 @@ vfbScreenInit(index, pScreen, argc, argv)
dpix, dpiy, pvfb->paddedWidth * 8);
break;
case 8:
- ret = cfbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
- dpix, dpiy, pvfb->paddedWidth);
- break;
case 16:
- ret = cfb16ScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
- dpix, dpiy, pvfb->paddedWidth);
- break;
case 32:
- ret = cfb32ScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
- dpix, dpiy, pvfb->paddedWidth);
+ ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
+ dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
+#ifdef RENDER
+ if (ret && Render)
+ fbPictureInit (pScreen, 0, 0);
+#endif
break;
default:
return FALSE;
@@ -891,6 +953,12 @@ vfbScreenInit(index, pScreen, argc, argv)
if (!ret) return FALSE;
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * Circumvent the backing store that was just initialised. This amounts
+ * to a truely bizarre way of initialising SaveDoomedAreas and friends.
+ */
pScreen->CreateGC = vfbMultiDepthCreateGC;
pScreen->GetImage = vfbMultiDepthGetImage;
pScreen->GetSpans = vfbMultiDepthGetSpans;
@@ -915,7 +983,7 @@ vfbScreenInit(index, pScreen, argc, argv)
}
else
{
- ret = cfbCreateDefColormap(pScreen);
+ ret = fbCreateDefColormap(pScreen);
}
miSetZeroLineBias(pScreen, pvfb->lineBias);
@@ -933,7 +1001,6 @@ InitOutput(screenInfo, argc, argv)
{
int i;
int NumFormats = 0;
- FILE *pf = stderr;
/* initialize pixmap formats */
@@ -943,6 +1010,10 @@ InitOutput(screenInfo, argc, argv)
vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
}
+ /* for RENDER we need 32bpp */
+ if (Render)
+ vfbPixmapDepths[32] = TRUE;
+
for (i = 1; i <= 32; i++)
{
if (vfbPixmapDepths[i])
diff --git a/hw/vfb/Xvfb.man.pre b/hw/vfb/Xvfb.man.pre
index 3d8d86156..e3e255298 100644
--- a/hw/vfb/Xvfb.man.pre
+++ b/hw/vfb/Xvfb.man.pre
@@ -22,7 +22,10 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
-.TH XVFB 1 "Release 6.4" "X Version 11"
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.9 2001/12/14 19:59:45 dawes Exp $
+.\"
+.TH XVFB 1 __xorgversion__
.SH NAME
Xvfb \- virtual framebuffer X server for X Version 11
.SH SYNOPSIS
@@ -46,9 +49,9 @@ that don't really need an X server but insist on having one anyway.
.SH BUILDING
To build \fIXvfb\fP, put the following in your host.def and remake.
.PP
-#define BuildServer YES /* if you aren't already building other servers */
+\&#define BuildServer YES /* if you aren't already building other servers */
.br
-#define XVirtualFramebufferServer YES
+\&#define XVirtualFramebufferServer YES
.SH OPTIONS
.PP
@@ -123,6 +126,6 @@ xwud -in /usr/tmp/Xvfb_screen0
Displays screen 0 of the server started by the preceding example.
.SH "SEE ALSO"
.PP
-X(1), Xserver(1), xwd(1), xwud(1), XWDFile.h
+X(__miscmansuffix__), Xserver(1), xwd(1), xwud(1), XWDFile.h
.SH AUTHORS
David P. Wiggins, The Open Group, Inc.
diff --git a/hw/xfree86/common/atKeynames.h b/hw/xfree86/common/atKeynames.h
index 24ae59a30..23760db5e 100644
--- a/hw/xfree86/common/atKeynames.h
+++ b/hw/xfree86/common/atKeynames.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.9 1996/12/23 06:43:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.18 2001/09/29 20:40:30 herrb Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -21,7 +21,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: atKeynames.h,v 1.3 2000/08/17 19:50:28 cpqbld Exp $ */
+/* $XConsortium: atKeynames.h /main/11 1996/03/09 11:17:41 kaleb $ */
#ifndef _ATKEYNAMES_H
#define _ATKEYNAMES_H
@@ -29,13 +29,12 @@
#define XK_TECHNICAL
#define XK_KATAKANA
#include "keysym.h"
+#include "XF86keysym.h"
#define GLYPHS_PER_KEY 4
-#define NUM_KEYCODES 150
-#define NUM_STD_KEYCODES 127
+#define NUM_KEYCODES 248
#define MIN_KEYCODE 8
#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
-#define MAX_STD_KEYCODE (NUM_STD_KEYCODES + MIN_KEYCODE - 1)
#define AltMask Mod1Mask
#define NumLockMask Mod2Mask
@@ -46,8 +45,6 @@
#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
#define ModifierDown(k) ((keyc->state & (k)) == (k))
-#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */
-
/*
* NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
* sets of scancodes. Set3 can only be generated by a MF keyboard.
@@ -72,8 +69,6 @@
* ---------------- ---------- ------- ------ ------
*/
-#ifndef PC98
-
#define KEY_Escape /* Escape 0x01 */ 1
#define KEY_1 /* 1 ! 0x02 */ 2
#define KEY_2 /* 2 @ 0x03 */ 3
@@ -185,7 +180,7 @@
#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
#define KEY_Pause /* Pause 0x66 */ 102
#define KEY_Print /* Print 0x67 */ 103
-#define KEY_KP_Divide /* Didive 0x68 */ 104
+#define KEY_KP_Divide /* Divide 0x68 */ 104
#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
#define KEY_Break /* Break 0x6a */ 106
#define KEY_LMeta /* Left Meta 0x6b */ 107
@@ -194,142 +189,18 @@
#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_SN_KP_7 /* ServerNumLock 7 0x80 */ 128
-#define KEY_SN_KP_8 /* ServerNumLock 8 0x81 */ 129
-#define KEY_SN_KP_9 /* ServerNumLock 9 0x82 */ 130
-#define KEY_SN_KP_4 /* ServerNumLock 4 0x83 */ 131
-#define KEY_SN_KP_5 /* ServerNumLock 5 0x84 */ 132
-#define KEY_SN_KP_6 /* ServerNumLock 6 0x85 */ 133
-#define KEY_SN_KP_1 /* ServerNumLock 1 0x86 */ 134
-#define KEY_SN_KP_2 /* ServerNumLock 2 0x87 */ 135
-#define KEY_SN_KP_3 /* ServerNumLock 4 0x88 */ 136
-#define KEY_SN_KP_0 /* ServerNumLock 0 0x89 */ 137
-#define KEY_SN_KP_Dec /* ServerNumLock Decimal 0x8a */ 138
-#define KEY_SN_KP_Home /* ServerNumLock Home 0x8b */ 139
-#define KEY_SN_KP_Up /* ServerNumLock Up 0x8c */ 140
-#define KEY_SN_KP_Prior /* ServerNumLock Prior 0x8d */ 141
-#define KEY_SN_KP_Left /* ServerNumLock Left 0x8e */ 142
-#define KEY_SN_KP_Begin /* ServerNumLock Begin 0x8f */ 143
-#define KEY_SN_KP_Right /* ServerNumLock Right 0x90 */ 144
-#define KEY_SN_KP_End /* ServerNumLock End 0x91 */ 145
-#define KEY_SN_KP_Down /* ServerNumLock Down 0x92 */ 146
-#define KEY_SN_KP_Next /* ServerNumLock Next 0x93 */ 147
-#define KEY_SN_KP_Ins /* ServerNumLock Ins 0x94 */ 148
-#define KEY_SN_KP_Del /* ServerNumLock Del 0x95 */ 149
-
-#else
-
-#define KEY_Escape /* Escape 0x01 */ 0
-#define KEY_1 /* 1 ! 0x02 */ 1
-#define KEY_2 /* 2 " 0x03 */ 2
-#define KEY_3 /* 3 # 0x04 */ 3
-#define KEY_4 /* 4 $ 0x05 */ 4
-#define KEY_5 /* 5 % 0x06 */ 5
-#define KEY_6 /* 6 & 0x07 */ 6
-#define KEY_7 /* 7 ' 0x08 */ 7
-#define KEY_8 /* 8 ( 0x09 */ 8
-#define KEY_9 /* 9 ) 0x0a */ 9
-#define KEY_0 /* 0 0x0b */ 10
-#define KEY_Minus /* - (Minus) = (Equal) 0x0c */ 11
-#define KEY_Hat /* ^ (Hat) ` 0x0d */ 12
-#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 13
-#define KEY_BackSpace /* Back Space 0x0e */ 14
-#define KEY_Tab /* Tab 0x0f */ 15
-#define KEY_Q /* Q 0x10 */ 16
-#define KEY_W /* W 0x11 */ 17
-#define KEY_E /* E 0x12 */ 18
-#define KEY_R /* R 0x13 */ 19
-#define KEY_T /* T 0x14 */ 20
-#define KEY_Y /* Y 0x15 */ 21
-#define KEY_U /* U 0x16 */ 22
-#define KEY_I /* I 0x17 */ 23
-#define KEY_O /* O 0x18 */ 24
-#define KEY_P /* P 0x19 */ 25
-#define KEY_At /* @ ~ 0x1a */ 26
-#define KEY_LBrace /* [ { 0x1b */ 27
-#define KEY_Enter /* Enter 0x1c */ 28
-#define KEY_A /* A 0x1d */ 29
-#define KEY_S /* S 0x1e */ 30
-#define KEY_D /* D 0x1f */ 31
-#define KEY_F /* F 0x20 */ 32
-#define KEY_G /* G 0x21 */ 33
-#define KEY_H /* H 0x22 */ 34
-#define KEY_J /* J 0x23 */ 35
-#define KEY_K /* K 0x24 */ 36
-#define KEY_L /* L 0x25 */ 37
-#define KEY_SemiColon /* ;(SemiColon) +(Plus) 0x26 */ 38
-#define KEY_Colon /* :(Colon) *(Quote) 0x27 */ 39
-#define KEY_RBrace /* ] } 0x28 */ 40
-#define KEY_Z /* Z 0x29 */ 41
-#define KEY_X /* X 0x2a */ 42
-#define KEY_C /* C 0x2b */ 43
-#define KEY_V /* V 0x2c */ 44
-#define KEY_B /* B 0x2d */ 45
-#define KEY_N /* N 0x2e */ 46
-#define KEY_M /* M 0x2f */ 47
-#define KEY_Comma /* , (Comma) < (Less) 0x30 */ 48
-#define KEY_Period /* . (Period) >(Greater)0x31 */ 49
-#define KEY_Slash /* / (Slash) ? 0x32 */ 50
-#define KEY_Under /* _ 0x33 */ 51
-#define KEY_Space /* (SpaceBar) 0x34 */ 52
-#define KEY_Xfer /* (XFER) 0x35 */ 53
-#define KEY_PgUp /* PgUp 0x36 */ 54
-#define KEY_Pgdown /* (Roll Down) 0x37 */ 55
-#define KEY_Insert /* Insert 0x38 */ 56
-#define KEY_Delete /* Delete 0x39 */ 57
-#define KEY_Up /* Up 0x3a */ 58
-#define KEY_Left /* Left 0x3b */ 59
-#define KEY_Right /* Right 0x3c */ 60
-#define KEY_Down /* Down 0x3d */ 61
-#define KEY_Home /* Home 0x3e */ 62
-#define KEY_Help /* Help 0x3f */ 63
-#define KEY_KP_Subtract /* - (Minus) 0x40 */ 64
-#define KEY_KP_Minus /* - */ 64
-#define KEY_KP_Divide /* / (Slash) 0x41 */ 65
-#define KEY_KP_7 /* 7 0x42 */ 66
-#define KEY_KP_8 /* 8 0x43 */ 67
-#define KEY_KP_9 /* 9 0x44 */ 68
-#define KEY_KP_Multiply /* * 0x45 */ 69
-#define KEY_KP_4 /* 4 0x46 */ 70
-#define KEY_KP_5 /* 5 0x47 */ 71
-#define KEY_KP_6 /* 6 0x48 */ 72
-#define KEY_KP_Add /* + (Plus) 0x49 */ 73
-#define KEY_KP_Plus /* + */ 73
-#define KEY_KP_1 /* 1 0x4a */ 74
-#define KEY_KP_2 /* 2 0x4b */ 75
-#define KEY_KP_3 /* 3 0x4c */ 76
-#define KEY_KP_Equal /* = 0x4d */ 77
-#define KEY_KP_0 /* 0 0x4e */ 78
-#define KEY_KP_Separator /* , 0x4f */ 79
-#define KEY_KP_Decimal /* . (Decimal) 0x50 */ 80
-#define KEY_Nfer /* (NFER) 0x51 */ 81
-#define KEY_F11 /* F11 0x52 */ 82
-#define KEY_F12 /* F12 0x53 */ 83
-#define KEY_F13 /* F13 0x54 */ 84
-#define KEY_F14 /* F14 0x55 */ 85
-#define KEY_F15 /* F15 0x56 */ 86
-#define KEY_Break /* (Stop) 0x60 */ 96
-#define KEY_Copy /* (Copy) 0x61 */ 97
-#define KEY_Begin /* Begin ?? */ 97
-#define KEY_F1 /* F1 0x62 */ 98
-#define KEY_F2 /* F2 0x63 */ 99
-#define KEY_F3 /* F3 0x64 */ 100
-#define KEY_F4 /* F4 0x65 */ 101
-#define KEY_F5 /* F5 0x66 */ 102
-#define KEY_F6 /* F6 0x67 */ 103
-#define KEY_F7 /* F7 0x68 */ 104
-#define KEY_F8 /* F8 0x69 */ 105
-#define KEY_F9 /* F9 0x6a */ 106
-#define KEY_F10 /* F10 0x6b */ 107
-#define KEY_ShiftL /* Shift(left) 0x70 */ 112
-#define KEY_CapsLock /* CapsLock 0x71 */ 113
-#define KEY_KanaLock /* Kana 0x72 */ 114
-#define KEY_Alt /* Alt(left) 0x73 */ 115
-#define KEY_LCtrl /* Ctrl(left) 0x74 */ 116
-
-#endif /* PC98 */
+#define KEY_BSlash2 /* \ _ 0x73 */ 115
+#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
+#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 "unknown" entries in translation maps. */
+#define KEY_NOTUSED 0
+#define KEY_UNKNOWN 255
#endif /* _ATKEYNAMES_H */
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index f85ecd132..4dda2f6c6 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.24.2.2 1998/02/07 00:44:37 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.99 2003/01/29 15:23:20 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -21,182 +21,269 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: compiler.h,v 1.3 2000/08/17 19:50:28 cpqbld Exp $ */
+/* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */
#ifndef _COMPILER_H
-#define _COMPILER_H
-#ifndef __STDC__
-# ifdef signed
-# undef signed
+# if !defined(_XF86_ANSIC_H) && defined(XFree86Module)
+# error missing #include "xf86_ansic.h" before #include "compiler.h"
# endif
-# ifdef volatile
-# undef volatile
-# endif
-# ifdef const
-# undef const
-# endif
-# define signed /**/
-# ifdef __GNUC__
-# define volatile __volatile__
-# define const __const__
-# ifdef PC98
-# undef NO_INLINE
-# endif
-# else
-# define const /**/
-# ifdef PC98
+
+# define _COMPILER_H
+
+/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */
+# ifndef __inline__
+# if defined(__GNUC__)
+ /* gcc has __inline__ */
+# elif defined(__HIGHC__)
+# define __inline__ _Inline
+# else
# define __inline__ /**/
# endif
-# endif /* __GNUC__ */
-#endif /* !__STDC__ */
-
-#if defined(IODEBUG) && defined(__GNUC__)
-#define outb RealOutb
-#define outw RealOutw
-#define outl RealOutl
-#define inb RealInb
-#define inw RealInw
-#define inl RealInl
-#endif
+# endif /* __inline__ */
+# ifndef __inline
+# if defined(__GNUC__)
+ /* gcc has __inline */
+# elif defined(__HIGHC__)
+# define __inline _Inline
+# else
+# define __inline /**/
+# endif
+# endif /* __inline */
+
+# if defined(IODEBUG) && defined(__GNUC__)
+# define outb RealOutb
+# define outw RealOutw
+# define outl RealOutl
+# define inb RealInb
+# define inw RealInw
+# define inl RealInl
+# endif
+
+# if defined(QNX4) /* Do this for now to keep Watcom happy */
+# define outb outp
+# define outw outpw
+# define outl outpd
+# define inb inp
+# define inw inpw
+# define inl inpd
+
+/* Define the ffs function for inlining */
+extern int ffs(unsigned long);
+# pragma aux ffs_ = \
+ "bsf edx, eax" \
+ "jnz bits_set" \
+ "xor eax, eax" \
+ "jmp exit1" \
+ "bits_set:" \
+ "mov eax, edx" \
+ "inc eax" \
+ "exit1:" \
+ __parm [eax] \
+ __modify [eax edx] \
+ __value [eax] \
+ ;
+# endif
+
+# if defined(NO_INLINE) || defined(DO_PROTOTYPES)
+
+# if !defined(__sparc__) && !defined(__arm32__) \
+ && !(defined(__alpha__) && defined(linux))
+
+extern void outb(unsigned short, unsigned char);
+extern void outw(unsigned short, unsigned short);
+extern void outl(unsigned short, unsigned int);
+extern unsigned int inb(unsigned short);
+extern unsigned int inw(unsigned short);
+extern unsigned int inl(unsigned short);
+
+# else /* __sparc__, __arm32__, __alpha__*/
+
+extern void outb(unsigned long, unsigned char);
+extern void outw(unsigned long, unsigned short);
+extern void outl(unsigned long, unsigned int);
+extern unsigned int inb(unsigned long);
+extern unsigned int inw(unsigned long);
+extern unsigned int inl(unsigned long);
+
+# endif /* __sparc__, __arm32__, __alpha__ */
+
+extern unsigned long ldq_u(unsigned long *);
+extern unsigned long ldl_u(unsigned int *);
+extern unsigned long ldw_u(unsigned short *);
+extern void stq_u(unsigned long, unsigned long *);
+extern void stl_u(unsigned long, unsigned int *);
+extern void stw_u(unsigned long, unsigned short *);
+extern void mem_barrier(void);
+extern void write_mem_barrier(void);
+extern void stl_brx(unsigned long, volatile unsigned char *, int);
+extern void stw_brx(unsigned short, volatile unsigned char *, int);
+extern unsigned long ldl_brx(volatile unsigned char *, int);
+extern unsigned short ldw_brx(volatile unsigned char *, int);
+
+# endif
+
+# ifndef NO_INLINE
+# ifdef __GNUC__
+# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && defined(__alpha__)
-#ifdef NO_INLINE
-
-extern void outb();
-extern void outw();
-extern void outl();
-extern unsigned int inb();
-extern unsigned int inw();
-extern unsigned int inl();
-#if NeedFunctionPrototypes
-extern unsigned char rdinx(unsigned short int, unsigned char);
-extern void wrinx(unsigned short int, unsigned char, unsigned char);
-extern void modinx(unsigned short int, unsigned char, unsigned char, unsigned char);
-extern int testrg(unsigned short int, unsigned char);
-extern int testinx2(unsigned short int, unsigned char, unsigned char);
-extern int testinx(unsigned short int, unsigned char);
-#else /* NeedFunctionProtoypes */
-extern unsigned char rdinx();
-extern void wrinx();
-extern void modinx();
-extern int testrg();
-extern int testinx2();
-extern int testinx();
-#endif /* NeedFunctionProtoypes */
-
-#else /* NO_INLINE */
-
-#ifdef __GNUC__
-
-#if defined(linux) && defined(__alpha__)
+# ifdef linux
/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
+extern void (*_alpha_outb)(char val, unsigned long port);
static __inline__ void
-outb(port, val)
- unsigned short port;
- char val;
+outb(unsigned long port, unsigned char val)
{
- extern void _outb(char val, unsigned short port);
- _outb(val, port);
+ _alpha_outb(val, port);
}
+extern void (*_alpha_outw)(short val, unsigned long port);
static __inline__ void
-outw(port, val)
- unsigned short port;
- short val;
+outw(unsigned long port, unsigned short val)
{
- extern void _outw(short val, unsigned short port);
- _outw(val, port);
+ _alpha_outw(val, port);
}
+extern void (*_alpha_outl)(int val, unsigned long port);
static __inline__ void
-outl(port, val)
- unsigned short port;
- int val;
+outl(unsigned long port, unsigned int val)
{
- extern void _outl(int val, unsigned short port);
- _outl(val, port);
+ _alpha_outl(val, port);
}
+extern unsigned int (*_alpha_inb)(unsigned long port);
static __inline__ unsigned int
-inb(port)
- unsigned short port;
+inb(unsigned long port)
{
- extern unsigned int _inb(unsigned short port);
- return _inb(port);
+ return _alpha_inb(port);
}
+extern unsigned int (*_alpha_inw)(unsigned long port);
static __inline__ unsigned int
-inw(port)
- unsigned short port;
+inw(unsigned long port)
{
- extern unsigned int _inw(unsigned short port);
- return _inw(port);
+ return _alpha_inw(port);
}
+extern unsigned int (*_alpha_inl)(unsigned long port);
static __inline__ unsigned int
-inl(port)
- unsigned short port;
+inl(unsigned long port)
{
- extern unsigned int _inl(unsigned short port);
- return _inl(port);
+ return _alpha_inl(port);
}
+# endif /* linux */
+
+# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
+ && !defined(DO_PROTOTYPES)
+
+/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */
+/* inx/outx routines */
+/* note that the appropriate setup via "ioperm" needs to be done */
+/* *before* any inx/outx is done. */
+
+extern void outb(unsigned int port, unsigned char val);
+extern void outw(unsigned int port, unsigned short val);
+extern void outl(unsigned int port, unsigned int val);
+extern unsigned char inb(unsigned int port);
+extern unsigned short inw(unsigned int port);
+extern unsigned int inl(unsigned int port);
+
+# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
+
+
+#if defined(__NetBSD__)
+#include <machine/pio.h>
+#endif /* __NetBSD__ */
/*
* inline functions to do unaligned accesses
* from linux/include/asm-alpha/unaligned.h
*/
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+/*
+ * Elemental unaligned loads
+ */
+/* let's try making these things static */
+
static __inline__ unsigned long ldq_u(unsigned long * r11)
{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+# else
unsigned long r1,r2;
__asm__("ldq_u %0,%3\n\t"
"ldq_u %1,%4\n\t"
"extql %0,%2,%0\n\t"
- "extqh %1,%2,%1\n\t"
- "bis %1,%0,%0"
+ "extqh %1,%2,%1"
:"=&r" (r1), "=&r" (r2)
:"r" (r11),
"m" (*r11),
- "m" (*(unsigned long *)(7+(char *) r11)));
- return r1;
+ "m" (*(const unsigned long *)(7+(char *) r11)));
+ return r1 | r2;
+# endif
}
static __inline__ unsigned long ldl_u(unsigned int * r11)
{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+# else
unsigned long r1,r2;
__asm__("ldq_u %0,%3\n\t"
"ldq_u %1,%4\n\t"
"extll %0,%2,%0\n\t"
- "extlh %1,%2,%1\n\t"
- "bis %1,%0,%0"
+ "extlh %1,%2,%1"
:"=&r" (r1), "=&r" (r2)
:"r" (r11),
"m" (*r11),
- "m" (*(unsigned long *)(3+(char *) r11)));
- return r1;
+ "m" (*(const unsigned long *)(3+(char *) r11)));
+ return r1 | r2;
+# endif
}
static __inline__ unsigned long ldw_u(unsigned short * r11)
{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+# else
unsigned long r1,r2;
__asm__("ldq_u %0,%3\n\t"
"ldq_u %1,%4\n\t"
"extwl %0,%2,%0\n\t"
- "extwh %1,%2,%1\n\t"
- "bis %1,%0,%0"
+ "extwh %1,%2,%1"
:"=&r" (r1), "=&r" (r2)
:"r" (r11),
"m" (*r11),
- "m" (*(unsigned long *)(1+(char *) r11)));
- return r1;
+ "m" (*(const unsigned long *)(1+(char *) r11)));
+ return r1 | r2;
+# endif
}
+/*
+ * Elemental unaligned stores
+ */
+
static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+# else
unsigned long r1,r2,r3,r4;
__asm__("ldq_u %3,%1\n\t"
@@ -213,10 +300,15 @@ static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
"=m" (*(unsigned long *)(7+(char *) r11)),
"=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
:"r" (r5), "r" (r11));
+# endif
}
static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+# else
unsigned long r1,r2,r3,r4;
__asm__("ldq_u %3,%1\n\t"
@@ -233,10 +325,15 @@ static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
"=m" (*(unsigned long *)(3+(char *) r11)),
"=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
:"r" (r5), "r" (r11));
+# endif
}
static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+# else
unsigned long r1,r2,r3,r4;
__asm__("ldq_u %3,%1\n\t"
@@ -253,66 +350,551 @@ static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
"=m" (*(unsigned long *)(1+(char *) r11)),
"=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
:"r" (r5), "r" (r11));
+# endif
}
-#define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
-#ifdef __ELF__
-#define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory")
-#else /* ECOFF gas 2.6 doesn't know "wmb" :-( */
-#define write_mem_barrier() mem_barrier()
-#endif
+/* to flush the I-cache before jumping to code which just got loaded */
+# define PAL_imb 134
+# define istream_mem_barrier() \
+ __asm__ __volatile__("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
+# define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
+# ifdef __ELF__
+# define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory")
+# else /* ECOFF gas 2.6 doesn't know "wmb" :-( */
+# define write_mem_barrier() mem_barrier()
+# endif
+
+
+# elif defined(linux) && defined(__ia64__)
+
+# include <inttypes.h>
+
+# include <sys/io.h>
+
+struct __una_u64 { uint64_t x __attribute__((packed)); };
+struct __una_u32 { uint32_t x __attribute__((packed)); };
+struct __una_u16 { uint16_t x __attribute__((packed)); };
+
+static __inline__ unsigned long
+__uldq (const unsigned long * r11)
+{
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+}
+
+static __inline__ unsigned long
+__uldl (const unsigned int * r11)
+{
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+}
+
+static __inline__ unsigned long
+__uldw (const unsigned short * r11)
+{
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+}
+
+static __inline__ void
+__ustq (unsigned long r5, unsigned long * r11)
+{
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+}
+
+static __inline__ void
+__ustl (unsigned long r5, unsigned int * r11)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+}
+
+static __inline__ void
+__ustw (unsigned long r5, unsigned short * r11)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+}
+
+# define ldq_u(p) __uldq(p)
+# define ldl_u(p) __uldl(p)
+# define ldw_u(p) __uldw(p)
+# define stq_u(v,p) __ustq(v,p)
+# define stl_u(v,p) __ustl(v,p)
+# define stw_u(v,p) __ustw(v,p)
+
+# 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
+
+# define outb(a,b) _outb(b,a)
+# define outw(a,b) _outw(b,a)
+# define outl(a,b) _outl(b,a)
+
+# elif defined(linux) && defined(__x86_64__)
+
+# include <inttypes.h>
+
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+
+# define mem_barrier() \
+ __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
+# define write_mem_barrier() \
+ __asm__ __volatile__ ("": : :"memory")
+
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+}
+
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__)) && defined(__sparc__)
+
+# if !defined(Lynx)
+# ifndef ASI_PL
+# define ASI_PL 0x88
+# endif
+
+# define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory")
+
+static __inline__ void
+outb(unsigned long port, unsigned char val)
+{
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (port), "i" (ASI_PL));
+ barrier();
+}
-#else /* defined(linux) && defined(__alpha__) */
-#if defined(__mips__)
+static __inline__ void
+outw(unsigned long port, unsigned short val)
+{
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (port), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+outl(unsigned long port, unsigned int val)
+{
+ __asm__ __volatile__("sta %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (port), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ unsigned int
+inb(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lduba [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lduha [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lda [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned char
+xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned char ret;
+
+ __asm__ __volatile__("lduba [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned short ret;
+
+ __asm__ __volatile__("lduh [%1], %0"
+ : "=r" (ret)
+ : "r" (addr));
+ return ret;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned short ret;
+
+ __asm__ __volatile__("lduha [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("ld [%1], %0"
+ : "=r" (ret)
+ : "r" (addr));
+ return ret;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("lda [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ void
+xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sth %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("st %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sta %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+}
+
+static __inline__ void
+xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sth %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+}
+
+static __inline__ void
+xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+}
+
+static __inline__ void
+xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("st %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+}
+
+static __inline__ void
+xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sta %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+}
+
+# endif /* !Lynx */
+
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+
+# if defined(__arch64__) || defined(__sparcv9)
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+# endif
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+static __inline__ unsigned long ldq_u(unsigned long *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+# if defined(__arch64__) || defined(__sparcv9)
+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
+# else
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+# endif
+ return ptr->x;
+# else
+ unsigned long ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+# endif
+}
+
+static __inline__ unsigned long ldl_u(unsigned int *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+ return ptr->x;
+# else
+ unsigned int ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+# endif
+}
+
+static __inline__ unsigned long ldw_u(unsigned short *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
+ return ptr->x;
+# else
+ unsigned short ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+# endif
+}
+
+static __inline__ void stq_u(unsigned long val, unsigned long *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+# if defined(__arch64__) || defined(__sparcv9)
+ struct __una_u64 *ptr = (struct __una_u64 *) p;
+# else
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+# endif
+ ptr->x = val;
+# else
+ unsigned long tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+# endif
+}
+
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+ ptr->x = val;
+# else
+ unsigned int tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+# endif
+}
+
+static __inline__ void stw_u(unsigned long val, unsigned short *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+ ptr->x = val;
+# else
+ unsigned short tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+# endif
+}
+
+# define mem_barrier() /* XXX: nop for now */
+# define write_mem_barrier() /* XXX: nop for now */
+
+# elif defined(__mips__) || defined(__arm32__)
+#ifdef __arm32__
+#define PORT_SIZE long
+#else
+#define PORT_SIZE short
+#endif
unsigned int IOPortBase; /* Memory mapped I/O port area */
static __inline__ void
-outb(port, val)
- short port;
- char val;
+outb(unsigned PORT_SIZE port, unsigned char val)
{
- *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val;
+ *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
}
static __inline__ void
-outw(port, val)
- short port;
- short val;
+outw(unsigned PORT_SIZE port, unsigned short val)
{
- *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val;
+ *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
}
static __inline__ void
-outl(port, val)
- short port;
- int val;
+outl(unsigned PORT_SIZE port, unsigned int val)
{
- *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val;
+ *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
}
static __inline__ unsigned int
-inb(port)
- short port;
+inb(unsigned PORT_SIZE port)
{
- return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase));
+ return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase);
}
static __inline__ unsigned int
-inw(port)
- short port;
+inw(unsigned PORT_SIZE port)
{
- return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase));
+ return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase);
}
static __inline__ unsigned int
-inl(port)
- short port;
+inl(unsigned PORT_SIZE port)
{
- return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase));
+ return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase);
}
+# if defined(__mips__)
static __inline__ unsigned long ldq_u(unsigned long * r11)
{
unsigned long r1;
@@ -349,511 +931,409 @@ static __inline__ unsigned long ldw_u(unsigned short * r11)
return r1;
}
-#define stq_u(v,p) stl_u(v,p)
-#define stl_u(v,p) ((unsigned char *)(p)) = (v); \
- ((unsigned char *)(p)+1) = ((v) >> 8); \
- ((unsigned char *)(p)+2) = ((v) >> 16); \
- ((unsigned char *)(p)+3) = ((v) >> 24)
+# ifdef linux /* don't mess with other OSs */
-#define stw_u(v,p) ((unsigned char *)(p)) = (v); \
- ((unsigned char *)(p)+1) = ((v) >> 8)
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads (and we don't support older
+ * versions anyway. Define some packed structures to talk about such things
+ * with.
+ */
-#define mem_barrier() /* NOP */
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
-#else /* defined(mips) */
+static __inline__ void stw_u(unsigned long val, unsigned short *p)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+ ptr->x = val;
+}
-#define ldq_u(p) (*((unsigned long *)(p)))
-#define ldl_u(p) (*((unsigned int *)(p)))
-#define ldw_u(p) (*((unsigned short *)(p)))
-#define stq_u(v,p) ((unsigned long *)(p)) = (v)
-#define stl_u(v,p) ((unsigned int *)(p)) = (v)
-#define stw_u(v,p) ((unsigned short *)(p)) = (v)
-#define mem_barrier() /* NOP */
-#define write_mem_barrier() /* NOP */
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+ ptr->x = val;
+}
-#if !defined(FAKEIT) && !defined(__mc68000__)
-#ifdef GCCUSESGAS
+# if X_BYTE_ORDER == X_BIG_ENDIAN
+static __inline__ unsigned int
+xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned int ret;
-/*
- * If gcc uses gas rather than the native assembler, the syntax of these
- * inlines has to be different. DHD
- */
-#ifndef PC98
+ __asm__ __volatile__("lw %0, 0(%1)"
+ : "=r" (ret)
+ : "r" (addr));
+ return ret;
+}
static __inline__ void
-#if NeedFunctionPrototypes
-outb(
-unsigned short int port,
-unsigned char val)
-#else
-outb(port, val)
-unsigned short int port;
-unsigned char val;
-#endif /* NeedFunctionPrototypes */
-{
- __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sw %0, 0(%1)"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+}
+# endif
+
+# define mem_barrier() \
+ __asm__ __volatile__( \
+ "# prevent instructions being moved around\n\t" \
+ ".set\tnoreorder\n\t" \
+ "# 8 nops to fool the R4400 pipeline\n\t" \
+ "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \
+ ".set\treorder" \
+ : /* no output */ \
+ : /* no input */ \
+ : "memory")
+# define write_mem_barrier() mem_barrier()
+
+# else /* !linux */
+
+# define stq_u(v,p) stl_u(v,p)
+# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*(unsigned char *)(p)+1) = ((v) >> 8); \
+ (*(unsigned char *)(p)+2) = ((v) >> 16); \
+ (*(unsigned char *)(p)+3) = ((v) >> 24)
+
+# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*(unsigned char *)(p)+1) = ((v) >> 8)
+
+# define mem_barrier() /* NOP */
+# endif /* !linux */
+# endif /* __mips__ */
+
+# if defined(__arm32__)
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() /* NOP */
+# define write_mem_barrier() /* NOP */
+# endif /* __arm32__ */
+
+# elif (defined(Lynx) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__powerpc__)
+
+# ifndef MAP_FAILED
+# define MAP_FAILED ((void *)-1)
+# endif
+
+extern volatile unsigned char *ioBase;
+
+# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
+
+static __inline__ unsigned char
+xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned char val;
+ __asm__ __volatile__(
+ "lbzx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
}
-
-static __inline__ void
-#if NeedFunctionPrototypes
-outw(
-unsigned short int port,
-unsigned short int val)
-#else
-outw(port, val)
-unsigned short int port;
-unsigned short int val;
-#endif /* NeedFunctionPrototypes */
+static __inline__ unsigned short
+xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
{
- __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+ register unsigned short val;
+ __asm__ __volatile__(
+ "lhzx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
}
-static __inline__ void
-#if NeedFunctionPrototypes
-outl(
-unsigned short int port,
-unsigned int val)
-#else
-outl(port, val)
-unsigned short int port;
-unsigned int val;
-#endif /* NeedFunctionPrototypes */
+static __inline__ unsigned short
+xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+ register unsigned short val;
+ __asm__ __volatile__(
+ "lhbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inb(
-unsigned short int port)
-#else
-inb(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ register unsigned int val;
+ __asm__ __volatile__(
+ "lwzx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inw(
-unsigned short int port)
-#else
-inw(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
{
- unsigned short int ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ register unsigned int val;
+ __asm__ __volatile__(
+ "lwbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
}
-static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inl(
-unsigned short int port)
-#else
-inl(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+static __inline__ void
+xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset,
+ const unsigned char val)
{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ __asm__ __volatile__(
+ "stbx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
}
-#else /* PC98 */
+static __inline__ void
+xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
+{
+ __asm__ __volatile__(
+ "sthbrx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
static __inline__ void
-#if NeedFunctionPrototypes
-_outb(
-unsigned short int port,
-unsigned char val)
-#else
-_outb(port, val)
-unsigned short int port;
-unsigned char val;
-#endif /* NeedFunctionPrototypes */
+xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
{
- __asm__ __volatile__("outb %0,%1" ::"a" (val), "d" (port));
+ __asm__ __volatile__(
+ "sthx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
}
static __inline__ void
-#if NeedFunctionPrototypes
-_outw(
-unsigned short int port,
-unsigned short int val)
-#else
-_outw(port, val)
-unsigned short int port;
-unsigned short int val;
-#endif /* NeedFunctionPrototypes */
+xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
{
- __asm__ __volatile__("outw %0,%1" ::"a" (val), "d" (port));
+ __asm__ __volatile__(
+ "stwbrx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
}
-
+
static __inline__ void
-#if NeedFunctionPrototypes
-_outl(
-unsigned short int port,
-unsigned int val)
-#else
-_outl(port, val)
-unsigned short int port;
-unsigned int val;
-#endif /* NeedFunctionPrototypes */
+xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__(
+ "stwx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
}
+static __inline__ void
+xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
+ const unsigned char val)
+{
+ xf86WriteMmioNB8(base, offset, val);
+ eieio();
+}
-static __inline__ unsigned int
-#if NeedFunctionPrototypes
-_inb(
-unsigned short int port)
-#else
-_inb(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+static __inline__ void
+xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ xf86WriteMmioNB16Le(base, offset, val);
+ eieio();
}
-static __inline__ unsigned int
-#if NeedFunctionPrototypes
-_inw(
-unsigned short int port)
-#else
-_inw(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+static __inline__ void
+xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
{
- unsigned short ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ xf86WriteMmioNB16Be(base, offset, val);
+ eieio();
}
-static __inline__ unsigned int
-#if NeedFunctionPrototypes
-_inl(
-unsigned short int port)
-#else
-_inl(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+static __inline__ void
+xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ xf86WriteMmioNB32Le(base, offset, val);
+ eieio();
}
+static __inline__ void
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ xf86WriteMmioNB32Be(base, offset, val);
+ eieio();
+}
-#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968)
-#define PW_PORT 0x600
-extern short chipID;
-#if NeedFunctionPrototypes
-extern void *mmioBase;
-#else
-extern unsigned char *mmioBase;
-#endif
-extern unsigned short _port_tbl[];
-#define port_convert(x) _port_tbl[(unsigned short)x]
-#endif
-#if defined(PC98_WAB) || defined(PC98_GANB_WAP)
-static __inline__ unsigned short
-port_convert(unsigned short port)
+static __inline__ void
+outb(unsigned short port, unsigned char value)
{
- port <<= 8;
- port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
- port |= 0xE0;
- return port;
+ if(ioBase == MAP_FAILED) return;
+ xf86WriteMmio8((void *)ioBase, port, value);
}
-#endif /* PC98_WAB || PC98_GANB_WAP */
-
-#if defined(PC98_WABEP)
-static __inline__ unsigned short
-port_convert(unsigned short port)
+
+static __inline__ void
+outw(unsigned short port, unsigned short value)
{
- port &= 0x7f; /* Mask 0000 0000 0111 1111 */
- port |= 0x0f00;
- return port;
+ if(ioBase == MAP_FAILED) return;
+ xf86WriteMmio16Le((void *)ioBase, port, value);
}
-#endif /* PC98_WABEP */
-#ifdef PC98_WSNA
-static __inline__ unsigned short
-port_convert(unsigned short port)
+static __inline__ void
+outl(unsigned short port, unsigned int value)
{
- port <<= 8;
- port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
- port |= 0xE2;
- return port;
+ if(ioBase == MAP_FAILED) return;
+ xf86WriteMmio32Le((void *)ioBase, port, value);
}
-#endif /* PC98_WSNA */
-#ifdef PC98_NKVNEC
-#ifdef PC98_NEC_CIRRUS2
-static __inline__ unsigned short
-port_convert(unsigned short port)
+static __inline__ unsigned int
+inb(unsigned short port)
{
- port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050;
- return port;
+ if(ioBase == MAP_FAILED) return 0;
+ return xf86ReadMmio8((void *)ioBase, port);
}
-#else
-static __inline__ unsigned short
-port_convert(unsigned short port)
+
+static __inline__ unsigned int
+inw(unsigned short port)
{
- port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0;
- return port;
+ if(ioBase == MAP_FAILED) return 0;
+ return xf86ReadMmio16Le((void *)ioBase, port);
}
-#endif /* PC98_NEC_CIRRUS2 */
-#endif /* PC98_NKVNEC */
-#if defined(PC98_TGUI) || defined(PC98_MGA)
-#if NeedFunctionPrototypes
-extern void *mmioBase;
-#else
-extern unsigned char *mmioBase;
-#endif
-#endif
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ if(ioBase == MAP_FAILED) return 0;
+ return xf86ReadMmio32Le((void *)ioBase, port);
+}
-static __inline__ void
-#if NeedFunctionPrototypes
-outb(
-unsigned short port,
-unsigned char val)
-#else
-outb(port, val)
-unsigned short port;
-unsigned char val;
-#endif /* NeedFunctionPrototypes */
-{
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
+# define ldq_u(p) ldl_u(p)
+# define ldl_u(p) ((*(unsigned char *)(p)) | \
+ (*((unsigned char *)(p)+1)<<8) | \
+ (*((unsigned char *)(p)+2)<<16) | \
+ (*((unsigned char *)(p)+3)<<24))
+# define ldw_u(p) ((*(unsigned char *)(p)) | \
+ (*((unsigned char *)(p)+1)<<8))
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val);
-#else
+# define stq_u(v,p) stl_u(v,p)
+# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*((unsigned char *)(p)+1)) = ((v) >> 8); \
+ (*((unsigned char *)(p)+2)) = ((v) >> 16); \
+ (*((unsigned char *)(p)+3)) = ((v) >> 24)
+# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*((unsigned char *)(p)+1)) = ((v) >> 8)
+
+# define mem_barrier() eieio()
+# define write_mem_barrier() eieio()
+
+# else /* ix86 */
+
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() /* NOP */
+# define write_mem_barrier() /* NOP */
+
+# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)
+# ifdef GCCUSESGAS
+
+/*
+ * If gcc uses gas rather than the native assembler, the syntax of these
+ * inlines has to be different. DHD
+ */
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
__asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
-#endif
}
-static __inline__ void
-#if NeedFunctionPrototypes
-outw(
-unsigned short port,
-unsigned short val)
-#else
-outw(port, val)
-unsigned short port;
-unsigned short val;
-#endif /* NeedFunctionPrototypes */
-{
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val);
-#else
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
__asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
-#endif
}
static __inline__ void
-#if NeedFunctionPrototypes
-outl(
-unsigned short port,
-unsigned int val)
-#else
-outl(port, val)
-unsigned short port;
-unsigned int val;
-#endif /* NeedFunctionPrototypes */
-{
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val);
-#else
+outl(unsigned short port, unsigned int val)
+{
__asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
-#endif
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inb(
-unsigned short port)
-#else
-inb(port)
-unsigned short port;
-#endif /* NeedFunctionPrototypes */
+inb(unsigned short port)
{
unsigned char ret;
-
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- ret =*(volatile unsigned char *)((char *)mmioBase+(port));
-#else
__asm__ __volatile__("inb %1,%0" :
"=a" (ret) :
"d" (port));
-#endif
return ret;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inw(
-unsigned short port)
-#else
-inw(port)
-unsigned short port;
-#endif /* NeedFunctionPrototypes */
+inw(unsigned short port)
{
unsigned short ret;
-
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- ret =*(volatile unsigned short *)((char *)mmioBase+(port));
-#else
__asm__ __volatile__("inw %1,%0" :
"=a" (ret) :
"d" (port));
-#endif
return ret;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inl(
-unsigned short port)
-#else
-inl(port)
-unsigned short port;
-#endif /* NeedFunctionPrototypes */
+inl(unsigned short port)
{
unsigned int ret;
-
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- ret =*(volatile unsigned int *)((char *)mmioBase+(port));
-#else
__asm__ __volatile__("inl %1,%0" :
"=a" (ret) :
"d" (port));
-#endif
return ret;
}
-#endif /* PC98 */
-
-#else /* GCCUSESGAS */
+# else /* GCCUSESGAS */
static __inline__ void
-#if NeedFunctionPrototypes
-outb(
-unsigned short int port,
-unsigned char val)
-#else
-outb(port, val)
-unsigned short int port;
-unsigned char val;
-#endif /* NeedFunctionPrototypes */
+outb(unsigned short port, unsigned char val)
{
__asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
}
static __inline__ void
-#if NeedFunctionPrototypes
-outw(
-unsigned short int port,
-unsigned short int val)
-#else
-outw(port, val)
-unsigned short int port;
-unsigned short int val;
-#endif /* NeedFunctionPrototypes */
+outw(unsigned short port, unsigned short val)
{
__asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port));
}
static __inline__ void
-#if NeedFunctionPrototypes
-outl(
-unsigned short int port,
-unsigned int val)
-#else
-outl(port, val)
-unsigned short int port;
-unsigned int val;
-#endif /* NeedFunctionPrototypes */
+outl(unsigned short port, unsigned int val)
{
__asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port));
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inb(
-unsigned short int port)
-#else
-inb(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+inb(unsigned short port)
{
unsigned char ret;
__asm__ __volatile__("in%B0 (%1)" :
@@ -863,15 +1343,9 @@ unsigned short int port;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inw(
-unsigned short int port)
-#else
-inw(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+inw(unsigned short port)
{
- unsigned short int ret;
+ unsigned short ret;
__asm__ __volatile__("in%W0 (%1)" :
"=a" (ret) :
"d" (port));
@@ -879,13 +1353,7 @@ unsigned short int port;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inl(
-unsigned short int port)
-#else
-inl(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+inl(unsigned short port)
{
unsigned int ret;
__asm__ __volatile__("in%L0 (%1)" :
@@ -894,567 +1362,382 @@ unsigned short int port;
return ret;
}
-#endif /* GCCUSESGAS */
+# endif /* GCCUSESGAS */
-#else /* !defined(FAKEIT) && !defined(__mc68000__) */
+# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)*/
static __inline__ void
-#if NeedFunctionPrototypes
-outb(
-unsigned short int port,
-unsigned char val)
-#else
-outb(port, val)
-unsigned short int port;
-unsigned char val;
-#endif /* NeedFunctionPrototypes */
+outb(unsigned short port, unsigned char val)
{
}
static __inline__ void
-#if NeedFunctionPrototypes
-outw(
-unsigned short int port,
-unsigned short int val)
-#else
-outw(port, val)
-unsigned short int port;
-unsigned short int val;
-#endif /* NeedFunctionPrototypes */
+outw(unsigned short port, unsigned short val)
{
}
static __inline__ void
-#if NeedFunctionPrototypes
-outl(
-unsigned short int port,
-unsigned int val)
-#else
-outl(port, val)
-unsigned short int port;
-unsigned int val;
-#endif /* NeedFunctionPrototypes */
+outl(unsigned short port, unsigned int val)
{
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inb(
-unsigned short int port)
-#else
-inb(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+inb(unsigned short port)
{
return 0;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inw(
-unsigned short int port)
-#else
-inw(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+inw(unsigned short port)
{
return 0;
}
static __inline__ unsigned int
-#if NeedFunctionPrototypes
-inl(
-unsigned short int port)
-#else
-inl(port)
-unsigned short int port;
-#endif /* NeedFunctionPrototypes */
+inl(unsigned short port)
{
return 0;
}
-#endif /* FAKEIT */
-
-#endif /* defined(mips) */
-#endif /* defined(AlphaArchitecture) && defined(LinuxArchitecture) */
-
-#else /* __GNUC__ */
-#if !defined(AMOEBA) && !defined(MINIX)
-# if defined(__STDC__) && (__STDC__ == 1)
-# ifndef asm
-# define asm __asm
-# endif
-# endif
-# ifdef SVR4
-# include <sys/types.h>
-# ifndef __HIGHC__
-# ifndef __USLC__
-# define __USLC__
-# endif
-# endif
-# endif
-# ifndef PC98
-# ifndef SCO325
-# include <sys/inline.h>
-# else
-# include "scoasm.h"
-# endif
-# else
-#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968)
-#define PW_PORT 0x600
-extern short chipID;
-#if NeedFunctionPrototypes
-extern void *mmioBase;
-#else
-extern unsigned char *mmioBase;
-#endif
-extern unsigned short _port_tbl[];
-#define port_convert(x) _port_tbl[(unsigned short)x]
-#endif
-
-#if defined(PC98_TGUI) || defined(PC98_MGA)
-#if NeedFunctionPrototypes
-extern void *mmioBase;
-#else
-extern unsigned char *mmioBase;
-#endif
-#endif
-
-asm void _outl(port,val)
-{
-%reg port,val;
- movl port, %edx
- movl val, %eax
- outl (%dx)
-%reg port; mem val;
- movl port, %edx
- movl val, %eax
- outl (%dx)
-%mem port; reg val;
- movw port, %dx
- movl val, %eax
- outl (%dx)
-%mem port,val;
- movw port, %dx
- movl val, %eax
- outl (%dx)
-}
-
-asm void _outw(port,val)
-{
-%reg port,val;
- movl port, %edx
- movl val, %eax
- data16
- outl (%dx)
-%reg port; mem val;
- movl port, %edx
- movw val, %ax
- data16
- outl (%dx)
-%mem port; reg val;
- movw port, %dx
- movl val, %eax
- data16
- outl (%dx)
-%mem port,val;
- movw port, %dx
- movw val, %ax
- data16
- outl (%dx)
-}
-
-asm void _outb(port,val)
-{
-%reg port,val;
- movl port, %edx
- movl val, %eax
- outb (%dx)
-%reg port; mem val;
- movl port, %edx
- movb val, %al
- outb (%dx)
-%mem port; reg val;
- movw port, %dx
- movl val, %eax
- outb (%dx)
-%mem port,val;
- movw port, %dx
- movb val, %al
- outb (%dx)
-}
-
-asm int _inl(port)
-{
-%reg port;
- movl port, %edx
- inl (%dx)
-%mem port;
- movw port, %dx
- inl (%dx)
-}
-
-asm int _inw(port)
-{
-%reg port;
- subl %eax, %eax
- movl port, %edx
- data16
- inl (%dx)
-%mem port;
- subl %eax, %eax
- movw port, %dx
- data16
- inl (%dx)
-}
-
-asm int _inb(port)
-{
-%reg port;
- subl %eax, %eax
- movl port, %edx
- inb (%dx)
-%mem port;
- subl %eax, %eax
- movw port, %dx
- inb (%dx)
-}
-
-#if defined(PC98_WAB) || defined(PC98_GANB_WAP)
-static unsigned short
-port_convert(unsigned short port)
-{
- port <<= 8;
- port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
- port |= 0xE0;
- return port;
-}
-#endif /* PC98_WAB || PC98_GANB_WAP */
-
-#if defined(PC98_WABEP)
-static unsigned short
-port_convert(unsigned short port)
-{
- port &= 0x7f; /* Mask 0000 0000 0111 1111 */
- port |= 0x0f00;
- return port;
-}
-#endif /* PC98_WABEP */
-
-#ifdef PC98_WSNA
-static unsigned short
-port_convert(unsigned short port)
-{
- port <<= 8;
- port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
- port |= 0xE2;
- return port;
-}
-#endif /* PC98_WSNA */
-
-#ifdef PC98_NKVNEC
-#ifdef PC98_NEC_CIRRUS2
-static unsigned short
-port_convert(unsigned short port)
-{
- port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050;
- return port;
-}
-#else
-static unsigned short
-port_convert(unsigned short port)
-{
- port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0;
- return port;
-}
-#endif /* PC98_NEC_CIRRUS2 */
-#endif /* PC98_NKVNEC */
-
-static void outl(port,val)
-{
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
+# endif /* FAKEIT */
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val);
-#else
- _outl(port,val);
-#endif
-}
-
-static void outw(port,val)
-{
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val);
-#else
- _outw(port,val);
-#endif
-}
-
-static void outb(port,val)
-{
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val);
-#else
- _outb(port,val);
-#endif
-}
-
-static int inl(port)
-{
- unsigned int ret;
-
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- ret =*(volatile unsigned int *)((char *)mmioBase+(port));
-#else
- ret = _inl(port);
-#endif
- return ret;
-}
-
-static int inw(port)
-{
- unsigned short ret;
-
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- ret =*(volatile unsigned short *)((char *)mmioBase+(port));
-#else
- ret = _inw(port);
-#endif
- return ret;
-}
-
-static int inb(port)
-{
- unsigned char ret;
-
-#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
- defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
- defined(PC98_XKB) || defined(PC98_NEC)
- unsigned short tmp;
- tmp=port_convert(port);
- port=tmp;
-#endif
-
-#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)
- ret =*(volatile unsigned char *)((char *)mmioBase+(port));
-#else
- ret = _inb(port);
-#endif
- return ret;
-}
-
-
-# endif /* PC98 */
-# if !defined(__HIGHC__) && !defined(SCO325)
-# pragma asm partial_optimization outl
-# pragma asm partial_optimization outw
-# pragma asm partial_optimization outb
-# pragma asm partial_optimization inl
-# pragma asm partial_optimization inw
-# pragma asm partial_optimization inb
-# endif
-#endif
-#define ldq_u(p) (*((unsigned long *)(p)))
-#define ldl_u(p) (*((unsigned int *)(p)))
-#define ldw_u(p) (*((unsigned short *)(p)))
-#define stq_u(v,p) ((unsigned long *)(p)) = (v)
-#define stl_u(v,p) ((unsigned int *)(p)) = (v)
-#define stw_u(v,p) ((unsigned short *)(p)) = (v)
-#define mem_barrier() /* NOP */
-#define write_mem_barrier() /* NOP */
-#endif /* __GNUC__ */
-
-#if defined(IODEBUG) && defined(__GNUC__)
-#undef inb
-#undef inw
-#undef inl
-#undef outb
-#undef outw
-#undef outl
-#define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
-#define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
-#define inl(a) __extension__ ({unsigned long __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
-
-#define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b))
-#define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b))
-#define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b))
-#endif
+# endif /* ix86 */
+# elif defined(__powerpc__) /* && !__GNUC__ */
/*
- * This header sometimes gets included where is isn't needed, and on some
- * OSs this causes problems because the following functions generate
- * references to inb() and outb() which can't be resolved. Defining
- * NO_COMPILER_H_EXTRAS avoids this problem.
+ * NON-GCC PowerPC - Presumed to be PowerMAX OS for now
*/
+# ifndef PowerMAX_OS
+# error - Non-gcc PowerPC and !PowerMAXOS ???
+# endif
-#ifndef NO_COMPILER_H_EXTRAS
+# define PPCIO_DEBUG 0
+# define PPCIO_INLINE 1
+# define USE_ABS_MACRO 1
/*
- *-----------------------------------------------------------------------
- * Port manipulation convenience functions
- *-----------------------------------------------------------------------
+ * Use compiler intrinsics to access certain PPC machine instructions
*/
+# define eieio() __inst_eieio()
+# define stw_brx(val,base,ndx) __inst_sthbrx(val,base,ndx)
+# define stl_brx(val,base,ndx) __inst_stwbrx(val,base,ndx)
+# define ldw_brx(base,ndx) __inst_lhbrx(base,ndx)
+# define ldl_brx(base,ndx) __inst_lwbrx(base,ndx)
+
+# define ldq_u(p) (*((unsigned long long *)(p)))
+# define ldl_u(p) (*((unsigned long *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() eieio()
+# define write_mem_barrier() eieio()
+
+extern volatile unsigned char *ioBase;
+
+# if !defined(abs) && defined(USE_ABS_MACRO)
+# define abs(x) ((x) >= 0 ? (x) : -(x))
+# endif
-#ifndef __GNUC__
-#define __inline__ /**/
+# undef inb
+# undef inw
+# undef inl
+# undef outb
+# undef outw
+# undef outl
+
+# if PPCIO_DEBUG
+
+extern void debug_outb(unsigned int a, unsigned char b, int line, char *file);
+extern void debug_outw(unsigned int a, unsigned short w, int line, char *file);
+extern void debug_outl(unsigned int a, unsigned int l, int line, char *file);
+extern unsigned char debug_inb(unsigned int a, int line, char *file);
+extern unsigned short debug_inw(unsigned int a, int line, char *file);
+extern unsigned int debug_inl(unsigned int a, int line, char *file);
+
+# define outb(a,b) debug_outb(a,b, __LINE__, __FILE__)
+# define outw(a,w) debug_outw(a,w, __LINE__, __FILE__)
+# define outl(a,l) debug_outl(a,l, __LINE__, __FILE__)
+# define inb(a) debug_inb(a, __LINE__, __FILE__)
+# define inw(a) debug_inw(a, __LINE__, __FILE__)
+# define inl(a) debug_inl(a, __LINE__, __FILE__)
+
+# else /* !PPCIO_DEBUG */
+
+extern unsigned char inb(unsigned int a);
+extern unsigned short inw(unsigned int a);
+extern unsigned int inl(unsigned int a);
+
+# if PPCIO_INLINE
+
+# define outb(a,b) \
+ (*((volatile unsigned char *)(ioBase + (a))) = (b), eieio())
+# define outw(a,w) (stw_brx((w),ioBase,(a)), eieio())
+# define outl(a,l) (stl_brx((l),ioBase,(a)), eieio())
+
+# else /* !PPCIO_INLINE */
+
+extern void outb(unsigned int a, unsigned char b);
+extern void outw(unsigned int a, unsigned short w);
+extern void outl(unsigned int a, unsigned int l);
+
+# endif /* PPCIO_INLINE */
+
+# endif /* !PPCIO_DEBUG */
+
+# else /* !GNUC && !PPC */
+# if !defined(QNX4)
+# if defined(__STDC__) && (__STDC__ == 1)
+# ifndef asm
+# define asm __asm
+# endif
+# endif
+# ifdef SVR4
+#if 0
+# include <sys/types.h>
#endif
+# ifndef __HIGHC__
+# ifndef __USLC__
+# define __USLC__
+# endif
+# endif
+# endif
+# ifndef SCO325
+# if defined(USL)
+# if defined(IN_MODULE)
+# /* avoid including <sys/types.h> for <sys/inline.h> on UnixWare */
+# define ushort unsigned short
+# define ushort_t unsigned short
+# define ulong unsigned long
+# define ulong_t unsigned long
+# define uint_t unsigned int
+# define uchar_t unsigned char
+# else
+# include <sys/types.h>
+# endif /* IN_MODULE */
+# endif /* USL */
+# include <sys/inline.h>
+# else
+# include "scoasm.h"
+# endif
+# if !defined(__HIGHC__) && !defined(SCO325)
+# pragma asm partial_optimization outl
+# pragma asm partial_optimization outw
+# pragma asm partial_optimization outb
+# pragma asm partial_optimization inl
+# pragma asm partial_optimization inw
+# pragma asm partial_optimization inb
+# endif
+# endif
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() /* NOP */
+# define write_mem_barrier() /* NOP */
+# endif /* __GNUC__ */
+
+# if defined(QNX4)
+# include <sys/types.h>
+extern unsigned inb(unsigned port);
+extern unsigned inw(unsigned port);
+extern unsigned inl(unsigned port);
+extern void outb(unsigned port, unsigned val);
+extern void outw(unsigned port, unsigned val);
+extern void outl(unsigned port, unsigned val);
+# endif /* QNX4 */
+
+# if defined(IODEBUG) && defined(__GNUC__)
+# undef inb
+# undef inw
+# undef inl
+# undef outb
+# undef outw
+# undef outl
+# define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+# define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+# define inl(a) __extension__ ({unsigned int __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+
+# define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b))
+# define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b))
+# define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b))
+# endif
-/*
- * rdinx - read the indexed byte port 'port', index 'ind', and return its value
- */
-static __inline__ unsigned char
-#ifdef __STDC__
-rdinx(unsigned short int port, unsigned char ind)
-#else
-rdinx(port, ind)
-unsigned short int port;
-unsigned char ind;
-#endif
-{
- if (port == 0x3C0) /* reset attribute flip-flop */
- (void) inb(0x3DA);
- outb(port, ind);
- return(inb(port+1));
-}
-
-/*
- * wrinx - write 'val' to port 'port', index 'ind'
- */
-static __inline__ void
-#ifdef __STDC__
-wrinx(unsigned short int port, unsigned char ind, unsigned char val)
-#else
-wrinx(port, ind, val)
-unsigned short int port;
-unsigned char ind, val;
-#endif
-{
- outb(port, ind);
- outb(port+1, val);
-}
+# endif /* NO_INLINE */
+
+# ifdef __alpha__
+/* entry points for Mmio memory access routines */
+extern int (*xf86ReadMmio8)(void *, unsigned long);
+extern int (*xf86ReadMmio16)(void *, unsigned long);
+extern int (*xf86ReadMmio32)(void *, unsigned long);
+extern void (*xf86WriteMmio8)(int, void *, unsigned long);
+extern void (*xf86WriteMmio16)(int, void *, unsigned long);
+extern void (*xf86WriteMmio32)(int, void *, unsigned long);
+extern void (*xf86WriteMmioNB8)(int, void *, unsigned long);
+extern void (*xf86WriteMmioNB16)(int, void *, unsigned long);
+extern void (*xf86WriteMmioNB32)(int, void *, unsigned long);
+extern void xf86JensenMemToBus(char *, long, long, int);
+extern void xf86JensenBusToMem(char *, char *, unsigned long, int);
+extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
+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)
+# 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_OUT32(base, offset, val) \
+ do { \
+ 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
-/*
- * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new';
- * the other bits are unchanged.
- */
-static __inline__ void
-#ifdef __STDC__
-modinx(unsigned short int port, unsigned char ind,
- unsigned char mask, unsigned char new)
-#else
-modinx(port, ind, mask, new)
-unsigned short int port;
-unsigned char ind, mask, new;
-#endif
-{
- unsigned char tmp;
+# define MMIO_OUT8(base, offset, val) \
+ (*xf86WriteMmio8)((CARD8)(val), base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ (*xf86WriteMmio16)((CARD16)(val), base, offset)
+# define MMIO_ONB8(base, offset, val) \
+ (*xf86WriteMmioNB8)((CARD8)(val), base, offset)
+# define MMIO_ONB16(base, offset, val) \
+ (*xf86WriteMmioNB16)((CARD16)(val), base, offset)
+# define MMIO_MOVE32(base, offset, val) \
+ MMIO_OUT32(base, offset, val)
+
+# elif defined(__powerpc__)
+ /*
+ * we provide byteswapping and no byteswapping functions here
+ * with byteswapping as default,
+ * drivers that don't need byteswapping should define PPC_MMIO_IS_BE
+ */
+# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+# define MMIO_OUT8(base, offset, val) \
+ 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)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Be(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmioNB16Be(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmioNB32Be(base, offset, (CARD32)(val))
+# else /* byteswapping is the default */
+# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
+# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Le(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Le(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmioNB16Le(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
+# endif
- tmp = (rdinx(port, ind) & ~mask) | (new & mask);
- wrinx(port, ind, tmp);
-}
+# define MMIO_MOVE32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+
+static __inline__ void ppc_flush_icache(char *addr)
+{
+ __asm__ volatile (
+ "dcbf 0,%0;"
+ "sync;"
+ "icbi 0,%0;"
+ "sync;"
+ "isync;"
+ : : "r"(addr) : "memory");
+}
+
+# elif defined(__sparc__)
+ /*
+ * Like powerpc, we provide byteswapping and no byteswapping functions
+ * here with byteswapping as default, drivers that don't need byteswapping
+ * should define SPARC_MMIO_IS_BE (perhaps create a generic macro so that we
+ * do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places
+ * of drivers?).
+ */
+# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+# define MMIO_OUT8(base, offset, val) \
+ 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)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Be(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmio16BeNB(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmio32BeNB(base, offset, (CARD32)(val))
+# else /* byteswapping is the default */
+# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
+# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Le(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Le(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmio16LeNB(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
+# endif
-/*
- * tstrg - returns true iff the bits in 'mask' of register 'port' are
- * readable & writable.
- */
+# define MMIO_MOVE32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
-static __inline__ int
-#ifdef __STDC__
-testrg(unsigned short int port, unsigned char mask)
-#else
-tstrg(port, mask)
-unsigned short int port;
-unsigned char mask;
-#endif
-{
- unsigned char old, new1, new2;
+# else /* !__alpha__ && !__powerpc__ && !__sparc__ */
- old = inb(port);
- outb(port, old & ~mask);
- new1 = inb(port) & mask;
- outb(port, old | mask);
- new2 = inb(port) & mask;
- outb(port, old);
- return((new1 == 0) && (new2 == mask));
-}
+# define MMIO_IN8(base, offset) \
+ *(volatile CARD8 *)(((CARD8*)(base)) + (offset))
+# define MMIO_IN16(base, offset) \
+ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset))
+# define MMIO_IN32(base, offset) \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
+# define MMIO_OUT8(base, offset, val) \
+ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val)
+# define MMIO_OUT16(base, offset, val) \
+ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
+# define MMIO_OUT32(base, offset, val) \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
+# 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)
-/*
- * testinx2 - returns true iff the bits in 'mask' of register 'port', index
- * 'ind' are readable & writable.
- */
-static __inline__ int
-#ifdef __STDC__
-testinx2(unsigned short int port, unsigned char ind, unsigned char mask)
-#else
-testinx2(port, ind, mask)
-unsigned short int port;
-unsigned char ind, mask;
-#endif
-{
- unsigned char old, new1, new2;
+# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
- old = rdinx(port, ind);
- wrinx(port, ind, old & ~mask);
- new1 = rdinx(port, ind) & mask;
- wrinx(port, ind, old | mask);
- new2 = rdinx(port, ind) & mask;
- wrinx(port, ind, old);
- return((new1 == 0) && (new2 == mask));
-}
+# endif /* __alpha__ */
/*
- * testinx - returns true iff all bits of register 'port', index 'ind' are
- * readable & writable.
+ * With Intel, the version in os-support/misc/SlowBcopy.s is used.
+ * This avoids port I/O during the copy (which causes problems with
+ * some hardware).
*/
-static __inline__ int
-#ifdef __STDC__
-testinx(unsigned short int port, unsigned char ind)
-#else
-testinx(port, ind, mask)
-unsigned short int port;
-unsigned char ind;
-#endif
-{
- return(testinx2(port, ind, 0xFF));
-}
-#endif /* NO_COMPILER_H_EXTRAS */
+# ifdef __alpha__
+# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
+# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
+# else /* __alpha__ */
+# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# endif /* __alpha__ */
-#endif /* NO_INLINE */
#endif /* _COMPILER_H */
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index ba00913d8..119adc5a6 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -1,743 +1,407 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.47.2.8 1998/02/24 19:05:53 hohndel Exp $ */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
- *
- */
-/* $Xorg: xf86.h,v 1.3 2000/08/17 19:50:28 cpqbld Exp $ */
-
-#ifndef _XF86_H
-#define _XF86_H
-
-#include "misc.h"
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "xf86_Option.h"
-
-/*
- * structure common for all modes
- */
-typedef struct _DispM {
- struct _DispM *prev,*next;
- char *name; /* identifier of this mode */
- /* These are the values that the user sees/provides */
- int Clock; /* pixel clock */
- int HDisplay; /* horizontal timing */
- int HSyncStart;
- int HSyncEnd;
- int HTotal;
- int HSkew;
- int VDisplay; /* vertical timing */
- int VSyncStart;
- int VSyncEnd;
- int VTotal;
- int Flags;
- /* These are the values the hardware uses */
- int SynthClock; /* Actual clock freq to be programmed */
- int CrtcHDisplay;
- int CrtcHSyncStart;
- int CrtcHSyncEnd;
- int CrtcHTotal;
- int CrtcHSkew;
- int CrtcVDisplay;
- int CrtcVSyncStart;
- int CrtcVSyncEnd;
- int CrtcVTotal;
- Bool CrtcHAdjusted;
- Bool CrtcVAdjusted;
- int PrivSize;
- INT32 *Private;
-} DisplayModeRec, *DisplayModePtr;
-
-#define V_PHSYNC 0x0001
-#define V_NHSYNC 0x0002
-#define V_PVSYNC 0x0004
-#define V_NVSYNC 0x0008
-#define V_INTERLACE 0x0010
-#define V_DBLSCAN 0x0020
-#define V_CSYNC 0x0040
-#define V_PCSYNC 0x0080
-#define V_NCSYNC 0x0100
-#define V_HSKEW 0x0200 /* hskew provided */
-#define V_PIXMUX 0x1000
-#define V_DBLCLK 0x2000
-#define V_CLKDIV2 0x4000
-
-/* The monitor description */
-
-#define MAX_HSYNC 8
-#define MAX_VREFRESH 8
-
-typedef struct { float hi, lo; } range;
-
-typedef struct {
- char *id;
- char *vendor;
- char *model;
- float EMPTY;
- int n_hsync;
- range hsync[MAX_HSYNC];
- int n_vrefresh;
- range vrefresh[MAX_VREFRESH];
- DisplayModePtr Modes, Last; /* Start and end of monitor's mode list */
-} MonRec, *MonPtr;
-
-#define MAXCLOCKS 128
-#define MAXDACSPEEDS 4 /* for <= 8, 16, 24, 32bpp */
-
-/* Set default max allowed clock to 90MHz */
-#define DEFAULT_MAX_CLOCK 90000
-
-/*
- * the graphic device
- */
-typedef struct {
- Bool configured;
- int tmpIndex;
- int scrnIndex;
- Bool (* Probe)(
-#if NeedNestedPrototypes
- void
-#endif
-);
- Bool (* Init)(
-#if NeedNestedPrototypes
- int scr_index,
- ScreenPtr pScreen,
- int argc,
- char **argv
-#endif
-);
- int (* ValidMode)(
-#if NeedNestedPrototypes
- DisplayModePtr target,
- Bool verbose,
- int flag
-#endif
-);
- void (* EnterLeaveVT)(
-#if NeedNestedPrototypes
- int,
- int
-#endif
-);
- void (* EnterLeaveMonitor)(
-#if NeedNestedPrototypes
- int
-#endif
-);
- void (* EnterLeaveCursor)(
-#if NeedNestedPrototypes
- int
-#endif
-);
- void (* AdjustFrame)(
-#if NeedNestedPrototypes
- int x,
- int y
-#endif
-);
- Bool (* SwitchMode)(
-#if NeedNestedPrototypes
- DisplayModePtr modes
-#endif
-);
- void (* DPMSSet)(
-#if NeedNestedPrototypes
- int level
-#endif
-);
- void (* PrintIdent)(
-#if NeedNestedPrototypes
- void
-#endif
-);
- int depth;
- xrgb weight;
- int bitsPerPixel;
- int defaultVisual;
- int virtualX,virtualY;
- int displayWidth;
- int frameX0, frameY0, frameX1, frameY1;
- OFlagSet options;
- OFlagSet clockOptions;
- OFlagSet xconfigFlag;
- char *chipset;
- char *ramdac;
- int dacSpeeds[MAXDACSPEEDS];
- int dacSpeedBpp;
- int clocks;
- int clock[MAXCLOCKS];
- int maxClock;
- int videoRam;
- int BIOSbase; /* Base address of video BIOS */
- unsigned long MemBase; /* Frame buffer base address */
- int width, height; /* real display dimensions */
- unsigned long speedup; /* Use SpeedUp code */
- DisplayModePtr modes;
- MonPtr monitor;
- char *clockprog;
- int textclock;
- Bool bankedMono; /* display supports banking for mono server */
- char *name;
- xrgb blackColour;
- xrgb whiteColour;
- int *validTokens;
- char *patchLevel;
- unsigned int IObase; /* AGX - video card I/O reg base */
- unsigned int DACbase; /* AGX - dac I/O reg base */
- unsigned long COPbase; /* AGX - coprocessor memory base */
- unsigned int POSbase; /* AGX - I/O address of POS regs */
- int instance; /* AGX - XGA video card instance number */
- int s3Madjust;
- int s3Nadjust;
- int s3MClk;
- int chipID;
- int chipRev;
- unsigned long VGAbase; /* AGX - 64K aperture memory address */
- int s3RefClk;
- int s3BlankDelay;
- int textClockFreq;
- char *DCConfig;
- char *DCOptions;
- int MemClk; /* General flag used for memory clocking */
- int LCDClk;
-#ifdef XFreeXDGA
- int directMode;
- void (*setBank)(
-#if NeedNestedPrototypes
- int
-#endif
- );
- unsigned long physBase;
- int physSize;
-#endif
-#ifdef XF86SETUP
- void *device; /* This should be GDevPtr, but it causes
- problems with include file order */
-#endif
-} ScrnInfoRec, *ScrnInfoPtr;
-
-typedef struct {
- int token; /* id of the token */
- char *name; /* pointer to the LOWERCASED name */
-} SymTabRec, *SymTabPtr;
-
-#define VGA_DRIVER 1
-#define V256_DRIVER 2
-#define WGA_DRIVER 3
-#define XGA_DRIVER 4
-
-#define ENTER 1
-#define LEAVE 0
-
-/* These are possible return values for xf86CheckMode() and ValidMode() */
-#define MODE_OK 0
-#define MODE_HSYNC 1 /* hsync out of range */
-#define MODE_VSYNC 2 /* vsync out of range */
-#define MODE_BAD 255 /* unspecified reason */
-
-/* These are the possible flags for ValidMode */
-#define MODE_USED 1 /* this mode is really being used in the */
- /* modes line of the Display Subsection */
-#define MODE_SUGGESTED 2 /* this mode is included in the available*/
- /* modes in the Monitor Section */
-#define MODE_VID 3 /* this is called from the VidMode extension */
-
-/* Indicates the level of DPMS support */
-typedef enum {
- DPMSSupportUnknown,
- DPMSNotSupported,
- DPMSFullSupport
-} DPMSSupportStatus;
-
-/* flags for xf86LookupMode */
-#define LOOKUP_DEFAULT 0 /* Use default mode lookup method */
-#define LOOKUP_BEST_REFRESH 1 /* Pick modes with best refresh */
-#define LOOKUP_NO_INTERLACED 2 /* Ignore interlaced modes */
-#define LOOKUP_FORCE_DEFAULT 4 /* Force default lookup method */
-
-#define INTERLACE_REFRESH_WEIGHT 1.5
-
-/* SpeedUp options */
-
-#define SPEEDUP_FILLBOX 1
-#define SPEEDUP_FILLRECT 2
-#define SPEEDUP_BITBLT 4
-#define SPEEDUP_LINE 8
-#define SPEEDUP_TEGBLT8 0x10
-#define SPEEDUP_RECTSTIP 0x20
-
-/*
- * This is the routines where SpeedUp is quicker than fXF86. The problem is
- * that the SpeedUp fillbox is better for drawing vertical and horizontal
- * line segments, and the fXF86 version is significantly better for
- * more general lines
- */
-#define SPEEDUP_BEST (SPEEDUP_FILLRECT | SPEEDUP_BITBLT | \
- SPEEDUP_LINE | SPEEDUP_TEGBLT8 | \
- SPEEDUP_RECTSTIP)
-/*
-#define SPEEDUP_BEST (SPEEDUP_FILLBOX | SPEEDUP_FILLRECT | \
- SPEEDUP_BITBLT | SPEEDUP_LINE | \
- SPEEDUP_TEGBLT8 | SPEEDUP_RECTSTIP)
-*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.169 2003/02/13 10:49:38 eich Exp $ */
/*
- * SpeedUp routines which are not dependent on the screen virtual resolution
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
*/
-#ifndef SPEEDUP_ANYWIDTH
-#define SPEEDUP_ANYWIDTH (SPEEDUP_FILLRECT | SPEEDUP_BITBLT | \
- SPEEDUP_LINE | SPEEDUP_FILLBOX)
-#endif
/*
- * SpeedUp routines which are not dependent on ET4000
+ * This file contains declarations for public XFree86 functions and variables,
+ * and definitions of public macros.
+ *
+ * "public" means available to video drivers.
*/
-#ifndef SPEEDUP_ANYCHIPSET
-#define SPEEDUP_ANYCHIPSET (SPEEDUP_TEGBLT8 | SPEEDUP_RECTSTIP)
-#endif
-
-/* All SpeedUps */
-#define SPEEDUP_ALL (SPEEDUP_FILLBOX | SPEEDUP_FILLRECT | \
- SPEEDUP_BITBLT | SPEEDUP_LINE | \
- SPEEDUP_TEGBLT8 | SPEEDUP_RECTSTIP)
-
-/* SpeedUp flags used if SpeedUp is not in XF86Config */
-#define SPEEDUP_DEFAULT SPEEDUP_ALL
-
-extern Bool xf86VTSema;
-/* Mouse device private record */
-
-#define MSE_MAPTOX (-1)
-#define MSE_MAPTOY (-2)
-#define MSE_MAXBUTTONS 12
-#define MSE_DFLTBUTTONS 3
-
-typedef struct _MouseDevRec {
- DeviceProc mseProc; /* procedure for initializing */
- void (* mseEvents)(
-#if NeedNestedPrototypes
- struct _MouseDevRec *
-#endif
- ); /* proc for processing events */
- DeviceIntPtr device;
- int mseFd;
- char *mseDevice;
- int mseType;
- int mseModel;
- int baudRate;
- int oldBaudRate;
- int sampleRate;
- int lastButtons;
- int threshold, num, den; /* acceleration */
- int buttons; /* # of buttons */
- int emulateState; /* automata state for 2 button mode */
- Bool emulate3Buttons;
- int emulate3Timeout; /* Timeout for 3 button emulation */
- Bool chordMiddle;
- int mouseFlags; /* Flags to Clear after opening mouse dev */
- int truebuttons; /* Arg to maintain before emulate3buttons timer callback */
-
- int resolution;
- int negativeZ;
- int positiveZ;
-#ifndef MOUSE_PROTOCOL_IN_KERNEL
- unsigned char protoPara[7];
-#endif
-
-#ifndef CSRG_BASED
- /* xque part */
- int xquePending; /* was xqueFd, but nothing uses that */
- int xqueSema;
-#endif
-#ifdef XINPUT
- struct _LocalDeviceRec *local;
-#endif
-} MouseDevRec, *MouseDevPtr;
+#ifndef _XF86_H
+#define _XF86_H
-#ifdef XINPUT
-#define MOUSE_DEV(dev) (MouseDevPtr) PRIVATE(dev)
+#include "xf86str.h"
+#include "xf86Opt.h"
+#include <X11/Xfuncproto.h>
+#ifndef IN_MODULE
+#include <stdarg.h>
#else
-#define MOUSE_DEV(dev) (MouseDevPtr) (dev)->public.devicePrivate
+#include "xf86_ansic.h"
+#endif
+
+#include "propertyst.h"
+
+/* General parameters */
+extern int xf86DoConfigure;
+extern Bool xf86DoConfigurePass1;
+extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */
+extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */
+extern int xf86PixmapIndex;
+extern Bool xf86ResAccessEnter;
+extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
+extern const unsigned char byte_reversed[256];
+extern PropertyPtr *xf86RegisteredPropertiesTable;
+extern ScrnInfoPtr xf86CurrentScreen;
+extern Bool pciSlotClaimed;
+extern Bool isaSlotClaimed;
+extern Bool fbSlotClaimed;
+#ifdef __sparc__
+extern Bool sbusSlotClaimed;
+#endif
+extern confDRIRec xf86ConfigDRI;
+extern Bool xf86inSuspend;
+
+#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
+
+#define XF86FLIP_PIXELS() \
+ do { \
+ if (xf86GetFlipPixels()) { \
+ pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
+ pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
+ } \
+ while (0)
+
+#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
+
+#define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \
+ (((p) == Pix24Use32) ? 32 : 0))
+
+/* variables for debugging */
+#ifdef BUILDDEBUG
+extern char* xf86p8bit[];
+extern CARD32 xf86DummyVar1;
+extern CARD32 xf86DummyVar2;
+extern CARD32 xf86DummyVar3;
#endif
-/* Global data */
-/* xf86Init.c */
-extern double xf86rGamma, xf86gGamma, xf86bGamma;
-
-#ifdef XF86VIDMODE
-extern Bool xf86VidModeEnabled;
-extern Bool xf86VidModeAllowNonLocal;
-#endif
-#ifdef XF86MISC
-extern Bool xf86MiscModInDevEnabled;
-extern Bool xf86MiscModInDevAllowNonLocal;
-#endif
-
-/* PCI probe flags */
-
-
-typedef enum {
- PCIProbe1 = 0,
- PCIProbe2,
- PCIForceConfig1,
- PCIForceConfig2
-} PciProbeType;
-
-extern PciProbeType xf86PCIFlags;
-
/* Function Prototypes */
#ifndef _NO_XF86_PROTOTYPES
-/* xf86Init.c */
-void InitOutput(
-#if NeedFunctionPrototypes
- ScreenInfo *pScreenInfo,
- int argc,
- char **argv
-#endif
-);
-
-void InitInput(
-#if NeedFunctionPrototypes
- int argc,
- char **argv
-#endif
-);
-
-void ddxGiveUp(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-void AbortDDX(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-int ddxProcessArgument(
-#if NeedFunctionPrototypes
- int argc,
- char *argv[],
- int i
-#endif
-);
-
-void ddxUseMsg(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-/* xf86Config.c */
-unsigned int StrToUL(
-#if NeedFunctionPrototypes
- char *str
-#endif
-);
-
-#ifndef CONFIG_RETURN_TYPE
-#ifdef XF86SETUP
-#define CONFIG_RETURN_TYPE int
-#else
-#define CONFIG_RETURN_TYPE void
-#endif
-#endif
-
-CONFIG_RETURN_TYPE xf86Config(
-#if NeedFunctionPrototypes
- int vtopen
-#endif
-);
-
-CONFIG_RETURN_TYPE configPointerSection(
-#if NeedFunctionPrototypes
- MouseDevPtr /*mouse_dev*/,
- int /*end_tag*/,
- char** /*devicename*/
-#endif
-);
-
-Bool xf86LookupMode(
-#if NeedFunctionPrototypes
- DisplayModePtr target,
- ScrnInfoPtr driver,
- int flags
-#endif
-);
-
-void xf86VerifyOptions(
-#if NeedFunctionPrototypes
- OFlagSet *allowedOptions,
- ScrnInfoPtr driver
-#endif
-);
-
-int xf86CheckMode(
-#if NeedFunctionPrototypes
- ScrnInfoPtr scrp,
- DisplayModePtr dispmp,
- MonPtr monp,
- int verbose
-#endif
-);
-
-int xf86GetNearestClock(
-#if NeedFunctionPrototypes
- ScrnInfoPtr Screen,
- int Frequency
-#endif
-);
-
+/* xf86Bus.c */
+
+Bool xf86CheckPciSlot(int bus, int device, int func);
+int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active);
+Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
+ int *func);
+Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
+void xf86FormatPciBusNumber(int busnum, char *buffer);
+pciVideoPtr *xf86GetPciVideoInfo(void);
+pciConfigPtr *xf86GetPciConfigInfo(void);
+void xf86SetPciVideo(pciVideoPtr, resType);
+void xf86PrintResList(int verb, resPtr list);
+resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
+int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+int xf86GetIsaInfoForScreen(int scrnIndex);
+int xf86GetFbInfoForScreen(int scrnIndex);
+Bool xf86ParseIsaBusString(const char *busID);
+int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+void xf86EnableAccess(ScrnInfoPtr pScrn);
+void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
+Bool xf86IsPrimaryPci(pciVideoPtr pPci);
+Bool xf86IsPrimaryIsa(void);
+int xf86CheckPciGAType(pciVideoPtr pPci);
+/* new RAC */
+resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
+resPtr xf86JoinResLists(resPtr rlist1, resPtr rlist2);
+resPtr xf86DupResList(const resPtr rlist);
+void xf86FreeResList(resPtr rlist);
+void xf86ClaimFixedResources(resList list, int entityIndex);
+Bool xf86DriverHasEntities(DriverPtr drvp);
+void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
+void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex,
+ int instance);
+int xf86GetNumEntityInstances(int entityIndex);
+GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
+void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+EntityInfoPtr xf86GetEntityInfo(int entityIndex);
+pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
+int xf86GetPciEntity(int bus, int dev, int func);
+Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer);
+void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type);
+resPtr xf86RegisterResources(int entityIndex, resList list,
+ unsigned long Access);
+Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base);
+void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
+ xf86SetAccessFuncPtr oldFuncs);
+Bool xf86IsEntityPrimary(int entityIndex);
+Bool xf86FixPciResource(int entityIndex, int prt, memType alignment,
+ unsigned long type);
+resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
+resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
+void xf86EnterServerState(xf86State state);
+resRange xf86GetBlock(unsigned long type, memType size,
+ memType window_start, memType window_end,
+ memType align_mask, resPtr avoid);
+resRange xf86GetSparse(unsigned long type, memType fixed_bits,
+ memType decode_mask, memType address_mask,
+ resPtr avoid);
+memType xf86ChkConflict(resRange *rgp, int entityIndex);
+Bool xf86IsPciDevPresent(int bus, int dev, int func);
+ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
+Bool xf86NoSharedResources(int screenIndex, resType res);
+resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2);
+pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
+ char n, pciVideoPtr pvp_exclude);
+pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
+ char n, pciVideoPtr pvp_exclude);
+#ifdef INCLUDE_DEPRECATED
+void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable);
+#endif
+void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
+Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
+#ifdef async
+Bool xf86QueueAsyncEvent(void (*func)(pointer),pointer arg);
+#endif
+
+int xf86GetLastScrnFlag(int entityIndex);
+void xf86SetLastScrnFlag(int entityIndex, int scrnIndex);
+Bool xf86IsEntityShared(int entityIndex);
+void xf86SetEntityShared(int entityIndex);
+Bool xf86IsEntitySharable(int entityIndex);
+void xf86SetEntitySharable(int entityIndex);
+Bool xf86IsPrimInitDone(int entityIndex);
+void xf86SetPrimInitDone(int entityIndex);
+void xf86ClearPrimInitDone(int entityIndex);
+int xf86AllocateEntityPrivateIndex(void);
+DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
+
+/* xf86Configure.c */
+GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
+ void *busData, int chipset);
+GDevPtr xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo,
+ int chipset);
+
/* xf86Cursor.c */
-void xf86InitViewport(
-#if NeedFunctionPrototypes
- ScrnInfoPtr pScr
-#endif
-);
-
-void xf86SetViewport(
-#if NeedFunctionPrototypes
- ScreenPtr pScreen,
- int x,
- int y
-#endif
-);
-
-void xf86LockZoom(
-#if NeedFunctionPrototypes
- ScreenPtr pScreen,
- int lock
-#endif
-);
-
-void xf86ZoomViewport(
-#if NeedFunctionPrototypes
- ScreenPtr pScreen,
- int zoom
-#endif
-);
-
-/* xf86Dl.c */
-void*
-xf86LoadModule(
-#if NeedFunctionPrototypes
- const char * file,
- const char * path
-#endif
-);
-
-/* xf86Events.c */
-int TimeSinceLastInputEvent(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-void SetTimeSinceLastInputEvent(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-void ProcessInputEvents(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-void xf86PostKbdEvent(
-#if NeedFunctionPrototypes
- unsigned key
-#endif
-);
-
-void xf86PostMseEvent(
-#if NeedFunctionPrototypes
- DeviceIntPtr device,
- int buttons,
- int dx,
- int dy
-#endif
-);
+void xf86LockZoom(ScreenPtr pScreen, int lock);
+void xf86InitViewport(ScrnInfoPtr pScr);
+void xf86SetViewport(ScreenPtr pScreen, int x, int y);
+void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
+Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
+void *xf86GetPointerScreenFuncs(void);
+void xf86InitOrigins(void);
+void xf86ReconfigureLayout(void);
+
+/* xf86DPMS.c */
-void xf86Block(
-#if NeedFunctionPrototypes
- pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadmask
-#endif
-);
+Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
-void xf86Wakeup(
-#if NeedFunctionPrototypes
- pointer blockData,
- int err,
- pointer pReadmask
-#endif
-);
+/* xf86DGA.c */
-void xf86SigHandler(
-#if NeedFunctionPrototypes
- int signo
-#endif
-);
-
-/* xf86Io.c */
-void xf86KbdBell(
-#if NeedFunctionPrototypes
- int percent,
- DeviceIntPtr pKeyboard,
- pointer ctrl,
- int unused
-#endif
-);
-
-void xf86KbdLeds(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
+ int num);
+xf86SetDGAModeProc xf86SetDGAMode;
-void xf86KbdCtrl(
-#if NeedFunctionPrototypes
- DevicePtr pKeyboard,
- KeybdCtrl *ctrl
-#endif
-);
-
-void xf86InitKBD(
-#if NeedFunctionPrototypes
- Bool init
-#endif
-);
-
-int xf86KbdProc(
-#if NeedFunctionPrototypes
- DeviceIntPtr pKeyboard,
- int what
-#endif
-);
-
-void xf86MseCtrl(
-#if NeedFunctionPrototypes
- DevicePtr pPointer,
- PtrCtrl *ctrl
-#endif
-);
-
-int GetMotionEvents(
-#if NeedFunctionPrototypes
- DeviceIntPtr,
- xTimecoord *,
- unsigned long,
- unsigned long,
- ScreenPtr
-#endif
-);
+/* xf86Events.c */
-int xf86MseProc(
-#if NeedFunctionPrototypes
- DeviceIntPtr pPointer,
- int what
-#endif
-);
+void SetTimeSinceLastInputEvent(void);
+pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
+int xf86RemoveInputHandler(pointer handler);
+void xf86DisableInputHandler(pointer handler);
+void xf86EnableInputHandler(pointer handler);
+void xf86InterceptSignals(int *signo);
+Bool xf86EnableVTSwitch(Bool new);
+Bool xf86CommonSpecialKey(int key, Bool down, int modifiers);
+void xf86ProcessActionEvent(ActionEvent action, void *arg);
+
+/* xf86Helper.c */
+
+void xf86AddDriver(DriverPtr driver, pointer module, int flags);
+void xf86DeleteDriver(int drvIndex);
+ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
+void xf86DeleteScreen(int scrnIndex, int flags);
+int xf86AllocateScrnInfoPrivateIndex(void);
+Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
+Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
+ int depth24flags);
+void xf86PrintDepthBpp(ScrnInfoPtr scrp);
+Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
+Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
+Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
+void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
+void xf86SetBlackWhitePixels(ScreenPtr pScreen);
+void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
+void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, va_list args);
+void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, ...);
+void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...);
+void xf86MsgVerb(MessageType type, int verb, const char *format, ...);
+void xf86Msg(MessageType type, const char *format, ...);
+void xf86ErrorFVerb(int verb, const char *format, ...);
+void xf86ErrorF(const char *format, ...);
+const char *xf86TokenToString(SymTabPtr table, int token);
+int xf86StringToToken(SymTabPtr table, const char *string);
+void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
+void xf86PrintChipsets(const char *drvname, const char *drvmsg,
+ SymTabPtr chips);
+int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
+int xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities);
+int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities);
+void xf86GetClocks(ScrnInfoPtr pScrn, int num,
+ Bool (*ClockFunc)(ScrnInfoPtr, int),
+ void (*ProtectRegs)(ScrnInfoPtr, Bool),
+ void (*BlankScreen)(ScrnInfoPtr, Bool),
+ IOADDRESS vertsyncreg, int maskval,
+ int knownclkindex, int knownclkvalue);
+void xf86SetPriority(Bool up);
+const char *xf86GetVisualName(int visual);
+int xf86GetVerbosity(void);
+Pix24Flags xf86GetPix24(void);
+int xf86GetDepth(void);
+rgb xf86GetWeight(void);
+Gamma xf86GetGamma(void);
+Bool xf86GetFlipPixels(void);
+const char *xf86GetServerName(void);
+Bool xf86ServerIsExiting(void);
+Bool xf86ServerIsResetting(void);
+Bool xf86ServerIsInitialising(void);
+Bool xf86ServerIsOnlyDetecting(void);
+Bool xf86ServerIsOnlyProbing(void);
+Bool xf86CaughtSignal(void);
+Bool xf86GetVidModeAllowNonLocal(void);
+Bool xf86GetVidModeEnabled(void);
+Bool xf86GetModInDevAllowNonLocal(void);
+Bool xf86GetModInDevEnabled(void);
+Bool xf86GetAllowMouseOpenFail(void);
+Bool xf86IsPc98(void);
+void xf86DisableRandR(void);
+CARD32 xf86GetVersion(void);
+CARD32 xf86GetModuleVersion(pointer module);
+pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
+pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
+pointer xf86LoadOneModule(char *name, pointer optlist);
+void xf86UnloadSubModule(pointer mod);
+Bool xf86LoaderCheckSymbol(const char *name);
+void xf86LoaderReqSymLists(const char **, ...);
+void xf86LoaderReqSymbols(const char *, ...);
+void xf86LoaderRefSymLists(const char **, ...);
+void xf86LoaderRefSymbols(const char *, ...);
+void xf86SetBackingStore(ScreenPtr pScreen);
+void xf86SetSilkenMouse(ScreenPtr pScreen);
+int xf86NewSerialNumber(WindowPtr p, pointer unused);
+pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options);
+void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
+ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex,PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+/* Obsolete! don't use */
+Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
+ int entityIndex,PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+/* Obsolete! don't use */
+Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn,
+ int entityIndex, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+Bool xf86IsScreenPrimary(int scrnIndex);
+int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
+ int format, unsigned long len,
+ pointer value);
+Bool xf86IsUnblank(int mode);
+
+#ifdef XFree86LOADER
+void xf86AddModuleInfo(ModuleInfoPtr info, pointer module);
+void xf86DeleteModuleInfo(int idx);
+#endif
+
+/* xf86Debug.c */
+#ifdef BUILDDEBUG
+ void xf86Break1(void);
+void xf86Break2(void);
+void xf86Break3(void);
+CARD8 xf86PeekFb8(CARD8 *p);
+CARD16 xf86PeekFb16(CARD16 *p);
+CARD32 xf86PeekFb32(CARD32 *p);
+void xf86PokeFb8(CARD8 *p, CARD8 v);
+void xf86PokeFb16(CARD16 *p, CARD16 v);
+void xf86PokeFb32(CARD16 *p, CARD32 v);
+CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset);
+CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset);
+CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset);
+void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v);
+void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v);
+void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v);
+extern void xf86SPTimestamp(xf86TsPtr* timestamp, char* string);
+extern void xf86STimestamp(xf86TsPtr* timestamp);
+#endif
+
+/* xf86Init.c */
-void xf86MseEvents(
-#if NeedFunctionPrototypes
- MouseDevPtr mouse
-#endif
-);
+PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
+int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
-CARD32 GetTimeInMillis(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+/* xf86Mode.c */
-void OsVendorInit(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ int DivFactor, int MulFactor, int *divider);
+const char *xf86ModeStatusToString(ModeStatus status);
+ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ ClockRangePtr clockRanges, LookupModeFlags strategy);
+ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
+ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ ClockRangePtr clockRanges,
+ LookupModeFlags strategy,
+ int maxPitch, int virtualX,
+ int virtualY);
+ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ int flags);
+int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch,
+ int minHeight, int maxHeight, int pitchInc,
+ int virtualX, int virtualY, int apertureSize,
+ LookupModeFlags strategy);
+void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
+void xf86PruneDriverModes(ScrnInfoPtr scrp);
+void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
+void xf86PrintModes(ScrnInfoPtr scrp);
+void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-/* xf86_Mouse.c */
-Bool xf86MouseSupported(
-#if NeedFunctionPrototypes
- int mousetype
-#endif
-);
+/* xf86Option.c */
-void xf86SetupMouse(
-#if NeedFunctionPrototypes
- MouseDevPtr mouse
-#endif
-);
+void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
-void xf86MouseProtocol(
-#if NeedFunctionPrototypes
- DeviceIntPtr device,
- unsigned char *rBuf,
- int nBytes
-#endif
-);
-#ifdef XINPUT
-void xf86MouseCtrl(
-#if NeedFunctionPrototypes
- DeviceIntPtr device,
- PtrCtrl *ctrl
-#endif
-);
+/* xf86RandR.c */
+#ifdef RANDR
+Bool xf86RandRInit (ScreenPtr pScreen);
+void xf86RandRSetInitialMode (ScreenPtr pScreen);
#endif
-/* xf86_PnPMouse.c */
-int xf86GetPnPMouseProtocol(
-#if NeedFunctionPrototypes
- MouseDevPtr mouse
-#endif
-);
+/* xf86VidModeExtentionInit.c */
-/* xf86Kbd.c */
-Bool LegalModifier(
-#if NeedFunctionPrototypes
- unsigned int key,
- DevicePtr pDev
-#endif
-);
+Bool VidModeExtensionInit(ScreenPtr pScreen);
-void xf86KbdGetMapping(
-#if NeedFunctionPrototypes
- KeySymsPtr pKeySyms,
- CARD8 *pModMap
-#endif
-);
#endif /* _NO_XF86_PROTOTYPES */
-/* End of Prototypes */
-
#endif /* _XF86_H */
-
-
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index e523dd0fc..1738222f5 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1,245 +1,98 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.269 2003/02/20 04:36:07 dawes Exp $ */
+
+
/*
- * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.113.2.17 1998/02/24 19:05:54 hohndel Exp $
+ * Copyright 1991-2002 by The XFree86 Project, Inc.
+ * Copyright 1997 by Metro Link, Inc.
*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ * Loosely based on code bearing the following copyright:
*
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
+ * <Put copyright message here>
+ *
+ * Author: Dirk Hohndel <hohndel@XFree86.Org> and others.
*/
-/* $Xorg: xf86Config.c,v 1.3 2000/08/17 19:50:28 cpqbld Exp $ */
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern double atof();
-extern char *getenv();
-#endif
-
-#define NEED_EVENTS 1
-#include "X.h"
-#include "Xproto.h"
-#include "Xmd.h"
-#include "input.h"
-#include "servermd.h"
-#include "scrnintstr.h"
-#ifdef DPMSExtension
-#include "opaque.h"
-extern CARD32 DPMSStandbyTime;
-extern CARD32 DPMSSuspendTime;
-extern CARD32 DPMSOffTime;
+#ifdef XF86DRI
+#include <sys/types.h>
+#include <grp.h>
#endif
-#define NO_COMPILER_H_EXTRAS
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "xf86Config.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#define INIT_CONFIG
-#include "xf86_Config.h"
-
-#ifdef XKB
-#include "inputstr.h"
-#include "XKBsrv.h"
-#endif
-
-#ifdef XF86SETUP
-#include "xfsconf.h"
-#endif
+#include "globals.h"
#ifdef XINPUT
#include "xf86Xinput.h"
-
-#ifndef XF86SETUP
-extern DeviceAssocRec mouse_assoc;
-#endif
+extern DeviceAssocRec mouse_assoc;
#endif
-#ifdef NEED_RETURN_VALUE
-#define HANDLE_RETURN(xx) if (xx == RET_ERROR) return RET_ERROR
-#else
-#define HANDLE_RETURN(xx) xx
+#ifdef XKB
+#define XKB_IN_SERVER
+#include "XKBsrv.h"
#endif
-#define CONFIG_BUF_LEN 1024
-
-static FILE * configFile = NULL;
-static int configStart = 0; /* start of the current token */
-static int configPos = 0; /* current readers position */
-static int configLineNo = 0; /* linenumber */
-static char *configBuf,*configRBuf; /* buffer for lines */
-static char *configPath; /* path to config file */
-static char *fontPath = NULL; /* font path */
-static char *modulePath = NULL; /* module path */
-static int pushToken = LOCK_TOKEN;
-static LexRec val; /* global return value */
-static char DCerr;
-static int scr_index = 0;
-
-#ifdef XF86SETUP
-#define STATIC_OR_NOT
-#else
-#define STATIC_OR_NOT static
+#ifdef RENDER
+#include "picture.h"
#endif
-STATIC_OR_NOT int n_monitors = 0;
-STATIC_OR_NOT MonPtr monitor_list = NULL;
-STATIC_OR_NOT int n_devices = 0;
-STATIC_OR_NOT GDevPtr device_list = NULL;
-
-static int screenno = -100; /* some little number ... */
-extern char *defaultFontPath;
-extern char *rgbPath;
-
-extern Bool xf86fpFlag, xf86coFlag, xf86sFlag;
-extern Bool xf86ScreensOpen;
-
-extern int defaultColorVisualClass;
-extern CARD32 defaultScreenSaverTime, ScreenSaverTime;
-
-char *xf86VisualNames[] = {
- "StaticGray",
- "GrayScale",
- "StaticColor",
- "PseudoColor",
- "TrueColor",
- "DirectColor"
-};
-
-static CONFIG_RETURN_TYPE configFilesSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static CONFIG_RETURN_TYPE configServerFlagsSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static CONFIG_RETURN_TYPE configKeyboardSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static CONFIG_RETURN_TYPE configDeviceSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static CONFIG_RETURN_TYPE configScreenSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static CONFIG_RETURN_TYPE configDisplaySubsection(
-#if NeedFunctionPrototypes
- DispPtr disp
-#endif
-);
-static CONFIG_RETURN_TYPE configMonitorSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static CONFIG_RETURN_TYPE configDynamicModuleSection(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-static char *xf86DCSaveLine(
-#if NeedFunctionPrototypes
-char *,
-int
-#endif
-);
-static char *xf86DCOption(
-#if NeedFunctionPrototypes
-char *,
-LexRec
-#endif
-);
-static char * xf86DCConcatOption(
-#if NeedFunctionPrototypes
-char *,
-char *
-#endif
-);
-#ifndef XF86SETUP
-static
-#endif
-CONFIG_RETURN_TYPE findConfigFile(
-#if NeedFunctionPrototypes
- char *filename,
- FILE **fp
-#endif
-);
-static int getScreenIndex(
-#if NeedFunctionPrototypes
- int token
-#endif
-);
-static int getStringToken(
-#if NeedFunctionPrototypes
- SymTabRec tab[]
-#endif
-);
-static CONFIG_RETURN_TYPE readVerboseMode(
-#if NeedFunctionPrototypes
- MonPtr monp
-#endif
-);
-static Bool validateGraphicsToken(
-#if NeedFunctionPrototypes
- int *validTokens,
- int token
-#endif
-);
-extern char * xf86GetPathElem(
-#if NeedFunctionPrototypes
- char **pnt
-#endif
-);
-static DisplayModePtr xf86PruneModes(
-#if NeedFunctionPrototypes
- MonPtr monp,
- DisplayModePtr allmodes,
- ScrnInfoPtr scrp,
- Bool card
-#endif
-);
-static char * xf86ValidateFontPath(
-#if NeedFunctionPrototypes
- char * /* path */
-#endif
-);
-#ifdef XINPUT
-extern CONFIG_RETURN_TYPE xf86ConfigExtendedInputSection(
-#if NeedFunctionPrototypes
- LexPtr pval
-#endif
-);
+#if (defined(i386) || defined(__i386__)) && \
+ (defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \
+ (defined(SVR4) && !defined(sun)) || defined(__GNU__))
+#define SUPPORT_PC98
#endif
-#ifdef XKB
-extern char *XkbInitialMap;
+/*
+ * These paths define the way the config file search is done. The escape
+ * sequences are documented in parser/scan.c.
+ */
+#ifndef ROOT_CONFIGPATH
+#define ROOT_CONFIGPATH "%A," "%R," \
+ "/etc/X11/%R," "%P/etc/X11/%R," \
+ "%E," "%F," \
+ "/etc/X11/%F," "%P/etc/X11/%F," \
+ "%D/%X," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#endif
+#ifndef USER_CONFIGPATH
+#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \
+ "/etc/X11/%G," "%P/etc/X11/%G," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#endif
+#ifndef PROJECTROOT
+#define PROJECTROOT "/usr/X11R6"
+#endif
+
+static char *fontPath = NULL;
+
+/* Forward declarations */
+static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
+ int scrnum, MessageType from);
+static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
+static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
+ Bool active);
+static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input,
+ MessageType from);
+static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
+static Bool addDefaultModes(MonPtr monitorp);
+#ifdef XF86DRI
+static Bool configDRI(XF86ConfDRIPtr drip);
#endif
-#define DIR_FILE "/fonts.dir"
-
/*
* xf86GetPathElem --
* Extract a single element from the font path string starting at
@@ -247,9 +100,8 @@ extern char *XkbInitialMap;
* updated to point to the start of the next element, or set to
* NULL if there are no more.
*/
-char *
-xf86GetPathElem(pnt)
- char **pnt;
+static char *
+xf86GetPathElem(char **pnt)
{
char *p1;
@@ -263,46 +115,6 @@ xf86GetPathElem(pnt)
}
/*
- * StrToUL --
- *
- * A portable, but restricted, version of strtoul(). It only understands
- * hex, octal, and decimal. But it's good enough for our needs.
- */
-unsigned int StrToUL(str)
-char *str;
-{
- int base = 10;
- char *p = str;
- unsigned int tot = 0;
-
- if (*p == '0') {
- p++;
- if (*p == 'x') {
- p++;
- base = 16;
- }
- else
- base = 8;
- }
- while (*p) {
- if ((*p >= '0') && (*p <= ((base == 8)?'7':'9'))) {
- tot = tot * base + (*p - '0');
- }
- else if ((base == 16) && (*p >= 'a') && (*p <= 'f')) {
- tot = tot * base + 10 + (*p - 'a');
- }
- else if ((base == 16) && (*p >= 'A') && (*p <= 'F')) {
- tot = tot * base + 10 + (*p - 'A');
- }
- else {
- return(tot);
- }
- p++;
- }
- return(tot);
-}
-
-/*
* xf86ValidateFontPath --
* Validates the user-specified font path. Each element that
* begins with a '/' is checked to make sure the directory exists.
@@ -310,31 +122,30 @@ char *str;
* is checked. If either check fails, an error is printed and the
* element is removed from the font path.
*/
-#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type))
+
+#define DIR_FILE "/fonts.dir"
static char *
-xf86ValidateFontPath(path)
- char *path;
+xf86ValidateFontPath(char *path)
{
char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
struct stat stat_buf;
int flag;
int dirlen;
- tmp_path = (char *)Xcalloc(strlen(path)+1);
+ tmp_path = xcalloc(1,strlen(path)+1);
out_pnt = tmp_path;
path_elem = NULL;
next = path;
while (next != NULL) {
path_elem = xf86GetPathElem(&next);
-#ifndef __EMX__
if (*path_elem == '/') {
- dir_elem = (char *)Xcalloc(strlen(path_elem) + 1);
+#ifndef __UNIXOS2__
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
if ((p1 = strchr(path_elem, ':')) != 0)
#else
/* OS/2 must prepend X11ROOT */
- if (*path_elem == '/') {
path_elem = (char*)__XOS2RedirRoot(path_elem);
- dir_elem = (char*)xcalloc(1, strlen(path_elem) + 1);
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
if (p1 = strchr(path_elem+2, ':'))
#endif
dirlen = p1 - path_elem;
@@ -344,29 +155,32 @@ xf86ValidateFontPath(path)
dir_elem[dirlen] = '\0';
flag = stat(dir_elem, &stat_buf);
if (flag == 0)
- if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR))
+ if (!S_ISDIR(stat_buf.st_mode))
flag = -1;
if (flag != 0) {
- ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem);
- ErrorF(" Entry deleted from font path.\n");
+ xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xfree(dir_elem);
continue;
}
else {
- p1 = (char *)xalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
+ p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
strcpy(p1, dir_elem);
strcat(p1, DIR_FILE);
flag = stat(p1, &stat_buf);
if (flag == 0)
- if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG))
+ if (!S_ISREG(stat_buf.st_mode))
flag = -1;
-#ifndef __EMX__
+#ifndef __UNIXOS2__
xfree(p1);
#endif
if (flag != 0) {
- ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n",
- dir_elem);
- ErrorF(" Entry deleted from font path.\n");
- ErrorF(" (Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ xf86Msg(X_WARNING,
+ "`fonts.dir' not found (or not valid) in \"%s\".\n",
+ dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ xfree(dir_elem);
continue;
}
}
@@ -385,3550 +199,2138 @@ xf86ValidateFontPath(path)
return(tmp_path);
}
+
/*
- * xf86GetToken --
- * Read next Token form the config file. Handle the global variable
- * pushToken.
+ * use the datastructure that the parser provides and pick out the parts
+ * that we need at this point
*/
-int
-xf86GetToken(tab)
- SymTabRec tab[];
+char **
+xf86ModulelistFromConfig(pointer **optlist)
{
- int c, i;
-
- /*
- * First check whether pushToken has a different value than LOCK_TOKEN.
- * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the other
- * case the next token must be read from the input.
- */
- if (pushToken == EOF) return(EOF);
- else if (pushToken == LOCK_TOKEN)
- {
-
- c = configBuf[configPos];
-
- /*
- * Get start of next Token. EOF is handled, whitespaces & comments are
- * skipped.
- */
- do {
- if (!c) {
- if (fgets(configBuf,CONFIG_BUF_LEN-1,configFile) == NULL)
- {
- return( pushToken = EOF );
- }
- configLineNo++;
- configStart = configPos = 0;
+ int count = 0;
+ char **modulearray;
+ pointer *optarray;
+ XF86LoadPtr modp;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ if (xf86configptr->conf_modules) {
+ /*
+ * Walk the list of modules in the "Module" section to determine how
+ * many we have.
+ */
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
}
-#ifndef __EMX__
- while (((c=configBuf[configPos++])==' ') || ( c=='\t') || ( c=='\n'));
-#else
- while (((c=configBuf[configPos++])==' ') || ( c=='\t') || ( c=='\n')
- || (c=='\r'));
-#endif
- if (c == '#') c = '\0';
- } while (!c);
-
- /* GJA -- handle '-' and ','
- * Be careful: "-hsync" is a keyword.
- */
- if ( (c == ',') && !isalpha(configBuf[configPos]) ) {
- configStart = configPos; return COMMA;
- } else if ( (c == '-') && !isalpha(configBuf[configPos]) ) {
- configStart = configPos; return DASH;
- }
+ }
+ if (count == 0)
+ return NULL;
- configStart = configPos;
- /*
- * Numbers are returned immediately ...
- */
- if (isdigit(c))
- {
- int base;
-
- if (c == '0')
- if ((configBuf[configPos] == 'x') ||
- (configBuf[configPos] == 'X'))
- base = 16;
- else
- base = 8;
- else
- base = 10;
-
- configRBuf[0] = c; i = 1;
- while (isdigit(c = configBuf[configPos++]) ||
- (c == '.') || (c == 'x') ||
- ((base == 16) && (((c >= 'a') && (c <= 'f')) ||
- ((c >= 'A') && (c <= 'F')))))
- configRBuf[i++] = c;
- configPos--; /* GJA -- one too far */
- configRBuf[i] = '\0';
- val.num = StrToUL(configRBuf);
- val.realnum = atof(configRBuf);
- return(NUMBER);
- }
-
- /*
- * All Strings START with a \" ...
- */
- else if (c == '\"')
- {
- i = -1;
- do {
- configRBuf[++i] = (c = configBuf[configPos++]);
-#ifndef __EMX__
- } while ((c != '\"') && (c != '\n') && (c != '\0'));
-#else
- } while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
-#endif
- configRBuf[i] = '\0';
- val.str = (char *)xalloc(strlen(configRBuf) + 1);
- strcpy(val.str, configRBuf); /* private copy ! */
- return(STRING);
- }
-
- /*
- * ... and now we MUST have a valid token. The search is
- * handled later along with the pushed tokens.
- */
- else
- {
- configRBuf[0] = c;
- i = 0;
- do {
- configRBuf[++i] = (c = configBuf[configPos++]);;
-#ifndef __EMX__
- } while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\0'));
-#else
- } while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0') );
-#endif
- configRBuf[i] = '\0'; i=0;
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ optarray = xnfalloc((count + 1) * sizeof(pointer));
+ count = 0;
+ if (xf86configptr->conf_modules) {
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ modulearray[count] = modp->load_name;
+ optarray[count] = modp->load_opt;
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
}
-
}
- else
- {
-
- /*
- * Here we deal with pushed tokens. Reinitialize pushToken again. If
- * the pushed token was NUMBER || STRING return them again ...
- */
- int temp = pushToken;
- pushToken = LOCK_TOKEN;
+ modulearray[count] = NULL;
+ optarray[count] = NULL;
+ if (optlist)
+ *optlist = optarray;
+ else
+ xfree(optarray);
+ return modulearray;
+}
+
+
+char **
+xf86DriverlistFromConfig()
+{
+ int count = 0;
+ int j;
+ char **modulearray;
+ screenLayoutPtr slp;
- if (temp == COMMA || temp == DASH) return(temp);
- if (temp == NUMBER || temp == STRING) return(temp);
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
}
-
- /*
- * Joop, at last we have to lookup the token ...
- */
- if (tab)
- {
- i = 0;
- while (tab[i].token != -1)
- if (StrCaseCmp(configRBuf,tab[i].name) == 0)
- return(tab[i].token);
- else
- i++;
+
+ /*
+ * Walk the list of driver lines in active "Device" sections to
+ * determine now many implicitly loaded modules there are.
+ *
+ */
+ if (xf86ConfigLayout.screens) {
+ slp = xf86ConfigLayout.screens;
+ while ((slp++)->screen) {
+ count++;
+ }
}
-
- return(ERROR_TOKEN); /* Error catcher */
-}
-/*
- * xf86GetToken --
- * Lookup a string if it is actually a token in disguise.
- */
-static int
-getStringToken(tab)
- SymTabRec tab[];
-{
- int i;
+ /*
+ * Handle the set of inactive "Device" sections.
+ */
+ j = 0;
+ while (xf86ConfigLayout.inactives[j++].identifier)
+ count++;
- for ( i = 0 ; tab[i].token != -1 ; i++ ) {
- if ( ! StrCaseCmp(tab[i].name,val.str) ) return tab[i].token;
- }
- return(ERROR_TOKEN);
-}
+ if (count == 0)
+ return NULL;
-/*
- * getScreenIndex --
- * Given the screen token, returns the index in xf86Screens, or -1 if
- * the screen type is not applicable to this server.
- */
-static int
-getScreenIndex(token)
- int token;
-{
- int i;
-
- for (i = 0; xf86ScreenNames[i] >= 0 && xf86ScreenNames[i] != token; i++)
- ;
- if (xf86ScreenNames[i] < 0)
- return(-1);
- else
- return(i);
-}
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ count = 0;
+ slp = xf86ConfigLayout.screens;
+ while (slp->screen) {
+ modulearray[count] = slp->screen->device->driver;
+ count++;
+ slp++;
+ }
-/*
- * validateGraphicsToken --
- * If token is a graphics token, check it is in the list of validTokens
- * XXXX This needs modifying to work as it did with the old format
- */
-static Bool
-validateGraphicsToken(validTokens, token)
- int *validTokens;
- int token;
-{
- int i;
+ j = 0;
- for (i = 0; ScreenTab[i].token >= 0 && ScreenTab[i].token != token; i++)
- ;
- if (ScreenTab[i].token < 0)
- return(FALSE); /* Not a graphics token */
+ while (xf86ConfigLayout.inactives[j].identifier)
+ modulearray[count++] = xf86ConfigLayout.inactives[j++].driver;
- for (i = 0; validTokens[i] >= 0 && validTokens[i] != token; i++)
- ;
- return(validTokens[i] >= 0);
-}
+ modulearray[count] = NULL;
-/*
- * xf86TokenToString --
- * returns the string corresponding to token
- */
-char *
-xf86TokenToString(table, token)
- SymTabPtr table;
- int token;
-{
- int i;
-
- for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
- ;
- if (table[i].token < 0)
- return("unknown");
- else
- return(table[i].name);
-}
-
-/*
- * xf86StringToToken --
- * returns the string corresponding to token
- */
-int
-xf86StringToToken(table, string)
- SymTabPtr table;
- char *string;
-{
- int i;
+ /* Remove duplicates */
+ for (count = 0; modulearray[count] != NULL; count++) {
+ int i;
- for (i = 0; table[i].token >= 0 && StrCaseCmp(string, table[i].name); i++)
- ;
- return(table[i].token);
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
+ }
+ return modulearray;
}
-
-/*
- * xf86ConfigError --
- * Print a READABLE ErrorMessage!!! All information that is
- * interesting is printed. Even a pointer to the erroneous place is
- * printed. Maybe our e-mail will be less :-)
- */
-#ifdef XF86SETUP
-int
-XF86SetupXF86ConfigError(msg)
-#else
-void
-xf86ConfigError(msg)
-#endif
- char *msg;
-{
- int i,j;
- ErrorF( "\nConfig Error: %s:%d\n\n%s", configPath, configLineNo, configBuf);
- for (i = 1, j = 1; i < configStart; i++, j++)
- if (configBuf[i-1] != '\t')
- ErrorF(" ");
- else
- do
- ErrorF(" ");
- while (((j++)%8) != 0);
- for (i = configStart; i <= configPos; i++) ErrorF("^");
- ErrorF("\n%s\n", msg);
-#ifdef NEED_RETURN_VALUE
- return RET_ERROR;
-#else
- exit(-1); /* simple exit ... */
-#endif
-}
-#ifndef XF86SETUP
-void
-xf86DeleteMode(infoptr, dispmp)
-ScrnInfoPtr infoptr;
-DisplayModePtr dispmp;
+Bool
+xf86BuiltinInputDriver(const char *name)
{
- if(infoptr->modes == dispmp)
- infoptr->modes = dispmp->next;
-
- if(dispmp->next == dispmp)
- FatalError("No valid modes found.\n");
-
- ErrorF("%s %s: Removing mode \"%s\" from list of valid modes.\n",
- XCONFIG_PROBED, infoptr->name, dispmp->name);
- dispmp->prev->next = dispmp->next;
- dispmp->next->prev = dispmp->prev;
-
- xfree(dispmp->name);
- xfree(dispmp);
+ if (xf86NameCmp(name, "keyboard") == 0)
+ return TRUE;
+ else
+ return FALSE;
}
-#endif
-/*
- * findConfigFile --
- * Locate the XF86Config file. Abort if not found.
- */
-#ifndef XF86SETUP
-static
-#endif
-CONFIG_RETURN_TYPE
-findConfigFile(filename, fp)
- char *filename;
- FILE **fp;
-{
-#define configFile (*fp)
-#define MAXPTRIES 6
- char *home = NULL;
- char *xconfig = NULL;
- char *xwinhome = NULL;
- char *configPaths[MAXPTRIES];
- int pcount = 0, idx;
- /*
- * First open if necessary the config file.
- * If the -xf86config flag was used, use the name supplied there (root only).
- * If $XF86CONFIG is a pathname, use it as the name of the config file (root)
- * If $XF86CONFIG is set but doesn't contain a '/', append it to 'XF86Config'
- * and search the standard places (root only).
- * If $XF86CONFIG is not set, just search the standard places.
- */
- while (!configFile) {
+char **
+xf86InputDriverlistFromConfig()
+{
+ int count = 0;
+ char **modulearray;
+ IDevPtr idp;
/*
- * configPaths[0] is used as a buffer for -xf86config
- * and $XF86CONFIG if it contains a path
- * configPaths[1...MAXPTRIES-1] is used to store the paths of each of
- * the other attempts
- */
- for (pcount = idx = 0; idx < MAXPTRIES; idx++)
- configPaths[idx] = NULL;
-
- /*
- * First check if the -xf86config option was used.
- */
- configPaths[pcount] = (char *)xalloc(PATH_MAX);
-#ifndef __EMX__
- if (getuid() == 0 && xf86ConfigFile[0])
-#else
- if (xf86ConfigFile[0])
-#endif
- {
- strcpy(configPaths[pcount], xf86ConfigFile);
- if ((configFile = fopen(configPaths[pcount], "r")) != 0)
- break;
- else
- FatalError(
- "Cannot read file \"%s\" specified by the -xf86config flag\n",
- configPaths[pcount]);
- }
- /*
- * Check if XF86CONFIG is set.
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
*/
-#ifndef __EMX__
- if (getuid() == 0
- && (xconfig = getenv("XF86CONFIG")) != 0
- && index(xconfig, '/'))
-#else
- /* no root available, and filenames start with drive letter */
- if ((xconfig = getenv("XF86CONFIG")) != 0
- && isalpha(xconfig[0])
- && xconfig[1]==':')
-#endif
- {
- strcpy(configPaths[pcount], xconfig);
- if ((configFile = fopen(configPaths[pcount], "r")) != 0)
- break;
- else
- FatalError(
- "Cannot read file \"%s\" specified by XF86CONFIG variable\n",
- configPaths[pcount]);
- }
-
-#ifndef __EMX__
- /*
- * ~/XF86Config ...
- */
- if (getuid() == 0 && (home = getenv("HOME"))) {
- configPaths[++pcount] = (char *)xalloc(PATH_MAX);
- strcpy(configPaths[pcount],home);
- strcat(configPaths[pcount],"/XF86Config");
- if (xconfig) strcat(configPaths[pcount],xconfig);
- if ((configFile = fopen( configPaths[pcount], "r" )) != 0) break;
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
}
/*
- * /etc/XF86Config
- */
- configPaths[++pcount] = (char *)xalloc(PATH_MAX);
- strcpy(configPaths[pcount], "/etc/XF86Config");
- if (xconfig) strcat(configPaths[pcount],xconfig);
- if ((configFile = fopen( configPaths[pcount], "r" )) != 0) break;
-
- /*
- * $(LIBDIR)/XF86Config.<hostname>
+ * Walk the list of driver lines in active "InputDevice" sections to
+ * determine now many implicitly loaded modules there are.
*/
+ if (xf86ConfigLayout.inputs) {
+ idp = xf86ConfigLayout.inputs;
+ while (idp->identifier) {
+ if (!xf86BuiltinInputDriver(idp->driver))
+ count++;
+ idp++;
+ }
+ }
- configPaths[++pcount] = (char *)xalloc(PATH_MAX);
- if (getuid() == 0 && (xwinhome = getenv("XWINHOME")) != NULL)
- sprintf(configPaths[pcount], "%s/lib/X11/XF86Config", xwinhome);
- else
- strcpy(configPaths[pcount], SERVER_CONFIG_FILE);
- if (getuid() == 0 && xconfig) strcat(configPaths[pcount],xconfig);
- strcat(configPaths[pcount], ".");
-#ifdef AMOEBA
- {
- extern char *XServerHostName;
+ if (count == 0)
+ return NULL;
- strcat(configPaths[pcount], XServerHostName);
- }
-#else
- gethostname(configPaths[pcount]+strlen(configPaths[pcount]),
- MAXHOSTNAMELEN);
-#endif
- if ((configFile = fopen( configPaths[pcount], "r" )) != 0) break;
-#endif /* !__EMX__ */
-
/*
- * $(LIBDIR)/XF86Config
+ * allocate the memory and walk the list again to fill in the pointers
*/
- configPaths[++pcount] = (char *)xalloc(PATH_MAX);
-#ifndef __EMX__
- if (getuid() == 0 && xwinhome)
- sprintf(configPaths[pcount], "%s/lib/X11/XF86Config", xwinhome);
- else
- strcpy(configPaths[pcount], SERVER_CONFIG_FILE);
- if (getuid() == 0 && xconfig) strcat(configPaths[pcount],xconfig);
-#else
- /* we explicitly forbid numerous config files everywhere for OS/2;
- * users should consider them lucky to have one in a standard place
- * and another one with the -xf86config option
- */
- xwinhome = getenv("X11ROOT"); /* get drive letter */
- if (!xwinhome) FatalError("X11ROOT environment variable not set\n");
- strcpy(configPaths[pcount], __XOS2RedirRoot("/XFree86/lib/X11/XConfig"));
-#endif
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ count = 0;
+ idp = xf86ConfigLayout.inputs;
+ while (idp->identifier) {
+ if (!xf86BuiltinInputDriver(idp->driver)) {
+ modulearray[count] = idp->driver;
+ count++;
+ }
+ idp++;
+ }
+ modulearray[count] = NULL;
- if ((configFile = fopen( configPaths[pcount], "r" )) != 0) break;
-
- ErrorF("\nCould not find config file!\n");
- ErrorF("- Tried:\n");
- for (idx = 1; idx <= pcount; idx++)
- if (configPaths[idx] != NULL)
- ErrorF(" %s\n", configPaths[idx]);
- FatalError("No config file found!\n%s", getuid() == 0 ? "" :
- "Note, the X server no longer looks for XF86Config in $HOME");
- }
- strcpy(filename, configPaths[pcount]);
- if (xf86Verbose) {
- ErrorF("XF86Config: %s\n", filename);
- ErrorF("%s stands for supplied, %s stands for probed/default values\n",
- XCONFIG_GIVEN, XCONFIG_PROBED);
- }
- for (idx = 0; idx <= pcount; idx++)
- if (configPaths[idx] != NULL)
- xfree(configPaths[idx]);
-#undef configFile
-#undef MAXPTRIES
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
-#endif
+ /* Remove duplicates */
+ for (count = 0; modulearray[count] != NULL; count++) {
+ int i;
+
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
+ }
+ return modulearray;
}
-static DisplayModePtr pNew, pLast;
-static Bool graphFound = FALSE;
/*
- * xf86GetNearestClock --
- * Find closest clock to given frequency (in kHz). This assumes the
- * number of clocks is greater than zero.
+ * Generate a compiled-in list of driver names. This is used to produce a
+ * consistent probe order. For the loader server, we also look for vendor-
+ * provided modules, pre-pending them to our own list.
*/
-int
-xf86GetNearestClock(Screen, Frequency)
- ScrnInfoPtr Screen;
- int Frequency;
+static char **
+GenerateDriverlist(char * dirname, char * drivernames)
{
- int NearestClock = 0;
- int MinimumGap = abs(Frequency - Screen->clock[0]);
- int i;
- for (i = 1; i < Screen->clocks; i++)
- {
- int Gap = abs(Frequency - Screen->clock[i]);
- if (Gap < MinimumGap)
+ char *cp, **driverlist;
+ int count;
+
+ /* Count the number needed */
+ count = 0;
+ cp = drivernames;
+ while (*cp) {
+ while (*cp && isspace(*cp)) cp++;
+ if (!*cp) break;
+ count++;
+ while (*cp && !isspace(*cp)) cp++;
+ }
+
+ if (!count)
+ return NULL;
+
+ /* Now allocate the array of pointers to 0-terminated driver names */
+ driverlist = (char **)xnfalloc((count + 1) * sizeof(char *));
+ count = 0;
+ cp = drivernames;
+ while (*cp) {
+ while (*cp && isspace(*cp)) cp++;
+ if (!*cp) break;
+ driverlist[count++] = cp;
+ while (*cp && !isspace(*cp)) cp++;
+ if (!*cp) break;
+ *cp++ = 0;
+ }
+ driverlist[count] = NULL;
+
+#ifdef XFree86LOADER
{
- MinimumGap = Gap;
- NearestClock = i;
+ const char *subdirs[] = {NULL, NULL};
+ static const char *patlist[] = {"(.*)_drv\\.so", "(.*)_drv\\.o", NULL};
+ char **dlist, **clist, **dcp, **ccp;
+ int size;
+
+ subdirs[0] = dirname;
+
+ /* Get module list */
+ dlist = LoaderListDirs(subdirs, patlist);
+ if (!dlist) {
+ xfree(driverlist);
+ return NULL; /* No modules, no list */
+ }
+
+ clist = driverlist;
+
+ /* The resulting list cannot be longer than the module list */
+ for (dcp = dlist, count = 0; *dcp++; count++);
+ driverlist = (char **)xnfalloc((size = count + 1) * sizeof(char *));
+
+ /* First, add modules not in compiled-in list */
+ for (count = 0, dcp = dlist; *dcp; dcp++) {
+ for (ccp = clist; ; ccp++) {
+ if (!*ccp) {
+ driverlist[count++] = *dcp;
+ if (count >= size)
+ driverlist = (char**)
+ xnfrealloc(driverlist, ++size * sizeof(char*));
+ break;
+ }
+ if (!strcmp(*ccp, *dcp))
+ break;
+ }
+ }
+
+ /* Next, add compiled-in names that are also modules */
+ for (ccp = clist; *ccp; ccp++) {
+ for (dcp = dlist; *dcp; dcp++) {
+ if (!strcmp(*ccp, *dcp)) {
+ driverlist[count++] = *ccp;
+ if (count >= size)
+ driverlist = (char**)
+ xnfrealloc(driverlist, ++size * sizeof(char*));
+ break;
+ }
+ }
+ }
+
+ driverlist[count] = NULL;
+ xfree(clist);
+ xfree(dlist);
}
- }
- return NearestClock;
+#endif /* XFree86LOADER */
+
+ return driverlist;
}
-/*
- * xf86Config --
- * Fill some internal structure with userdefined setups. Many internal
- * Structs are initialized. The drivers are selected and initialized.
- * if (! vtopen), XF86Config is read, but devices are not probed.
- * if (vtopen), devices are probed (and modes resolved).
- * The vtopen argument was added so that XF86Config information could be
- * made available before the VT is opened.
- */
-CONFIG_RETURN_TYPE
-xf86Config (vtopen)
- int vtopen;
+
+char **
+xf86DriverlistFromCompile(void)
{
- int token;
- int i, j;
-#if defined(SYSV) || defined(linux)
- int xcpipe[2];
-#endif
-#ifdef XINPUT
- LocalDevicePtr local;
-#endif
-
- if (!vtopen)
- {
+ static char **driverlist = NULL;
+ static Bool generated = FALSE;
- OFLG_ZERO(&GenericXF86ConfigFlag);
- configBuf = (char*)xalloc(CONFIG_BUF_LEN);
- configRBuf = (char*)xalloc(CONFIG_BUF_LEN);
- configPath = (char*)xalloc(PATH_MAX);
-
- configBuf[0] = '\0'; /* sanity ... */
-
- /*
- * Read the XF86Config file with the real uid to avoid security problems
- *
- * For SYSV we fork, and send the data back to the parent through a pipe
- */
-#if defined(SYSV) || defined(linux)
- if (getuid() != 0) {
- if (pipe(xcpipe))
- FatalError("Pipe failed (%s)\n", strerror(errno));
- switch (fork()) {
- case -1:
- FatalError("Fork failed (%s)\n", strerror(errno));
- break;
- case 0: /* child */
- close(xcpipe[0]);
- setuid(getuid());
- HANDLE_RETURN(findConfigFile(configPath, &configFile));
- {
- unsigned char pbuf[CONFIG_BUF_LEN];
- int nbytes;
-
- /* Pass the filename back as the first line */
- strcat(configPath, "\n");
- if (write(xcpipe[1], configPath, strlen(configPath)) < 0)
- FatalError("Child error writing to pipe (%s)\n", strerror(errno));
- while ((nbytes = fread(pbuf, 1, CONFIG_BUF_LEN, configFile)) > 0)
- if (write(xcpipe[1], pbuf, nbytes) < 0)
- FatalError("Child error writing to pipe (%s)\n", strerror(errno));
- }
- close(xcpipe[1]);
- fclose(configFile);
- exit(0);
- break;
- default: /* parent */
- close(xcpipe[1]);
- configFile = (FILE *)fdopen(xcpipe[0], "r");
- if (fgets(configPath, PATH_MAX, configFile) == NULL)
- FatalError("Error reading config file\n");
- configPath[strlen(configPath) - 1] = '\0';
- }
- }
- else {
- HANDLE_RETURN(findConfigFile(configPath, &configFile));
- }
-#else /* ! (SYSV || linux) */
- {
-#ifndef __EMX__ /* in OS/2 we don't care about uids */
- int real_uid = getuid();
+ /* This string is modified in-place */
+ static char drivernames[] = DRIVERS;
- if (real_uid) {
-#ifdef MINIX
- setuid(getuid());
-#else
-#if !defined(SVR4) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
- setruid(0);
-#endif
- seteuid(real_uid);
-#endif /* MINIX */
+ if (!generated) {
+ generated = TRUE;
+ driverlist = GenerateDriverlist("drivers", drivernames);
}
-#endif /* __EMX__ */
- HANDLE_RETURN(findConfigFile(configPath, &configFile));
-#if defined(MINIX) || defined(__EMX__)
- /* no need to restore the uid to root */
-#else
- if (real_uid) {
- seteuid(0);
-#if !defined(SVR4) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
- setruid(real_uid);
-#endif
+ return driverlist;
+}
+
+
+char **
+xf86InputDriverlistFromCompile(void)
+{
+ static char **driverlist = NULL;
+ static Bool generated = FALSE;
+
+ /* This string is modified in-place */
+ static char drivernames[] = IDRIVERS;
+
+ if (!generated) {
+ generated = TRUE;
+ driverlist = GenerateDriverlist("input", drivernames);
}
-#endif /* MINIX */
- }
-#endif /* SYSV || linux */
- xf86Info.sharedMonitor = FALSE;
- xf86Info.kbdProc = NULL;
- xf86Info.notrapSignals = FALSE;
- xf86Info.caughtSignal = FALSE;
-
- /* Allocate mouse device */
-#if defined(XINPUT) && !defined(XF86SETUP)
- local = mouse_assoc.device_allocate();
- xf86Info.mouseLocal = (pointer) local;
- xf86Info.mouseDev = (MouseDevPtr) local->private;
- xf86Info.mouseDev->mseProc = NULL;
-#else
- xf86Info.mouseDev = (MouseDevPtr) Xcalloc(sizeof(MouseDevRec));
-#endif
-
- while ((token = xf86GetToken(TopLevelTab)) != EOF) {
- switch(token) {
- case SECTION:
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("section name string expected");
- if ( StrCaseCmp(val.str, "files") == 0 ) {
- HANDLE_RETURN(configFilesSection());
- } else if ( StrCaseCmp(val.str, "serverflags") == 0 ) {
- HANDLE_RETURN(configServerFlagsSection());
- } else if ( StrCaseCmp(val.str, "keyboard") == 0 ) {
- HANDLE_RETURN(configKeyboardSection());
- } else if ( StrCaseCmp(val.str, "pointer") == 0 ) {
- HANDLE_RETURN(configPointerSection(xf86Info.mouseDev, ENDSECTION, NULL));
- } else if ( StrCaseCmp(val.str, "device") == 0 ) {
- HANDLE_RETURN(configDeviceSection());
- } else if ( StrCaseCmp(val.str, "monitor") == 0 ) {
- HANDLE_RETURN(configMonitorSection());
- } else if ( StrCaseCmp(val.str, "screen") == 0 ) {
- HANDLE_RETURN(configScreenSection());
-#ifdef XINPUT
- } else if ( StrCaseCmp(val.str, "xinput") == 0 ) {
- HANDLE_RETURN(xf86ConfigExtendedInputSection(&val));
-#endif
- } else if ( StrCaseCmp(val.str, "module") == 0 ) {
- HANDLE_RETURN(configDynamicModuleSection());
- } else {
- xf86ConfigError("not a recognized section name");
- }
- break;
- }
- }
-
- fclose(configFile);
- xfree(configBuf);
- xfree(configRBuf);
- xfree(configPath);
-
- /* These aren't needed after the XF86Config file has been read */
-#ifndef XF86SETUP
- if (monitor_list)
- xfree(monitor_list);
- if (device_list)
- xfree(device_list);
-#endif
- if (modulePath)
- xfree(modulePath);
-
-#if defined(SYSV) || defined(linux)
- if (getuid() != 0) {
- /* Wait for the child */
- wait(NULL);
- }
-#endif
-
+
+ return driverlist;
+}
+
+
+/*
+ * xf86ConfigError --
+ * Print a READABLE ErrorMessage!!! All information that is
+ * available is printed.
+ */
+static void
+xf86ConfigError(char *msg, ...)
+{
+ va_list ap;
+
+ ErrorF("\nConfig Error:\n");
+ va_start(ap, msg);
+ VErrorF(msg, ap);
+ va_end(ap);
+ ErrorF("\n");
+ return;
+}
+
+static Bool
+configFiles(XF86ConfFilesPtr fileconf)
+{
+ MessageType pathFrom = X_DEFAULT;
+
+ /* FontPath */
+
/* Try XF86Config FontPath first */
- if (!xf86fpFlag)
- if (fontPath) {
- char *f = xf86ValidateFontPath(fontPath);
+ if (!xf86fpFlag) {
+ if (fileconf) {
+ if (fileconf->file_fontpath) {
+ char *f = xf86ValidateFontPath(fileconf->file_fontpath);
+ pathFrom = X_CONFIG;
if (*f)
defaultFontPath = f;
- else
- ErrorF(
- "Warning: FontPath is completely invalid. Using compiled-in default.\n"
- );
- xfree(fontPath);
- fontPath = (char *)NULL;
- }
- else
- ErrorF("Warning: No FontPath specified, using compiled-in default.\n");
- else /* Use fontpath specified with '-fp' */
- {
- OFLG_CLR (XCONFIG_FONTPATH, &GenericXF86ConfigFlag);
+ else {
+ xf86Msg(X_WARNING,
+ "FontPath is completely invalid. Using compiled-in default.\n");
+ fontPath = NULL;
+ pathFrom = X_DEFAULT;
+ }
+ }
+ } else {
+ xf86Msg(X_WARNING,
+ "No FontPath specified. Using compiled-in default.\n");
+ pathFrom = X_DEFAULT;
+ }
+ } else {
+ /* Use fontpath specified with '-fp' */
if (fontPath)
{
- xfree(fontPath);
- fontPath = (char *)NULL;
+ fontPath = NULL;
}
+ pathFrom = X_CMDLINE;
}
- if (!fontPath) {
- /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ if (!fileconf) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
could be static, so we make a copy. */
- char *f = (char *)xalloc(strlen(defaultFontPath) + 1);
+ char *f = xnfalloc(strlen(defaultFontPath) + 1);
f[0] = '\0';
strcpy (f, defaultFontPath);
defaultFontPath = xf86ValidateFontPath(f);
xfree(f);
+ } else {
+ if (fileconf) {
+ if (!fileconf->file_fontpath) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ could be static, so we make a copy. */
+ char *f = xnfalloc(strlen(defaultFontPath) + 1);
+ f[0] = '\0';
+ strcpy (f, defaultFontPath);
+ defaultFontPath = xf86ValidateFontPath(f);
+ xfree(f);
+ }
+ }
}
- else
- xfree(fontPath);
/* If defaultFontPath is still empty, exit here */
if (! *defaultFontPath)
- FatalError("No valid FontPath could be found\n");
- if (xf86Verbose)
- ErrorF("%s FontPath set to \"%s\"\n",
- OFLG_ISSET(XCONFIG_FONTPATH, &GenericXF86ConfigFlag) ? XCONFIG_GIVEN :
- XCONFIG_PROBED, defaultFontPath);
-
- if (!xf86Info.kbdProc)
- FatalError("You must specify a keyboard in XF86Config");
- if (!xf86Info.mouseDev->mseProc)
- FatalError("You must specify a mouse in XF86Config");
-
- if (!graphFound)
- {
- Bool needcomma = FALSE;
+ FatalError("No valid FontPath could be found.");
- ErrorF("\nYou must provide a \"Screen\" section in XF86Config for at\n");
- ErrorF("least one of the following graphics drivers: ");
- for (i = 0; i < xf86MaxScreens; i++)
- {
- if (xf86Screens[i])
- {
- ErrorF("%s%s", needcomma ? ", " : "",
- xf86TokenToString(DriverTab, xf86ScreenNames[i]));
- needcomma = TRUE;
- }
+ xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath);
+
+ /* RgbPath */
+
+ pathFrom = X_DEFAULT;
+
+ if (xf86coFlag)
+ pathFrom = X_CMDLINE;
+ else if (fileconf) {
+ if (fileconf->file_rgbpath) {
+ rgbPath = fileconf->file_rgbpath;
+ pathFrom = X_CONFIG;
}
- ErrorF("\n");
- FatalError("No configured graphics devices");
}
- }
-#ifndef XF86SETUP
- else /* if (vtopen) */
- {
- /*
- * Probe all configured screens for letting them resolve their modes
- */
- xf86ScreensOpen = TRUE;
- for ( i=0; i < xf86MaxScreens; i++ )
- if (xf86Screens[i] && xf86Screens[i]->configured &&
- (xf86Screens[i]->configured = (xf86Screens[i]->Probe)())){
- /* if driver doesn't report error do it here */
- if(xf86DCGetToken(xf86Screens[i]->DCConfig,NULL,DeviceTab) != EOF){
- xf86DCConfigError("Unknown device section keyword");
- FatalError("\n");
- }
- if(xf86Screens[i]->DCOptions){
- xf86DCGetOption(xf86Screens[i]->DCOptions,NULL);
- FatalError("\n");
- }
- xf86InitViewport(xf86Screens[i]);
+
+ xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath);
+
+ if (fileconf && fileconf->file_inputdevs) {
+ xf86InputDeviceList = fileconf->file_inputdevs;
+ xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n",
+ xf86InputDeviceList);
+ }
+
+
+#ifdef XFree86LOADER
+ /* ModulePath */
+
+ if (fileconf) {
+ if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+ xf86ModulePath = fileconf->file_modulepath;
+ xf86ModPathFrom = X_CONFIG;
}
+ }
+ xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
+#endif
+
+#if 0
+ /* LogFile */
/*
- * Now sort the drivers to match the order of the ScreenNumbers
- * requested by the user. (sorry, slow bubble-sort here)
- * Note, that after this sorting the first driver that is not configured
- * can be used as last-mark for all configured ones.
+ * XXX The problem with this is that the log file is already open.
+ * One option might be to copy the exiting contents to the new location.
+ * and re-open it. The down side is that the default location would
+ * already have been overwritten. Another option would be to start with
+ * unique temporary location, then copy it once the correct name is known.
+ * A problem with this is what happens if the server exits before that
+ * happens.
*/
- for ( j = 0; j < xf86MaxScreens-1; j++)
- for ( i=0; i < xf86MaxScreens-j-1; i++ )
- if (!xf86Screens[i] || !xf86Screens[i]->configured ||
- (xf86Screens[i+1] && xf86Screens[i+1]->configured &&
- (xf86Screens[i+1]->tmpIndex < xf86Screens[i]->tmpIndex)))
- {
- ScrnInfoPtr temp = xf86Screens[i+1];
- xf86Screens[i+1] = xf86Screens[i];
- xf86Screens[i] = temp;
- }
+ if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
+ xf86LogFile = fileconf->file_logfile;
+ xf86LogFileFrom = X_CONFIG;
+ }
+#endif
+
+ return TRUE;
+}
- }
-#endif /* XF86SETUP */
+typedef enum {
+ FLAG_NOTRAPSIGNALS,
+ FLAG_DONTVTSWITCH,
+ FLAG_DONTZAP,
+ FLAG_DONTZOOM,
+ FLAG_DISABLEVIDMODE,
+ FLAG_ALLOWNONLOCAL,
+ FLAG_DISABLEMODINDEV,
+ FLAG_MODINDEVALLOWNONLOCAL,
+ FLAG_ALLOWMOUSEOPENFAIL,
+ FLAG_VTINIT,
+ FLAG_VTSYSREQ,
+ FLAG_XKBDISABLE,
+ FLAG_PCIPROBE1,
+ FLAG_PCIPROBE2,
+ FLAG_PCIFORCECONFIG1,
+ FLAG_PCIFORCECONFIG2,
+ FLAG_PCIFORCENONE,
+ FLAG_PCIOSCONFIG,
+ FLAG_SAVER_BLANKTIME,
+ FLAG_DPMS_STANDBYTIME,
+ FLAG_DPMS_SUSPENDTIME,
+ FLAG_DPMS_OFFTIME,
+ FLAG_PIXMAP,
+ FLAG_PC98,
+ FLAG_ESTIMATE_SIZES_AGGRESSIVELY,
+ FLAG_NOPM,
+ FLAG_XINERAMA,
+ FLAG_ALLOW_DEACTIVATE_GRABS,
+ FLAG_ALLOW_CLOSEDOWN_GRABS,
+ FLAG_LOG,
+ FLAG_RENDER_COLORMAP_MODE,
+ FLAG_HANDLE_SPECIAL_KEYS,
+ FLAG_RANDR
+} FlagValues;
+
+static OptionInfoRec FlagOptions[] = {
+ { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEMODINDEV, "DisableModInDev", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_MODINDEVALLOWNONLOCAL, "AllowNonLocalModInDev", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_VTINIT, "VTInit", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIPROBE1, "PciProbe1" , OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIPROBE2, "PciProbe2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCECONFIG1, "PciForceConfig1", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCECONFIG2, "PciForceConfig2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCENONE, "PciForceNone", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIOSCONFIG, "PciOsConfig", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PC98, "PC98", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ESTIMATE_SIZES_AGGRESSIVELY,"EstimateSizesAggressively",OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOW_DEACTIVATE_GRABS,"AllowDeactivateGrabs", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_LOG, "Log", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_HANDLE_SPECIAL_KEYS, "HandleSpecialKeys", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_RANDR, "RandR", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
+};
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
+#if defined(i386) || defined(__i386__)
+static Bool
+detectPC98(void)
+{
+#ifdef SUPPORT_PC98
+ unsigned char buf[2];
+
+ if (xf86ReadBIOS(0xf8000, 0xe80, buf, 2) != 2)
+ return FALSE;
+ if ((buf[0] == 0x98) && (buf[1] == 0x21))
+ return TRUE;
+ else
+ return FALSE;
+#else
+ return FALSE;
#endif
}
+#endif /* __i386__ */
-static char* prependRoot(char *pathname)
+static Bool
+configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
{
-#ifndef __EMX__
- return pathname;
+ XF86OptionPtr optp, tmp;
+ int i;
+ Pix24Flags pix24 = Pix24DontCare;
+ Bool value;
+ MessageType from;
+
+ /*
+ * Merge the ServerLayout and ServerFlags options. The former have
+ * precedence over the latter.
+ */
+ optp = NULL;
+ if (flagsconf && flagsconf->flg_option_lst)
+ optp = xf86optionListDup(flagsconf->flg_option_lst);
+ if (layoutopts) {
+ tmp = xf86optionListDup(layoutopts);
+ if (optp)
+ optp = xf86optionListMerge(optp, tmp);
+ else
+ optp = tmp;
+ }
+
+ xf86ProcessOptions(-1, optp, FlagOptions);
+
+ xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
+
+ xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS,
+ &(xf86Info.grabInfo.allowDeactivate));
+ xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS,
+ &(xf86Info.grabInfo.allowClosedown));
+
+ /*
+ * Set things up based on the config file information. Some of these
+ * settings may be overridden later when the command line options are
+ * checked.
+ */
+#ifdef XF86VIDMODE
+ if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value))
+ xf86Info.vidModeEnabled = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value))
+ xf86Info.vidModeAllowNonLocal = value;
+#endif
+
+#ifdef XF86MISC
+ if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEMODINDEV, &value))
+ xf86Info.miscModInDevEnabled = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_MODINDEVALLOWNONLOCAL, &value))
+ xf86Info.miscModInDevAllowNonLocal = value;
+#endif
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
+ xf86Info.allowMouseOpenFail = value;
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, &value)) {
+#ifdef USE_VT_SYSREQ
+ xf86Info.vtSysreq = value;
+ xf86Msg(X_CONFIG, "VTSysReq %s\n", value ? "enabled" : "disabled");
#else
- /* XXXX caveat: multiple path components in line */
- return (char*)__XOS2RedirRoot(pathname);
+ if (value)
+ xf86Msg(X_WARNING, "VTSysReq is not supported on this OS\n");
#endif
-}
+ }
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_XKBDISABLE, &value)) {
+#ifdef XKB
+ noXkbExtension = value;
+ xf86Msg(X_CONFIG, "Xkb %s\n", value ? "disabled" : "enabled");
+#else
+ if (!value)
+ xf86Msg(X_WARNING, "Xserver doesn't support XKB\n");
+#endif
+ }
+
+ xf86Info.vtinit = xf86GetOptValString(FlagOptions, FLAG_VTINIT);
+
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1))
+ xf86Info.pciFlags = PCIProbe1;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2))
+ xf86Info.pciFlags = PCIProbe2;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG1))
+ xf86Info.pciFlags = PCIForceConfig1;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2))
+ xf86Info.pciFlags = PCIForceConfig2;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIOSCONFIG))
+ xf86Info.pciFlags = PCIOsConfig;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCENONE))
+ xf86Info.pciFlags = PCIForceNone;
+
+ xf86Info.pmFlag = TRUE;
+ if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
+ xf86Info.pmFlag = !value;
+ {
+ const char *s;
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
+ if (!xf86NameCmp(s,"flush")) {
+ xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
+ xf86Info.log = LogFlush;
+ } else if (!xf86NameCmp(s,"sync")) {
+ xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
+ xf86Info.log = LogSync;
+ } else {
+ xf86Msg(X_WARNING,"Unknown Log option\n");
+ }
+ }
+ }
-static CONFIG_RETURN_TYPE
-configFilesSection()
-{
- int token;
- int i, j;
- int k, l;
- char *str;
-
- while ((token = xf86GetToken(FilesTab)) != ENDSECTION) {
- switch (token) {
- case FONTPATH:
- OFLG_SET(XCONFIG_FONTPATH,&GenericXF86ConfigFlag);
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("Font path component expected");
- j = FALSE;
- str = prependRoot(val.str);
- if (fontPath == NULL)
- {
- fontPath = (char *)xalloc(1);
- fontPath[0] = '\0';
- i = strlen(str) + 1;
- }
- else
- {
- i = strlen(fontPath) + strlen(str) + 1;
- if (fontPath[strlen(fontPath)-1] != ',')
+#ifdef RENDER
+ {
+ const char *s;
+
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){
+ int policy = PictureParseCmapPolicy (s);
+ if (policy == PictureCmapPolicyInvalid)
+ xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
+ else
{
- i++;
- j = TRUE;
+ xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
+ PictureCmapPolicy = policy;
}
}
- fontPath = (char *)xrealloc(fontPath, i);
- if (j)
- strcat(fontPath, ",");
-
- strcat(fontPath, str);
- xfree(val.str);
- break;
-
- case RGBPATH:
- OFLG_SET(XCONFIG_RGBPATH, &GenericXF86ConfigFlag);
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("RGB path expected");
- if (!xf86coFlag)
- rgbPath = val.str;
- break;
-
- case MODULEPATH:
- OFLG_SET(XCONFIG_MODULEPATH, &GenericXF86ConfigFlag);
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("Module path expected");
- l = FALSE;
- str = prependRoot(val.str);
- if (modulePath == NULL) {
- modulePath = (char *)xalloc(1);
- modulePath[0] = '\0';
- k = strlen(str) + 1;
- }
- else
- {
- k = strlen(modulePath) + strlen(str) + 1;
- if (modulePath[strlen(modulePath)-1] != ',')
- {
- k++;
- l = TRUE;
+ }
+#endif
+ {
+ const char *s;
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_HANDLE_SPECIAL_KEYS))) {
+ if (!xf86NameCmp(s,"always")) {
+ xf86Msg(X_CONFIG, "Always handling special keys in DDX\n");
+ xf86Info.ddxSpecialKeys = SKAlways;
+ } else if (!xf86NameCmp(s,"whenneeded")) {
+ xf86Msg(X_CONFIG, "Special keys handled in DDX only if needed\n");
+ xf86Info.ddxSpecialKeys = SKWhenNeeded;
+ } else if (!xf86NameCmp(s,"never")) {
+ xf86Msg(X_CONFIG, "Never handling special keys in DDX\n");
+ xf86Info.ddxSpecialKeys = SKNever;
+ } else {
+ xf86Msg(X_WARNING,"Unknown HandleSpecialKeys option\n");
}
- }
- modulePath = (char *)xrealloc(modulePath, k);
- if (l)
- strcat(modulePath, ",");
-
- strcat(modulePath, str);
- xfree(val.str);
- break;
+ }
+ }
+#ifdef RANDR
+ xf86Info.disableRandR = FALSE;
+ xf86Info.randRFrom = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) {
+ xf86Info.disableRandR = !value;
+ xf86Info.randRFrom = X_CONFIG;
+ }
+#endif
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i);
+ if (i >= 0)
+ xf86Info.estimateSizesAggressively = i;
+ else
+ xf86Info.estimateSizesAggressively = 0;
+
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i);
+ if (i >= 0)
+ ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
- case EOF:
- FatalError("Unexpected EOF (missing EndSection?)");
- break; /* :-) */
+#ifdef DPMSExtension
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i);
+ if (i >= 0)
+ DPMSStandbyTime = defaultDPMSStandbyTime = i * MILLI_PER_MIN;
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
+ if (i >= 0)
+ DPMSSuspendTime = defaultDPMSSuspendTime = i * MILLI_PER_MIN;
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
+ if (i >= 0)
+ DPMSOffTime = defaultDPMSOffTime = i * MILLI_PER_MIN;
+#endif
+
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i);
+ switch (i) {
+ case 24:
+ pix24 = Pix24Use24;
+ break;
+ case 32:
+ pix24 = Pix24Use32;
+ break;
+ case -1:
+ break;
default:
- xf86ConfigError("File section keyword expected");
- break;
+ xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
+ return FALSE;
}
- }
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
+ if (xf86Pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = xf86Pix24;
+ xf86Info.pix24From = X_CMDLINE;
+ } else if (pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = pix24;
+ xf86Info.pix24From = X_CONFIG;
+ } else {
+ xf86Info.pixmap24 = Pix24DontCare;
+ xf86Info.pix24From = X_DEFAULT;
+ }
+#if defined(i386) || defined(__i386__)
+ if (xf86GetOptValBool(FlagOptions, FLAG_PC98, &value)) {
+ xf86Info.pc98 = value;
+ if (value) {
+ xf86Msg(X_CONFIG, "Japanese PC98 architecture\n");
+ }
+ } else
+ if (detectPC98()) {
+ xf86Info.pc98 = TRUE;
+ xf86Msg(X_PROBED, "Japanese PC98 architecture\n");
+ }
#endif
-}
-static CONFIG_RETURN_TYPE
-configServerFlagsSection()
-{
- int token;
-
- xf86Info.dontZap = FALSE;
- xf86Info.dontZoom = FALSE;
-
- while ((token = xf86GetToken(ServerFlagsTab)) != ENDSECTION) {
- switch (token) {
- case NOTRAPSIGNALS:
- xf86Info.notrapSignals=TRUE;
- break;
- case DONTZAP:
- xf86Info.dontZap = TRUE;
- break;
- case DONTZOOM:
- xf86Info.dontZoom = TRUE;
- break;
-#ifdef XF86VIDMODE
- case DISABLEVIDMODE:
- xf86VidModeEnabled = FALSE;
- break;
- case ALLOWNONLOCAL:
- xf86VidModeAllowNonLocal = TRUE;
- break;
-#endif
-#ifdef XF86MISC
- case DISABLEMODINDEV:
- xf86MiscModInDevEnabled = FALSE;
- break;
- case MODINDEVALLOWNONLOCAL:
- xf86MiscModInDevAllowNonLocal = TRUE;
- break;
-#endif
- case ALLOWMOUSEOPENFAIL:
- xf86AllowMouseOpenFail = TRUE;
- break;
- case PCIPROBE1:
- xf86PCIFlags = PCIProbe1;
- break;
- case PCIPROBE2:
- xf86PCIFlags = PCIProbe2;
- break;
- case PCIFORCECONFIG1:
- xf86PCIFlags = PCIForceConfig1;
- break;
- case PCIFORCECONFIG2:
- xf86PCIFlags = PCIForceConfig2;
- break;
- case EOF:
- FatalError("Unexpected EOF (missing EndSection?)");
- break; /* :-) */
- default:
- xf86ConfigError("Server flags section keyword expected");
- break;
+#ifdef PANORAMIX
+ from = X_DEFAULT;
+ if (!noPanoramiXExtension)
+ from = X_CMDLINE;
+ else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) {
+ noPanoramiXExtension = !value;
+ from = X_CONFIG;
}
- }
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
+ if (!noPanoramiXExtension)
+ xf86Msg(from, "Xinerama: enabled\n");
#endif
+
+ return TRUE;
}
-static CONFIG_RETURN_TYPE
-configKeyboardSection()
+/*
+ * XXX This function is temporary, and will be removed when the keyboard
+ * driver is converted into a regular input driver.
+ */
+static Bool
+configInputKbd(IDevPtr inputp)
{
- int token, ntoken;
-
+ char *s;
+ MessageType from = X_DEFAULT;
+ Bool customKeycodesDefault = FALSE;
+ int verb = 0;
+
/* Initialize defaults */
- xf86Info.serverNumLock = FALSE;
xf86Info.xleds = 0L;
xf86Info.kbdDelay = 500;
xf86Info.kbdRate = 30;
- xf86Info.kbdProc = (DeviceProc)0;
+
+ xf86Info.kbdProc = NULL;
xf86Info.vtinit = NULL;
xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
- xf86Info.specialKeyMap = (int *)xalloc((RIGHTCTL - LEFTALT + 1) *
- sizeof(int));
- xf86Info.specialKeyMap[LEFTALT - LEFTALT] = KM_META;
- xf86Info.specialKeyMap[RIGHTALT - LEFTALT] = KM_META;
- xf86Info.specialKeyMap[SCROLLLOCK - LEFTALT] = KM_COMPOSE;
- xf86Info.specialKeyMap[RIGHTCTL - LEFTALT] = KM_CONTROL;
-#if defined(SVR4) && defined(i386) && !defined(PC98)
+#if defined(SVR4) && defined(i386)
xf86Info.panix106 = FALSE;
#endif
-#ifdef XKB
- xf86Info.xkbkeymap = NULL;
- xf86Info.xkbtypes = "default";
-#ifndef PC98
- xf86Info.xkbcompat = "default";
- xf86Info.xkbkeycodes = "xfree86";
- xf86Info.xkbsymbols = "us(pc101)";
- xf86Info.xkbgeometry = "pc";
-#else
- xf86Info.xkbcompat = "pc98";
- xf86Info.xkbkeycodes = "xfree98";
- xf86Info.xkbsymbols = "nec/jp(pc98)";
- xf86Info.xkbgeometry = "nec(pc98)";
-#endif
- xf86Info.xkbcomponents_specified = False;
- xf86Info.xkbrules = "xfree86";
- xf86Info.xkbmodel = NULL;
- xf86Info.xkblayout = NULL;
- xf86Info.xkbvariant = NULL;
- xf86Info.xkboptions = NULL;
-#endif
-
- while ((token = xf86GetToken(KeyboardTab)) != ENDSECTION) {
- switch (token) {
- case KPROTOCOL:
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("Keyboard protocol name expected");
- if ( StrCaseCmp(val.str,"standard") == 0 ) {
- xf86Info.kbdProc = xf86KbdProc;
-#ifdef AMOEBA
- xf86Info.kbdEvents = NULL;
-#else
- xf86Info.kbdEvents = xf86KbdEvents;
+ xf86Info.kbdCustomKeycodes = FALSE;
+#ifdef WSCONS_SUPPORT
+ xf86Info.kbdFd = -1;
#endif
- } else if ( StrCaseCmp(val.str,"xqueue") == 0 ) {
+#ifdef XKB
+ if (!xf86IsPc98()) {
+ xf86Info.xkbrules = "xfree86";
+ xf86Info.xkbmodel = "pc105";
+ xf86Info.xkblayout = "us";
+ xf86Info.xkbvariant = NULL;
+ xf86Info.xkboptions = NULL;
+ } else {
+ xf86Info.xkbrules = "xfree98";
+ xf86Info.xkbmodel = "pc98";
+ xf86Info.xkblayout = "nec/jp";
+ xf86Info.xkbvariant = NULL;
+ xf86Info.xkboptions = NULL;
+ }
+ xf86Info.xkbcomponents_specified = FALSE;
+ /* Should discourage the use of these. */
+ xf86Info.xkbkeymap = NULL;
+ xf86Info.xkbtypes = NULL;
+ xf86Info.xkbcompat = NULL;
+ xf86Info.xkbkeycodes = NULL;
+ xf86Info.xkbsymbols = NULL;
+ xf86Info.xkbgeometry = NULL;
+#endif
+
+ s = xf86SetStrOption(inputp->commonOptions, "Protocol", "standard");
+ if (xf86NameCmp(s, "standard") == 0) {
+ xf86Info.kbdProc = xf86KbdProc;
+ xf86Info.kbdEvents = xf86KbdEvents;
+ xfree(s);
+ } else if (xf86NameCmp(s, "xqueue") == 0) {
#ifdef XQUEUE
- xf86Info.kbdProc = xf86XqueKbdProc;
- xf86Info.kbdEvents = xf86XqueEvents;
- xf86Info.mouseDev->xqueSema = 0;
- if (xf86Verbose)
- ErrorF("%s Xqueue selected for keyboard input\n",
- XCONFIG_GIVEN);
-#endif
- } else {
- xf86ConfigError("Not a valid keyboard protocol name");
- }
- break;
- case AUTOREPEAT:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Autorepeat delay expected");
- xf86Info.kbdDelay = val.num;
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Autorepeat rate expected");
- xf86Info.kbdRate = val.num;
- break;
- case SERVERNUM:
- xf86Info.serverNumLock = TRUE;
- break;
-
- case XLEDS:
- while ((token= xf86GetToken(NULL)) == NUMBER)
- xf86Info.xleds |= 1L << (val.num-1);
- pushToken = token;
- break;
- case LEFTALT:
- case RIGHTALT:
- case SCROLLLOCK:
- case RIGHTCTL:
- ntoken = xf86GetToken(KeyMapTab);
- if ((ntoken == EOF) || (ntoken == STRING) || (ntoken == NUMBER))
- xf86ConfigError("KeyMap type token expected");
- else {
- switch(ntoken) {
- case KM_META:
- case KM_COMPOSE:
- case KM_MODESHIFT:
- case KM_MODELOCK:
- case KM_SCROLLLOCK:
- case KM_CONTROL:
- xf86Info.specialKeyMap[token - LEFTALT] = ntoken;
- break;
- default:
- xf86ConfigError("Illegal KeyMap type");
- break;
- }
- }
- break;
- case VTINIT:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("VTInit string expected");
- xf86Info.vtinit = val.str;
- if (xf86Verbose)
- ErrorF("%s VTInit: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case VTSYSREQ:
-#ifdef USE_VT_SYSREQ
- xf86Info.vtSysreq = TRUE;
- if (xf86Verbose && !VT_SYSREQ_DEFAULT)
- ErrorF("%s VTSysReq enabled\n", XCONFIG_GIVEN);
-#else
- xf86ConfigError("VTSysReq not supported on this OS");
+ xf86Info.kbdProc = xf86XqueKbdProc;
+ xf86Info.kbdEvents = xf86XqueEvents;
+ xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
+#endif
+ xfree(s);
+#ifdef WSCONS_SUPPORT
+ } else if (xf86NameCmp(s, "wskbd") == 0) {
+ xf86Info.kbdProc = xf86KbdProc;
+ xf86Info.kbdEvents = xf86WSKbdEvents;
+ xfree(s);
+ s = xf86SetStrOption(inputp->commonOptions, "Device", NULL);
+ xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n");
+ if (s == NULL) {
+ xf86ConfigError("A \"device\" option is required with"
+ " the \"wskbd\" keyboard protocol");
+ return FALSE;
+ }
+ xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL);
+ if (xf86Info.kbdFd == -1) {
+ xf86ConfigError("cannot open \"%s\"", s);
+ xfree(s);
+ return FALSE;
+ }
+ xfree(s);
+ /* Find out keyboard type */
+ if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) {
+ xf86ConfigError("cannot get keyboard type");
+ close(xf86Info.kbdFd);
+ return FALSE;
+ }
+ switch (xf86Info.wsKbdType) {
+ case WSKBD_TYPE_PC_XT:
+ xf86Msg(X_PROBED, "Keyboard type: XT\n");
+ break;
+ case WSKBD_TYPE_PC_AT:
+ xf86Msg(X_PROBED, "Keyboard type: AT\n");
+ break;
+ case WSKBD_TYPE_USB:
+ xf86Msg(X_PROBED, "Keyboard type: USB\n");
+ break;
+#ifdef WSKBD_TYPE_ADB
+ case WSKBD_TYPE_ADB:
+ xf86Msg(X_PROBED, "Keyboard type: ADB\n");
+ break;
#endif
- break;
-
-#ifdef XKB
- case XKBDISABLE:
- noXkbExtension = TRUE;
- if (xf86Verbose)
- ErrorF("%s XKB: disabled\n", XCONFIG_GIVEN);
- break;
-
- case XKBKEYMAP:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBKeymap string expected");
- xf86Info.xkbkeymap = val.str;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: keymap: \"%s\" (overrides other XKB settings)\n",
- XCONFIG_GIVEN, val.str);
- break;
-
- case XKBCOMPAT:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBCompat string expected");
- xf86Info.xkbcompat = val.str;
- xf86Info.xkbcomponents_specified = True;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: compat: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBTYPES:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBTypes string expected");
- xf86Info.xkbtypes = val.str;
- xf86Info.xkbcomponents_specified = True;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: types: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBKEYCODES:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBKeycodes string expected");
- xf86Info.xkbkeycodes = val.str;
- xf86Info.xkbcomponents_specified = True;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: keycodes: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBGEOMETRY:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBGeometry string expected");
- xf86Info.xkbgeometry = val.str;
- xf86Info.xkbcomponents_specified = True;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: geometry: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBSYMBOLS:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBSymbols string expected");
- xf86Info.xkbsymbols = val.str;
- xf86Info.xkbcomponents_specified = True;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: symbols: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBRULES:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBRules string expected");
- xf86Info.xkbrules = val.str;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: rules: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBMODEL:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBModel string expected");
- xf86Info.xkbmodel = val.str;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: model: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBLAYOUT:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBLayout string expected");
- xf86Info.xkblayout = val.str;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: layout: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBVARIANT:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBVariant string expected");
- xf86Info.xkbvariant = val.str;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: variant: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
-
- case XKBOPTIONS:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("XKBOptions string expected");
- xf86Info.xkboptions = val.str;
- if (xf86Verbose && !XkbInitialMap)
- ErrorF("%s XKB: options: \"%s\"\n", XCONFIG_GIVEN, val.str);
- break;
+#ifdef WSKBD_TYPE_SUN
+ case WSKBD_TYPE_SUN:
+ xf86Msg(X_PROBED, "Keyboard type: Sun\n");
+ break;
#endif
-#if defined(SVR4) && defined(i386) && !defined(PC98)
- case PANIX106:
- xf86Info.panix106 = TRUE;
- if (xf86Verbose)
- ErrorF("%s PANIX106: enabled\n", XCONFIG_GIVEN);
- break;
+ default:
+ xf86ConfigError("Unsupported wskbd type \"%d\"",
+ xf86Info.wsKbdType);
+ close(xf86Info.kbdFd);
+ return FALSE;
+ }
#endif
+ } else {
+ xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s);
+ xfree(s);
+ return FALSE;
+ }
- case EOF:
- FatalError("Unexpected EOF (missing EndSection?)");
- break; /* :-) */
+ s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL);
+ if (s) {
+ if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) {
+ xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s);
+ xfree(s);
+ return FALSE;
+ }
+ xfree(s);
+ }
- default:
- xf86ConfigError("Keyboard section keyword expected");
- break;
+ s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL);
+ if (s) {
+ char *l, *end;
+ unsigned int i;
+ l = strtok(s, " \t\n");
+ while (l) {
+ i = strtoul(l, &end, 0);
+ if (*end == '\0')
+ xf86Info.xleds |= 1L << (i - 1);
+ else {
+ xf86ConfigError("\"%s\" is not a valid XLeds value", l);
+ xfree(s);
+ return FALSE;
+ }
+ l = strtok(NULL, " \t\n");
}
+ xfree(s);
}
- if (xf86Info.kbdProc == (DeviceProc)0)
- {
- xf86ConfigError("No keyboard device given");
+
+#ifdef XKB
+ from = X_DEFAULT;
+ if (noXkbExtension)
+ from = X_CMDLINE;
+ else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) {
+ xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the "
+ "ServerFlags section instead\n"
+ "\tof in the \"keyboard\" InputDevice section.\n");
+ noXkbExtension =
+ xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE);
+ from = X_CONFIG;
}
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
-#endif
-}
-
-CONFIG_RETURN_TYPE
-configPointerSection(MouseDevPtr mouse_dev,
- int end_tag,
- char **devicename) /* used by extended device */
-{
- int token;
- int mtoken;
- int i;
- char *mouseType = "unknown";
-
- /* Set defaults */
- mouse_dev->baudRate = 1200;
- mouse_dev->oldBaudRate = -1;
- mouse_dev->sampleRate = 0;
- mouse_dev->resolution = 0;
- mouse_dev->buttons = MSE_DFLTBUTTONS;
- mouse_dev->emulate3Buttons = FALSE;
- mouse_dev->emulate3Timeout = 50;
- mouse_dev->chordMiddle = FALSE;
- mouse_dev->mouseFlags = 0;
- mouse_dev->mseProc = (DeviceProc)0;
- mouse_dev->mseDevice = NULL;
- mouse_dev->mseType = -1;
- mouse_dev->mseModel = 0;
- mouse_dev->negativeZ = 0;
- mouse_dev->positiveZ = 0;
-
- while ((token = xf86GetToken(PointerTab)) != end_tag) {
- switch (token) {
-
- case PROTOCOL:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Mouse name expected");
-#if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY)
- if ( StrCaseCmp(val.str,"osmouse") == 0 ) {
- if (xf86Verbose)
- ErrorF("%s OsMouse selected for mouse input\n", XCONFIG_GIVEN);
- /*
- * allow an option to be passed to the OsMouse routines
- */
- if ((i = xf86GetToken(NULL)) != ERROR_TOKEN)
- xf86OsMouseOption(i, (pointer) &val);
- else
- pushToken = i;
- mouse_dev->mseProc = xf86OsMouseProc;
- mouse_dev->mseEvents = (void(*)(MouseDevPtr))xf86OsMouseEvents;
- break;
+ if (noXkbExtension)
+ xf86Msg(from, "XKB: disabled\n");
+
+#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL))
+
+ if (!noXkbExtension && !XkbInitialMap) {
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) {
+ xf86Info.xkbkeymap = NULL_IF_EMPTY(s);
+ xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" "
+ "(overrides other XKB settings)\n", xf86Info.xkbkeymap);
+ } else {
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) {
+ xf86Info.xkbcompat = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s);
}
-#endif
-#ifdef XQUEUE
- if ( StrCaseCmp(val.str,"xqueue") == 0 ) {
- mouse_dev->mseProc = xf86XqueMseProc;
- mouse_dev->mseEvents = (void(*)(MouseDevPtr))xf86XqueEvents;
- mouse_dev->xqueSema = 0;
- if (xf86Verbose)
- ErrorF("%s Xqueue selected for mouse input\n",
- XCONFIG_GIVEN);
- break;
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) {
+ xf86Info.xkbtypes = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s);
}
-#endif
-#ifndef OSMOUSE_ONLY
-#if defined(MACH) || defined(AMOEBA)
- mouseType = (char *) xalloc (strlen (val.str) + 1);
- strcpy (mouseType, val.str);
-#else
- mouseType = (char *)strdup(val.str); /* GJA -- should we free this? */
-#endif
- mtoken = getStringToken(MouseTab); /* Which mouse? */
-#ifdef AMOEBA
- mouse_dev->mseProc = xf86MseProc;
- mouse_dev->mseEvents = NULL;
-#else
- mouse_dev->mseProc = xf86MseProc;
- mouse_dev->mseEvents = xf86MseEvents;
-#endif
- mouse_dev->mseType = mtoken - MICROSOFT;
- if (!xf86MouseSupported(mouse_dev->mseType))
- {
- xf86ConfigError("Mouse type not supported by this OS");
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) {
+ xf86Info.xkbkeycodes = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s);
}
-#else /* OSMOUSE_ONLY */
- xf86ConfigError("Mouse type not supported by this OS");
-#endif /* OSMOUSE_ONLY */
-#ifdef MACH386
- /* Don't need to specify the device for MACH -- should always be this */
- mouse_dev->mseDevice = "/dev/mouse";
-#endif
- break;
-#ifndef OSMOUSE_ONLY
- case PDEVICE:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Mouse device expected");
- mouse_dev->mseDevice = val.str;
- break;
- case BAUDRATE:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Baudrate expected");
- if (mouse_dev->mseType + MICROSOFT == LOGIMAN)
- {
- /*
- * XXXX This should be extended to other mouse types -- most
- * support only 1200. Should also disallow baudrate for bus mice
- */
- /* Moan if illegal baud rate! [CHRIS-211092] */
- if ((val.num != 1200) && (val.num != 9600))
- xf86ConfigError("Only 1200 or 9600 Baud are supported by MouseMan");
- }
- else if (val.num%1200 != 0 || val.num < 1200 || val.num > 9600)
- xf86ConfigError("Baud rate must be one of 1200, 2400, 4800, or 9600");
- mouse_dev->baudRate = val.num;
- break;
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) {
+ xf86Info.xkbgeometry = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s);
+ }
- case SAMPLERATE:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Sample rate expected");
-#if 0
- if (mouse_dev->mseType + MICROSOFT == LOGIMAN)
- {
- /* XXXX Most mice don't allow this */
- /* Moan about illegal sample rate! [CHRIS-211092] */
- xf86ConfigError("Selection of sample rate is not supported by MouseMan");
- }
-#endif
- mouse_dev->sampleRate = val.num;
- break;
-
- case PRESOLUTION:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Resolution expected");
- if (val.num <= 0)
- xf86ConfigError("Resolution must be a positive value");
- mouse_dev->resolution = val.num;
- break;
-#endif /* OSMOUSE_ONLY */
- case EMULATE3:
- if (mouse_dev->chordMiddle)
- xf86ConfigError("Can't use Emulate3Buttons with ChordMiddle");
- mouse_dev->emulate3Buttons = TRUE;
- break;
-
- case EM3TIMEOUT:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("3 button emulation timeout expected");
- mouse_dev->emulate3Timeout = val.num;
- break;
-
-#ifndef OSMOUSE_ONLY
- case CHORDMIDDLE:
- if (mouse_dev->mseType + MICROSOFT == MICROSOFT ||
- mouse_dev->mseType + MICROSOFT == LOGIMAN)
- {
- if (mouse_dev->emulate3Buttons)
- xf86ConfigError("Can't use ChordMiddle with Emulate3Buttons");
- mouse_dev->chordMiddle = TRUE;
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) {
+ xf86Info.xkbsymbols = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s);
}
- else
- xf86ConfigError("ChordMiddle is only supported for Microsoft and MouseMan");
- break;
- case CLEARDTR:
-#ifdef CLEARDTR_SUPPORT
- if (mouse_dev->mseType + MICROSOFT == MOUSESYS)
- mouse_dev->mouseFlags |= MF_CLEAR_DTR;
- else
- xf86ConfigError("ClearDTR only supported for MouseSystems mouse");
-#else
- xf86ConfigError("ClearDTR not supported on this OS");
-#endif
- break;
- case CLEARRTS:
-#ifdef CLEARDTR_SUPPORT
- if (mouse_dev->mseType + MICROSOFT == MOUSESYS)
- mouse_dev->mouseFlags |= MF_CLEAR_RTS;
- else
- xf86ConfigError("ClearRTS only supported for MouseSystems mouse");
-#else
- xf86ConfigError("ClearRTS not supported on this OS");
-#endif
- break;
-#endif /* OSMOUSE_ONLY */
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) {
+ xf86Info.xkbrules = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s);
+ }
- case DEVICE_NAME:
- if (!devicename) /* not called for an extended device */
- xf86ConfigError("Pointer section keyword expected");
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) {
+ xf86Info.xkbmodel = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s);
+ }
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("Option string expected");
- *devicename = strdup(val.str);
- break;
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) {
+ xf86Info.xkblayout = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s);
+ }
-#ifndef XF86SETUP
-#ifdef XINPUT
- case ALWAYSCORE:
- xf86AlwaysCore(mouse_dev->local, TRUE);
- break;
-#endif
-#endif
-
- case ZAXISMAPPING:
- switch (xf86GetToken(ZMapTab)) {
- case NUMBER:
- if (val.num <= 0 || val.num > MSE_MAXBUTTONS)
- xf86ConfigError("Button number (1..12) expected");
- mouse_dev->negativeZ = 1 << (val.num - 1);
- if (xf86GetToken(NULL) != NUMBER ||
- val.num <= 0 || val.num > MSE_MAXBUTTONS)
- xf86ConfigError("Button number (1..12) expected");
- mouse_dev->positiveZ = 1 << (val.num - 1);
- break;
- case XAXIS:
- mouse_dev->negativeZ = mouse_dev->positiveZ = MSE_MAPTOX;
- break;
- case YAXIS:
- mouse_dev->negativeZ = mouse_dev->positiveZ = MSE_MAPTOY;
- break;
- default:
- xf86ConfigError("Button number (1..12), X or Y expected");
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) {
+ xf86Info.xkbvariant = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s);
}
- break;
-
- case PBUTTONS:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Number of buttons (1..12) expected");
- if (val.num <= 0 || val.num > MSE_MAXBUTTONS)
- xf86ConfigError("Number of buttons must be a positive value (1..12)");
- mouse_dev->buttons = val.num;
- break;
-
- case EOF:
- FatalError("Unexpected EOF (missing EndSection?)");
- break; /* :-) */
-
- default:
- xf86ConfigError("Pointer section keyword expected");
- break;
- }
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) {
+ xf86Info.xkboptions = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s);
+ }
+ }
}
- /* Print log and make sanity checks */
-
- if (mouse_dev->mseProc == (DeviceProc)0)
- {
- xf86ConfigError("No mouse protocol given");
+#undef NULL_IF_EMPTY
+#endif
+#if defined(SVR4) && defined(i386)
+ if ((xf86Info.panix106 =
+ xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) {
+ xf86Msg(X_CONFIG, "PANIX106: enabled\n");
}
-
+#endif
+
/*
- * if mseProc is set and mseType isn't, then using Xqueue or OSmouse.
- * Otherwise, a mouse device is required.
+ * 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.
*/
- if (mouse_dev->mseType >= 0 && !mouse_dev->mseDevice)
+ from = X_DEFAULT;
+ verb = 2;
+#if defined(__linux__) && defined(__powerpc__)
{
- xf86ConfigError("No mouse device given");
- }
-
- switch (mouse_dev->negativeZ) {
- case 0: /* none */
- case MSE_MAPTOX:
- case MSE_MAPTOY:
- break;
- default: /* buttons */
- for (i = 0; mouse_dev->negativeZ != (1 << i); ++i)
- ;
- if (i + 1 > mouse_dev->buttons)
- mouse_dev->buttons = i + 1;
- for (i = 0; mouse_dev->positiveZ != (1 << i); ++i)
- ;
- if (i + 1 > mouse_dev->buttons)
- mouse_dev->buttons = i + 1;
- break;
- }
-
- if (xf86Verbose && mouse_dev->mseType >= 0)
- {
- Bool formatFlag = FALSE;
- ErrorF("%s Mouse: type: %s, device: %s",
- XCONFIG_GIVEN, mouseType, mouse_dev->mseDevice);
- if (mouse_dev->mseType != P_BM
- && mouse_dev->mseType != P_PS2
- && mouse_dev->mseType != P_IMPS2
- && mouse_dev->mseType != P_THINKINGPS2
- && mouse_dev->mseType != P_MMANPLUSPS2
- && mouse_dev->mseType != P_GLIDEPOINTPS2
- && mouse_dev->mseType != P_NETPS2
- && mouse_dev->mseType != P_NETSCROLLPS2
- && mouse_dev->mseType != P_SYSMOUSE)
- {
- formatFlag = TRUE;
- ErrorF(", baudrate: %d", mouse_dev->baudRate);
- }
- if (mouse_dev->sampleRate)
- {
- ErrorF(formatFlag ? "\n%s Mouse: samplerate: %d" : "%ssamplerate: %d",
- formatFlag ? XCONFIG_GIVEN : ", ", mouse_dev->sampleRate);
- formatFlag = !formatFlag;
- }
- if (mouse_dev->resolution)
- {
- ErrorF(formatFlag ? "\n%s Mouse: resolution: %d" : "%sresolution: %d",
- formatFlag ? XCONFIG_GIVEN : ", ", mouse_dev->resolution);
- formatFlag = !formatFlag;
- }
- ErrorF(formatFlag ? "\n%s Mouse: buttons: %d" : "%sbuttons: %d",
- formatFlag ? XCONFIG_GIVEN : ", ", mouse_dev->buttons);
- formatFlag = !formatFlag;
- if (mouse_dev->emulate3Buttons)
- {
- ErrorF(formatFlag ? "\n%s Mouse: 3 button emulation (timeout: %dms)" :
- "%s3 button emulation (timeout: %dms)",
- formatFlag ? XCONFIG_GIVEN : ", ", mouse_dev->emulate3Timeout);
- formatFlag = !formatFlag;
- }
- if (mouse_dev->chordMiddle)
- ErrorF(formatFlag ? "\n%s Mouse: Chorded middle button" :
- "%sChorded middle button",
- formatFlag ? XCONFIG_GIVEN : ", ");
- ErrorF("\n");
-
- switch (mouse_dev->negativeZ) {
- case 0: /* none */
- break;
- case MSE_MAPTOX:
- ErrorF("%s Mouse: zaxismapping: X\n", XCONFIG_GIVEN);
- break;
- case MSE_MAPTOY:
- ErrorF("%s Mouse: zaxismapping: Y\n", XCONFIG_GIVEN);
- break;
- default: /* buttons */
- for (i = 0; mouse_dev->negativeZ != (1 << i); ++i)
- ;
- ErrorF("%s Mouse: zaxismapping: (-)%d", XCONFIG_GIVEN, i + 1);
- for (i = 0; mouse_dev->positiveZ != (1 << i); ++i)
- ;
- ErrorF(" (+)%d\n", i + 1);
- break;
+ 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);
}
}
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
#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;
}
-
-static CONFIG_RETURN_TYPE
-configDeviceSection()
-{
- int token;
- int i;
- GDevPtr devp;
- /* Allocate one more device */
- if ( device_list == NULL ) {
- device_list = (GDevPtr) xalloc(sizeof(GDevRec));
- } else {
- device_list = (GDevPtr) xrealloc(device_list,
- (n_devices+1) * sizeof(GDevRec));
- }
- devp = &(device_list[n_devices]); /* Point to the last device */
- n_devices++;
-
- /* Pre-init the newly created device */
- devp->identifier = NULL;
- devp->board = NULL;
- devp->vendor = NULL;
- devp->chipset = NULL;
- devp->ramdac = NULL;
- for (i=0; i<MAXDACSPEEDS; i++)
- devp->dacSpeeds[i] = 0;
- OFLG_ZERO(&(devp->options));
- OFLG_ZERO(&(devp->xconfigFlag));
- devp->videoRam = 0;
- devp->speedup = SPEEDUP_DEFAULT;
- OFLG_ZERO(&(devp->clockOptions));
- devp->clocks = 0;
- devp->clockprog = NULL;
- devp->textClockValue = -1;
- /* GJA -- We initialize the following fields to known values.
- * If later on we find they contain different values,
- * they might be interesting to print.
- */
- devp->IObase = 0;
- devp->DACbase = 0;
- devp->COPbase = 0;
- devp->POSbase = 0;
- devp->instance = 0;
- devp->BIOSbase = 0;
- devp->VGAbase = 0;
- devp->MemBase = 0;
- devp->s3Madjust = 0;
- devp->s3Nadjust = 0;
- devp->s3MClk = 0;
- devp->chipID = 0;
- devp->chipRev = 0;
- devp->s3RefClk = 0;
- devp->s3BlankDelay = -1;
- devp->DCConfig = NULL;
- devp->DCOptions = NULL;
- devp->MemClk = 0;
- devp->LCDClk = 0;
-
- while ((token = xf86GetToken(DeviceTab)) != ENDSECTION) {
- devp->DCConfig = xf86DCSaveLine(devp->DCConfig, token);
- switch (token) {
-
- case IDENTIFIER:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("identifier name expected");
- devp->identifier = val.str;
- break;
-
- case VENDOR:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("vendor name expected");
- devp->vendor = val.str;
- break;
-
- case BOARD:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("board name expected");
- devp->board = val.str;
- break;
-
- case CHIPSET:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Chipset string expected");
- devp->chipset = val.str;
- OFLG_SET(XCONFIG_CHIPSET,&(devp->xconfigFlag));
- break;
-
- case RAMDAC:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("RAMDAC string expected");
- devp->ramdac = val.str;
- OFLG_SET(XCONFIG_RAMDAC,&(devp->xconfigFlag));
- break;
-
- case DACSPEED:
- for (i=0; i<MAXDACSPEEDS; i++)
- devp->dacSpeeds[i] = 0;
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("DAC speed(s) expected");
- else {
- devp->dacSpeeds[0] = (int)(val.realnum * 1000.0 + 0.5);
- for(i=1; i<MAXDACSPEEDS; i++) {
- if (xf86GetToken(NULL) == NUMBER)
- devp->dacSpeeds[i] = (int)(val.realnum * 1000.0 + 0.5);
- else {
- pushToken = token;
- break;
+static Bool
+checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
+{
+ Bool havePointer = FALSE, haveKeyboard = FALSE;
+ Bool foundPointer = FALSE, foundKeyboard = FALSE;
+ IDevPtr indp;
+ IDevRec Pointer, Keyboard;
+ XF86ConfInputPtr confInput;
+ int count = 0;
+ MessageType from = X_DEFAULT;
+
+ /* Check if a core pointer or core keyboard is needed. */
+ for (indp = servlayoutp->inputs; indp->identifier; indp++) {
+ if ((indp->commonOptions &&
+ xf86FindOption(indp->commonOptions, "CorePointer")) ||
+ (indp->extraOptions &&
+ xf86FindOption(indp->extraOptions, "CorePointer"))) {
+ havePointer = TRUE;
+ }
+ if ((indp->commonOptions &&
+ xf86FindOption(indp->commonOptions, "CoreKeyboard")) ||
+ (indp->extraOptions &&
+ xf86FindOption(indp->extraOptions, "CoreKeyboard"))) {
+ haveKeyboard = TRUE;
+ }
+ count++;
+ }
+ if (!havePointer) {
+ if (xf86PointerName) {
+ confInput = xf86findInput(xf86PointerName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86PointerName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ } else {
+ from = X_DEFAULT;
+ confInput = xf86findInput(CONF_IMPLICIT_POINTER,
+ xf86configptr->conf_input_lst);
+ if (!confInput && implicitLayout) {
+ confInput = xf86findInputByDriver("mouse",
+ xf86configptr->conf_input_lst);
}
- }
- }
- OFLG_SET(XCONFIG_DACSPEED,&(devp->xconfigFlag));
- break;
-
- case CLOCKCHIP:
- /* Only allow one Clock string */
- if (OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(devp->clockOptions)))
- {
- xf86ConfigError("Only one Clock chip may be specified.");
- break;
- }
- if (devp->clocks == 0)
- {
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Option string expected");
- i = 0;
- while (xf86_ClockOptionTab[i].token != -1)
- {
- if (StrCaseCmp(val.str, xf86_ClockOptionTab[i].name) == 0)
- {
- OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &(devp->clockOptions));
- OFLG_SET(xf86_ClockOptionTab[i].token,
- &(devp->clockOptions));
- break;
- }
- i++;
- }
- if (xf86_ClockOptionTab[i].token == -1) {
- xf86ConfigError("Unknown clock chip");
- break;
- }
- }
- else
- {
- xf86ConfigError("Clocks previously specified by value");
- }
- break;
-
- case CLOCKS:
- OFLG_SET(XCONFIG_CLOCKS,&(devp->xconfigFlag));
- if ((token = xf86GetToken(NULL)) == STRING)
- {
- xf86ConfigError("Use ClockChip to specify a programmable clock");
- break;
- }
- if (OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(devp->clockOptions)))
- {
- xf86ConfigError("Clock previously specified as programmable");
- break;
- }
- for (i = devp->clocks; token == NUMBER && i < MAXCLOCKS; i++) {
- devp->clock[i] = (int)(val.realnum * 1000.0 + 0.5);
- token = xf86GetToken(NULL);
- }
-
- devp->clocks = i;
- pushToken = token;
- break;
-
- case OPTION:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Option string expected");
- i = 0;
- while (xf86_OptionTab[i].token != -1)
- {
- if (StrCaseCmp(val.str, xf86_OptionTab[i].name) == 0)
- {
- OFLG_SET(xf86_OptionTab[i].token, &(devp->options));
- break;
}
- i++;
- }
- if (xf86_OptionTab[i].token == -1)
- /*xf86ConfigError("Unknown option string");*/
- devp->DCOptions = xf86DCOption(devp->DCOptions,val);
- break;
-
- case VIDEORAM:
- OFLG_SET(XCONFIG_VIDEORAM,&(devp->xconfigFlag));
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Video RAM size expected");
- devp->videoRam = val.num;
- break;
-
- case SPEEDUP:
- OFLG_SET(XCONFIG_SPEEDUP,&(devp->xconfigFlag));
- if ((token = xf86GetToken(NULL)) == STRING)
- if (!strcmp(val.str,"all"))
- devp->speedup = SPEEDUP_ALL;
+ if (confInput)
+ foundPointer = configInput(&Pointer, confInput, from);
+ }
+ if (!haveKeyboard) {
+ if (xf86KeyboardName) {
+ confInput = xf86findInput(xf86KeyboardName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86KeyboardName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ } else {
+ from = X_DEFAULT;
+ confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
+ xf86configptr->conf_input_lst);
+ if (!confInput && implicitLayout) {
+ confInput = xf86findInputByDriver("keyboard",
+ xf86configptr->conf_input_lst);
+ }
+ }
+ if (confInput)
+ foundKeyboard = configInput(&Keyboard, confInput, from);
+ }
+ if (foundPointer) {
+ count++;
+ indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec));
+ indp[count - 1] = Pointer;
+ indp[count - 1].extraOptions = xf86addNewOption(NULL, "CorePointer", NULL);
+ indp[count].identifier = NULL;
+ servlayoutp->inputs = indp;
+ } else if (!havePointer) {
+ if (implicitLayout)
+ xf86Msg(X_ERROR, "Unable to find a core pointer device\n");
else
- if (!strcmp(val.str,"best"))
- devp->speedup = SPEEDUP_BEST;
- else
- if (!strcmp(val.str,"none"))
- devp->speedup = 0;
- else
- xf86ConfigError("Unrecognised SpeedUp option");
- else
- {
- pushToken = token;
- if ((token = xf86GetToken(NULL)) == NUMBER)
- devp->speedup = val.num;
+ xf86Msg(X_ERROR, "No core pointer device specified\n");
+ return FALSE;
+ }
+ if (foundKeyboard) {
+ count++;
+ indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec));
+ indp[count - 1] = Keyboard;
+ indp[count - 1].extraOptions = xf86addNewOption(NULL, "CoreKeyboard", NULL);
+ indp[count].identifier = NULL;
+ servlayoutp->inputs = indp;
+ } else if (!haveKeyboard) {
+ if (implicitLayout)
+ xf86Msg(X_ERROR, "Unable to find a core keyboard device\n");
else
- {
- pushToken = token;
- devp->speedup = SPEEDUP_ALL;
- }
- }
- break;
-
- case NOSPEEDUP:
- OFLG_SET(XCONFIG_SPEEDUP,&(devp->xconfigFlag));
- devp->speedup = 0;
- break;
-
- case CLOCKPROG:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("ClockProg string expected");
- if (val.str[0] != '/')
- FatalError("Full pathname must be given for ClockProg \"%s\"\n",
- val.str);
- if (access(val.str, X_OK) < 0)
- {
- if (access(val.str, F_OK) < 0)
- FatalError("ClockProg \"%s\" does not exist\n", val.str);
- else
- FatalError("ClockProg \"%s\" is not executable\n", val.str);
- }
- {
- struct stat stat_buf;
- stat(val.str, &stat_buf);
- if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG))
- FatalError("ClockProg \"%s\" is not a regular file\n", val.str);
- }
- devp->clockprog = val.str;
- if (xf86GetToken(NULL) == NUMBER)
- {
- devp->textClockValue = (int)(val.realnum * 1000.0 + 0.5);
- }
- else
- {
- pushToken = token;
- }
- break;
-
- case BIOSBASE:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("BIOS base address expected");
- devp->BIOSbase = val.num;
- OFLG_SET(XCONFIG_BIOSBASE, &(devp->xconfigFlag));
- break;
-
- case MEMBASE:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Memory base address expected");
- devp->MemBase = val.num;
- OFLG_SET(XCONFIG_MEMBASE, &(devp->xconfigFlag));
- break;
-
- case IOBASE:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Direct access register I/O base address expected");
- devp->IObase = val.num;
- OFLG_SET(XCONFIG_IOBASE, &(devp->xconfigFlag));
- break;
-
- case DACBASE:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("DAC base I/O address expected");
- devp->DACbase = val.num;
- OFLG_SET(XCONFIG_DACBASE, &(devp->xconfigFlag));
- break;
-
- case COPBASE:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Coprocessor base memory address expected");
- devp->COPbase = val.num;
- OFLG_SET(XCONFIG_COPBASE, &(devp->xconfigFlag));
- break;
-
- case POSBASE:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("POS base address expected");
- devp->POSbase = val.num;
- OFLG_SET(XCONFIG_POSBASE, &(devp->xconfigFlag));
- break;
-
- case INSTANCE:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Video adapter instance number expected");
- devp->instance = val.num;
- OFLG_SET(XCONFIG_INSTANCE, &(devp->xconfigFlag));
- break;
-
- case S3MNADJUST:
- if ((token = xf86GetToken(NULL)) == DASH) { /* negative number */
- token = xf86GetToken(NULL);
- val.num = -val.num;
- }
- if (token != NUMBER || val.num<-31 || val.num>31)
- xf86ConfigError("M adjust (max. 31) expected");
- devp->s3Madjust = val.num;
-
- if ((token = xf86GetToken(NULL)) == DASH) { /* negative number */
- token = xf86GetToken(NULL);
- val.num = -val.num;
- }
- if (token == NUMBER) {
- if (val.num<-255 || val.num>255)
- xf86ConfigError("N adjust (max. 255) expected");
- else
- devp->s3Nadjust = val.num;
- }
- else pushToken = token;
- break;
-
- case S3MCLK:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("MCLK value in MHz expected");
- devp->s3MClk = (int)(val.realnum * 1000.0 + 0.5);
- break;
-
- case MEMCLOCK:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Memory Clock value in MHz expected");
- devp->MemClk = (int)(val.realnum * 1000.0 + 0.5);
- OFLG_SET(XCONFIG_MEMCLOCK,&(devp->xconfigFlag));
- break;
-
- case LCDCLOCK:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("LCD Clock value in MHz expected");
- devp->LCDClk = (int)(val.realnum * 1000.0 + 0.5);
- OFLG_SET(XCONFIG_LCDCLOCK,&(devp->xconfigFlag));
- break;
-
- case CHIPID:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("ChipID expected");
- devp->chipID = val.num;
- break;
-
- case CHIPREV:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("ChipRev expected");
- devp->chipRev = val.num;
- break;
-
- case VGABASEADDR:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("VGA aperature base address expected");
- devp->VGAbase = val.num;
- OFLG_SET(XCONFIG_VGABASE, &(devp->xconfigFlag));
- break;
-
- case S3REFCLK:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("RefCLK value in MHz expected");
- devp->s3RefClk = (int)(val.realnum * 1000.0 + 0.5);
- break;
-
- case S3BLANKDELAY:
- if (xf86GetToken(NULL) != NUMBER || val.num>7)
- xf86ConfigError("number(s) 0..7 expected");
- devp->s3BlankDelay = val.num;
- if ((token=xf86GetToken(NULL)) == NUMBER) {
- if (val.num>7) xf86ConfigError("number2 0..7 expected");
- devp->s3BlankDelay |= val.num<<4;
- }
- else pushToken = token;
- break;
-
- case TEXTCLOCKFRQ:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Text clock expected");
- devp->textClockValue = (int)(val.realnum * 1000.0 + 0.5);
- break;
-
- case EOF:
- FatalError("Unexpected EOF (missing EndSection?)");
- break; /* :-) */
- default:
- if(DCerr)
- xf86ConfigError("Device section keyword expected");
- break;
+ xf86Msg(X_ERROR, "No core keyboard device specified\n");
+ return FALSE;
}
- }
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
-#endif
+ return TRUE;
}
-static CONFIG_RETURN_TYPE
-configMonitorSection()
+/*
+ * figure out which layout is active, which screens are used in that layout,
+ * which drivers and monitors are used in these screens
+ */
+static Bool
+configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
+ char *default_layout)
{
- int token;
- int i;
- MonPtr monp;
- float multiplier;
-
- /* Allocate one more monitor */
- if ( monitor_list == NULL ) {
- monitor_list = (MonPtr) xalloc(sizeof(MonRec));
- } else {
- monitor_list = (MonPtr) xrealloc(monitor_list,
- (n_monitors+1) * sizeof(MonRec));
- }
- monp = &(monitor_list[n_monitors]); /* Point to the new monitor */
- monp->Modes = 0;
- monp->Last = 0;
- monp->n_hsync = 0;
- monp->n_vrefresh = 0;
- n_monitors++;
-
- while ((token = xf86GetToken(MonitorTab)) != ENDSECTION) {
- switch (token) {
- case IDENTIFIER:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("identifier name expected");
- monp->id = val.str;
- break;
- case VENDOR:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("vendor name expected");
- monp->vendor = val.str;
- break;
- case MODEL:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("model name expected");
- monp->model = val.str;
- break;
- case MODE:
- readVerboseMode(monp);
- break;
- case MODELINE:
- token = xf86GetToken(NULL);
- pNew = (DisplayModePtr)xalloc(sizeof(DisplayModeRec));
-
- if (monp->Last)
- monp->Last->next = pNew;
- else
- monp->Modes = pNew;
-
- if (token == STRING)
- {
- pNew->name = val.str;
- if ((token = xf86GetToken(NULL)) != NUMBER)
- FatalError("Dotclock expected");
- }
- else if (monp->Last)
- {
-#if defined(MACH) || defined(AMOEBA)
- pNew->name = (char *) xalloc (strlen (monp->Last->name) + 1);
- strcpy (pNew->name, monp->Last->name);
-#else
- pNew->name = (char *)strdup(monp->Last->name);
-#endif
- }
- else
- xf86ConfigError("Mode name expected");
-
- pNew->next = NULL;
- pNew->prev = NULL;
- pNew->Flags = 0;
- pNew->Clock = (int)(val.realnum * 1000.0 + 0.5);
- pNew->CrtcHAdjusted = FALSE;
- pNew->CrtcVAdjusted = FALSE;
- pNew->CrtcHSkew = pNew->HSkew = 0;
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHDisplay = pNew->HDisplay = val.num;
- else xf86ConfigError("Horizontal display expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHSyncStart = pNew->HSyncStart = val.num;
- else xf86ConfigError("Horizontal sync start expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHSyncEnd = pNew->HSyncEnd = val.num;
- else xf86ConfigError("Horizontal sync end expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHTotal = pNew->HTotal = val.num;
- else xf86ConfigError("Horizontal total expected");
-
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVDisplay = pNew->VDisplay = val.num;
- else xf86ConfigError("Vertical display expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVSyncStart = pNew->VSyncStart = val.num;
- else xf86ConfigError("Vertical sync start expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVSyncEnd = pNew->VSyncEnd = val.num;
- else xf86ConfigError("Vertical sync end expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVTotal = pNew->VTotal = val.num;
- else xf86ConfigError("Vertical total expected");
-
- token = xf86GetToken(TimingTab);
- while ( (token == TT_INTERLACE) || (token == TT_PHSYNC) ||
- (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
- (token == TT_NVSYNC) || (token == TT_CSYNC) ||
- (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
- (token == TT_DBLSCAN) || (token == TT_HSKEW) )
- {
- switch(token) {
-
- case TT_INTERLACE: pNew->Flags |= V_INTERLACE; break;
- case TT_PHSYNC: pNew->Flags |= V_PHSYNC; break;
- case TT_NHSYNC: pNew->Flags |= V_NHSYNC; break;
- case TT_PVSYNC: pNew->Flags |= V_PVSYNC; break;
- case TT_NVSYNC: pNew->Flags |= V_NVSYNC; break;
- case TT_CSYNC: pNew->Flags |= V_CSYNC; break;
- case TT_PCSYNC: pNew->Flags |= V_PCSYNC; break;
- case TT_NCSYNC: pNew->Flags |= V_NCSYNC; break;
- case TT_DBLSCAN: pNew->Flags |= V_DBLSCAN; break;
- case TT_HSKEW:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Horizontal skew expected");
- pNew->CrtcHSkew = pNew->HSkew = val.num;
- pNew->Flags |= V_HSKEW;
- break;
- default:
- xf86ConfigError("bug found in config reader"); break;
- }
- token = xf86GetToken(TimingTab);
- }
- pushToken = token;
- monp->Last = pNew; /* GJA */
- break;
- case BANDWIDTH:
- /* This should be completely removed at some point */
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Bandwidth number expected");
-#if 0
- monp->bandwidth = val.realnum;
- /* Handle optional scaler */
- token = xf86GetToken(UnitTab);
- switch ( token ) {
- case HRZ: multiplier = 1.0e-6; break;
- case KHZ: multiplier = 1.0e-3; break;
- case MHZ: multiplier = 1.0; break;
- default: multiplier = 1.0; pushToken = token;
- }
- monp->bandwidth *= multiplier;
-#endif
- break;
- case HORIZSYNC:
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Horizontal sync value expected");
- monp->hsync[monp->n_hsync].lo = val.realnum;
- if ((token = xf86GetToken(NULL)) == DASH) {
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Upperbound for horizontal sync value expected");
- monp->hsync[monp->n_hsync].hi = val.realnum;
- } else {
- pushToken = token;
- monp->hsync[monp->n_hsync].hi = monp->hsync[monp->n_hsync].lo;
- }
- monp->n_hsync++;
- while ( (token = xf86GetToken(NULL)) == COMMA ) {
- if ( monp->n_hsync == MAX_HSYNC )
- xf86ConfigError("Sorry. Too many horizontal sync intervals.");
-
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Horizontal sync value expected");
- monp->hsync[monp->n_hsync].lo = val.realnum;
- if ((token = xf86GetToken(NULL)) == DASH) {
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Upperbound for horizontal sync value expected");
- monp->hsync[monp->n_hsync].hi = val.realnum;
- } else {
- pushToken = token;
- monp->hsync[monp->n_hsync].hi = monp->hsync[monp->n_hsync].lo;
- }
- monp->n_hsync++;
- }
- pushToken = token;
- /* Handle optional scaler */
- token = xf86GetToken(UnitTab);
- switch ( token ) {
- case HRZ: multiplier = 1.0e-3; break;
- case KHZ: multiplier = 1.0; break;
- case MHZ: multiplier = 1.0e3; break;
- default: multiplier = 1.0; pushToken = token;
- }
- for ( i = 0 ; i < monp->n_hsync ; i++ ) {
- monp->hsync[i].hi *= multiplier;
- monp->hsync[i].lo *= multiplier;
- }
- break;
- case VERTREFRESH:
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Vertical refresh value expected");
- monp->vrefresh[monp->n_vrefresh].lo = val.realnum;
- if ((token = xf86GetToken(NULL)) == DASH) {
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Upperbound for vertical refresh value expected");
- monp->vrefresh[monp->n_vrefresh].hi = val.realnum;
- } else {
- monp->vrefresh[monp->n_vrefresh].hi =
- monp->vrefresh[monp->n_vrefresh].lo;
- pushToken = token;
- }
- monp->n_vrefresh++;
- while ( (token = xf86GetToken(NULL)) == COMMA ) {
- if ( monp->n_vrefresh == MAX_HSYNC )
- xf86ConfigError("Sorry. Too many vertical refresh intervals.");
-
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Vertical refresh value expected");
- monp->vrefresh[monp->n_vrefresh].lo = val.realnum;
- if ((token = xf86GetToken(NULL)) == DASH) {
- if ((token = xf86GetToken(NULL)) != NUMBER)
- xf86ConfigError("Upperbound for vertical refresh value expected");
- monp->vrefresh[monp->n_vrefresh].hi = val.realnum;
- } else {
- monp->vrefresh[monp->n_vrefresh].hi =
- monp->vrefresh[monp->n_vrefresh].lo;
- pushToken = token;
- }
- monp->n_vrefresh++;
- }
- pushToken = token;
- /* Handle optional scaler */
- token = xf86GetToken(UnitTab);
- switch ( token ) {
- case HRZ: multiplier = 1.0; break;
- case KHZ: multiplier = 1.0e3; break;
- case MHZ: multiplier = 1.0e6; break;
- default: multiplier = 1.0; pushToken = token;
- }
- for ( i = 0 ; i < monp->n_vrefresh ; i++ ) {
- monp->vrefresh[i].hi *= multiplier;
- monp->vrefresh[i].lo *= multiplier;
- }
- break;
- case GAMMA: {
- char *msg = "gamma correction value(s) expected\n either one value or three r/g/b values with 0.1 <= gamma <= 10";
- if ((token = xf86GetToken(NULL)) != NUMBER || val.realnum<0.1 || val.realnum>10)
- xf86ConfigError(msg);
- else {
- xf86rGamma = xf86gGamma = xf86bGamma = 1.0 / val.realnum;
- if ((token = xf86GetToken(NULL)) == NUMBER) {
- if (val.realnum<0.1 || val.realnum>10) xf86ConfigError(msg);
- else {
- xf86gGamma = 1.0 / val.realnum;
- if ((token = xf86GetToken(NULL)) != NUMBER || val.realnum<0.1 || val.realnum>10)
- xf86ConfigError(msg);
- else {
- xf86bGamma = 1.0 / val.realnum;
- }
- }
- }
- else pushToken = token;
- }
- break;
+ XF86ConfAdjacencyPtr adjp;
+ XF86ConfInactivePtr idp;
+ XF86ConfInputrefPtr irp;
+ int count = 0;
+ int scrnum;
+ XF86ConfLayoutPtr l;
+ MessageType from;
+ screenLayoutPtr slp;
+ GDevPtr gdp;
+ IDevPtr indp;
+ int i = 0, j;
+
+ if (!servlayoutp)
+ return FALSE;
+
+ /*
+ * which layout section is the active one?
+ *
+ * If there is a -layout command line option, use that one, otherwise
+ * pick the first one.
+ */
+ from = X_DEFAULT;
+ if (xf86LayoutName != NULL)
+ from = X_CMDLINE;
+ else if (default_layout) {
+ xf86LayoutName = default_layout;
+ from = X_CONFIG;
+ }
+ if (xf86LayoutName != NULL) {
+ if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
+ xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
+ xf86LayoutName);
+ return FALSE;
+ }
+ conf_layout = l;
}
- case EOF:
- FatalError("Unexpected EOF. Missing EndSection?");
- break; /* :-) */
+ xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
+ adjp = conf_layout->lay_adjacency_lst;
- default:
- xf86ConfigError("Monitor section keyword expected");
- break;
+ /*
+ * we know that each screen is referenced exactly once on the left side
+ * of a layout statement in the Layout section. So to allocate the right
+ * size for the array we do a quick walk of the list to figure out how
+ * many sections we have
+ */
+ while (adjp) {
+ count++;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
- }
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
+#ifdef DEBUG
+ ErrorF("Found %d screens in the layout section %s",
+ count, conf_layout->lay_identifier);
#endif
-}
+ slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
+ slp[count].screen = NULL;
+ /*
+ * now that we have storage, loop over the list again and fill in our
+ * data structure; at this point we do not fill in the adjacency
+ * information as it is not clear if we need it at all
+ */
+ adjp = conf_layout->lay_adjacency_lst;
+ count = 0;
+ while (adjp) {
+ slp[count].screen = xnfcalloc(1, sizeof(confScreenRec));
+ if (adjp->adj_scrnum < 0)
+ scrnum = count;
+ else
+ scrnum = adjp->adj_scrnum;
+ if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
+ X_CONFIG))
+ return FALSE;
+ slp[count].x = adjp->adj_x;
+ slp[count].y = adjp->adj_y;
+ slp[count].refname = adjp->adj_refscreen;
+ switch (adjp->adj_where) {
+ case CONF_ADJ_OBSOLETE:
+ slp[count].where = PosObsolete;
+ slp[count].topname = adjp->adj_top_str;
+ slp[count].bottomname = adjp->adj_bottom_str;
+ slp[count].leftname = adjp->adj_left_str;
+ slp[count].rightname = adjp->adj_right_str;
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ slp[count].where = PosAbsolute;
+ break;
+ case CONF_ADJ_RIGHTOF:
+ slp[count].where = PosRightOf;
+ break;
+ case CONF_ADJ_LEFTOF:
+ slp[count].where = PosLeftOf;
+ break;
+ case CONF_ADJ_ABOVE:
+ slp[count].where = PosAbove;
+ break;
+ case CONF_ADJ_BELOW:
+ slp[count].where = PosBelow;
+ break;
+ case CONF_ADJ_RELATIVE:
+ slp[count].where = PosRelative;
+ break;
+ }
+ count++;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ }
-static CONFIG_RETURN_TYPE
-configDynamicModuleSection()
-{
- int token;
-
- while ((token = xf86GetToken(ModuleTab)) != ENDSECTION) {
- switch (token) {
- case LOAD:
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("Dynamic module expected");
- else {
-#ifdef DYNAMIC_MODULE
- if (!modulePath) {
- static Bool firstTime = TRUE;
-
- modulePath = (char*)Xcalloc(strlen(DEFAULT_MODULE_PATH)+1);
- strcpy(modulePath, DEFAULT_MODULE_PATH);
-
- if (xf86Verbose && firstTime) {
- ErrorF("%s no ModulePath specified using default: %s\n",
- XCONFIG_PROBED, DEFAULT_MODULE_PATH);
- firstTime = FALSE;
- }
- }
- xf86LoadModule(val.str, modulePath);
-#else
- ErrorF("Dynamic modules not supported. \"%s\" not loaded\n",
- val.str);
-#endif
+ /* XXX Need to tie down the upper left screen. */
+
+ /* Fill in the refscreen and top/bottom/left/right values */
+ for (i = 0; i < count; i++) {
+ for (j = 0; j < count; j++) {
+ if (slp[i].refname &&
+ strcmp(slp[i].refname, slp[j].screen->id) == 0) {
+ slp[i].refscreen = slp[j].screen;
}
- break;
+ if (slp[i].topname &&
+ strcmp(slp[i].topname, slp[j].screen->id) == 0) {
+ slp[i].top = slp[j].screen;
+ }
+ if (slp[i].bottomname &&
+ strcmp(slp[i].bottomname, slp[j].screen->id) == 0) {
+ slp[i].bottom = slp[j].screen;
+ }
+ if (slp[i].leftname &&
+ strcmp(slp[i].leftname, slp[j].screen->id) == 0) {
+ slp[i].left = slp[j].screen;
+ }
+ if (slp[i].rightname &&
+ strcmp(slp[i].rightname, slp[j].screen->id) == 0) {
+ slp[i].right = slp[j].screen;
+ }
+ }
+ if (slp[i].where != PosObsolete
+ && slp[i].where != PosAbsolute
+ && !slp[i].refscreen) {
+ xf86Msg(X_ERROR,"Screen %s doesn't exist: deleting placement\n",
+ slp[i].refname);
+ slp[i].where = PosAbsolute;
+ slp[i].x = 0;
+ slp[i].y = 0;
+ }
+ }
- case EOF:
- FatalError("Unexpected EOF. Missing EndSection?");
- break; /* :-) */
-
- default:
- xf86ConfigError("Module section keyword expected");
+#ifdef LAYOUT_DEBUG
+ ErrorF("Layout \"%s\"\n", conf_layout->lay_identifier);
+ for (i = 0; i < count; i++) {
+ ErrorF("Screen: \"%s\" (%d):\n", slp[i].screen->id,
+ slp[i].screen->screennum);
+ switch (slp[i].where) {
+ case PosObsolete:
+ ErrorF("\tObsolete format: \"%s\" \"%s\" \"%s\" \"%s\"\n",
+ slp[i].top, slp[i].bottom, slp[i].left, slp[i].right);
+ break;
+ case PosAbsolute:
+ if (slp[i].x == -1)
+ if (slp[i].screen->screennum == 0)
+ ErrorF("\tImplicitly left-most\n");
+ else
+ ErrorF("\tImplicitly right of screen %d\n",
+ slp[i].screen->screennum - 1);
+ else
+ ErrorF("\t%d %d\n", slp[i].x, slp[i].y);
+ break;
+ case PosRightOf:
+ ErrorF("\tRight of \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosLeftOf:
+ ErrorF("\tLeft of \"%s\"\n", slp[i].refscreen->id);
break;
- }
+ case PosAbove:
+ ErrorF("\tAbove \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosBelow:
+ ErrorF("\tBelow \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosRelative:
+ ErrorF("\t%d %d relative to \"%s\"\n", slp[i].x, slp[i].y,
+ slp[i].refscreen->id);
+ break;
+ }
}
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
#endif
+ /*
+ * Count the number of inactive devices.
+ */
+ count = 0;
+ idp = conf_layout->lay_inactive_lst;
+ while (idp) {
+ count++;
+ idp = (XF86ConfInactivePtr)idp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d inactive devices in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ gdp = xnfalloc((count + 1) * sizeof(GDevRec));
+ gdp[count].identifier = NULL;
+ idp = conf_layout->lay_inactive_lst;
+ count = 0;
+ while (idp) {
+ if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
+ return FALSE;
+ count++;
+ idp = (XF86ConfInactivePtr)idp->list.next;
+ }
+ /*
+ * Count the number of input devices.
+ */
+ count = 0;
+ irp = conf_layout->lay_input_lst;
+ while (irp) {
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d input devices in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ indp = xnfalloc((count + 1) * sizeof(IDevRec));
+ indp[count].identifier = NULL;
+ irp = conf_layout->lay_input_lst;
+ count = 0;
+ while (irp) {
+ if (!configInput(&indp[count], irp->iref_inputdev, X_CONFIG))
+ return FALSE;
+ indp[count].extraOptions = irp->iref_option_lst;
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
+ }
+ servlayoutp->id = conf_layout->lay_identifier;
+ servlayoutp->screens = slp;
+ servlayoutp->inactives = gdp;
+ servlayoutp->inputs = indp;
+ servlayoutp->options = conf_layout->lay_option_lst;
+ from = X_DEFAULT;
+
+ if (!checkCoreInputDevices(servlayoutp, FALSE))
+ return FALSE;
+ return TRUE;
}
-static CONFIG_RETURN_TYPE
-readVerboseMode(monp)
-MonPtr monp;
+/*
+ * No layout section, so find the first Screen section and set that up as
+ * the only active screen.
+ */
+static Bool
+configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
{
- int token, token2;
- int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
-
- pNew = (DisplayModePtr)xalloc(sizeof(DisplayModeRec));
- pNew->next = NULL;
- pNew->prev = NULL;
- pNew->Flags = 0;
- pNew->HDisplay = pNew->VDisplay = 0; /* Uninitialized */
- pNew->CrtcHAdjusted = pNew->CrtcVAdjusted = FALSE;
- pNew->CrtcHSkew = pNew->HSkew = 0;
-
- if (monp->Last)
- monp->Last->next = pNew;
- else
- monp->Modes = pNew;
- monp->Last = pNew;
-
- if ( xf86GetToken(NULL) != STRING ) {
- FatalError("Mode name expected");
- }
- pNew->name = val.str;
- while ((token = xf86GetToken(ModeTab)) != ENDMODE) {
- switch (token) {
- case DOTCLOCK:
- if ((token = xf86GetToken(NULL)) != NUMBER) {
- FatalError("Dotclock expected");
- }
- pNew->Clock = (int)(val.realnum * 1000.0 + 0.5);
- had_dotclock = 1;
- break;
- case HTIMINGS:
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHDisplay = pNew->HDisplay = val.num;
- else xf86ConfigError("Horizontal display expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHSyncStart = pNew->HSyncStart = val.num;
- else xf86ConfigError("Horizontal sync start expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHSyncEnd = pNew->HSyncEnd = val.num;
- else xf86ConfigError("Horizontal sync end expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcHTotal = pNew->HTotal = val.num;
- else xf86ConfigError("Horizontal total expected");
- had_htimings = 1;
- break;
- case VTIMINGS:
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVDisplay = pNew->VDisplay = val.num;
- else xf86ConfigError("Vertical display expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVSyncStart = pNew->VSyncStart = val.num;
- else xf86ConfigError("Vertical sync start expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVSyncEnd = pNew->VSyncEnd = val.num;
- else xf86ConfigError("Vertical sync end expected");
-
- if (xf86GetToken(NULL) == NUMBER)
- pNew->CrtcVTotal = pNew->VTotal = val.num;
- else xf86ConfigError("Vertical total expected");
- had_vtimings = 1;
- break;
- case FLAGS:
- token = xf86GetToken(NULL);
- if (token != STRING)
- xf86ConfigError("Flag string expected. Note: flags must be in \"\"");
- while ( token == STRING ) {
- token2 = getStringToken(TimingTab);
- switch(token2) {
- case TT_INTERLACE: pNew->Flags |= V_INTERLACE; break;
- case TT_PHSYNC: pNew->Flags |= V_PHSYNC; break;
- case TT_NHSYNC: pNew->Flags |= V_NHSYNC; break;
- case TT_PVSYNC: pNew->Flags |= V_PVSYNC; break;
- case TT_NVSYNC: pNew->Flags |= V_NVSYNC; break;
- case TT_CSYNC: pNew->Flags |= V_CSYNC; break;
- case TT_PCSYNC: pNew->Flags |= V_PCSYNC; break;
- case TT_NCSYNC: pNew->Flags |= V_NCSYNC; break;
- case TT_DBLSCAN: pNew->Flags |= V_DBLSCAN; break;
- default:
- xf86ConfigError("Unknown flag string"); break;
- }
- token = xf86GetToken(NULL);
- }
- pushToken = token;
- break;
- case HSKEW:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Horizontal skew expected");
- pNew->Flags |= V_HSKEW;
- pNew->CrtcHSkew = pNew->HSkew = val.num;
- break;
+ MessageType from;
+ XF86ConfScreenPtr s;
+ screenLayoutPtr slp;
+ IDevPtr indp;
+
+ if (!servlayoutp)
+ return FALSE;
+
+ if (conf_screen == NULL) {
+ xf86ConfigError("No Screen sections present\n");
+ return FALSE;
}
- }
- if ( !had_dotclock ) xf86ConfigError("the dotclock is missing");
- if ( !had_htimings ) xf86ConfigError("the horizontal timings are missing");
- if ( !had_vtimings ) xf86ConfigError("the vertical timings are missing");
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
-#endif
-}
-static Bool dummy;
+ /*
+ * which screen section is the active one?
+ *
+ * If there is a -screen option, use that one, otherwise use the first
+ * one.
+ */
-#ifdef XF86SETUP
-int xf86setup_scrn_ndisps[8];
-DispPtr xf86setup_scrn_displays[8];
-#endif
+ from = X_CONFIG;
+ if (xf86ScreenName != NULL) {
+ if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
+ xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
+ xf86ScreenName);
+ return FALSE;
+ }
+ conf_screen = s;
+ from = X_CMDLINE;
+ }
+
+ /* We have exactly one screen */
+
+ slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec));
+ slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
+ slp[1].screen = NULL;
+ if (!configScreen(slp[0].screen, conf_screen, 0, from))
+ return FALSE;
+ servlayoutp->id = "(implicit)";
+ servlayoutp->screens = slp;
+ servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec));
+ servlayoutp->options = NULL;
+ /* Set up an empty input device list, then look for some core devices. */
+ indp = xnfalloc(sizeof(IDevRec));
+ indp->identifier = NULL;
+ servlayoutp->inputs = indp;
+ if (!checkCoreInputDevices(servlayoutp, TRUE))
+ return FALSE;
+
+ return TRUE;
+}
-static CONFIG_RETURN_TYPE
-configScreenSection()
+static Bool
+configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
{
- int i, j;
- int driverno;
- int had_monitor = 0, had_device = 0;
- int dispIndex = 0;
- int numDisps = 0;
- DispPtr dispList = NULL;
- DispPtr dispp;
-
- int token;
- ScrnInfoPtr screen = NULL;
- int textClockValue = -1;
-
- token = xf86GetToken(ScreenTab);
- if ( token != DRIVER )
- xf86ConfigError("The screen section must begin with the 'driver' line");
-
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Driver name expected");
- driverno = getStringToken(DriverTab);
- switch ( driverno ) {
- case SVGA:
- case VGA2:
- case MONO:
- case VGA16:
- case ACCEL:
- case FBDEV:
- break;
- default:
- xf86ConfigError("Not a recognized driver name");
- }
- scr_index = getScreenIndex(driverno);
+ int count = 0;
+ XF86ConfVideoPortPtr conf_port;
+
+ xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n",
+ conf_adaptor->va_identifier);
+ adaptor->identifier = conf_adaptor->va_identifier;
+ adaptor->options = conf_adaptor->va_option_lst;
+ if (conf_adaptor->va_busid || conf_adaptor->va_driver) {
+ xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
+ return FALSE;
+ }
- dummy = scr_index < 0 || !xf86Screens[scr_index];
- if (dummy)
- screen = (ScrnInfoPtr)xalloc(sizeof(ScrnInfoRec));
- else
- {
- screen = xf86Screens[scr_index];
- screen->configured = TRUE;
- screen->tmpIndex = screenno++;
- screen->scrnIndex = scr_index; /* scrnIndex must not be changed */
- screen->frameX0 = -1;
- screen->frameY0 = -1;
- screen->virtualX = -1;
- screen->virtualY = -1;
- screen->defaultVisual = -1;
- screen->modes = NULL;
- screen->width = 240;
- screen->height = 180;
- screen->bankedMono = FALSE;
- screen->textclock = -1;
- screen->blackColour.red = 0;
- screen->blackColour.green = 0;
- screen->blackColour.blue = 0;
- screen->whiteColour.red = 0x3F;
- screen->whiteColour.green = 0x3F;
- screen->whiteColour.blue = 0x3F;
- }
- screen->clocks = 0;
+ /*
+ * figure out how many videoport subsections there are and fill them in
+ */
+ conf_port = conf_adaptor->va_port_lst;
+ while(conf_port) {
+ count++;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ }
+ adaptor->ports = xnfalloc((count) * sizeof(confXvPortRec));
+ adaptor->numports = count;
+ count = 0;
+ conf_port = conf_adaptor->va_port_lst;
+ while(conf_port) {
+ adaptor->ports[count].identifier = conf_port->vp_identifier;
+ adaptor->ports[count].options = conf_port->vp_option_lst;
+ count++;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ }
- while ((token = xf86GetToken(ScreenTab)) != ENDSECTION) {
- switch (token) {
+ return TRUE;
+}
+
+static Bool
+configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
+ MessageType from)
+{
+ int count = 0;
+ XF86ConfDisplayPtr dispptr;
+ XF86ConfAdaptorLinkPtr conf_adaptor;
- case DEFBPP:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Default color depth expected");
- screen->depth = val.num;
- break;
+ xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
+ scrnum);
+ /*
+ * now we fill in the elements of the screen
+ */
+ screenp->id = conf_screen->scrn_identifier;
+ screenp->screennum = scrnum;
+ screenp->defaultdepth = conf_screen->scrn_defaultdepth;
+ screenp->defaultbpp = conf_screen->scrn_defaultbpp;
+ screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp;
+ screenp->monitor = xnfcalloc(1, sizeof(MonRec));
+ if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
+ return FALSE;
+ screenp->device = xnfcalloc(1, sizeof(GDevRec));
+ configDevice(screenp->device,conf_screen->scrn_device, TRUE);
+ screenp->device->myScreenSection = screenp;
+ screenp->options = conf_screen->scrn_option_lst;
+
+ /*
+ * figure out how many display subsections there are and fill them in
+ */
+ dispptr = conf_screen->scrn_display_lst;
+ while(dispptr) {
+ count++;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ }
+ screenp->displays = xnfalloc((count) * sizeof(DispRec));
+ screenp->numdisplays = count;
+ count = 0;
+ dispptr = conf_screen->scrn_display_lst;
+ while(dispptr) {
+ configDisplay(&(screenp->displays[count]),dispptr);
+ count++;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ }
- case SCREENNO:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Screen number expected");
- screen->tmpIndex = val.num;
- break;
+ /*
+ * figure out how many videoadaptor references there are and fill them in
+ */
+ conf_adaptor = conf_screen->scrn_adaptor_lst;
+ while(conf_adaptor) {
+ count++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ }
+ screenp->xvadaptors = xnfalloc((count) * sizeof(confXvAdaptorRec));
+ screenp->numxvadaptors = 0;
+ conf_adaptor = conf_screen->scrn_adaptor_lst;
+ while(conf_adaptor) {
+ if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]),
+ conf_adaptor->al_adaptor))
+ screenp->numxvadaptors++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ }
- case SUBSECTION:
- if ((xf86GetToken(NULL) != STRING) || (StrCaseCmp(val.str, "display") != 0)) {
- xf86ConfigError("You must say \"Display\" here");
- }
- if (dispList == NULL) {
- dispList = (DispPtr)xalloc(sizeof(DispRec));
- } else {
- dispList = (DispPtr)xrealloc(dispList,
- (numDisps + 1) * sizeof(DispRec));
- }
- dispp = dispList + numDisps;
- numDisps++;
- dispp->depth = -1;
- dispp->weight.red = dispp->weight.green = dispp->weight.blue = 0;
- dispp->frameX0 = -1;
- dispp->frameY0 = -1;
- dispp->virtualX = -1;
- dispp->virtualY = -1;
- dispp->modes = NULL;
- dispp->whiteColour.red = dispp->whiteColour.green =
- dispp->whiteColour.blue = 0x3F;
- dispp->blackColour.red = dispp->blackColour.green =
- dispp->blackColour.blue = 0;
- dispp->defaultVisual = -1;
- OFLG_ZERO(&(dispp->options));
- OFLG_ZERO(&(dispp->xconfigFlag));
- dispp->DCOptions = NULL;
-
- configDisplaySubsection(dispp);
- break;
-
- case EOF:
- FatalError("Unexpected EOF (missing EndSection?)");
- break; /* :-) */
-
- case MDEVICE:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Device name expected");
- for ( i = 0 ; i < n_devices ; i++ ) {
- if ( strcmp(device_list[i].identifier,val.str) == 0 ) {
- /* Copy back */
- if (!dummy && xf86Verbose) {
- ErrorF("%s %s: Graphics device ID: \"%s\"\n",
- XCONFIG_GIVEN, screen->name, device_list[i].identifier);
- }
- screen->clocks = device_list[i].clocks;
- for ( j = 0 ; j < MAXCLOCKS ; j++ ) {
- screen->clock[j] = device_list[i].clock[j];
- }
- screen->chipset = device_list[i].chipset;
- screen->ramdac = device_list[i].ramdac;
- for (j=0; j<MAXDACSPEEDS; j++)
- screen->dacSpeeds[j] = device_list[i].dacSpeeds[j];
- screen->dacSpeedBpp = 0;
- screen->options = device_list[i].options;
- screen->clockOptions = device_list[i].clockOptions;
- screen->xconfigFlag = device_list[i].xconfigFlag;
- screen->videoRam = device_list[i].videoRam;
- screen->speedup = device_list[i].speedup;
- screen->clockprog = device_list[i].clockprog;
- textClockValue = device_list[i].textClockValue;
- if (OFLG_ISSET(XCONFIG_BIOSBASE, &screen->xconfigFlag))
- screen->BIOSbase = device_list[i].BIOSbase;
- if (OFLG_ISSET(XCONFIG_MEMBASE, &screen->xconfigFlag))
- screen->MemBase = device_list[i].MemBase;
- if (OFLG_ISSET(XCONFIG_IOBASE, &screen->xconfigFlag))
- screen->IObase = device_list[i].IObase;
- if (OFLG_ISSET(XCONFIG_DACBASE, &screen->xconfigFlag))
- screen->DACbase = device_list[i].DACbase;
- if (OFLG_ISSET(XCONFIG_COPBASE, &screen->xconfigFlag))
- screen->COPbase = device_list[i].COPbase;
- if (OFLG_ISSET(XCONFIG_POSBASE, &screen->xconfigFlag))
- screen->POSbase = device_list[i].POSbase;
- if (OFLG_ISSET(XCONFIG_INSTANCE, &screen->xconfigFlag))
- screen->instance = device_list[i].instance;
- screen->s3Madjust = device_list[i].s3Madjust;
- screen->s3Nadjust = device_list[i].s3Nadjust;
- screen->s3MClk = device_list[i].s3MClk;
- screen->MemClk = device_list[i].MemClk;
- screen->LCDClk = device_list[i].LCDClk;
- screen->chipID = device_list[i].chipID;
- screen->chipRev = device_list[i].chipRev;
- screen->s3RefClk = device_list[i].s3RefClk;
- screen->s3BlankDelay = device_list[i].s3BlankDelay;
- screen->textClockFreq = device_list[i].textClockValue;
- if (OFLG_ISSET(XCONFIG_VGABASE, &screen->xconfigFlag))
- screen->VGAbase = device_list[i].VGAbase;
- screen->DCConfig = device_list[i].DCConfig;
- screen->DCOptions = device_list[i].DCOptions;
-#ifdef XF86SETUP
- screen->device = (void *) &device_list[i];
-#endif
- break;
- }
- }
- if ( i == n_devices ) { /* Exhausted the device list */
- xf86ConfigError("Not a declared device");
- }
- had_device = 1;
- break;
-
- case MONITOR:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Monitor name expected");
- for ( i = 0 ; i < n_monitors ; i++ ) {
- if ( strcmp(monitor_list[i].id,val.str) == 0 ) {
- if (!dummy && xf86Verbose) {
- ErrorF("%s %s: Monitor ID: \"%s\"\n",
- XCONFIG_GIVEN, screen->name, monitor_list[i].id);
- }
- if (!dummy) {
- monitor_list[i].Modes = xf86PruneModes(&monitor_list[i],
- monitor_list[i].Modes,
- screen, FALSE);
- screen->monitor = (MonPtr)xalloc(sizeof(MonRec));
- memcpy(screen->monitor, &monitor_list[i], sizeof(MonRec));
- }
- break;
- }
- }
- if ( i == n_monitors ) { /* Exhausted the monitor list */
- xf86ConfigError("Not a declared monitor");
- }
- had_monitor = 1;
- break;
-
- case BLANKTIME:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Screensaver blank time expected");
- if (!dummy && !xf86sFlag)
- defaultScreenSaverTime = ScreenSaverTime = val.num * MILLI_PER_MIN;
- break;
-
- case STANDBYTIME:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Screensaver standby time expected");
-#ifdef DPMSExtension
- if (!dummy)
- DPMSStandbyTime = val.num * MILLI_PER_MIN;
-#endif
- break;
+ return TRUE;
+}
- case SUSPENDTIME:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Screensaver suspend time expected");
-#ifdef DPMSExtension
- if (!dummy)
- DPMSSuspendTime = val.num * MILLI_PER_MIN;
-#endif
- break;
+static Bool
+configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
+{
+ int count;
+ DisplayModePtr mode,last = NULL;
+ XF86ConfModeLinePtr cmodep;
+ XF86ConfModesPtr modes;
+ XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
+ Gamma zeros = {0.0, 0.0, 0.0};
+ float badgamma = 0.0;
+
+ xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n",
+ conf_monitor->mon_identifier);
+ monitorp->id = conf_monitor->mon_identifier;
+ monitorp->vendor = conf_monitor->mon_vendor;
+ monitorp->model = conf_monitor->mon_modelname;
+ monitorp->Modes = NULL;
+ monitorp->Last = NULL;
+ monitorp->gamma = zeros;
+ monitorp->widthmm = conf_monitor->mon_width;
+ monitorp->heightmm = conf_monitor->mon_height;
+ monitorp->options = conf_monitor->mon_option_lst;
- case OFFTIME:
- if (xf86GetToken(NULL) != NUMBER)
- xf86ConfigError("Screensaver off time expected");
-#ifdef DPMSExtension
- if (!dummy)
- DPMSOffTime = val.num * MILLI_PER_MIN;
-#endif
- break;
+ /*
+ * fill in the monitor structure
+ */
+ for( count = 0 ; count < conf_monitor->mon_n_hsync; count++) {
+ monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi;
+ monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo;
+ }
+ monitorp->nHsync = conf_monitor->mon_n_hsync;
+ for( count = 0 ; count < conf_monitor->mon_n_vrefresh; count++) {
+ monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi;
+ monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo;
+ }
+ monitorp->nVrefresh = conf_monitor->mon_n_vrefresh;
- default:
- if (!dummy && !validateGraphicsToken(screen->validTokens, token))
- {
- xf86ConfigError("Screen section keyword expected");
- }
- break;
+ /*
+ * first we collect the mode lines from the UseModes directive
+ */
+ while(modeslnk)
+ {
+ modes = xf86findModes (modeslnk->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ modeslnk->ml_modes = modes;
+
+
+ /* now add the modes found in the modes
+ section to the list of modes for this
+ monitor unless it has been added before
+ because we are reusing the same section
+ for another screen */
+ if (xf86itemNotSublist(
+ (GenericListPtr)conf_monitor->mon_modeline_lst,
+ (GenericListPtr)modes->mon_modeline_lst)) {
+ conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
+ xf86addListItem(
+ (GenericListPtr)conf_monitor->mon_modeline_lst,
+ (GenericListPtr)modes->mon_modeline_lst);
+ }
+ modeslnk = modeslnk->list.next;
}
- }
- if (!dummy) {
- if (dispList == NULL) {
- FatalError(
- "A \"Display\" subsection is required in each \"Screen\" section\n");
- } else {
- /* Work out which if any Display subsection to use based on depth */
- if (xf86bpp < 0) {
- /*
- * no -bpp option given, so take depth if only one Display subsection
- * Don't do this for VGA2 and VGA16 where it makes no sense, and only
- * causes problems
- */
- if (numDisps == 1) {
-#ifndef XF86SETUP
- if (dispList[0].depth > 0
- && !(driverno >= VGA2 && driverno <= VGA16)) {
- xf86bpp = dispList[0].depth;
- }
-#endif
- dispIndex = 0;
- } else {
- xf86bpp = screen->depth;
- /* Look for a section which matches the driver's default depth */
- for (dispIndex = 0; dispIndex < numDisps; dispIndex++) {
- if (dispList[dispIndex].depth == screen->depth)
- break;
- }
- if (dispIndex == numDisps) {
- /* No match. This time, allow 15/16 and 24/32 to match */
- for (dispIndex = 0; dispIndex < numDisps; dispIndex++) {
- if ((screen->depth == 15 && dispList[dispIndex].depth == 16) ||
- (screen->depth == 16 && dispList[dispIndex].depth == 15) ||
- (screen->depth == 24 && dispList[dispIndex].depth == 32) ||
- (screen->depth == 32 && dispList[dispIndex].depth == 24))
- break;
- }
- }
- if (dispIndex == numDisps) {
- /* Still no match, so exit */
- FatalError("No \"Display\" subsection for default depth %d\n",
- screen->depth);
- }
+ /*
+ * we need to hook in the mode lines now
+ * here both data structures use lists, only our internal one
+ * is double linked
+ */
+ cmodep = conf_monitor->mon_modeline_lst;
+ while( cmodep ) {
+ mode = xnfalloc(sizeof(DisplayModeRec));
+ memset(mode,'\0',sizeof(DisplayModeRec));
+ mode->type = 0;
+ mode->Clock = cmodep->ml_clock;
+ mode->HDisplay = cmodep->ml_hdisplay;
+ mode->HSyncStart = cmodep->ml_hsyncstart;
+ mode->HSyncEnd = cmodep->ml_hsyncend;
+ mode->HTotal = cmodep->ml_htotal;
+ mode->VDisplay = cmodep->ml_vdisplay;
+ mode->VSyncStart = cmodep->ml_vsyncstart;
+ mode->VSyncEnd = cmodep->ml_vsyncend;
+ mode->VTotal = cmodep->ml_vtotal;
+ mode->Flags = cmodep->ml_flags;
+ mode->HSkew = cmodep->ml_hskew;
+ mode->VScan = cmodep->ml_vscan;
+ mode->name = xnfstrdup(cmodep->ml_identifier);
+ if( last ) {
+ mode->prev = last;
+ last->next = mode;
}
- } else {
- /* xf86bpp is set */
- if (numDisps == 1 && dispList[0].depth < 0) {
- /* one Display subsection, no depth set, so use it */
- /* XXXX Maybe should only do this when xf86bpp == default depth?? */
- dispIndex = 0;
- } else {
- /* find Display subsection matching xf86bpp */
- for (dispIndex = 0; dispIndex < numDisps; dispIndex++) {
- if (dispList[dispIndex].depth == xf86bpp)
- break;
- }
- if (dispIndex == numDisps) {
-#if 0
- /* No match. This time, allow 15/16 and 24/32 to match */
- for (dispIndex = 0; dispIndex < numDisps; dispIndex++) {
- if ((xf86bpp == 15 && dispList[dispIndex].depth == 16) ||
- (xf86bpp == 16 && dispList[dispIndex].depth == 15) ||
- (xf86bpp == 24 && dispList[dispIndex].depth == 32) ||
- (xf86bpp == 32 && dispList[dispIndex].depth == 24))
- break;
-#else
- /* No match. This time, allow 15/16 to match */
- for (dispIndex = 0; dispIndex < numDisps; dispIndex++) {
- if ((xf86bpp == 15 && dispList[dispIndex].depth == 16) ||
- (xf86bpp == 16 && dispList[dispIndex].depth == 15))
- break;
-#endif
- }
- }
- if (dispIndex == numDisps) {
- if (!(driverno >= VGA2 && driverno <= VGA16)) {
- /* Still no match, so exit */
- FatalError("No \"Display\" subsection for -bpp depth %d\n",
- xf86bpp);
- }
- else
- dispIndex = 0;
- }
+ else {
+ /*
+ * this is the first mode
+ */
+ monitorp->Modes = mode;
+ mode->prev = NULL;
}
- }
- /* Now copy the info across to the screen rec */
- dispp = dispList + dispIndex;
- if (xf86bpp > 0) screen->depth = xf86bpp;
- else if (dispp->depth > 0) screen->depth = dispp->depth;
- if (xf86weight.red || xf86weight.green || xf86weight.blue)
- screen->weight = xf86weight;
- else if (dispp->weight.red > 0) {
- screen->weight = dispp->weight;
- xf86weight = dispp->weight;
- }
- screen->frameX0 = dispp->frameX0;
- screen->frameY0 = dispp->frameY0;
- screen->virtualX = dispp->virtualX;
- screen->virtualY = dispp->virtualY;
- screen->modes = dispp->modes;
- screen->whiteColour = dispp->whiteColour;
- screen->blackColour = dispp->blackColour;
- screen->defaultVisual = dispp->defaultVisual;
- /* Add any new options that might be set */
- for (i = 0; i < MAX_OFLAGS; i++) {
- if (OFLG_ISSET(i, &(dispp->options)))
- OFLG_SET(i, &(screen->options));
- if (OFLG_ISSET(i, &(dispp->xconfigFlag)))
- OFLG_SET(i, &(screen->xconfigFlag));
- }
- screen->DCOptions = xf86DCConcatOption(screen->DCOptions,dispp->DCOptions);
-#ifdef XF86SETUP
- xf86setup_scrn_ndisps[driverno-SVGA] = numDisps;
- xf86setup_scrn_displays[driverno-SVGA] = dispList;
-#else
- /* Don't need them any more */
- xfree(dispList);
-#endif
+ last = mode;
+ cmodep = (XF86ConfModeLinePtr)cmodep->list.next;
}
-
- /* Maybe these should be FatalError() instead? */
- if ( !had_monitor ) {
- xf86ConfigError("A screen must specify a monitor");
+ if(last){
+ last->next = NULL;
}
- if ( !had_device ) {
- xf86ConfigError("A screen must specify a device");
+ monitorp->Last = last;
+
+ /* add the (VESA) default modes */
+ if (! addDefaultModes(monitorp) )
+ return FALSE;
+
+ if (conf_monitor->mon_gamma_red > GAMMA_ZERO)
+ monitorp->gamma.red = conf_monitor->mon_gamma_red;
+ if (conf_monitor->mon_gamma_green > GAMMA_ZERO)
+ monitorp->gamma.green = conf_monitor->mon_gamma_green;
+ if (conf_monitor->mon_gamma_blue > GAMMA_ZERO)
+ monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
+
+ /* Check that the gamma values are within range */
+ if (monitorp->gamma.red > GAMMA_ZERO &&
+ (monitorp->gamma.red < GAMMA_MIN ||
+ monitorp->gamma.red > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.red;
+ } else if (monitorp->gamma.green > GAMMA_ZERO &&
+ (monitorp->gamma.green < GAMMA_MIN ||
+ monitorp->gamma.green > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.green;
+ } else if (monitorp->gamma.blue > GAMMA_ZERO &&
+ (monitorp->gamma.blue < GAMMA_MIN ||
+ monitorp->gamma.blue > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.blue;
+ }
+ if (badgamma > GAMMA_ZERO) {
+ xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
+ badgamma, GAMMA_MIN, GAMMA_MAX);
+ return FALSE;
}
- }
- /* Check for information that must be specified in XF86Config */
- if (scr_index >= 0 && xf86Screens[scr_index])
- {
- ScrnInfoPtr driver = xf86Screens[scr_index];
+ return TRUE;
+}
- graphFound = TRUE;
+static int
+lookupVisual(const char *visname)
+{
+ int i;
- if (driver->clockprog && !driver->clocks)
- {
- if (!OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(screen->clockOptions))){
- ErrorF("%s: No clock line specified: assuming programmable clocks\n");
- OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &(screen->clockOptions));}
- driver->textclock = textClockValue;
- }
+ if (!visname || !*visname)
+ return -1;
- /* Find the Index of the Text Clock for the ClockProg */
- if (driver->clockprog && textClockValue > 0
- && !OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(screen->clockOptions)))
- {
- driver->textclock = xf86GetNearestClock(driver, textClockValue);
- if (abs(textClockValue - driver->clock[driver->textclock]) >
- CLOCK_TOLERANCE)
- FatalError(
- "There is no defined dot-clock matching the text clock\n");
- if (xf86Verbose)
- ErrorF("%s %s: text clock = %7.3f, clock used = %7.3f\n",
- XCONFIG_GIVEN,
- driver->name, textClockValue / 1000.0,
- driver->clock[driver->textclock] / 1000.0);
- }
- if (xf86Verbose && driver->defaultVisual > 0) {
- char *visualname;
- switch (driver->defaultVisual) {
- case StaticGray:
- case GrayScale:
- case StaticColor:
- case PseudoColor:
- case TrueColor:
- case DirectColor:
- visualname = xf86VisualNames[driver->defaultVisual];
- break;
- default:
- xf86ConfigError("unknown visual type");
- }
- ErrorF("%s %s: Default visual: %s\n", XCONFIG_GIVEN, driver->name,
- visualname);
+ for (i = 0; i <= DirectColor; i++) {
+ if (!xf86nameCompare(visname, xf86VisualNames[i]))
+ break;
}
- if (defaultColorVisualClass < 0)
- defaultColorVisualClass = driver->defaultVisual;
- /* GJA --Moved these from the device code. Had to reorganize it
- * a bit.
- */
- if (xf86Verbose) {
- if (OFLG_ISSET(XCONFIG_IOBASE, &driver->xconfigFlag))
- ErrorF("%s %s: Direct Access Register I/O Base Address: %x\n",
- XCONFIG_GIVEN, driver->name, driver->IObase);
-
- if (OFLG_ISSET(XCONFIG_DACBASE, &driver->xconfigFlag))
- ErrorF("%s %s: DAC Base I/O Address: %x\n",
- XCONFIG_GIVEN, driver->name, driver->DACbase);
-
- if (OFLG_ISSET(XCONFIG_COPBASE, &driver->xconfigFlag))
- ErrorF("%s %s: Coprocessor Base Memory Address: %x\n",
- XCONFIG_GIVEN, driver->name, driver->COPbase);
-
- if (OFLG_ISSET(XCONFIG_POSBASE, &driver->xconfigFlag))
- ErrorF("%s %s: POS Base Address: %x\n", XCONFIG_GIVEN, driver->name,
- driver->POSbase);
-
- if (OFLG_ISSET(XCONFIG_BIOSBASE, &driver->xconfigFlag))
- ErrorF("%s %s: BIOS Base Address: %x\n", XCONFIG_GIVEN, driver->name,
- driver->BIOSbase);
-
- if (OFLG_ISSET(XCONFIG_MEMBASE, &driver->xconfigFlag))
- ErrorF("%s %s: Memory Base Address: %x\n", XCONFIG_GIVEN,
- driver->name, driver->MemBase);
-
- if (OFLG_ISSET(XCONFIG_VGABASE, &driver->xconfigFlag))
- ErrorF("%s %s: VGA Aperture Base Address: %x\n", XCONFIG_GIVEN,
- driver->name, driver->VGAbase);
-
- /* Print clock program */
- if ( driver->clockprog ) {
- ErrorF("%s %s: ClockProg: \"%s\"", XCONFIG_GIVEN, driver->name,
- driver->clockprog);
- if ( textClockValue )
- ErrorF(", Text Clock: %7.3f\n", textClockValue / 1000.0);
- ErrorF("\n");
- }
- }
- }
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
-#endif
+ if (i <= DirectColor)
+ return i;
+
+ return -1;
}
-static CONFIG_RETURN_TYPE
-configDisplaySubsection(disp)
-DispPtr disp;
+
+static Bool
+configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display)
{
- int token;
- int i;
-
- while ((token = xf86GetToken(DisplayTab)) != ENDSUBSECTION) {
- switch (token) {
- case DEPTH:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Display depth expected");
- disp->depth = val.num;
- break;
-
- case WEIGHT:
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Display weight expected");
- if (val.num > 9) {
- disp->weight.red = (val.num / 100) % 10;
- disp->weight.green = (val.num / 10) % 10;
- disp->weight.blue = val.num % 10;
- } else {
- disp->weight.red = val.num;
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Display weight expected");
- disp->weight.green = val.num;
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Display weight expected");
- disp->weight.blue = val.num;
- }
- break;
-
- case VIEWPORT:
- OFLG_SET(XCONFIG_VIEWPORT,&(disp->xconfigFlag));
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Viewport X expected");
- disp->frameX0 = val.num;
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Viewport Y expected");
- disp->frameY0 = val.num;
- break;
-
- case VIRTUAL:
- OFLG_SET(XCONFIG_VIRTUAL,&(disp->xconfigFlag));
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Virtual X expected");
- disp->virtualX = val.num;
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Virtual Y expected");
- disp->virtualY = val.num;
- break;
-
- case MODES:
- for (pLast=NULL; (token = xf86GetToken(NULL)) == STRING; pLast = pNew)
- {
- pNew = (DisplayModePtr)xalloc(sizeof(DisplayModeRec));
- pNew->name = val.str;
- pNew->PrivSize = 0;
- pNew->Private = NULL;
-
- if (pLast)
- {
- pLast->next = pNew;
- pNew->prev = pLast;
- }
- else
- disp->modes = pNew;
- }
- /* Make sure at least one mode was present */
- if (!pLast)
- xf86ConfigError("Mode name expected");
- pNew->next = disp->modes;
- disp->modes->prev = pLast;
- pushToken = token;
- break;
-
- case BLACK:
- case WHITE:
- {
- unsigned char rgb[3];
- int ii;
-
- for (ii = 0; ii < 3; ii++)
- {
- if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("RGB value expected");
- rgb[ii] = val.num & 0x3F;
- }
- if (token == BLACK)
- {
- disp->blackColour.red = rgb[0];
- disp->blackColour.green = rgb[1];
- disp->blackColour.blue = rgb[2];
- }
- else
- {
- disp->whiteColour.red = rgb[0];
- disp->whiteColour.green = rgb[1];
- disp->whiteColour.blue = rgb[2];
- }
- }
- break;
-
- case VISUAL:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Visual name expected");
- token = getStringToken(VisualTab);
- if (!dummy && disp->defaultVisual >= 0)
- xf86ConfigError("Only one default visual may be specified");
- disp->defaultVisual = token - STATICGRAY;
- break;
-
- case OPTION:
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Option string expected");
- i = 0;
- while (xf86_OptionTab[i].token != -1)
- {
- if (StrCaseCmp(val.str, xf86_OptionTab[i].name) == 0)
- {
- OFLG_SET(xf86_OptionTab[i].token, &(disp->options));
- break;
- }
- i++;
- }
- if (xf86_OptionTab[i].token == -1)
- disp->DCOptions = xf86DCOption(disp->DCOptions,val);
- break;
-
- /* The following should really go in the S3 server */
- case INVERTVCLK:
- case BLANKDELAY:
- case EARLYSC:
- {
- DisplayModePtr p = disp->modes;
- if (xf86GetToken(NULL) != STRING) xf86ConfigError("Mode name expected");
- if (disp->modes == NULL)
- xf86ConfigError("This must be after the Modes line");
- {
- Bool found = FALSE;
- int opt;
- INT32 value;
- char *mode_string = (char *)xalloc(strlen(val.str)+1);
- strcpy(mode_string,val.str);
-
- switch (token) {
- default: /* pacify compiler (uninitialized opt, value) */
- case INVERTVCLK:
- if (xf86GetToken(NULL) != NUMBER || val.num < 0 || val.num > 1)
- xf86ConfigError("0 or 1 expected");
- opt = S3_INVERT_VCLK;
- value = val.num;
- break;
-
- case BLANKDELAY:
- if (xf86GetToken(NULL) != NUMBER || val.num < 0 || val.num > 7)
- xf86ConfigError("number(s) 0..7 expected");
- opt = S3_BLANK_DELAY;
- value = val.num;
- if ((token=xf86GetToken(NULL)) == NUMBER) {
- if (val.num < 0 || val.num > 7)
- xf86ConfigError("number2 0..7 expected");
- value |= val.num << 4;
- }
- else pushToken = token;
- break;
-
- case EARLYSC:
- if (xf86GetToken(NULL) != NUMBER || val.num < 0 || val.num > 1)
- xf86ConfigError("0 or 1 expected");
- opt = S3_EARLY_SC;
- value = val.num;
- break;
- }
-
- do {
- if (strcmp(p->name, mode_string) == 0
- || strcmp("*", mode_string) == 0) {
- found = TRUE;
- if (!p->PrivSize || !p->Private) {
- p->PrivSize = S3_MODEPRIV_SIZE;
- p->Private = (INT32 *)Xcalloc(sizeof(INT32) * S3_MODEPRIV_SIZE);
- p->Private[0] = 0;
- }
- p->Private[0] |= (1 << opt);
- p->Private[opt] = value;
- }
- p = p->next;
- } while (p != disp->modes);
- if (!found) xf86ConfigError("No mode of that name in the Modes line");
- xfree(mode_string);
- }
- }
- break;
+ int count = 0;
+ XF86ModePtr modep;
+ displayp->frameX0 = conf_display->disp_frameX0;
+ displayp->frameY0 = conf_display->disp_frameY0;
+ displayp->virtualX = conf_display->disp_virtualX;
+ displayp->virtualY = conf_display->disp_virtualY;
+ displayp->depth = conf_display->disp_depth;
+ displayp->fbbpp = conf_display->disp_bpp;
+ displayp->weight.red = conf_display->disp_weight.red;
+ displayp->weight.green = conf_display->disp_weight.green;
+ displayp->weight.blue = conf_display->disp_weight.blue;
+ displayp->blackColour.red = conf_display->disp_black.red;
+ displayp->blackColour.green = conf_display->disp_black.green;
+ displayp->blackColour.blue = conf_display->disp_black.blue;
+ displayp->whiteColour.red = conf_display->disp_white.red;
+ displayp->whiteColour.green = conf_display->disp_white.green;
+ displayp->whiteColour.blue = conf_display->disp_white.blue;
+ displayp->options = conf_display->disp_option_lst;
+ if (conf_display->disp_visual) {
+ displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
+ if (displayp->defaultVisual == -1) {
+ xf86ConfigError("Invalid visual name: \"%s\"",
+ conf_display->disp_visual);
+ return FALSE;
+ }
+ } else {
+ displayp->defaultVisual = -1;
+ }
+
+ /*
+ * now hook in the modes
+ */
+ modep = conf_display->disp_mode_lst;
+ while(modep) {
+ count++;
+ modep = (XF86ModePtr)modep->list.next;
+ }
+ displayp->modes = xnfalloc((count+1) * sizeof(char*));
+ modep = conf_display->disp_mode_lst;
+ count = 0;
+ while(modep) {
+ displayp->modes[count] = modep->mode_name;
+ count++;
+ modep = (XF86ModePtr)modep->list.next;
+ }
+ displayp->modes[count] = NULL;
- case EOF:
- FatalError("Unexpected EOF (missing EndSubSection)");
- break; /* :-) */
+ return TRUE;
+}
- default:
- xf86ConfigError("Display subsection keyword expected");
- break;
+static Bool
+configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
+{
+ int i;
+
+ if (active)
+ xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
+ conf_device->dev_identifier);
+ else
+ xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
+ conf_device->dev_identifier);
+
+ devicep->identifier = conf_device->dev_identifier;
+ devicep->vendor = conf_device->dev_vendor;
+ devicep->board = conf_device->dev_board;
+ devicep->chipset = conf_device->dev_chipset;
+ devicep->ramdac = conf_device->dev_ramdac;
+ devicep->driver = conf_device->dev_driver;
+ devicep->active = active;
+ devicep->videoRam = conf_device->dev_videoram;
+ devicep->BiosBase = conf_device->dev_bios_base;
+ devicep->MemBase = conf_device->dev_mem_base;
+ devicep->IOBase = conf_device->dev_io_base;
+ devicep->clockchip = conf_device->dev_clockchip;
+ devicep->busID = conf_device->dev_busid;
+ devicep->textClockFreq = conf_device->dev_textclockfreq;
+ devicep->chipID = conf_device->dev_chipid;
+ devicep->chipRev = conf_device->dev_chiprev;
+ devicep->options = conf_device->dev_option_lst;
+ devicep->irq = conf_device->dev_irq;
+ devicep->screen = conf_device->dev_screen;
+
+ for (i = 0; i < MAXDACSPEEDS; i++) {
+ if (i < CONF_MAXDACSPEEDS)
+ devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i];
+ else
+ devicep->dacSpeeds[i] = 0;
}
- }
-#ifdef NEED_RETURN_VALUE
- return RET_OKAY;
-#endif
+ devicep->numclocks = conf_device->dev_clocks;
+ if (devicep->numclocks > MAXCLOCKS)
+ devicep->numclocks = MAXCLOCKS;
+ for (i = 0; i < devicep->numclocks; i++) {
+ devicep->clock[i] = conf_device->dev_clock[i];
+ }
+ devicep->claimed = FALSE;
+
+ return TRUE;
}
-Bool
-xf86LookupMode(target, driver, flags)
- DisplayModePtr target;
- ScrnInfoPtr driver;
- int flags;
+#ifdef XF86DRI
+static Bool
+configDRI(XF86ConfDRIPtr drip)
{
- DisplayModePtr p;
- DisplayModePtr best_mode = NULL;
- int i, j, k, Gap;
- int Minimum_Gap = CLOCK_TOLERANCE + 1;
- Bool found_mode = FALSE;
- Bool clock_too_high = FALSE;
- static Bool first_time = TRUE;
- double refresh, bestRefresh = 0.0;
-
- if (first_time)
- {
- ErrorF("%s %s: Maximum allowed dot-clock: %1.3f MHz\n", XCONFIG_PROBED,
- driver->name, driver->maxClock / 1000.0);
- first_time = FALSE;
- /*
- * First time through, cull modes which are not valid for the
- * card/driver.
- */
- driver->monitor->Modes = xf86PruneModes(NULL, driver->monitor->Modes,
- driver, TRUE);
- }
-
- if (xf86BestRefresh && !(flags & LOOKUP_FORCE_DEFAULT))
- flags |= LOOKUP_BEST_REFRESH;
+ int count = 0;
+ XF86ConfBuffersPtr bufs;
+ int i;
+ struct group *grp;
+
+ xf86ConfigDRI.group = -1;
+ xf86ConfigDRI.mode = 0;
+ xf86ConfigDRI.bufs_count = 0;
+ xf86ConfigDRI.bufs = NULL;
+
+ if (drip) {
+ if (drip->dri_group_name) {
+ if ((grp = getgrnam(drip->dri_group_name)))
+ xf86ConfigDRI.group = grp->gr_gid;
+ } else {
+ if (drip->dri_group >= 0)
+ xf86ConfigDRI.group = drip->dri_group;
+ }
+ xf86ConfigDRI.mode = drip->dri_mode;
+ for (bufs = drip->dri_buffers_lst; bufs; bufs = bufs->list.next)
+ ++count;
+
+ xf86ConfigDRI.bufs_count = count;
+ xf86ConfigDRI.bufs = xnfalloc(count * sizeof(*xf86ConfigDRI.bufs));
+
+ for (i = 0, bufs = drip->dri_buffers_lst;
+ i < count;
+ i++, bufs = bufs->list.next) {
+
+ xf86ConfigDRI.bufs[i].count = bufs->buf_count;
+ xf86ConfigDRI.bufs[i].size = bufs->buf_size;
+ /* FIXME: Flags not implemented. These
+ could be used, for example, to specify a
+ contiguous block and/or write-combining
+ cache policy. */
+ xf86ConfigDRI.bufs[i].flags = 0;
+ }
+ }
- for (p = driver->monitor->Modes; p != NULL; p = p->next) /* scan list */
- {
- if (!strcmp(p->name, target->name)) /* names equal ? */
- {
- /* First check if the driver objects to the mode */
- if ((driver->ValidMode)(p, xf86Verbose, MODE_USED) != MODE_OK)
- {
- ErrorF("%s %s: Mode \"%s\" rejected by driver. Deleted.\n",
- XCONFIG_PROBED,driver->name, target->name );
- break;
- }
+ return TRUE;
+}
+#endif
- if ((flags & LOOKUP_NO_INTERLACED) && (p->Flags & V_INTERLACE))
- {
- continue;
- }
+static Bool
+configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
+{
+ xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
+ inputp->identifier = conf_input->inp_identifier;
+ inputp->driver = conf_input->inp_driver;
+ inputp->commonOptions = conf_input->inp_option_lst;
+ inputp->extraOptions = NULL;
- if ((OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(driver->clockOptions))) &&
- !OFLG_ISSET(OPTION_NO_PROGRAM_CLOCKS, &(driver->options)))
- {
- if (driver->clocks == 0)
- {
- /* this we know */
- driver->clock[0] = 25175; /* 25.175Mhz */
- driver->clock[1] = 28322; /* 28.322MHz */
- driver->clocks = 2;
- }
+ /* XXX This is required until the keyboard driver is converted */
+ if (!xf86NameCmp(inputp->driver, "keyboard"))
+ return configInputKbd(inputp);
- if ((p->Clock / 1000) > (driver->maxClock / 1000))
- clock_too_high = TRUE;
- else
- {
- /* We fill in the the programmable clocks as we go */
- for (i=0; i < driver->clocks; i++)
- if (driver->clock[i] == p->Clock)
- break;
-
- if (i >= MAXCLOCKS)
- {
- ErrorF("%s %s: Too many programmable clocks used (limit %d)!\n",
- XCONFIG_PROBED, driver->name, MAXCLOCKS);
- return FALSE;
- }
-
- if (i == driver->clocks)
- {
- driver->clock[i] = p->Clock;
- driver->clocks++;
- }
-
-
- if (flags & LOOKUP_BEST_REFRESH)
- {
- refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal;
- if (p->Flags & V_INTERLACE)
- {
- refresh *= 2;
- refresh /= INTERLACE_REFRESH_WEIGHT;
- }
- else if (p->Flags & V_DBLSCAN)
- {
- refresh /= 2;
- }
- if (refresh > bestRefresh)
- {
- best_mode = p;
- bestRefresh = refresh;
- target->Clock = i;
- }
- }
- else
- {
- target->Clock = i;
- best_mode = p;
- }
- }
- }
- else
- {
- /*
- * go look if any of the clocks in the list matches the one in
- * the mode (j=1), or if a better match exists when the clocks
- * in the list are divided by 2 (j=2)
- */
- if (OFLG_ISSET(OPTION_CLKDIV2, &(driver->options)))
- k=2;
- else
- k=1;
- for (j=1 ; j<=k ; j++)
- {
- i = xf86GetNearestClock(driver, p->Clock*j);
- if (flags & LOOKUP_BEST_REFRESH)
- {
- if ( ((driver->clock[i]/j) / 1000) > (driver->maxClock / 1000) )
- clock_too_high = TRUE;
- else
- {
- refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal;
- if (p->Flags & V_INTERLACE)
- {
- refresh *= 2;
- refresh /= INTERLACE_REFRESH_WEIGHT;
- }
- else if (p->Flags & V_DBLSCAN)
- {
- refresh /= 2;
- }
- if (refresh > bestRefresh)
- {
- target->Clock = i;
- if (j==2) p->Flags |= V_CLKDIV2;
- best_mode = p;
- bestRefresh = refresh;
- }
- }
- }
- else
- {
- Gap = abs( p->Clock - (driver->clock[i]/j) );
- if (Gap < Minimum_Gap)
- {
- if ( ((driver->clock[i]/j) / 1000) > (driver->maxClock / 1000) )
- clock_too_high = TRUE;
- else
- {
- target->Clock = i;
- if (j==2) p->Flags |= V_CLKDIV2;
- best_mode = p;
- Minimum_Gap = Gap;
- }
- }
- }
- }
- }
- found_mode = TRUE;
- }
- }
+ return TRUE;
+}
+
+static Bool
+modeIsPresent(char * modename,MonPtr monitorp)
+{
+ DisplayModePtr knownmodes = monitorp->Modes;
- if (best_mode != NULL)
- {
- target->HDisplay = best_mode->HDisplay;
- target->HSyncStart = best_mode->HSyncStart;
- target->HSyncEnd = best_mode->HSyncEnd;
- target->HTotal = best_mode->HTotal;
- target->HSkew = best_mode->HSkew;
- target->VDisplay = best_mode->VDisplay;
- target->VSyncStart = best_mode->VSyncStart;
- target->VSyncEnd = best_mode->VSyncEnd;
- target->VTotal = best_mode->VTotal;
- target->Flags = best_mode->Flags;
- target->CrtcHDisplay = best_mode->CrtcHDisplay;
- target->CrtcHSyncStart = best_mode->CrtcHSyncStart;
- target->CrtcHSyncEnd = best_mode->CrtcHSyncEnd;
- target->CrtcHTotal = best_mode->CrtcHTotal;
- target->CrtcHSkew = best_mode->CrtcHSkew;
- target->CrtcVDisplay = best_mode->CrtcVDisplay;
- target->CrtcVSyncStart = best_mode->CrtcVSyncStart;
- target->CrtcVSyncEnd = best_mode->CrtcVSyncEnd;
- target->CrtcVTotal = best_mode->CrtcVTotal;
- target->CrtcHAdjusted = best_mode->CrtcHAdjusted;
- target->CrtcVAdjusted = best_mode->CrtcVAdjusted;
- if (target->Flags & V_DBLSCAN)
+ /* all I can think of is a linear search... */
+ while(knownmodes != NULL)
{
- target->CrtcVDisplay *= 2;
- target->CrtcVSyncStart *= 2;
- target->CrtcVSyncEnd *= 2;
- target->CrtcVTotal *= 2;
- target->CrtcVAdjusted = TRUE;
+ if(!strcmp(modename,knownmodes->name) &&
+ !(knownmodes->type & M_T_DEFAULT))
+ return TRUE;
+ knownmodes = knownmodes->next;
}
+ return FALSE;
+}
-#if 0
- /* I'm not sure if this is the best place for this in the
- * new XF86Config organization. - SRA
- */
- if (found_mode)
- if ((driver->ValidMode)(target, xf86Verbose, MODE_USED) != MODE_OK)
- {
- ErrorF("%s %s: Unable to support mode \"%s\"\n",
- XCONFIG_GIVEN,driver->name, target->name );
- return(FALSE);
- }
-#endif
+static Bool
+addDefaultModes(MonPtr monitorp)
+{
+ DisplayModePtr mode;
+ DisplayModePtr last = monitorp->Last;
+ int i = 0;
- if (xf86Verbose)
+ while (xf86DefaultModes[i].name != NULL)
{
- ErrorF("%s %s: Mode \"%s\": mode clock = %7.3f",
- XCONFIG_GIVEN, driver->name, target->name,
- best_mode->Clock / 1000.0);
- if (!OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(driver->clockOptions)) ||
- OFLG_ISSET(OPTION_NO_PROGRAM_CLOCKS, &(driver->options))) {
- ErrorF(", clock used = %7.3f", driver->clock[target->Clock] / 1000.0);
- if (target->Flags & V_CLKDIV2)
- ErrorF("/2");
- }
- ErrorF("\n");
+ if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) )
+ do
+ {
+ mode = xnfalloc(sizeof(DisplayModeRec));
+ memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
+ if (xf86DefaultModes[i].name)
+ mode->name = xnfstrdup(xf86DefaultModes[i].name);
+ if( last ) {
+ mode->prev = last;
+ last->next = mode;
+ }
+ else {
+ /* this is the first mode */
+ monitorp->Modes = mode;
+ mode->prev = NULL;
+ }
+ last = mode;
+ i++;
+ }
+ while((xf86DefaultModes[i].name != NULL) &&
+ (!strcmp(xf86DefaultModes[i].name,xf86DefaultModes[i-1].name)));
+ else
+ i++;
}
- }
- else if (!found_mode)
- ErrorF("%s %s: There is no mode definition named \"%s\"\n",
- XCONFIG_PROBED, driver->name, target->name);
- else if (clock_too_high)
- ErrorF("%s %s: Clock for mode \"%s\" %s\n\tLimit is %7.3f MHz\n",
- XCONFIG_PROBED, driver->name, target->name,
- "is too high for the configured hardware.",
- driver->maxClock / 1000.0);
- else
- ErrorF("%s %s: There is no defined dot-clock matching mode \"%s\"\n",
- XCONFIG_PROBED, driver->name, target->name);
-
- return (best_mode != NULL);
-}
+ monitorp->Last = last;
-void
-xf86VerifyOptions(allowedOptions, driver)
- OFlagSet *allowedOptions;
- ScrnInfoPtr driver;
-{
- int j;
-
- for (j=0; xf86_OptionTab[j].token >= 0; j++)
- if ((OFLG_ISSET(xf86_OptionTab[j].token, &driver->options)))
- if (OFLG_ISSET(xf86_OptionTab[j].token, allowedOptions))
- {
- if (xf86Verbose)
- ErrorF("%s %s: Option \"%s\"\n", XCONFIG_GIVEN,
- driver->name, xf86_OptionTab[j].name);
- }
- else
- ErrorF("%s %s: Option flag \"%s\" is not defined for this driver\n",
- XCONFIG_GIVEN, driver->name, xf86_OptionTab[j].name);
+ return TRUE;
}
-/* Note: (To keep me [GJA] from getting confused)
- * We have two mode-related datastructures:
- * 1. A doubly linked mode name list, with ends marked by self-pointers.
- * 2. A doubly linked mode structure list.
- * We are operating here on the second structure.
- * Initially this is just singly linked.
+/*
+ * load the config file and fill the global data structure
*/
-static DisplayModePtr
-xf86PruneModes(monp, allmodes, scrp, card)
- MonPtr monp; /* Monitor specification */
- DisplayModePtr allmodes; /* List to be pruned */
- ScrnInfoPtr scrp;
- Bool card; /* TRUE => do driver validity check */
+Bool
+xf86HandleConfigFile(void)
{
- DisplayModePtr dispmp; /* To walk the list */
- DisplayModePtr olddispmp; /* The one being freed. */
- DisplayModePtr remainder; /* The first one retained. */
+ const char *filename;
+ char *searchpath;
+ MessageType from = X_DEFAULT;
- dispmp = allmodes;
+ if (getuid() == 0)
+ searchpath = ROOT_CONFIGPATH;
+ else
+ searchpath = USER_CONFIGPATH;
- /* The first modes to be deleted require that the pointer to the
- * mode list is updated. Also, they have no predecessor in the list.
- */
- while (dispmp &&
- (card ?
- ((scrp->ValidMode)(dispmp, xf86Verbose, MODE_SUGGESTED)
- != MODE_OK) :
- (xf86CheckMode(scrp, dispmp, monp, xf86Verbose) != MODE_OK))) {
- olddispmp = dispmp;
- dispmp = dispmp->next;
- xfree(olddispmp->name);
- xfree(olddispmp);
- }
- /* Now we either have a mode that fits, or no mode at all */
- if ( ! dispmp ) { /* No mode at all */
- return NULL;
- }
- remainder = dispmp;
- while ( dispmp->next ) {
- if (card ?
- ((scrp->ValidMode)(dispmp->next,xf86Verbose,MODE_SUGGESTED)
- != MODE_OK) :
- (xf86CheckMode(scrp, dispmp->next, monp, xf86Verbose) !=
- MODE_OK)) {
- olddispmp = dispmp->next;
- dispmp->next = dispmp->next->next;
- xfree(olddispmp->name);
- xfree(olddispmp);
- } else {
- dispmp = dispmp->next;
- }
- }
- return remainder; /* Return pointer to {the first / the list } */
-}
+ if (xf86ConfigFile)
+ from = X_CMDLINE;
-/*
- * Return MODE_OK if the mode pointed to by dispmp agrees with all constraints
- * we can make up for the monitor pointed to by monp.
- */
-int
-xf86CheckMode(scrp, dispmp, monp, verbose)
- ScrnInfoPtr scrp;
- DisplayModePtr dispmp;
- MonPtr monp;
- Bool verbose;
-{
- int i;
- float dotclock, hsyncfreq, vrefreshrate;
- char *scrname = scrp->name;
-
- /* Sanity checks */
- if ((0 >= dispmp->HDisplay) ||
- (dispmp->HDisplay > dispmp->HSyncStart) ||
- (dispmp->HSyncStart >= dispmp->HSyncEnd) ||
- (dispmp->HSyncEnd >= dispmp->HTotal))
- {
- ErrorF(
- "%s %s: Invalid horizontal timing for mode \"%s\". Deleted.\n",
- XCONFIG_PROBED, scrname, dispmp->name);
- return MODE_HSYNC;
- }
+ filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT);
+ if (filename) {
+ xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
+ xf86ConfigFile = xnfstrdup(filename);
+ } else {
+ xf86Msg(X_ERROR, "Unable to locate/open config file");
+ if (xf86ConfigFile)
+ xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile);
+ xf86ErrorFVerb(0, "\n");
+ return FALSE;
+ }
+ if ((xf86configptr = xf86readConfigFile ()) == NULL) {
+ xf86Msg(X_ERROR, "Problem parsing the config file\n");
+ return FALSE;
+ }
+ xf86closeConfigFile ();
- if ((0 >= dispmp->VDisplay) ||
- (dispmp->VDisplay > dispmp->VSyncStart) ||
- (dispmp->VSyncStart >= dispmp->VSyncEnd) ||
- (dispmp->VSyncEnd >= dispmp->VTotal))
- {
- ErrorF(
- "%s %s: Invalid vertical timing for mode \"%s\". Deleted.\n",
- XCONFIG_PROBED, scrname, dispmp->name);
- return MODE_VSYNC;
- }
+ /* Initialise a few things. */
- /* Deal with the dispmp->Clock being a frequency or index */
- if (dispmp->Clock > MAXCLOCKS) {
- dotclock = (float)dispmp->Clock;
- } else {
- dotclock = (float)scrp->clock[dispmp->Clock];
+ /*
+ * now we convert part of the information contained in the parser
+ * structures into our own structures.
+ * The important part here is to figure out which Screen Sections
+ * in the XF86Config file are active so that we can piece together
+ * the modes that we need later down the road.
+ * And while we are at it, we'll decode the rest of the stuff as well
+ */
+
+ /* First check if a layout section is present, and if it is valid. */
+
+ if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
+ if (xf86ScreenName == NULL) {
+ xf86Msg(X_WARNING,
+ "No Layout section. Using the first Screen section.\n");
}
- hsyncfreq = dotclock / (float)(dispmp->HTotal);
- for ( i = 0 ; i < monp->n_hsync ; i++ )
- if ( (hsyncfreq > 0.999 * monp->hsync[i].lo) &&
- (hsyncfreq < 1.001 * monp->hsync[i].hi) )
- break; /* In range. */
-
- /* Now see whether we ran out of sync frequencies */
- if ( i == monp->n_hsync ) {
- if (verbose) {
- ErrorF(
- "%s %s: Mode \"%s\" needs hsync freq of %.2f kHz. Deleted.\n",
- XCONFIG_PROBED, scrname, dispmp->name, hsyncfreq);
- }
- return MODE_HSYNC;
+ if (!configImpliedLayout(&xf86ConfigLayout,
+ xf86configptr->conf_screen_lst)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
}
-
- vrefreshrate = dotclock * 1000.0 /
- ((float)(dispmp->HTotal) * (float)(dispmp->VTotal)) ;
- if ( dispmp->Flags & V_INTERLACE ) vrefreshrate *= 2.0;
- if ( dispmp->Flags & V_DBLSCAN ) vrefreshrate /= 2.0;
- for ( i = 0 ; i < monp->n_vrefresh ; i++ )
- if ( (vrefreshrate > 0.999 * monp->vrefresh[i].lo) &&
- (vrefreshrate < 1.001 * monp->vrefresh[i].hi) )
- break; /* In range. */
-
- /* Now see whether we ran out of refresh rates */
- if ( i == monp->n_vrefresh ) {
- if (verbose) {
- ErrorF(
- "%s %s: Mode \"%s\" needs vert refresh rate of %.2f Hz. Deleted.\n",
- XCONFIG_PROBED, scrname, dispmp->name, vrefreshrate);
- }
- return MODE_VSYNC;
+ } else {
+ if (xf86configptr->conf_flags != NULL) {
+ char *dfltlayout = NULL;
+ pointer optlist = xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
+ dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL);
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ dfltlayout)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ } else {
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ NULL)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
}
+ }
- /* Interlaced modes should have an odd VTotal */
- if (dispmp->Flags & V_INTERLACE)
- dispmp->CrtcVTotal = dispmp->VTotal |= 1;
+ /* Now process everything else */
- /* Passed every test. */
- return MODE_OK;
-}
+ if (!configFiles(xf86configptr->conf_files) ||
+ !configServerFlags(xf86configptr->conf_flags,
+ xf86ConfigLayout.options)
+#ifdef XF86DRI
+ || !configDRI(xf86configptr->conf_dri)
+#endif
+ ) {
+ ErrorF ("Problem when converting the config data structures\n");
+ return FALSE;
+ }
-/*
- * Save entire line from config file in memory area, if memory area
- * does not exist allocate it. Set DCerr according to value of token.
- * Return address of memory area.
- */
-static char *xf86DCSaveLine(DCPointer,token)
- char *DCPointer;
- int token;
-{
- static int len = 0; /* length of memory area where to store strings */
- static int pos = 0; /* current position */
- char *currpointer; /* pointer to current position in memory area */
- static int currline; /* lineno of line currently interpreted */
- int addlen; /* len to add to pos */
-
- if(DCPointer == NULL){ /* initialize */
- DCPointer = (char *)xalloc(4096); /* initial size 4kB */
- len = 4096;
- strcpy(DCPointer,configPath);
- pos = strlen(DCPointer) + 1;
- currline = -1; /* no line yet */
- }
+ /*
+ * Handle some command line options that can override some of the
+ * ServerFlags settings.
+ */
+#ifdef XF86VIDMODE
+ if (xf86VidModeDisabled)
+ xf86Info.vidModeEnabled = FALSE;
+ if (xf86VidModeAllowNonLocal)
+ xf86Info.vidModeAllowNonLocal = TRUE;
+#endif
- if(configLineNo != currline) /* new line */
- {
- currline = configLineNo;
- addlen = strlen(configBuf) + 1 + sizeof(int); /* string + lineno */
- while ( (pos + addlen) >= len ){ /* not enough space? */
- DCPointer = (char *)xrealloc(DCPointer, (len + 4096));
- len += 4096;
- }
- currpointer = DCPointer + pos; /* find current position */
- memcpy(currpointer, &currline, sizeof(int)); /* Grrr unaligned ints.. */
- strcpy((currpointer + sizeof(int)),configBuf); /* store complete line*/
- pos += addlen; /* goto end */
- currpointer += addlen;
- *(currpointer) = EOF; /* mark end */
- }
- switch(token){
- case STRING:
- case DASH:
- case NUMBER:
- case COMMA:
- break;
- case ERROR_TOKEN: /* if unknown token unset DCerr to ignore it */
- DCerr = 0; /* and subsequent STRING, DASH, NUMBER, COMMA */
- break;
- default: /* set to complain if a valid token is */
- DCerr = 1; /* followed by an unwanted STRING etc. */
- }
- return(DCPointer);
+#ifdef XF86MISC
+ if (xf86MiscModInDevDisabled)
+ xf86Info.miscModInDevEnabled = FALSE;
+ if (xf86MiscModInDevAllowNonLocal)
+ xf86Info.miscModInDevAllowNonLocal = TRUE;
+#endif
+
+ if (xf86AllowMouseOpenFail)
+ xf86Info.allowMouseOpenFail = TRUE;
+
+ return TRUE;
}
-/*
- * Store any unknown Option strings (contained in val.str)
- * in a memory are pointed to by pointer. If it doesn't
- * exist allocate it and return a pointer pointing to it
- */
-static char *
-xf86DCOption(DCPointer, val)
- char *DCPointer;
- LexRec val;
+/* These make the equivalent parser functions visible to the common layer. */
+Bool
+xf86PathIsAbsolute(const char *path)
{
- static int len = 0;
- static int pos = 0;
- int addlen;
- char *currpointer; /* current position */
-
- if (DCPointer == NULL){ /* First time: initialize */
- DCPointer = (char *)xalloc(4096); /* allocate enough space */
- strcpy(DCPointer,configPath);
- pos = strlen(DCPointer) + 1;
- len = 4096; /* and total length */
- }
-
- addlen = sizeof(int) + strlen(val.str) + 1; /* token, lineno */
- while( (pos + addlen) >= len ){ /* reallocate if not enough */
- DCPointer = (char *)xrealloc(DCPointer, (len + 4096));
- len += 4096;
- }
- currpointer = DCPointer + pos;
- *(int *)currpointer=configLineNo;
- strcpy(currpointer + sizeof(int),val.str); /* store string */
- pos += addlen;
- *(currpointer + addlen) = EOF; /* mark end */
- return(DCPointer);
+ return (xf86pathIsAbsolute(path) != 0);
}
-static char
-* xf86DCConcatOption(Pointer1, Pointer2)
-char *Pointer1;
-char *Pointer2;
+Bool
+xf86PathIsSafe(const char *path)
{
- int s1 = 0;
- int s2 = 0;
- int s3;
- char *ptmp;
-
- if(Pointer1)
- while(*(Pointer1 + s1) != EOF){s1++;}
- else if (Pointer2)
- return Pointer2;
- else return NULL;
- if(Pointer2)
- while(*(Pointer2 + s2) != EOF){s2++;}
- else if (Pointer1)
- return Pointer1;
- else return NULL;
- s3 = strlen(Pointer2) + 1;
- s2 -= s3;
-
- Pointer1 = (char *)xrealloc(Pointer1,s1+s2+1);
- ptmp = Pointer1 + s1;
- Pointer2 += s3;
- do{
- *ptmp = *Pointer2;
- *ptmp++;
- *Pointer2++;
- } while(s2--);
- return Pointer1;
+ return (xf86pathIsSafe(path) != 0);
}
-
+
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 6c0943b41..1a214c4ad 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -1,27 +1,5 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.13 1996/12/23 06:43:22 dawes Exp $ */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
- *
- */
-/* $Xorg: xf86Cursor.c,v 1.3 2000/08/17 19:50:29 cpqbld Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.35 2003/02/13 10:49:38 eich Exp $ */
+/* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */
#define NEED_EVENTS
#include "X.h"
@@ -30,73 +8,72 @@
#include "cursor.h"
#include "mipointer.h"
#include "scrnintstr.h"
+#include "globals.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
-#ifdef XFreeXDGA
-#include "Xproto.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-
-#define _XF86DGA_SERVER_
-#include "extensions/xf86dgastr.h"
-#endif
+#include "xf86Priv.h"
+#include "xf86_OSproc.h"
#ifdef XINPUT
-#include "xf86_Config.h"
#include "XIproto.h"
#include "xf86Xinput.h"
#endif
-/* #include "atKeynames.h" -hv- dont need that include here */
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+typedef struct _xf86EdgeRec {
+ short screen;
+ short start;
+ short end;
+ DDXPointRec offset;
+ struct _xf86EdgeRec *next;
+} xf86EdgeRec, *xf86EdgePtr;
-static Bool xf86CursorOffScreen(
-#if NeedFunctionPrototypes
- ScreenPtr *pScreen,
- int *x,
- int *y
-#endif
-);
-static void xf86CrossScreen(
-#if NeedFunctionPrototypes
- ScreenPtr pScreen,
- Bool entering
-#endif
-);
-static void xf86WrapCursor(
-#if NeedFunctionPrototypes
- ScreenPtr pScreen,
- int x,
- int y
-#endif
-);
+typedef struct {
+ xf86EdgePtr left, right, up, down;
+} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
+
+static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
+static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
+static void xf86WarpCursor(ScreenPtr pScreen, int x, int y);
+
+static void xf86PointerMoved(int scrnIndex, int x, int y);
-miPointerScreenFuncRec xf86PointerScreenFuncs = {
+static miPointerScreenFuncRec xf86PointerScreenFuncs = {
xf86CursorOffScreen,
xf86CrossScreen,
- xf86WrapCursor,
+ xf86WarpCursor,
#ifdef XINPUT
xf86eqEnqueue,
+ xf86eqSwitchScreen
+#else
+ /* let miPointerInitialize take care of these */
+ NULL,
+ NULL
#endif
};
+static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
+static Bool HardEdges;
/*
* xf86InitViewport --
* Initialize paning & zooming parameters, so that a driver must only
* check what resolutions are possible and whether the virtual area
- * is valid if specifyed.
+ * is valid if specified.
*/
void
-xf86InitViewport(pScr)
- ScrnInfoPtr pScr;
+xf86InitViewport(ScrnInfoPtr pScr)
{
+
+ pScr->PointerMoved = xf86PointerMoved;
+
/*
* Compute the initial Viewport if necessary
*/
@@ -131,163 +108,269 @@ xf86InitViewport(pScr)
*/
void
-xf86SetViewport(pScreen, x, y)
- ScreenPtr pScreen;
- int x, y;
+xf86SetViewport(ScreenPtr pScreen, int x, int y)
{
- Bool frameChanged = FALSE;
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ (*pScr->PointerMoved)(pScreen->myNum, x, y);
+}
+
+
+static void
+xf86PointerMoved(int scrnIndex, int x, int y)
+{
+ Bool frameChanged = FALSE;
+ ScrnInfoPtr pScr = xf86Screens[scrnIndex];
+
/*
* check wether (x,y) belongs to the visual part of the screen
* if not, change the base of the displayed frame accoring
*/
if ( pScr->frameX0 > x) {
pScr->frameX0 = x;
- pScr->frameX1 = x + pScr->modes->HDisplay - 1;
+ pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
frameChanged = TRUE ;
}
if ( pScr->frameX1 < x) {
pScr->frameX1 = x + 1;
- pScr->frameX0 = x - pScr->modes->HDisplay + 1;
+ pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
frameChanged = TRUE ;
}
if ( pScr->frameY0 > y) {
pScr->frameY0 = y;
- pScr->frameY1 = y + pScr->modes->VDisplay - 1;
+ pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
frameChanged = TRUE;
}
if ( pScr->frameY1 < y) {
pScr->frameY1 = y;
- pScr->frameY0 = y - pScr->modes->VDisplay + 1;
+ pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
frameChanged = TRUE;
}
- if (frameChanged) (pScr->AdjustFrame)(pScr->frameX0, pScr->frameY0);
+ if (frameChanged && pScr->AdjustFrame != NULL)
+ pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
}
-
-static Bool xf86ZoomLocked = FALSE;
-
/*
* xf86LockZoom --
* Enable/disable ZoomViewport
*/
void
-xf86LockZoom (pScreen, lock)
- ScreenPtr pScreen;
- Bool lock;
+xf86LockZoom(ScreenPtr pScreen, Bool lock)
{
- /*
- * pScreen is currently ignored, but may be used later to enable locking
- * of individual screens.
- */
-
- xf86ZoomLocked = lock;
+ XF86SCRNINFO(pScreen)->zoomLocked = lock;
}
/*
- * xf86ZoomViewport --
- * Reinitialize the visual part of the screen for another modes->
+ * xf86SwitchMode --
+ * This is called by both keyboard processing and the VidMode extension to
+ * set a new mode.
*/
-void
-xf86ZoomViewport (pScreen, zoom)
- ScreenPtr pScreen;
- int zoom;
+Bool
+xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ ScreenPtr pCursorScreen;
+ Bool Switched;
+ int px, py;
- if (xf86ZoomLocked)
- return;
+ if (!pScr->vtSema || !mode || !pScr->SwitchMode)
+ return FALSE;
#ifdef XFreeXDGA
- /*
- * We should really send the mode change request to the DGA client and let
- * it decide what to do. For now just bin the request
- */
- if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectGraphics)
- return;
+ if (DGAActive(pScr->scrnIndex))
+ return FALSE;
#endif
- if (pScr->modes != pScr->modes->next)
- {
- pScr->modes = zoom > 0 ? pScr->modes->next : pScr->modes->prev;
+ if (mode == pScr->currentMode)
+ return TRUE;
+
+ if (mode->HDisplay > pScreen->width || mode->VDisplay > pScreen->height)
+ return FALSE;
+
+ pCursorScreen = miPointerCurrentScreen();
+ if (pScreen == pCursorScreen)
+ miPointerPosition(&px, &py);
+
+ xf86EnterServerState(SETUP);
+ Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
+ xf86EnterServerState(OPERATING);
+ if (Switched) {
+ pScr->currentMode = mode;
+
+ /*
+ * Adjust frame for new display size.
+ */
+ if (pScreen == pCursorScreen)
+ pScr->frameX0 = px - (mode->HDisplay / 2) + 1;
+ else
+ pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2;
+
+ if (pScr->frameX0 < 0)
+ pScr->frameX0 = 0;
+
+ pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1;
+ if (pScr->frameX1 >= pScr->virtualX) {
+ pScr->frameX0 = pScr->virtualX - mode->HDisplay;
+ pScr->frameX1 = pScr->virtualX - 1;
+ }
- if ((pScr->SwitchMode)(pScr->modes))
- {
- /*
- * adjust new frame for the displaysize
- */
- pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 -pScr->modes->HDisplay)/2;
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
-
- if (pScr->frameX0 < 0)
- {
- pScr->frameX0 = 0;
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
- }
- else if (pScr->frameX1 >= pScr->virtualX)
- {
- pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
- }
-
- pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 - pScr->modes->VDisplay)/2;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
-
- if (pScr->frameY0 < 0)
- {
- pScr->frameY0 = 0;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
- }
- else if (pScr->frameY1 >= pScr->virtualY)
- {
- pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
- }
+ if (pScreen == pCursorScreen)
+ pScr->frameY0 = py - (mode->VDisplay / 2) + 1;
+ else
+ pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2;
+
+ if (pScr->frameY0 < 0)
+ pScr->frameY0 = 0;
+
+ pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1;
+ if (pScr->frameY1 >= pScr->virtualY) {
+ pScr->frameY0 = pScr->virtualY - mode->VDisplay;
+ pScr->frameY1 = pScr->virtualY - 1;
}
- else /* switch failed, so go back to old mode */
- pScr->modes = zoom > 0 ? pScr->modes->prev : pScr->modes->next;
}
- (pScr->AdjustFrame)(pScr->frameX0, pScr->frameY0);
+ if (pScr->AdjustFrame)
+ (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+
+ if (pScreen == pCursorScreen)
+ xf86WarpCursor(pScreen, px, py);
+
+ return Switched;
}
+
+/*
+ * xf86ZoomViewport --
+ * Reinitialize the visual part of the screen for another mode.
+ */
+void
+xf86ZoomViewport(ScreenPtr pScreen, int zoom)
+{
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ DisplayModePtr mode;
+
+ if (pScr->zoomLocked || !(mode = pScr->currentMode))
+ return;
+
+ do {
+ if (zoom > 0)
+ mode = mode->next;
+ else
+ mode = mode->prev;
+ } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
+
+ (void)xf86SwitchMode(pScreen, mode);
+}
+
+
+static xf86EdgePtr
+FindEdge(xf86EdgePtr edge, int val)
+{
+ while(edge && (edge->end <= val))
+ edge = edge->next;
+ if(edge && (edge->start <= val))
+ return edge;
+
+ return NULL;
+}
/*
* xf86CursorOffScreen --
* Check whether it is necessary to switch to another screen
*/
-/* ARGSUSED */
static Bool
-xf86CursorOffScreen (pScreen, x, y)
- ScreenPtr *pScreen;
- int *x, *y;
+xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
{
- int i;
-
- if ((screenInfo.numScreens > 1) && ((*x < 0) || ((*pScreen)->width <= *x))) {
- i = (*pScreen)->myNum;
- if (*x < 0) {
- i = (i ? i : screenInfo.numScreens) -1;
- *pScreen = screenInfo.screens[i];
- *x += (*pScreen)->width;
+ xf86EdgePtr edge;
+ int tmp;
+
+ if(screenInfo.numScreens == 1)
+ return FALSE;
+
+ if(*x < 0) {
+ tmp = *y;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].left))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *x = 0;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
+ }
+
+ if(*x >= (*pScreen)->width) {
+ tmp = *y;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].right))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *x = (*pScreen)->width - 1;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
}
- else {
- *x -= (*pScreen)->width;
- i = (i+1) % screenInfo.numScreens;
- *pScreen = screenInfo.screens[i];
+
+ if(*y < 0) {
+ tmp = *x;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].up))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *y = 0;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
}
- return(TRUE);
- }
- return(FALSE);
+
+ if(*y >= (*pScreen)->height) {
+ tmp = *x;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].down))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *y = (*pScreen)->height - 1;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ (*pScreen) = xf86Screens[edge->screen]->pScreen;
+ }
+ }
+
+
+#if 0
+ /* This presents problems for overlapping screens when
+ HardEdges is used. Have to think about the logic more */
+ if((*x < 0) || (*x >= (*pScreen)->width) ||
+ (*y < 0) || (*y >= (*pScreen)->height)) {
+ /* We may have crossed more than one screen */
+ xf86CursorOffScreen(pScreen, x, y);
+ }
+#endif
+
+ return TRUE;
}
@@ -297,30 +380,373 @@ xf86CursorOffScreen (pScreen, x, y)
* Switch to another screen
*/
+/* NEED TO CHECK THIS */
/* ARGSUSED */
static void
-xf86CrossScreen (pScreen, entering)
- ScreenPtr pScreen;
- Bool entering;
+xf86CrossScreen (ScreenPtr pScreen, Bool entering)
{
+#if 0
if (xf86Info.sharedMonitor)
(XF86SCRNINFO(pScreen)->EnterLeaveMonitor)(entering);
(XF86SCRNINFO(pScreen)->EnterLeaveCursor)(entering);
+#endif
}
/*
- * xf86WrapCursor --
- * Wrap possible to another screen
+ * xf86WarpCursor --
+ * Warp possible to another screen
*/
/* ARGSUSED */
static void
-xf86WrapCursor (pScreen, x, y)
- ScreenPtr pScreen;
- int x,y;
+xf86WarpCursor (ScreenPtr pScreen, int x, int y)
{
+ int sigstate;
+ sigstate = xf86BlockSIGIO ();
miPointerWarpCursor(pScreen,x,y);
xf86Info.currentScreen = pScreen;
+ xf86UnblockSIGIO (sigstate);
+}
+
+
+void *
+xf86GetPointerScreenFuncs(void)
+{
+ return (void *)&xf86PointerScreenFuncs;
+}
+
+
+static xf86EdgePtr
+AddEdge(
+ xf86EdgePtr edge,
+ short min,
+ short max,
+ short dx,
+ short dy,
+ short screen
+){
+ xf86EdgePtr pEdge = edge, pPrev = NULL, pNew;
+
+ while(1) {
+ while(pEdge && (min >= pEdge->end)) {
+ pPrev = pEdge;
+ pEdge = pEdge->next;
+ }
+
+ if(!pEdge) {
+ if(!(pNew = xalloc(sizeof(xf86EdgeRec))))
+ break;
+
+ pNew->screen = screen;
+ pNew->start = min;
+ pNew->end = max;
+ pNew->offset.x = dx;
+ pNew->offset.y = dy;
+ pNew->next = NULL;
+
+ if(pPrev)
+ pPrev->next = pNew;
+ else
+ edge = pNew;
+
+ break;
+ } else if (min < pEdge->start) {
+ if(!(pNew = xalloc(sizeof(xf86EdgeRec))))
+ break;
+
+ pNew->screen = screen;
+ pNew->start = min;
+ pNew->offset.x = dx;
+ pNew->offset.y = dy;
+ pNew->next = pEdge;
+
+ if(pPrev) pPrev->next = pNew;
+ else edge = pNew;
+
+ if(max <= pEdge->start) {
+ pNew->end = max;
+ break;
+ } else {
+ pNew->end = pEdge->start;
+ min = pEdge->end;
+ }
+ } else
+ min = pEdge->end;
+
+ pPrev = pEdge;
+ pEdge = pEdge->next;
+
+ if(max <= min) break;
+ }
+
+ return edge;
+}
+
+static void
+FillOutEdge(xf86EdgePtr pEdge, int limit)
+{
+ xf86EdgePtr pNext;
+ int diff;
+
+ if(pEdge->start > 0) pEdge->start = 0;
+
+ while((pNext = pEdge->next)) {
+ diff = pNext->start - pEdge->end;
+ if(diff > 0) {
+ pEdge->end += diff >> 1;
+ pNext->start -= diff - (diff >> 1);
+ }
+ pEdge = pNext;
+ }
+
+ if(pEdge->end < limit)
+ pEdge->end = limit;
+}
+
+/*
+ * xf86InitOrigins() can deal with a maximum of 32 screens
+ * on 32 bit architectures, 64 on 64 bit architectures.
+ */
+
+void
+xf86InitOrigins(void)
+{
+ unsigned long screensLeft, prevScreensLeft, mask;
+ screenLayoutPtr screen;
+ ScreenPtr pScreen;
+ int x1, x2, y1, y2, left, right, top, bottom;
+ int i, j, ref, minX, minY, min, max;
+ xf86ScreenLayoutPtr pLayout;
+ Bool OldStyleConfig = FALSE;
+
+ /* need to have this set up with a config file option */
+ HardEdges = FALSE;
+
+ bzero(xf86ScreenLayout, MAXSCREENS * sizeof(xf86ScreenLayoutRec));
+
+ screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1;
+
+ while(1) {
+ for(mask = screensLeft, i = 0; mask; mask >>= 1, i++) {
+ if(!(mask & 1L)) continue;
+
+ screen = &xf86ConfigLayout.screens[i];
+
+ switch(screen->where) {
+ case PosObsolete:
+ OldStyleConfig = TRUE;
+ pLayout = &xf86ScreenLayout[i];
+ /* force edge lists */
+ if(screen->left) {
+ ref = screen->left->screennum;
+ pLayout->left = AddEdge(pLayout->left,
+ 0, xf86Screens[i]->pScreen->height,
+ xf86Screens[ref]->pScreen->width, 0, ref);
+ }
+ if(screen->right) {
+ ref = screen->right->screennum;
+ pScreen = xf86Screens[i]->pScreen;
+ pLayout->right = AddEdge(pLayout->right,
+ 0, pScreen->height, -pScreen->width, 0, ref);
+ }
+ if(screen->top) {
+ ref = screen->top->screennum;
+ pLayout->up = AddEdge(pLayout->up,
+ 0, xf86Screens[i]->pScreen->width,
+ 0, xf86Screens[ref]->pScreen->height, ref);
+ }
+ if(screen->bottom) {
+ ref = screen->bottom->screennum;
+ pScreen = xf86Screens[i]->pScreen;
+ pLayout->down = AddEdge(pLayout->down,
+ 0, pScreen->width, 0, -pScreen->height, ref);
+ }
+ /* we could also try to place it based on those
+ relative locations if we wanted to */
+ screen->x = screen->y = 0;
+ /* FALLTHROUGH */
+ case PosAbsolute:
+ dixScreenOrigins[i].x = screen->x;
+ dixScreenOrigins[i].y = screen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosRelative:
+ ref = screen->refscreen->screennum;
+ if(screensLeft & (1 << ref)) break;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->x;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosRightOf:
+ ref = screen->refscreen->screennum;
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[ref]->pScreen;
+ dixScreenOrigins[i].x =
+ dixScreenOrigins[ref].x + pScreen->width;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosLeftOf:
+ ref = screen->refscreen->screennum;
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[i]->pScreen;
+ dixScreenOrigins[i].x =
+ dixScreenOrigins[ref].x - pScreen->width;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosBelow:
+ ref = screen->refscreen->screennum;
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[ref]->pScreen;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
+ dixScreenOrigins[i].y =
+ dixScreenOrigins[ref].y + pScreen->height;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosAbove:
+ ref = screen->refscreen->screennum;
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[i]->pScreen;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
+ dixScreenOrigins[i].y =
+ dixScreenOrigins[ref].y - pScreen->height;
+ screensLeft &= ~(1 << i);
+ break;
+ default:
+ ErrorF("Illegal placement keyword in Layout!\n");
+ break;
+ }
+
+ }
+
+ if(!screensLeft) break;
+
+ if(screensLeft == prevScreensLeft) {
+ /* All the remaining screens are referencing each other.
+ Assign a value to one of them and go through again */
+ i = 0;
+ while(!((1 << i) & screensLeft)){ i++; }
+
+ ref = xf86ConfigLayout.screens[i].refscreen->screennum;
+ dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0;
+ screensLeft &= ~(1 << ref);
+ }
+
+ prevScreensLeft = screensLeft;
+ }
+
+ /* justify the topmost and leftmost to (0,0) */
+ minX = dixScreenOrigins[0].x;
+ minY = dixScreenOrigins[0].y;
+
+ for(i = 1; i < xf86NumScreens; i++) {
+ if(dixScreenOrigins[i].x < minX)
+ minX = dixScreenOrigins[i].x;
+ if(dixScreenOrigins[i].y < minY)
+ minY = dixScreenOrigins[i].y;
+ }
+
+ if (minX || minY) {
+ for(i = 0; i < xf86NumScreens; i++) {
+ dixScreenOrigins[i].x -= minX;
+ dixScreenOrigins[i].y -= minY;
+ }
+ }
+
+
+ /* Create the edge lists */
+
+ if(!OldStyleConfig) {
+ for(i = 0; i < xf86NumScreens; i++) {
+ pLayout = &xf86ScreenLayout[i];
+
+ pScreen = xf86Screens[i]->pScreen;
+
+ left = dixScreenOrigins[i].x;
+ right = left + pScreen->width;
+ top = dixScreenOrigins[i].y;
+ bottom = top + pScreen->height;
+
+ for(j = 0; j < xf86NumScreens; j++) {
+ if(i == j) continue;
+
+ x1 = dixScreenOrigins[j].x;
+ x2 = x1 + xf86Screens[j]->pScreen->width;
+ y1 = dixScreenOrigins[j].y;
+ y2 = y1 + xf86Screens[j]->pScreen->height;
+
+ if((bottom > y1) && (top < y2)) {
+ min = y1 - top;
+ if(min < 0) min = 0;
+ max = pScreen->height - (bottom - y2);
+ if(max > pScreen->height) max = pScreen->height;
+
+ if(((left - 1) >= x1) && ((left - 1) < x2))
+ pLayout->left = AddEdge(pLayout->left, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+
+ if((right >= x1) && (right < x2))
+ pLayout->right = AddEdge(pLayout->right, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+ }
+
+
+ if((left < x2) && (right > x1)) {
+ min = x1 - left;
+ if(min < 0) min = 0;
+ max = pScreen->width - (right - x2);
+ if(max > pScreen->width) max = pScreen->width;
+
+ if(((top - 1) >= y1) && ((top - 1) < y2))
+ pLayout->up = AddEdge(pLayout->up, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+
+ if((bottom >= y1) && (bottom < y2))
+ pLayout->down = AddEdge(pLayout->down, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+ }
+ }
+ }
+ }
+
+ if(!HardEdges && !OldStyleConfig) {
+ for(i = 0; i < xf86NumScreens; i++) {
+ pLayout = &xf86ScreenLayout[i];
+ pScreen = xf86Screens[i]->pScreen;
+ if(pLayout->left)
+ FillOutEdge(pLayout->left, pScreen->height);
+ if(pLayout->right)
+ FillOutEdge(pLayout->right, pScreen->height);
+ if(pLayout->up)
+ FillOutEdge(pLayout->up, pScreen->width);
+ if(pLayout->down)
+ FillOutEdge(pLayout->down, pScreen->width);
+ }
+ }
}
+
+void
+xf86ReconfigureLayout(void)
+{
+ int i;
+
+ for (i = 0; i < MAXSCREENS; i++) {
+ xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
+ /* we don't have to zero these, xf86InitOrigins() takes care of that */
+ if (sl->left) xfree(sl->left);
+ if (sl->right) xfree(sl->right);
+ if (sl->up) xfree(sl->up);
+ if (sl->down) xfree(sl->down);
+ }
+
+ xf86InitOrigins();
+}
+
+
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index aa0983111..4d0efbcb9 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.42.2.4 1998/02/07 09:23:28 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.146 2003/02/20 04:20:52 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -21,48 +21,42 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86Events.c,v 1.3 2000/08/17 19:50:29 cpqbld Exp $ */
+/* $XConsortium: xf86Events.c /main/46 1996/10/25 11:36:30 kaleb $ */
/* [JCH-96/01/21] Extended std reverse map to four buttons. */
-#define NEED_EVENTS
#include "X.h"
+#include "Xpoll.h"
#include "Xproto.h"
#include "misc.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "Xpoll.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
-#include "xf86_Config.h"
#include "atKeynames.h"
#ifdef XFreeXDGA
-#include "XIproto.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-
-#include "exevents.h"
-
-#define _XF86DGA_SERVER_
-#include "extensions/xf86dgastr.h"
+#include "dgaproc.h"
#endif
#ifdef XINPUT
#include "XI.h"
#include "XIproto.h"
-#include "xf86Xinput.h"
+#else
+#include "inputstr.h"
#endif
+#include "xf86Xinput.h"
+#include "mi.h"
#include "mipointer.h"
-#include "opaque.h"
-#ifdef DPMSExtension
-#include "extensions/dpms.h"
+
+#ifdef XF86BIGFONT
+#define _XF86BIGFONT_SERVER_
+#include "xf86bigfont.h"
#endif
#ifdef XKB
@@ -72,6 +66,18 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
+#ifdef XINPUT
+#define __EqEnqueue(ev) xf86eqEnqueue(ev)
+#else
+#define __EqEnqueue(ev) mieqEnqueue(ev)
+#endif
+
+#define EqEnqueue(ev) { \
+ int __sigstate = xf86BlockSIGIO (); \
+ __EqEnqueue (ev); \
+ xf86UnblockSIGIO(__sigstate); \
+}
+
#ifdef XTESTEXT1
#define XTestSERVER_SIDE
@@ -81,62 +87,30 @@ extern short xtest_mousey;
extern int on_steal_input;
extern Bool XTestStealKeyData();
extern void XTestStealMotionData();
-
-#ifdef XINPUT
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- if (!on_steal_input || \
- XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \
- xtest_mousex, xtest_mousey)) \
- xf86eqEnqueue((ev))
-#else
#define ENQUEUE(ev, code, direction, dev_type) \
(ev)->u.u.detail = (code); \
(ev)->u.u.type = (direction); \
if (!on_steal_input || \
XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \
xtest_mousex, xtest_mousey)) \
- mieqEnqueue((ev))
-#endif
-
-#define MOVEPOINTER(dx, dy, time) \
- if (on_steal_input) \
- XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \
- miPointerDeltaCursor (dx, dy, time)
-
+ EqEnqueue((ev))
#else /* ! XTESTEXT1 */
-#ifdef XINPUT
#define ENQUEUE(ev, code, direction, dev_type) \
(ev)->u.u.detail = (code); \
(ev)->u.u.type = (direction); \
- xf86eqEnqueue((ev))
-#else
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- mieqEnqueue((ev))
-#endif
-#define MOVEPOINTER(dx, dy, time) \
- miPointerDeltaCursor (dx, dy, time)
+ EqEnqueue((ev))
#endif
-Bool xf86VTSema = TRUE;
-
-#ifdef XINPUT
-extern InputInfo inputInfo;
-#endif /* XINPUT */
-
/*
- * The first of many hack's to get VT switching to work under
+ * The first of many hacks to get VT switching to work under
* Solaris 2.1 for x86. The basic problem is that Solaris is supposed
* to be SVR4. It is for the most part, except where the video interface
* is concerned. These hacks work around those problems.
- * See the comments for Linux, and SCO.
+ * See the comments for Linux, and SCO.
*
- * This is a toggleling variable:
+ * This is a toggling variable:
* FALSE = No VT switching keys have been pressed last time around
* TRUE = Possible VT switch Pending
* (DWH - 12/2/93)
@@ -145,167 +119,40 @@ extern InputInfo inputInfo;
*/
#ifdef USE_VT_SYSREQ
-static Bool VTSysreqToggle = FALSE;
+Bool VTSysreqToggle = FALSE;
#endif /* !USE_VT_SYSREQ */
-static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD */
+Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
+ *BSD and for avoiding VT
+ switches when using the DRI
+ automatic full screen mode.*/
extern fd_set EnabledDevices;
-#if defined(CODRV_SUPPORT)
-extern unsigned char xf86CodrvMap[];
-#endif
-
-#if defined(XQUEUE) && !defined(XQUEUE_ASYNC)
-extern void xf86XqueRequest(
-#if NeedFunctionPrototypes
- void
-#endif
- );
+#if defined(XQUEUE)
+extern void xf86XqueRequest(void);
#endif
+extern void (*xf86OSPMClose)(void);
-#ifdef DPMSExtension
-extern BOOL DPMSEnabled;
-extern void DPMSSet(CARD16);
-#endif
-
-static void xf86VTSwitch(
-#if NeedFunctionPrototypes
- void
-#endif
- );
-#ifdef XFreeXDGA
-static void XF86DirectVideoMoveMouse(
-#if NeedFunctionPrototypes
- int x,
- int y,
- CARD32 mtime
-#endif
- );
-static void XF86DirectVideoKeyEvent(
-#if NeedFunctionPrototypes
- xEvent *xE,
- int keycode,
- int etype
-#endif
- );
-#endif
-static CARD32 buttonTimer(
-#if NeedFunctionPrototypes
- OsTimerPtr timer,
- CARD32 now,
- pointer arg
-#endif
- );
+static void xf86VTSwitch(void);
/*
- * Lets create a simple finite-state machine:
- *
- * state[?][0]: action1
- * state[?][1]: action2
- * state[?][2]: next state
- *
- * 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 ...
+ * Allow arbitrary drivers or other XFree86 code to register with our main
+ * Wakeup handler.
*/
+typedef struct x_IHRec {
+ int fd;
+ InputHandlerProc ihproc;
+ pointer data;
+ Bool enabled;
+ struct x_IHRec * next;
+} IHRec, *IHPtr;
-static 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 */
-};
-
-
-/*
- * Table to allow quick reversal of natural button mapping to correct mapping
- */
-
-/*
- * [JCH-96/01/21] The ALPS GlidePoint pad extends the MS protocol
- * with a fourth button activated by tapping the PAD.
- * The 2nd line corresponds to 4th button on; the drv sends
- * the buttons in the following map (MSBit described first) :
- * 0 | 4th | 1st | 2nd | 3rd
- * And we remap them (MSBit described first) :
- * 0 | 4th | 3rd | 2nd | 1st
- */
-static char reverseMap[32] = { 0, 4, 2, 6, 1, 5, 3, 7,
- 8, 12, 10, 14, 9, 13, 11, 15,
- 16, 20, 18, 22, 17, 21, 19, 23,
- 24, 28, 26, 30, 25, 29, 27, 31};
-
-
-static char hitachMap[16] = { 0, 2, 1, 3,
- 8, 10, 9, 11,
- 4, 6, 5, 7,
- 12, 14, 13, 15 };
-
-#define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f])
+static IHPtr InputHandlers = NULL;
/*
* TimeSinceLastInputEvent --
- * Function used for screensaver purposes by the os module. Retruns the
+ * Function used for screensaver purposes by the os module. Returns the
* time in milliseconds since there last was any input.
*/
@@ -348,20 +195,6 @@ ProcessInputEvents ()
static int generation = 0;
#endif
-#ifdef AMOEBA
-#define MAXEVENTS 32
-#define BUTTON_PRESS 0x1000
-#define MAP_BUTTON(ev,but) (((ev) == EV_ButtonPress) ? \
- ((but) | BUTTON_PRESS) : ((but) & ~BUTTON_PRESS))
-#define KEY_RELEASE 0x80
-#define MAP_KEY(ev, key) (((ev) == EV_KeyReleaseEvent) ? \
- ((key) | KEY_RELEASE) : ((key) & ~KEY_RELEASE))
-
- register IOPEvent *e, *elast;
- IOPEvent events[MAXEVENTS];
- int dx, dy, nevents;
-#endif
-
/*
* With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock
* and ScrollLock will be set to match that of the VT the server is
@@ -398,37 +231,6 @@ ProcessInputEvents ()
}
#endif
-#ifdef AMOEBA
- /*
- * Get all events from the IOP server
- */
- while ((nevents = AmoebaGetEvents(events, MAXEVENTS)) > 0) {
- for (e = &events[0], elast = &events[nevents]; e < elast; e++) {
- xf86Info.lastEventTime = e->time;
- switch (e->type) {
- case EV_PointerDelta:
- if (e->x != 0 || e->y != 0) {
- xf86PostMseEvent(&xf86Info.pMouse, 0, e->x, e->y);
- }
- break;
- case EV_ButtonPress:
- case EV_ButtonRelease:
- xf86PostMseEvent(&xf86Info.pMouse, MAP_BUTTON(e->type, e->keyorbut), 0, 0);
- break;
- case EV_KeyPressEvent:
- case EV_KeyReleaseEvent:
- xf86PostKbdEvent(MAP_KEY(e->type, e->keyorbut));
- break;
- default:
- /* this shouldn't happen */
- ErrorF("stray event %d (%d,%d) %x\n",
- e->type, e->x, e->y, e->keyorbut);
- break;
- }
- }
- }
-#endif
-
xf86Info.inputPending = FALSE;
#ifdef XINPUT
@@ -442,7 +244,111 @@ ProcessInputEvents ()
xf86SetViewport(xf86Info.currentScreen, x, y);
}
+void
+xf86GrabServerCallback(CallbackListPtr *callbacks, pointer data, pointer args)
+{
+ ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args;
+
+ xf86Info.grabInfo.server.client = grab->client;
+ xf86Info.grabInfo.server.grabstate = grab->grabstate;
+}
+/*
+ * Handle keyboard events that cause some kind of "action"
+ * (i.e., server termination, video mode changes, VT switches, etc.)
+ */
+void
+xf86ProcessActionEvent(ActionEvent action, void *arg)
+{
+#ifdef DEBUG
+ ErrorF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
+#endif
+ switch (action) {
+ case ACTION_TERMINATE:
+ if (!xf86Info.dontZap) {
+#ifdef XFreeXDGA
+ DGAShutdown();
+#endif
+ GiveUp(0);
+ }
+ break;
+ case ACTION_NEXT_MODE:
+ if (!xf86Info.dontZoom)
+ xf86ZoomViewport(xf86Info.currentScreen, 1);
+ break;
+ case ACTION_PREV_MODE:
+ if (!xf86Info.dontZoom)
+ xf86ZoomViewport(xf86Info.currentScreen, -1);
+ break;
+ case ACTION_DISABLEGRAB:
+ if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) {
+ if (inputInfo.pointer && inputInfo.pointer->grab != NULL &&
+ inputInfo.pointer->DeactivateGrab)
+ inputInfo.pointer->DeactivateGrab(inputInfo.pointer);
+ if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL &&
+ inputInfo.keyboard->DeactivateGrab)
+ inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard);
+ }
+ break;
+ case ACTION_CLOSECLIENT:
+ if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) {
+ ClientPtr pointer, keyboard, server;
+
+ pointer = keyboard = server = NULL;
+ if (inputInfo.pointer && inputInfo.pointer->grab != NULL)
+ pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)];
+ if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) {
+ keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)];
+ if (keyboard == pointer)
+ keyboard = NULL;
+ }
+ if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) &&
+ (((server = xf86Info.grabInfo.server.client) == pointer) ||
+ (server == keyboard)))
+ server = NULL;
+
+ if (pointer)
+ CloseDownClient(pointer);
+ if (keyboard)
+ CloseDownClient(keyboard);
+ if (server)
+ CloseDownClient(server);
+ }
+ break;
+#if !defined(__SOL8__) && (!defined(sun) || defined(i386))
+ case ACTION_SWITCHSCREEN:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
+ int vtno = *((int *) arg);
+#if defined(QNX4)
+ xf86Info.vtRequestsPending = vtno;
+#else
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+#endif
+ }
+ break;
+ case ACTION_SWITCHSCREEN_NEXT:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0)
+#if defined(SCO) || (defined(sun) && defined (i386) && defined (SVR4))
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
+#else
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0)
+#endif
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ }
+ break;
+ case ACTION_SWITCHSCREEN_PREV:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ }
+ break;
+#endif
+ default:
+ break;
+ }
+}
/*
* xf86PostKbdEvent --
@@ -454,17 +360,18 @@ ProcessInputEvents ()
* ifdefs further (hv).
*/
-#ifdef ASSUME_CUSTOM_KEYCODES
+#ifdef __linux__
extern u_char SpecialServerMap[];
-#endif /* ASSUME_CUSTOM_KEYCODES */
+#endif
-#if !defined(__EMX__)
+#if !defined(__UNIXOS2__) && \
+ !defined(__SOL8__) && \
+ (!defined(sun) || defined(i386))
void
-xf86PostKbdEvent(key)
- unsigned key;
+xf86PostKbdEvent(unsigned key)
{
int scanCode = (key & 0x7f);
- int specialkey;
+ int specialkey = 0;
Bool down = (key & 0x80 ? FALSE : TRUE);
KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
Bool updateLeds = FALSE;
@@ -474,16 +381,17 @@ xf86PostKbdEvent(key)
KeySym *keysym;
int keycode;
static int lockkeys = 0;
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
static Bool first_time = TRUE;
#endif
-
-#if defined(CODRV_SUPPORT)
- if (xf86Info.consType == CODRV011 || xf86Info.consType == CODRV01X)
- scanCode = xf86CodrvMap[scanCode];
+#if defined(__sparc__)
+ static int kbdSun = -1;
#endif
+ /* Disable any keyboard processing while in suspend */
+ if (xf86inSuspend)
+ return;
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
if (first_time)
{
first_time = FALSE;
@@ -492,102 +400,78 @@ xf86PostKbdEvent(key)
}
#endif
-#if defined (i386) && defined (SVR4) && !defined (PC98)
+#if defined (__sparc__)
+ if (kbdSun == -1) {
+ if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
+ || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
+ kbdSun = 1;
+ else
+ kbdSun = 0;
+ }
+ if (kbdSun)
+ goto special;
+#endif /* __sparc__ */
+
+#if defined (i386) && defined (SVR4)
/*
* 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 ...
*/
if (xf86Info.scanPrefix == 0) {
switch (scanCode) {
-
-#ifndef PC98
case KEY_Prefix0:
case KEY_Prefix1:
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT) {
+ || xf86Info.consType == PCVT
+#ifdef WSCONS_SUPPORT
+ || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents)
+#endif
+ ) {
#endif
xf86Info.scanPrefix = scanCode; /* special prefixes */
return;
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
}
break;
#endif
-#endif /* not PC98 */
- }
-#ifndef PC98
- if (xf86Info.serverNumLock) {
- if ((!xf86Info.numLock && ModifierDown(ShiftMask)) ||
- (xf86Info.numLock && !ModifierDown(ShiftMask))) {
- /*
- * Hardwired numlock handling ... (Some applications break if they have
- * these keys double defined, like twm)
- */
- switch (scanCode) {
- case KEY_KP_7: scanCode = KEY_SN_KP_7; break; /* curs 7 */
- case KEY_KP_8: scanCode = KEY_SN_KP_8; break; /* curs 8 */
- case KEY_KP_9: scanCode = KEY_SN_KP_9; break; /* curs 9 */
- case KEY_KP_4: scanCode = KEY_SN_KP_4; break; /* curs 4 */
- case KEY_KP_5: scanCode = KEY_SN_KP_5; break; /* curs 5 */
- case KEY_KP_6: scanCode = KEY_SN_KP_6; break; /* curs 6 */
- case KEY_KP_1: scanCode = KEY_SN_KP_1; break; /* curs 1 */
- case KEY_KP_2: scanCode = KEY_SN_KP_2; break; /* curs 2 */
- case KEY_KP_3: scanCode = KEY_SN_KP_3; break; /* curs 3 */
- case KEY_KP_0: scanCode = KEY_SN_KP_0; break; /* curs 0 */
- case KEY_KP_Decimal: scanCode = KEY_SN_KP_Dec; break; /* curs decimal */
- }
- } else {
- switch (scanCode) {
- case KEY_KP_7: scanCode = KEY_SN_KP_Home; break; /* curs home */
- case KEY_KP_8: scanCode = KEY_SN_KP_Up ; break; /* curs up */
- case KEY_KP_9: scanCode = KEY_SN_KP_Prior; break; /* curs pgup */
- case KEY_KP_4: scanCode = KEY_SN_KP_Left; break; /* curs left */
- case KEY_KP_5: scanCode = KEY_SN_KP_Begin; break; /* curs begin */
- case KEY_KP_6: scanCode = KEY_SN_KP_Right; break; /* curs right */
- case KEY_KP_1: scanCode = KEY_SN_KP_End; break; /* curs end */
- case KEY_KP_2: scanCode = KEY_SN_KP_Down; break; /* curs down */
- case KEY_KP_3: scanCode = KEY_SN_KP_Next; break; /* curs pgdn */
- case KEY_KP_0: scanCode = KEY_SN_KP_Ins; break; /* curs ins */
- case KEY_KP_Decimal: scanCode = KEY_SN_KP_Del; break; /* curs del */
- }
- }
}
-#endif /* not PC98 */
}
-#ifndef PC98
else if (
#ifdef CSRG_BASED
(xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT) &&
+ || xf86Info.consType == PCVT
+#ifdef WSCONS_SUPPORT
+ || (xf86Info.consType == WSCONS && xf86Info.kbdEvents !=
+ xf86WSKbdEvents)
+#endif
+ ) &&
#endif
(xf86Info.scanPrefix == KEY_Prefix0)) {
xf86Info.scanPrefix = 0;
@@ -622,8 +506,18 @@ xf86PostKbdEvent(key)
/*
* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
*/
+ case 0x2A:
+ case 0x36:
+ return;
default:
- return; /* skip illegal */
+ xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
+ scanCode);
+ /*
+ * "Internet" keyboards are generating lots of new codes. Let them
+ * pass. There is little consistency between them, so don't bother
+ * with symbolic names at this level.
+ */
+ scanCode += 0x78;
}
}
@@ -639,55 +533,140 @@ xf86PostKbdEvent(key)
if (scanCode != KEY_NumLock) return;
scanCode = KEY_Pause; /* pause */
}
-#endif /* not PC98 */
-#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 */
- if ((ModifierDown(ControlMask | AltMask)) ||
- (ModifierDown(ControlMask | AltLangMask)))
+#ifdef __linux__
+customkeycodes:
+#endif
+#if defined(i386) || defined(__i386__)
+ if (xf86IsPc98()) {
+ switch (scanCode) {
+ case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */
+ case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */
+ case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */
+
+ /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
+
+ case 0x62: specialkey = 0x3b; break; /* KEY_F1 */
+ case 0x63: specialkey = 0x3c; break; /* KEY_F2 */
+ case 0x64: specialkey = 0x3d; break; /* KEY_F3 */
+ case 0x65: specialkey = 0x3e; break; /* KEY_F4 */
+ case 0x66: specialkey = 0x3f; break; /* KEY_F5 */
+ case 0x67: specialkey = 0x40; break; /* KEY_F6 */
+ case 0x68: specialkey = 0x41; break; /* KEY_F7 */
+ case 0x69: specialkey = 0x42; break; /* KEY_F8 */
+ case 0x6a: specialkey = 0x43; break; /* KEY_F9 */
+ case 0x6b: specialkey = 0x44; break; /* KEY_F10 */
+ /* case 0x73: specialkey = 0x38; break; KEY_Alt */
+ /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */
+ default: specialkey = 0x00; break;
+ }
+ }
+#endif
+#if defined (__sparc__)
+special:
+ if (kbdSun) {
+ switch (scanCode) {
+ case 0x2b: specialkey = KEY_BackSpace; break;
+ case 0x47: specialkey = KEY_KP_Minus; break;
+ case 0x7d: specialkey = KEY_KP_Plus; break;
+
+ /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
+
+ case 0x05: specialkey = KEY_F1; break;
+ case 0x06: specialkey = KEY_F2; break;
+ case 0x08: specialkey = KEY_F3; break;
+ case 0x0a: specialkey = KEY_F4; break;
+ case 0x0c: specialkey = KEY_F5; break;
+ case 0x0e: specialkey = KEY_F6; break;
+ case 0x10: specialkey = KEY_F7; break;
+ case 0x11: specialkey = KEY_F8; break;
+ case 0x12: specialkey = KEY_F9; break;
+ case 0x07: specialkey = KEY_F10; break;
+ case 0x09: specialkey = KEY_F11; break;
+ case 0x0b: specialkey = KEY_F12; break;
+ default: specialkey = 0; break;
+ }
+ /*
+ * XXX XXX XXX:
+ *
+ * I really don't know what's wrong here, but passing the real
+ * scanCode offsets by one from XKB's point of view.
+ *
+ * (ecd@skynet.be, 980405)
+ */
+ scanCode--;
+ }
+#endif /* defined (__sparc__) */
+
+#ifdef XKB
+ if ((xf86Info.ddxSpecialKeys == SKWhenNeeded &&
+ !xf86Info.ActionKeyBindingsSet) ||
+ noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) {
+#endif
+ if (!(ModifierDown(ShiftMask)) &&
+ ((ModifierDown(ControlMask | AltMask)) ||
+ (ModifierDown(ControlMask | AltLangMask))))
{
-
switch (specialkey) {
case KEY_BackSpace:
- if (!xf86Info.dontZap) {
-#ifdef XFreeXDGA
- if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectGraphics)
+ xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
break;
-#endif
- GiveUp(0);
- }
+
+ /*
+ * Check grabs
+ */
+ case KEY_KP_Divide:
+ xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
break;
-
- /*
- * The idea here is to pass the scancode down to a list of
- * registered routines. There should be some standard conventions
- * for processing certain keys.
- */
+ case KEY_KP_Multiply:
+ xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
+ break;
+
+ /*
+ * Video mode switches
+ */
case KEY_KP_Minus: /* Keypad - */
- if (!xf86Info.dontZoom) {
- if (down) xf86ZoomViewport(xf86Info.currentScreen, -1);
- return;
- }
+ if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
+ if (!xf86Info.dontZoom) return;
break;
case KEY_KP_Plus: /* Keypad + */
- if (!xf86Info.dontZoom) {
- if (down) xf86ZoomViewport(xf86Info.currentScreen, 1);
+ if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
+ if (!xf86Info.dontZoom) return;
+ break;
+
+ /* Under QNX4, we set the vtPending flag for VT switching and
+ * let the VT switch function do the rest...
+ * This is a little different from the other OS'es.
+ */
+#if defined(QNX4)
+ case KEY_1:
+ case KEY_2:
+ case KEY_3:
+ case KEY_4:
+ case KEY_5:
+ case KEY_6:
+ case KEY_7:
+ case KEY_8:
+ case KEY_9:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
+ if (down) {
+ int vtno = specialkey - KEY_1 + 1;
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
+ }
return;
}
break;
+#endif
-#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) || defined(SCO)
+#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(SCO)
/*
* Under Linux, the raw keycodes are consumed before the kernel
* does any processing on them, so we must emulate the vt switching
@@ -703,37 +682,23 @@ xf86PostKbdEvent(key)
case KEY_F8:
case KEY_F9:
case KEY_F10:
- if (VTSwitchEnabled && !xf86Info.vtSysreq
-#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)))
- && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
-#endif
- )
- {
- if (down)
-#ifdef SCO325
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F1);
-#else
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F1 + 1);
-#endif
- return;
- }
- break;
case KEY_F11:
case KEY_F12:
- if (VTSwitchEnabled && !xf86Info.vtSysreq
-#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)))
+ if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
+#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)))
&& (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
#endif
- )
- {
- if (down)
+ ) {
+ int vtno = specialkey - KEY_F1 + 1;
+ if (specialkey == KEY_F11 || specialkey == KEY_F12)
+ vtno = specialkey - KEY_F11 + 11;
#ifdef SCO325
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F11 + 10);
-#else
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F11 + 11);
+ vtno--;
#endif
- return;
- }
+ if (down)
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
+ return;
+ }
break;
#endif /* linux || BSD with VTs */
@@ -753,7 +718,7 @@ xf86PostKbdEvent(key)
*/
#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq)
+ if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
{
switch (specialkey)
{
@@ -765,7 +730,7 @@ xf86PostKbdEvent(key)
case KEY_H:
if (VTSysreqToggle && down)
{
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0);
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL);
VTSysreqToggle = 0;
return;
}
@@ -780,8 +745,7 @@ xf86PostKbdEvent(key)
case KEY_N:
if (VTSysreqToggle && down)
{
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1 ) < 0)
- ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
VTSysreqToggle = FALSE;
return;
}
@@ -790,9 +754,7 @@ xf86PostKbdEvent(key)
case KEY_P:
if (VTSysreqToggle && down)
{
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1 ) < 0)
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
- ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
VTSysreqToggle = FALSE;
return;
}
@@ -809,21 +771,13 @@ xf86PostKbdEvent(key)
case KEY_F8:
case KEY_F9:
case KEY_F10:
- if (VTSysreqToggle && down)
- {
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey-KEY_F1 + 1) < 0)
- ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
case KEY_F11:
case KEY_F12:
if (VTSysreqToggle && down)
- {
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey-KEY_F11 + 11) < 0)
- ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ { int vtno = specialkey - KEY_F1 + 1;
+ if (specialkey == KEY_F11 || specialkey == KEY_F12)
+ vtno = specialkey - KEY_F11 + 11;
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
VTSysreqToggle = FALSE;
return;
}
@@ -831,17 +785,13 @@ xf86PostKbdEvent(key)
/* Ignore these keys -- ie don't let them cancel an alt-sysreq */
case KEY_Alt:
-#ifndef PC98
case KEY_AltLang:
-#endif /* not PC98 */
break;
-#ifndef PC98
case KEY_SysReqest:
if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask)))
VTSysreqToggle = TRUE;
break;
-#endif /* not PC98 */
default:
if (VTSysreqToggle)
@@ -870,14 +820,26 @@ xf86PostKbdEvent(key)
*/
if (specialkey == KEY_Print && ModifierDown(ControlMask)) {
if (down)
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0)
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
- ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
return;
}
#endif /* SCO */
+#ifdef XKB
+ }
+#endif
/*
+ * PC keyboards generate separate key codes for
+ * Alt+Print and Control+Pause but in the X keyboard model
+ * they need to get the same key code as the base key on the same
+ * physical keyboard key.
+ */
+ if (scanCode == KEY_SysReqest)
+ scanCode = KEY_Print;
+ else if (scanCode == KEY_Break)
+ scanCode = KEY_Pause;
+
+ /*
* Now map the scancodes to real X-keycodes ...
*/
keycode = scanCode + MIN_KEYCODE;
@@ -949,7 +911,6 @@ xf86PostKbdEvent(key)
* ignore releases, toggle on & off on presses.
* Don't deal with the Caps_Lock keysym directly, but check the lock modifier
*/
-#ifndef PC98
if (keyc->modifierMap[keycode] & LockMask ||
keysym[0] == XK_Scroll_Lock ||
keysym[1] == XF86XK_ModeLock ||
@@ -971,28 +932,29 @@ xf86PostKbdEvent(key)
if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag;
updateLeds = TRUE;
}
-#endif /* not PC98 */
-#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__)
+ 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;
- }
-#endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */
+ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
+#if !defined(CSRG_BASED) && \
+ !defined(__GNU__) && \
+ defined(KB_84)
+ /*
+ * 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 && ... */
+ }
}
-#endif /* !ASSUME_CUSTOM_KEYCODES */
- if (updateLeds) xf86KbdLeds();
+ if (updateLeds) xf86UpdateKbdLeds();
#ifdef XKB
}
#endif
@@ -1000,9 +962,14 @@ xf86PostKbdEvent(key)
/*
* check for an autorepeat-event
*/
- if ((down && KeyPressed(keycode)) &&
- (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode]))
- return;
+ if (down && KeyPressed(keycode)) {
+ KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed;
+ if ((xf86Info.autoRepeat != AutoRepeatModeOn) ||
+ keyc->modifierMap[keycode] ||
+ (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) ))))
+ return;
+ }
+
xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis();
/*
@@ -1023,383 +990,220 @@ xf86PostKbdEvent(key)
}
else
{
-#ifdef XFreeXDGA
- if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectKeyb) {
- XF86DirectVideoKeyEvent(&kevent, keycode, (down ? KeyPress : KeyRelease));
- } else
-#endif
- {
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
-
- }
+ ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
}
}
-#endif /* !__EMX__ */
+#endif /* !__UNIXOS2__ */
+#define ModifierIsSet(k) ((modifiers & (k)) == (k))
-static CARD32
-buttonTimer(timer, now, arg)
- OsTimerPtr timer;
- CARD32 now;
- pointer arg;
+Bool
+xf86CommonSpecialKey(int key, Bool down, int modifiers)
{
- MouseDevPtr priv = MOUSE_DEV((DeviceIntPtr) arg);
+ if ((ModifierIsSet(ControlMask | AltMask)) ||
+ (ModifierIsSet(ControlMask | AltLangMask))) {
+ switch (key) {
+
+ case KEY_BackSpace:
+ xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
+ break;
- xf86PostMseEvent(((DeviceIntPtr) arg), priv->truebuttons, 0, 0);
- return(0);
+ /*
+ * Check grabs
+ */
+ case KEY_KP_Divide:
+ xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
+ break;
+ case KEY_KP_Multiply:
+ xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
+ break;
+
+ /*
+ * The idea here is to pass the scancode down to a list of
+ * registered routines. There should be some standard conventions
+ * for processing certain keys.
+ */
+ case KEY_KP_Minus: /* Keypad - */
+ if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
+ if (!xf86Info.dontZoom) return TRUE;
+ break;
+
+ case KEY_KP_Plus: /* Keypad + */
+ if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
+ if (!xf86Info.dontZoom) return TRUE;
+ break;
+ }
+ }
+ return FALSE;
}
-
-/*
- * xf86PostMseEvent --
- * Translate the raw hardware MseEvent into an XEvent(s), and tell DIX
- * about it. Perform a 3Button emulation if required.
+/*
+ * xf86Wakeup --
+ * Os wakeup handler.
*/
+/* ARGSUSED */
void
-xf86PostMseEvent(device, buttons, dx, dy)
- DeviceIntPtr device;
- int buttons, dx, dy;
+xf86Wakeup(pointer blockData, int err, pointer pReadmask)
{
- static OsTimerPtr timer = NULL;
- MouseDevPtr private = MOUSE_DEV(device);
- int id, change;
- int truebuttons;
- xEvent mevent[2];
-#ifdef XINPUT
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) mevent;
- deviceValuator *xv = (deviceValuator *) (xev+1);
- int is_pointer; /* the mouse is the pointer ? */
-#endif
-
-#ifdef AMOEBA
- int pressed;
-
- pressed = ((buttons & BUTTON_PRESS) != 0);
- buttons &= ~BUTTON_PRESS;
-#endif
-
-#ifdef XINPUT
- is_pointer = xf86IsCorePointer(device);
-
- if (!is_pointer) {
- xev->time = xf86Info.lastEventTime = GetTimeInMillis();
- }
- else
-#endif
- xf86Info.lastEventTime = mevent->u.keyButtonPointer.time = GetTimeInMillis();
-
- truebuttons = buttons;
- if (private->mseType == P_MMHIT)
- buttons = reverseBits(hitachMap, buttons);
- else
- buttons = reverseBits(reverseMap, buttons);
-
- if (dx || dy) {
-
- /*
- * accelerate the baby now if sqrt(dx*dx + dy*dy) > threshold !
- * but do some simpler arithmetic here...
- */
- if ((abs(dx) + abs(dy)) >= private->threshold) {
- dx = (dx * private->num) / private->den;
- dy = (dy * private->num)/ private->den;
- }
-
-#ifdef XINPUT
- if (is_pointer) {
-#endif
-#ifdef XFreeXDGA
- if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectMouse) {
- XF86DirectVideoMoveMouse(dx, dy, mevent->u.keyButtonPointer.time);
- } else
-#endif
- {
- MOVEPOINTER(dx, dy, mevent->u.keyButtonPointer.time);
+#if !defined(__UNIXOS2__) && !defined(__QNX__)
+ fd_set* LastSelectMask = (fd_set*)pReadmask;
+ fd_set devicesWithInput;
+ InputInfoPtr pInfo;
+
+ if (err >= 0) {
+
+ XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
+ if (XFD_ANYSET(&devicesWithInput)) {
+ if (xf86Info.kbdEvents)
+ (xf86Info.kbdEvents)();
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->read_input && pInfo->fd >= 0 &&
+ (FD_ISSET(pInfo->fd, ((fd_set *)pReadmask)) != 0)) {
+ int sigstate = xf86BlockSIGIO();
+
+ pInfo->read_input(pInfo);
+ xf86UnblockSIGIO(sigstate);
+ /*
+ * Must break here because more than one device may share
+ * the same file descriptor.
+ */
+ break;
+ }
+ pInfo = pInfo->next;
+ }
}
-#ifdef XINPUT
}
- else {
- xev->type = DeviceMotionNotify;
- xev->deviceid = device->id | MORE_EVENTS;
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->num_valuators = 2;
- xv->first_valuator = 0;
- xv->device_state = 0;
- xv->valuator0 = dx;
- xv->valuator1 = dy;
- xf86eqEnqueue(mevent);
+#else /* __UNIXOS2__ and __QNX__ */
+
+ InputInfoPtr pInfo;
+
+ (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->read_input && pInfo->fd >= 0) {
+ int sigstate = xf86BlockSIGIO();
+
+ pInfo->read_input(pInfo);
+ xf86UnblockSIGIO(sigstate);
+ /*
+ * Must break here because more than one device may share
+ * the same file descriptor.
+ */
+ break;
+ }
+ pInfo = pInfo->next;
}
-#endif
- }
-
- if (private->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 (private->mseType == P_MMHIT)
- change = buttons ^ reverseBits(hitachMap, private->lastButtons);
- else
- change = buttons ^ reverseBits(reverseMap, private->lastButtons);
- if (change & 02)
- {
-#ifdef XINPUT
- if (xf86CheckButton(2, (buttons & 02))) {
-#endif
- ENQUEUE(mevent,
- 2, (buttons & 02) ? ButtonPress : ButtonRelease,
- XE_POINTER);
-#ifdef XINPUT
- }
-#endif
- }
-
- /*
- * emulate the third button by the other two
- */
- if ((id = stateTab[buttons + private->emulateState][0]) != 0)
- {
-#ifdef XINPUT
- if (is_pointer) {
- if (xf86CheckButton(abs(id), (id >= 0))) {
-#endif
- ENQUEUE(mevent,
- abs(id), (id < 0 ? ButtonRelease : ButtonPress),
- XE_POINTER);
-#ifdef XINPUT
- }
- }
- else {
- xev->type = (id < 0 ? DeviceButtonRelease : DeviceButtonPress);
- xev->deviceid = device->id | MORE_EVENTS;
- xev->detail = abs(id);
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->num_valuators = 0;
- xv->device_state = 0;
- xf86eqEnqueue(mevent);
- }
-#endif
- }
+#endif /* __UNIXOS2__ and __QNX__ */
- if ((id = stateTab[buttons + private->emulateState][1]) != 0)
- {
-#ifdef XINPUT
- if (is_pointer) {
- if (xf86CheckButton(abs(id), (id >= 0))) {
-#endif
- ENQUEUE(mevent,
- abs(id), (id < 0 ? ButtonRelease : ButtonPress),
- XE_POINTER);
-#ifdef XINPUT
- }
- }
- else {
- xev->type = (id < 0 ? DeviceButtonRelease : DeviceButtonPress);
- xev->deviceid = device->id | MORE_EVENTS;
- xev->detail = abs(id);
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->num_valuators = 0;
- xv->device_state = 0;
- xf86eqEnqueue(mevent);
- }
-#endif
- }
-
- private->emulateState = stateTab[buttons + private->emulateState][2];
- if (stateTab[buttons + private->emulateState][0] ||
- stateTab[buttons + private->emulateState][1])
- {
- private->truebuttons = truebuttons;
- timer = TimerSet(timer, 0, private->emulate3Timeout, buttonTimer,
- (pointer)device);
- }
- else
- {
- if (timer)
- {
- TimerFree(timer);
- timer = NULL;
- }
- }
- }
- else
- {
-#ifdef AMOEBA
- if (truebuttons != 0) {
-#ifdef XINPUT
- if (is_pointer) {
- if (xf86CheckButton(truebuttons)) {
-#endif
- ENQUEUE(mevent,
- truebuttons, (pressed ? ButtonPress : ButtonRelease),
- XE_POINTER);
-#ifdef XINPUT
- }
- }
- else {
- xev->type = pressed ? DeviceButtonPress : DeviceButtonRelease;
- xev->deviceid = device->id | MORE_EVENTS;
- xev->detail = truebuttons;
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->num_valuators = 0;
- xv->device_state = 0;
- xf86eqEnqueue(mevent);
- }
-#endif
- }
-#else
- /*
- * real three button event
- * Note that xf86Info.lastButtons has the hardware button mapping which
- * is the reverse of the button mapping reported to the server.
- */
- if (private->mseType == P_MMHIT)
- change = buttons ^ reverseBits(hitachMap, private->lastButtons);
- else
- change = buttons ^ reverseBits(reverseMap, private->lastButtons);
- while (change)
- {
- id = ffs(change);
- change &= ~(1 << (id-1));
-#ifdef XINPUT
- if (is_pointer) {
- if (xf86CheckButton(id, (buttons&(1<<(id-1))))) {
-#endif
- ENQUEUE(mevent,
- id, (buttons&(1<<(id-1)))? ButtonPress : ButtonRelease,
- XE_POINTER);
-#ifdef XINPUT
+ if (err >= 0) { /* we don't want the handlers called if select() */
+ IHPtr ih; /* returned with an error condition, do we? */
+
+ for (ih = InputHandlers; ih; ih = ih->next) {
+ if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
+ (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) {
+ ih->ihproc(ih->fd, ih->data);
}
- }
- else {
- xev->type = (buttons&(1<<(id-1)))? DeviceButtonPress : DeviceButtonRelease;
- xev->deviceid = device->id | MORE_EVENTS;
- xev->detail = id;
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->num_valuators = 0;
- xv->device_state = 0;
- xf86eqEnqueue(mevent);
- }
-#endif
}
-#endif
}
- private->lastButtons = truebuttons;
-}
+
+ if (xf86VTSwitchPending()) xf86VTSwitch();
+ if (xf86Info.inputPending) ProcessInputEvents();
+}
/*
- * xf86Block --
- * Os block handler.
+ * xf86SigioReadInput --
+ * signal handler for the SIGIO signal.
*/
-
-/* ARGSUSED */
-void
-xf86Block(blockData, pTimeout, pReadmask)
- pointer blockData;
- OSTimePtr pTimeout;
- pointer pReadmask;
+static void
+xf86SigioReadInput(int fd,
+ void *closure)
{
-}
+ int sigstate = xf86BlockSIGIO();
+ InputInfoPtr pInfo = (InputInfoPtr) closure;
+ pInfo->read_input(pInfo);
-#ifndef AMOEBA
+ xf86UnblockSIGIO(sigstate);
+}
/*
- * xf86Wakeup --
- * Os wakeup handler.
+ * xf86AddEnabledDevice --
+ *
*/
-
-/* ARGSUSED */
void
-xf86Wakeup(blockData, err, pReadmask)
- pointer blockData;
- int err;
- pointer pReadmask;
+xf86AddEnabledDevice(InputInfoPtr pInfo)
{
+ if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {
+ AddEnabledDevice(pInfo->fd);
+ }
+}
-#ifndef __EMX__
-#ifdef __OSF__
- fd_set kbdDevices;
- fd_set mseDevices;
-#endif /* __OSF__ */
- fd_set* LastSelectMask = (fd_set*)pReadmask;
- fd_set devicesWithInput;
-
- if ((int)err >= 0) {
- XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
-#ifdef __OSF__
- /*
- * Until the two devices are made nonblock on read, we have to do this.
- */
-
- MASKANDSETBITS(devicesWithInput, pReadmask, EnabledDevices);
-
- CLEARBITS(kbdDevices);
- BITSET(kbdDevices, xf86Info.consoleFd);
- MASKANDSETBITS(kbdDevices, kbdDevices, devicesWithInput);
-
- CLEARBITS(mseDevices);
- BITSET(mseDevices, xf86Info.mouseDev->mseFd);
- MASKANDSETBITS(mseDevices, mseDevices, devicesWithInput);
-
- if (ANYSET(kbdDevices) || xf86Info.kbdRate)
- (xf86Info.kbdEvents)(ANYSET(kbdDevices));
- if (ANYSET(mseDevices))
- (xf86Info.mouseDev->mseEvents)(1);
-
-#else
- if (XFD_ANYSET(&devicesWithInput))
- {
- (xf86Info.kbdEvents)();
- (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev);
- }
-#endif /* __OSF__ */
- }
-#else /* __EMX__ */
-
- (xf86Info.kbdEvents)(); /* Under OS/2, always call */
- (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev);
-
-#endif /* __EMX__ */
-
-#if defined(XQUEUE) && !defined(XQUEUE_ASYNC)
- /* This could be done more cleanly */
- if (xf86Info.mouseDev->xqueSema && xf86Info.mouseDev->xquePending)
- xf86XqueRequest();
-#endif
-
- if (xf86VTSwitchPending()) xf86VTSwitch();
-
- if (xf86Info.inputPending) ProcessInputEvents();
+/*
+ * xf86RemoveEnabledDevice --
+ *
+ */
+void
+xf86RemoveEnabledDevice(InputInfoPtr pInfo)
+{
+ if (!xf86RemoveSIGIOHandler (pInfo->fd)) {
+ RemoveEnabledDevice(pInfo->fd);
+ }
}
-#endif /* AMOEBA */
+static int *xf86SignalIntercept = NULL;
+void
+xf86InterceptSignals(int *signo)
+{
+ if ((xf86SignalIntercept = signo))
+ *signo = -1;
+}
/*
* xf86SigHandler --
- * Catch unexpected signals and exit cleanly.
+ * Catch unexpected signals and exit or continue cleanly.
*/
void
-xf86SigHandler(signo)
- int signo;
+xf86SigHandler(int signo)
{
+ if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
+ /* Re-arm handler just in case */
+ (void) signal(signo, xf86SigHandler);
+ *xf86SignalIntercept = signo;
+ return;
+ }
+
signal(signo,SIG_IGN);
xf86Info.caughtSignal = TRUE;
+#ifdef XF86BIGFONT
+ XF86BigfontCleanup();
+#endif
+#if defined(XFree86LOADER)
+ if (xf86Initialising)
+ LoaderCheckUnresolved(LD_RESOLV_IFDONE);
+ ErrorF("\n"
+ " *** If unresolved symbols were reported above, they might not\n"
+ " *** be the reason for the server aborting.\n");
+#endif
FatalError("Caught signal %d. Server aborting\n", signo);
}
+#ifdef MEMDEBUG
+void
+xf86SigMemDebug(int signo)
+{
+ CheckMemory();
+ (void) signal(signo, xf86SigMemDebug);
+ return;
+}
+#endif
+
/*
* xf86VTSwitch --
* Handle requests for switching the vt.
@@ -1407,76 +1211,261 @@ xf86SigHandler(signo)
static void
xf86VTSwitch()
{
- int j;
+ int i, prevSIGIO;
+ InputInfoPtr pInfo;
+ IHPtr ih;
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch()\n");
+#endif
+
#ifdef XFreeXDGA
+ if(!DGAVTSwitch())
+ return;
+#endif
+
/*
- * Not ideal, but until someone adds DGA events to the DGA client we
- * should protect the machine
+ * Since all screens are currently all in the same state it is sufficient
+ * check the first. This might change in future.
*/
- if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectGraphics) {
- xf86Info.vtRequestsPending = FALSE;
- return;
- }
+ if (xf86Screens[0]->vtSema) {
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+ BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
#endif
- if (xf86VTSema) {
- for (j = 0; j < screenInfo.numScreens; j++)
- (XF86SCRNINFO(screenInfo.screens[j])->EnterLeaveVT)(LEAVE, j);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!(dispatchException & DE_TERMINATE))
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+ }
+#if !defined(__UNIXOS2__)
-#ifndef __EMX__
+ /*
+ * Keep the order: Disable Device > LeaveVT
+ * EnterVT > EnableDevice
+ */
DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
- DisableDevice((DeviceIntPtr)xf86Info.pMouse);
-#endif
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ DisableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+#endif /* !__UNIXOS2__ */
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->LeaveVT(i, 0);
+ }
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86DisableInputHandler(ih);
+ xf86AccessLeave(); /* We need this here, otherwise */
+ xf86AccessLeaveState(); /* console won't be restored */
if (!xf86VTSwitchAway()) {
/*
* switch failed
*/
- for (j = 0; j < screenInfo.numScreens; j++)
- (XF86SCRNINFO(screenInfo.screens[j])->EnterLeaveVT)(ENTER, j);
- SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
-#ifdef DPMSExtension
- if (DPMSEnabled)
- DPMSSet(DPMSModeOn);
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Leave failed\n");
#endif
+ prevSIGIO = xf86BlockSIGIO();
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ xf86EnterServerState(OPERATING);
+ if (!(dispatchException & DE_TERMINATE)) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+ }
+ }
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
-#ifndef __EMX__
+#if !defined(__UNIXOS2__)
EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
- EnableDevice((DeviceIntPtr)xf86Info.pMouse);
-#endif
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ EnableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+#endif /* !__UNIXOS2__ */
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+
+ xf86UnblockSIGIO(prevSIGIO);
} else {
- xf86VTSema = FALSE;
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ xf86OSPMClose = NULL;
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
+ xf86Screens[i]->access = NULL;
+ xf86Screens[i]->busAccess = NULL;
+ }
+ xf86DisableIO();
}
} else {
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Entering\n");
+#endif
if (!xf86VTSwitchTo()) return;
-
- xf86VTSema = TRUE;
- for (j = 0; j < screenInfo.numScreens; j++)
- (XF86SCRNINFO(screenInfo.screens[j])->EnterLeaveVT)(ENTER, j);
-
+
+ prevSIGIO = xf86BlockSIGIO();
+ xf86OSPMClose = xf86OSPMOpen();
+
+ xf86EnableIO();
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->vtSema = TRUE;
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ xf86EnterServerState(OPERATING);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE);
+ }
+
/* Turn screen saver off when switching back */
SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
-#ifdef DPMSExtension
- if (DPMSEnabled)
- DPMSSet(DPMSModeOn);
-#endif
-#ifndef __EMX__
+#if !defined(__UNIXOS2__)
EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
- EnableDevice((DeviceIntPtr)xf86Info.pMouse);
-#endif
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ EnableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+#endif /* !__UNIXOS2__ */
+
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+ xf86UnblockSIGIO(prevSIGIO);
}
}
+
+/* Input handler registration */
+
+pointer
+xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
+{
+ IHPtr ih;
+
+ if (fd < 0 || !proc)
+ return NULL;
+
+ ih = xcalloc(sizeof(*ih), 1);
+ if (!ih)
+ return NULL;
+
+ ih->fd = fd;
+ ih->ihproc = proc;
+ ih->data = data;
+ ih->enabled = TRUE;
+
+ ih->next = InputHandlers;
+ InputHandlers = ih;
+
+ AddEnabledDevice(fd);
+
+ return ih;
+}
+
+int
+xf86RemoveInputHandler(pointer handler)
+{
+ IHPtr ih, p;
+ int fd;
+
+ if (!handler)
+ return -1;
+
+ ih = handler;
+ fd = ih->fd;
+
+ if (ih->fd >= 0)
+ RemoveEnabledDevice(ih->fd);
+
+ if (ih == InputHandlers)
+ InputHandlers = ih->next;
+ else {
+ p = InputHandlers;
+ while (p && p->next != ih)
+ p = p->next;
+ if (ih)
+ p->next = ih->next;
+ }
+ xfree(ih);
+ return fd;
+}
+
+void
+xf86DisableInputHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = FALSE;
+ if (ih->fd >= 0)
+ RemoveEnabledDevice(ih->fd);
+}
+
+void
+xf86EnableInputHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = TRUE;
+ if (ih->fd >= 0)
+ AddEnabledDevice(ih->fd);
+}
+
+/*
+ * As used currently by the DRI, the return value is ignored.
+ */
+Bool
+xf86EnableVTSwitch(Bool new)
+{
+ static Bool def = TRUE;
+ Bool old;
+
+ old = VTSwitchEnabled;
+ if (!new) {
+ /* Disable VT switching */
+ def = VTSwitchEnabled;
+ VTSwitchEnabled = FALSE;
+ } else {
+ /* Restore VT switching to default */
+ VTSwitchEnabled = def;
+ }
+ return old;
+}
+
#ifdef XTESTEXT1
void
-XTestGetPointerPos(fmousex, fmousey)
- short *fmousex;
- short *fmousey;
+XTestGetPointerPos(short *fmousex, short *fmousey)
{
int x,y;
@@ -1488,23 +1477,14 @@ XTestGetPointerPos(fmousex, fmousey)
void
-XTestJumpPointer(jx, jy, dev_type)
- int jx;
- int jy;
- int dev_type;
+XTestJumpPointer(int jx, int jy, int dev_type)
{
miPointerAbsoluteCursor(jx, jy, GetTimeInMillis() );
}
-
-
void
-XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
- int dev_type;
- int keycode;
- int keystate;
- int mousex;
- int mousey;
+XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex,
+ int mousey)
{
xEvent tevent;
@@ -1525,51 +1505,30 @@ XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
#endif /* XTESTEXT1 */
+#ifdef WSCONS_SUPPORT
-#ifdef XFreeXDGA
-static void
-XF86DirectVideoMoveMouse(x, y, mtime)
- int x;
- int y;
- CARD32 mtime;
-{
- xEvent xE;
-
- xE.u.u.type = MotionNotify;
- xE.u.keyButtonPointer.time = xf86Info.lastEventTime = mtime;
- xf86Info.lastEventTime = mtime;
-
-
- xE.u.keyButtonPointer.eventY = x;
- xE.u.keyButtonPointer.eventY = y;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
+/* XXX Currently XKB is mandatory. */
- if (((DeviceIntPtr)(xf86Info.pMouse))->grab)
- DeliverGrabbedEvent(&xE, (xf86Info.pMouse), FALSE, 1);
- else
- DeliverDeviceEvents(GetSpriteWindow(), &xE, NullGrab, NullWindow,
- (xf86Info.pMouse), 1);
-}
+extern int WSKbdToKeycode(int);
-static void
-XF86DirectVideoKeyEvent(xE, keycode, etype)
-xEvent *xE;
-int keycode;
-int etype;
+void
+xf86PostWSKbdEvent(struct wscons_event *event)
{
- DeviceIntPtr keybd = (DeviceIntPtr)xf86Info.pKeyboard;
- KeyClassPtr keyc = keybd->key;
- BYTE *kptr;
-
- kptr = &keyc->down[keycode >> 3];
- xE->u.u.type = etype;
- xE->u.u.detail = keycode;
-
- /* clear the keypress state */
- if (etype == KeyPress) {
- *kptr &= ~(1 << (keycode & 7));
+ int type = event->type;
+ int value = event->value;
+ unsigned int keycode;
+ int blocked;
+
+ if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) {
+ Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE);
+
+ /* map the scancodes to standard XFree86 scancode */
+ keycode = WSKbdToKeycode(value);
+ if (!down) keycode |= 0x80;
+ /* It seems better to block SIGIO there */
+ blocked = xf86BlockSIGIO();
+ xf86PostKbdEvent(keycode);
+ xf86UnblockSIGIO(blocked);
}
- keybd->public.processInputProc(xE, keybd, 1);
}
-#endif
+#endif /* WSCONS_SUPPORT */
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 864933a84..7c65ce888 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1,138 +1,199 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.198 2003/02/26 09:21:38 dawes Exp $ */
+
/*
- * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.66.2.2 1997/06/29 08:43:36 dawes Exp $
- *
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ * Copyright 1991-1999 by The XFree86 Project, Inc.
*
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * Loosely based on code bearing the following copyright:
*
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*/
-/* $Xorg: xf86Init.c,v 1.3 2000/08/17 19:50:29 cpqbld Exp $ */
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#else
-extern int atoi();
-#endif
#define NEED_EVENTS
#include "X.h"
#include "Xmd.h"
#include "Xproto.h"
+#include "Xatom.h"
#include "input.h"
#include "servermd.h"
+#include "windowstr.h"
#include "scrnintstr.h"
#include "site.h"
+#include "mi.h"
#include "compiler.h"
+#ifdef XFree86LOADER
+#include "loaderProcs.h"
+#endif
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+#define XF86_OS_PRIVS
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
+#include "xf86Config.h"
#include "xf86_OSlib.h"
#include "xf86Version.h"
+#include "xf86Date.h"
+#include "xf86Build.h"
#include "mipointer.h"
-
#ifdef XINPUT
#include "XI.h"
#include "XIproto.h"
-#include "xf86_Config.h"
-#include "xf86Xinput.h"
#else
#include "inputstr.h"
#endif
+#include "xf86DDC.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
-#include "opaque.h"
+#include "globals.h"
#ifdef XTESTEXT1
#include "atKeynames.h"
extern int xtest_command_key;
#endif /* XTESTEXT1 */
-#ifdef __EMX__
-#define seteuid(x) /*nothing*/
-#define setruid(x) /*nothing*/
-#endif
-/* xf86Exiting is set while the screen is shutting down (even on a reset) */
-Bool xf86Exiting = FALSE;
-Bool xf86Resetting = FALSE;
-Bool xf86ProbeFailed = TRUE;
-Bool xf86FlipPixels = FALSE;
-#ifdef XF86VIDMODE
-Bool xf86VidModeEnabled = TRUE;
-Bool xf86VidModeAllowNonLocal = FALSE;
-#endif
-#ifdef XF86MISC
-Bool xf86MiscModInDevEnabled = TRUE;
-Bool xf86MiscModInDevAllowNonLocal = FALSE;
-#endif
-Bool xf86AllowMouseOpenFail = FALSE;
-PciProbeType xf86PCIFlags = PCIProbe1;
-Bool xf86ScreensOpen = FALSE;
-int xf86Verbose = 1;
-Bool xf86fpFlag = FALSE;
-Bool xf86coFlag = FALSE;
-Bool xf86sFlag = FALSE;
-Bool xf86ProbeOnly = FALSE;
-char xf86ConfigFile[PATH_MAX] = "";
-int xf86bpp = -1;
-xrgb xf86weight = { 0, 0, 0 } ; /* RGB weighting at 16 bpp */
-double xf86rGamma=1.0, xf86gGamma=1.0, xf86bGamma=1.0;
-unsigned char xf86rGammaMap[256], xf86gGammaMap[256], xf86bGammaMap[256];
-char *xf86ServerName = NULL;
-Bool xf86BestRefresh = FALSE;
-
-int vgaIOBase = 0x3d0;
-int vgaCRIndex = 0x3d4;
-int vgaCRReg = 0x3d5;
-
-static void xf86PrintBanner(
-#if NeedFunctionPrototypes
- void
-#endif
- );
-static void xf86PrintConfig(
-#if NeedFunctionPrototypes
- void
-#endif
- );
+/* forward declarations */
+
+static void xf86PrintBanner(void);
+static void xf86PrintMarkers(void);
+static void xf86RunVtInit(void);
+
#ifdef DO_CHECK_BETA
-void xf86CheckBeta(
-#if NeedFunctionPrototypes
- int,
- char *
-#endif
- );
static int extraDays = 0;
static char *expKey = NULL;
#endif
-extern ScrnInfoPtr xf86Screens[];
-extern int xf86MaxScreens;
-extern double pow();
-#ifdef USE_XF86_SERVERLOCK
-extern void xf86UnlockServer();
-#endif
-#ifdef __EMX__
+#ifdef __UNIXOS2__
extern void os2ServerVideoAccess();
#endif
-xf86InfoRec xf86Info;
-int xf86ScreenIndex;
+void (*xf86OSPMClose)(void) = NULL;
+
+#ifdef XFree86LOADER
+static char *baseModules[] = {
+ "bitmap",
+ "pcidata",
+ NULL
+};
+#endif
+
+/* Common pixmap formats */
+
+static PixmapFormatRec formats[MAXFORMATS] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+#ifdef RENDER
+ { 32, 32, BITMAP_SCANLINE_PAD },
+#endif
+};
+#ifdef RENDER
+static int numFormats = 7;
+#else
+static int numFormats = 6;
+#endif
+static Bool formatsDone = FALSE;
+
+InputDriverRec xf86KEYBOARD = {
+ 1,
+ "keyboard",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0
+};
+
+static Bool
+xf86CreateRootWindow(WindowPtr pWin)
+{
+ int ret = TRUE;
+ int err = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PropertyPtr pRegProp, pOldRegProp;
+ CreateWindowProcPtr CreateWindow =
+ (CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr);
+
+#ifdef DEBUG
+ ErrorF("xf86CreateRootWindow(%p)\n", pWin);
+#endif
+
+ if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
+ /* Can't find hook we are hung on */
+ xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
+ "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
+ xf86CreateRootWindow, pScreen->CreateWindow );
+ }
+
+ /* Unhook this function ... */
+ pScreen->CreateWindow = CreateWindow;
+ pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL;
+
+ /* ... and call the previous CreateWindow fuction, if any */
+ if (NULL!=pScreen->CreateWindow) {
+ ret = (*pScreen->CreateWindow)(pWin);
+ }
+
+ /* Now do our stuff */
+
+ if (xf86RegisteredPropertiesTable != NULL) {
+ if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
+ for (pRegProp = xf86RegisteredPropertiesTable[pScreen->myNum];
+ pRegProp != NULL && err==Success;
+ pRegProp = pRegProp->next )
+ {
+ Atom oldNameAtom = pRegProp->propertyName;
+ char *nameString;
+ /* propertyName was created before the screen existed,
+ * so the atom does not belong to any screen;
+ * we need to create a new atom with the same name.
+ */
+ nameString = NameForAtom(oldNameAtom);
+ pRegProp->propertyName = MakeAtom(nameString, strlen(nameString), TRUE);
+ err = ChangeWindowProperty(pWin,
+ pRegProp->propertyName, pRegProp->type,
+ pRegProp->format, PropModeReplace,
+ pRegProp->size, pRegProp->data,
+ FALSE
+ );
+ }
+
+ /* Look at err */
+ ret &= (err==Success);
+
+ /* free memory */
+ pOldRegProp = xf86RegisteredPropertiesTable[pScreen->myNum];
+ while (pOldRegProp!=NULL) {
+ pRegProp = pOldRegProp->next;
+ xfree(pOldRegProp);
+ pOldRegProp = pRegProp;
+ }
+ xf86RegisteredPropertiesTable[pScreen->myNum] = NULL;
+ } else {
+ xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
+ "non-root window %p (parent %p)\n", pWin, pWin->parent);
+ ret = FALSE;
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("xf86CreateRootWindow() returns %d\n", ret);
+#endif
+ return (ret);
+}
+
/*
* InitOutput --
@@ -142,23 +203,38 @@ int xf86ScreenIndex;
*/
void
-InitOutput(pScreenInfo, argc, argv)
- ScreenInfo *pScreenInfo;
- int argc;
- char **argv;
+InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
- int i, j, scr_index;
- static int numFormats = 0;
- static PixmapFormatRec formats[MAXFORMATS];
+ int i, j, k, scr_index;
static unsigned long generation = 0;
- int any_screens = 0;
-
-#ifdef __EMX__
+#ifdef XFree86LOADER
+ char **modulelist;
+ pointer *optionlist;
+#endif
+ screenLayoutPtr layout;
+ Pix24Flags screenpix24, pix24;
+ MessageType pix24From = X_DEFAULT;
+ Bool pix24Fail = FALSE;
+
+#ifdef __UNIXOS2__
os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */
#endif
+ xf86Initialising = TRUE;
+
+ /* Do this early? */
+ if (generation != serverGeneration) {
+ xf86ScreenIndex = AllocateScreenPrivateIndex();
+ xf86CreateRootWindowIndex = AllocateScreenPrivateIndex();
+ xf86PixmapIndex = AllocatePixmapPrivateIndex();
+ xf86RegisteredPropertiesTable=NULL;
+ generation = serverGeneration;
+ }
+
if (serverGeneration == 1) {
+ pScreenInfo->numScreens = 0;
+
if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
xf86ServerName++;
else
@@ -169,119 +245,517 @@ InitOutput(pScreenInfo, argc, argv)
#endif
xf86PrintBanner();
+ xf86PrintMarkers();
+ if (xf86LogFile) {
+ time_t t;
+ const char *ct;
+ t = time(NULL);
+ ct = ctime(&t);
+ xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
+ xf86LogFile, ct);
+ }
+
+ /* Read and parse the config file */
+ if (!xf86DoProbe && !xf86DoConfigure) {
+ if (!xf86HandleConfigFile()) {
+ xf86Msg(X_ERROR, "Error from xf86HandleConfigFile()\n");
+ return;
+ }
+ }
- xf86PrintConfig();
+ /*
+ * Install signal handler for unexpected signals
+ */
+ xf86Info.caughtSignal=FALSE;
+ if (!xf86Info.notrapSignals) {
+ signal(SIGSEGV,xf86SigHandler);
+ signal(SIGILL,xf86SigHandler);
+#ifdef SIGEMT
+ signal(SIGEMT,xf86SigHandler);
+#endif
+ signal(SIGFPE,xf86SigHandler);
+#ifdef SIGBUS
+ signal(SIGBUS,xf86SigHandler);
+#endif
+#ifdef SIGSYS
+ signal(SIGSYS,xf86SigHandler);
+#endif
+#ifdef SIGXCPU
+ signal(SIGXCPU,xf86SigHandler);
+#endif
+#ifdef SIGXFSZ
+ signal(SIGXFSZ,xf86SigHandler);
+#endif
+#ifdef MEMDEBUG
+ signal(SIGUSR2,xf86SigMemDebug);
+#endif
+ }
xf86OpenConsole();
+ xf86OSPMClose = xf86OSPMOpen();
+
+ /* Run an external VT Init program if specified in the config file */
+ xf86RunVtInit();
+
+ /* Do this after XF86Config is read (it's normally in OsInit()) */
+ OsInitColors();
+
+ /* Enable full I/O access */
+ xf86EnableIO();
+
+#ifdef XFree86LOADER
+ /* Initialise the loader */
+ LoaderInit();
+
+ /* Tell the loader the default module search path */
+ LoaderSetPath(xf86ModulePath);
+
+#ifdef TESTING
+ {
+ char **list, **l;
+ const char *subdirs[] = {
+ "drivers",
+ NULL
+ };
+ const char *patlist[] = {
+ "(.*)_drv\\.so",
+ "(.*)_drv\\.o",
+ NULL
+ };
+ ErrorF("Getting module listing...\n");
+ list = LoaderListDirs(NULL, NULL);
+ if (list)
+ for (l = list; *l; l++)
+ ErrorF("module: %s\n", *l);
+ LoaderFreeDirList(list);
+ ErrorF("Getting video driver listing...\n");
+ list = LoaderListDirs(subdirs, NULL);
+ if (list)
+ for (l = list; *l; l++)
+ ErrorF("video driver: %s\n", *l);
+ LoaderFreeDirList(list);
+ ErrorF("Getting driver listing...\n");
+ list = LoaderListDirs(NULL, patlist);
+ if (list)
+ for (l = list; *l; l++)
+ ErrorF("video driver: %s\n", *l);
+ LoaderFreeDirList(list);
+ }
+#endif
+
+ /* Force load mandatory base modules */
+ if (!xf86LoadModules(baseModules, NULL))
+ FatalError("Unable to load required base modules, Exiting...\n");
+
+#endif
+
+ /* Do a general bus probe. This will be a PCI probe for x86 platforms */
+ xf86BusProbe();
+
+ if (xf86DoProbe)
+ DoProbe();
+
+ if (xf86DoConfigure)
+ DoConfigure();
+
+ /* Initialise the resource broker */
+ xf86ResourceBrokerInit();
+
+#ifdef XFree86LOADER
+ /* Load all modules specified explicitly in the config file */
+ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
+ xf86LoadModules(modulelist, optionlist);
+ xfree(modulelist);
+ xfree(optionlist);
+ }
+
+ /* Load all driver modules specified in the config file */
+ if ((modulelist = xf86DriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ xfree(modulelist);
+ }
+
+ /* Setup the builtin input drivers */
+ xf86AddInputDriver(&xf86KEYBOARD, NULL, 0);
+ /* Load all input driver modules specified in the config file. */
+ if ((modulelist = xf86InputDriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ xfree(modulelist);
+ }
-#if !defined(AMOEBA) && !defined(MINIX)
/*
- * If VTInit was set, run that program with consoleFd as stdin and stdout
+ * It is expected that xf86AddDriver()/xf86AddInputDriver will be
+ * called for each driver as it is loaded. Those functions save the
+ * module pointers for drivers.
+ * XXX Nothing keeps track of them for other modules.
*/
+ /* XXX What do we do if not all of these could be loaded? */
+#endif
- if (xf86Info.vtinit) {
- switch(fork()) {
- case -1:
- FatalError("Fork failed for VTInit (%s)\n", strerror(errno));
- break;
- case 0: /* child */
- setuid(getuid());
- /* set stdin, stdout to the consoleFd */
- for (i = 0; i < 2; i++) {
- if (xf86Info.consoleFd != i) {
- close(i);
- dup(xf86Info.consoleFd);
- }
- }
- execl("/bin/sh", "sh", "-c", xf86Info.vtinit, NULL);
- ErrorF("Warning: exec of /bin/sh failed for VTInit (%s)\n",
- strerror(errno));
- exit(255);
- break;
- default: /* parent */
- wait(NULL);
+ /*
+ * At this point, xf86DriverList[] is all filled in with entries for
+ * each of the drivers to try and xf86NumDrivers has the number of
+ * drivers. If there are none, return now.
+ */
+
+ if (xf86NumDrivers == 0) {
+ xf86Msg(X_ERROR, "No drivers available.\n");
+ return;
+ }
+
+ /*
+ * Call each of the Identify functions. The Identify functions print
+ * out some identifying information, and anything else that might be
+ * needed at this early stage.
+ */
+
+ for (i = 0; i < xf86NumDrivers; i++)
+ /* The Identify function is mandatory, but if it isn't there continue */
+ if (xf86DriverList[i]->Identify != NULL)
+ xf86DriverList[i]->Identify(0);
+ else {
+ xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n",
+ xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
+ : "noname");
}
+
+ /*
+ * Locate bus slot that had register IO enabled at server startup
+ */
+
+ xf86AccessInit();
+ xf86FindPrimaryDevice();
+
+ /*
+ * Now call each of the Probe functions. Each successful probe will
+ * result in an extra entry added to the xf86Screens[] list for each
+ * instance of the hardware found.
+ */
+
+ for (i = 0; i < xf86NumDrivers; i++) {
+ if (xf86DriverList[i]->Probe != NULL)
+ xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT);
+ else {
+ xf86MsgVerb(X_WARNING, 0,
+ "Driver `%s' has no Probe function (ignoring)\n",
+ xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
+ : "noname");
+ }
+ xf86SetPciVideo(NULL,NONE);
}
-#endif /* !AMOEBA && !MINIX */
- /* Do this after XF86Config is read (it's normally in OsInit()) */
- OsInitColors();
+ /*
+ * If nothing was detected, return now.
+ */
- for (i=0; i<256; i++) {
- xf86rGammaMap[i] = (int)(pow(i/255.0,xf86rGamma)*255.0+0.5);
- xf86gGammaMap[i] = (int)(pow(i/255.0,xf86gGamma)*255.0+0.5);
- xf86bGammaMap[i] = (int)(pow(i/255.0,xf86bGamma)*255.0+0.5);
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR, "No devices detected.\n");
+ return;
}
- xf86Config(TRUE); /* Probe displays, and resolve modes */
+ /*
+ * Match up the screens found by the probes against those specified
+ * in the config file. Remove the ones that won't be used. Sort
+ * them in the order specified.
+ */
-#ifdef XKB
- xf86InitXkb();
-#endif
+ /*
+ * What is the best way to do this?
+ *
+ * For now, go through the screens allocated by the probes, and
+ * look for screen config entry which refers to the same device
+ * section as picked out by the probe.
+ *
+ */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
+ layout++) {
+ Bool found = FALSE;
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+
+ GDevPtr dev =
+ xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
+ xf86Screens[i]->entityInstanceList[j]);
+
+ if (dev == layout->screen->device) {
+ /* A match has been found */
+ xf86Screens[i]->confScreen = layout->screen;
+ found = TRUE;
+ break;
+ }
+ }
+ if (found) break;
+ }
+ if (layout->screen == NULL) {
+ /* No match found */
+ xf86Msg(X_ERROR,
+ "Screen %d deleted because of no matching config section.\n", i);
+ xf86DeleteScreen(i--, 0);
+ }
+ }
/*
- * collect all possible formats
+ * If no screens left, return now.
*/
- formats[0].depth = 1;
- formats[0].bitsPerPixel = 1;
- formats[0].scanlinePad = BITMAP_SCANLINE_PAD;
- numFormats++;
-
- for ( i=0;
- i < xf86MaxScreens && xf86Screens[i] && xf86Screens[i]->configured;
- i++ )
- {
- /*
- * At least one probe function succeeded.
- */
- any_screens = 1;
- /*
- * add new pixmap format
- */
- for ( j=0; j < numFormats; j++ ) {
-
- if (formats[j].depth == xf86Screens[i]->depth &&
- formats[j].bitsPerPixel == xf86Screens[i]->bitsPerPixel)
- break; /* found */
- }
-
- if (j == numFormats) { /* not already there */
- formats[j].depth = xf86Screens[i]->depth;
- formats[j].bitsPerPixel = xf86Screens[i]->bitsPerPixel;
- formats[j].scanlinePad = BITMAP_SCANLINE_PAD;
- numFormats++;
- if ( numFormats > MAXFORMATS )
- FatalError( "Too many pixmap formats! Exiting\n" );
- }
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Device(s) detected, but none match those in the config file.\n");
+ return;
+ }
+
+ xf86PostProbe();
+ xf86EntityInit();
+
+ /*
+ * Sort the drivers to match the requested ording. Using a slow
+ * bubble sort.
+ */
+ for (j = 0; j < xf86NumScreens - 1; j++) {
+ for (i = 0; i < xf86NumScreens - j - 1; i++) {
+ if (xf86Screens[i + 1]->confScreen->screennum <
+ xf86Screens[i]->confScreen->screennum) {
+ ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
+ xf86Screens[i + 1] = xf86Screens[i];
+ xf86Screens[i] = tmpScrn;
+ }
+ }
+ }
+ /* Fix up the indexes */
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->scrnIndex = i;
+ }
+
+ /*
+ * Call the driver's PreInit()'s to complete initialisation for the first
+ * generation.
+ */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->PreInit &&
+ xf86Screens[i]->PreInit(xf86Screens[i], 0))
+ xf86Screens[i]->configured = TRUE;
+ }
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86Screens[i]->configured)
+ xf86DeleteScreen(i--, 0);
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Screen(s) found, but none have a usable configuration.\n");
+ return;
+ }
+
+ /* This could be moved into a separate function */
+
+ /*
+ * Check that all screens have initialised the mandatory function
+ * entry points. Delete those which have not.
+ */
+
+#define WARN_SCREEN(func) \
+ xf86Msg(X_ERROR, "Driver `%s' has no %s function, deleting.\n", \
+ xf86Screens[i]->name, (warned++, func))
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ int warned = 0;
+ if (xf86Screens[i]->name == NULL) {
+ xf86Screens[i]->name = xnfalloc(strlen("screen") + 1 + 1);
+ if (i < 10)
+ sprintf(xf86Screens[i]->name, "screen%c", i + '0');
+ else
+ sprintf(xf86Screens[i]->name, "screen%c", i - 10 + 'A');
+ xf86MsgVerb(X_WARNING, 0,
+ "Screen driver %d has no name set, using `%s'.\n",
+ i, xf86Screens[i]->name);
}
- if (!any_screens)
- if (xf86ProbeFailed)
- ErrorF("\n *** None of the configured devices were detected.***\n\n");
- else
- ErrorF(
- "\n *** A configured device found, but display modes could not be resolved.***\n\n");
+ if (xf86Screens[i]->ScreenInit == NULL)
+ WARN_SCREEN("ScreenInit");
+ if (xf86Screens[i]->EnterVT == NULL)
+ WARN_SCREEN("EnterVT");
+ if (xf86Screens[i]->LeaveVT == NULL)
+ WARN_SCREEN("LeaveVT");
+ if (warned)
+ xf86DeleteScreen(i--, 0);
+ }
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR, "Screen(s) found, but drivers were unusable.\n");
+ return;
+ }
+
+ /* XXX Should this be before or after loading dependent modules? */
if (xf86ProbeOnly)
{
- xf86VTSema = FALSE;
+ OsCleanup();
AbortDDX();
fflush(stderr);
exit(0);
}
- }
- else {
+
+#ifdef XFree86LOADER
+ /* Remove (unload) drivers that are not required */
+ for (i = 0; i < xf86NumDrivers; i++)
+ if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
+ xf86DeleteDriver(i);
+#endif
+
+ /*
+ * At this stage we know how many screens there are.
+ */
+
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86InitViewport(xf86Screens[i]);
+
+ /*
+ * Collect all pixmap formats and check for conflicts at the display
+ * level. Should we die here? Or just delete the offending screens?
+ * Also, should this be done for -probeonly?
+ */
+ screenpix24 = Pix24DontCare;
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->imageByteOrder !=
+ xf86Screens[0]->imageByteOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlinePad !=
+ xf86Screens[0]->bitmapScanlinePad)
+ FatalError("Inconsistent display bitmapScanlinePad. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlineUnit !=
+ xf86Screens[0]->bitmapScanlineUnit)
+ FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n");
+ if (xf86Screens[i]->bitmapBitOrder !=
+ xf86Screens[0]->bitmapBitOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+
+ /* Determine the depth 24 pixmap format the screens would like */
+ if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
+ if (screenpix24 == Pix24DontCare)
+ screenpix24 = xf86Screens[i]->pixmap24;
+ else if (screenpix24 != xf86Screens[i]->pixmap24)
+ FatalError("Inconsistent depth 24 pixmap format. Exiting\n");
+ }
+ }
+ /* check if screenpix24 is consistent with the config/cmdline */
+ if (xf86Info.pixmap24 != Pix24DontCare) {
+ pix24 = xf86Info.pixmap24;
+ pix24From = xf86Info.pix24From;
+ if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24)
+ pix24Fail = TRUE;
+ } else if (screenpix24 != Pix24DontCare) {
+ pix24 = screenpix24;
+ pix24From = X_PROBED;
+ } else
+ pix24 = Pix24Use32;
+
+ if (pix24Fail)
+ FatalError("Screen(s) can't use the required depth 24 pixmap format"
+ " (%d). Exiting\n", PIX24TOBPP(pix24));
+
+ /* Initialise the depth 24 format */
+ for (j = 0; j < numFormats && formats[j].depth != 24; j++)
+ ;
+ formats[j].bitsPerPixel = PIX24TOBPP(pix24);
+
+ /* Collect additional formats */
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numFormats; j++) {
+ for (k = 0; ; k++) {
+ if (k >= numFormats) {
+ if (k >= MAXFORMATS)
+ FatalError("Too many pixmap formats! Exiting\n");
+ formats[k] = xf86Screens[i]->formats[j];
+ numFormats++;
+ break;
+ }
+ if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
+ if ((formats[k].bitsPerPixel ==
+ xf86Screens[i]->formats[j].bitsPerPixel) &&
+ (formats[k].scanlinePad ==
+ xf86Screens[i]->formats[j].scanlinePad))
+ break;
+ FatalError("Inconsistent pixmap format for depth %d."
+ " Exiting\n", formats[k].depth);
+ }
+ }
+ }
+ }
+ formatsDone = TRUE;
+
+ /* If a screen uses depth 24, show what the pixmap format is */
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->depth == 24) {
+ xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
+ PIX24TOBPP(pix24));
+ break;
+ }
+ }
+
+#if BITMAP_SCANLINE_UNIT == 64
+ /*
+ * cfb24 doesn't currently work on architectures with a 64 bit
+ * BITMAP_SCANLINE_UNIT, so check for 24 bit pixel size for pixmaps
+ * or framebuffers.
+ */
+ {
+ Bool usesCfb24 = FALSE;
+
+ if (PIX24TOBPP(pix24) == 24)
+ usesCfb24 = TRUE;
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->bitsPerPixel == 24)
+ usesCfb24 = TRUE;
+ if (usesCfb24) {
+ FatalError("24-bit pixel size is not supported on systems with"
+ " 64-bit scanlines.\n");
+ }
+ }
+#endif
+
+#ifdef XKB
+ xf86InitXkb();
+#endif
+ /* set up the proper access funcs */
+ xf86PostPreInit();
+
+ AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL);
+
+ } else {
/*
* serverGeneration != 1; some OSs have to do things here, too.
*/
xf86OpenConsole();
+
+ /*
+ should we reopen it here? We need to deal with an already opened
+ device. We could leave this to the OS layer. For now we simply
+ close it here
+ */
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
+ xf86MsgVerb(3,X_INFO,"APM registered successfully\n");
+
+ /* Make sure full I/O access is enabled */
+ xf86EnableIO();
}
+#if 0
/*
* Install signal handler for unexpected signals
*/
+ xf86Info.caughtSignal=FALSE;
if (!xf86Info.notrapSignals)
{
- xf86Info.caughtSignal=FALSE;
signal(SIGSEGV,xf86SigHandler);
signal(SIGILL,xf86SigHandler);
#ifdef SIGEMT
@@ -301,85 +775,146 @@ InitOutput(pScreenInfo, argc, argv)
signal(SIGXFSZ,xf86SigHandler);
#endif
}
-
+#endif
/*
- * Use the previous collected parts to setup pScreenInfo
+ * Use the previously collected parts to setup pScreenInfo
*/
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
- pScreenInfo->numPixmapFormats = numFormats;
- for ( i=0; i < numFormats; i++ ) pScreenInfo->formats[i] = formats[i];
-
- if (generation != serverGeneration)
- {
- xf86ScreenIndex = AllocateScreenPrivateIndex();
- generation = serverGeneration;
- }
-
- for ( i=0;
- i < xf86MaxScreens && xf86Screens[i] && xf86Screens[i]->configured;
- i++ )
- {
- /*
- * On a server-reset, we have explicitely to remap all stuff ...
- * (At startuptime this is implicitely done by probing the device
- */
- if (serverGeneration != 1)
- {
- xf86Resetting = TRUE;
- xf86Exiting = FALSE;
+ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
+ pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
+ pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
+ pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
+ pScreenInfo->numPixmapFormats = numFormats;
+ for (i = 0; i < numFormats; i++)
+ pScreenInfo->formats[i] = formats[i];
+
+ /* Make sure the server's VT is active */
+
+ if (serverGeneration != 1) {
+ xf86Resetting = TRUE;
+ /* All screens are in the same state, so just check the first */
+ if (!xf86Screens[0]->vtSema) {
#ifdef HAS_USL_VTS
- if (!xf86VTSema)
- ioctl(xf86Info.consoleFd,VT_RELDISP,VT_ACKACQ);
+ ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
#endif
- xf86VTSema = TRUE;
- (xf86Screens[i]->EnterLeaveVT)(ENTER, i);
- xf86Resetting = FALSE;
- }
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ }
+ }
#ifdef SCO
- else {
- /*
- * Under SCO we must ack that we got the console at startup,
- * I think this is the safest way to assure it
- */
- static int once = 1;
- if (once) {
- once = 0;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
- ErrorF("VT_ACKACQ failed");
- }
- }
+ else {
+ /*
+ * Under SCO we must ack that we got the console at startup,
+ * I think this is the safest way to assure it.
+ */
+ static int once = 1;
+ if (once) {
+ once = 0;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+ xf86Msg(X_WARNING, "VT_ACKACQ failed");
+ }
+ }
#endif /* SCO */
- scr_index = AddScreen(xf86Screens[i]->Init, argc, argv);
- if (scr_index > -1)
- {
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ /*
+ * Almost everything uses these defaults, and many of those that
+ * don't, will wrap them.
+ */
+ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+ xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
+ scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
+ if (scr_index == i) {
+ /*
+ * Hook in our ScrnInfoRec, and initialise some other pScreen
+ * fields.
+ */
screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr
= (pointer)xf86Screens[i];
+ xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
+ /* The driver should set this, but make sure it is set anyway */
+ xf86Screens[i]->vtSema = TRUE;
+ } else {
+ /* This shouldn't normally happen */
+ FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
}
+#ifdef DEBUG
+ ErrorF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
+ i, xf86Screens[i]->pScreen );
+ ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
+ i, xf86Screens[i]->pScreen->CreateWindow );
+#endif
+
+ screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr
+ = (void*)(xf86Screens[i]->pScreen->CreateWindow);
+ xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
+
+#ifdef RENDER
+ if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
+ {
+ xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
+ PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
+ DDC ?
+ (DDC->features.input_type ?
+ SubPixelHorizontalRGB : SubPixelNone) :
+ SubPixelUnknown);
+ }
+#endif
+#ifdef RANDR
+ if (!xf86Info.disableRandR)
+ xf86RandRInit (screenInfo.screens[scr_index]);
+ xf86Msg(xf86Info.randRFrom, "RandR %s\n",
+ xf86Info.disableRandR ? "disabled" : "enabled");
+#endif
+#ifdef NOT_USED
/*
* Here we have to let the driver getting access of the VT. Note that
* this doesn't mean that the graphics board may access automatically
* the monitor. If the monitor is shared this is done in xf86CrossScreen!
*/
if (!xf86Info.sharedMonitor) (xf86Screens[i]->EnterLeaveMonitor)(ENTER);
- }
+#endif
+ }
-#ifndef AMOEBA
- RegisterBlockAndWakeupHandlers(xf86Block, xf86Wakeup, (void *)0);
+#ifdef XFree86LOADER
+ if ((serverGeneration == 1) && LoaderCheckUnresolved(LD_RESOLV_IFDONE)) {
+ /* For now, just a warning */
+ xf86Msg(X_WARNING, "Some symbols could not be resolved!\n");
+ }
#endif
+
+ xf86PostScreenInit();
+
+ xf86InitOrigins();
+
+ xf86Resetting = FALSE;
+ xf86Initialising = FALSE;
+
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
+ NULL);
+}
+
+
+static InputDriverPtr
+MatchInput(IDevPtr pDev)
+{
+ int i;
+
+ for (i = 0; i < xf86NumInputDrivers; i++) {
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
+ }
+ return NULL;
}
/*
* InitInput --
- * Initialize all supported input devices...what else is there
- * besides pointer and keyboard? Two DeviceRec's are allocated and
- * registered as the system pointer and keyboard devices.
+ * Initialize all supported input devices.
*/
void
@@ -387,129 +922,175 @@ InitInput(argc, argv)
int argc;
char **argv;
{
- xf86Info.vtRequestsPending = FALSE;
- xf86Info.inputPending = FALSE;
+ IDevPtr pDev;
+ InputDriverPtr pDrv;
+ InputInfoPtr pInfo;
+ static InputInfoPtr coreKeyboard = NULL, corePointer = NULL;
+
+ xf86Info.vtRequestsPending = FALSE;
+ xf86Info.inputPending = FALSE;
#ifdef XTESTEXT1
- xtest_command_key = KEY_Begin + MIN_KEYCODE;
+ xtest_command_key = KEY_Begin + MIN_KEYCODE;
#endif /* XTESTEXT1 */
- xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
- xf86Info.pMouse = AddInputDevice(xf86Info.mouseDev->mseProc, TRUE);
- RegisterKeyboardDevice((DevicePtr)xf86Info.pKeyboard);
- RegisterPointerDevice((DevicePtr)xf86Info.pMouse);
-
-#ifdef XINPUT
- (xf86Info.pMouse)->public.devicePrivate = xf86Info.mouseLocal;
-#if 0 /* Is this needed?? */
- ((LocalDevicePtr) xf86Info.mouseLocal)->dev = xf86Info.pMouse;
-#endif
-#else
- (xf86Info.pMouse)->public.devicePrivate = (pointer) xf86Info.mouseDev;
-#endif
-
-#ifdef XINPUT
- InitExtInput();
+ if (serverGeneration == 1) {
+ /* Call the PreInit function for each input device instance. */
+ for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
+ /* XXX The keyboard driver is a special case for now. */
+ if (!xf86NameCmp(pDev->driver, "keyboard")) {
+ xf86Msg(X_INFO, "Keyboard \"%s\" handled by legacy driver\n",
+ pDev->identifier);
+ continue;
+ }
+ if ((pDrv = MatchInput(pDev)) == NULL) {
+ xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
+ /* XXX For now, just continue. */
+ continue;
+ }
+ if (!pDrv->PreInit) {
+ xf86MsgVerb(X_WARNING, 0,
+ "Input driver `%s' has no PreInit function (ignoring)\n",
+ pDrv->driverName);
+ continue;
+ }
+ pInfo = pDrv->PreInit(pDrv, pDev, 0);
+ if (!pInfo) {
+ xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
+ pDev->identifier);
+ continue;
+ } else if (!(pInfo->flags & XI86_CONFIGURED)) {
+ xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+ pDev->identifier);
+ xf86DeleteInput(pInfo, 0);
+ continue;
+ }
+ if (pInfo->flags & XI86_CORE_KEYBOARD) {
+ if (coreKeyboard) {
+ xf86Msg(X_ERROR,
+ "Attempt to register more than one core keyboard (%s)\n",
+ pInfo->name);
+ pInfo->flags &= ~XI86_CORE_KEYBOARD;
+ } else {
+ if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
+ /* XXX just a warning for now */
+ xf86Msg(X_WARNING,
+ "%s: does not have core keyboard capabilities\n",
+ pInfo->name);
+ }
+ coreKeyboard = pInfo;
+ }
+ }
+ if (pInfo->flags & XI86_CORE_POINTER) {
+ if (corePointer) {
+ xf86Msg(X_ERROR,
+ "Attempt to register more than one core pointer (%s)\n",
+ pInfo->name);
+ pInfo->flags &= ~XI86_CORE_POINTER;
+ } else {
+ if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
+ /* XXX just a warning for now */
+ xf86Msg(X_WARNING,
+ "%s: does not have core pointer capabilities\n",
+ pInfo->name);
+ }
+ corePointer = pInfo;
+ }
+ }
+ }
+ if (!corePointer) {
+ xf86Msg(X_WARNING, "No core pointer registered\n");
+ /* XXX register a dummy core pointer */
+ }
+#ifdef NEW_KBD
+ if (!coreKeyboard) {
+ xf86Msg(X_WARNING, "No core keyboard registered\n");
+ /* XXX register a dummy core keyboard */
+ }
#endif
+ }
+
+ /* Initialise all input devices. */
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ xf86ActivateDevice(pInfo);
+ pInfo = pInfo->next;
+ }
- miRegisterPointerDevice(screenInfo.screens[0], (DevicePtr) xf86Info.pMouse);
+ if (coreKeyboard) {
+ xf86Info.pKeyboard = coreKeyboard->dev;
+ xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/
+ }
+ else {
+ xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
+ }
+ if (corePointer)
+ xf86Info.pMouse = corePointer->dev;
+ RegisterKeyboardDevice(xf86Info.pKeyboard);
+
+ miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
#ifdef XINPUT
- xf86XinputFinalizeInit(xf86Info.pMouse);
xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
#else
- mieqInit (xf86Info.pKeyboard, xf86Info.pMouse);
+ mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
#endif
}
+#ifndef SET_STDERR_NONBLOCKING
+#define SET_STDERR_NONBLOCKING 1
+#endif
+
/*
* OsVendorInit --
* OS/Vendor-specific initialisations. Called from OsInit(), which
* is called by dix before establishing the well known sockets.
*/
-extern Bool OsDelayInitColors;
-
void
OsVendorInit()
{
+ static Bool beenHere = FALSE;
+
+ /* xf86WrapperInit() is called directly from OsInit() */
#ifdef SIGCHLD
signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
#endif
-#ifdef USE_XF86_SERVERLOCK
- extern void xf86LockServer();
- static Bool been_here = FALSE;
-
- if (!been_here) {
- xf86LockServer();
- been_here = TRUE;
- }
-#endif
OsDelayInitColors = TRUE;
-}
-
-#ifdef DPMSExtension
-extern CARD16 DPMSPowerLevel;
-
-/*
- * DPMSSet --
- * Device dependent DPMS mode setting hook. This is called whenever
- * the DPMS mode is to be changed.
- */
-void
-DPMSSet(CARD16 level)
-{
- int i;
+#ifdef XFree86LOADER
+ loadableFonts = TRUE;
+#endif
- /* For each screen, set the power saver level */
- for (i = 0; i < screenInfo.numScreens; i++) {
- (XF86SCRNINFO(screenInfo.screens[i])->DPMSSet)(level);
- }
+ if (!beenHere)
+ xf86LogInit();
- DPMSPowerLevel = level;
-}
+#if SET_STDERR_NONBLOCKING
+ /* Set stderr to non-blocking. */
+#ifndef O_NONBLOCK
+#if defined(FNDELAY)
+#define O_NONBLOCK FNDELAY
+#elif defined(O_NDELAY)
+#define O_NONBLOCK O_NDELAY
+#endif
+#endif
-#if 0
-/*
- * DPMSGet --
- * Device dependent DPMS mode getting hook. This returns the current
- * DPMS mode, or -1 if DPMS is not supported.
- *
- * This should hook in to the appropriate driver-level function, which
- * will be added to the ScrnInfoRec.
- *
- * NOTES:
- * 1. the calling interface should be changed to specify which
- * screen to check.
- * 2. It isn't clear that this function is ever used.
- */
-CARD16
-DPMSGet(CARD16 *level)
-{
- int i;
+#ifdef O_NONBLOCK
+ if (!beenHere) {
+#if !defined(__EMX__)
+ if (geteuid() == 0 && getuid() != geteuid())
+#endif
+ {
+ int status;
- /* For each screen, set the power saver level */
- for (i = 0; i < screenInfo.numScreens; i++) {
- ;
+ status = fcntl(fileno(stderr), F_GETFL, 0);
+ if (status != -1) {
+ fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
+ }
}
-}
+ }
+#endif
#endif
-/*
- * DPMSSupported --
- * Return TRUE if any screen supports DPMS.
- */
-Bool
-DPMSSupported(void)
-{
- int i;
-
- /* For each screen, check if DPMS is supported */
- for (i = 0; i < screenInfo.numScreens; i++) {
- if (XF86SCRNINFO(screenInfo.screens[i])->DPMSSet != (void (*)())NoopDDA)
- return TRUE;
- }
- return FALSE;
+ beenHere = TRUE;
}
-#endif /* DPMSExtension */
/*
* ddxGiveUp --
@@ -521,15 +1102,38 @@ DPMSSupported(void)
void
ddxGiveUp()
{
+ int i;
+
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ xf86OSPMClose = NULL;
+
+ xf86AccessLeaveState();
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
+ xf86Screens[i]->access = NULL;
+ xf86Screens[i]->busAccess = NULL;
+ }
+
#ifdef USE_XF86_SERVERLOCK
- xf86UnlockServer();
+ xf86UnlockServer();
#endif
+#ifdef XFreeXDGA
+ DGAShutdown();
+#endif
+
+ xf86CloseConsole();
- xf86CloseConsole();
+ xf86CloseLog();
- /* If an unexpected signal was caught, dump a core for debugging */
- if (xf86Info.caughtSignal)
- abort();
+ /* If an unexpected signal was caught, dump a core for debugging */
+ if (xf86Info.caughtSignal)
+ abort();
}
@@ -546,18 +1150,11 @@ AbortDDX()
{
int i;
-#if 0
- if (xf86Exiting)
- return;
-#endif
-
- xf86Exiting = TRUE;
-
/*
* try to deinitialize all input devices
*/
- if (xf86Info.pMouse) (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_CLOSE);
- if (xf86Info.pKeyboard) (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
+ if (xf86Info.pKeyboard)
+ (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
/*
* try to restore the original video state
@@ -566,14 +1163,25 @@ AbortDDX()
/* Need the sleep when starting X from within another X session */
sleep(1);
#endif
- if (xf86VTSema && xf86ScreensOpen)
- for ( i=0;
- i < xf86MaxScreens && xf86Screens[i] && xf86Screens[i]->configured;
- i++ )
- (xf86Screens[i]->EnterLeaveVT)(LEAVE, i);
-
+ if (xf86Screens) {
+ if (xf86Screens[0]->vtSema)
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->vtSema) {
+ /*
+ * if we are aborting before ScreenInit() has finished
+ * we might not have been wrapped yet. Therefore enable
+ * screen explicitely.
+ */
+ xf86EnableAccess(xf86Screens[i]);
+ (xf86Screens[i]->LeaveVT)(i, 0);
+ }
+ }
+
+ xf86AccessLeave();
+
/*
- * This is needed for a abnormal server exit, since the normal exit stuff
+ * This is needed for an abnormal server exit, since the normal exit stuff
* MUST also be performed (i.e. the vt must be left in a defined state)
*/
ddxGiveUp();
@@ -583,7 +1191,11 @@ void
OsVendorFatalError()
{
ErrorF("\nWhen reporting a problem related to a server crash, please send\n"
- "the full server output, not just the last messages\n\n");
+ "the full server output, not just the last messages.\n");
+ if (xf86LogFile && xf86LogFileWasOpened)
+ ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile);
+ ErrorF("Please report problems to %s.\n", BUILDERADDR);
+ ErrorF("\n");
}
/*
@@ -591,24 +1203,81 @@ OsVendorFatalError()
* Process device-dependent command line args. Returns 0 if argument is
* not device dependent, otherwise Count of number of elements of argv
* that are part of a device dependent commandline option.
+ *
*/
+
+
/* ARGSUSED */
int
-ddxProcessArgument (argc, argv, i)
- int argc;
- char *argv[];
- int i;
+ddxProcessArgument(int argc, char **argv, int i)
{
- if (getuid() == 0 && !strcmp(argv[i], "-xf86config"))
+ /*
+ * Note: can't use xalloc/xfree here because OsInit() hasn't been called
+ * yet. Use malloc/free instead.
+ */
+
+#ifdef DDXOSVERRORF
+ static Bool beenHere = FALSE;
+
+ if (!beenHere) {
+ /*
+ * This initialises our hook into VErrorF() for catching log messages
+ * that are generated before OsInit() is called.
+ */
+ OsVendorVErrorFProc = OsVendorVErrorF;
+ beenHere = TRUE;
+ }
+#endif
+
+ /* First the options that are only allowed for root */
+ if (getuid() == 0)
+ {
+ if (!strcmp(argv[i], "-modulepath"))
+ {
+ char *mp;
+ if (!argv[i + 1])
+ return 0;
+ mp = malloc(strlen(argv[i + 1]) + 1);
+ if (!mp)
+ FatalError("Can't allocate memory for ModulePath\n");
+ strcpy(mp, argv[i + 1]);
+ xf86ModulePath = mp;
+ xf86ModPathFrom = X_CMDLINE;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "-logfile"))
+ {
+ char *lf;
+ if (!argv[i + 1])
+ return 0;
+ lf = malloc(strlen(argv[i + 1]) + 1);
+ if (!lf)
+ FatalError("Can't allocate memory for LogFile\n");
+ strcpy(lf, argv[i + 1]);
+ xf86LogFile = lf;
+ xf86LogFileFrom = X_CMDLINE;
+ return 2;
+ }
+ }
+ if (!strcmp(argv[i], "-xf86config"))
{
- if (!argv[i+1])
+ if (!argv[i + 1])
return 0;
- if (strlen(argv[i+1]) >= PATH_MAX)
- FatalError("XF86Config path name too long\n");
- strcpy(xf86ConfigFile, argv[i+1]);
+ if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
+ FatalError("\nInvalid argument for -xf86config\n"
+ "\tFor non-root users, the file specified with -xf86config must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n"
+ "\tUsing default XF86Config search path.\n\n");
+ }
+ xf86ConfigFile = argv[i + 1];
return 2;
}
+ if (!strcmp(argv[i],"-showunresolved"))
+ {
+ xf86ShowUnresolved = TRUE;
+ return 1;
+ }
if (!strcmp(argv[i],"-probeonly"))
{
xf86ProbeOnly = TRUE;
@@ -622,7 +1291,7 @@ ddxProcessArgument (argc, argv, i)
#ifdef XF86VIDMODE
if (!strcmp(argv[i],"-disableVidMode"))
{
- xf86VidModeEnabled = FALSE;
+ xf86VidModeDisabled = TRUE;
return 1;
}
if (!strcmp(argv[i],"-allowNonLocalXvidtune"))
@@ -634,7 +1303,7 @@ ddxProcessArgument (argc, argv, i)
#ifdef XF86MISC
if (!strcmp(argv[i],"-disableModInDev"))
{
- xf86MiscModInDevEnabled = FALSE;
+ xf86MiscModInDevDisabled = TRUE;
return 1;
}
if (!strcmp(argv[i],"-allowNonLocalModInDev"))
@@ -642,17 +1311,24 @@ ddxProcessArgument (argc, argv, i)
xf86MiscModInDevAllowNonLocal = TRUE;
return 1;
}
+#endif
if (!strcmp(argv[i],"-allowMouseOpenFail"))
{
xf86AllowMouseOpenFail = TRUE;
return 1;
}
-#endif
if (!strcmp(argv[i],"-bestRefresh"))
{
xf86BestRefresh = TRUE;
return 1;
}
+ if (!strcmp(argv[i],"-ignoreABI"))
+ {
+#ifdef XFree86LOADER
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+#endif
+ return 1;
+ }
#ifdef DO_CHECK_BETA
if (!strcmp(argv[i],"-extendExpiry"))
{
@@ -663,8 +1339,34 @@ ddxProcessArgument (argc, argv, i)
#endif
if (!strcmp(argv[i],"-verbose"))
{
- if (!xf86Verbose++)
- xf86Verbose = 2;
+ if (++i < argc && argv[i])
+ {
+ char *end;
+ long val;
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0')
+ {
+ xf86Verbose = val;
+ return 2;
+ }
+ }
+ xf86Verbose++;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-logverbose"))
+ {
+ if (++i < argc && argv[i])
+ {
+ char *end;
+ long val;
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0')
+ {
+ xf86LogVerbose = val;
+ return 2;
+ }
+ }
+ xf86LogVerbose++;
return 1;
}
if (!strcmp(argv[i],"-quiet"))
@@ -675,7 +1377,6 @@ ddxProcessArgument (argc, argv, i)
if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))
{
xf86PrintBanner();
- xf86PrintConfig();
exit(0);
}
/* Notice the -fp flag, but allow it to pass to the dix layer */
@@ -690,26 +1391,72 @@ ddxProcessArgument (argc, argv, i)
xf86coFlag = TRUE;
return 0;
}
+ /* Notice the -bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-bs"))
+ {
+ xf86bsDisableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the +bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "+bs"))
+ {
+ xf86bsEnableFlag = TRUE;
+ return 0;
+ }
/* Notice the -s flag, but allow it to pass to the dix layer */
if (!strcmp(argv[i], "-s"))
{
xf86sFlag = TRUE;
return 0;
}
-#ifndef XF86MONOVGA
if (!strcmp(argv[i], "-bpp"))
{
+ if (++i >= argc)
+ return 0;
+ ErrorF("The -bpp option is no longer supported.\n"
+ "\tUse -depth to set the color depth, and use -fbbpp if you really\n"
+ "\tneed to force a non-default framebuffer (hardware) pixel format.\n");
+ return 2;
+ }
+ if (!strcmp(argv[i], "-pixmap24"))
+ {
+ xf86Pix24 = Pix24Use24;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-pixmap32"))
+ {
+ xf86Pix24 = Pix24Use32;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-fbbpp"))
+ {
int bpp;
if (++i >= argc)
return 0;
if (sscanf(argv[i], "%d", &bpp) == 1)
{
- xf86bpp = bpp;
+ xf86FbBpp = bpp;
return 2;
}
else
{
- ErrorF("Invalid bpp\n");
+ ErrorF("Invalid fbbpp\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-depth"))
+ {
+ int depth;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%d", &depth) == 1)
+ {
+ xf86Depth = depth;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid depth\n");
return 0;
}
}
@@ -720,9 +1467,9 @@ ddxProcessArgument (argc, argv, i)
return 0;
if (sscanf(argv[i], "%1d%1d%1d", &red, &green, &blue) == 3)
{
- xf86weight.red = red;
- xf86weight.green = green;
- xf86weight.blue = blue;
+ xf86Weight.red = red;
+ xf86Weight.green = green;
+ xf86Weight.blue = blue;
return 2;
}
else
@@ -738,23 +1485,78 @@ ddxProcessArgument (argc, argv, i)
if (++i >= argc)
return 0;
if (sscanf(argv[i], "%lf", &gamma) == 1) {
- if (gamma < 0.1 || gamma > 10) {
- ErrorF("gamma out of range, only 0.1 < gamma_value < 10 is valid\n");
+ if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
+ ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
+ " is valid\n", GAMMA_MIN, GAMMA_MAX);
return 0;
}
- if (!strcmp(argv[i-1], "-gamma"))
- xf86rGamma = xf86gGamma = xf86bGamma = 1.0 / gamma;
- else if (!strcmp(argv[i-1], "-rgamma")) xf86rGamma = 1.0 / gamma;
- else if (!strcmp(argv[i-1], "-ggamma")) xf86gGamma = 1.0 / gamma;
- else if (!strcmp(argv[i-1], "-bgamma")) xf86bGamma = 1.0 / gamma;
+ if (!strcmp(argv[i-1], "-gamma"))
+ xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
+ else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma;
+ else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma;
+ else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma;
return 2;
}
}
-#endif /* XF86MONOVGA */
+ if (!strcmp(argv[i], "-layout"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86LayoutName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-screen"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86ScreenName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-pointer"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86PointerName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-keyboard"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86KeyboardName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-nosilk"))
+ {
+ xf86silkenMouseDisableFlag = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-scanpci"))
+ {
+ DoScanPci(argc, argv, i);
+ }
+ if (!strcmp(argv[i], "-probe"))
+ {
+ xf86DoProbe = TRUE;
+#if 0
+ DoProbe(argc, argv, i);
+#endif
+ return 1;
+ }
+ if (!strcmp(argv[i], "-configure"))
+ {
+ if (getuid() != 0) {
+ ErrorF("The '-configure' option can only be used by root.\n");
+ exit(1);
+ }
+ xf86DoConfigure = TRUE;
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
+ /* OS-specific processing */
return xf86ProcessArgument(argc, argv, i);
}
-
/*
* ddxUseMsg --
* Print out correct use of device dependent commandline options.
@@ -768,18 +1570,36 @@ ddxUseMsg()
ErrorF("\n");
ErrorF("Device Dependent Usage\n");
if (getuid() == 0)
+ {
ErrorF("-xf86config file specify a configuration file\n");
+ ErrorF("-modulepath paths specify the module search path\n");
+ ErrorF("-logfile file specify a log file name\n");
+ ErrorF("-configure probe for devices and write an XF86Config\n");
+ }
+ else
+ {
+ ErrorF("-xf86config file specify a configuration file, relative to the\n");
+ ErrorF(" XF86Config search path, only root can use absolute\n");
+ }
ErrorF("-probeonly probe for devices, then exit\n");
- ErrorF("-verbose verbose startup messages\n");
+ ErrorF("-scanpci execute the scanpci module and exit\n");
+ ErrorF("-verbose [n] verbose startup messages\n");
+ ErrorF("-logverbose [n] verbose log messages\n");
ErrorF("-quiet minimal startup messages\n");
-#ifndef XF86MONOVGA
- ErrorF("-bpp n set number of bits per pixel. Default: 8\n");
+ ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
+ ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
+ ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
+ ErrorF("-depth n set colour depth. Default: 8\n");
ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
ErrorF("-rgamma f set gamma value for red phase\n");
ErrorF("-ggamma f set gamma value for green phase\n");
ErrorF("-bgamma f set gamma value for blue phase\n");
ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
-#endif /* XF86MONOVGA */
+ ErrorF("-layout name specify the ServerLayout section name\n");
+ ErrorF("-screen name specify the Screen section name\n");
+ ErrorF("-keyboard name specify the core keyboard InputDevice name\n");
+ ErrorF("-pointer name specify the core pointer InputDevice name\n");
+ ErrorF("-nosilk disable Silken Mouse\n");
ErrorF("-flipPixels swap default black/white Pixel values\n");
#ifdef XF86VIDMODE
ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
@@ -791,44 +1611,230 @@ ddxUseMsg()
ErrorF(" from non-local clients\n");
ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
#endif
- ErrorF("-bestRefresh Chose modes with the best refresh rate\n");
- ErrorF(
- "-showconfig show which drivers are included in the server\n");
+ ErrorF("-bestRefresh choose modes with the best refresh rate\n");
+ ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
+ ErrorF("-version show the server version\n");
+ /* OS-specific usage */
xf86UseMsg();
ErrorF("\n");
}
#ifndef OSNAME
-#define OSNAME "unknown"
+#define OSNAME " unknown"
#endif
#ifndef OSVENDOR
#define OSVENDOR ""
#endif
+#ifndef PRE_RELEASE
+#define PRE_RELEASE XF86_VERSION_SNAP
+#endif
static void
xf86PrintBanner()
{
- ErrorF("\nXFree86 Version%s/ X Window System\n",XF86_VERSION);
- ErrorF("(protocol Version %d, revision %d, vendor release %d)\n",
- X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE );
- ErrorF("Release Date: %s\n", XF86_DATE);
- ErrorF("\tIf the server is older than 6-12 months, or if your card is "
- "newer\n"
- "\tthan the above date, look for a newer version before "
- "reporting\n"
- "\tproblems. (see http://www.XFree86.Org/FAQ)\n");
- ErrorF("Operating System: %s %s\n", OSNAME, OSVENDOR);
+#if PRE_RELEASE
+ ErrorF("\n"
+ "This is a pre-release version of XFree86, and is not supported in any\n"
+ "way. Bugs may be reported to XFree86@XFree86.Org and patches submitted\n"
+ "to fixes@XFree86.Org. Before reporting bugs in pre-release versions,\n"
+ "please check the latest version in the XFree86 CVS repository\n"
+ "(http://www.XFree86.Org/cvs).\n");
+#endif
+ ErrorF("\nXFree86 Version %d.%d.%d", XF86_VERSION_MAJOR, XF86_VERSION_MINOR,
+ XF86_VERSION_PATCH);
+#if XF86_VERSION_SNAP > 0
+ ErrorF(".%d", XF86_VERSION_SNAP);
+#endif
+
+#if XF86_VERSION_SNAP >= 900
+ ErrorF(" (%d.%d.0 RC %d)", XF86_VERSION_MAJOR, XF86_VERSION_MINOR + 1,
+ XF86_VERSION_SNAP - 900);
+#endif
+
+#ifdef XF86_CUSTOM_VERSION
+ ErrorF(" (%s)", XF86_CUSTOM_VERSION);
+#endif
+ ErrorF("\nRelease Date: %s\n", XF86_DATE);
+ ErrorF("X Protocol Version %d, Revision %d, %s\n",
+ X_PROTOCOL, X_PROTOCOL_REVISION, XORG_RELEASE );
+ ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR);
+#ifdef BUILD_DATE
+ {
+ struct tm t;
+ char buf[100];
+
+ bzero(&t, sizeof(t));
+ bzero(buf, sizeof(buf));
+ t.tm_mday = BUILD_DATE % 100;
+ t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
+ t.tm_year = BUILD_DATE / 10000 - 1900;
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ ErrorF("Build Date: %s\n", buf);
+ }
+#endif
+#if defined(BUILDERSTRING)
+ ErrorF("%s \n",BUILDERSTRING);
+#endif
+ ErrorF("\tBefore reporting problems, check http://www.XFree86.Org/\n"
+ "\tto make sure that you have the latest version.\n");
+#ifdef XFree86LOADER
+ ErrorF("Module Loader present\n");
+#endif
}
static void
-xf86PrintConfig()
+xf86PrintMarkers()
{
- int i;
+ /* Show what the marker symbols mean */
+ ErrorF("Markers: " X_PROBE_STRING " probed, "
+ X_CONFIG_STRING " from config file, "
+ X_DEFAULT_STRING " default setting,\n"
+ " " X_CMDLINE_STRING " from command line, "
+ X_NOTICE_STRING " notice, "
+ X_INFO_STRING " informational,\n"
+ " " X_WARNING_STRING " warning, "
+ X_ERROR_STRING " error, "
+ X_NOT_IMPLEMENTED_STRING " not implemented, "
+ X_UNKNOWN_STRING " unknown.\n");
+}
+
+static void
+xf86RunVtInit(void)
+{
+ int i;
+
+ /*
+ * If VTInit was set, run that program with consoleFd as stdin and stdout
+ */
+
+ if (xf86Info.vtinit) {
+ switch(fork()) {
+ case -1:
+ FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno));
+ break;
+ case 0: /* child */
+ setuid(getuid());
+ /* set stdin, stdout to the consoleFd */
+ for (i = 0; i < 2; i++) {
+ if (xf86Info.consoleFd != i) {
+ close(i);
+ dup(xf86Info.consoleFd);
+ }
+ }
+ execl("/bin/sh", "sh", "-c", xf86Info.vtinit, (void *)NULL);
+ xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n",
+ strerror(errno));
+ exit(255);
+ break;
+ default: /* parent */
+ wait(NULL);
+ }
+ }
+}
+
+#ifdef XFree86LOADER
+/*
+ * xf86LoadModules iterates over a list that is being passed in.
+ */
+Bool
+xf86LoadModules(char **list, pointer *optlist)
+{
+ int errmaj, errmin;
+ pointer opt;
+ int i;
+ char *name;
+ Bool failed = FALSE;
+
+ if (!list)
+ return TRUE;
+
+ for (i = 0; list[i] != NULL; i++) {
+
+#ifndef NORMALISE_MODULE_NAME
+ name = xstrdup(list[i]);
+#else
+ /* Normalise the module name */
+ name = xf86NormalizeName(list[i]);
+#endif
+
+ /* Skip empty names */
+ if (name == NULL || *name == '\0')
+ continue;
+
+ if (optlist)
+ opt = optlist[i];
+ else
+ opt = NULL;
+
+ if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ failed = TRUE;
+ }
+ xfree(name);
+ }
+ return !failed;
+}
+
+#endif
+
+/* Pixmap format stuff */
- ErrorF("Configured drivers:\n");
- for (i = 0; i < xf86MaxScreens; i++)
- if (xf86Screens[i])
- (xf86Screens[i]->PrintIdent)();
+PixmapFormatPtr
+xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
+{
+ int i;
+ static PixmapFormatRec format; /* XXX not reentrant */
+
+ /*
+ * When the formats[] list initialisation isn't complete, check the
+ * depth 24 pixmap config/cmdline options and screen-specified formats.
+ */
+
+ if (!formatsDone) {
+ if (depth == 24) {
+ Pix24Flags pix24 = Pix24DontCare;
+
+ format.depth = 24;
+ format.scanlinePad = BITMAP_SCANLINE_PAD;
+ if (xf86Info.pixmap24 != Pix24DontCare)
+ pix24 = xf86Info.pixmap24;
+ else if (pScrn->pixmap24 != Pix24DontCare)
+ pix24 = pScrn->pixmap24;
+ if (pix24 == Pix24Use24)
+ format.bitsPerPixel = 24;
+ else
+ format.bitsPerPixel = 32;
+ return &format;
+ }
+ }
+
+ for (i = 0; i < numFormats; i++)
+ if (formats[i].depth == depth)
+ break;
+ if (i != numFormats)
+ return &formats[i];
+ else if (!formatsDone) {
+ /* Check for screen-specified formats */
+ for (i = 0; i < pScrn->numFormats; i++)
+ if (pScrn->formats[i].depth == depth)
+ break;
+ if (i != pScrn->numFormats)
+ return &pScrn->formats[i];
+ }
+ return NULL;
+}
+
+int
+xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
+{
+ PixmapFormatPtr format;
+
+
+ format = xf86GetPixFormat(pScrn, depth);
+ if (format)
+ return format->bitsPerPixel;
+ else
+ return 0;
}
diff --git a/hw/xfree86/common/xf86Io.c b/hw/xfree86/common/xf86Io.c
index 6fddb5e89..06819bccf 100644
--- a/hw/xfree86/common/xf86Io.c
+++ b/hw/xfree86/common/xf86Io.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.28.2.5 1998/02/24 19:05:55 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.53 2003/01/15 03:29:05 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -21,8 +21,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86Io.c,v 1.3 2000/08/17 19:50:29 cpqbld Exp $ */
-/* Patch for PS/2 Intellimouse - Tim Goodwin 1997-11-06. */
+/* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */
#define NEED_EVENTS
#include "X.h"
@@ -32,12 +31,16 @@
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
-#include "xf86_Config.h"
+#include "mipointer.h"
#ifdef XINPUT
#include "xf86Xinput.h"
+#include "XIproto.h"
+#include "exevents.h"
#endif
#ifdef XKB
@@ -46,18 +49,12 @@
#include <X11/extensions/XKBsrv.h>
#endif
-extern KeybdCtrl defaultKeyboardControl;
-
unsigned int xf86InitialCaps = 0;
unsigned int xf86InitialNum = 0;
unsigned int xf86InitialScroll = 0;
#include "atKeynames.h"
-extern int miPointerGetMotionEvents(DeviceIntPtr pPtr, xTimecoord *coords,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
-
/*
* xf86KbdBell --
* Ring the terminal/keyboard bell for an amount of time proportional to
@@ -74,50 +71,58 @@ xf86KbdBell(percent, pKeyboard, ctrl, unused)
xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration);
}
-#ifdef AMOEBA
-#define LED_CAP IOP_LED_CAP
-#define LED_NUM IOP_LED_NUM
-#define LED_SCR IOP_LED_SCROLL
-#endif
-
-#ifdef MINIX
-#define LED_CAP KBD_LEDS_CAPS
-#define LED_NUM KBD_LEDS_NUM
-#define LED_SCR KBD_LEDS_SCROLL
-#endif
+void
+xf86UpdateKbdLeds()
+{
+ int leds = 0;
+ if (xf86Info.capsLock) leds |= XLED1;
+ if (xf86Info.numLock) leds |= XLED2;
+ if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3;
+ if (xf86Info.composeLock) leds |= XLED4;
+ xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds);
+ xf86KbdLeds();
+}
void
xf86KbdLeds ()
{
- int leds = 0;
-#ifdef XKB
- if (!noXkbExtension) {
- XkbEventCauseRec cause;
- XkbSetCauseUnknown(&cause);
- XkbUpdateIndicators((DeviceIntPtr)xf86Info.pKeyboard,
- XkbAllIndicatorsMask, False, NULL, &cause);
- return;
+ int leds, real_leds = 0;
+
+#if defined (__sparc__)
+ static int kbdSun = -1;
+ if (kbdSun == -1) {
+ if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) ||
+ (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
+ kbdSun = 1;
+ else
+ kbdSun = 0;
}
-#endif
-#ifdef LED_CAP
- if (xf86Info.capsLock && !(xf86Info.xleds & XLED1))
- leds |= LED_CAP;
-
- if (xf86Info.numLock && !(xf86Info.xleds & XLED2))
- leds |= LED_NUM;
-
- if ((xf86Info.scrollLock ||
- xf86Info.modeSwitchLock ||
- xf86Info.composeLock) &&
- !(xf86Info.xleds & XLED3))
- leds |= LED_SCR;
-
- if ((xf86Info.leds & xf86Info.xleds) & XLED1) leds |= LED_CAP;
- if ((xf86Info.leds & xf86Info.xleds) & XLED2) leds |= LED_NUM;
- if ((xf86Info.leds & xf86Info.xleds) & XLED3) leds |= LED_SCR;
+ if (kbdSun) {
+ if (xf86Info.leds & 0x08) real_leds |= XLED1;
+ if (xf86Info.leds & 0x04) real_leds |= XLED3;
+ if (xf86Info.leds & 0x02) real_leds |= XLED4;
+ if (xf86Info.leds & 0x01) real_leds |= XLED2;
+ leds = real_leds;
+ real_leds = 0;
+ } else {
+ leds = xf86Info.leds;
+ }
+#else
+ leds = xf86Info.leds;
+#endif /* defined (__sparc__) */
- xf86SetKbdLeds(leds);
-#endif /* LED_CAP */
+#ifdef LED_CAP
+ if (leds & XLED1) real_leds |= LED_CAP;
+ if (leds & XLED2) real_leds |= LED_NUM;
+ if (leds & XLED3) real_leds |= LED_SCR;
+#ifdef LED_COMP
+ if (leds & XLED4) real_leds |= LED_COMP;
+#else
+ if (leds & XLED4) real_leds |= LED_SCR;
+#endif
+#endif
+ xf86SetKbdLeds(real_leds);
+ return;
}
/*
@@ -131,19 +136,30 @@ xf86KbdCtrl (pKeyboard, ctrl)
DevicePtr pKeyboard; /* Keyboard to alter */
KeybdCtrl *ctrl;
{
+ int leds;
xf86Info.bell_pitch = ctrl->bell_pitch;
xf86Info.bell_duration = ctrl->bell_duration;
xf86Info.autoRepeat = ctrl->autoRepeat;
- xf86Info.leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE;
+ leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds);
+#ifdef XKB
+ } else {
+ xf86Info.leds = leds;
+ }
+#endif
+
xf86KbdLeds();
}
/*
* xf86InitKBD --
- * Reinitialize the keyboard. Only set Lockkeys accrding to ours leds.
+ * Reinitialize the keyboard. Only set Lockkeys according to ours leds.
* Depress all other keys.
*/
@@ -158,7 +174,6 @@ Bool init;
KeyClassRec *keyc = xf86Info.pKeyboard->key;
KeySym *map = keyc->curKeySyms.map;
-#ifndef MACH386
kevent.u.keyButtonPointer.time = GetTimeInMillis();
kevent.u.keyButtonPointer.rootX = 0;
kevent.u.keyButtonPointer.rootY = 0;
@@ -192,7 +207,6 @@ Bool init;
(* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1);
}
}
-#endif /* MACH386 */
xf86Info.scanPrefix = 0;
@@ -314,7 +328,10 @@ xf86KbdProc (pKeyboard, what)
(KbdCtrlProcPtr)xf86KbdCtrl);
#ifdef XKB
} else {
- XkbComponentNamesRec names;
+ XkbComponentNamesRec names;
+ XkbDescPtr desc;
+ Bool foundTerminate = FALSE;
+ int keyc;
if (XkbInitialMap) {
if ((xf86Info.xkbkeymap = strchr(XkbInitialMap, '/')) != NULL)
xf86Info.xkbkeymap++;
@@ -343,12 +360,30 @@ xf86KbdProc (pKeyboard, what)
XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
xf86Info.xkblayout, xf86Info.xkbvariant,
xf86Info.xkboptions);
+
XkbInitKeyboardDeviceStruct(pKeyboard,
&names,
&keySyms,
modMap,
xf86KbdBell,
(KbdCtrlProcPtr)xf86KbdCtrl);
+
+ /* Search keymap for Terminate action */
+ desc = pKeyboard->key->xkbInfo->desc;
+ for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) {
+ int i;
+ for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) {
+ if (XkbKeyAction(desc, keyc, i)
+ && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) {
+ foundTerminate = TRUE;
+ goto searchdone;
+ }
+ }
+ }
+searchdone:
+ xf86Info.ActionKeyBindingsSet = foundTerminate;
+ if (!foundTerminate)
+ xf86Msg(X_INFO, "Server_Terminate keybinding not found\n");
}
#endif
@@ -367,15 +402,21 @@ xf86KbdProc (pKeyboard, what)
* passing on parts of the VT switch sequence.
*/
sleep(1);
- if (kbdFd != -1) {
- char buf[16];
- read(kbdFd, buf, 16);
+#if defined(WSCONS_SUPPORT)
+ if (xf86Info.consType != WSCONS) {
+#endif
+ if (kbdFd != -1) {
+ char buf[16];
+ read(kbdFd, buf, 16);
+ }
+#if defined(WSCONS_SUPPORT)
}
+#endif
-#ifndef __EMX__ /* Under EMX, keyboard cannot be select()'ed */
+#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */
if (kbdFd != -1)
AddEnabledDevice(kbdFd);
-#endif /* __EMX__ */
+#endif /* __UNIXOS2__ */
pKeyboard->public.on = TRUE;
xf86InitKBD(FALSE);
@@ -399,144 +440,31 @@ xf86KbdProc (pKeyboard, what)
return (Success);
}
-/*
- * xf86MseCtrl --
- * Alter the control parameters for the mouse. Note that all special
- * protocol values are handled by dix.
- */
-
-void
-xf86MseCtrl(pPointer, ctrl)
- DevicePtr pPointer;
- PtrCtrl *ctrl;
-{
- MouseDevPtr mouse = MOUSE_DEV((DeviceIntPtr) pPointer);
-
- mouse->num = ctrl->num;
- mouse->den = ctrl->den;
- mouse->threshold = ctrl->threshold;
-}
-
-/*
- * xf86MseProc --
- * Handle the initialization, etc. of a mouse
- */
-
-int
-xf86MseProc(pPointer, what)
- DeviceIntPtr pPointer;
- int what;
-{
- MouseDevPtr mouse = MOUSE_DEV(pPointer);
-
- mouse->device = pPointer;
-
- return xf86MseProcAux(pPointer, what, mouse, NULL,
- (PtrCtrlProcPtr)xf86MseCtrl);
-}
-
-int
-xf86MseProcAux(pPointer, what, mouse, fd, ctrl)
- DeviceIntPtr pPointer;
- int what;
- MouseDevPtr mouse;
- int *fd;
- PtrCtrlProcPtr ctrl;
-{
- unsigned char map[MSE_MAXBUTTONS + 1];
- int nbuttons;
- int mousefd;
-
- switch (what)
- {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- /*
- * [KAZU-241097] We don't know exactly how many buttons the
- * device has...
- */
- for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
- map[nbuttons + 1] = nbuttons + 1;
-
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- min(mouse->buttons, MSE_MAXBUTTONS),
- miPointerGetMotionEvents,
- ctrl,
- miPointerGetMotionBufferSize());
-
- xf86MouseInit(mouse);
-
- break;
-
- case DEVICE_ON:
-
- mousefd = xf86MouseOn(mouse);
-
- if (fd)
- *fd = mousefd;
-
- if (mousefd != -1) {
- if (mousefd == -2) {
- if (fd)
- *fd = -1;
- } else {
- if (mouse->mseType == P_PS2)
- write(mousefd, "\364", 1);
-
- AddEnabledDevice(mousefd);
- }
- mouse->lastButtons = 0;
- mouse->emulateState = 0;
- pPointer->public.on = TRUE;
- } else {
- return !Success;
- }
-
- break;
-
- case DEVICE_OFF:
- case DEVICE_CLOSE:
-
- mousefd = xf86MouseOff(mouse, what == DEVICE_CLOSE);
-
- if (mousefd != -1)
- RemoveEnabledDevice(mousefd);
-
- pPointer->public.on = FALSE;
- usleep(300000);
- break;
- }
- return Success;
-}
-
-/*
- * xf86MseEvents --
- * Read the new events from the device, and pass them to the eventhandler.
- * This should is not used if there is only an OS_MOUSE driver.
- */
-#ifndef OSMOUSE_ONLY
-void
-xf86MseEvents(mouse)
- MouseDevPtr mouse;
-{
- xf86MouseEvents(mouse);
-}
-#endif
-
-#if !defined(AMOEBA) && !(defined (sun) && defined(i386) && defined (SVR4)) && !defined(MINIX) && !defined(__mips__)
+#if defined(DDXTIME) && !defined(QNX4)
/*
* These are getting tossed in here until I can think of where
* they really belong
*/
+#define HALFMONTH ((unsigned long) 1<<31)
CARD32
GetTimeInMillis()
{
struct timeval tp;
+ register CARD32 val;
+ register INT32 diff;
+ static CARD32 oldval = 0;
+ static CARD32 time = 0;
gettimeofday(&tp, 0);
- return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+ val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+ if (oldval) {
+ diff = val - oldval;
+ if (diff > 0)
+ time += diff;
+ }
+ oldval = val;
+
+ return time;
}
-#endif /* !AMOEBA && !(sun || SVR4) && !MINIX */
+#endif /* DDXTIME && !QNX4 */
diff --git a/hw/xfree86/common/xf86Kbd.c b/hw/xfree86/common/xf86Kbd.c
index f263937a2..c1ad79778 100644
--- a/hw/xfree86/common/xf86Kbd.c
+++ b/hw/xfree86/common/xf86Kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.14 1997/01/05 11:58:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.24 2002/05/31 18:45:58 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -21,7 +21,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86Kbd.c,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
+/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */
#include "X.h"
#include "Xmd.h"
@@ -30,13 +30,27 @@
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
-#include "xf86_Config.h"
+#include "xf86Config.h"
#include "xf86Keymap.h"
+#if defined(KDGKBTYPE) && \
+ !defined(Lynx) && \
+ !defined(__UNIXOS2__) && !defined(__mips__) && \
+ !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__)
+#define HAS_GETKBTYPE
+#endif
+#if defined(GIO_KEYMAP) && \
+ !defined(Lynx) && \
+ !defined(__UNIXOS2__) && !defined(__mips__) && \
+ !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \
+ !defined(__QNX__)
+#define HAS_GETKEYMAP
+
#define KD_GET_ENTRY(i,n) \
eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
@@ -208,6 +222,7 @@ static KeySym eascii_to_x[512] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
};
+#endif /* HAS_GETKEYMAP */
/*
* LegalModifier --
@@ -238,14 +253,15 @@ xf86KbdGetMapping (pKeySyms, pModMap)
CARD8 *pModMap;
{
KeySym *k;
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
+#ifdef HAS_GETKEYMAP
keymap_t keymap;
-#endif /* !Lynx && !AMOEBA && !MINIX && !__OSF__ && !__EMX__ */
- char type;
- int i, j;
+#endif
+ int i;
KeySym *pMap;
+
+#ifdef HAS_GETKBTYPE
+ char type;
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
xf86Info.kbdType =
ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
if (xf86Info.kbdType == KB_84)
@@ -253,11 +269,14 @@ xf86KbdGetMapping (pKeySyms, pModMap)
else
pMap = map;
#else
+/* OS/2 sets the keyboard type during xf86OpenKbd */
+#ifndef __UNIXOS2__
xf86Info.kbdType = 0;
+#endif
pMap = map;
#endif
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
+#ifdef HAS_GETKEYMAP
/*
* use the keymap, which can be gotten from our oringinal vt??.
* ( ttymap(1) !!!! )
@@ -280,59 +299,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
}
}
-#endif /* !Lynx && !AMOEBA && !MINIX && !__OSF__ && !__EMX__ */
-
- /*
- * Apply the special key mapping specified in XF86Config
- */
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
- switch (k[0]) {
- case XK_Alt_L:
- j = K_INDEX_LEFTALT;
- break;
- case XK_Alt_R:
- j = K_INDEX_RIGHTALT;
- break;
- case XK_Scroll_Lock:
- j = K_INDEX_SCROLLLOCK;
- break;
- case XK_Control_R:
- j = K_INDEX_RIGHTCTL;
- break;
- default:
- j = -1;
- }
- if (j >= 0)
- switch (xf86Info.specialKeyMap[j]) {
- case KM_META:
- if (k[0] == XK_Alt_R)
- k[1] = XK_Meta_R;
- else {
- k[0] = XK_Alt_L;
- k[1] = XK_Meta_L;
- }
- break;
- case KM_COMPOSE:
- k[0] = XK_Multi_key;
- break;
- case KM_MODESHIFT:
- k[0] = XK_Mode_switch;
- k[1] = NoSymbol;
- break;
- case KM_MODELOCK:
- k[0] = XK_Mode_switch;
- k[1] = XF86XK_ModeLock;
- break;
- case KM_SCROLLLOCK:
- k[0] = XK_Scroll_Lock;
- break;
- case KM_CONTROL:
- k[0] = XK_Control_R;
- break;
- }
- }
+#endif
/*
* compute the modifier map
@@ -366,7 +333,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
break;
case XK_Num_Lock:
- if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
+ pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
@@ -386,22 +353,8 @@ xf86KbdGetMapping (pKeySyms, pModMap)
}
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
- xf86Info.kbdType =
- ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
-#else
-/* OS/2 sets the keyboard type during xf86OpenKbd */
-#ifndef __EMX__
- xf86Info.kbdType = 0;
-#endif
-#endif
-
-
pKeySyms->map = pMap;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
- if (xf86Info.serverNumLock)
- pKeySyms->maxKeyCode = MAX_KEYCODE;
- else
- pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
}
diff --git a/hw/xfree86/common/xf86KbdBSD.c b/hw/xfree86/common/xf86KbdBSD.c
index bf880dd68..a606b14fb 100644
--- a/hw/xfree86/common/xf86KbdBSD.c
+++ b/hw/xfree86/common/xf86KbdBSD.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.10 1996/12/23 06:43:30 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.20 2002/05/22 21:38:27 herrb Exp $ */
/*
* Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
* which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
@@ -22,7 +22,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Xorg: xf86KbdBSD.c,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
+/* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */
#include "X.h"
#include "Xmd.h"
@@ -31,22 +31,17 @@
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
-#include "xf86_Config.h"
-#include "coKeynames.h"
#include "xf86Keymap.h"
+#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP)
#define KD_GET_ENTRY(i,n) \
eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-#ifndef __bsdi__
-static KeySym coGetKeysym();
-#endif
-
-#ifndef PC98
-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 */
@@ -64,27 +59,6 @@ static unsigned char remap[128] = {
0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
};
-#else /* PC98 */
-static unsigned char remap[128] = {
- 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 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0, 0, 0, /* 0x30 - 0x37 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x38 - 0x3f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0x52, 0x53, 0x54, 0x55, 0x56, 0, /* 0x50 - 0x57 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 - 0x67 */
- 0x68, 0x69, 0x6a, 0x6b, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0x70, 0x71, 0x72, 0x73, 0x74, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-#endif /* PC98 */
-
/* This table assumes the ibm code page 437 coding for characters
* > 0x80. They are returned in this form by PCVT */
@@ -158,6 +132,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,
@@ -221,6 +263,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__
@@ -314,6 +358,7 @@ static KeySym latin1_to_x[256] = {
XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
#endif
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
/*
* LegalModifier --
* determine whether a key is a legal modifier key, i.e send a
@@ -341,8 +386,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
CARD8 *pModMap;
{
KeySym *k;
- char type;
- int i, j;
+ int i;
#ifndef __bsdi__
switch (xf86Info.consType) {
@@ -453,7 +497,10 @@ xf86KbdGetMapping (pKeySyms, pModMap)
break;
#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+/*
+ * XXX wscons has no GIO_KEYMAP
+ */
+#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP)
case SYSCONS:
case PCVT:
{
@@ -461,11 +508,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
-#ifdef PC98
- if (remap[i] || i == 0) {
-#else
if (remap[i]) {
-#endif
k = map + (remap[i] << 2);
k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
k[1] = KD_GET_ENTRY(i,1); /* shifted */
@@ -482,102 +525,10 @@ xf86KbdGetMapping (pKeySyms, pModMap)
break;
#endif /* SYSCONS || PCVT */
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- for (i=1; i<= 128; i++) {
- struct kbd_ovlkey cokeymap;
- struct oldkbd_ovlkey ocokeymap;
- KeySym coGetKeysym();
-
- if (xf86Info.consType == CODRV011) {
- ocokeymap.keynum = i;
- if (ioctl(xf86Info.consoleFd, OLDKBDGCKEY, &ocokeymap) < 0)
- break; /* Don't try again if it fails once */
- if ((ocokeymap.type & KBD_OVERLOAD)) { /* changed from default setting */
- k = map + (xf86CodrvMap[i] << 2);
- k[0] = coGetKeysym(ocokeymap.type,(CARD8*)&ocokeymap.unshift,k[0]);
- k[1] = coGetKeysym(ocokeymap.type,(CARD8*)&ocokeymap.shift,k[1]);
- k[2] = coGetKeysym(ocokeymap.type,(CARD8*)&ocokeymap.altgr,k[2]);
- k[3] = NoSymbol;
- }
- } else {
- cokeymap.keynum = i;
- if (ioctl(xf86Info.consoleFd, KBDGCKEY, &cokeymap) < 0)
- break; /* Don't try again if it fails once */
- if ((cokeymap.type & KBD_OVERLOAD)) { /* changed from default setting */
- k = map + (xf86CodrvMap[i] << 2);
- k[0] = coGetKeysym(cokeymap.type,(CARD8*)&cokeymap.unshift,k[0]);
- k[1] = coGetKeysym(cokeymap.type,(CARD8*)&cokeymap.shift,k[1]);
- k[2] = coGetKeysym(cokeymap.type,(CARD8*)&cokeymap.altgr,k[2]);
- k[3] = coGetKeysym(cokeymap.type,(CARD8*)&cokeymap.shiftaltgr,k[3]);
- }
- }
- if ((cokeymap.type & KBD_OVERLOAD)) { /* changed from default setting */
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
- break;
-#endif /* CODRV */
}
#endif /* !bsdi */
/*
- * Apply the special key mapping specified in XF86Config
- */
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
- switch (k[0]) {
- case XK_Alt_L:
- j = K_INDEX_LEFTALT;
- break;
- case XK_Alt_R:
- j = K_INDEX_RIGHTALT;
- break;
- case XK_Scroll_Lock:
- j = K_INDEX_SCROLLLOCK;
- break;
- case XK_Control_R:
- j = K_INDEX_RIGHTCTL;
- break;
- default:
- j = -1;
- }
- if (j >= 0)
- switch (xf86Info.specialKeyMap[j]) {
- case KM_META:
- if (k[0] == XK_Alt_R)
- k[1] = XK_Meta_R;
- else {
- k[0] = XK_Alt_L;
- k[1] = XK_Meta_L;
- }
- break;
- case KM_COMPOSE:
- k[0] = XK_Multi_key;
- break;
- case KM_MODESHIFT:
- k[0] = XK_Mode_switch;
- k[1] = NoSymbol;
- break;
- case KM_MODELOCK:
- k[0] = XK_Mode_switch;
- k[1] = XF86XK_ModeLock;
- break;
- case KM_SCROLLLOCK:
- k[0] = XK_Scroll_Lock;
- break;
- case KM_CONTROL:
- k[0] = XK_Control_R;
- break;
- }
- }
-
- /*
* compute the modifier map
*/
for (i = 0; i < MAP_LENGTH; i++)
@@ -609,7 +560,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
break;
case XK_Num_Lock:
- if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
+ pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
@@ -634,54 +585,649 @@ xf86KbdGetMapping (pKeySyms, pModMap)
pKeySyms->map = map;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
- if (xf86Info.serverNumLock)
- pKeySyms->maxKeyCode = MAX_KEYCODE;
- else
- pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
}
-#ifdef CODRV_SUPPORT
-/* Converts a CoDriver ASCII+Special combination into a KeySym
+#ifdef WSCONS_SUPPORT
+#include "atKeynames.h"
+
+static CARD8 wsUsbMap[] = {
+ /* 0 */ KEY_NOTUSED,
+ /* 1 */ KEY_NOTUSED,
+ /* 2 */ KEY_NOTUSED,
+ /* 3 */ KEY_NOTUSED,
+ /* 4 */ KEY_A,
+ /* 5 */ KEY_B,
+ /* 6 */ KEY_C,
+ /* 7 */ KEY_D,
+ /* 8 */ KEY_E,
+ /* 9 */ KEY_F,
+ /* 10 */ KEY_G,
+ /* 11 */ KEY_H,
+ /* 12 */ KEY_I,
+ /* 13 */ KEY_J,
+ /* 14 */ KEY_K,
+ /* 15 */ KEY_L,
+ /* 16 */ KEY_M,
+ /* 17 */ KEY_N,
+ /* 18 */ KEY_O,
+ /* 19 */ KEY_P,
+ /* 20 */ KEY_Q,
+ /* 21 */ KEY_R,
+ /* 22 */ KEY_S,
+ /* 23 */ KEY_T,
+ /* 24 */ KEY_U,
+ /* 25 */ KEY_V,
+ /* 26 */ KEY_W,
+ /* 27 */ KEY_X,
+ /* 28 */ KEY_Y,
+ /* 29 */ KEY_Z,
+ /* 30 */ KEY_1, /* 1 !*/
+ /* 31 */ KEY_2, /* 2 @ */
+ /* 32 */ KEY_3, /* 3 # */
+ /* 33 */ KEY_4, /* 4 $ */
+ /* 34 */ KEY_5, /* 5 % */
+ /* 35 */ KEY_6, /* 6 ^ */
+ /* 36 */ KEY_7, /* 7 & */
+ /* 37 */ KEY_8, /* 8 * */
+ /* 38 */ KEY_9, /* 9 ( */
+ /* 39 */ KEY_0, /* 0 ) */
+ /* 40 */ KEY_Enter, /* Return */
+ /* 41 */ KEY_Escape, /* Escape */
+ /* 42 */ KEY_BackSpace, /* Backspace Delete */
+ /* 43 */ KEY_Tab, /* Tab */
+ /* 44 */ KEY_Space, /* Space */
+ /* 45 */ KEY_Minus, /* - _ */
+ /* 46 */ KEY_Equal, /* = + */
+ /* 47 */ KEY_LBrace, /* [ { */
+ /* 48 */ KEY_RBrace, /* ] } */
+ /* 49 */ KEY_BSlash, /* \ | */
+ /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */
+ /* 51 */ KEY_SemiColon, /* ; : */
+ /* 52 */ KEY_Quote, /* ' " */
+ /* 53 */ KEY_Tilde, /* ` ~ */
+ /* 54 */ KEY_Comma, /* , < */
+ /* 55 */ KEY_Period, /* . > */
+ /* 56 */ KEY_Slash, /* / ? */
+ /* 57 */ KEY_CapsLock, /* Caps Lock */
+ /* 58 */ KEY_F1, /* F1 */
+ /* 59 */ KEY_F2, /* F2 */
+ /* 60 */ KEY_F3, /* F3 */
+ /* 61 */ KEY_F4, /* F4 */
+ /* 62 */ KEY_F5, /* F5 */
+ /* 63 */ KEY_F6, /* F6 */
+ /* 64 */ KEY_F7, /* F7 */
+ /* 65 */ KEY_F8, /* F8 */
+ /* 66 */ KEY_F9, /* F9 */
+ /* 67 */ KEY_F10, /* F10 */
+ /* 68 */ KEY_F11, /* F11 */
+ /* 69 */ KEY_F12, /* F12 */
+ /* 70 */ KEY_Print, /* PrintScrn SysReq */
+ /* 71 */ KEY_ScrollLock, /* Scroll Lock */
+ /* 72 */ KEY_Pause, /* Pause Break */
+ /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
+ /* 74 */ KEY_Home, /* Home */
+ /* 75 */ KEY_PgUp, /* Page Up */
+ /* 76 */ KEY_Delete, /* Delete */
+ /* 77 */ KEY_End, /* End */
+ /* 78 */ KEY_PgDown, /* Page Down */
+ /* 79 */ KEY_Right, /* Right Arrow */
+ /* 80 */ KEY_Left, /* Left Arrow */
+ /* 81 */ KEY_Down, /* Down Arrow */
+ /* 82 */ KEY_Up, /* Up Arrow */
+ /* 83 */ KEY_NumLock, /* Num Lock */
+ /* 84 */ KEY_KP_Divide, /* Keypad / */
+ /* 85 */ KEY_KP_Multiply, /* Keypad * */
+ /* 86 */ KEY_KP_Minus, /* Keypad - */
+ /* 87 */ KEY_KP_Plus, /* Keypad + */
+ /* 88 */ KEY_KP_Enter, /* Keypad Enter */
+ /* 89 */ KEY_KP_1, /* Keypad 1 End */
+ /* 90 */ KEY_KP_2, /* Keypad 2 Down */
+ /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
+ /* 92 */ KEY_KP_4, /* Keypad 4 Left */
+ /* 93 */ KEY_KP_5, /* Keypad 5 */
+ /* 94 */ KEY_KP_6, /* Keypad 6 */
+ /* 95 */ KEY_KP_7, /* Keypad 7 Home */
+ /* 96 */ KEY_KP_8, /* Keypad 8 Up */
+ /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
+ /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
+ /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
+ /* 100 */ KEY_Less, /* < > on some keyboards */
+ /* 101 */ KEY_Menu, /* Menu */
+ /* 102 */ KEY_NOTUSED,
+ /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
+ /* 104 */ KEY_NOTUSED,
+ /* 105 */ KEY_NOTUSED,
+ /* 106 */ KEY_NOTUSED,
+ /* 107 */ KEY_NOTUSED,
+ /* 108 */ KEY_NOTUSED,
+ /* 109 */ KEY_NOTUSED,
+ /* 110 */ KEY_NOTUSED,
+ /* 111 */ KEY_NOTUSED,
+ /* 112 */ KEY_NOTUSED,
+ /* 113 */ KEY_NOTUSED,
+ /* 114 */ KEY_NOTUSED,
+ /* 115 */ KEY_NOTUSED,
+ /* 116 */ KEY_NOTUSED,
+ /* 117 */ KEY_NOTUSED,
+ /* 118 */ KEY_NOTUSED,
+ /* 119 */ KEY_NOTUSED,
+ /* 120 */ KEY_NOTUSED,
+ /* 121 */ KEY_NOTUSED,
+ /* 122 */ KEY_NOTUSED,
+ /* 123 */ KEY_NOTUSED,
+ /* 124 */ KEY_NOTUSED,
+ /* 125 */ KEY_NOTUSED,
+ /* 126 */ KEY_NOTUSED,
+ /* 127 */ KEY_NOTUSED,
+ /* 128 */ KEY_NOTUSED,
+ /* 129 */ KEY_NOTUSED,
+ /* 130 */ KEY_NOTUSED,
+ /* 131 */ KEY_NOTUSED,
+ /* 132 */ KEY_NOTUSED,
+ /* 133 */ KEY_NOTUSED,
+ /* 134 */ KEY_NOTUSED,
+ /* 135 */ KEY_NOTUSED,
+ /* 136 */ KEY_NOTUSED,
+ /* 137 */ KEY_NOTUSED,
+ /* 138 */ KEY_NOTUSED,
+ /* 139 */ KEY_NOTUSED,
+ /* 140 */ KEY_NOTUSED,
+ /* 141 */ KEY_NOTUSED,
+ /* 142 */ KEY_NOTUSED,
+ /* 143 */ KEY_NOTUSED,
+ /* 144 */ KEY_NOTUSED,
+ /* 145 */ KEY_NOTUSED,
+ /* 146 */ KEY_NOTUSED,
+ /* 147 */ KEY_NOTUSED,
+ /* 148 */ KEY_NOTUSED,
+ /* 149 */ KEY_NOTUSED,
+ /* 150 */ KEY_NOTUSED,
+ /* 151 */ KEY_NOTUSED,
+ /* 152 */ KEY_NOTUSED,
+ /* 153 */ KEY_NOTUSED,
+ /* 154 */ KEY_NOTUSED,
+ /* 155 */ KEY_NOTUSED,
+ /* 156 */ KEY_NOTUSED,
+ /* 157 */ KEY_NOTUSED,
+ /* 158 */ KEY_NOTUSED,
+ /* 159 */ KEY_NOTUSED,
+ /* 160 */ KEY_NOTUSED,
+ /* 161 */ KEY_NOTUSED,
+ /* 162 */ KEY_NOTUSED,
+ /* 163 */ KEY_NOTUSED,
+ /* 164 */ KEY_NOTUSED,
+ /* 165 */ KEY_NOTUSED,
+ /* 166 */ KEY_NOTUSED,
+ /* 167 */ KEY_NOTUSED,
+ /* 168 */ KEY_NOTUSED,
+ /* 169 */ KEY_NOTUSED,
+ /* 170 */ KEY_NOTUSED,
+ /* 171 */ KEY_NOTUSED,
+ /* 172 */ KEY_NOTUSED,
+ /* 173 */ KEY_NOTUSED,
+ /* 174 */ KEY_NOTUSED,
+ /* 175 */ KEY_NOTUSED,
+ /* 176 */ KEY_NOTUSED,
+ /* 177 */ KEY_NOTUSED,
+ /* 178 */ KEY_NOTUSED,
+ /* 179 */ KEY_NOTUSED,
+ /* 180 */ KEY_NOTUSED,
+ /* 181 */ KEY_NOTUSED,
+ /* 182 */ KEY_NOTUSED,
+ /* 183 */ KEY_NOTUSED,
+ /* 184 */ KEY_NOTUSED,
+ /* 185 */ KEY_NOTUSED,
+ /* 186 */ KEY_NOTUSED,
+ /* 187 */ KEY_NOTUSED,
+ /* 188 */ KEY_NOTUSED,
+ /* 189 */ KEY_NOTUSED,
+ /* 190 */ KEY_NOTUSED,
+ /* 191 */ KEY_NOTUSED,
+ /* 192 */ KEY_NOTUSED,
+ /* 193 */ KEY_NOTUSED,
+ /* 194 */ KEY_NOTUSED,
+ /* 195 */ KEY_NOTUSED,
+ /* 196 */ KEY_NOTUSED,
+ /* 197 */ KEY_NOTUSED,
+ /* 198 */ KEY_NOTUSED,
+ /* 199 */ KEY_NOTUSED,
+ /* 200 */ KEY_NOTUSED,
+ /* 201 */ KEY_NOTUSED,
+ /* 202 */ KEY_NOTUSED,
+ /* 203 */ KEY_NOTUSED,
+ /* 204 */ KEY_NOTUSED,
+ /* 205 */ KEY_NOTUSED,
+ /* 206 */ KEY_NOTUSED,
+ /* 207 */ KEY_NOTUSED,
+ /* 208 */ KEY_NOTUSED,
+ /* 209 */ KEY_NOTUSED,
+ /* 210 */ KEY_NOTUSED,
+ /* 211 */ KEY_NOTUSED,
+ /* 212 */ KEY_NOTUSED,
+ /* 213 */ KEY_NOTUSED,
+ /* 214 */ KEY_NOTUSED,
+ /* 215 */ KEY_NOTUSED,
+ /* 216 */ KEY_NOTUSED,
+ /* 217 */ KEY_NOTUSED,
+ /* 218 */ KEY_NOTUSED,
+ /* 219 */ KEY_NOTUSED,
+ /* 220 */ KEY_NOTUSED,
+ /* 221 */ KEY_NOTUSED,
+ /* 222 */ KEY_NOTUSED,
+ /* 223 */ KEY_NOTUSED,
+ /* 224 */ KEY_LCtrl, /* Left Control */
+ /* 225 */ KEY_ShiftL, /* Left Shift */
+ /* 226 */ KEY_Alt, /* Left Alt */
+ /* 227 */ KEY_LMeta, /* Left Meta */
+ /* 228 */ KEY_RCtrl, /* Right Control */
+ /* 229 */ KEY_ShiftR, /* Right Shift */
+ /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
+ /* 231 */ KEY_LMeta, /* Right Meta XXX */
+};
+
+#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
+
+/* Map for adb keyboards */
+static CARD8 wsAdbMap[] = {
+ /* 0 */ KEY_A,
+ /* 1 */ KEY_S,
+ /* 2 */ KEY_D,
+ /* 3 */ KEY_F,
+ /* 4 */ KEY_H,
+ /* 5 */ KEY_G,
+ /* 6 */ KEY_Z,
+ /* 7 */ KEY_X,
+ /* 8 */ KEY_C,
+ /* 9 */ KEY_V,
+ /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */
+ /* 11 */ KEY_B,
+ /* 12 */ KEY_Q,
+ /* 13 */ KEY_W,
+ /* 14 */ KEY_E,
+ /* 15 */ KEY_R,
+ /* 16 */ KEY_Y,
+ /* 17 */ KEY_T,
+ /* 18 */ KEY_1,
+ /* 19 */ KEY_2,
+ /* 20 */ KEY_3,
+ /* 21 */ KEY_4,
+ /* 22 */ KEY_6,
+ /* 23 */ KEY_5,
+ /* 24 */ KEY_Equal,
+ /* 25 */ KEY_9,
+ /* 26 */ KEY_7,
+ /* 27 */ KEY_Minus,
+ /* 28 */ KEY_8,
+ /* 29 */ KEY_0,
+ /* 30 */ KEY_RBrace,
+ /* 31 */ KEY_O,
+ /* 32 */ KEY_U,
+ /* 33 */ KEY_LBrace,
+ /* 34 */ KEY_I,
+ /* 35 */ KEY_P,
+ /* 36 */ KEY_Enter,
+ /* 37 */ KEY_L,
+ /* 38 */ KEY_J,
+ /* 39 */ KEY_Quote,
+ /* 40 */ KEY_K,
+ /* 41 */ KEY_SemiColon,
+ /* 42 */ KEY_BSlash,
+ /* 43 */ KEY_Comma,
+ /* 44 */ KEY_Slash,
+ /* 45 */ KEY_N,
+ /* 46 */ KEY_M,
+ /* 47 */ KEY_Period,
+ /* 48 */ KEY_Tab,
+ /* 49 */ KEY_Space,
+ /* 50 */ KEY_Tilde,
+ /* 51 */ KEY_Delete,
+ /* 52 */ KEY_AltLang,
+ /* 53 */ KEY_Escape,
+ /* 54 */ KEY_LCtrl,
+ /* 55 */ KEY_Alt,
+ /* 56 */ KEY_ShiftL,
+ /* 57 */ KEY_CapsLock,
+ /* 58 */ KEY_LMeta,
+ /* 59 */ KEY_Left,
+ /* 60 */ KEY_Right,
+ /* 61 */ KEY_Down,
+ /* 62 */ KEY_Up,
+ /* 63 */ KEY_UNKNOWN, /* Fn */
+ /* 64 */ KEY_NOTUSED,
+ /* 65 */ KEY_KP_Decimal,
+ /* 66 */ KEY_NOTUSED,
+ /* 67 */ KEY_KP_Multiply,
+ /* 68 */ KEY_NOTUSED,
+ /* 69 */ KEY_KP_Plus,
+ /* 70 */ KEY_NOTUSED,
+ /* 71 */ KEY_UNKNOWN, /* Clear */
+ /* 72 */ KEY_NOTUSED,
+ /* 73 */ KEY_NOTUSED,
+ /* 74 */ KEY_NOTUSED,
+ /* 75 */ KEY_KP_Divide,
+ /* 76 */ KEY_KP_Enter,
+ /* 77 */ KEY_NOTUSED,
+ /* 78 */ KEY_KP_Minus,
+ /* 79 */ KEY_NOTUSED,
+ /* 80 */ KEY_NOTUSED,
+ /* 81 */ KEY_KP_Equal, /* Keypad = */
+ /* 82 */ KEY_KP_0,
+ /* 83 */ KEY_KP_1,
+ /* 84 */ KEY_KP_2,
+ /* 85 */ KEY_KP_3,
+ /* 86 */ KEY_KP_4,
+ /* 87 */ KEY_KP_5,
+ /* 88 */ KEY_KP_6,
+ /* 89 */ KEY_KP_7,
+ /* 90 */ KEY_NOTUSED,
+ /* 91 */ KEY_KP_8,
+ /* 92 */ KEY_KP_9,
+ /* 93 */ KEY_NOTUSED,
+ /* 94 */ KEY_NOTUSED,
+ /* 95 */ KEY_UNKNOWN, /* Keypad , */
+ /* 96 */ KEY_F5,
+ /* 97 */ KEY_F6,
+ /* 98 */ KEY_F7,
+ /* 99 */ KEY_F3,
+ /* 100 */ KEY_F8,
+ /* 101 */ KEY_F9,
+ /* 102 */ KEY_NOTUSED,
+ /* 103 */ KEY_F11,
+ /* 104 */ KEY_NOTUSED,
+ /* 105 */ KEY_NOTUSED,
+ /* 106 */ KEY_KP_Enter,
+ /* 107 */ KEY_NOTUSED,
+ /* 108 */ KEY_NOTUSED,
+ /* 109 */ KEY_F10,
+ /* 110 */ KEY_NOTUSED,
+ /* 111 */ KEY_F12,
+ /* 112 */ KEY_NOTUSED,
+ /* 113 */ KEY_NOTUSED,
+ /* 114 */ KEY_NOTUSED,
+ /* 115 */ KEY_Home,
+ /* 116 */ KEY_PgUp,
+ /* 117 */ KEY_NOTUSED,
+ /* 118 */ KEY_F4,
+ /* 119 */ KEY_End,
+ /* 120 */ KEY_F2,
+ /* 121 */ KEY_PgDown,
+ /* 122 */ KEY_F1,
+ /* 123 */ KEY_NOTUSED,
+ /* 124 */ KEY_NOTUSED,
+ /* 125 */ KEY_NOTUSED,
+ /* 126 */ KEY_NOTUSED,
+ /* 127 */ KEY_NOTUSED,
+ /* 128 */ KEY_NOTUSED,
+ /* 129 */ KEY_NOTUSED,
+ /* 130 */ KEY_NOTUSED,
+ /* 131 */ KEY_NOTUSED,
+ /* 132 */ KEY_NOTUSED,
+ /* 133 */ KEY_NOTUSED,
+ /* 134 */ KEY_NOTUSED,
+ /* 135 */ KEY_NOTUSED,
+ /* 136 */ KEY_NOTUSED,
+ /* 137 */ KEY_NOTUSED,
+ /* 138 */ KEY_NOTUSED,
+ /* 139 */ KEY_NOTUSED,
+ /* 140 */ KEY_NOTUSED,
+ /* 141 */ KEY_NOTUSED,
+ /* 142 */ KEY_NOTUSED,
+ /* 143 */ KEY_NOTUSED,
+ /* 144 */ KEY_NOTUSED,
+ /* 145 */ KEY_NOTUSED,
+ /* 146 */ KEY_NOTUSED,
+ /* 147 */ KEY_NOTUSED,
+ /* 148 */ KEY_NOTUSED,
+ /* 149 */ KEY_NOTUSED,
+ /* 150 */ KEY_NOTUSED,
+ /* 151 */ KEY_NOTUSED,
+ /* 152 */ KEY_NOTUSED,
+ /* 153 */ KEY_NOTUSED,
+ /* 154 */ KEY_NOTUSED,
+ /* 155 */ KEY_NOTUSED,
+ /* 156 */ KEY_NOTUSED,
+ /* 157 */ KEY_NOTUSED,
+ /* 158 */ KEY_NOTUSED,
+ /* 159 */ KEY_NOTUSED,
+ /* 160 */ KEY_NOTUSED,
+ /* 161 */ KEY_NOTUSED,
+ /* 162 */ KEY_NOTUSED,
+ /* 163 */ KEY_NOTUSED,
+ /* 164 */ KEY_NOTUSED,
+ /* 165 */ KEY_NOTUSED,
+ /* 166 */ KEY_NOTUSED,
+ /* 167 */ KEY_NOTUSED,
+ /* 168 */ KEY_NOTUSED,
+ /* 169 */ KEY_NOTUSED,
+ /* 170 */ KEY_NOTUSED,
+ /* 171 */ KEY_NOTUSED,
+ /* 172 */ KEY_NOTUSED,
+ /* 173 */ KEY_NOTUSED,
+ /* 174 */ KEY_NOTUSED,
+ /* 175 */ KEY_NOTUSED,
+ /* 176 */ KEY_NOTUSED,
+ /* 177 */ KEY_NOTUSED,
+ /* 178 */ KEY_NOTUSED,
+ /* 179 */ KEY_NOTUSED,
+ /* 180 */ KEY_NOTUSED,
+ /* 181 */ KEY_NOTUSED,
+ /* 182 */ KEY_NOTUSED,
+ /* 183 */ KEY_NOTUSED,
+ /* 184 */ KEY_NOTUSED,
+ /* 185 */ KEY_NOTUSED,
+ /* 186 */ KEY_NOTUSED,
+ /* 187 */ KEY_NOTUSED,
+ /* 188 */ KEY_NOTUSED,
+ /* 189 */ KEY_NOTUSED,
+ /* 190 */ KEY_NOTUSED,
+ /* 191 */ KEY_NOTUSED,
+ /* 192 */ KEY_NOTUSED,
+ /* 193 */ KEY_NOTUSED,
+ /* 194 */ KEY_NOTUSED,
+ /* 195 */ KEY_NOTUSED,
+ /* 196 */ KEY_NOTUSED,
+ /* 197 */ KEY_NOTUSED,
+ /* 198 */ KEY_NOTUSED,
+ /* 199 */ KEY_NOTUSED,
+ /* 200 */ KEY_NOTUSED,
+ /* 201 */ KEY_NOTUSED,
+ /* 202 */ KEY_NOTUSED,
+ /* 203 */ KEY_NOTUSED,
+ /* 204 */ KEY_NOTUSED,
+ /* 205 */ KEY_NOTUSED,
+ /* 206 */ KEY_NOTUSED,
+ /* 207 */ KEY_NOTUSED,
+ /* 208 */ KEY_NOTUSED,
+ /* 209 */ KEY_NOTUSED,
+ /* 210 */ KEY_NOTUSED,
+ /* 211 */ KEY_NOTUSED,
+ /* 212 */ KEY_NOTUSED,
+ /* 213 */ KEY_NOTUSED,
+ /* 214 */ KEY_NOTUSED,
+ /* 215 */ KEY_NOTUSED,
+ /* 216 */ KEY_NOTUSED,
+ /* 217 */ KEY_NOTUSED,
+ /* 218 */ KEY_NOTUSED,
+ /* 219 */ KEY_NOTUSED,
+ /* 220 */ KEY_NOTUSED,
+ /* 221 */ KEY_NOTUSED,
+ /* 222 */ KEY_NOTUSED,
+ /* 223 */ KEY_NOTUSED,
+};
+
+static CARD8 wsSunMap[] = {
+ /* 0x00 */ KEY_NOTUSED,
+ /* 0x01 */ KEY_NOTUSED, /* stop */
+ /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */
+ /* 0x03 */ KEY_NOTUSED, /* again */
+ /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */
+ /* 0x05 */ KEY_F1,
+ /* 0x06 */ KEY_F2,
+ /* 0x07 */ KEY_F10,
+ /* 0x08 */ KEY_F3,
+ /* 0x09 */ KEY_F11,
+ /* 0x0a */ KEY_F4,
+ /* 0x0b */ KEY_F12,
+ /* 0x0c */ KEY_F5,
+ /* 0x0d */ KEY_AltLang,
+ /* 0x0e */ KEY_F6,
+ /* 0x0f */ KEY_NOTUSED,
+ /* 0x10 */ KEY_F7,
+ /* 0x11 */ KEY_F8,
+ /* 0x12 */ KEY_F9,
+ /* 0x13 */ KEY_Alt,
+ /* 0x14 */ KEY_Up,
+ /* 0x15 */ KEY_Pause,
+ /* 0x16 */ KEY_Print,
+ /* 0x17 */ KEY_NOTUSED, /* props */
+ /* 0x18 */ KEY_Left,
+ /* 0x19 */ KEY_ScrollLock,
+ /* 0x1a */ KEY_NOTUSED, /* undo */
+ /* 0x1b */ KEY_Down,
+ /* 0x1c */ KEY_Right,
+ /* 0x1d */ KEY_Escape,
+ /* 0x1e */ KEY_1,
+ /* 0x1f */ KEY_2,
+ /* 0x20 */ KEY_3,
+ /* 0x21 */ KEY_4,
+ /* 0x22 */ KEY_5,
+ /* 0x23 */ KEY_6,
+ /* 0x24 */ KEY_7,
+ /* 0x25 */ KEY_8,
+ /* 0x26 */ KEY_9,
+ /* 0x27 */ KEY_0,
+ /* 0x28 */ KEY_Minus,
+ /* 0x29 */ KEY_Equal,
+ /* 0x2a */ KEY_Tilde,
+ /* 0x2b */ KEY_BackSpace,
+ /* 0x2c */ KEY_Insert,
+ /* 0x2d */ KEY_KP_Equal,
+ /* 0x2e */ KEY_KP_Divide,
+ /* 0x2f */ KEY_KP_Multiply,
+ /* 0x30 */ KEY_NOTUSED,
+ /* 0x31 */ KEY_NOTUSED, /* front */
+ /* 0x32 */ KEY_KP_Decimal,
+ /* 0x33 */ KEY_NOTUSED, /* copy */
+ /* 0x34 */ KEY_Home,
+ /* 0x35 */ KEY_Tab,
+ /* 0x36 */ KEY_Q,
+ /* 0x37 */ KEY_W,
+ /* 0x38 */ KEY_E,
+ /* 0x39 */ KEY_R,
+ /* 0x3a */ KEY_T,
+ /* 0x3b */ KEY_Y,
+ /* 0x3c */ KEY_U,
+ /* 0x3d */ KEY_I,
+ /* 0x3e */ KEY_O,
+ /* 0x3f */ KEY_P,
+ /* 0x40 */ KEY_LBrace,
+ /* 0x41 */ KEY_RBrace,
+ /* 0x42 */ KEY_Delete,
+ /* 0x43 */ KEY_NOTUSED, /* compose */
+ /* 0x44 */ KEY_KP_7,
+ /* 0x45 */ KEY_KP_8,
+ /* 0x46 */ KEY_KP_9,
+ /* 0x47 */ KEY_KP_Minus,
+ /* 0x48 */ KEY_NOTUSED, /* open */
+ /* 0x49 */ KEY_NOTUSED, /* paste */
+ /* 0x4a */ KEY_End,
+ /* 0x4b */ KEY_NOTUSED,
+ /* 0x4c */ KEY_LCtrl,
+ /* 0x4d */ KEY_A,
+ /* 0x4e */ KEY_S,
+ /* 0x4f */ KEY_D,
+ /* 0x50 */ KEY_F,
+ /* 0x51 */ KEY_G,
+ /* 0x52 */ KEY_H,
+ /* 0x53 */ KEY_J,
+ /* 0x54 */ KEY_K,
+ /* 0x55 */ KEY_L,
+ /* 0x56 */ KEY_SemiColon,
+ /* 0x57 */ KEY_Quote,
+ /* 0x58 */ KEY_BSlash,
+ /* 0x59 */ KEY_Enter,
+ /* 0x5a */ KEY_KP_Enter,
+ /* 0x5b */ KEY_KP_4,
+ /* 0x5c */ KEY_KP_5,
+ /* 0x5d */ KEY_KP_6,
+ /* 0x5e */ KEY_KP_0,
+ /* 0x5f */ KEY_NOTUSED, /* find */
+ /* 0x60 */ KEY_PgUp,
+ /* 0x61 */ KEY_NOTUSED, /* cut */
+ /* 0x62 */ KEY_NumLock,
+ /* 0x63 */ KEY_ShiftL,
+ /* 0x64 */ KEY_Z,
+ /* 0x65 */ KEY_X,
+ /* 0x66 */ KEY_C,
+ /* 0x67 */ KEY_V,
+ /* 0x68 */ KEY_B,
+ /* 0x69 */ KEY_N,
+ /* 0x6a */ KEY_M,
+ /* 0x6b */ KEY_Comma,
+ /* 0x6c */ KEY_Period,
+ /* 0x6d */ KEY_Slash,
+ /* 0x6e */ KEY_ShiftR,
+ /* 0x6f */ KEY_NOTUSED, /* linefeed */
+ /* 0x70 */ KEY_KP_1,
+ /* 0x71 */ KEY_KP_2,
+ /* 0x72 */ KEY_KP_3,
+ /* 0x73 */ KEY_NOTUSED,
+ /* 0x74 */ KEY_NOTUSED,
+ /* 0x75 */ KEY_NOTUSED,
+ /* 0x76 */ KEY_NOTUSED, /* help */
+ /* 0x77 */ KEY_CapsLock,
+ /* 0x78 */ KEY_LMeta,
+ /* 0x79 */ KEY_Space,
+ /* 0x7a */ KEY_RMeta,
+ /* 0x7b */ KEY_PgDown,
+ /* 0x7c */ KEY_NOTUSED,
+ /* 0x7d */ KEY_KP_Plus,
+ /* 0x7e */ KEY_NOTUSED,
+ /* 0x7f */ KEY_NOTUSED
+};
+
+#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
+
+
+#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
+
+/*
+ * Translate raw wskbd keyboard event values to XFree86 standard keycodes
+ * (based on the AT keyboard scan codes using the tables above
*/
-static KeySym
-coGetKeysym(typ,str,old)
- int typ;
- CARD8 *str;
- KeySym old;
+int
+WSKbdToKeycode(int keycode)
{
- if (strlen((char *)str) > 1) return old;
- switch (typ & KBD_MASK) {
- case KBD_NONE:
- return NoSymbol;
- case KBD_SHIFT:
- if (old==XK_Shift_L || old==XK_Shift_R) return old;
- else return XK_Shift_L;
- case KBD_NUM:
- return XK_Num_Lock;
- case KBD_CTL:
- if (old==XK_Control_L || old==XK_Control_R) return old;
- else return XK_Control_L;
- case KBD_ALTGR:
- return XK_Mode_switch;
- case KBD_META:
- if (old==XK_Alt_L || old==XK_Alt_R) return old;
- else return XK_Alt_L;
- case KBD_SHFTLOCK:
- case KBD_CAPS:
- return XK_Caps_Lock;
- case KBD_SCROLL:
- return XK_Scroll_Lock;
- case KBD_BREAK:
- return XK_Break;
+ switch (xf86Info.wsKbdType) {
+ case WSKBD_TYPE_PC_XT:
+ case WSKBD_TYPE_PC_AT:
+ /* No translation needed */
+ return keycode;
+ case WSKBD_TYPE_USB:
+ if (keycode < 0 || keycode >= WS_USB_MAP_SIZE)
+ return KEY_UNKNOWN;
+ else
+ return wsUsbMap[keycode];
+#ifdef WSKBD_TYPE_ADB
+ case WSKBD_TYPE_ADB:
+ if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE)
+ return KEY_UNKNOWN;
+ else
+ return wsAdbMap[keycode];
+#endif
+#ifdef WSKBD_TYPE_SUN
+ case WSKBD_TYPE_SUN:
+ if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE)
+ return KEY_UNKNOWN;
+ else
+ return wsSunMap[keycode];
+#endif
default:
- case KBD_KP: /* there are few good reasons to overload
- * F Keys and KP Keys, so we ignore any attempt
- * at all
- */
- return old;
- case KBD_ASCII:
- return *str;
+ ErrorF("Unknown wskbd type %d\n", xf86Info.wsKbdType);
+ return KEY_UNKNOWN;
}
}
-#endif
+
+#endif /* WSCONS_SUPPORT */
diff --git a/hw/xfree86/common/xf86KbdLnx.c b/hw/xfree86/common/xf86KbdLnx.c
index 094044b30..1f97c0b15 100644
--- a/hw/xfree86/common/xf86KbdLnx.c
+++ b/hw/xfree86/common/xf86KbdLnx.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.12 1996/12/23 06:43:31 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
@@ -28,7 +28,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86KbdLnx.c,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
+/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */
#include "X.h"
#include "Xmd.h"
@@ -37,10 +37,10 @@
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
-#include "xf86_Config.h"
#include "xf86Keymap.h"
#include "DECkeysym.h"
@@ -71,63 +71,11 @@ xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
{
KeySym *k;
char type;
- int i, j;
+ int i;
readKernelMapping(pKeySyms, pModMap);
/*
- * Apply the special key mapping specified in XF86Config
- */
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
- switch (k[0]) {
- case XK_Alt_L:
- j = K_INDEX_LEFTALT;
- break;
- case XK_Alt_R:
- j = K_INDEX_RIGHTALT;
- break;
- case XK_Scroll_Lock:
- j = K_INDEX_SCROLLLOCK;
- break;
- case XK_Control_R:
- j = K_INDEX_RIGHTCTL;
- break;
- default:
- j = -1;
- }
- if (j >= 0)
- switch (xf86Info.specialKeyMap[j]) {
- case KM_META:
- if (k[0] == XK_Alt_R)
- k[1] = XK_Meta_R;
- else {
- k[0] = XK_Alt_L;
- k[1] = XK_Meta_L;
- }
- break;
- case KM_COMPOSE:
- k[0] = XK_Multi_key;
- break;
- case KM_MODESHIFT:
- k[0] = XK_Mode_switch;
- k[1] = NoSymbol;
- break;
- case KM_MODELOCK:
- k[0] = XK_Mode_switch;
- k[1] = XF86XK_ModeLock;
- break;
- case KM_SCROLLLOCK:
- k[0] = XK_Scroll_Lock;
- break;
- case KM_CONTROL:
- k[0] = XK_Control_R;
- break;
- }
- }
-
- /*
* compute the modifier map
*/
for (i = 0; i < MAP_LENGTH; i++)
@@ -159,7 +107,7 @@ xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
break;
case XK_Num_Lock:
- if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
+ pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
@@ -185,11 +133,7 @@ xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
pKeySyms->map = map;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
- if (xf86Info.serverNumLock)
- pKeySyms->maxKeyCode = MAX_KEYCODE;
- else
- pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
-
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
}
#include <linux/keyboard.h>
@@ -226,7 +170,7 @@ static KeySym linux_to_x[256] = {
XK_p, XK_q, XK_r, XK_s,
XK_t, XK_u, XK_v, XK_w,
XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
@@ -261,12 +205,10 @@ 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
*/
-static unsigned char at2lnx[] =
+static unsigned char at2lnx[NUM_KEYCODES] =
{
0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
0x03, /* KEY_2 */ 0x04, /* KEY_3 */
@@ -332,34 +274,19 @@ static unsigned char at2lnx[] =
0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
0x00, /* 0x7f */
- /* the following are for ServerNumLock handling */
- 0x47, /* KEY_SN_KP_7 */ 0x48, /* KEY_SN_KP_8 */
- 0x49, /* KEY_SN_KP_9 */ 0x4b, /* KEY_SN_KP_4 */
- 0x4c, /* KEY_SN_KP_5 */ 0x4d, /* KEY_SN_KP_6 */
- 0x4f, /* KEY_SN_KP_1 */ 0x50, /* KEY_SN_KP_2 */
- 0x51, /* KEY_SN_KP_3 */ 0x52, /* KEY_SN_KP_0 */
- 0x53, /* KEY_SN_KP_Decimal */ 0x66, /* KEY_SN_Home */
- 0x67, /* KEY_SN_Up */ 0x68, /* KEY_SN_Prior */
- 0x69, /* KEY_SN_Left */ 0x5d, /* KEY_SN_Begin */
- 0x6a, /* KEY_SN_Right */ 0x6b, /* KEY_SN_End */
- 0x6c, /* KEY_SN_Down */ 0x6d, /* KEY_SN_Next */
- 0x6e, /* KEY_SN_Ins */ 0x6f /* KEY_SN_Del */
};
#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
-#else /* !ASSUME_CUSTOM_KEYCODES */
-
-#define NUM_AT2LNX NR_KEYS
+#define NUM_CUSTOMKEYS NR_KEYS
-u_char SpecialServerMap[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 */
@@ -377,30 +304,27 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
* First, figure out which tables to use for the modeswitch columns
* above, from the XF86Config fields.
*/
- if (xf86Info.specialKeyMap[K_INDEX_RIGHTCTL] == KM_MODESHIFT ||
- xf86Info.specialKeyMap[K_INDEX_RIGHTCTL] == KM_MODELOCK)
- tbl[2] = 4; /* control */
- else if (xf86Info.specialKeyMap[K_INDEX_RIGHTALT] == KM_MODESHIFT ||
- xf86Info.specialKeyMap[K_INDEX_RIGHTALT] == KM_MODELOCK)
- tbl[2] = 2; /* AltGr */
- else
- tbl[2] = 8; /* alt */
+ 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)
{
@@ -410,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;
@@ -624,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;
@@ -693,5 +618,4 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
}
SpecialServerMap[i] = special;
}
-#endif /* ASSUME_CUSTOM_KEYCODES */
}
diff --git a/hw/xfree86/common/xf86KbdMach.c b/hw/xfree86/common/xf86KbdMach.c
index cc23ee8e0..fbbafd8af 100644
--- a/hw/xfree86/common/xf86KbdMach.c
+++ b/hw/xfree86/common/xf86KbdMach.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.7 1996/12/23 06:43:32 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.8 1998/07/25 16:55:09 dawes Exp $ */
/*
*****************************************************************************
* HISTORY
@@ -35,7 +35,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86KbdMach.c,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
+/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */
#include "X.h"
#include "Xmd.h"
@@ -44,10 +44,11 @@
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
-#include "xf86_Config.h"
+#include "xf86Config.h"
#include "xf86Keymap.h"
diff --git a/hw/xfree86/common/xf86Keymap.h b/hw/xfree86/common/xf86Keymap.h
index 2b9debff4..45f4dd104 100644
--- a/hw/xfree86/common/xf86Keymap.h
+++ b/hw/xfree86/common/xf86Keymap.h
@@ -1,13 +1,15 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.9 1996/12/23 06:43:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.19 2002/05/31 18:45:58 dawes Exp $ */
/*
*
* For Scancodes see notes in atKeynames.h !!!!
*
*/
-/* $Xorg: xf86Keymap.h,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
+/* $XConsortium: xf86Keymap.h /main/14 1996/02/21 17:38:47 kaleb $ */
+
+static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+
+#if !defined(__SOL8__) && (!defined(sun) || defined(i386))
-static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
-#ifndef PC98
/* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
/* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
@@ -23,7 +25,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,
@@ -84,7 +86,7 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
/* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
/* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
- /* 0x4c */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
/* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
/* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
/* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
@@ -97,7 +99,6 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
/* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
/* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
-
/* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
/* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
/* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
@@ -119,180 +120,178 @@ 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,
-#else /* PC98 */
- /* 0x00 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
- /* 0x01 */ XK_1, XK_exclam, XK_kana_NU, NoSymbol,
- /* 0x02 */ XK_2, XK_quotedbl, XK_kana_FU, NoSymbol,
- /* 0x03 */ XK_3, XK_numbersign, XK_kana_A, XK_kana_a,
- /* 0x04 */ XK_4, XK_dollar, XK_kana_U, XK_kana_u,
- /* 0x05 */ XK_5, XK_percent, XK_kana_E, XK_kana_e,
- /* 0x06 */ XK_6, XK_ampersand, XK_kana_O, XK_kana_o,
- /* 0x07 */ XK_7, XK_quoteright, XK_kana_YA, XK_kana_ya,
- /* 0x08 */ XK_8, XK_parenleft, XK_kana_YU, XK_kana_yu,
- /* 0x09 */ XK_9, XK_parenright, XK_kana_YO, XK_kana_yo,
- /* 0x0a */ XK_0, NoSymbol, XK_kana_WA, XK_kana_WO,
- /* 0x0b */ XK_minus, XK_equal, XK_kana_HO, NoSymbol,
- /* 0x0c */ XK_asciicircum, XK_quoteleft, XK_kana_HE, NoSymbol,
- /* 0x0d */ XK_backslash, XK_bar, XK_prolongedsound, NoSymbol,
- /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
- /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol,
- /* 0x10 */ XK_Q, NoSymbol, XK_kana_TA, NoSymbol,
- /* 0x11 */ XK_W, NoSymbol, XK_kana_TE, NoSymbol,
- /* 0x12 */ XK_E, NoSymbol, XK_kana_I, XK_kana_i,
- /* 0x13 */ XK_R, NoSymbol, XK_kana_SU, NoSymbol,
- /* 0x14 */ XK_T, NoSymbol, XK_kana_KA, NoSymbol,
- /* 0x15 */ XK_Y, NoSymbol, XK_kana_N, NoSymbol,
- /* 0x16 */ XK_U, NoSymbol, XK_kana_NA, NoSymbol,
- /* 0x17 */ XK_I, NoSymbol, XK_kana_NI, NoSymbol,
- /* 0x18 */ XK_O, NoSymbol, XK_kana_RA, NoSymbol,
- /* 0x19 */ XK_P, NoSymbol, XK_kana_SE, NoSymbol,
- /* 0x1a */ XK_at, XK_asciitilde, XK_voicedsound, NoSymbol,
- /* 0x1b */ XK_bracketleft, XK_braceleft, XK_semivoicedsound, XK_kana_openingbracket,
- /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1d */ XK_A, NoSymbol, XK_kana_CHI, NoSymbol,
- /* 0x1e */ XK_S, NoSymbol, XK_kana_TO, NoSymbol,
- /* 0x1f */ XK_D, NoSymbol, XK_kana_SHI, NoSymbol,
- /* 0x20 */ XK_F, NoSymbol, XK_kana_HA, NoSymbol,
- /* 0x21 */ XK_G, NoSymbol, XK_kana_KI, NoSymbol,
- /* 0x22 */ XK_H, NoSymbol, XK_kana_KU, NoSymbol,
- /* 0x23 */ XK_J, NoSymbol, XK_kana_MA, NoSymbol,
- /* 0x24 */ XK_K, NoSymbol, XK_kana_NO, NoSymbol,
- /* 0x25 */ XK_L, NoSymbol, XK_kana_RI, NoSymbol,
- /* 0x26 */ XK_semicolon, XK_plus, XK_kana_RE, NoSymbol,
- /* 0x27 */ XK_colon, XK_asterisk, XK_kana_KE, NoSymbol,
- /* 0x28 */ XK_bracketright,XK_braceright, XK_kana_MU, XK_kana_closingbracket,
- /* 0x29 */ XK_Z, NoSymbol, XK_kana_TSU, NoSymbol,
- /* 0x2a */ XK_X, NoSymbol, XK_kana_SA, NoSymbol,
- /* 0x2b */ XK_C, NoSymbol, XK_kana_SO, NoSymbol,
- /* 0x2c */ XK_V, NoSymbol, XK_kana_HI, NoSymbol,
- /* 0x2d */ XK_B, NoSymbol, XK_kana_KO, NoSymbol,
- /* 0x2e */ XK_N, NoSymbol, XK_kana_MI, NoSymbol,
- /* 0x2f */ XK_M, NoSymbol, XK_kana_MO, NoSymbol,
- /* 0x30 */ XK_comma, XK_less, XK_kana_NE, XK_kana_comma,
- /* 0x31 */ XK_period, XK_greater, XK_kana_RU, XK_kana_fullstop,
- /* 0x32 */ XK_slash, XK_question, XK_kana_ME, XK_kana_middledot,
- /* 0x33 */ XK_underscore, XK_underscore, XK_kana_RO, NoSymbol,
- /* 0x34 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
- /* 0x35 */ XK_Henkan, XK_Kanji, NoSymbol, NoSymbol,
- /* 0x36 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
- /* 0x37 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
- /* 0x38 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
- /* 0x39 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3a */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3b */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3c */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3d */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3e */ XK_Clear, XK_Home, NoSymbol, NoSymbol,
- /* 0x3f */ XK_Help, NoSymbol, NoSymbol, NoSymbol,
- /* 0x40 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
- /* 0x41 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
- /* 0x42 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol,
- /* 0x43 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol,
- /* 0x44 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol,
- /* 0x45 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
- /* 0x46 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol,
- /* 0x47 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol,
- /* 0x48 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol,
- /* 0x49 */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4a */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4b */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4c */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4d */ XK_KP_Equal, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4e */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4f */ XK_KP_Separator,NoSymbol, NoSymbol, NoSymbol,
- /* 0x50 */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol,
- /* 0x51 */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol,
- /* 0x52 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
- /* 0x53 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
- /* 0x54 */ XK_F13, NoSymbol, NoSymbol, NoSymbol,
- /* 0x55 */ XK_F14, NoSymbol, NoSymbol, NoSymbol,
- /* 0x56 */ XK_F15, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+
+#else /* SunOS */
+
+/* Assumes a US English keyboard as default - sorry 'bout that
+ *
+ * Hopefully it'll be enough someone can have a sorta working
+ * keyboard, if they're not using XKB
+ *
+ * DWH 9/12/99
+ */
+
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Tab, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x2a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x38 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x3f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x48 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x49 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_End, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x52 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
/* 0x57 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x58 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x59 */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x5c */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x5d */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
/* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x60 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
- /* 0x61 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
- /* 0x62 */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
- /* 0x63 */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
- /* 0x64 */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
- /* 0x65 */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
- /* 0x66 */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
- /* 0x67 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
- /* 0x68 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
- /* 0x69 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6a */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6b */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x61 */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
/* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x70 */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x71 */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x72 */ XK_kana_switch, NoSymbol, XK_kana_switch, NoSymbol,
- /* 0x73 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
- /* 0x74 */ XK_Control_L, 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,
- /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
-#endif /* PC98 */
+ /* 0x70 */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
/* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* These are for ServerNumLock handling */
- /* 0x80 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol,
- /* 0x81 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol,
- /* 0x82 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol,
- /* 0x83 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol,
- /* 0x84 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol,
- /* 0x85 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol,
- /* 0x86 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol,
- /* 0x87 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol,
- /* 0x88 */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol,
- /* 0x89 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8b */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8c */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8d */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8e */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8f */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
- /* 0x90 */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
- /* 0x91 */ XK_End, NoSymbol, NoSymbol, NoSymbol,
- /* 0x92 */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
- /* 0x93 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
- /* 0x94 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
- /* 0x95 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+#endif /* SunOS */
+
};
-static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+#if !defined(Lynx) && \
+ !defined(__UNIXOS2__) && \
+ !defined(__mips__) && \
+ !defined(linux) && \
+ !defined(CSRG_BASED) && \
+ !defined(__CYGWIN__) && \
+ !defined(__SOL8__) && \
+ (!defined(sun) || defined(i386))
+
+static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
/* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
@@ -382,7 +381,6 @@ static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
/* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
/* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
-
/* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
@@ -421,29 +419,5 @@ static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = {
/* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
/* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
-
- /* These are for ServerNumLock handling */
- /* 0x80 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol,
- /* 0x81 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol,
- /* 0x82 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol,
- /* 0x83 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol,
- /* 0x84 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol,
- /* 0x85 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol,
- /* 0x86 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol,
- /* 0x87 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol,
- /* 0x88 */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol,
- /* 0x89 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8b */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8c */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8d */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8e */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
- /* 0x8f */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
- /* 0x90 */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
- /* 0x91 */ XK_End, NoSymbol, NoSymbol, NoSymbol,
- /* 0x92 */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
- /* 0x93 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
- /* 0x94 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
- /* 0x95 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
};
+#endif
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 3c73f6e56..308e7a72c 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -1,175 +1,202 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.24.2.1 1998/02/01 16:04:47 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.80 2002/12/12 18:29:10 eich Exp $ */
+
/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains declarations for private XFree86 functions and variables,
+ * and definitions of private macros.
*
+ * "private" means not available to video drivers.
*/
-/* $Xorg: xf86Priv.h,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
#ifndef _XF86PRIV_H
#define _XF86PRIV_H
-#ifndef _XF86VIDMODE_SERVER_
-#include "Xproto.h"
-#include "xf86_OSproc.h"
+#include "xf86Privstr.h"
+#include "propertyst.h"
+
+/*
+ * Parameters set ONLY from the command line options
+ * The global state of these things is held in xf86InfoRec (when appropriate).
+ */
+extern const char *xf86ConfigFile;
+extern Bool xf86AllowMouseOpenFail;
+#ifdef XF86VIDMODE
+extern Bool xf86VidModeDisabled;
+extern Bool xf86VidModeAllowNonLocal;
+#endif
+#ifdef XF86MISC
+extern Bool xf86MiscModInDevDisabled;
+extern Bool xf86MiscModInDevAllowNonLocal;
+#endif
+extern Bool xf86fpFlag;
+extern Bool xf86coFlag;
+extern Bool xf86sFlag;
+extern Bool xf86bsEnableFlag;
+extern Bool xf86bsDisableFlag;
+extern Bool xf86silkenMouseDisableFlag;
+extern char *xf86LayoutName;
+extern char *xf86ScreenName;
+extern char *xf86PointerName;
+extern char *xf86KeyboardName;
+#ifdef KEEPBPP
+extern int xf86Bpp;
#endif
+extern int xf86FbBpp;
+extern int xf86Depth;
+extern Pix24Flags xf86Pix24;
+extern rgb xf86Weight;
+extern Bool xf86FlipPixels;
+extern Bool xf86BestRefresh;
+extern Gamma xf86Gamma;
+extern char *xf86ServerName;
+extern Bool xf86ShowUnresolved;
-typedef struct {
+/* Other parameters */
- /* keyboard part */
- DeviceIntPtr pKeyboard;
- DeviceProc kbdProc; /* procedure for initializing */
- void (* kbdEvents)( /* proc for processing events */
-#if NeedNestedPrototypes && !defined(__OSF__)
- void
-#endif
- );
-#ifndef MINIX
- int consoleFd;
+extern xf86InfoRec xf86Info;
+extern const char *xf86InputDeviceList;
+extern const char *xf86ModulePath;
+extern MessageType xf86ModPathFrom;
+extern const char *xf86LogFile;
+extern MessageType xf86LogFileFrom;
+extern Bool xf86LogFileWasOpened;
+extern serverLayoutRec xf86ConfigLayout;
+extern Pix24Flags xf86ConfigPix24;
+
+extern unsigned short xf86MouseCflags[];
+extern Bool xf86SupportedMouseTypes[];
+extern int xf86NumMouseTypes;
+
+#ifdef XFree86LOADER
+extern DriverPtr *xf86DriverList;
+extern ModuleInfoPtr *xf86ModuleInfoList;
+extern int xf86NumModuleInfos;
#else
- int kbdFd;
-#endif /* MINIX */
-#if defined(MACH386) || defined(__OSF__)
- int kbdFd;
-#endif /* MACH386 || __OSF__ */
- int vtno;
- int kbdType; /* AT84 / AT101 */
- int kbdRate;
- int kbdDelay;
- int bell_pitch;
- int bell_duration;
- Bool autoRepeat;
- unsigned long leds;
- unsigned long xleds;
- char *vtinit;
- int *specialKeyMap;
- int scanPrefix; /* scancode-state */
- Bool capsLock;
- Bool numLock;
- Bool scrollLock;
- Bool modeSwitchLock;
- Bool serverNumLock;
- Bool composeLock;
- Bool vtSysreq;
-#if defined(SVR4) && defined(i386)
- Bool panix106;
-#endif /* SVR4 && i386 */
-
- /* mouse part */
- DeviceIntPtr pMouse;
-#ifdef XINPUT
- pointer mouseLocal;
+extern DriverPtr xf86DriverList[];
#endif
- MouseDevPtr mouseDev;
-
- /* event handler part */
- int lastEventTime;
- Bool vtRequestsPending;
- Bool inputPending;
- Bool dontZap;
- Bool dontZoom;
- Bool notrapSignals; /* don't exit cleanly - die at fault */
- Bool caughtSignal;
-
- /* graphics part */
- Bool sharedMonitor;
- ScreenPtr currentScreen;
-#ifdef CSRG_BASED
- int screenFd; /* fd for memory mapped access to vga card */
- int consType; /* Which console driver? */
+extern int xf86NumDrivers;
+extern Bool xf86Resetting;
+extern Bool xf86Initialising;
+extern Bool xf86ProbeFailed;
+extern int xf86NumScreens;
+extern pciVideoPtr *xf86PciVideoInfo;
+extern xf86CurrentAccessRec xf86CurrentAccess;
+extern const char *xf86VisualNames[];
+extern int xf86Verbose; /* verbosity level */
+extern int xf86LogVerbose; /* log file verbosity level */
+extern Bool xf86ProbeOnly;
+extern Bool xf86DoProbe;
+
+#ifndef DEFAULT_VERBOSE
+#define DEFAULT_VERBOSE 0
#endif
-#if defined(AMOEBA)
- void *screenPtr;
+#ifndef DEFAULT_LOG_VERBOSE
+#define DEFAULT_LOG_VERBOSE 3
#endif
-
-#ifdef XKB
-/*
- * would like to use an XkbComponentNamesRec here but can't without
- * pulling in a bunch of header files. :-(
- */
- char *xkbkeymap;
- char *xkbkeycodes;
- char *xkbtypes;
- char *xkbcompat;
- char *xkbsymbols;
- char *xkbgeometry;
- Bool xkbcomponents_specified;
- char *xkbrules;
- char *xkbmodel;
- char *xkblayout;
- char *xkbvariant;
- char *xkboptions;
+#ifndef DEFAULT_DPI
+#define DEFAULT_DPI 75
#endif
-} xf86InfoRec, *xf86InfoPtr;
+#define DEFAULT_UNRESOLVED TRUE
+#define DEFAULT_BEST_REFRESH FALSE
-extern xf86InfoRec xf86Info;
+/* Function Prototypes */
+#ifndef _NO_XF86_PROTOTYPES
+
+/* xf86Beta.c */
+extern void xf86CheckBeta(int extraDays, char *key);
+
+/* xf86Bus.c */
-/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
-#define XLED1 ((unsigned long) 0x00000001)
-#define XLED2 ((unsigned long) 0x00000002)
-#define XLED3 ((unsigned long) 0x00000004)
-#define XCAPS ((unsigned long) 0x20000000)
-#define XNUM ((unsigned long) 0x40000000)
-#define XSCR ((unsigned long) 0x80000000)
-#define XCOMP ((unsigned long) 0x00008000)
-
-/* 386BSD console driver types (consType) */
-#ifdef CSRG_BASED
-#define PCCONS 0
-#define CODRV011 1
-#define CODRV01X 2
-#define SYSCONS 8
-#define PCVT 16
+void xf86BusProbe(void);
+void xf86ChangeBusIndex(int oldIndex, int newIndex);
+void xf86AccessInit(void);
+void xf86AccessEnter(void);
+void xf86AccessLeave(void);
+void xf86EntityInit(void);
+void xf86EntityEnter(void);
+void xf86EntityLeave(void);
+void xf86AccessLeaveState(void);
+
+void xf86FindPrimaryDevice(void);
+/* new RAC */
+void xf86ResourceBrokerInit(void);
+void xf86PostProbe(void);
+void xf86ClearEntityListForScreen(int scrnIndex);
+void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
+extern void xf86PostPreInit(void);
+extern void xf86PostScreenInit(void);
+extern memType getValidBIOSBase(PCITAG tag, int num);
+extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag);
+
+/* xf86Config.c */
+
+Bool xf86PathIsAbsolute(const char *path);
+Bool xf86PathIsSafe(const char *path);
+
+/* xf86DefaultModes */
+
+extern DisplayModeRec xf86DefaultModes [];
+
+/* xf86DoScanPci.c */
+
+void DoScanPci(int argc, char **argv, int i);
+
+/* xf86DoProbe.c */
+void DoProbeArgs(int argc, char **argv, int i);
+void DoProbe(void);
+void DoConfigure(void);
+
+/* xf86Events.c */
+
+void xf86PostKbdEvent(unsigned key);
+void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy);
+void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
+void xf86SigHandler(int signo);
+#ifdef MEMDEBUG
+void xf86SigMemDebug(int signo);
#endif
+void xf86HandlePMEvents(int fd, pointer data);
+extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
+extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
+void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer);
-/* Values of xf86Info.mouseFlags */
-#define MF_CLEAR_DTR 1
-#define MF_CLEAR_RTS 2
+/* xf86Helper.c */
+void xf86LogInit(void);
+void xf86CloseLog(void);
+void OsVendorVErrorF(const char *f, va_list args);
-extern int xf86ScreenIndex;
+/* xf86Init.c */
+Bool xf86LoadModules(char **list, pointer *optlist);
-#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
+/* xf86Io.c */
-extern int xf86MaxScreens;
-extern ScrnInfoPtr xf86Screens[];
-extern int xf86ScreenNames[];
+void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl,
+ int unused);
+void xf86KbdLeds(void);
+void xf86UpdateKbdLeds(void);
+void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl);
+void xf86InitKBD(Bool init);
+int xf86KbdProc(DeviceIntPtr pKeyboard, int what);
-extern char xf86ConfigFile[];
-extern int xf86Verbose;
-extern Bool xf86ProbeOnly, xf86ProbeFailed;
-extern unsigned short xf86MouseCflags[];
-extern Bool xf86SupportedMouseTypes[];
-extern int xf86NumMouseTypes;
-extern int xf86bpp;
-extern xrgb xf86weight;
-extern Bool xf86AllowMouseOpenFail;
-extern Bool xf86BestRefresh;
+/* xf86Kbd.c */
-extern Bool xf86FlipPixels;
-#define XF86FLIP_PIXELS() \
- if (xf86FlipPixels) { \
- pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
- pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
- }
+void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
-#endif /* _XF86PRIV_H */
+/* xf86Lock.c */
+#ifdef USE_XF86_SERVERLOCK
+void xf86UnlockServer(void);
+#endif
+/* xf86XKB.c */
+
+void xf86InitXkb(void);
+
+#endif /* _NO_XF86_PROTOTYPES */
+
+
+#endif /* _XF86PRIV_H */
diff --git a/hw/xfree86/common/xf86Version.h b/hw/xfree86/common/xf86Version.h
index f403c31f5..e548b0437 100644
--- a/hw/xfree86/common/xf86Version.h
+++ b/hw/xfree86/common/xf86Version.h
@@ -1,23 +1,33 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.236.2.50 1998/03/02 09:58:21 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.543.2.1 2003/05/10 01:10:10 dawes Exp $ */
-#define XF86_VERSION " 3.3.2 "
+#ifndef XF86_VERSION_CURRENT
-/* The finer points in versions... */
-#define XF86_VERSION_MAJOR 3
+#define XF86_VERSION_MAJOR 4
#define XF86_VERSION_MINOR 3
-#define XF86_VERSION_SUBMINOR 2
-#define XF86_VERSION_BETA 0 /* 0="", 1="A", 2="B", etc... */
-#define XF86_VERSION_ALPHA 0 /* 0="", 1="a", 2="b", etc... */
+#define XF86_VERSION_PATCH 0
+#define XF86_VERSION_SNAP 1
+
+/* This has five arguments for compatibilty reasons */
+#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \
+ (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
+
+#define XF86_GET_MAJOR_VERSION(vers) ((vers) / 10000000)
+#define XF86_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000)
+#define XF86_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000)
+#define XF86_GET_SNAP_VERSION(vers) ((vers) % 1000)
+
+/* Define these for compatibility. They'll be removed at some point. */
+#define XF86_VERSION_SUBMINOR XF86_VERSION_PATCH
+#define XF86_VERSION_BETA 0
+#define XF86_VERSION_ALPHA XF86_VERSION_SNAP
-#define XF86_VERSION_NUMERIC(major,minor,subminor,beta,alpha) \
- ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
#define XF86_VERSION_CURRENT \
XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR, \
XF86_VERSION_MINOR, \
- XF86_VERSION_SUBMINOR, \
- XF86_VERSION_BETA, \
- XF86_VERSION_ALPHA)
+ XF86_VERSION_PATCH, \
+ XF86_VERSION_SNAP, \
+ 0)
-#define XF86_DATE "March 2 1998"
+#endif
-/* $Xorg: xf86Version.h,v 1.3 2000/08/17 19:48:48 cpqbld Exp $ */
+/* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */
diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c
index c5ac740fd..ddd3055ab 100644
--- a/hw/xfree86/common/xf86XKB.c
+++ b/hw/xfree86/common/xf86XKB.c
@@ -1,4 +1,4 @@
-/* $Xorg: xf86XKB.c,v 1.3 2000/08/17 19:50:31 cpqbld Exp $ */
+/* $XConsortium: xf86XKB.c /main/4 1996/02/04 09:28:04 kaleb $ */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
@@ -24,7 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.6 1996/12/28 11:14:43 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.11 2002/10/11 01:40:31 dawes Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -38,81 +38,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
-#include "xf86_Config.h"
#include "XKBsrv.h"
-#ifdef AMOEBA
-#define LED_CAP IOP_LED_CAP
-#define LED_NUM IOP_LED_NUM
-#define LED_SCR IOP_LED_SCROLL
-#endif
-
-#ifdef MINIX
-#define LED_CAP KBD_LEDS_CAPS
-#define LED_NUM KBD_LEDS_NUM
-#define LED_SCR KBD_LEDS_SCROLL
-#endif
-
-void
-xf86InitXkb()
-{
-}
-
-void
-#if NeedFunctionPrototypes
-XkbDDXUpdateIndicators(DeviceIntPtr pXDev,CARD32 new)
-#else
-XkbDDXUpdateIndicators(pXDev,new)
- DeviceIntPtr pXDev;
- CARD32 new;
-#endif
-{
- CARD32 old;
-#ifdef DEBUG
-/* if (xkbDebugFlags)*/
- ErrorF("XkbDDXUpdateIndicators(...,0x%x) -- XFree86 version\n",new);
-#endif
-#ifdef LED_CAP
- old= new;
- new= 0;
- if (old&XLED1) new|= LED_CAP;
- if (old&XLED2) new|= LED_NUM;
- if (old&XLED3) new|= LED_SCR;
-#endif
- xf86SetKbdLeds(new);
- return;
-}
-
void
-#if NeedFunctionPrototypes
-XkbDDXUpdateDeviceIndicators( DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- CARD32 new)
-#else
-XkbDDXUpdateDeviceIndicators(dev,sli,new)
- DeviceIntPtr dev;
- XkbSrvLedInfoPtr sli;
- CARD32 new;
-#endif
+xf86InitXkb(void)
{
- if (sli->fb.kf==dev->kbdfeed)
- XkbDDXUpdateIndicators(dev,new);
- else if (sli->class==KbdFeedbackClass) {
- KbdFeedbackPtr kf;
- kf= sli->fb.kf;
- if (kf && kf->CtrlProc) {
- (*kf->CtrlProc)(dev,&kf->ctrl);
- }
- }
- else if (sli->class==LedFeedbackClass) {
- LedFeedbackPtr lf;
- lf= sli->fb.lf;
- if (lf && lf->CtrlProc) {
- (*lf->CtrlProc)(dev,&lf->ctrl);
- }
- }
- return;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7659deb3f..53fa1b3ff 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1,6 +1,6 @@
-/* $Xorg: xf86Xinput.c,v 1.3 2000/08/17 19:50:31 cpqbld Exp $ */
+/* $XConsortium: xf86Xinput.c /main/14 1996/10/27 11:05:25 kaleb $ */
/*
- * Copyright 1995,1996 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@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
@@ -22,25 +22,37 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.22.2.7 1998/02/07 10:05:22 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.68 2002/10/11 01:40:31 dawes Exp $ */
+#include "Xfuncproto.h"
#include "Xmd.h"
+#ifdef XINPUT
#include "XI.h"
#include "XIproto.h"
+#endif
#include "xf86.h"
-#include "Xpoll.h"
#include "xf86Priv.h"
-#include "xf86_Config.h"
#include "xf86Xinput.h"
-#include "xf86Procs.h"
+#ifdef XINPUT
+#include "XIstubs.h"
+#endif
#include "mipointer.h"
+#include "xf86InPriv.h"
#ifdef DPMSExtension
+#define DPMS_SERVER
#include "extensions/dpms.h"
+#include "dpmsproc.h"
+#endif
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
#endif
#include "exevents.h" /* AddInputDevice */
+#include "exglobals.h"
+#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
@@ -48,40 +60,34 @@
#include <stdarg.h>
-extern InputInfo inputInfo;
+#include "osdep.h" /* EnabledDevices */
+#include "Xpoll.h"
+#include "xf86_OSproc.h" /* sigio stuff */
-#ifndef DYNAMIC_MODULE
-#ifdef JOYSTICK_SUPPORT
-extern DeviceAssocRec joystick_assoc;
-#endif
-#ifdef WACOM_SUPPORT
-extern DeviceAssocRec wacom_stylus_assoc;
-extern DeviceAssocRec wacom_cursor_assoc;
-extern DeviceAssocRec wacom_eraser_assoc;
-#endif
-#ifdef ELOGRAPHICS_SUPPORT
-extern DeviceAssocRec elographics_assoc;
-#endif
-#ifdef SUMMASKETCH_SUPPORT
-extern DeviceAssocRec summasketch_assoc;
+/******************************************************************************
+ * debugging macro
+ *****************************************************************************/
+#ifdef DBG
+#undef DBG
#endif
+#ifdef DEBUG
+#undef DEBUG
#endif
-extern DeviceAssocRec mouse_assoc;
+#define DEBUG 0
-static int num_devices;
-static LocalDevicePtr *localDevices;
-static int max_devices;
+#if DEBUG
+static int debug_level = 0;
-static DeviceAssocPtr *deviceAssoc = NULL;
-static int numAssoc = 0;
-static int maxAssoc = 0;
+#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
+#else
+#define DBG(lvl, f)
+#endif
-static SymTabRec XinputTab[] = {
- { ENDSECTION, "endsection"},
- { SUBSECTION, "subsection" },
- { -1, "" },
-};
+/******************************************************************************
+ * macros
+ *****************************************************************************/
+#define ENQUEUE(e) xf86eqEnqueue((e))
/***********************************************************************
*
@@ -110,20 +116,27 @@ xf86AlwaysCoreControl(DeviceIntPtr device,
int
xf86IsCorePointer(DeviceIntPtr device)
{
+ return(device == inputInfo.pointer);
+}
+
+static int
+xf86ShareCorePointer(DeviceIntPtr device)
+{
LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
return((local->always_core_feedback &&
- local->always_core_feedback->ctrl.integer_displayed) ||
- (device == inputInfo.pointer));
+ local->always_core_feedback->ctrl.integer_displayed));
}
-static int
-xf86IsAlwaysCore(DeviceIntPtr device)
+static Bool
+xf86SendDragEvents(DeviceIntPtr device)
{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- return(local->always_core_feedback &&
- local->always_core_feedback->ctrl.integer_displayed);
+ if (inputInfo.pointer->button->buttonsDown > 0)
+ return (local->flags & XI86_SEND_DRAG_EVENTS);
+ else
+ return (TRUE);
}
int
@@ -136,8 +149,7 @@ xf86IsCoreKeyboard(DeviceIntPtr device)
}
void
-xf86AlwaysCore(LocalDevicePtr local,
- Bool always)
+xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always)
{
if (always) {
local->flags |= XI86_ALWAYS_CORE;
@@ -146,6 +158,8 @@ xf86AlwaysCore(LocalDevicePtr local,
}
}
+static int xf86CoreButtonState;
+
/***********************************************************************
*
* xf86CheckButton --
@@ -159,153 +173,64 @@ Bool
xf86CheckButton(int button,
int down)
{
- /* The device may have up to MSE_MAXBUTTONS (12) buttons. */
- int state = (inputInfo.pointer->button->state & 0x0fff00) >> 8;
- int check = (state & (1 << (button - 1)));
+ int check;
+ int bit = (1 << (button - 1));
+
+ check = xf86CoreButtonState & bit;
- if ((check && down) && (!check && !down)) {
+ DBG(5, ErrorF("xf86CheckButton "
+ "button=%d down=%d state=%d check=%d returns ",
+ button, down, state, check));
+ if ((check && down) || (!check && !down)) {
+ DBG(5, ErrorF("FALSE\n"));
return FALSE;
}
+ xf86CoreButtonState ^= bit;
+ DBG(5, ErrorF("TRUE\n"));
return TRUE;
}
/***********************************************************************
*
- * ReadInput --
- * Wakeup handler to catch input and dispatch it to our
- * input routines if necessary.
+ * xf86ProcessCommonOptions --
+ *
+ * Process global options.
*
***********************************************************************
*/
-static void
-ReadInput(pointer block_data,
- int select_status,
- pointer read_mask)
+void
+xf86ProcessCommonOptions(LocalDevicePtr local,
+ pointer list)
{
- int i;
- LocalDevicePtr local_dev;
- fd_set* LastSelectMask = (fd_set*) read_mask;
- fd_set devices_with_input;
- extern fd_set EnabledDevices;
-
- if (select_status < 1)
- return;
-
- XFD_ANDSET(&devices_with_input, LastSelectMask, &EnabledDevices);
- if (!XFD_ANYSET(&devices_with_input))
- return;
-
- for (i = 0; i < num_devices; i++) {
- local_dev = localDevices[i];
- if (local_dev->read_input &&
- (local_dev->fd >= 0) &&
- (FD_ISSET(local_dev->fd, ((fd_set *) read_mask)) != 0)) {
- (*local_dev->read_input)(local_dev);
- break;
+ if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
+ xf86SetBoolOption(list, "SendCoreEvents", 0)) {
+ local->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
}
- }
-}
-/***********************************************************************
- *
- * configExtendedInputSection --
- *
- ***********************************************************************
- */
-
-void
-xf86ConfigExtendedInputSection(LexPtr val)
-{
- int i;
- int token;
-
-#ifndef DYNAMIC_MODULE
-# ifdef JOYSTICK_SUPPORT
- xf86AddDeviceAssoc(&joystick_assoc);
-# endif
-# ifdef WACOM_SUPPORT
- xf86AddDeviceAssoc(&wacom_stylus_assoc);
- xf86AddDeviceAssoc(&wacom_cursor_assoc);
- xf86AddDeviceAssoc(&wacom_eraser_assoc);
-# endif
-# ifdef ELOGRAPHICS_SUPPORT
- xf86AddDeviceAssoc(&elographics_assoc);
-# endif
-# ifdef SUMMASKETCH_SUPPORT
- xf86AddDeviceAssoc(&summasketch_assoc);
-# endif
-#endif
+ if (xf86SetBoolOption(list, "CorePointer", 0)) {
+ local->flags |= XI86_CORE_POINTER;
+ xf86Msg(X_CONFIG, "%s: Core Pointer\n", local->name);
+ }
- xf86AddDeviceAssoc(&mouse_assoc);
-
- num_devices = 0;
- max_devices = 3;
- localDevices = (LocalDevicePtr*) xalloc(sizeof(LocalDevicePtr)*max_devices);
-
- while ((token = xf86GetToken(XinputTab)) != ENDSECTION)
- {
- if (token == SUBSECTION)
- {
- int found = 0;
-
- if (xf86GetToken(NULL) != STRING)
- xf86ConfigError("SubSection name expected");
-
- for(i=0; !found && i<numAssoc; i++)
- {
- if (StrCaseCmp(val->str, deviceAssoc[i]->config_section_name) == 0)
- {
- if (num_devices == max_devices) {
- max_devices *= 2;
- localDevices = (LocalDevicePtr*) xrealloc(localDevices,
- sizeof(LocalDevicePtr)*max_devices);
- }
- localDevices[num_devices] = deviceAssoc[i]->device_allocate();
-
- if (localDevices[num_devices] && localDevices[num_devices]->device_config)
- {
- (*localDevices[num_devices]->device_config)(localDevices,
- num_devices,
- num_devices+1,
- val);
- localDevices[num_devices]->flags |= XI86_CONFIGURED;
- num_devices++;
- }
- found = 1;
- }
- }
- if (!found)
- xf86ConfigError("Invalid SubSection name");
- }
- else
- xf86ConfigError("XInput keyword section expected");
+ if (xf86SetBoolOption(list, "CoreKeyboard", 0)) {
+ local->flags |= XI86_CORE_KEYBOARD;
+ xf86Msg(X_CONFIG, "%s: Core Keyboard\n", local->name);
}
-}
-/***********************************************************************
- *
- * xf86AddDeviceAssoc --
- *
- * Add an association to the array deviceAssoc. This is needed to
- * allow dynamic loading of devices to register themself.
- *
- ***********************************************************************
- */
-void
-xf86AddDeviceAssoc(DeviceAssocPtr assoc)
-{
- if (!deviceAssoc) {
- maxAssoc = 10;
- deviceAssoc = (DeviceAssocPtr*) xalloc(sizeof(DeviceAssocPtr)*maxAssoc);
+ if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
+ local->flags |= XI86_SEND_DRAG_EVENTS;
} else {
- if (maxAssoc == numAssoc) {
- maxAssoc *= 2;
- deviceAssoc = (DeviceAssocPtr*) xrealloc(deviceAssoc, sizeof(DeviceAssocPtr)*maxAssoc);
- }
+ xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ }
+
+ local->history_size = xf86SetIntOption(list, "HistorySize", 0);
+
+ if (local->history_size > 0) {
+ xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
+ local->history_size);
}
- deviceAssoc[numAssoc] = assoc;
- numAssoc++;
}
/***********************************************************************
@@ -321,6 +246,9 @@ void
xf86XinputFinalizeInit(DeviceIntPtr dev)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+
+ local->dxremaind = 0.0;
+ local->dyremaind = 0.0;
if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) {
ErrorF("Unable to init integer feedback for always core feature\n");
@@ -330,57 +258,61 @@ xf86XinputFinalizeInit(DeviceIntPtr dev)
}
}
-
/***********************************************************************
*
- * InitExtInput --
+ * xf86ActivateDevice --
*
- * Initialize any extended devices we might have. It is called from
- * ddx InitInput.
+ * Initialize an input device.
*
***********************************************************************
*/
-
void
-InitExtInput()
+xf86ActivateDevice(LocalDevicePtr local)
{
DeviceIntPtr dev;
- int i;
- /* Register a Wakeup handler to handle input when generated */
- RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA, ReadInput,
- NULL);
-
- /* Add each device */
- for (i = 0; i < num_devices; i++) {
- if (localDevices[i]->flags & XI86_CONFIGURED) {
- int open_on_init;
-
- open_on_init = !(localDevices[i]->flags & XI86_NO_OPEN_ON_INIT) ||
- (localDevices[i]->flags & XI86_ALWAYS_CORE);
-
- dev = AddInputDevice(localDevices[i]->device_control,
- open_on_init);
- if (dev == NULL)
- FatalError("Too many input devices");
-
- localDevices[i]->atom = MakeAtom(localDevices[i]->name,
- strlen(localDevices[i]->name),
- TRUE);
- dev->public.devicePrivate = (pointer) localDevices[i];
- localDevices[i]->dev = dev;
+ if (local->flags & XI86_CONFIGURED) {
+ int open_on_init;
+
+ open_on_init = local->flags &
+ (XI86_OPEN_ON_INIT |
+ XI86_ALWAYS_CORE | XI86_CORE_POINTER | XI86_CORE_KEYBOARD);
+
+ dev = AddInputDevice(local->device_control,
+ open_on_init);
+ if (dev == NULL)
+ FatalError("Too many input devices");
+
+ local->atom = MakeAtom(local->name,
+ strlen(local->name),
+ TRUE);
+ AssignTypeAndName (dev, local->atom, local->name);
+ dev->public.devicePrivate = (pointer) local;
+ local->dev = dev;
+
+ xf86XinputFinalizeInit(dev);
- xf86XinputFinalizeInit(dev);
-
+ /*
+ * XXX Can a single device instance be both core keyboard and
+ * core pointer? If so, this should be changed.
+ */
+ if (local->flags & XI86_CORE_POINTER)
+ RegisterPointerDevice(dev);
+ else if (local->flags & XI86_CORE_KEYBOARD)
+ RegisterKeyboardDevice(dev);
+#ifdef XINPUT
+ else
RegisterOtherDevice(dev);
- if (serverGeneration == 1)
- ErrorF("%s Adding extended device \"%s\" (type: %s)\n", XCONFIG_GIVEN,
- localDevices[i]->name, localDevices[i]->type_name);
- }
+#endif
+
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ local->name, local->type_name);
}
}
+#ifdef XINPUT
/***********************************************************************
*
* Caller: ProcXOpenDevice
@@ -405,13 +337,10 @@ InitExtInput()
*/
void
-OpenInputDevice (dev, client, status)
- DeviceIntPtr dev;
- ClientPtr client;
- int *status;
+OpenInputDevice(DeviceIntPtr dev,
+ ClientPtr client,
+ int *status)
{
- extern int BadDevice;
-
if (!dev->inited) {
*status = BadDevice;
} else {
@@ -453,9 +382,7 @@ OpenInputDevice (dev, client, status)
*/
int
-ChangeKeyboardDevice (old_dev, new_dev)
- DeviceIntPtr old_dev;
- DeviceIntPtr new_dev;
+ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev)
{
/**********************************************************************
* DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
@@ -496,17 +423,11 @@ ChangeKeyboardDevice (old_dev, new_dev)
*/
int
-#ifdef NeedFunctionPrototypes
ChangePointerDevice (
DeviceIntPtr old_dev,
DeviceIntPtr new_dev,
unsigned char x,
unsigned char y)
-#else
-ChangePointerDevice (old_dev, new_dev, x, y)
- DeviceIntPtr old_dev, new_dev;
- unsigned char x, y;
-#endif /* NeedFunctionPrototypes */
{
/************************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
@@ -518,6 +439,7 @@ ChangePointerDevice (old_dev, new_dev, x, y)
else
axes_changed = FALSE;
*************************************************************************/
+
/*
* We don't allow axis swap or other exotic features.
*/
@@ -561,9 +483,7 @@ ChangePointerDevice (old_dev, new_dev, x, y)
*/
void
-CloseInputDevice (d, client)
- DeviceIntPtr d;
- ClientPtr client;
+CloseInputDevice (DeviceIntPtr d, ClientPtr client)
{
ErrorF("ProcXCloseDevice to close or not ?\n");
}
@@ -616,10 +536,7 @@ AddOtherInputDevices ()
*/
int
-SetDeviceMode (client, dev, mode)
- register ClientPtr client;
- DeviceIntPtr dev;
- int mode;
+SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
@@ -645,12 +562,8 @@ SetDeviceMode (client, dev, mode)
*/
int
-SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
- register ClientPtr client;
- DeviceIntPtr dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
+SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
+ int first_valuator, int num_valuators)
{
return BadMatch;
}
@@ -666,10 +579,7 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
*/
int
-ChangeDeviceControl (client, dev, control)
- register ClientPtr client;
- DeviceIntPtr dev;
- xDeviceCtl *control;
+ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
@@ -680,13 +590,12 @@ ChangeDeviceControl (client, dev, control)
return (*local->control_proc)(local, control);
}
}
+#endif
/*
* adapted from mieq.c to support extended events
*
*/
-extern InputInfo inputInfo;
-
#define QUEUE_SIZE 256
typedef struct _Event {
@@ -710,8 +619,7 @@ typedef struct _EventQueue {
static EventQueueRec xf86EventQueue;
Bool
-xf86eqInit (pKbd, pPtr)
- DevicePtr pKbd, pPtr;
+xf86eqInit (DevicePtr pKbd, DevicePtr pPtr)
{
xf86EventQueue.head = xf86EventQueue.tail = 0;
xf86EventQueue.lastEventTime = GetTimeInMillis ();
@@ -732,46 +640,56 @@ xf86eqInit (pKbd, pPtr)
*/
void
-xf86eqEnqueue (e)
- xEvent *e;
+xf86eqEnqueue (xEvent *e)
{
- int oldtail, newtail;
- Bool isMotion;
+ int oldtail, newtail;
+ Bool isMotion;
#ifdef XINPUT
- int count;
-
- switch (e->u.u.type)
- {
- case KeyPress:
- case KeyRelease:
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
+ int count;
+
+ xf86AssertBlockedSIGIO ("xf86eqEnqueue");
+ switch (e->u.u.type) {
+ case KeyPress:
+ case KeyRelease:
+#ifdef XFreeXDGA
+ /* we do this here, because nobody seems to be calling
+ xf86PostKeyEvent(). We can't steal MotionNotify events here
+ because the motion-relative information has been lost already. */
+ if(DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, e))
+ return;
+#endif
+ /* fall through */
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
count = 1;
break;
- default:
- if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS)
- {
+ default:
+#ifdef XFreeXDGA
+ if (DGAIsDgaEvent (e))
+ {
+ count = 1;
+ break;
+ }
+#endif
+ if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS) {
count = 1;
- }
- else
- {
- count = 2;
- }
+ }
+ else {
+ count = 2;
+ }
break;
- }
+ }
#endif
oldtail = xf86EventQueue.tail;
isMotion = e->u.u.type == MotionNotify;
- if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head)
- {
+ if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head) {
if (oldtail == 0)
oldtail = QUEUE_SIZE;
oldtail = oldtail - 1;
}
- else
- {
+ else {
newtail = oldtail + 1;
if (newtail == QUEUE_SIZE)
newtail = 0;
@@ -784,9 +702,8 @@ xf86eqEnqueue (e)
xf86EventQueue.lastMotion = isMotion;
xf86EventQueue.events[oldtail].event = *e;
#ifdef XINPUT
- if (count == 2)
- {
- xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1));
+ if (count == 2) {
+ xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1));
}
#endif
/*
@@ -794,8 +711,8 @@ xf86eqEnqueue (e)
* is "unnecessary", but very useful
*/
if (e->u.keyButtonPointer.time < xf86EventQueue.lastEventTime &&
- xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
- {
+ xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) {
+
xf86EventQueue.events[oldtail].event.u.keyButtonPointer.time =
xf86EventQueue.lastEventTime;
}
@@ -810,28 +727,31 @@ xf86eqProcessInputEvents ()
{
EventRec *e;
int x, y;
- xEvent xe;
+ struct {
+ xEvent event;
+#ifdef XINPUT
+ deviceValuator val;
+#endif
+ } xe;
#ifdef XINPUT
DeviceIntPtr dev;
int id, count;
deviceKeyButtonPointer *dev_xe;
#endif
- while (xf86EventQueue.head != xf86EventQueue.tail)
- {
+ while (xf86EventQueue.head != xf86EventQueue.tail) {
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(DPMSModeOn);
#endif
e = &xf86EventQueue.events[xf86EventQueue.head];
/*
* Assumption - screen switching can only occur on motion events
*/
- if (e->pScreen != xf86EventQueue.pDequeueScreen)
- {
+ if (e->pScreen != xf86EventQueue.pDequeueScreen) {
xf86EventQueue.pDequeueScreen = e->pScreen;
x = e->event.u.keyButtonPointer.rootX;
y = e->event.u.keyButtonPointer.rootY;
@@ -841,54 +761,56 @@ xf86eqProcessInputEvents ()
++xf86EventQueue.head;
NewCurrentScreen (xf86EventQueue.pDequeueScreen, x, y);
}
- else
- {
- xe = e->event;
+ else {
+ xe.event = e->event;
+ xe.val = e->val;
if (xf86EventQueue.head == QUEUE_SIZE - 1)
xf86EventQueue.head = 0;
else
++xf86EventQueue.head;
- switch (xe.u.u.type)
- {
+ switch (xe.event.u.u.type) {
case KeyPress:
case KeyRelease:
(*xf86EventQueue.pKbd->processInputProc)
- (&xe, (DeviceIntPtr)xf86EventQueue.pKbd, 1);
+ (&xe.event, (DeviceIntPtr)xf86EventQueue.pKbd, 1);
break;
#ifdef XINPUT
case ButtonPress:
case ButtonRelease:
case MotionNotify:
(*(inputInfo.pointer->public.processInputProc))
- (&xe, (DeviceIntPtr)inputInfo.pointer, 1);
- break;
+ (&xe.event, (DeviceIntPtr)inputInfo.pointer, 1);
+ break;
default:
- dev_xe = (deviceKeyButtonPointer *) e;
- id = dev_xe->deviceid & DEVICE_BITS;
- if (!(dev_xe->deviceid & MORE_EVENTS)) {
- count = 1;
- } else {
- count = 2;
- }
- dev = LookupDeviceIntRec(id);
- if (dev == NULL)
- {
- ErrorF("LookupDeviceIntRec id=0x%x not found\n", id);
+#ifdef XFreeXDGA
+ if (DGADeliverEvent (xf86EventQueue.pDequeueScreen, &xe.event))
+ break;
+#endif
+ dev_xe = (deviceKeyButtonPointer *) &xe.event;
+ id = dev_xe->deviceid & DEVICE_BITS;
+ if (!(dev_xe->deviceid & MORE_EVENTS)) {
+ count = 1;
+ }
+ else {
+ count = 2;
+ }
+ dev = LookupDeviceIntRec(id);
+ if (dev == NULL) {
+ ErrorF("LookupDeviceIntRec id=0x%x not found\n", id);
/* FatalError("xf86eqProcessInputEvents : device not found.\n");
*/
- break;
- }
- if (!dev->public.processInputProc)
- {
- FatalError("xf86eqProcessInputEvents : device has no input proc.\n");
- break;
- }
- (*dev->public.processInputProc)(&e->event, dev, count);
+ break;
+ }
+ if (!dev->public.processInputProc) {
+ FatalError("xf86eqProcessInputEvents : device has no input proc.\n");
+ break;
+ }
+ (*dev->public.processInputProc)(&xe.event, dev, count);
#else
default:
(*xf86EventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)xf86EventQueue.pPtr, 1);
+ (&xe.event, (DeviceIntPtr)xf86EventQueue.pPtr, 1);
#endif
break;
}
@@ -896,6 +818,16 @@ xf86eqProcessInputEvents ()
}
}
+void
+xf86eqSwitchScreen(ScreenPtr pScreen,
+ Bool fromDIX)
+{
+ xf86EventQueue.pEnqueueScreen = pScreen;
+
+ if (fromDIX)
+ xf86EventQueue.pDequeueScreen = pScreen;
+}
+
/*
* convenient functions to post events
*/
@@ -912,87 +844,206 @@ xf86PostMotionEvent(DeviceIntPtr device,
xEvent xE[2];
deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
deviceValuator *xv = (deviceValuator*) xev+1;
- LocalDevicePtr local = (LocalDevicePtr)device->public.devicePrivate;
- char *buff;
- Time current = GetTimeInMillis();
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+ char *buff = 0;
+ Time current;
+ Bool is_core = xf86IsCorePointer(device);
+ Bool is_shared = xf86ShareCorePointer(device);
+ Bool drag = xf86SendDragEvents(device);
+ ValuatorClassPtr val = device->valuator;
+ int valuator[6];
+ int oldaxis[6];
+ int *axisvals;
+ AxisInfoPtr axes;
+ int dx = 0, dy = 0;
+ float mult;
+ int x, y;
+ int loop_start;
+ int i;
+ int num;
- if (HAS_MOTION_HISTORY(local)) {
+ DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) is_core=%s is_shared=%s is_absolute=%s\n",
+ device, device->name,
+ is_core ? "True" : "False",
+ is_shared ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
+ xf86Info.lastEventTime = xev->time = current = GetTimeInMillis();
+
+ if (!is_core) {
+ if (HAS_MOTION_HISTORY(local)) {
buff = ((char *)local->motion_history +
(sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
- } else
- buff = 0;
+ }
+ }
+
+ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
+ }
+
+ axisvals = val->axisVal;
+ axes = val->axes;
va_start(var, num_valuators);
+ loop_start = first_valuator;
for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = va_arg(var, int);
- break;
- case 1:
- xv->valuator1 = va_arg(var, int);
- break;
- case 2:
- xv->valuator2 = va_arg(var, int);
- break;
- case 3:
- xv->valuator3 = va_arg(var, int);
- break;
- case 4:
- xv->valuator4 = va_arg(var, int);
- break;
- case 5:
- xv->valuator5 = va_arg(var, int);
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- if (!xf86IsCorePointer(device)) {
+
+ valuator[loop%6] = va_arg(var,int);
+
+ if (loop % 6 == 5 || loop == num_valuators - 1) {
+ num = loop % 6 + 1;
+ /*
+ * Adjust first two relative valuators
+ */
+ if (!is_absolute && num_valuators >= 2 && loop_start == 0) {
+
+ dx = valuator[0];
+ dy = valuator[1];
+
+ /*
+ * Accelerate
+ */
+ if (device->ptrfeed && device->ptrfeed->ctrl.num) {
+ /* modeled from xf86Events.c */
+ if (device->ptrfeed->ctrl.threshold) {
+ if ((abs(dx) + abs(dy)) >= device->ptrfeed->ctrl.threshold) {
+ valuator[0] = (dx * device->ptrfeed->ctrl.num) /
+ device->ptrfeed->ctrl.den;
+ valuator[1] = (dy * device->ptrfeed->ctrl.num) /
+ device->ptrfeed->ctrl.den;
+ }
+ }
+ else if (dx || dy) {
+ mult = pow((float)(dx*dx+dy*dy),
+ ((float)(device->ptrfeed->ctrl.num) /
+ (float)(device->ptrfeed->ctrl.den) - 1.0) /
+ 2.0) / 2.0;
+ if (dx) {
+ local->dxremaind = mult * (float)dx + local->dxremaind;
+ valuator[0] = (int)local->dxremaind;
+ local->dxremaind = local->dxremaind - (float)valuator[0];
+ }
+ if (dy) {
+ local->dyremaind = mult * (float)dy + local->dyremaind;
+ valuator[1] = (int)local->dyremaind;
+ local->dyremaind = local->dyremaind - (float)valuator[1];
+ }
+ }
+ DBG(6, ErrorF("xf86PostMotionEvent acceleration v0=%d v1=%d\n",
+ valuator[0], valuator[1]));
+ }
+
+ /*
+ * Map current position back to device space in case
+ * the cursor was warped
+ */
+ if (is_core || is_shared)
+ {
+ miPointerPosition (&x, &y);
+ if (local->reverse_conversion_proc)
+ (*local->reverse_conversion_proc)(local, x, y, axisvals);
+ else
+ {
+ axisvals[0] = x;
+ axisvals[1] = y;
+ }
+ }
+ }
+
+ /*
+ * Update axes
+ */
+ for (i = 0; i < num; i++)
+ {
+ oldaxis[i] = axisvals[loop_start + i];
+ if (is_absolute)
+ axisvals[loop_start + i] = valuator[i];
+ else
+ axisvals[loop_start + i] += valuator[i];
+ }
+
+ /*
+ * Deliver extension event
+ */
+ if (!is_core) {
xev->type = DeviceMotionNotify;
xev->detail = 0;
- xf86Info.lastEventTime = xev->time = current;
xev->deviceid = device->id | MORE_EVENTS;
xv->type = DeviceValuator;
xv->deviceid = device->id;
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
xv->device_state = 0;
+ xv->num_valuators = num;
+ xv->first_valuator = loop_start;
+ memcpy (&xv->valuator0, &axisvals[loop_start],
+ sizeof(INT32)*xv->num_valuators);
if (HAS_MOTION_HISTORY(local)) {
*(Time*)buff = current;
- memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator, &xv->valuator0,
+ memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator,
+ &axisvals[loop_start],
sizeof(INT32)*xv->num_valuators);
}
-
- xf86eqEnqueue(xE);
- } else {
- xf86Info.lastEventTime = current;
+ ENQUEUE(xE);
+ }
- if (num_valuators >= 2) {
- if (is_absolute) {
- miPointerAbsoluteCursor(xv->valuator0, xv->valuator1, xf86Info.lastEventTime);
- } else {
- if (device->ptrfeed) {
- /* modeled from xf86Events.c */
- if ((abs(xv->valuator0) + abs(xv->valuator1)) >= device->ptrfeed->ctrl.threshold) {
- xv->valuator0 = (xv->valuator0 * device->ptrfeed->ctrl.num) / device->ptrfeed->ctrl.den;
- xv->valuator1 = (xv->valuator1 * device->ptrfeed->ctrl.num) / device->ptrfeed->ctrl.den;
- }
- }
- miPointerDeltaCursor(xv->valuator0, xv->valuator1, xf86Info.lastEventTime);
- }
+ /*
+ * Deliver core event
+ */
+ if (is_core ||
+ (is_shared && num_valuators >= 2 && loop_start == 0)) {
+#ifdef XFreeXDGA
+ /*
+ * Let DGA peek at the event and steal it
+ */
+ xev->type = MotionNotify;
+ xev->detail = 0;
+ if (is_absolute)
+ {
+ dx = axisvals[0] - oldaxis[0];
+ dy = axisvals[1] - oldaxis[1];
+ }
+ if (DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum,
+ xE, dx, dy))
+ continue;
+#endif
+ if (!(*local->conversion_proc)(local, loop_start, num,
+ axisvals[0], axisvals[1],
+ axisvals[2], axisvals[3],
+ axisvals[4], axisvals[5],
+ &x, &y))
+ continue;
+
+ if (drag)
+ miPointerAbsoluteCursor (x, y, current);
+ /*
+ * Retrieve the position
+ */
+ miPointerPosition (&x, &y);
+ if (local->reverse_conversion_proc)
+ (*local->reverse_conversion_proc)(local, x, y, axisvals);
+ else
+ {
+ axisvals[0] = x;
+ axisvals[1] = y;
}
- break;
}
+ loop_start += 6;
}
- va_end(var);
}
+ va_end(var);
if (HAS_MOTION_HISTORY(local)) {
local->last = (local->last + 1) % device->valuator->numMotionEvents;
if (local->last == local->first)
local->first = (local->first + 1) % device->valuator->numMotionEvents;
}
+ DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) is_core=%s is_shared=%s\n",
+ device, device->name,
+ is_core ? "True" : "False",
+ is_shared ? "True" : "False"));
}
void
@@ -1007,47 +1058,85 @@ xf86PostProximityEvent(DeviceIntPtr device,
xEvent xE[2];
deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
deviceValuator *xv = (deviceValuator*) xev+1;
+ ValuatorClassPtr val = device->valuator;
+ Bool is_core = xf86IsCorePointer(device);
+ Bool is_absolute = val && ((val->mode & 1) == Relative);
+
+ DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
+ device, device->name, is_in ? "true" : "false",
+ is_core ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
+ if (is_core) {
+ return;
+ }
+
+ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
+ }
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = va_arg(var, int);
- break;
- case 1:
- xv->valuator1 = va_arg(var, int);
- break;
- case 2:
- xv->valuator2 = va_arg(var, int);
- break;
- case 3:
- xv->valuator3 = va_arg(var, int);
- break;
- case 4:
- xv->valuator4 = va_arg(var, int);
- break;
- case 5:
- xv->valuator5 = va_arg(var, int);
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xev->type = is_in ? ProximityIn : ProximityOut;
- xev->detail = 0;
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
-
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- xv->device_state = 0;
+ xev->type = is_in ? ProximityIn : ProximityOut;
+ xev->detail = 0;
+ xev->deviceid = device->id | MORE_EVENTS;
- xf86eqEnqueue(xE);
+ xv->type = DeviceValuator;
+ xv->deviceid = device->id;
+ xv->device_state = 0;
+
+ if ((device->valuator->mode & 1) == Relative) {
+ num_valuators = 0;
+ }
+
+ if (num_valuators != 0) {
+ int *axisvals = val->axisVal;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 1:
+ xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 2:
+ xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 3:
+ xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 4:
+ xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 5:
+ xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ }
+ if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+
+ xv->num_valuators = (loop % 6) + 1;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+ ENQUEUE(xE);
+ }
}
+ va_end(var);
}
- va_end(var);
+ else {
+ /* no valuator */
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+
+ xv->num_valuators = 0;
+ xv->first_valuator = 0;
+ ENQUEUE(xE);
+ }
+ DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
+ device, device->name, is_in ? "true" : "false",
+ is_core ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
}
void
@@ -1064,89 +1153,97 @@ xf86PostButtonEvent(DeviceIntPtr device,
xEvent xE[2];
deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
deviceValuator *xv = (deviceValuator*) xev+1;
- int is_core_pointer = xf86IsCorePointer(device);
-
+ ValuatorClassPtr val = device->valuator;
+ Bool is_core = xf86IsCorePointer(device);
+ Bool is_shared = xf86ShareCorePointer(device);
+
+ DBG(5, ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_core=%s is_shared=%s is_absolute=%s\n",
+ device, device->name, button,
+ is_down ? "True" : "False",
+ is_core ? "True" : "False",
+ is_shared ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
/* Check the core pointer button state not to send an inconsistent
* event. This can happen with the AlwaysCore feature.
*/
- if (is_core_pointer && !xf86CheckButton(button, is_down)) {
+ if ((is_core || is_shared) &&
+ !xf86CheckButton(device->button->map[button], is_down))
+ {
return;
}
- va_start(var, num_valuators);
-
+ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
+ }
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = va_arg(var, int);
- break;
- case 1:
- xv->valuator1 = va_arg(var, int);
- break;
- case 2:
- xv->valuator2 = va_arg(var, int);
- break;
- case 3:
- xv->valuator3 = va_arg(var, int);
- break;
- case 4:
- xv->valuator4 = va_arg(var, int);
- break;
- case 5:
- xv->valuator5 = va_arg(var, int);
- break;
- }
- if (((loop % 6 == 5) || (loop == num_valuators - 1)) &&
- !is_core_pointer) {
- xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease;
- xev->detail = button;
-
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
- /* if the device is in the relative mode we don't have to send valuators */
- xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- xf86eqEnqueue(xE);
- /* if the device is in the relative mode only one event is needed */
- if (!is_absolute) break;
- }
- if (is_core_pointer && loop == 1) {
- int cx, cy;
+ if (!is_core) {
+ xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease;
+ xev->detail = button;
+ xev->deviceid = device->id | MORE_EVENTS;
- GetSpritePosition(&cx, &cy);
-
- /* Try to find the index in the core buttons map
- * which corresponds to the extended button for
- * an AlwaysCore device.
- */
- if (xf86IsAlwaysCore(device)) {
- int loop;
+ xv->type = DeviceValuator;
+ xv->deviceid = device->id;
+ xv->device_state = 0;
- button = device->button->map[button];
-
- for(loop=1; loop<=inputInfo.pointer->button->numButtons; loop++) {
- if (inputInfo.pointer->button->map[loop] == button) {
- button = loop;
- break;
- }
+ if (num_valuators != 0) {
+ int *axisvals = val->axisVal;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 1:
+ xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 2:
+ xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 3:
+ xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 4:
+ xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 5:
+ xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ }
+ if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ xv->num_valuators = (loop % 6) + 1;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+ ENQUEUE(xE);
+
}
}
-
- xE->u.u.type = is_down ? ButtonPress : ButtonRelease;
- xE->u.u.detail = button;
- xE->u.keyButtonPointer.rootY = cx;
- xE->u.keyButtonPointer.rootX = cy;
- xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis();
- xf86eqEnqueue(xE);
- break;
+ va_end(var);
+ }
+ else {
+ /* no valuator */
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ xv->num_valuators = 0;
+ xv->first_valuator = 0;
+ ENQUEUE(xE);
}
}
- va_end(var);
+
+ /* removed rootX/rootY as DIX sets these fields */
+ if (is_core || is_shared) {
+ xE->u.u.type = is_down ? ButtonPress : ButtonRelease;
+ xE->u.u.detail = device->button->map[button];
+ xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis();
+
+#ifdef XFreeXDGA
+ if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, 0, 0))
+#endif
+ ENQUEUE(xE);
+ }
+ DBG(5, ErrorF("xf86PostButtonEvent END\n"));
}
void
@@ -1166,7 +1263,6 @@ xf86PostKeyEvent(DeviceIntPtr device,
va_start(var, num_valuators);
-
for(loop=0; loop<num_valuators; loop++) {
switch (loop % 6) {
case 0:
@@ -1202,7 +1298,7 @@ xf86PostKeyEvent(DeviceIntPtr device,
xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0;
xv->first_valuator = first_valuator + (loop / 6) * 6;
- xf86eqEnqueue(xE);
+ ENQUEUE(xE);
/* if the device is in the relative mode only one event is needed */
if (!is_absolute) break;
}
@@ -1210,6 +1306,28 @@ xf86PostKeyEvent(DeviceIntPtr device,
va_end(var);
}
+void
+xf86PostKeyboardEvent(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down)
+{
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
+
+ if (xf86IsCoreKeyboard(device)) {
+ xev->type = is_down ? KeyPress : KeyRelease;
+ } else {
+ xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
+ }
+ xev->detail = key_code;
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+
+#ifdef XFreeXDGA
+ /* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */
+#endif
+ ENQUEUE(xE);
+}
+
/*
* Motion history management.
*/
@@ -1221,7 +1339,7 @@ xf86MotionHistoryAllocate(LocalDevicePtr local)
if (!HAS_MOTION_HISTORY(local))
return;
-
+ if (local->motion_history) xfree(local->motion_history);
local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
* valuator->numMotionEvents);
local->first = 0;
@@ -1261,4 +1379,102 @@ xf86GetMotionEvents(DeviceIntPtr dev,
return num;
}
+LocalDevicePtr
+xf86FirstLocalDevice()
+{
+ return xf86InputDevs;
+}
+
+/*
+ * Cx - raw data from touch screen
+ * Sxhigh - scaled highest dimension
+ * (remember, this is of rows - 1 because of 0 origin)
+ * Sxlow - scaled lowest dimension
+ * Rxhigh - highest raw value from touch screen calibration
+ * Rxlow - lowest raw value from touch screen calibration
+ *
+ * This function is the same for X or Y coordinates.
+ * You may have to reverse the high and low values to compensate for
+ * different orgins on the touch screen vs X.
+ */
+
+int
+xf86ScaleAxis(int Cx,
+ int Sxhigh,
+ int Sxlow,
+ int Rxhigh,
+ int Rxlow )
+{
+ int X;
+ int dSx = Sxhigh - Sxlow;
+ int dRx = Rxhigh - Rxlow;
+
+ dSx = Sxhigh - Sxlow;
+ if (dRx) {
+ X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
+ }
+ else {
+ X = 0;
+ ErrorF ("Divide by Zero in xf86ScaleAxis");
+ }
+
+ if (X > Sxlow)
+ X = Sxlow;
+ if (X < Sxhigh)
+ X = Sxhigh;
+
+ return (X);
+}
+
+/*
+ * This function checks the given screen against the current screen and
+ * makes changes if appropriate. It should be called from an XInput driver's
+ * ReadInput function before any events are posted, if the device is screen
+ * specific like a touch screen.
+ */
+void
+xf86XInputSetScreen(LocalDevicePtr local,
+ int screen_number,
+ int x,
+ int y)
+{
+ if ((xf86IsCorePointer(local->dev) || xf86ShareCorePointer(local->dev)) &&
+ (miPointerCurrentScreen() != screenInfo.screens[screen_number])) {
+ miPointerSetNewScreen (screen_number, x, y);
+ }
+}
+
+
+void
+xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
+ int resolution, int min_res, int max_res)
+{
+#ifdef XINPUT
+ if (maxval == -1) {
+ if (axnum == 0)
+ maxval = screenInfo.screens[0]->width - 1;
+ else if (axnum == 1)
+ maxval = screenInfo.screens[0]->height - 1;
+ /* else? */
+ }
+ InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
+ max_res);
+#endif
+}
+
+/*
+ * Set the valuator values to be in synch with dix/event.c
+ * DefineInitialRootWindow().
+ */
+void
+xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
+{
+#ifdef XINPUT
+ if (axnum == 0)
+ dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
+ else if (axnum == 1)
+ dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
+#endif
+}
+
/* end of xf86Xinput.c */
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index b2bb8832f..1e9694402 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -1,6 +1,6 @@
-/* $Xorg: xf86Xinput.h,v 1.3 2000/08/17 19:50:31 cpqbld Exp $ */
+/* $XConsortium: xf86Xinput.h /main/11 1996/10/27 11:05:29 kaleb $ */
/*
- * Copyright 1995,1996 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@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
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.14.2.1 1997/05/12 12:52:29 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.35 2002/10/11 01:40:31 dawes Exp $ */
#ifndef _xf86Xinput_h
#define _xf86Xinput_h
@@ -30,251 +30,164 @@
#ifndef NEED_EVENTS
#define NEED_EVENTS
#endif
-#include "X.h"
-#include "Xproto.h"
+#include "xf86str.h"
#include "inputstr.h"
-#include "XI.h"
-#include "XIproto.h"
+#ifdef XINPUT
+#include "extensions/XI.h"
+#include "extensions/XIproto.h"
#include "XIstubs.h"
+#endif
+
+/* Input device flags */
+#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
+#define XI86_CONFIGURED 0x02 /* the device has been configured */
+#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
+/* the device sends Xinput and core pointer events */
+#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
+/* if the device is the core pointer or is sending core events, and
+ * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
+ * (mouse drag action) are sent. This is mainly to allow a touch screen to be
+ * used with netscape and other browsers which do strange things if the mouse
+ * moves between button down and button up. With a touch screen, this motion
+ * is common due to the user's finger moving slightly.
+ */
+#define XI86_SEND_DRAG_EVENTS 0x08
+#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
+#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
+#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
+#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
-#define XI86_NO_OPEN_ON_INIT 1 /* open the device only when needed */
-#define XI86_CONFIGURED 2 /* the device has been configured */
-#define XI86_ALWAYS_CORE 4 /* the device always controls the pointer */
+#define XI_PRIVATE(dev) \
+ (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
-#ifdef PRIVATE
-#undef PRIVATE
+#ifdef DBG
+#undef DBG
#endif
-#define PRIVATE(dev) (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
+#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
#ifdef HAS_MOTION_HISTORY
#undef HAS_MOTION_HISTORY
#endif
#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
-typedef struct _LocalDeviceRec {
- char *name;
- int flags;
- Bool (*device_config)(
-#if NeedNestedPrototypes
- struct _LocalDeviceRec** /*array*/,
- int /*index*/,
- int /*max*/,
- LexPtr /*val*/
-#endif
- );
- Bool (*device_control)(
-#if NeedNestedPrototypes
- DeviceIntPtr /*device*/,
- int /*what*/
-#endif
- );
- void (*read_input)(
-#if NeedNestedPrototypes
- struct _LocalDeviceRec* /*local*/
-#endif
- );
- int (*control_proc)(
-#if NeedNestedPrototypes
- struct _LocalDeviceRec* /*local*/,
- xDeviceCtl* /* control */
-#endif
- );
- void (*close_proc)(
-#if NeedNestedPrototypes
- struct _LocalDeviceRec* /*local*/
-#endif
- );
- int (*switch_mode)(
-#if NeedNestedPrototypes
- ClientPtr /*client*/,
- DeviceIntPtr /*dev*/,
- int /*mode*/
-#endif
- );
- int fd;
- Atom atom;
- DeviceIntPtr dev;
- pointer private;
- int private_flags;
- pointer motion_history;
- ValuatorMotionProcPtr motion_history_proc;
- unsigned int history_size; /* only for configuration purpose */
- unsigned int first;
- unsigned int last;
- char *type_name;
- IntegerFeedbackPtr always_core_feedback;
-} LocalDeviceRec, *LocalDevicePtr;
+#ifdef XINPUT
+/* This holds the input driver entry and module information. */
+typedef struct _InputDriverRec {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
+ IDevPtr dev, int flags);
+ void (*UnInit)(struct _InputDriverRec *drv,
+ struct _LocalDeviceRec *pInfo,
+ int flags);
+ pointer module;
+ int refCount;
+} InputDriverRec, *InputDriverPtr;
+#endif
+
+/* This is to input devices what the ScrnInfoRec is to screens. */
+
+typedef struct _LocalDeviceRec {
+ struct _LocalDeviceRec *next;
+ char * name;
+ int flags;
+
+ Bool (*device_control)(DeviceIntPtr device, int what);
+ void (*read_input)(struct _LocalDeviceRec *local);
+ int (*control_proc)(struct _LocalDeviceRec *local,
+ xDeviceCtl *control);
+ void (*close_proc)(struct _LocalDeviceRec *local);
+ int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
+ int mode);
+ Bool (*conversion_proc)(struct _LocalDeviceRec *local,
+ int first, int num, int v0,
+ int v1, int v2, int v3, int v4,
+ int v5, int *x, int *y);
+ Bool (*reverse_conversion_proc)(
+ struct _LocalDeviceRec *local,
+ int x, int y, int *valuators);
+
+ int fd;
+ Atom atom;
+ DeviceIntPtr dev;
+ pointer private;
+ int private_flags;
+ pointer motion_history;
+ ValuatorMotionProcPtr motion_history_proc;
+ unsigned int history_size; /* only for configuration purpose */
+ unsigned int first;
+ unsigned int last;
+ int old_x;
+ int old_y;
+ float dxremaind;
+ float dyremaind;
+ char * type_name;
+ IntegerFeedbackPtr always_core_feedback;
+ IDevPtr conf_idev;
+ InputDriverPtr drv;
+ pointer module;
+ pointer options;
+} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
typedef struct _DeviceAssocRec
{
- char *config_section_name;
- LocalDevicePtr (*device_allocate)(
-#if NeedNestedPrototypes
- void
-#endif
-);
+ char * config_section_name;
+ LocalDevicePtr (*device_allocate)(void);
} DeviceAssocRec, *DeviceAssocPtr;
-extern int DeviceKeyPress;
-extern int DeviceKeyRelease;
-extern int DeviceButtonPress;
-extern int DeviceButtonRelease;
-extern int DeviceMotionNotify;
-extern int DeviceValuator;
-extern int ProximityIn;
-extern int ProximityOut;
-
-extern int
-xf86IsCorePointer(
-#if NeedFunctionPrototypes
- DeviceIntPtr /*dev*/
-#endif
-);
-
-extern int
-xf86IsCoreKeyboard(
-#if NeedFunctionPrototypes
- DeviceIntPtr /*dev*/
-#endif
-);
-
-extern void
-xf86AlwaysCore(
-#if NeedFunctionPrototypes
- LocalDevicePtr /*local*/,
- Bool /*always*/
-#endif
-);
-
-void
-xf86configExtendedInputSection(
-#ifdef NeedFunctionPrototypes
- LexPtr /* val */
-#endif
-);
-
-void
-xf86AddDeviceAssoc(
-#ifdef NeedFunctionPrototypes
- DeviceAssocPtr /* assoc */
-#endif
-);
-
-void
-InitExtInput(
-#ifdef NeedFunctionPrototypes
- void
-#endif
-);
-
-Bool
-xf86eqInit (
-#ifdef NeedFunctionPrototypes
- DevicePtr /* pKbd */,
- DevicePtr /* pPtr */
-#endif
-);
-
-void
-xf86eqEnqueue (
-#ifdef NeedFunctionPrototypes
- struct _xEvent * /*event */
-#endif
-);
-
-void
-xf86eqProcessInputEvents (
-#ifdef NeedFunctionPrototypes
- void
-#endif
-);
-
-void
-xf86PostMotionEvent(
-#if NeedVarargsPrototypes
- DeviceIntPtr /*device*/,
- int /*is_absolute*/,
- int /*first_valuator*/,
- int /*num_valuators*/,
- ...
-#endif
-);
-
-void
-xf86PostProximityEvent(
-#if NeedVarargsPrototypes
- DeviceIntPtr /*device*/,
- int /*is_in*/,
- int /*first_valuator*/,
- int /*num_valuators*/,
- ...
-#endif
-);
-
-void
-xf86PostButtonEvent(
-#if NeedVarargsPrototypes
- DeviceIntPtr /*device*/,
- int /*is_absolute*/,
- int /*button*/,
- int /*is_down*/,
- int /*first_valuator*/,
- int /*num_valuators*/,
- ...
-#endif
-);
-
-void
-xf86PostKeyEvent(
-#if NeedVarargsPrototypes
- DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...
-#endif
-);
-
-void
-xf86AddDeviceAssoc(
-#if NeedFunctionPrototypes
- DeviceAssocPtr /*assoc*/
-#endif
-);
-
-void
-xf86MotionHistoryAllocate(
-#if NeedFunctionPrototypes
- LocalDevicePtr local
-#endif
-);
-
-int
-xf86GetMotionEvents(
-#if NeedFunctionPrototypes
- DeviceIntPtr dev,
- xTimecoord *buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen
-#endif
-);
-
-void
-xf86XinputFinalizeInit(
-#if NeedFunctionPrototypes
- DeviceIntPtr dev
-#endif
-);
-
-Bool
-xf86CheckButton(
-#if NeedFunctionPrototypes
- int button,
- int down
-#endif
-);
+/* xf86Globals.c */
+extern InputInfoPtr xf86InputDevs;
+
+/* xf86Xinput.c */
+int xf86IsCorePointer(DeviceIntPtr dev);
+int xf86IsCoreKeyboard(DeviceIntPtr dev);
+void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
+#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
+
+void InitExtInput(void);
+Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
+void xf86eqEnqueue(struct _xEvent *event);
+void xf86eqProcessInputEvents (void);
+void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
+void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
+ int first_valuator, int num_valuators, ...);
+void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
+ int first_valuator, int num_valuators, ...);
+void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, int first_valuator, int num_valuators,
+ ...);
+void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator, int num_valuators,
+ ...);
+void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
+ int is_down);
+void xf86MotionHistoryAllocate(LocalDevicePtr local);
+int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
+ unsigned long start, unsigned long stop,
+ ScreenPtr pScreen);
+void xf86XinputFinalizeInit(DeviceIntPtr dev);
+Bool xf86CheckButton(int button, int down);
+void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
+LocalDevicePtr xf86FirstLocalDevice(void);
+int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
+void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
+void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
+void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
+ int maxval, int resolution, int min_res,
+ int max_res);
+void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
+void xf86AddEnabledDevice(InputInfoPtr pInfo);
+void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
+
+/* xf86Helper.c */
+void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
+void xf86DeleteInputDriver(int drvIndex);
+InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+void xf86DeleteInput(InputInfoPtr pInp, int flags);
+
+/* xf86Option.c */
+void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
+ pointer extraOpts);
#endif /* _xf86Xinput_h */
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 8abab86a5..f9882f2f1 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/Xext/xf86vmode.c,v 3.25 1996/10/16 14:37:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/Xext/xf86vmode.c,v 3.54 2002/12/22 00:46:51 dawes Exp $ */
/*
@@ -43,27 +43,25 @@ from Kaleb S. KEITHLEY
#include "servermd.h"
#define _XF86VIDMODE_SERVER_
#include "xf86vmstr.h"
-#include "Xfuncproto.h"
-#include "../hw/xfree86/common/xf86.h"
-#include "../hw/xfree86/common/xf86Priv.h"
+#include "swaprep.h"
+#include "xf86.h"
+#include "vidmodeproc.h"
-extern int xf86ScreenIndex;
-extern Bool xf86VidModeEnabled;
-extern Bool xf86VidModeAllowNonLocal;
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
-static int vidmodeErrorBase;
+static int VidModeErrorBase;
+static int VidModeGeneration = 0;
+static int VidModeClientPrivateIndex;
-static int ProcXF86VidModeDispatch(
-#if NeedFunctionPrototypes
- ClientPtr /* client */
-#endif
-);
+/* This holds the client's version information */
+typedef struct {
+ int major;
+ int minor;
+} VidModePrivRec, *VidModePrivPtr;
-static int SProcXF86VidModeDispatch(
-#if NeedFunctionPrototypes
- ClientPtr /* client */
-#endif
-);
+#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr)
static void XF86VidModeResetProc(
#if NeedFunctionPrototypes
@@ -71,20 +69,60 @@ static void XF86VidModeResetProc(
#endif
);
-extern void Swap32Write(); /* XXX should be in header file */
+static DISPATCH_PROC(ProcXF86VidModeDispatch);
+static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines);
+static DISPATCH_PROC(ProcXF86VidModeGetModeLine);
+static DISPATCH_PROC(ProcXF86VidModeGetMonitor);
+static DISPATCH_PROC(ProcXF86VidModeLockModeSwitch);
+static DISPATCH_PROC(ProcXF86VidModeAddModeLine);
+static DISPATCH_PROC(ProcXF86VidModeDeleteModeLine);
+static DISPATCH_PROC(ProcXF86VidModeModModeLine);
+static DISPATCH_PROC(ProcXF86VidModeValidateModeLine);
+static DISPATCH_PROC(ProcXF86VidModeQueryVersion);
+static DISPATCH_PROC(ProcXF86VidModeSwitchMode);
+static DISPATCH_PROC(ProcXF86VidModeSwitchToMode);
+static DISPATCH_PROC(ProcXF86VidModeGetViewPort);
+static DISPATCH_PROC(ProcXF86VidModeSetViewPort);
+static DISPATCH_PROC(ProcXF86VidModeGetDotClocks);
+static DISPATCH_PROC(ProcXF86VidModeSetGamma);
+static DISPATCH_PROC(ProcXF86VidModeGetGamma);
+static DISPATCH_PROC(ProcXF86VidModeSetClientVersion);
+static DISPATCH_PROC(ProcXF86VidModeGetGammaRamp);
+static DISPATCH_PROC(ProcXF86VidModeSetGammaRamp);
+static DISPATCH_PROC(ProcXF86VidModeGetGammaRampSize);
+static DISPATCH_PROC(SProcXF86VidModeDispatch);
+static DISPATCH_PROC(SProcXF86VidModeGetAllModeLines);
+static DISPATCH_PROC(SProcXF86VidModeGetModeLine);
+static DISPATCH_PROC(SProcXF86VidModeGetMonitor);
+static DISPATCH_PROC(SProcXF86VidModeLockModeSwitch);
+static DISPATCH_PROC(SProcXF86VidModeAddModeLine);
+static DISPATCH_PROC(SProcXF86VidModeDeleteModeLine);
+static DISPATCH_PROC(SProcXF86VidModeModModeLine);
+static DISPATCH_PROC(SProcXF86VidModeValidateModeLine);
+static DISPATCH_PROC(SProcXF86VidModeQueryVersion);
+static DISPATCH_PROC(SProcXF86VidModeSwitchMode);
+static DISPATCH_PROC(SProcXF86VidModeSwitchToMode);
+static DISPATCH_PROC(SProcXF86VidModeGetViewPort);
+static DISPATCH_PROC(SProcXF86VidModeSetViewPort);
+static DISPATCH_PROC(SProcXF86VidModeGetDotClocks);
+static DISPATCH_PROC(SProcXF86VidModeSetGamma);
+static DISPATCH_PROC(SProcXF86VidModeGetGamma);
+static DISPATCH_PROC(SProcXF86VidModeSetClientVersion);
+static DISPATCH_PROC(SProcXF86VidModeGetGammaRamp);
+static DISPATCH_PROC(SProcXF86VidModeSetGammaRamp);
+static DISPATCH_PROC(SProcXF86VidModeGetGammaRampSize);
static unsigned char XF86VidModeReqCode = 0;
+
/* The XF86VIDMODE_EVENTS code is far from complete */
#ifdef XF86VIDMODE_EVENTS
static int XF86VidModeEventBase = 0;
static void SXF86VidModeNotifyEvent();
-#if NeedFunctionPrototypes
xXF86VidModeNotifyEvent * /* from */,
xXF86VidModeNotifyEvent * /* to */
-#endif
);
extern WindowPtr *WindowTable;
@@ -114,25 +152,59 @@ static int ScreenPrivateIndex;
#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
-#define New(t) ((t *) xalloc (sizeof (t)))
+#define New(t) (xalloc (sizeof (t)))
+#endif
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
#endif
void
-XFree86VidModeExtensionInit()
+XFree86VidModeExtensionInit(void)
{
ExtensionEntry* extEntry;
-#ifdef XF86VIDMODE_EVENTS
+ ScreenPtr pScreen;
int i;
- ScreenPtr pScreen;
+ Bool enabled = FALSE;
+
+ DEBUG_P("XFree86VidModeExtensionInit");
+#ifdef XF86VIDMODE_EVENTS
EventType = CreateNewResourceType(XF86VidModeFreeEvents);
ScreenPrivateIndex = AllocateScreenPrivateIndex ();
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
+#endif
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if (VidModeExtensionInit(pScreen))
+ enabled = TRUE;
+#ifdef XF86VIDMODE_EVENTS
SetScreenPrivate (pScreen, NULL);
- }
#endif
+ }
+ /* This means that the DDX doesn't want the vidmode extension enabled */
+ if (!enabled)
+ return;
+
+ /*
+ * Allocate a client private index to hold the client's version
+ * information.
+ */
+ if (VidModeGeneration != serverGeneration) {
+ VidModeClientPrivateIndex = AllocateClientPrivateIndex();
+ /*
+ * Allocate 0 length, and use the private to hold a pointer to our
+ * VidModePrivRec.
+ */
+ if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) {
+ ErrorF("XFree86VidModeExtensionInit: "
+ "AllocateClientPrivate failed\n");
+ return;
+ }
+ VidModeGeneration = serverGeneration;
+ }
if (
#ifdef XF86VIDMODE_EVENTS
@@ -146,10 +218,10 @@ XFree86VidModeExtensionInit()
XF86VidModeResetProc,
StandardMinorOpcode))) {
XF86VidModeReqCode = (unsigned char)extEntry->base;
- vidmodeErrorBase = extEntry->errorBase;
+ VidModeErrorBase = extEntry->errorBase;
#ifdef XF86VIDMODE_EVENTS
XF86VidModeEventBase = extEntry->eventBase;
- EventSwapVector[XF86VidModeEventBase] = SXF86VidModeNotifyEvent;
+ EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
#endif
}
}
@@ -161,6 +233,18 @@ XF86VidModeResetProc (extEntry)
{
}
+static int
+ClientMajorVersion(ClientPtr client)
+{
+ VidModePrivPtr pPriv;
+
+ pPriv = VMPRIV(client);
+ if (!pPriv)
+ return 0;
+ else
+ return pPriv->major;
+}
+
#ifdef XF86VIDMODE_EVENTS
static void
CheckScreenPrivate (pScreen)
@@ -194,9 +278,7 @@ MakeScreenPrivate (pScreen)
}
static unsigned long
-getEventMask (pScreen, client)
- ScreenPtr pScreen;
- ClientPtr client;
+getEventMask (ScreenPtr pScreen, ClientPtr client)
{
SetupScreen(pScreen);
XF86VidModeEventPtr pEv;
@@ -210,10 +292,7 @@ getEventMask (pScreen, client)
}
static Bool
-setEventMask (pScreen, client, mask)
- ScreenPtr pScreen;
- ClientPtr client;
- unsigned long mask;
+setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
{
SetupScreen(pScreen);
XF86VidModeEventPtr pEv, *pPrev;
@@ -251,9 +330,7 @@ setEventMask (pScreen, client, mask)
}
static int
-XF86VidModeFreeEvents (value, id)
- pointer value;
- XID id;
+XF86VidModeFreeEvents(pointer value, XID id)
{
XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
ScreenPtr pScreen = pOld->screen;
@@ -274,10 +351,7 @@ XF86VidModeFreeEvents (value, id)
}
static void
-SendXF86VidModeNotify (pScreen, state, forced)
- ScreenPtr pScreen;
- int state;
- Bool forced;
+SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
{
XF86VidModeScreenPrivatePtr pPriv;
XF86VidModeEventPtr pEv;
@@ -312,8 +386,8 @@ SendXF86VidModeNotify (pScreen, state, forced)
}
static void
-SXF86VidModeNotifyEvent (from, to)
- xXF86VidModeNotifyEvent *from, *to;
+SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
+ xXF86VidModeNotifyEvent *to)
{
to->type = from->type;
to->state = from->state;
@@ -326,12 +400,13 @@ SXF86VidModeNotifyEvent (from, to)
#endif
static int
-ProcXF86VidModeQueryVersion(client)
- register ClientPtr client;
+ProcXF86VidModeQueryVersion(ClientPtr client)
{
xXF86VidModeQueryVersionReply rep;
register int n;
+ DEBUG_P("XF86VidModeQueryVersion");
+
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
@@ -349,43 +424,66 @@ ProcXF86VidModeQueryVersion(client)
}
static int
-ProcXF86VidModeGetModeLine(client)
- register ClientPtr client;
+ProcXF86VidModeGetModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeGetModeLineReq);
xXF86VidModeGetModeLineReply rep;
+ xXF86OldVidModeGetModeLineReply oldrep;
+ pointer mode;
register int n;
- ScrnInfoPtr vptr;
- DisplayModePtr mptr;
- int privsize;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- mptr = vptr->modes;
+ int dotClock;
+ int ver;
- if (!mptr->Private)
- privsize = 0;
- else
- privsize = mptr->PrivSize;
+ DEBUG_P("XF86VidModeGetModeline");
+ ver = ClientMajorVersion(client);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
rep.type = X_Reply;
- rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xGenericReply) +
- privsize * sizeof(INT32)) >> 2;
+ if (ver < 2) {
+ rep.length = (SIZEOF(xXF86OldVidModeGetModeLineReply) -
+ SIZEOF(xGenericReply)) >> 2;
+ } else {
+ rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) -
+ SIZEOF(xGenericReply)) >> 2;
+ }
rep.sequenceNumber = client->sequence;
- rep.dotclock = vptr->clock[mptr->Clock];
- rep.hdisplay = mptr->HDisplay;
- rep.hsyncstart = mptr->HSyncStart;
- rep.hsyncend = mptr->HSyncEnd;
- rep.htotal = mptr->HTotal;
- rep.vdisplay = mptr->VDisplay;
- rep.vsyncstart = mptr->VSyncStart;
- rep.vsyncend = mptr->VSyncEnd;
- rep.vtotal = mptr->VTotal;
- rep.flags = mptr->Flags;
- rep.privsize = privsize;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ rep.dotclock = dotClock;
+ rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("GetModeLine - scrn: %d clock: %d\n",
+ stuff->screen, rep.dotclock);
+ ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ rep.hdisplay, rep.hsyncstart,
+ rep.hsyncend, rep.htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ rep.vdisplay, rep.vsyncstart, rep.vsyncend,
+ rep.vtotal, rep.flags);
+ }
+
+ /*
+ * Older servers sometimes had server privates that the VidMode
+ * extention made available. So to be compatiable pretend that
+ * there are no server privates to pass to the client
+ */
+ rep.privsize = 0;
+
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
@@ -394,6 +492,7 @@ ProcXF86VidModeGetModeLine(client)
swaps(&rep.hsyncstart, n);
swaps(&rep.hsyncend, n);
swaps(&rep.htotal, n);
+ swaps(&rep.hskew, n);
swaps(&rep.vdisplay, n);
swaps(&rep.vsyncstart, n);
swaps(&rep.vsyncend, n);
@@ -401,42 +500,66 @@ ProcXF86VidModeGetModeLine(client)
swapl(&rep.flags, n);
swapl(&rep.privsize, n);
}
- WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply), (char *)&rep);
- if (privsize) {
- client->pSwapReplyFunc = Swap32Write;
- WriteSwappedDataToClient(client, privsize * sizeof(INT32),
- mptr->Private);
+ if (ver < 2) {
+ oldrep.type = rep.type;
+ oldrep.sequenceNumber = rep.sequenceNumber;
+ oldrep.length = rep.length;
+ oldrep.dotclock = rep.dotclock;
+ oldrep.hdisplay = rep.hdisplay;
+ oldrep.hsyncstart = rep.hsyncstart;
+ oldrep.hsyncend = rep.hsyncend;
+ oldrep.htotal = rep.htotal;
+ oldrep.vdisplay = rep.vdisplay;
+ oldrep.vsyncstart = rep.vsyncstart;
+ oldrep.vsyncend = rep.vsyncend;
+ oldrep.vtotal = rep.vtotal;
+ oldrep.flags = rep.flags;
+ oldrep.privsize = rep.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
+ (char *)&oldrep);
+ } else {
+ WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
+ (char *)&rep);
}
return (client->noClientException);
}
static int
-ProcXF86VidModeGetAllModeLines(client)
- register ClientPtr client;
+ProcXF86VidModeGetAllModeLines(ClientPtr client)
{
REQUEST(xXF86VidModeGetAllModeLinesReq);
xXF86VidModeGetAllModeLinesReply rep;
xXF86VidModeModeInfo mdinf;
+ xXF86OldVidModeModeInfo oldmdinf;
+ pointer mode;
+ int modecount, dotClock;
register int n;
- ScrnInfoPtr vptr;
- DisplayModePtr mptr, curmptr;
- int privsize, modecount=1;
+ int ver;
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
+ DEBUG_P("XF86VidModeGetAllModelines");
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- curmptr = mptr = vptr->modes;
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
- while (mptr->next != curmptr) {
- ++modecount;
- mptr = mptr->next;
- }
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+ ver = ClientMajorVersion(client);
+
+ modecount = VidModeGetNumOfModes(stuff->screen);
+ if (modecount < 1)
+ return (VidModeErrorBase + XF86VidModeExtensionDisabled);
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
rep.type = X_Reply;
- rep.length = (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xGenericReply) +
- modecount * sizeof(xXF86VidModeModeInfo)) >> 2;
+ rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+ SIZEOF(xGenericReply);
+ if (ver < 2)
+ rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
+ else
+ rep.length += modecount * sizeof(xXF86VidModeModeInfo);
+ rep.length >>= 2;
rep.sequenceNumber = client->sequence;
rep.modecount = modecount;
if (client->swapped) {
@@ -445,67 +568,113 @@ ProcXF86VidModeGetAllModeLines(client)
swapl(&rep.modecount, n);
}
WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
- mptr = curmptr;
+
do {
- if (!mptr->Private)
- privsize = 0;
- else
- privsize = mptr->PrivSize;
-
- mdinf.dotclock = vptr->clock[mptr->Clock];
- mdinf.hdisplay = mptr->HDisplay;
- mdinf.hsyncstart = mptr->HSyncStart;
- mdinf.hsyncend = mptr->HSyncEnd;
- mdinf.htotal = mptr->HTotal;
- mdinf.vdisplay = mptr->VDisplay;
- mdinf.vsyncstart = mptr->VSyncStart;
- mdinf.vsyncend = mptr->VSyncEnd;
- mdinf.vtotal = mptr->VTotal;
- mdinf.flags = mptr->Flags;
- mdinf.privsize = privsize;
+ mdinf.dotclock = dotClock;
+ mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+ mdinf.privsize = 0;
if (client->swapped) {
swapl(&mdinf.dotclock, n);
swaps(&mdinf.hdisplay, n);
swaps(&mdinf.hsyncstart, n);
swaps(&mdinf.hsyncend, n);
swaps(&mdinf.htotal, n);
+ swaps(&mdinf.hskew, n);
swaps(&mdinf.vdisplay, n);
swaps(&mdinf.vsyncstart, n);
swaps(&mdinf.vsyncend, n);
swaps(&mdinf.vtotal, n);
swapl(&mdinf.flags, n);
swapl(&mdinf.privsize, n);
- }
- WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
- mptr = mptr->next;
- } while (mptr != curmptr);
+ }
+ if (ver < 2) {
+ oldmdinf.dotclock = mdinf.dotclock;
+ oldmdinf.hdisplay = mdinf.hdisplay;
+ oldmdinf.hsyncstart = mdinf.hsyncstart;
+ oldmdinf.hsyncend = mdinf.hsyncend;
+ oldmdinf.htotal = mdinf.htotal;
+ oldmdinf.vdisplay = mdinf.vdisplay;
+ oldmdinf.vsyncstart = mdinf.vsyncstart;
+ oldmdinf.vsyncend = mdinf.vsyncend;
+ oldmdinf.vtotal = mdinf.vtotal;
+ oldmdinf.flags = mdinf.flags;
+ oldmdinf.privsize = mdinf.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
+ (char *)&oldmdinf);
+ } else {
+ WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
+ }
+
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
return (client->noClientException);
}
-#define CLOCKSPD(clk,scrp) ((clk>MAXCLOCKS)? clk: scrp->clock[clk])
-#define MODEMATCH(mptr,stuff,scrp) \
- (CLOCKSPD(mptr->Clock,scrp) == CLOCKSPD(stuff->dotclock,scrp) \
- && mptr->HDisplay == stuff->hdisplay \
- && mptr->HSyncStart== stuff->hsyncstart \
- && mptr->HSyncEnd == stuff->hsyncend \
- && mptr->HTotal == stuff->htotal \
- && mptr->VDisplay == stuff->vdisplay \
- && mptr->VSyncStart== stuff->vsyncstart \
- && mptr->VSyncEnd == stuff->vsyncend \
- && mptr->VTotal == stuff->vtotal \
- && mptr->Flags == stuff->flags )
+#define MODEMATCH(mode,stuff) \
+ (VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \
+ && VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \
+ && VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \
+ && VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \
+ && VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \
+ && VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \
+ && VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \
+ && VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
+ && VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
static int
-ProcXF86VidModeAddModeLine(client)
- register ClientPtr client;
+ProcXF86VidModeAddModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeAddModeLineReq);
- ScrnInfoPtr vptr;
- DisplayModePtr curmptr, mptr, newmptr;
- DisplayModeRec modetmp;
+ xXF86OldVidModeAddModeLineReq *oldstuff =
+ (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ xXF86VidModeAddModeLineReq newstuff;
+ pointer mode;
int len;
-
- if (xf86Verbose) {
+ int dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeAddModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ stuff->after_dotclock = oldstuff->after_dotclock;
+ stuff->after_hdisplay = oldstuff->after_hdisplay;
+ stuff->after_hsyncstart = oldstuff->after_hsyncstart;
+ stuff->after_hsyncend = oldstuff->after_hsyncend;
+ stuff->after_htotal = oldstuff->after_htotal;
+ stuff->after_hskew = 0;
+ stuff->after_vdisplay = oldstuff->after_vdisplay;
+ stuff->after_vsyncstart = oldstuff->after_vsyncstart;
+ stuff->after_vsyncend = oldstuff->after_vsyncend;
+ stuff->after_vtotal = oldstuff->after_vtotal;
+ stuff->after_flags = oldstuff->after_flags;
+ }
+ if (xf86GetVerbosity() > 1) {
ErrorF("AddModeLine - scrn: %d clock: %d\n",
stuff->screen, stuff->dotclock);
ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
@@ -523,17 +692,20 @@ ProcXF86VidModeAddModeLine(client)
stuff->after_vdisplay, stuff->after_vsyncstart,
stuff->after_vsyncend, stuff->after_vtotal, stuff->after_flags);
}
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- curmptr = mptr = vptr->modes;
- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2);
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeAddModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2);
+ }
if (len != stuff->privsize)
return BadLength;
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
if (stuff->hsyncstart < stuff->hdisplay ||
stuff->hsyncend < stuff->hsyncstart ||
stuff->htotal < stuff->hsyncend ||
@@ -552,96 +724,103 @@ ProcXF86VidModeAddModeLine(client)
if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
Bool found = FALSE;
- do {
- if (MODEMATCH(mptr, stuff, vptr)) {
- found = TRUE;
- break;
- }
- } while ((mptr = mptr->next) != curmptr);
+ if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
+ do {
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
+ == dotClock) && MODEMATCH(mode, stuff)) {
+ found = TRUE;
+ break;
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+ }
if (!found)
return BadValue;
}
- newmptr = (DisplayModePtr) xalloc(sizeof(DisplayModeRec));
-
- newmptr->Clock = stuff->dotclock;
- newmptr->CrtcHDisplay = newmptr->HDisplay = stuff->hdisplay;
- newmptr->CrtcHSyncStart= newmptr->HSyncStart = stuff->hsyncstart;
- newmptr->CrtcHSyncEnd = newmptr->HSyncEnd = stuff->hsyncend;
- newmptr->CrtcHTotal = newmptr->HTotal = stuff->htotal;
- newmptr->CrtcVDisplay = newmptr->VDisplay = stuff->vdisplay;
- newmptr->CrtcVSyncStart= newmptr->VSyncStart = stuff->vsyncstart;
- newmptr->CrtcVSyncEnd = newmptr->VSyncEnd = stuff->vsyncend;
- newmptr->CrtcVTotal = newmptr->VTotal = stuff->vtotal;
- newmptr->Flags = stuff->flags;
-#if 0
- newmptr->CrtcHSkew = newmptr->HSkew = stuff->hskew;
-#endif
- newmptr->CrtcHAdjusted = FALSE;
- newmptr->CrtcVAdjusted = FALSE;
- newmptr->name = "";
- newmptr->Private = NULL;
- if (stuff->privsize) {
- if (xf86Verbose)
- ErrorF("AddModeLine - Request includes privates\n");
- newmptr->Private =
- (INT32 *) ALLOCATE_LOCAL(stuff->privsize * sizeof(INT32));
- memcpy(newmptr->Private, &stuff[1], stuff->privsize*sizeof(INT32));
- }
+
+ mode = VidModeCreateMode();
+ if (mode == NULL)
+ return BadValue;
+
+ VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
+
+ if (stuff->privsize)
+ ErrorF("AddModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
- switch (xf86CheckMode(vptr, newmptr, vptr->monitor, FALSE)) {
+ switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
+ case MODE_OK:
+ break;
case MODE_HSYNC:
- xfree(newmptr->Private);
- xfree(newmptr);
- return vidmodeErrorBase + XF86VidModeBadHTimings;
+ case MODE_H_ILLEGAL:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadHTimings;
case MODE_VSYNC:
- xfree(newmptr->Private);
- xfree(newmptr);
- return vidmodeErrorBase + XF86VidModeBadVTimings;
+ case MODE_V_ILLEGAL:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
/* Check that the driver is happy with the mode */
- if (vptr->ValidMode(newmptr, xf86Verbose, MODE_VID) != MODE_OK) {
- xfree(newmptr->Private);
- xfree(newmptr);
- return vidmodeErrorBase + XF86VidModeModeUnsuitable;
- }
-
- if (newmptr->Flags & V_DBLSCAN)
- {
- newmptr->CrtcVDisplay *= 2;
- newmptr->CrtcVSyncStart *= 2;
- newmptr->CrtcVSyncEnd *= 2;
- newmptr->CrtcVTotal *= 2;
- newmptr->CrtcVAdjusted = TRUE;
+ if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
- newmptr->next = mptr->next;
- newmptr->prev = mptr;
- mptr->next = newmptr;
- newmptr->next->prev = newmptr;
-
-#if 0 /* Do we want this? */
- (vptr->SwitchMode)(newmptr);
-#endif
-
- if (xf86Verbose)
+ VidModeSetCrtcForMode(stuff->screen, mode);
+
+ VidModeAddModeline(stuff->screen, mode);
+
+ if (xf86GetVerbosity() > 1)
ErrorF("AddModeLine - Succeeded\n");
- return(client->noClientException);
+ return client->noClientException;
}
static int
-ProcXF86VidModeDeleteModeLine(client)
- register ClientPtr client;
+ProcXF86VidModeDeleteModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeDeleteModeLineReq);
- ScrnInfoPtr vptr;
- DisplayModePtr curmptr, mptr;
- DisplayModeRec modetmp;
- int len;
-
- if (xf86Verbose) {
+ xXF86OldVidModeDeleteModeLineReq *oldstuff =
+ (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ xXF86VidModeDeleteModeLineReq newstuff;
+ pointer mode;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeDeleteModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
ErrorF("DeleteModeLine - scrn: %d clock: %d\n",
stuff->screen, stuff->dotclock, stuff->dotclock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
@@ -651,65 +830,110 @@ ProcXF86VidModeDeleteModeLine(client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, stuff->flags);
}
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- curmptr = mptr = vptr->modes;
-
- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2);
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeDeleteModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2);
+ }
if (len != stuff->privsize) {
- ErrorF("req_len = %d, sizeof(Req) = %d, privsize = %d, len = %d, length = %d\n",
- client->req_len, sizeof(xXF86VidModeDeleteModeLineReq)>>2, stuff->privsize, len, stuff->length);
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("req_len = %d, sizeof(Req) = %d, privsize = %d, len = %d, length = %d\n",
+ client->req_len, sizeof(xXF86VidModeDeleteModeLineReq)>>2, stuff->privsize, len, stuff->length);
+ }
return BadLength;
}
- ErrorF("Checking against clock: %d (%d)\n",
- mptr->Clock, CLOCKSPD(mptr->Clock, vptr));
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- mptr->HDisplay, mptr->HSyncStart,
- mptr->HSyncEnd, mptr->HTotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- mptr->VDisplay, mptr->VSyncStart, mptr->VSyncEnd,
- mptr->VTotal, mptr->Flags);
- if (MODEMATCH(mptr, stuff, vptr))
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
- while ((mptr = mptr->next) != curmptr) {
+ if (xf86GetVerbosity() > 1) {
ErrorF("Checking against clock: %d (%d)\n",
- mptr->Clock, CLOCKSPD(mptr->Clock, vptr));
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- mptr->HDisplay, mptr->HSyncStart,
- mptr->HSyncEnd, mptr->HTotal);
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- mptr->VDisplay, mptr->VSyncStart, mptr->VSyncEnd,
- mptr->VTotal, mptr->Flags);
- if (MODEMATCH(mptr, stuff, vptr)) {
- mptr->prev->next = mptr->next;
- mptr->next->prev = mptr->prev;
- xfree(mptr->name);
- xfree(mptr->Private);
- xfree(mptr);
- if (xf86Verbose)
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff))
+ return BadValue;
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ do {
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+ VidModeDeleteModeline(stuff->screen, mode);
+ if (xf86GetVerbosity())
ErrorF("DeleteModeLine - Succeeded\n");
return(client->noClientException);
}
- }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
return BadValue;
}
static int
-ProcXF86VidModeModModeLine(client)
- register ClientPtr client;
+ProcXF86VidModeModModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeModModeLineReq);
- ScrnInfoPtr vptr;
- DisplayModePtr mptr;
- DisplayModeRec modetmp;
- int len;
-
- if (xf86Verbose) {
+ xXF86OldVidModeModModeLineReq *oldstuff =
+ (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ xXF86VidModeModModeLineReq newstuff;
+ pointer mode, modetmp;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeModModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2 ) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->screen, stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
@@ -717,14 +941,14 @@ ProcXF86VidModeModModeLine(client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, stuff->flags);
}
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- mptr = vptr->modes;
- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2);
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeModModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2);
+ }
if (len != stuff->privsize)
return BadLength;
@@ -736,104 +960,103 @@ ProcXF86VidModeModModeLine(client)
stuff->vtotal < stuff->vsyncend)
return BadValue;
- memcpy(&modetmp, mptr, sizeof(DisplayModeRec));
-
- modetmp.HDisplay = stuff->hdisplay;
- modetmp.HSyncStart = stuff->hsyncstart;
- modetmp.HSyncEnd = stuff->hsyncend;
- modetmp.HTotal = stuff->htotal;
- modetmp.VDisplay = stuff->vdisplay;
- modetmp.VSyncStart = stuff->vsyncstart;
- modetmp.VSyncEnd = stuff->vsyncend;
- modetmp.VTotal = stuff->vtotal;
- modetmp.Flags = stuff->flags;
- if (mptr->PrivSize && stuff->privsize) {
- if (mptr->PrivSize != stuff->privsize)
- return BadValue;
- }
- if (mptr->PrivSize && mptr->Private) {
- modetmp.Private =
- (INT32 *)ALLOCATE_LOCAL(mptr->PrivSize * sizeof(INT32));
- if (stuff->privsize) {
- if (xf86Verbose)
- ErrorF("ModModeLine - Request includes privates\n");
- memcpy(modetmp.Private, &stuff[1], mptr->PrivSize * sizeof(INT32));
- } else
- memcpy(modetmp.Private, mptr->Private,
- mptr->PrivSize * sizeof(INT32));
- }
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ modetmp = VidModeCreateMode();
+ VidModeCopyMode(mode, modetmp);
+
+ VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
+
+ if (stuff->privsize)
+ ErrorF("ModModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
- switch (xf86CheckMode(vptr, &modetmp, vptr->monitor, FALSE)) {
+ switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
+ case MODE_OK:
+ break;
case MODE_HSYNC:
- DEALLOCATE_LOCAL(modetmp.Private);
- return vidmodeErrorBase + XF86VidModeBadHTimings;
+ case MODE_H_ILLEGAL:
+ return VidModeErrorBase + XF86VidModeBadHTimings;
case MODE_VSYNC:
- DEALLOCATE_LOCAL(modetmp.Private);
- return vidmodeErrorBase + XF86VidModeBadVTimings;
+ case MODE_V_ILLEGAL:
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
/* Check that the driver is happy with the mode */
- if (vptr->ValidMode(&modetmp, xf86Verbose, MODE_VID) != MODE_OK) {
- DEALLOCATE_LOCAL(modetmp.Private);
- return vidmodeErrorBase + XF86VidModeModeUnsuitable;
- }
-
- DEALLOCATE_LOCAL(modetmp.Private);
-
- mptr->HDisplay = stuff->hdisplay;
- mptr->HSyncStart = stuff->hsyncstart;
- mptr->HSyncEnd = stuff->hsyncend;
- mptr->HTotal = stuff->htotal;
- mptr->VDisplay = stuff->vdisplay;
- mptr->VSyncStart = stuff->vsyncstart;
- mptr->VSyncEnd = stuff->vsyncend;
- mptr->VTotal = stuff->vtotal;
- mptr->Flags = stuff->flags;
- mptr->CrtcHDisplay = stuff->hdisplay;
- mptr->CrtcHSyncStart = stuff->hsyncstart;
- mptr->CrtcHSyncEnd = stuff->hsyncend;
- mptr->CrtcHTotal = stuff->htotal;
- mptr->CrtcVDisplay = stuff->vdisplay;
- mptr->CrtcVSyncStart = stuff->vsyncstart;
- mptr->CrtcVSyncEnd = stuff->vsyncend;
- mptr->CrtcVTotal = stuff->vtotal;
- mptr->CrtcVAdjusted = FALSE;
- mptr->CrtcHAdjusted = FALSE;
- if (mptr->Flags & V_DBLSCAN)
- {
- mptr->CrtcVDisplay *= 2;
- mptr->CrtcVSyncStart *= 2;
- mptr->CrtcVSyncEnd *= 2;
- mptr->CrtcVTotal *= 2;
- mptr->CrtcVAdjusted = TRUE;
- }
- if (mptr->PrivSize && stuff->privsize) {
- memcpy(mptr->Private, &stuff[1], mptr->PrivSize * sizeof(INT32));
+ if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
- (vptr->SwitchMode)(mptr);
- (vptr->AdjustFrame)(vptr->frameX0, vptr->frameY0);
-
- if (xf86Verbose)
+ VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
+
+ VidModeSetCrtcForMode(stuff->screen, mode);
+ VidModeSwitchMode(stuff->screen, mode);
+
+ if (xf86GetVerbosity() > 1)
ErrorF("ModModeLine - Succeeded\n");
return(client->noClientException);
}
static int
-ProcXF86VidModeValidateModeLine(client)
- register ClientPtr client;
+ProcXF86VidModeValidateModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeValidateModeLineReq);
+ xXF86OldVidModeValidateModeLineReq *oldstuff =
+ (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ xXF86VidModeValidateModeLineReq newstuff;
xXF86VidModeValidateModeLineReply rep;
- ScrnInfoPtr vptr;
- DisplayModePtr mptr;
- DisplayModeRec modetmp;
- int len, status;
-
- if (xf86Verbose) {
+ pointer mode, modetmp;
+ int len, status, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeValidateModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
ErrorF("ValidateModeLine - scrn: %d clock: %d\n",
- stuff->screen, stuff->dotclock, stuff->dotclock);
+ stuff->screen, stuff->dotclock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
@@ -841,19 +1064,22 @@ ProcXF86VidModeValidateModeLine(client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, stuff->flags);
}
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- mptr = vptr->modes;
- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
- len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2);
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ len = client->req_len -
+ (sizeof(xXF86OldVidModeValidateModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2);
+ }
if (len != stuff->privsize)
return BadLength;
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
status = MODE_OK;
- modetmp.Private = NULL;
if (stuff->hsyncstart < stuff->hdisplay ||
stuff->hsyncend < stuff->hsyncstart ||
@@ -866,46 +1092,33 @@ ProcXF86VidModeValidateModeLine(client)
goto status_reply;
}
- memcpy(&modetmp, mptr, sizeof(DisplayModeRec));
-
- modetmp.HDisplay = stuff->hdisplay;
- modetmp.HSyncStart = stuff->hsyncstart;
- modetmp.HSyncEnd = stuff->hsyncend;
- modetmp.HTotal = stuff->htotal;
- modetmp.VDisplay = stuff->vdisplay;
- modetmp.VSyncStart = stuff->vsyncstart;
- modetmp.VSyncEnd = stuff->vsyncend;
- modetmp.VTotal = stuff->vtotal;
- modetmp.Flags = stuff->flags;
- modetmp.Private = NULL;
- if (mptr->PrivSize && stuff->privsize) {
- if (mptr->PrivSize != stuff->privsize) {
- status = MODE_BAD;
- goto status_reply;
- }
- }
- if (mptr->PrivSize && mptr->Private) {
- modetmp.Private =
- (INT32 *)ALLOCATE_LOCAL(mptr->PrivSize * sizeof(INT32));
- if (stuff->privsize) {
- if (xf86Verbose)
- ErrorF("ValidateModeLine - Request includes privates\n");
- memcpy(modetmp.Private, &stuff[1], mptr->PrivSize * sizeof(INT32));
- } else
- memcpy(modetmp.Private, mptr->Private,
- mptr->PrivSize * sizeof(INT32));
- }
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ modetmp = VidModeCreateMode();
+ VidModeCopyMode(mode, modetmp);
+
+ VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
+ if (stuff->privsize)
+ ErrorF("ValidateModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
- if ((status = xf86CheckMode(vptr, &modetmp, vptr->monitor, FALSE)) != MODE_OK)
+ if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
goto status_reply;
/* Check that the driver is happy with the mode */
- status = vptr->ValidMode(&modetmp, xf86Verbose, MODE_VID);
+ status = VidModeCheckModeForDriver(stuff->screen, modetmp);
status_reply:
- if (modetmp.Private)
- DEALLOCATE_LOCAL(modetmp.Private);
rep.type = X_Reply;
rep.length = (SIZEOF(xXF86VidModeValidateModeLineReply)
- SIZEOF(xGenericReply)) >> 2;
@@ -918,227 +1131,555 @@ status_reply:
swapl(&rep.status, n);
}
WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
- if (xf86Verbose)
- ErrorF("ValidateModeLine - Succeeded\n");
+ if (xf86GetVerbosity() > 1)
+ ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
return(client->noClientException);
}
static int
-ProcXF86VidModeSwitchMode(client)
- register ClientPtr client;
+ProcXF86VidModeSwitchMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchModeReq);
- ScreenPtr vptr;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
- vptr = screenInfo.screens[stuff->screen];
- if (xf86Info.dontZoom)
- return vidmodeErrorBase + XF86VidModeZoomLocked;
+ DEBUG_P("XF86VidModeSwitchMode");
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
- xf86ZoomViewport(vptr, (short)stuff->zoom);
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
+
return (client->noClientException);
}
static int
-ProcXF86VidModeSwitchToMode(client)
- register ClientPtr client;
+ProcXF86VidModeSwitchToMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchToModeReq);
- ScrnInfoPtr vptr;
- DisplayModePtr curmptr, mptr;
- DisplayModeRec modetmp;
+ xXF86OldVidModeSwitchToModeReq *oldstuff =
+ (xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
+ xXF86VidModeSwitchToModeReq newstuff;
+ pointer mode;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeSwitchToMode");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("SwitchToMode - scrn: %d clock: %d\n",
+ stuff->screen, stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, stuff->flags);
+ }
- if (stuff->screen > screenInfo.numScreens)
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeSwitchToModeReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
+ len = client->req_len - (sizeof(xXF86VidModeSwitchToModeReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
- if (xf86Info.dontZoom)
- return vidmodeErrorBase + XF86VidModeZoomLocked;
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
+ && MODEMATCH(mode, stuff))
+ return (client->noClientException);
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- curmptr = mptr = vptr->modes;
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
+ do {
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
- if (MODEMATCH(mptr, stuff, vptr))
- return (client->noClientException);
+ if (!VidModeSwitchMode(stuff->screen, mode))
+ return BadValue;
- while ((mptr = mptr->next) != curmptr) {
- if (MODEMATCH(mptr, stuff, vptr)) {
- if ((vptr->SwitchMode)(mptr)) {
- vptr->modes = mptr;
- vptr->frameX0 = (vptr->frameX1 +vptr->frameX0 -mptr->HDisplay)/2;
- vptr->frameX1 = vptr->frameX0 + mptr->HDisplay -1;
- if (vptr->frameX0 < 0) {
- vptr->frameX0 = 0;
- vptr->frameX1 = mptr->HDisplay -1;
- } else if (vptr->frameX1 >= vptr->virtualX) {
- vptr->frameX0 = vptr->virtualX - mptr->HDisplay;
- vptr->frameX1 = vptr->frameX0 + mptr->HDisplay -1;
- }
- vptr->frameY0 = (vptr->frameY1 +vptr->frameY0 -mptr->VDisplay)/2;
- vptr->frameY1 = vptr->frameY0 + mptr->VDisplay -1;
- if (vptr->frameY0 < 0) {
- vptr->frameY0 = 0;
- vptr->frameY1 = mptr->VDisplay -1;
- } else if (vptr->frameY1 >= vptr->virtualY) {
- vptr->frameY0 = vptr->virtualY - mptr->VDisplay;
- vptr->frameY1 = vptr->frameY0 + mptr->VDisplay -1;
- }
- }
- (vptr->AdjustFrame)(vptr->frameX0, vptr->frameY0);
+ if (xf86GetVerbosity() > 1)
+ ErrorF("SwitchToMode - Succeeded\n");
return(client->noClientException);
}
- }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
return BadValue;
}
static int
-ProcXF86VidModeLockModeSwitch(client)
- register ClientPtr client;
+ProcXF86VidModeLockModeSwitch(ClientPtr client)
{
REQUEST(xXF86VidModeLockModeSwitchReq);
- ScreenPtr vptr;
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
+ REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
- vptr = screenInfo.screens[stuff->screen];
- if (xf86Info.dontZoom)
- return vidmodeErrorBase + XF86VidModeZoomLocked;
+ DEBUG_P("XF86VidModeLockModeSwitch");
- REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
+ return VidModeErrorBase + XF86VidModeZoomLocked;
- xf86LockZoom(vptr, (short)stuff->lock);
return (client->noClientException);
}
static int
-ProcXF86VidModeGetMonitor(client)
- register ClientPtr client;
+ProcXF86VidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
xXF86VidModeGetMonitorReply rep;
register int n;
- ScrnInfoPtr vptr;
- MonPtr mptr;
CARD32 *hsyncdata, *vsyncdata;
- int i;
+ int i, nHsync, nVrefresh;
+ pointer monitor;
+
+ DEBUG_P("XF86VidModeGetMonitor");
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- mptr = vptr->monitor;
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+ if (!VidModeGetMonitor(stuff->screen, &monitor))
+ return BadValue;
+
+ nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
+ nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
+
rep.type = X_Reply;
- if (mptr->vendor)
- rep.vendorLength = strlen(mptr->vendor);
+ if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
+ rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VENDOR, 0)).ptr);
else
rep.vendorLength = 0;
- if (mptr->model)
- rep.modelLength = strlen(mptr->model);
+ if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
+ rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_MODEL, 0)).ptr);
else
rep.modelLength = 0;
rep.length = (SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) +
- (mptr->n_hsync + mptr->n_vrefresh) * sizeof(CARD32) +
+ (nHsync + nVrefresh) * sizeof(CARD32) +
((rep.vendorLength + 3) & ~3) +
((rep.modelLength + 3) & ~3)) >> 2;
rep.sequenceNumber = client->sequence;
- rep.nhsync = mptr->n_hsync;
- rep.nvsync = mptr->n_vrefresh;
-#if 0
- rep.bandwidth = (unsigned long)(mptr->bandwidth * 1e6);
-#endif
- hsyncdata = ALLOCATE_LOCAL(mptr->n_hsync * sizeof(CARD32));
+ rep.nhsync = nHsync;
+ rep.nvsync = nVrefresh;
+ hsyncdata = ALLOCATE_LOCAL(nHsync * sizeof(CARD32));
if (!hsyncdata) {
return BadAlloc;
}
- vsyncdata = ALLOCATE_LOCAL(mptr->n_vrefresh * sizeof(CARD32));
+
+ vsyncdata = ALLOCATE_LOCAL(nVrefresh * sizeof(CARD32));
if (!vsyncdata) {
DEALLOCATE_LOCAL(hsyncdata);
return BadAlloc;
}
- for (i = 0; i < mptr->n_hsync; i++) {
- hsyncdata[i] = (unsigned short)(mptr->hsync[i].lo * 100.0) |
- (unsigned short)(mptr->hsync[i].hi * 100.0) << 16;
+
+ for (i = 0; i < nHsync; i++) {
+ hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_LO, i)).f |
+ (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_HI, i)).f << 16;
}
- for (i = 0; i < mptr->n_vrefresh; i++) {
- vsyncdata[i] = (unsigned short)(mptr->vrefresh[i].lo * 100.0) |
- (unsigned short)(mptr->vrefresh[i].hi * 100.0) << 16;
+ for (i = 0; i < nVrefresh; i++) {
+ vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_LO, i)).f |
+ (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_HI, i)).f << 16;
}
+
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
- swapl(&rep.bandwidth, n);
}
WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
- client->pSwapReplyFunc = Swap32Write;
- WriteSwappedDataToClient(client, mptr->n_hsync * sizeof(CARD32),
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
hsyncdata);
- WriteSwappedDataToClient(client, mptr->n_vrefresh * sizeof(CARD32),
+ WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
vsyncdata);
if (rep.vendorLength)
- WriteToClient(client, rep.vendorLength, mptr->vendor);
+ WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
if (rep.modelLength)
- WriteToClient(client, rep.modelLength, mptr->model);
+ WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
+
DEALLOCATE_LOCAL(hsyncdata);
DEALLOCATE_LOCAL(vsyncdata);
+
return (client->noClientException);
}
static int
-ProcXF86VidModeGetViewPort(client)
- register ClientPtr client;
+ProcXF86VidModeGetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeGetViewPortReq);
xXF86VidModeGetViewPortReply rep;
- register int n;
- ScrnInfoPtr vptr;
- MonPtr mptr;
- CARD32 *hsyncdata, *vsyncdata;
- int i;
+ int x, y, n;
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- mptr = vptr->monitor;
+ DEBUG_P("XF86VidModeGetViewPort");
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ VidModeGetViewPort(stuff->screen, &x, &y);
+ rep.x = x;
+ rep.y = y;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.x, n);
+ swapl(&rep.y, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
return (client->noClientException);
}
static int
-ProcXF86VidModeSetViewPort(client)
- register ClientPtr client;
+ProcXF86VidModeSetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeSetViewPortReq);
+
+ DEBUG_P("XF86VidModeSetViewPort");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetDotClocks(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetDotClocksReq);
+ xXF86VidModeGetDotClocksReply rep;
register int n;
- ScrnInfoPtr vptr;
- MonPtr mptr;
- CARD32 *hsyncdata, *vsyncdata;
- int i;
+ int numClocks;
+ CARD32 dotclock;
+ int *Clocks = NULL;
+ Bool ClockProg;
+
+ DEBUG_P("XF86VidModeGetDotClocks");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
+
+ rep.type = X_Reply;
+ rep.length = (SIZEOF(xXF86VidModeGetDotClocksReply)
+ - SIZEOF(xGenericReply) + numClocks) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.clocks = numClocks;
+ rep.maxclocks = MAXCLOCKS;
+ rep.flags = 0;
+
+ if (!ClockProg) {
+ Clocks = ALLOCATE_LOCAL(numClocks * sizeof(int));
+ if (!Clocks)
+ return BadValue;
+ if (!VidModeGetClocks(stuff->screen, Clocks)) {
+ DEALLOCATE_LOCAL(Clocks);
+ return BadValue;
+ }
+ }
+
+ if (ClockProg) {
+ rep.flags |= CLKFLAG_PROGRAMABLE;
+ }
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.clocks, n);
+ swapl(&rep.maxclocks, n);
+ swapl(&rep.flags, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
+ if (!ClockProg) {
+ for (n = 0; n < numClocks; n++) {
+ dotclock = *Clocks++;
+ if (client->swapped) {
+ WriteSwappedDataToClient(client, 4, (char *)&dotclock);
+ } else {
+ WriteToClient(client, 4, (char *)&dotclock);
+ }
+ }
+ }
+
+ DEALLOCATE_LOCAL(Clocks);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetGamma(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetGammaReq);
+
+ DEBUG_P("XF86VidModeSetGamma");
- if (stuff->screen > screenInfo.numScreens)
+ REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
+ ((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
return BadValue;
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
- mptr = vptr->monitor;
+ return (client->noClientException);
+}
- REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
+static int
+ProcXF86VidModeGetGamma(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetGammaReq);
+ xXF86VidModeGetGammaReply rep;
+ register int n;
+ float red, green, blue;
+
+ DEBUG_P("XF86VidModeGetGamma");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
+ return BadValue;
+ rep.red = (CARD32)(red * 10000.);
+ rep.green = (CARD32)(green * 10000.);
+ rep.blue = (CARD32)(blue * 10000.);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.red, n);
+ swapl(&rep.green, n);
+ swapl(&rep.blue, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetGammaRamp(ClientPtr client)
+{
+ CARD16 *r, *g, *b;
+ int length;
+ REQUEST(xXF86VidModeSetGammaRampReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
+
+ length = (stuff->size + 1) & ~1;
+
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
+
+ r = (CARD16*)&stuff[1];
+ g = r + length;
+ b = g + length;
+
+ if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetGammaRamp(ClientPtr client)
+{
+ CARD16 *ramp = NULL;
+ int n, length, i;
+ xXF86VidModeGetGammaRampReply rep;
+ REQUEST(xXF86VidModeGetGammaRampReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+
+ length = (stuff->size + 1) & ~1;
+
+ if(stuff->size) {
+ if(!(ramp = xalloc(length * 3 * sizeof(CARD16))))
+ return BadAlloc;
+
+ if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
+ ramp, ramp + length, ramp + (length * 2)))
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = (length >> 1) * 3;
+ rep.sequenceNumber = client->sequence;
+ rep.size = stuff->size;
+ if(client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.size, n);
+ for(i = 0; i < length * 3; i++)
+ swaps(&ramp[i],n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
+
+ if(stuff->size) {
+ WriteToClient(client, rep.length << 2, (char*)ramp);
+ xfree(ramp);
+ }
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86VidModeGetGammaRampSize(ClientPtr client)
+{
+ xXF86VidModeGetGammaRampSizeReply rep;
+ int n;
+ REQUEST(xXF86VidModeGetGammaRampSizeReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.size = VidModeGetGammaRampSize(stuff->screen);
+ if(client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.size, n);
+ }
+ WriteToClient(client,sizeof(xXF86VidModeGetGammaRampSizeReply),(char*)&rep);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetPermissions(ClientPtr client)
+{
+ xXF86VidModeGetPermissionsReply rep;
+ int n;
+ REQUEST(xXF86VidModeGetPermissionsReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.permissions = XF86VM_READ_PERMISSION;
+ if (xf86GetVidModeEnabled() &&
+ (xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
+ rep.permissions |= XF86VM_WRITE_PERMISSION;
+ }
+ if(client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.permissions, n);
+ }
+ WriteToClient(client,sizeof(xXF86VidModeGetPermissionsReply),(char*)&rep);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86VidModeSetClientVersion(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetClientVersionReq);
+
+ VidModePrivPtr pPriv;
+
+ DEBUG_P("XF86VidModeSetClientVersion");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+
+ if ((pPriv = VMPRIV(client)) == NULL) {
+ pPriv = xalloc(sizeof(VidModePrivRec));
+ if (!pPriv)
+ return BadAlloc;
+ VMPRIV(client) = pPriv;
+ }
+ pPriv->major = stuff->major;
+ pPriv->minor = stuff->minor;
+
return (client->noClientException);
}
static int
-ProcXF86VidModeDispatch (client)
- register ClientPtr client;
+ProcXF86VidModeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
@@ -1147,18 +1688,30 @@ ProcXF86VidModeDispatch (client)
return ProcXF86VidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return ProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetAllModeLines:
- return ProcXF86VidModeGetAllModeLines(client);
case X_XF86VidModeGetMonitor:
return ProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:
+ return ProcXF86VidModeGetAllModeLines(client);
case X_XF86VidModeValidateModeLine:
return ProcXF86VidModeValidateModeLine(client);
case X_XF86VidModeGetViewPort:
return ProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeGetDotClocks:
+ return ProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:
+ return ProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:
+ return ProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:
+ return ProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:
+ return ProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:
+ return ProcXF86VidModeGetPermissions(client);
default:
- if (!xf86VidModeEnabled)
- return vidmodeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86VidModeAllowNonLocal || LocalClient (client)) {
+ if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
switch (stuff->data) {
case X_XF86VidModeAddModeLine:
return ProcXF86VidModeAddModeLine(client);
@@ -1174,17 +1727,20 @@ ProcXF86VidModeDispatch (client)
return ProcXF86VidModeLockModeSwitch(client);
case X_XF86VidModeSetViewPort:
return ProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeSetGamma:
+ return ProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeSetGammaRamp:
+ return ProcXF86VidModeSetGammaRamp(client);
default:
return BadRequest;
}
} else
- return vidmodeErrorBase + XF86VidModeClientNotLocal;
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
}
}
static int
-SProcXF86VidModeQueryVersion(client)
- register ClientPtr client;
+SProcXF86VidModeQueryVersion(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeQueryVersionReq);
@@ -1193,8 +1749,7 @@ SProcXF86VidModeQueryVersion(client)
}
static int
-SProcXF86VidModeGetModeLine(client)
- ClientPtr client;
+SProcXF86VidModeGetModeLine(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetModeLineReq);
@@ -1205,8 +1760,7 @@ SProcXF86VidModeGetModeLine(client)
}
static int
-SProcXF86VidModeGetAllModeLines(client)
- ClientPtr client;
+SProcXF86VidModeGetAllModeLines(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetAllModeLinesReq);
@@ -1217,100 +1771,187 @@ SProcXF86VidModeGetAllModeLines(client)
}
static int
-SProcXF86VidModeAddModeLine(client)
- ClientPtr client;
+SProcXF86VidModeAddModeLine(ClientPtr client)
{
+ xXF86OldVidModeAddModeLineReq *oldstuff =
+ (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ int ver;
register int n;
+
REQUEST(xXF86VidModeAddModeLineReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
return ProcXF86VidModeAddModeLine(client);
}
static int
-SProcXF86VidModeDeleteModeLine(client)
- ClientPtr client;
+SProcXF86VidModeDeleteModeLine(ClientPtr client)
{
+ xXF86OldVidModeDeleteModeLineReq *oldstuff =
+ (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ int ver;
register int n;
+
REQUEST(xXF86VidModeDeleteModeLineReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
return ProcXF86VidModeDeleteModeLine(client);
}
static int
-SProcXF86VidModeModModeLine(client)
- ClientPtr client;
+SProcXF86VidModeModModeLine(ClientPtr client)
{
+ xXF86OldVidModeModModeLineReq *oldstuff =
+ (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ int ver;
register int n;
+
REQUEST(xXF86VidModeModModeLineReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
return ProcXF86VidModeModModeLine(client);
}
static int
-SProcXF86VidModeValidateModeLine(client)
- ClientPtr client;
+SProcXF86VidModeValidateModeLine(ClientPtr client)
{
+ xXF86OldVidModeValidateModeLineReq *oldstuff =
+ (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ int ver;
register int n;
+
REQUEST(xXF86VidModeValidateModeLineReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
- swapl(&stuff->screen, n);
- swaps(&stuff->hdisplay, n);
- swaps(&stuff->hsyncstart, n);
- swaps(&stuff->hsyncend, n);
- swaps(&stuff->htotal, n);
- swaps(&stuff->vdisplay, n);
- swaps(&stuff->vsyncstart, n);
- swaps(&stuff->vsyncend, n);
- swaps(&stuff->vtotal, n);
- swapl(&stuff->flags, n);
- swapl(&stuff->privsize, n);
- SwapRestL(stuff);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
return ProcXF86VidModeValidateModeLine(client);
}
static int
-SProcXF86VidModeSwitchMode(client)
- ClientPtr client;
+SProcXF86VidModeSwitchMode(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSwitchModeReq);
@@ -1322,8 +1963,7 @@ SProcXF86VidModeSwitchMode(client)
}
static int
-SProcXF86VidModeSwitchToMode(client)
- ClientPtr client;
+SProcXF86VidModeSwitchToMode(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSwitchToModeReq);
@@ -1334,8 +1974,7 @@ SProcXF86VidModeSwitchToMode(client)
}
static int
-SProcXF86VidModeLockModeSwitch(client)
- ClientPtr client;
+SProcXF86VidModeLockModeSwitch(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeLockModeSwitchReq);
@@ -1347,8 +1986,7 @@ SProcXF86VidModeLockModeSwitch(client)
}
static int
-SProcXF86VidModeGetMonitor(client)
- ClientPtr client;
+SProcXF86VidModeGetMonitor(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetMonitorReq);
@@ -1359,8 +1997,7 @@ SProcXF86VidModeGetMonitor(client)
}
static int
-SProcXF86VidModeGetViewPort(client)
- ClientPtr client;
+SProcXF86VidModeGetViewPort(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetViewPortReq);
@@ -1371,20 +2008,123 @@ SProcXF86VidModeGetViewPort(client)
}
static int
-SProcXF86VidModeSetViewPort(client)
- ClientPtr client;
+SProcXF86VidModeSetViewPort(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
swaps(&stuff->screen, n);
+ swapl(&stuff->x, n);
+ swapl(&stuff->y, n);
return ProcXF86VidModeSetViewPort(client);
}
static int
-SProcXF86VidModeDispatch (client)
- register ClientPtr client;
+SProcXF86VidModeGetDotClocks(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetDotClocksReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetDotClocks(client);
+}
+
+static int
+SProcXF86VidModeSetClientVersion(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetClientVersionReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+ swaps(&stuff->major, n);
+ swaps(&stuff->minor, n);
+ return ProcXF86VidModeSetClientVersion(client);
+}
+
+static int
+SProcXF86VidModeSetGamma(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetGammaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->red, n);
+ swapl(&stuff->green, n);
+ swapl(&stuff->blue, n);
+ return ProcXF86VidModeSetGamma(client);
+}
+
+static int
+SProcXF86VidModeGetGamma(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetGammaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGamma(client);
+}
+
+static int
+SProcXF86VidModeSetGammaRamp(ClientPtr client)
+{
+ CARD16 *ramp;
+ int length, n;
+ REQUEST(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->size, n);
+ swaps(&stuff->screen, n);
+ length = ((stuff->size + 1) & ~1) * 6;
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
+ ramp = (CARD16*)&stuff[1];
+ while(length--) {
+ swaps(ramp, n);
+ ramp++;
+ }
+ return ProcXF86VidModeSetGammaRamp(client);
+}
+
+static int
+SProcXF86VidModeGetGammaRamp(ClientPtr client)
+{
+ int n;
+ REQUEST(xXF86VidModeGetGammaRampReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+ swaps(&stuff->size, n);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGammaRamp(client);
+}
+
+static int
+SProcXF86VidModeGetGammaRampSize(ClientPtr client)
+{
+ int n;
+ REQUEST(xXF86VidModeGetGammaRampSizeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGammaRampSize(client);
+}
+
+static int
+SProcXF86VidModeGetPermissions(ClientPtr client)
+{
+ int n;
+ REQUEST(xXF86VidModeGetPermissionsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetPermissions(client);
+}
+
+
+static int
+SProcXF86VidModeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
@@ -1393,18 +2133,30 @@ SProcXF86VidModeDispatch (client)
return SProcXF86VidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return SProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetAllModeLines:
- return SProcXF86VidModeGetAllModeLines(client);
case X_XF86VidModeGetMonitor:
return SProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:
+ return SProcXF86VidModeGetAllModeLines(client);
case X_XF86VidModeGetViewPort:
return SProcXF86VidModeGetViewPort(client);
case X_XF86VidModeValidateModeLine:
return SProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetDotClocks:
+ return SProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:
+ return SProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:
+ return SProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:
+ return SProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:
+ return SProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:
+ return SProcXF86VidModeGetPermissions(client);
default:
- if (!xf86VidModeEnabled)
- return vidmodeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86VidModeAllowNonLocal || LocalClient(client)) {
+ if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
switch (stuff->data) {
case X_XF86VidModeAddModeLine:
return SProcXF86VidModeAddModeLine(client);
@@ -1420,10 +2172,14 @@ SProcXF86VidModeDispatch (client)
return SProcXF86VidModeLockModeSwitch(client);
case X_XF86VidModeSetViewPort:
return SProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeSetGamma:
+ return SProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeSetGammaRamp:
+ return SProcXF86VidModeSetGammaRamp(client);
default:
return BadRequest;
}
} else
- return vidmodeErrorBase + XF86VidModeClientNotLocal;
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
}
}
diff --git a/hw/xfree86/os-support/README.OS-lib b/hw/xfree86/os-support/README.OS-lib
index cf3a0cc7e..27af6b3f2 100644
--- a/hw/xfree86/os-support/README.OS-lib
+++ b/hw/xfree86/os-support/README.OS-lib
@@ -34,13 +34,10 @@ have been made in implementation.
at build time via Imakefile rules. This is alway
preferable to reproducing functions in more than one
OS library.
- amoeba/ OS support for the Amoeba operating system.
bsd/ OS support for the 386BSD/NetBSD/FreeBSD operating
systems.
bsdi/ OS support for the BSD/386 operating system.
linux/ OS support for the Linux operating system.
- mach/ OS support for the Mach and OSF/1 operating systems.
- minix/ OS support for the Minix operating system.
os2/ OS support for OS/2 2.11 and OS/2 Warp
sco/ OS support for the SCO SVR3.x operating system.
solx86/ OS support for the Solaris x86 operating system.
@@ -75,7 +72,7 @@ void xf86OpenConsole(void)
{
/*
* Open console device, activate VTs, etc, etc. Fill in requisite
- * pieces of x386Info. Most of this code comes from x386Init.c
+ * pieces of xf86Info. Most of this code comes from xf86Init.c
*/
}
@@ -124,8 +121,7 @@ Bool xf86LinearVidMem(void)
*/
}
-pointer xf86MapVidMem(int ScreenNum, int Region, pointer Base,
- unsigned long Size)
+pointer xf86MapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
/*
* Handle mapping the video memory. Returns (pointer *)0 for
@@ -134,8 +130,7 @@ pointer xf86MapVidMem(int ScreenNum, int Region, pointer Base,
*/
}
-void xf86UnMapVidMem(int ScreenNum, int Region, pointer Base,
- unsigned long Size)
+void xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
/*
* Handle unmapping the video memory. This should undo what
@@ -173,31 +168,11 @@ int xf86ReadBIOS(unsigned long Base, unsigned long Offset,
*/
}
-void xf86ClearIOPortList(int ScreenNum)
-{
- /*
- * Clears any list of I/O ports that the OS-layer may be maintaining.
- * Note: the value used for ScreenNum must be the scrnIndex field
- * of the screenInfoRec, because this is the only index that is
- * guaranteed to be valid and never change during the life of the
- * server. It is not the same as the index of pScreen in ScreenInfo.
- */
-}
-
-void xf86AddIOPorts(int ScreenNum, int NumPorts, unsigned *Ports)
-{
- /*
- * Adds NumPorts I/O ports listed in array Ports to a list that
- * the OS-layer may be maintaining. Successive calls to this
- * function are cumulative.
- */
-}
void xf86EnableIOPorts(int ScreenNum)
{
/*
- * Enables I/O permissions. The OS layer can either use a
- * previously created list of I/O ports to be used, or can
+ * Enables I/O permissions. The OS layer should
* enable all I/O port access.
*/
}
@@ -205,16 +180,7 @@ void xf86EnableIOPorts(int ScreenNum)
void xf86DisableIOPorts(int ScreenNum)
{
/*
- * Disables I/O permissions. Does not clear the list of I/O
- * ports, if any exists.
- */
-}
-
-void xf86DisableIOPrivs(void)
-{
- /*
- * Do whatever is necessary to disable I/O permissions after forking
- * a child process.
+ * Disables I/O permissions.
*/
}
@@ -323,7 +289,7 @@ void xf86KbdEvents(void)
{
/*
* Read characters from the keyboard device, and post the events
- * by calling x386PostKbdEvent(). Read as much as is available
+ * by calling xf86PostKbdEvent(). Read as much as is available
* without waiting.
*/
}
@@ -380,7 +346,7 @@ void xf86MouseEvents(void)
{
/*
* Read characters from the mouse device, and post the events
- * by calling x386PostMseEvent(). Read as much as is available
+ * by calling xf86PostMseEvent(). Read as much as is available
* without waiting. If the OS doesn't handle the mouse protocol
* translation, xf86MouseProtocol() may be called to do the
* translation and event posting. If the OS does handle the protocol
@@ -407,7 +373,7 @@ int xf86OsMouseEvents(void)
/*
* When supporting an OS-based mouse driver (as opposed to the
* server's internal mouse driver), read some events from the device
- * and post them to the DIX layer through x386PostMseEvent().
+ * and post them to the DIX layer through xf86PostMseEvent().
*
* This function only needs to be implemented if USE_OSMOUSE is
* defined for the OS.
@@ -427,11 +393,114 @@ void xf86OsMouseOption(int token, pointer lex_ptr)
*/
}
+/*
+ * The following functions are simply wrappers around the OS specific
+ * libc functions
+ */
+
+void *
+xf86memmove(void * dest, const void * src, INT32 n)
+{
+ return(memmove(dest,src,n));
+}
+
+void *
+xf86memset(void * s, int c, INT32 n)
+{
+ return(memset(s,c,n));
+}
+
+void *
+xf86memcpy(void * dest, const void * src, INT32 n)
+{
+ return(memcpy(dest,src,n));
+}
+
+int
+xf86memcmp(const void * s1, const void * s2, INT32 n)
+{
+ return(memcmp(s1,s2,n));
+}
+
+char *
+xf86strcat(char * dest, const char * src)
+{
+ return(strcat(dest,src));
+}
+
+char *
+xf86strcpy(char * dest, const char * src)
+{
+ return(strcpy(dest,src));
+}
+
+int
+xf86strcmp(const char * s1, const char * s2)
+{
+ return(strcmp(s1,s2));
+}
+
+int
+xf86strncmp(const char * s1, const char * s2, INT32 n)
+{
+ return(strncmp(s1,s2,n));
+}
+
+size_t
+xf86strlen(const char * s)
+{
+ return(strlen(s));
+}
+
+void
+xf86getsecs(INT32 * secs, INT32 * usecs)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ *secs = tv.tv_sec;
+ *usecs= tv.tv_usec;
+
+ return;
+}
+
+double
+xf86exp(double x)
+{
+ return(exp(x));
+}
+
+double
+xf86log(double x)
+{
+ return(log(x));
+}
+
+double
+xf86pow(double x, double y)
+{
+ return(pow(x,y));
+}
+
+double
+xf86sqrt(double x)
+{
+ return(sqrt(x));
+}
+
+double
+xf86cos(double x)
+{
+ return(cos(x));
+}
+
+
+
-$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.2 1996/12/23 06:48:59 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.10 2001/12/17 20:00:45 dawes Exp $
-$Xorg: README.OS-lib,v 1.3 2000/08/17 19:51:19 cpqbld Exp $
+$XConsortium: README.OS-lib /main/5 1996/02/21 17:50:28 kaleb $
diff --git a/hw/xfree86/os-support/assyntax.h b/hw/xfree86/os-support/assyntax.h
index ee2c23fa4..3ae8a7940 100644
--- a/hw/xfree86/os-support/assyntax.h
+++ b/hw/xfree86/os-support/assyntax.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.7.2.2 1997/05/11 02:56:22 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.12 1999/12/27 00:39:46 robin Exp $ */
#ifndef __ASSYNTAX_H__
#define __ASSYNTAX_H__
@@ -23,7 +23,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Xorg: assyntax.h,v 1.3 2000/08/17 19:51:19 cpqbld Exp $ */
+/* $XConsortium: assyntax.h /main/5 1996/02/21 17:50:49 kaleb $ */
/*
* assyntax.h
@@ -212,7 +212,7 @@
#endif /* ACK_ASSEMBLER */
-#if defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || (defined(linux) || defined(__OS2ELF__)) && defined(__ELF__)
+#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__)
#define GLNAME(a) a
#else
#define GLNAME(a) CONCAT(_,a)
diff --git a/hw/xfree86/os-support/bsd/bsd_VTsw.c b/hw/xfree86/os-support/bsd/bsd_VTsw.c
index 13e78ad34..adb101dc5 100644
--- a/hw/xfree86/os-support/bsd/bsd_VTsw.c
+++ b/hw/xfree86/os-support/bsd/bsd_VTsw.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c,v 3.5 1996/12/23 06:49:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c,v 3.6 1998/07/25 16:56:33 dawes Exp $ */
/*
* Derived from VTsw_usl.c which is
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -23,12 +23,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: bsd_VTsw.c,v 1.3 2000/08/17 19:51:21 cpqbld Exp $ */
+/* $XConsortium: bsd_VTsw.c /main/4 1996/02/21 17:50:57 kaleb $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
-
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
@@ -42,8 +39,8 @@
* This function is the signal handler for the VT-switching signal. It
* is only referenced inside the OS-support layer.
*/
-void xf86VTRequest(sig)
-int sig;
+void
+xf86VTRequest(int sig)
{
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
@@ -53,7 +50,8 @@ int sig;
return;
}
-Bool xf86VTSwitchPending()
+Bool
+xf86VTSwitchPending()
{
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
@@ -63,7 +61,8 @@ Bool xf86VTSwitchPending()
return FALSE;
}
-Bool xf86VTSwitchAway()
+Bool
+xf86VTSwitchAway()
{
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
@@ -77,7 +76,8 @@ Bool xf86VTSwitchAway()
return FALSE;
}
-Bool xf86VTSwitchTo()
+Bool
+xf86VTSwitchTo()
{
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 961fd0eac..236b6ffbb 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.8.2.1 1998/02/06 22:36:49 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.19 2002/05/05 18:54:02 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -23,24 +23,18 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: bsd_init.c,v 1.3 2000/08/17 19:51:21 cpqbld Exp $ */
+/* $XConsortium: bsd_init.c /main/8 1996/10/23 13:13:05 kaleb $ */
#include "X.h"
-#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-extern void xf86VTRequest(
-#if NeedFunctionPrototypes
- int
-#endif
-);
+#include <sys/utsname.h>
+#include <stdlib.h>
static Bool KeepTty = FALSE;
static int devConsoleFd = -1;
@@ -58,12 +52,6 @@ static int initialVT = -1;
#define PCCONS_CONSOLE_MODE O_RDWR|O_NDELAY
#endif
-#ifdef CODRV_SUPPORT
-/* Holger Veit's codrv console driver */
-#define CODRV_CONSOLE_DEV "/dev/kbd"
-#define CODRV_CONSOLE_MODE O_RDONLY|O_NDELAY
-#endif
-
#ifdef SYSCONS_SUPPORT
/* The FreeBSD 1.1 version syscons driver uses /dev/ttyv0 */
#define SYSCONS_CONSOLE_DEV1 "/dev/ttyv0"
@@ -81,6 +69,11 @@ static int initialVT = -1;
#define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY
#endif
+#if defined(WSCONS_SUPPORT) && defined(__NetBSD__)
+/* NetBSD's new console driver */
+#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
+#endif
+
#define CHECK_DRIVER_MSG \
"Check your kernel's console driver configuration and /dev entries"
@@ -88,15 +81,15 @@ static char *supported_drivers[] = {
#ifdef PCCONS_SUPPORT
"pccons (with X support)",
#endif
-#ifdef CODRV_SUPPORT
- "codrv",
-#endif
#ifdef SYSCONS_SUPPORT
"syscons",
#endif
#ifdef PCVT_SUPPORT
"pcvt",
#endif
+#ifdef WSCONS_SUPPORT
+ "wscons",
+#endif
};
@@ -108,64 +101,43 @@ static char *supported_drivers[] = {
* an X server.
*/
-typedef int (*xf86ConsOpen_t)(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+typedef int (*xf86ConsOpen_t)(void);
#ifdef PCCONS_SUPPORT
-static int xf86OpenPccons(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+static int xf86OpenPccons(void);
#endif /* PCCONS_SUPPORT */
-#ifdef CODRV_SUPPORT
-static int xf86OpenCodrv(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-#endif /* CODRV_SUPPORT */
-
#ifdef SYSCONS_SUPPORT
-static int xf86OpenSyscons(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+static int xf86OpenSyscons(void);
#endif /* SYSCONS_SUPPORT */
#ifdef PCVT_SUPPORT
-static int xf86OpenPcvt(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+static int xf86OpenPcvt(void);
#endif /* PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+static int xf86OpenWScons(void);
+#endif
+
/*
* The sequence of the driver probes is important; start with the
* driver that is best distinguishable, and end with the most generic
* driver. (Otherwise, pcvt would also probe as syscons, and either
- * pcvt or syscons might succesfully probe as pccons. Only codrv is
- * at its own.)
+ * pcvt or syscons might succesfully probe as pccons.)
*/
static xf86ConsOpen_t xf86ConsTab[] = {
#ifdef PCVT_SUPPORT
xf86OpenPcvt,
#endif
-#ifdef CODRV_SUPPORT
- xf86OpenCodrv,
-#endif
#ifdef SYSCONS_SUPPORT
xf86OpenSyscons,
#endif
#ifdef PCCONS_SUPPORT
xf86OpenPccons,
#endif
+#ifdef WSCONS_SUPPORT
+ xf86OpenWScons,
+#endif
(xf86ConsOpen_t)NULL
};
@@ -173,10 +145,9 @@ static xf86ConsOpen_t xf86ConsTab[] = {
void
xf86OpenConsole()
{
- int i, fd;
-#ifdef CODRV_SUPPORT
- int onoff;
-#endif
+ int i, fd = -1;
+ int result;
+ struct utsname uts;
xf86ConsOpen_t *driver;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
vtmode_t vtmode;
@@ -187,10 +158,7 @@ xf86OpenConsole()
/* check if we are run with euid==0 */
if (geteuid() != 0)
{
- FatalError("xf86OpenConsole: Server must be running with root "
- "permissions\n"
- "You should be using Xwrapper to start the server or xdm.\n"
- "We strongly advise against making the server SUID root!\n");
+ FatalError("xf86OpenConsole: Server must be suid root\n");
}
if (!KeepTty)
@@ -211,7 +179,7 @@ xf86OpenConsole()
/* detect which driver we are running on */
for (driver = xf86ConsTab; *driver; driver++)
{
- if((fd = (*driver)()) >= 0)
+ if ((fd = (*driver)()) >= 0)
break;
}
@@ -231,28 +199,14 @@ xf86OpenConsole()
"%s: No console driver found\n\tSupported drivers: %s\n\t%s\n",
"xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
}
+#if 0 /* stdin is already closed in OsInit() */
fclose(stdin);
+#endif
xf86Info.consoleFd = fd;
xf86Info.screenFd = fd;
- xf86Config(FALSE); /* Read XF86Config */
-
switch (xf86Info.consType)
{
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- onoff = X_MODE_ON;
- if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE, &onoff) < 0)
- {
- FatalError("%s: CONSOLE_X_MODE ON failed (%s)\n%s\n",
- "xf86OpenConsole", strerror(errno),
- CHECK_DRIVER_MSG);
- }
- if (xf86Info.consType == CODRV01X)
- ioctl(xf86Info.consoleFd, VGATAKECTRL, 0);
- break;
-#endif
#ifdef PCCONS_SUPPORT
case PCCONS:
if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0)
@@ -267,13 +221,24 @@ xf86OpenConsole()
*/
if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0)
{
- ErrorF("Warning: couldn't open /dev/console (%s)\n",
- strerror(errno));
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: couldn't open /dev/console (%s)\n",
+ strerror(errno));
}
break;
#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
+ /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
+ * switching anymore. Here we check for FreeBSD 3.1 and up.
+ * Add cases for other *BSD that behave the same.
+ */
+ uname (&uts);
+ if (strcmp(uts.sysname, "FreeBSD") == 0) {
+ i = atof(uts.release) * 100;
+ if (i >= 310) goto acquire_vt;
+ }
+ /* otherwise fall through */
case PCVT:
/*
* First activate the #1 VT. This is a hack to allow a server
@@ -284,21 +249,27 @@ xf86OpenConsole()
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: VT_ACTIVATE failed\n");
}
sleep(1);
}
-
+
+acquire_vt:
/*
* now get the VT
*/
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
+ if (result != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
+ if (result != 0)
{
- ErrorF("xf86OpenConsole: VT_WAITACTIVE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
signal(SIGUSR1, xf86VTRequest);
@@ -311,17 +282,25 @@ xf86OpenConsole()
{
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
}
+#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
{
FatalError("xf86OpenConsole: KDENABIO failed (%s)\n",
strerror(errno));
}
+#endif
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
{
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
}
break;
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ fprintf(stderr, "xf86OpenConsole\n");
+ /* xf86Info.consoleFd = open("/dev/wskbd0", 0); */
+ break;
+#endif
}
}
else
@@ -332,7 +311,7 @@ xf86OpenConsole()
{
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
}
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
@@ -363,10 +342,7 @@ xf86OpenPccons()
CHECK_DRIVER_MSG);
}
xf86Info.consType = PCCONS;
- if (xf86Verbose)
- {
- ErrorF("Using pccons driver with X support\n");
- }
+ xf86Msg(X_PROBED, "Using pccons driver with X support\n");
}
return fd;
}
@@ -383,6 +359,7 @@ xf86OpenSyscons()
char vtname[12];
struct stat status;
long syscons_version;
+ MessageType from;
/* Check for syscons */
if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0
@@ -397,6 +374,7 @@ xf86OpenSyscons()
}
xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
#ifdef VT_GETACTIVE
if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
@@ -430,6 +408,7 @@ xf86OpenSyscons()
/*
* All VTs are in use. If initialVT was found, use it.
* Otherwise, if stdin is a VT, use that one.
+ * XXX stdin is already closed, so this won't work.
*/
if (initialVT != -1)
{
@@ -458,6 +437,7 @@ xf86OpenSyscons()
"or the use of the vtxx server option");
}
}
+ from = X_PROBED;
}
close(fd);
@@ -476,20 +456,17 @@ xf86OpenSyscons()
FatalError("xf86OpenSyscons: VT_GETMODE failed\n");
}
xf86Info.consType = SYSCONS;
- if (xf86Verbose)
+ xf86Msg(X_PROBED, "Using syscons driver with X support");
+ if (syscons_version >= 0x100)
{
- ErrorF("Using syscons driver with X support");
- if (syscons_version >= 0x100)
- {
- ErrorF(" (version %d.%d)\n", syscons_version >> 8,
+ xf86ErrorF(" (version %d.%d)\n", syscons_version >> 8,
syscons_version & 0xFF);
- }
- else
- {
- ErrorF(" (version 0.x)\n");
- }
- ErrorF("(using VT number %d)\n\n", xf86Info.vtno);
}
+ else
+ {
+ xf86ErrorF(" (version 0.x)\n");
+ }
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
}
else
{
@@ -504,78 +481,6 @@ xf86OpenSyscons()
#endif /* SYSCONS_SUPPORT */
-#ifdef CODRV_SUPPORT
-
-static int
-xf86OpenCodrv()
-{
- int fd = -1, onoff = X_MODE_OFF;
- struct oldconsinfo ci;
-
- if ((fd = open(CODRV_CONSOLE_DEV, CODRV_CONSOLE_MODE, 0)) >= 0)
- {
- if (ioctl(fd, CONSOLE_X_MODE, &onoff) < 0)
- {
- FatalError("%s: CONSOLE_X_MODE on %s failed (%s)\n%s\n%s\n",
- "xf86OpenCodrv",
- CODRV_CONSOLE_DEV, strerror(errno),
- "Was expecting codrv driver",
- CHECK_DRIVER_MSG);
- }
- xf86Info.consType = CODRV011;
- }
- else
- {
- if (errno == EBUSY)
- {
- FatalError("xf86OpenCodrv: %s is already in use (codrv)\n",
- CODRV_CONSOLE_DEV);
- }
- }
- else
- {
- fd = -1;
- }
-
- if(fd >= 0)
- {
- /*
- * analyse whether this kernel has sufficient capabilities for
- * this xserver, if not don't proceed: it won't work. Also
- * find out which codrv version.
- */
-#define NECESSARY (CONS_HASKBD|CONS_HASKEYNUM|CONS_HASPX386)
- if ((ioctl(fd, OLDCONSGINFO, &ci) < 0 ||
- (ci.info1 & NECESSARY) != NECESSARY))
- {
- FatalError("xf86OpenCodrv: %s\n%s\n%s\n",
- "This Xserver has detected the codrv driver, but your",
- "kernel doesn't appear to have the required facilities",
- CHECK_DRIVER_MSG);
- }
- /* Check for codrv 0.1.2 or later */
- if (ci.info1 & CONS_CODRV2)
- {
- xf86Info.consType = CODRV01X;
- if (xf86Verbose)
- {
- ErrorF("Using codrv 0.1.2 (or later)\n");
- }
- }
- else
- {
- if (xf86Verbose)
- {
- ErrorF("Using codrv 0.1.1\n");
- }
- }
-#undef NECESSARY
- }
-
- return fd;
-}
-#endif /* CODRV_SUPPORT */
-
#ifdef PCVT_SUPPORT
static int
@@ -584,11 +489,25 @@ xf86OpenPcvt()
/* This looks much like syscons, since pcvt is API compatible */
int fd = -1;
vtmode_t vtmode;
- char vtname[12];
+ char vtname[12], *vtprefix;
struct stat status;
struct pcvtid pcvt_version;
- if ((fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0)) >= 0)
+#ifndef __OpenBSD__
+ vtprefix = "/dev/ttyv";
+#else
+ vtprefix = "/dev/ttyC";
+#endif
+
+ fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
+ if (fd < 0)
+ {
+ fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+ vtprefix = "/dev/ttyE";
+ }
+#endif
+ if (fd >= 0)
{
if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0)
{
@@ -618,6 +537,7 @@ xf86OpenPcvt()
/*
* All VTs are in use. If initialVT was found, use it.
* Otherwise, if stdin is a VT, use that one.
+ * XXX stdin is already closed, so this won't work.
*/
if (initialVT != -1)
{
@@ -639,11 +559,7 @@ xf86OpenPcvt()
}
close(fd);
-#ifndef __OpenBSD__
- sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1);
-#else
- sprintf(vtname, "/dev/ttyC%01x", xf86Info.vtno - 1);
-#endif
+ sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
{
FatalError("xf86OpenPcvt: Cannot open %s (%s)\n",
@@ -654,11 +570,15 @@ xf86OpenPcvt()
FatalError("xf86OpenPcvt: VT_GETMODE failed\n");
}
xf86Info.consType = PCVT;
- if (xf86Verbose)
- {
- ErrorF("Using pcvt driver (version %d.%d)\n",
- pcvt_version.rmajor, pcvt_version.rminor);
- }
+#ifdef WSCONS_SUPPORT
+ xf86Msg(X_PROBED,
+ "Using wscons driver in pcvt compatibility mode "
+ "(version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+#else
+ xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+#endif
}
else
{
@@ -672,30 +592,49 @@ xf86OpenPcvt()
#endif /* PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+
+static int
+xf86OpenWScons()
+{
+ int fd = -1;
+ int mode = WSDISPLAYIO_MODE_MAPPED;
+ int i;
+ char ttyname[16];
+
+ /* XXX Is this ok? */
+ for (i = 0; i < 8; i++) {
+#if defined(__NetBSD__)
+ sprintf(ttyname, "/dev/ttyE%d", i);
+#elif defined(__OpenBSD__)
+ sprintf(ttyname, "/dev/ttyC%d", i);
+#endif
+ if ((fd = open(ttyname, 2)) != -1)
+ break;
+ }
+ if (fd != -1) {
+ if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
+ FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s\n",
+ "xf86OpenConsole", strerror(errno),
+ CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = WSCONS;
+ xf86Msg(X_PROBED, "Using wscons driver\n");
+ }
+ return fd;
+}
+
+#endif /* WSCONS_SUPPORT */
void
xf86CloseConsole()
{
-#if defined(CODRV_SUPPORT)
- int onoff;
-#endif
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
struct vt_mode VT;
#endif
switch (xf86Info.consType)
{
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- onoff = X_MODE_OFF;
- if (xf86Info.consType == CODRV01X)
- {
- ioctl (xf86Info.consoleFd, VGAGIVECTRL, 0);
- }
- ioctl (xf86Info.consoleFd, CONSOLE_X_MODE, &onoff);
- break;
-#endif /* CODRV_SUPPORT */
#ifdef PCCONS_SUPPORT
case PCCONS:
ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0);
@@ -710,15 +649,25 @@ xf86CloseConsole()
VT.mode = VT_AUTO;
ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
}
+#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
{
xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)\n",
strerror(errno));
}
+#endif
if (initialVT != -1)
ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
break;
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ {
+ int mode = WSDISPLAYIO_MODE_EMUL;
+ ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode);
+ break;
+ }
+#endif
}
if (xf86Info.screenFd != xf86Info.consoleFd)
@@ -738,10 +687,7 @@ xf86CloseConsole()
}
int
-xf86ProcessArgument (argc, argv, i)
-int argc;
-char *argv[];
-int i;
+xf86ProcessArgument(int argc, char *argv[], int i)
{
/*
* Keep server from detaching from controlling tty. This is useful
diff --git a/hw/xfree86/os-support/bsd/bsd_io.c b/hw/xfree86/os-support/bsd/bsd_io.c
index 6741ba978..0f40ba707 100644
--- a/hw/xfree86/os-support/bsd/bsd_io.c
+++ b/hw/xfree86/os-support/bsd/bsd_io.c
@@ -1,7 +1,7 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.12 1996/12/23 06:49:37 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.23 2002/10/21 20:38:04 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
- * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
+ * Copyright 1993 by David Dawes <dawes@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
@@ -23,29 +23,30 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: bsd_io.c,v 1.3 2000/08/17 19:51:21 cpqbld Exp $ */
+/* $XConsortium: bsd_io.c /main/11 1996/10/19 18:06:07 kaleb $ */
#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-void xf86SoundKbdBell(loudness, pitch, duration)
-int loudness;
-int pitch;
-int duration;
+#ifdef WSCONS_SUPPORT
+#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
+#endif
+
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
{
+#ifdef WSCONS_SUPPORT
+ struct wskbd_bell_data wsb;
+#endif
+
if (loudness && pitch)
{
-#ifdef CODRV_SUPPORT
- struct kbd_sound s;
-#endif
#ifdef PCCONS_SUPPORT
int data[2];
#endif
@@ -59,14 +60,6 @@ int duration;
ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
break;
#endif
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- s.pitch = pitch;
- s.duration = (duration * loudness) / 50;
- ioctl(xf86Info.consoleFd, KBDSETBELL, &s);
- break;
-#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
@@ -75,34 +68,43 @@ int duration;
(((unsigned long)duration*loudness/50)<<16));
break;
#endif
+#if defined (WSCONS_SUPPORT)
+ case WSCONS:
+ wsb.which = WSKBD_BELL_DOALL;
+ wsb.pitch = pitch;
+ wsb.period = duration;
+ wsb.volume = loudness;
+ ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
+ &wsb);
+ break;
+#endif
}
}
}
-void xf86SetKbdLeds(leds)
-int leds;
+void
+xf86SetKbdLeds(int leds)
{
switch (xf86Info.consType) {
case PCCONS:
break;
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- leds = (leds&0x01)<<2 | leds&0x02 | (leds&0x04)>>2;
- ioctl(xf86Info.consoleFd, KBDSLEDS, &leds);
- break;
-#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDSETLED, leds);
break;
#endif
+#if defined(WSCONS_SUPPORT)
+ case WSCONS:
+ ioctl(KBD_FD(xf86Info), WSKBDIO_SETLEDS, &leds);
+ break;
+#endif
}
}
-int xf86GetKbdLeds()
+int
+xf86GetKbdLeds()
{
int leds = 0;
@@ -110,40 +112,28 @@ int xf86GetKbdLeds()
case PCCONS:
break;
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- ioctl(xf86Info.consoleFd, KBDGLEDS, &leds);
- leds = (leds&0x01)<<2 | leds&0x02 | (leds&0x04)>>2;
- break;
-#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDGETLED, &leds);
break;
#endif
+#if defined(WSCONS_SUPPORT)
+ case WSCONS:
+ ioctl(KBD_FD(xf86Info), WSKBDIO_GETLEDS, &leds);
+ break;
+#endif
}
return(leds);
}
-#if NeedFunctionPrototypes
-void xf86SetKbdRepeat(char rad)
-#else
-void xf86SetKbdRepeat(rad)
-char rad;
-#endif
+void
+xf86SetKbdRepeat(char rad)
{
switch (xf86Info.consType) {
case PCCONS:
break;
-#ifdef CODRV_SUPPORT
- case CODRV011:
- case CODRV01X:
- ioctl(xf86Info.consoleFd, KBDSTPMAT, &rad);
- break;
-#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
@@ -153,15 +143,15 @@ char rad;
}
}
+#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
static struct termio kbdtty;
+#endif
-void xf86KbdInit()
+void
+xf86KbdInit()
{
switch (xf86Info.consType) {
- case CODRV011:
- case CODRV01X:
- break;
#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case PCCONS:
case SYSCONS:
@@ -169,18 +159,27 @@ void xf86KbdInit()
tcgetattr(xf86Info.consoleFd, &kbdtty);
break;
#endif
+#if defined WSCONS_SUPPORT
+ case WSCONS:
+ if (xf86Info.kbdFd != -1)
+ xf86FlushInput(xf86Info.kbdFd);
+ else
+ tcgetattr(xf86Info.consoleFd, &kbdtty);
+ break;
+#endif
}
}
-int xf86KbdOn()
+int
+xf86KbdOn()
{
struct termios nTty;
+#ifdef WSCONS_SUPPORT
+ int option;
+#endif
- switch (xf86Info.consType) {
- case CODRV011:
- case CODRV01X:
- break;
+ switch (xf86Info.consType) {
#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
case SYSCONS:
@@ -202,17 +201,44 @@ int xf86KbdOn()
#endif
break;
#endif
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ if (xf86Info.kbdFd == -1) {
+ nTty = kbdtty;
+ nTty.c_iflag = IGNPAR | IGNBRK;
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
+ cfsetispeed(&nTty, 9600);
+ cfsetospeed(&nTty, 9600);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+ option = WSKBD_RAW;
+ if (ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE,
+ &option) == -1)
+ FatalError("can't switch keyboard to raw mode. "
+ "Enable support for it in the kernel\n"
+ "or use for example:\n\n"
+ "Option \"Protocol\" \"wskbd\"\n"
+ "Option \"Device\" \"/dev/wskbd0\"\n"
+ "\nin your XF86Config(5) file\n");
+ } else {
+ return xf86Info.kbdFd;
+ }
+#endif
}
return(xf86Info.consoleFd);
}
-int xf86KbdOff()
+int
+xf86KbdOff()
{
- switch (xf86Info.consType) {
+#ifdef WSCONS_SUPPORT
+ int option;
+#endif
- case CODRV011:
- case CODRV01X:
- break;
+ switch (xf86Info.consType) {
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
@@ -225,33 +251,39 @@ int xf86KbdOff()
tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
break;
#endif
- }
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ if (xf86Info.kbdFd != -1) {
+ return xf86Info.kbdFd;
+ } else {
+ option = WSKBD_TRANSLATED;
+ ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
+ }
+ break;
+#endif
+ }
return(xf86Info.consoleFd);
}
-void xf86MouseInit(mouse)
-MouseDevPtr mouse;
+#ifdef WSCONS_SUPPORT
+
+#define NUMEVENTS 64
+
+void
+xf86WSKbdEvents(void)
{
+ static struct wscons_event events[NUMEVENTS];
+ int n, i;
+
+ n = read(xf86Info.kbdFd, events, sizeof events);
+ if (n <= 0)
return;
+ n /= sizeof(struct wscons_event);
+ for (i = 0; i < n; i++)
+ xf86PostWSKbdEvent(&events[i]);
}
-int xf86MouseOn(mouse)
-MouseDevPtr mouse;
-{
- if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Cannot open mouse (%s) - Continuing...\n",
- strerror(errno));
- return(-2);
- }
- FatalError("Cannot open mouse (%s)\n", strerror(errno));
- }
+#endif /* WSCONS_SUPPORT */
- xf86SetupMouse(mouse);
- /* Flush any pending input */
- tcflush(mouse->mseFd, TCIFLUSH);
-
- return(mouse->mseFd);
-}
diff --git a/hw/xfree86/os-support/bsd/bsd_jstk.c b/hw/xfree86/os-support/bsd/bsd_jstk.c
index ab4a31420..7f24124dc 100644
--- a/hw/xfree86/os-support/bsd/bsd_jstk.c
+++ b/hw/xfree86/os-support/bsd/bsd_jstk.c
@@ -23,18 +23,22 @@
/* Modified for FreeBSD by David Dawes <dawes@XFree86.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.2 1996/01/12 14:34:41 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.8 2002/08/06 13:20:47 herrb Exp $ */
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
+#include <errno.h>
#include <machine/joystick.h>
#include <fcntl.h>
-#define JS_RETURN sizeof(struct joystick)
+#ifdef XFree86LOADER
+#include "misc.h"
+#include "xf86_libc.h"
+#endif
+#include "xf86.h"
-extern int errno;
-extern int xf86Verbose;
+#define JS_RETURN sizeof(struct joystick)
/***********************************************************************
*
@@ -57,16 +61,16 @@ xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY)
ErrorF("xf86JoystickOn: %s\n", name);
#endif
- if ((status = open(name, O_RDWR | O_NDELAY)) < 0)
+ if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0)
{
- ErrorF("xf86JoystickOn: Cannot open joystick '%s' (%s)\n", name,
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n",
+ name, strerror(errno));
return -1;
}
if (*timeout <= 0) {
/* Use the current setting */
- ioctl(status, JOY_GETTIMEOUT, &timeinmicros);
+ ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros);
*timeout = timeinmicros / 1000;
if (*timeout == 0)
*timeout = 1;
@@ -78,8 +82,8 @@ xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY)
changed = 1;
}
- if (changed && xf86Verbose)
- ErrorF("(--) Joystick: timeout value = %d\n", *timeout);
+ if (changed)
+ xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout);
timeinmicros = *timeout * 1000;
@@ -87,15 +91,11 @@ xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY)
read(status, &js, JS_RETURN);
if (*centerX < 0) {
*centerX = js.x;
- if (xf86Verbose) {
- ErrorF("(--) Joystick: CenterX set to %d\n", *centerX);
- }
+ xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX);
}
if (*centerY < 0) {
*centerY = js.y;
- if (xf86Verbose) {
- ErrorF("(--) Joystick: CenterY set to %d\n", *centerY);
- }
+ xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY);
}
return status;
@@ -126,9 +126,7 @@ xf86JoystickInit()
*/
int
-xf86JoystickOff(fd, doclose)
-int *fd;
-int doclose;
+xf86JoystickOff(int *fd, int doclose)
{
int oldfd;
@@ -149,11 +147,7 @@ int doclose;
*/
int
-xf86JoystickGetState(fd, x, y, buttons)
-int fd;
-int *x;
-int *y;
-int *buttons;
+xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
{
struct joystick js;
int status;
@@ -177,4 +171,15 @@ int *buttons;
return 1;
}
+#ifdef XFree86LOADER
+/*
+ * Entry point for XFree86 Loader
+ */
+void
+bsd_jstkModuleInit(pointer *data, INT32 *magic)
+{
+ *magic = MAGIC_DONE;
+ *data = NULL;
+}
+#endif
/* end of bsd_jstk.c */
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 1c0791abb..0ac8c6a8b 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.7.2.3 1998/02/06 22:36:51 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -23,18 +23,17 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: lnx_init.c,v 1.3 2000/08/17 19:51:23 cpqbld Exp $ */
+/* $XConsortium: lnx_init.c /main/7 1996/10/23 18:46:30 kaleb $ */
#include "X.h"
#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#include "lnx.h"
#ifdef USE_DEV_FB
extern char *getenv(const char *);
@@ -46,52 +45,50 @@ static Bool KeepTty = FALSE;
static int VTnum = -1;
static int activeVT = -1;
-extern void xf86VTRequest(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-
-void xf86OpenConsole()
+void
+xf86OpenConsole(void)
{
- int i, fd;
+ int i, fd = -1;
+ int result;
struct vt_mode VT;
char vtname[11];
struct vt_stat vts;
+ MessageType from = X_PROBED;
#ifdef USE_DEV_FB
struct fb_var_screeninfo var;
int fbfd;
#endif
+ char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
+ char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
if (serverGeneration == 1)
{
/* check if we're run with euid==0 */
if (geteuid() != 0)
{
- FatalError("xf86OpenConsole: Server must be running with root "
- "permissions\n"
- "You should be using Xwrapper to start the server or xdm.\n"
- "We strongly advise against making the server SUID root!\n");
+ FatalError("xf86OpenConsole: Server must be suid root\n");
}
/*
* setup the virtual terminal manager
*/
- if (VTnum != -1)
- {
+ if (VTnum != -1) {
xf86Info.vtno = VTnum;
- }
- else
- {
- if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
+ from = X_CMDLINE;
+ } else {
+ i=0;
+ while (tty0[i] != NULL)
{
+ if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
+ break;
+ i++;
+ }
+ if (fd < 0)
FatalError(
"xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
strerror(errno));
- }
if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
- (xf86Info.vtno == -1))
- {
+ (xf86Info.vtno == -1)) {
FatalError("xf86OpenConsole: Cannot find a free VT\n");
}
close(fd);
@@ -107,21 +104,24 @@ void xf86OpenConsole()
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var))
FatalError("xf86OpenConsole: Unable to get screen info\n");
#endif
- ErrorF("(using VT number %d)\n\n", xf86Info.vtno);
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
- sprintf(vtname,"/dev/tty%d",xf86Info.vtno); /* /dev/tty1-64 */
-
- xf86Config(FALSE); /* Read XF86Config */
-
- if (!KeepTty)
- {
+ if (!KeepTty) {
setpgrp();
}
- if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
- {
- FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
- vtname, strerror(errno));
+ i=0;
+ while (vcs[i] != NULL)
+ {
+ sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
+ if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
+ break;
+ i++;
+ }
+
+ if (xf86Info.consoleFd < 0) {
+ FatalError("xf86OpenConsole: Cannot open virtual console %d (%s)\n",
+ xf86Info.vtno, strerror(errno));
}
/* change ownership of the vt */
@@ -131,7 +131,7 @@ void xf86OpenConsole()
* the current VT device we're running on is not "console", we want
* to grab all consoles too
*
- * Why is this needed?
+ * Why is this needed??
*/
chown("/dev/tty0", getuid(), getgid());
@@ -159,17 +159,21 @@ void xf86OpenConsole()
/*
* now get the VT
*/
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
+ if (result != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
+ if (result != 0)
{
- ErrorF("xf86OpenConsole: VT_WAITACTIVE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ SYSCALL(result = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
+ if (result < 0)
{
- FatalError ("xf86OpenConsole: VT_GETMODE failed\n");
+ FatalError("xf86OpenConsole: VT_GETMODE failed\n");
}
signal(SIGUSR1, xf86VTRequest);
@@ -185,6 +189,10 @@ void xf86OpenConsole()
{
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
}
+
+ /* we really should have a InitOSInputDevices() function instead
+ * of Init?$#*&Device(). So I just place it here */
+
#ifdef USE_DEV_FB
/* copy info to new console */
var.yoffset=0;
@@ -200,19 +208,23 @@ void xf86OpenConsole()
/*
* now get the VT
*/
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
+ if (result != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
+ if (result != 0)
{
- ErrorF("xf86OpenConsole: VT_WAITACTIVE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
}
return;
}
-void xf86CloseConsole()
+void
+xf86CloseConsole()
{
struct vt_mode VT;
@@ -238,10 +250,8 @@ void xf86CloseConsole()
return;
}
-int xf86ProcessArgument (argc, argv, i)
-int argc;
-char *argv[];
-int i;
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
{
/*
* Keep server from detaching from controlling tty. This is useful
@@ -265,7 +275,8 @@ int i;
return(0);
}
-void xf86UseMsg()
+void
+xf86UseMsg()
{
ErrorF("vtXX use the specified VT number\n");
ErrorF("-keeptty ");
diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c
index 57a2979c5..741b9a279 100644
--- a/hw/xfree86/os-support/linux/lnx_io.c
+++ b/hw/xfree86/os-support/linux/lnx_io.c
@@ -1,7 +1,7 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.3 1996/12/23 06:50:01 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.24 2002/10/20 21:45:27 tsi Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
+ * Copyright 1993 by David Dawes <dawes@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
@@ -23,23 +23,21 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: lnx_io.c,v 1.3 2000/08/17 19:51:23 cpqbld Exp $ */
+/* $XConsortium: lnx_io.c /main/8 1996/10/19 18:06:28 kaleb $ */
#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-void xf86SoundKbdBell(loudness, pitch, duration)
-int loudness;
-int pitch;
-int duration;
+#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
+
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
{
if (loudness && pitch)
{
@@ -50,20 +48,100 @@ int duration;
}
}
-void xf86SetKbdLeds(leds)
-int leds;
+void
+xf86SetKbdLeds(int leds)
{
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
+ ioctl(xf86Info.consoleFd, KDSETLED, leds);
}
-int xf86GetKbdLeds()
+int
+xf86GetKbdLeds()
{
- int leds;
+ int leds = 0;
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
+ ioctl(xf86Info.consoleFd, KDGETLED, &leds);
return(leds);
}
+/* kbd rate stuff based on kbdrate.c from Rik Faith <faith@cs.unc.edu> et.al.
+ * from util-linux-2.9t package */
+
+#include <linux/kd.h>
+#ifdef __sparc__
+#include <asm/param.h>
+#include <asm/kbio.h>
+#endif
+
+/* Deal with spurious kernel header change */
+#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42)
+# define rate period
+# endif
+#endif
+
+static int
+KDKBDREP_ioctl_ok(int rate, int delay) {
+#if defined(KDKBDREP) && !defined(__sparc__)
+ /* This ioctl is defined in <linux/kd.h> but is not
+ implemented anywhere - must be in some m68k patches. */
+ struct kbd_repeat kbdrep_s;
+
+ /* don't change, just test */
+ kbdrep_s.rate = -1;
+ kbdrep_s.delay = -1;
+ if (ioctl( 0, KDKBDREP, &kbdrep_s )) {
+ return 0;
+ }
+
+ /* do the change */
+ if (rate == 0) /* switch repeat off */
+ kbdrep_s.rate = 0;
+ else
+ kbdrep_s.rate = 10000 / rate; /* convert cps to msec */
+ if (kbdrep_s.rate < 1)
+ kbdrep_s.rate = 1;
+ kbdrep_s.delay = delay;
+ if (kbdrep_s.delay < 1)
+ kbdrep_s.delay = 1;
+
+ if (ioctl( 0, KDKBDREP, &kbdrep_s )) {
+ return 0;
+ }
+
+ return 1; /* success! */
+#else /* no KDKBDREP */
+ return 0;
+#endif /* KDKBDREP */
+}
+
+static int
+KIOCSRATE_ioctl_ok(int rate, int delay) {
+#ifdef KIOCSRATE
+ struct kbd_rate kbdrate_s;
+ int fd;
+
+ fd = open("/dev/kbd", O_RDONLY);
+ if (fd == -1)
+ return 0;
+
+ kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */
+ kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */
+ if (kbdrate_s.rate > 50)
+ kbdrate_s.rate = 50;
+
+ if (ioctl( fd, KIOCSRATE, &kbdrate_s ))
+ return 0;
+
+ close( fd );
+
+ return 1;
+#else /* no KIOCSRATE */
+ return 0;
+#endif /* KIOCSRATE */
+}
+
+#undef rate
+
#if NeedFunctionPrototypes
void xf86SetKbdRepeat(char rad)
#else
@@ -71,23 +149,101 @@ void xf86SetKbdRepeat(rad)
char rad;
#endif
{
- return;
+#ifdef __sparc__
+ int rate = 500; /* Default rate */
+ int delay = 200; /* Default delay */
+#else
+ int rate = 300; /* Default rate */
+ int delay = 250; /* Default delay */
+#endif
+
+#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
+ int i;
+ int timeout;
+ int value = 0x7f; /* Maximum delay with slowest rate */
+
+ static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
+ 133, 120, 109, 100, 92, 86, 80, 75, 67,
+ 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
+ 25, 23, 21, 20 };
+#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
+
+ static int valid_delays[] = { 250, 500, 750, 1000 };
+#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
+#endif
+
+ if (xf86Info.kbdRate >= 0)
+ rate = xf86Info.kbdRate * 10;
+ if (xf86Info.kbdDelay >= 0)
+ delay = xf86Info.kbdDelay;
+
+
+ if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */
+ return;
+
+ if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */
+ return;
+
+ if (xf86IsPc98())
+ return;
+
+#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
+
+ /* The ioport way */
+
+ for (i = 0; i < RATE_COUNT; i++)
+ if (rate >= valid_rates[i]) {
+ value &= 0x60;
+ value |= i;
+ break;
+ }
+
+ for (i = 0; i < DELAY_COUNT; i++)
+ if (delay <= valid_delays[i]) {
+ value &= 0x1f;
+ value |= i << 5;
+ break;
+ }
+
+ timeout = KBC_TIMEOUT;
+ while (((inb(0x64) & 2) == 2) && --timeout)
+ usleep(1000); /* wait */
+
+ if (timeout == 0)
+ return;
+
+ outb(0x60, 0xf3); /* set typematic rate */
+ while (((inb(0x64) & 2) == 2) && --timeout)
+ usleep(1000); /* wait */
+
+ usleep(10000);
+ outb(0x60, value);
+
+#endif /* __alpha__ || __i386__ || __ia64__ */
}
static int kbdtrans;
static struct termios kbdtty;
-void xf86KbdInit()
+void
+xf86KbdInit()
{
ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
tcgetattr (xf86Info.consoleFd, &kbdtty);
}
-int xf86KbdOn()
+int
+xf86KbdOn()
{
struct termios nTty;
+#ifdef __powerpc__
+ 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;
@@ -101,36 +257,11 @@ int xf86KbdOn()
return(xf86Info.consoleFd);
}
-int xf86KbdOff()
+int
+xf86KbdOff()
{
ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans);
tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
return(xf86Info.consoleFd);
}
-void xf86MouseInit(mouse)
-MouseDevPtr mouse;
-{
- return;
-}
-
-int xf86MouseOn(mouse)
-MouseDevPtr mouse;
-{
- if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Cannot open mouse (%s) - Continuing...\n",
- strerror(errno));
- return(-2);
- }
- FatalError("Cannot open mouse (%s)\n", strerror(errno));
- }
-
- xf86SetupMouse(mouse);
-
- /* Flush any pending input */
- tcflush(mouse->mseFd, TCIFLUSH);
-
- return(mouse->mseFd);
-}
diff --git a/hw/xfree86/os-support/linux/lnx_jstk.c b/hw/xfree86/os-support/linux/lnx_jstk.c
index ea308c159..2423bd45e 100644
--- a/hw/xfree86/os-support/linux/lnx_jstk.c
+++ b/hw/xfree86/os-support/linux/lnx_jstk.c
@@ -1,4 +1,4 @@
-/* $Xorg: lnx_jstk.c,v 1.3 2000/08/17 19:51:23 cpqbld Exp $ */
+/* $XConsortium: lnx_jstk.c /main/7 1996/02/21 17:51:36 kaleb $ */
/* Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp */
/*
* Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
@@ -23,19 +23,31 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c,v 3.6 1996/12/23 06:50:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c,v 3.13 1998/07/25 16:56:43 dawes Exp $ */
-static const char rcs_id[] = "$Xorg: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp";
+static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp";
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
+#include <errno.h>
#define inline __inline__
#include <linux/joystick.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-extern int errno;
+#ifdef XFree86LOADER
+#include "xf86.h"
+#include "xf86_ansic.h"
+#endif
+
+#if !defined(JSIOCGTIMELIMIT)
+/* make 2.1.x joystick.h backward compatable */
+#define JSIOCGTIMELIMIT JS_GET_TIMELIMIT
+#define JSIOCSTIMELIMIT JS_SET_TIMELIMIT
+#define js_status JS_DATA_TYPE
+#endif
+
/***********************************************************************
*
@@ -50,33 +62,30 @@ int
xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY)
{
int fd;
- struct JS_DATA_TYPE js;
- extern int xf86Verbose;
+ struct js_status js;
#ifdef DEBUG
ErrorF("xf86JoystickOn %s\n", name);
#endif
- if ((fd = open(name, O_RDWR | O_NDELAY)) < 0)
+ if ((fd = open(name, O_RDWR | O_NDELAY, 0)) < 0)
{
- ErrorF("Cannot open joystick '%s' (%s)\n", name,
- strerror(errno));
+ xf86Msg(X_WARNING, "Cannot open joystick '%s' (%s)\n", name,
+ strerror(errno));
return -1;
}
if (*timeout == 0) {
- if (ioctl (fd, JS_GET_TIMELIMIT, timeout) == -1) {
- Error("joystick JS_GET_TIMELIMIT ioctl");
+ if (ioctl (fd, JSIOCGTIMELIMIT, timeout) == -1) {
+ Error("joystick JSIOCGTIMELIMIT ioctl");
}
else {
- if (xf86Verbose) {
- ErrorF("(--) Joystick: timeout value = %d\n", *timeout);
- }
+ xf86Msg(X_CONFIG, "Joystick: timeout value = %d\n", *timeout);
}
}
else {
- if (ioctl(fd, JS_SET_TIMELIMIT, timeout) == -1) {
- Error("joystick JS_SET_TIMELIMIT ioctl");
+ if (ioctl(fd, JSIOCSTIMELIMIT, timeout) == -1) {
+ Error("joystick JSIOCSTIMELIMIT ioctl");
}
}
@@ -84,17 +93,13 @@ xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY)
read(fd, &js, JS_RETURN);
if (*centerX < 0) {
*centerX = js.x;
- if (xf86Verbose) {
- ErrorF("(--) Joystick: CenterX set to %d\n", *centerX);
- }
+ xf86Msg(X_CONFIG, "Joystick: CenterX set to %d\n", *centerX);
}
if (*centerY < 0) {
*centerY = js.y;
- if (xf86Verbose) {
- ErrorF("(--) Joystick: CenterY set to %d\n", *centerY);
- }
+ xf86Msg(X_CONFIG, "Joystick: CenterY set to %d\n", *centerY);
}
-
+
return fd;
}
@@ -123,9 +128,7 @@ xf86JoystickInit()
*/
int
-xf86JoystickOff(fd, doclose)
-int *fd;
-int doclose;
+xf86JoystickOff(int *fd, int doclose)
{
int oldfd;
@@ -146,14 +149,10 @@ int doclose;
*/
int
-xf86JoystickGetState(fd, x, y, buttons)
-int fd;
-int *x;
-int *y;
-int *buttons;
+xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
{
- struct JS_DATA_TYPE js;
- int status;
+ struct js_status js;
+ int status;
status = read(fd, &js, JS_RETURN);
@@ -170,4 +169,16 @@ int *buttons;
return 1;
}
+#ifdef XFree86LOADER
+/*
+ * Entry point for XFree86 Loader
+ */
+void
+linux_jstkModuleInit(pointer *data, INT32 *magic)
+{
+ *magic = MAGIC_DONE;
+ *data = NULL;
+}
+#endif
+
/* end of lnx_jstk.c */
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index a29db8251..107d5595e 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/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.13.2.1 1997/05/11 05:04:25 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.64 2003/02/17 15:29:22 dawes Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -23,7 +23,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: lnx_video.c,v 1.3 2000/08/17 19:51:23 cpqbld Exp $ */
+/* $XConsortium: lnx_video.c /main/9 1996/10/19 18:06:34 kaleb $ */
#include "X.h"
#include "input.h"
@@ -32,603 +32,1065 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-
+#include "xf86OSpriv.h"
+#include "lnx.h"
#ifdef __alpha__
+#include "xf86Axp.h"
+#endif
-/*
- * The Jensen lacks dense memory, thus we have to address the bus via
- * the sparse addressing scheme.
- *
- * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
- */
-
-#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
-#define SPARSE (5)
-#define isJensen (1)
-#else
-#define isJensen (!_bus_base())
-#define SPARSE (7)
+#ifdef HAS_MTRR_SUPPORT
+#include <asm/mtrr.h>
#endif
-#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base())
-#define JENSEN_SHIFT(x) (isJensen ? ((long)x<<SPARSE) : (long)x)
-#else
-#define BUS_BASE 0
-#define JENSEN_SHIFT(x) (x)
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
#endif
-/***************************************************************************/
-/* Video Memory Mapping section */
-/***************************************************************************/
+static Bool ExtendedEnabled = FALSE;
+
+#ifdef __ia64__
+
+#include "compiler.h"
+#include <sys/io.h>
+
+#elif !defined(__powerpc__) && \
+ !defined(__mc68000__) && \
+ !defined(__sparc__) && \
+ !defined(__mips__)
/*
- * Unfortunatly mmap without MAP_FIXED only works the first time :-(
- * This is now fixed in pl13 ALPHA, but still seems to have problems.
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+ * these.
*/
-#undef ONLY_MMAP_FIXED_WORKS
+extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
+extern int iopl(int __level);
-#ifdef ONLY_MMAP_FIXED_WORKS
-static pointer AllocAddress[MAXSCREENS][NUM_REGIONS];
#endif
-#if 0
-static struct xf86memMap {
- int offset;
- int memSize;
-} xf86memMaps[MAXSCREENS];
-#endif
+#ifdef __alpha__
-pointer xf86MapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
-{
- pointer base;
- int fd;
+# ifdef LIBC_IS_FIXED
+extern void sethae(unsigned long hae);
+# else
+# include <unistd.h>
+# define sethae(x) syscall(301,x);
+# endif
-#ifdef ONLY_MMAP_FIXED_WORKS
-#ifdef __alpha__
- FatalError("xf86MapVidMem: Unexpected code for Alpha (pagesize=8k!)\n");
-#endif
- AllocAddress[ScreenNum][Region] = (pointer)xalloc(Size + 0x1000);
- if (AllocAddress[ScreenNum][Region] == NULL)
- {
- FatalError("xf86MapVidMem: can't alloc framebuffer space\n");
- }
- base = (pointer)(((unsigned int)AllocAddress[ScreenNum][Region]
- & ~0xFFF) + 0x1000);
- if ((fd = open("/dev/mem", O_RDWR)) < 0)
- {
- FatalError("xf86MapVidMem: failed to open /dev/mem (%s)\n",
- strerror(errno));
- }
- base = (pointer)mmap((caddr_t)base, Size, PROT_READ|PROT_WRITE,
- MAP_FIXED|MAP_SHARED, fd, (off_t)Base);
-#else
- if ((fd = open("/dev/mem", O_RDWR)) < 0)
- {
- FatalError("xf86MapVidMem: failed to open /dev/mem (%s)\n",
- strerror(errno));
- }
- /* This requirers linux-0.99.pl10 or above */
- base = (pointer)mmap((caddr_t)0, JENSEN_SHIFT(Size),
- PROT_READ|PROT_WRITE,
- MAP_SHARED, fd,
- (off_t)(JENSEN_SHIFT((off_t)Base) + BUS_BASE));
-#endif
- close(fd);
- if ((long)base == -1)
- {
- FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
- strerror(errno));
- }
-#if 0
- xf86memMaps[ScreenNum].offset = (int) Base;
- xf86memMaps[ScreenNum].memSize = Size;
-#endif
- return base;
-}
+/* define to test the Sparse addressing on a non-Jensen */
+# ifdef TEST_JENSEN_CODE
+# define isJensen (1)
+# else
+# define isJensen (axpSystem == JENSEN)
+# endif
-#if 0
-void xf86GetVidMemData(ScreenNum, Base, Size)
-int ScreenNum;
-int *Base;
-int *Size;
-{
- *Base = xf86memMaps[ScreenNum].offset;
- *Size = xf86memMaps[ScreenNum].memSize;
-}
-#endif
+# define BUS_BASE bus_base
-void xf86UnMapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
-{
- munmap((caddr_t)JENSEN_SHIFT(Base), JENSEN_SHIFT(Size));
-#ifdef ONLY_MMAP_FIXED_WORKS
- xfree(AllocAddress[ScreenNum][Region]);
-#endif
-}
+#else
-Bool xf86LinearVidMem()
-{
- return(TRUE);
-}
+#define BUS_BASE (0)
+
+#endif /* __alpha__ */
/***************************************************************************/
-/* I/O Permissions section */
+/* Video Memory Mapping section */
/***************************************************************************/
-/*
- * Linux handles regular (<= 0x3ff) ports with the TSS I/O bitmap, and
- * extended ports with the iopl() system call.
- *
- * For testing, it's useful to enable only the ports we need, but for
- * production purposes, it's faster to enable all ports.
- */
-#define ALWAYS_USE_EXTENDED
+static pointer mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, pointer, unsigned long);
+#if defined (__alpha__)
+static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
+extern axpDevice lnxGetAXP(void);
+static void unmapVidMemSparse(int, pointer, unsigned long);
+# if defined(JENSEN_SUPPORT)
+static pointer mapVidMemJensen(int, unsigned long, unsigned long, int);
+static void unmapVidMemJensen(int, pointer, unsigned long);
+# endif
+static axpDevice axpSystem = -1;
+static Bool needSparse;
+static unsigned long hae_thresh;
+static unsigned long hae_mask;
+static unsigned long bus_base;
+static unsigned long sparse_size;
+#endif
-#ifdef ALWAYS_USE_EXTENDED
+#ifdef HAS_MTRR_SUPPORT
-static Bool ScreenEnabled[MAXSCREENS];
-static Bool ExtendedEnabled = FALSE;
-static Bool InitDone = FALSE;
+#define SPLIT_WC_REGIONS 1
-void xf86ClearIOPortList(ScreenNum)
-int ScreenNum;
-{
- if (!InitDone)
- {
- int i;
+static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, pointer);
+
+/* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
+ driver will clean up when we exit. */
+#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
+#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
+ a problem. */
+static int mtrr_fd = MTRR_FD_UNOPENED;
- for (i = 0; i < MAXSCREENS; i++)
- ScreenEnabled[i] = FALSE;
- InitDone = TRUE;
+/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0,
+ and will fail on Linux 2.2 with MTRR support configured out,
+ so verbosity should be chosen appropriately. */
+static Bool
+mtrr_open(int verbosity)
+{
+ /* Only report absence of /proc/mtrr once. */
+ static Bool warned = FALSE;
+
+ char **fn;
+ static char *mtrr_files[] = {
+ "/dev/cpu/mtrr", /* Possible future name */
+ "/proc/mtrr", /* Current name */
+ NULL
+ };
+
+ if (mtrr_fd == MTRR_FD_UNOPENED) {
+ /* So open it. */
+ for (fn = mtrr_files; mtrr_fd < 0 && *fn; fn++)
+ mtrr_fd = open(*fn, O_WRONLY);
+
+ if (mtrr_fd < 0)
+ mtrr_fd = MTRR_FD_PROBLEM;
}
- return;
-}
+ if (mtrr_fd == MTRR_FD_PROBLEM) {
+ /* To make sure we only ever warn once, need to check
+ verbosity outside xf86MsgVerb */
+ if (!warned && verbosity <= xf86GetVerbosity()) {
+ xf86MsgVerb(X_WARNING, verbosity,
+ "System lacks support for changing MTRRs\n");
+ warned = TRUE;
+ }
-void xf86AddIOPorts(ScreenNum, NumPorts, Ports)
-int ScreenNum;
-int NumPorts;
-unsigned *Ports;
-{
- return;
+ return FALSE;
+ }
+ else
+ return TRUE;
}
-void xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
-{
- int i;
+/*
+ * We maintain a list of WC regions for each physical mapping so they can
+ * be undone when unmapping.
+ */
- ScreenEnabled[ScreenNum] = TRUE;
+struct mtrr_wc_region {
+ struct mtrr_sentry sentry;
+ Bool added; /* added WC or removed it */
+ struct mtrr_wc_region * next;
+};
- if (ExtendedEnabled)
- return;
-
-#ifndef __mc68000__
- if (iopl(3))
- FatalError("%s: Failed to set IOPL for I/O\n",
- "xf86EnableIOPorts");
-#endif
- ExtendedEnabled = TRUE;
+static struct mtrr_wc_region *
+mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
+ MessageType from)
+{
+ /* Some BIOS writers thought that setting wc over the mmio
+ region of a graphics devices was a good idea. Try to fix
+ it. */
+
+ struct mtrr_gentry gent;
+ char buf[20];
+ struct mtrr_wc_region *wcreturn = NULL, *wcr;
+
+ /* Linux 2.0 users should not get a warning without -verbose */
+ if (!mtrr_open(2))
+ return NULL;
+
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0;
+ gent.regnum++) {
+ if (gent.type != MTRR_TYPE_WRCOMB
+ || gent.base + gent.size <= base
+ || base + size <= gent.base)
+ continue;
- return;
+ /* Found an overlapping region. Delete it. */
+
+ wcr = xalloc(sizeof(*wcr));
+ if (!wcr)
+ return NULL;
+ wcr->sentry.base = gent.base;
+ wcr->sentry.size = gent.size;
+ wcr->sentry.type = MTRR_TYPE_WRCOMB;
+ wcr->added = FALSE;
+
+ /* There is now a nicer ioctl-based way to do this,
+ but it isn't in current kernels. */
+ snprintf(buf, sizeof(buf), "disable=%u\n", gent.regnum);
+
+ if (write(mtrr_fd, buf, strlen(buf)) >= 0) {
+ xf86DrvMsg(screenNum, from,
+ "Removed MMIO write-combining range "
+ "(0x%lx,0x%lx)\n",
+ gent.base, gent.size);
+ wcr->next = wcreturn;
+ wcreturn = wcr;
+ } else {
+ xfree(wcr);
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to remove MMIO "
+ "write-combining range (0x%lx,0x%lx)\n",
+ gent.base, gent.size);
+ }
+ }
+ return wcreturn;
}
-void xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
+
+static struct mtrr_wc_region *
+mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
+ MessageType from)
{
- int i;
+ struct mtrr_wc_region *wcr;
- ScreenEnabled[ScreenNum] = FALSE;
+ /* Linux 2.0 should not warn, unless the user explicitly asks for
+ WC. */
+ if (!mtrr_open(from == X_CONFIG ? 0 : 2))
+ return NULL;
- if (!ExtendedEnabled)
- return;
+ wcr = xalloc(sizeof(*wcr));
+ if (!wcr)
+ return NULL;
- for (i = 0; i < MAXSCREENS; i++)
- if (ScreenEnabled[i])
- return;
+ wcr->sentry.base = base;
+ wcr->sentry.size = size;
+ wcr->sentry.type = MTRR_TYPE_WRCOMB;
+ wcr->added = TRUE;
+ wcr->next = NULL;
-#ifndef __mc68000__
- iopl(0);
-#endif
- ExtendedEnabled = FALSE;
+#if SPLIT_WC_REGIONS
+ /*
+ * Splits up the write-combining region if it is not aligned on a
+ * size boundary.
+ */
- return;
+ {
+ unsigned long lbase, d_size = 1;
+ unsigned long n_size = size;
+ unsigned long n_base = base;
+
+ for (lbase = n_base, d_size = 1; !(lbase & 1);
+ lbase = lbase >> 1, d_size <<= 1);
+ while (d_size > n_size)
+ d_size = d_size >> 1;
+#ifdef DEBUG
+ ErrorF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1);
+#endif
+ n_base += d_size;
+ n_size -= d_size;
+ if (n_size) {
+ xf86DrvMsgVerb(screenNum,X_INFO,3,"Splitting WC range: "
+ "base: 0x%lx, size: 0x%lx\n",base,size);
+ wcr->next = mtrr_add_wc_region(screenNum, n_base, n_size,from);
+ }
+ wcr->sentry.size = d_size;
+ }
+
+ /*****************************************************************/
+#endif /* SPLIT_WC_REGIONS */
+
+ if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &wcr->sentry) >= 0) {
+ /* Avoid printing on every VT switch */
+ if (xf86ServerIsInitialising()) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n",
+ base, size);
+ }
+ return wcr;
+ }
+ else {
+ xfree(wcr);
+
+ /* Don't complain about the VGA region: MTRR fixed
+ regions aren't currently supported, but might be in
+ the future. */
+ if ((unsigned long)base >= 0x100000) {
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to set up write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ }
+ return NULL;
+ }
}
-#else /* !ALWAYS_USE_EXTENDED */
-
-static unsigned *EnabledPorts[MAXSCREENS];
-static int NumEnabledPorts[MAXSCREENS];
-static Bool ScreenEnabled[MAXSCREENS];
-static Bool ExtendedPorts[MAXSCREENS];
-static Bool ExtendedEnabled = FALSE;
-static Bool InitDone = FALSE;
-
-void xf86ClearIOPortList(ScreenNum)
-int ScreenNum;
+static void
+mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
{
- if (!InitDone)
- {
- xf86InitPortLists(EnabledPorts, NumEnabledPorts,
- ScreenEnabled, ExtendedPorts, MAXSCREENS);
- InitDone = TRUE;
- return;
+ struct mtrr_wc_region *p, *prev;
+
+ if (mtrr_fd > 0) {
+ p = wcr;
+ while (p) {
+ if (p->added)
+ ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
+ prev = p;
+ p = p->next;
+ xfree(prev);
+ }
}
- ExtendedPorts[ScreenNum] = FALSE;
- if (EnabledPorts[ScreenNum] != (unsigned *)NULL)
- xfree(EnabledPorts[ScreenNum]);
- EnabledPorts[ScreenNum] = (unsigned *)NULL;
- NumEnabledPorts[ScreenNum] = 0;
}
-void xf86AddIOPorts(ScreenNum, NumPorts, Ports)
-int ScreenNum;
-int NumPorts;
-unsigned *Ports;
+static pointer
+setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
{
- int i;
-
- if (!InitDone)
- {
- FatalError("xf86AddIOPorts: I/O control lists not initialised\n");
- }
- EnabledPorts[ScreenNum] = (unsigned *)xrealloc(EnabledPorts[ScreenNum],
- (NumEnabledPorts[ScreenNum]+NumPorts)*sizeof(unsigned));
- for (i = 0; i < NumPorts; i++)
- {
- EnabledPorts[ScreenNum][NumEnabledPorts[ScreenNum] + i] =
- Ports[i];
- if (Ports[i] > 0x3FF)
- ExtendedPorts[ScreenNum] = TRUE;
- }
- NumEnabledPorts[ScreenNum] += NumPorts;
+ if (enable)
+ return mtrr_add_wc_region(screenNum, base, size, from);
+ else
+ return mtrr_cull_wc_region(screenNum, base, size, from);
}
-void xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
+static void
+undoWC(int screenNum, pointer regioninfo)
{
- int i;
+ mtrr_undo_wc_region(screenNum, regioninfo);
+}
- if (ScreenEnabled[ScreenNum])
- return;
+#endif /* HAS_MTRR_SUPPORT */
- for (i = 0; i < MAXSCREENS; i++)
- {
- if (ExtendedPorts[i] && (ScreenEnabled[i] || i == ScreenNum))
- {
-#ifndef __mc68000__
- if (iopl(3))
- {
- FatalError("%s: Failed to set IOPL for extended I/O\n",
- "xf86EnableIOPorts");
- }
-#endif
- ExtendedEnabled = TRUE;
- break;
- }
- }
- /* Extended I/O was used, but not any more */
- if (ExtendedEnabled && i == MAXSCREENS)
- {
-#ifndef __mc68000__
- iopl(0);
-#endif
- ExtendedEnabled = FALSE;
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+#ifdef __alpha__
+ if (axpSystem == -1) {
+ axpSystem = lnxGetAXP();
+ if ((needSparse = (_bus_base_sparse() > 0))) {
+ hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
+ hae_mask = xf86AXPParams[axpSystem].hae_mask;
+ sparse_size = xf86AXPParams[axpSystem].size;
+ }
+ bus_base = _bus_base();
}
- /*
- * Turn on non-extended ports even when using extended I/O
- * so they are there if extended I/O gets turned off when it's no
- * longer needed.
- */
- for (i = 0; i < NumEnabledPorts[ScreenNum]; i++)
- {
- unsigned port = EnabledPorts[ScreenNum][i];
+ if (isJensen) {
+# ifndef JENSEN_SUPPORT
+ FatalError("Jensen is not supported any more\n"
+ "If you are intereseted in fixing Jensen support\n"
+ "please contact xfree86@xfree86.org\n");
+# else
+ xf86Msg(X_INFO,"Machine type is Jensen\n");
+ pVidMem->mapMem = mapVidMemJensen;
+ pVidMem->unmapMem = unmapVidMemJensen;
+# endif /* JENSEN_SUPPORT */
+ } else if (needSparse) {
+ xf86Msg(X_INFO,"Machine needs sparse mapping\n");
+ pVidMem->mapMem = mapVidMemSparse;
+ pVidMem->unmapMem = unmapVidMemSparse;
+ } else {
+ xf86Msg(X_INFO,"Machine type has 8/16 bit access\n");
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ }
+#else
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+#endif /* __alpha__ */
- if (port > 0x3FF)
- continue;
- if (xf86CheckPorts(port, EnabledPorts, NumEnabledPorts,
- ScreenEnabled, MAXSCREENS))
- {
- if (ioperm(port, 1, TRUE) < 0)
- {
- FatalError("%s: Failed to enable I/O port 0x%x (%s)\n",
- "xf86EnableIOPorts", port, strerror(errno));
- }
- }
- }
- ScreenEnabled[ScreenNum] = TRUE;
- return;
+#ifdef HAS_MTRR_SUPPORT
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
+#endif
+ pVidMem->initialised = TRUE;
}
-void xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
+#ifdef __sparc__
+/* Basically, you simply cannot do this on Sparc. You have to do something portable
+ * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
+ */
+static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ return NULL;
+}
+#else
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- int i;
+ pointer base;
+ int fd;
+ int mapflags = MAP_SHARED;
+ memType realBase, alignOff;
+
+ realBase = Base & ~(getpagesize() - 1);
+ alignOff = Base - realBase;
+#ifdef DEBUG
+ ErrorF("base: %lx, realBase: %lx, alignOff: %lx \n",
+ Base,realBase,alignOff);
+#endif
+
+#if defined(__ia64__)
+#ifndef MAP_WRITECOMBINED
+#define MAP_WRITECOMBINED 0x00010000
+#endif
+#ifndef MAP_NONCACHED
+#define MAP_NONCACHED 0x00020000
+#endif
+ if(flags & VIDMEM_FRAMEBUFFER)
+ mapflags |= MAP_WRITECOMBINED;
+ else
+ mapflags |= MAP_NONCACHED;
+#endif
- if (!ScreenEnabled[ScreenNum])
- return;
+#if defined(__ia64__)
+ /* this will disappear when people upgrade their kernels */
+ if ((fd = open(DEV_MEM, O_RDWR|O_SYNC)) < 0)
+#else
+ if ((fd = open(DEV_MEM, O_RDWR)) < 0)
+#endif
+ {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
+ }
+ /* This requires linux-0.99.pl10 or above */
+ base = mmap((caddr_t)0, Size + alignOff,
+ PROT_READ|PROT_WRITE,
+ mapflags, fd,
+ (off_t)(off_t)realBase + BUS_BASE);
+ close(fd);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer"
+ " (0x%08x,0x%x) (%s)\n", Base, Size,
+ strerror(errno));
+ }
+#ifdef DEBUG
+ ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff);
+#endif
+ return (char *)base + alignOff;
+}
+#endif /* !(__sparc__) */
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ memType alignOff = (memType)Base
+ - ((memType)Base & ~(getpagesize() - 1));
+
+#ifdef DEBUG
+ ErrorF("alignment offset: %lx\n",alignOff);
+#endif
+ munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
+}
- ScreenEnabled[ScreenNum] = FALSE;
- for (i = 0; i < MAXSCREENS; i++)
- {
- if (ScreenEnabled[i] && ExtendedPorts[i])
- break;
- }
- if (ExtendedEnabled && i == MAXSCREENS)
- {
-#ifndef __mc68000__
- iopl(0);
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+#if defined(__powerpc__)
+volatile unsigned char *ioBase = NULL;
+
+#ifndef __NR_pciconfig_iobase
+#define __NR_pciconfig_iobase 200
#endif
- ExtendedEnabled = FALSE;
- }
- for (i = 0; i < NumEnabledPorts[ScreenNum]; i++)
- {
- unsigned port = EnabledPorts[ScreenNum][i];
- if (port > 0x3FF)
- continue;
+#endif
- if (xf86CheckPorts(port, EnabledPorts, NumEnabledPorts,
- ScreenEnabled, MAXSCREENS))
- {
- ioperm(port, 1, FALSE);
+void
+xf86EnableIO(void)
+{
+#if defined(__powerpc__)
+ int fd;
+ unsigned int ioBase_phys;
+#endif
+
+ if (ExtendedEnabled)
+ return;
+
+#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__) && !defined(__sh__) && !defined(__hppa__)
+ if (ioperm(0, 1024, 1) || iopl(3))
+ FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n");
+# if !defined(__alpha__)
+ ioperm(0x40,4,0); /* trap access to the timer chip */
+ ioperm(0x60,4,0); /* trap access to the keyboard controller */
+# endif
+#endif
+ ExtendedEnabled = TRUE;
+
return;
}
-#endif /* ALWAYS_USE_EXTENDED */
-
-void xf86DisableIOPrivs()
+void
+xf86DisableIO(void)
{
-#ifndef __mc68000__
- if (ExtendedEnabled)
- iopl(0);
+ if (!ExtendedEnabled)
+ return;
+#if defined(__powerpc__)
+ munmap(ioBase, 0x20000);
+ ioBase = NULL;
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__)
+ iopl(0);
+ ioperm(0, 1024, 0);
#endif
+ ExtendedEnabled = FALSE;
+
return;
}
+
/***************************************************************************/
/* Interrupt Handling section */
/***************************************************************************/
-Bool xf86DisableInterrupts()
+/* XXX The #ifdefs should be made simpler. */
+
+Bool
+xf86DisableInterrupts()
{
+#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__)
if (!ExtendedEnabled)
-#ifndef __mc68000__
- if (iopl(3))
+ if (iopl(3) || ioperm(0, 1024, 1))
return (FALSE);
#endif
-#if defined(__alpha__) || defined(__mc68000__)
-#else
-#ifdef __GNUC__
- __asm__ __volatile__("cli");
+#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__)
#else
+# ifdef __GNUC__
+# if defined(__ia64__)
+# if 0
+ __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory");
+# endif
+# else
+ __asm__ __volatile__("cli");
+# endif
+# else
asm("cli");
+# endif
#endif
-#endif
-#ifndef __mc68000__
- if (!ExtendedEnabled)
- iopl(0);
+#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__)
+ if (!ExtendedEnabled) {
+ iopl(0);
+ ioperm(0, 1024, 0);
+ }
+
#endif
return (TRUE);
}
-void xf86EnableInterrupts()
+void
+xf86EnableInterrupts()
{
+#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__)
if (!ExtendedEnabled)
-#ifndef __mc68000__
- if (iopl(3))
+ if (iopl(3) || ioperm(0, 1024, 1))
return;
#endif
-#if defined(__alpha__) || defined(__mc68000__)
-#else
-#ifdef __GNUC__
- __asm__ __volatile__("sti");
+#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__)
#else
+# ifdef __GNUC__
+# if defined(__ia64__)
+# if 0
+ __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory");
+# endif
+# else
+ __asm__ __volatile__("sti");
+# endif
+# else
asm("sti");
+# endif
#endif
-#endif
-#ifndef __mc68000__
- if (!ExtendedEnabled)
- iopl(0);
+#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__)
+ if (!ExtendedEnabled) {
+ iopl(0);
+ ioperm(0, 1024, 0);
+ }
#endif
return;
}
-#if defined(__alpha__)
+#if defined (__alpha__)
-static int xf86SparseShift = 5; /* default to all but JENSEN */
+#define vuip volatile unsigned int *
-pointer xf86MapVidMemSparse(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+extern int readDense8(pointer Base, register unsigned long Offset);
+extern int readDense16(pointer Base, register unsigned long Offset);
+extern int readDense32(pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense8(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense16(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense32(int Value, pointer Base, register unsigned long Offset);
+
+static int readSparse8(pointer Base, register unsigned long Offset);
+static int readSparse16(pointer Base, register unsigned long Offset);
+static int readSparse32(pointer Base, register unsigned long Offset);
+static void
+writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse32(int Value, pointer Base, register unsigned long Offset);
+
+#define DENSE_BASE 0x2ff00000000UL
+#define SPARSE_BASE 0x30000000000UL
+
+static unsigned long msb_set = 0;
+
+static pointer
+mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- pointer base;
- int fd;
+ int fd;
+ unsigned long ret, rets = 0;
+
+ static Bool was_here = FALSE;
+
+ if (!was_here) {
+ was_here = TRUE;
+
+ xf86WriteMmio8 = writeSparse8;
+ xf86WriteMmio16 = writeSparse16;
+ xf86WriteMmio32 = writeSparse32;
+ xf86WriteMmioNB8 = writeSparseNB8;
+ xf86WriteMmioNB16 = writeSparseNB16;
+ xf86WriteMmioNB32 = writeSparseNB32;
+ xf86ReadMmio8 = readSparse8;
+ xf86ReadMmio16 = readSparse16;
+ xf86ReadMmio32 = readSparse32;
+ }
+
+ if ((fd = open(DEV_MEM, O_RDWR)) < 0) {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
+ }
+
+#if 0
+ xf86Msg(X_INFO,"mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
+ Base, Size, flags);
+#endif
- if (!_bus_base()) xf86SparseShift = 7; /* Uh, oh, JENSEN... */
+ /* This requirers linux-0.99.pl10 or above */
+
+ /*
+ * Always do DENSE mmap, since read32/write32 currently require it.
+ */
+ ret = (unsigned long)mmap((caddr_t)(DENSE_BASE + Base), Size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd,
+ (off_t) (bus_base + Base));
+
+ /*
+ * Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER
+ * and SPARSE (which should require the use of read/write macros).
+ *
+ * By not SPARSE mmapping an 8MB framebuffer, we can save approx. 256K
+ * bytes worth of pagetable (32 pages).
+ */
+ if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
+ {
+ rets = (unsigned long)mmap((caddr_t)(SPARSE_BASE + (Base << 5)),
+ Size << 5, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd,
+ (off_t) _bus_base_sparse() + (Base << 5));
+ }
- Size <<= xf86SparseShift;
- Base = (pointer)((unsigned long)Base << xf86SparseShift);
+ close(fd);
+
+ if (ret == (unsigned long)MAP_FAILED) {
+ FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n",
+ strerror(errno));
+ }
- if ((fd = open("/dev/mem", O_RDWR)) < 0)
+ if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
+ {
+ if (rets == (unsigned long)MAP_FAILED ||
+ rets != (SPARSE_BASE + (Base << 5)))
{
- FatalError("xf86MapVidMem: failed to open /dev/mem (%s)\n",
- strerror(errno));
+ FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
+ strerror(errno));
}
- /* This requirers linux-0.99.pl10 or above */
- base = (pointer)mmap((caddr_t)0, Size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, fd,
- (off_t)Base + _bus_base_sparse());
- close(fd);
- if ((long)base == -1)
- {
- FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
- strerror(errno));
+ }
+
+#if 1
+ if (rets)
+ xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
+ Base, Size, ret, rets);
+ else
+ xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE only at 0x%lx\n",
+ Base, Size, ret);
+
+#endif
+ return (pointer) ret;
+}
+
+static void
+unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
+{
+ unsigned long Offset = (unsigned long)Base - DENSE_BASE;
+#if 1
+ xf86Msg(X_INFO,"unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
+ Base, Size);
+#endif
+ /* Unmap DENSE always. */
+ munmap((caddr_t)Base, Size);
+
+ /* Unmap SPARSE always, and ignore error in case we did not map it. */
+ munmap((caddr_t)(SPARSE_BASE + (Offset << 5)), Size << 5);
+}
+
+static int
+readSparse8(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+ register unsigned long msb;
+
+ mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ shift = (Offset & 0x3) << 3;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
}
- return base;
+ }
+
+ mem_barrier();
+ result = *(vuip) (SPARSE_BASE + (Offset << 5));
+ result >>= shift;
+ return 0xffUL & result;
}
-void xf86UnMapVidMemSparse(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static int
+readSparse16(pointer Base, register unsigned long Offset)
{
- Size <<= xf86SparseShift;
+ register unsigned long result, shift;
+ register unsigned long msb;
+
+ mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ shift = (Offset & 0x2) << 3;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
- munmap((caddr_t)Base, Size);
+ mem_barrier();
+ result = *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2)));
+ result >>= shift;
+ return 0xffffUL & result;
}
-#define vuip volatile unsigned int *
+static int
+readSparse32(pointer Base, register unsigned long Offset)
+{
+ /* NOTE: this is really using DENSE. */
+ mem_barrier();
+ return *(vuip)((unsigned long)Base+(Offset));
+}
-extern void sethae(unsigned long hae);
+static void
+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 - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+
+ write_mem_barrier();
+ *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
+}
-int xf86ReadSparse8(Base, Offset)
-pointer Base;
-unsigned long Offset;
+static void
+writeSparse16(int Value, pointer Base, register unsigned long Offset)
{
- unsigned long result, shift;
- unsigned long msb = 0;
+ register unsigned long msb;
+ register unsigned int w = Value & 0xffffU;
+
+ write_mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
- shift = (Offset & 0x3) * 8;
- if (xf86SparseShift != 7) { /* if not JENSEN, we may need HAE */
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000UL;
- Offset -= msb;
- if (msb) {
- sethae(msb);
- }
- }
+ write_mem_barrier();
+ *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))) = w * 0x00010001;
+}
+
+static void
+writeSparse32(int Value, pointer Base, register unsigned long Offset)
+{
+ /* NOTE: this is really using DENSE. */
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base + (Offset)) = Value;
+ return;
+}
+
+static void
+writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int b = Value & 0xffU;
+
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
- result = *(vuip) ((unsigned long)Base + (Offset << xf86SparseShift));
- if (msb)
- sethae(0);
+ *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
+}
+
+static void
+writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int w = Value & 0xffffU;
+
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+ *(vuip)(SPARSE_BASE+(Offset<<5)+(1<<(5-2))) = w * 0x00010001;
+}
+
+static void
+writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ /* NOTE: this is really using DENSE. */
+ *(vuip)((unsigned long)Base + (Offset)) = Value;
+ return;
+}
+
+void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset)
+ = writeDense8;
+void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset)
+ = writeDense16;
+void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset)
+ = writeDense32;
+void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB8;
+void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB16;
+void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB32;
+int (*xf86ReadMmio8)(pointer Base, unsigned long Offset)
+ = readDense8;
+int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
+ = readDense16;
+int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
+ = readDense32;
+
+#ifdef JENSEN_SUPPORT
+
+static int
+readSparseJensen8(pointer Base, register unsigned long Offset);
+static int
+readSparseJensen16(pointer Base, register unsigned long Offset);
+static int
+readSparseJensen32(pointer Base, register unsigned long Offset);
+static void
+writeSparseJensen8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensen16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensen32(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset);
+
+/*
+ * The Jensen lacks dense memory, thus we have to address the bus via
+ * the sparse addressing scheme.
+ *
+ * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
+ */
+
+#ifdef TEST_JENSEN_CODE
+#define SPARSE (5)
+#else
+#define SPARSE (7)
+#endif
+
+#define JENSEN_SHIFT(x) ((long)x<<SPARSE)
+
+static pointer
+mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+ int fd;
+
+ xf86WriteMmio8 = writeSparseJensen8;
+ xf86WriteMmio16 = writeSparseJensen16;
+ xf86WriteMmio32 = writeSparseJensen32;
+ xf86WriteMmioNB8 = writeSparseJensenNB8;
+ xf86WriteMmioNB16 = writeSparseJensenNB16;
+ xf86WriteMmioNB32 = writeSparseJensenNB32;
+ xf86ReadMmio8 = readSparseJensen8;
+ xf86ReadMmio16 = readSparseJensen16;
+ xf86ReadMmio32 = readSparseJensen32;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) < 0) {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
+ }
+ /* This requires linux-0.99.pl10 or above */
+ base = mmap((caddr_t)0, JENSEN_SHIFT(Size),
+ PROT_READ|PROT_WRITE,
+ MAP_SHARED, fd,
+ (off_t)(JENSEN_SHIFT((off_t)Base) + _bus_base_sparse()));
+ close(fd);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer"
+ " (0x%08x,0x%x) (%s)\n", Base, Size,
+ strerror(errno));
+ }
+ return base;
+}
+
+static void
+unmapVidMemJensen(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap((caddr_t)Base, JENSEN_SHIFT(Size));
+}
+
+static int
+readSparseJensen8(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+
+ mem_barrier();
+ shift = (Offset & 0x3) << 3;
+
+ result = *(vuip) ((unsigned long)Base + (Offset << SPARSE));
+
result >>= shift;
return 0xffUL & result;
}
-int xf86ReadSparse16(Base, Offset)
-pointer Base;
-unsigned long Offset;
+static int
+readSparseJensen16(pointer Base, register unsigned long Offset)
{
- unsigned long result, shift;
- unsigned long msb = 0;
+ register unsigned long result, shift;
+
+ mem_barrier();
+ shift = (Offset & 0x2) << 3;
+
+ result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2)));
- shift = (Offset & 0x2) * 8;
- if (xf86SparseShift != 7) { /* if not JENSEN, we may need HAE */
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000UL;
- Offset -= msb;
- if (msb) {
- sethae(msb);
- }
- }
- }
- result = *(vuip)((unsigned long)Base+(Offset<<xf86SparseShift)+(1<<(xf86SparseShift-2)));
- if (msb)
- sethae(0);
result >>= shift;
return 0xffffUL & result;
}
-int xf86ReadSparse32(Base, Offset)
-pointer Base;
-unsigned long Offset;
+static int
+readSparseJensen32(pointer Base, register unsigned long Offset)
{
- unsigned long result;
- unsigned long msb = 0;
+ register unsigned long result;
+
+ mem_barrier();
+ result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2)));
- if (xf86SparseShift != 7) { /* if not JENSEN, we may need HAE */
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000UL;
- Offset -= msb;
- if (msb) {
- sethae(msb);
- }
- }
- }
- result = *(vuip)((unsigned long)Base+(Offset<<xf86SparseShift)+(3<<(xf86SparseShift-2)));
- if (msb)
- sethae(0);
return result;
}
-void xf86WriteSparse8(Value, Base, Offset)
-int Value;
-pointer Base;
-unsigned long Offset;
+static void
+writeSparseJensen8(int Value, pointer Base, register unsigned long Offset)
{
- unsigned long msb = 0;
- unsigned int b = Value & 0xffU;
+ register unsigned int b = Value & 0xffU;
- if (xf86SparseShift != 7) { /* not JENSEN */
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
- Offset -= msb;
- if (msb) {
- sethae(msb);
- }
- }
- }
- *(vuip) ((unsigned long)Base + (Offset << xf86SparseShift)) = b * 0x01010101;
- if (msb)
- sethae(0);
+ write_mem_barrier();
+ *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101;
}
-void xf86WriteSparse16(Value, Base, Offset)
-int Value;
-pointer Base;
-unsigned long Offset;
+static void
+writeSparseJensen16(int Value, pointer Base, register unsigned long Offset)
{
- unsigned long msb = 0;
- unsigned int w = Value & 0xffffU;
+ register unsigned int w = Value & 0xffffU;
- if (xf86SparseShift != 7) { /* not JENSEN */
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
- Offset -= msb;
- if (msb) {
- sethae(msb);
- }
- }
- }
- *(vuip)((unsigned long)Base+(Offset<<xf86SparseShift)+(1<<(xf86SparseShift-2))) =
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) =
w * 0x00010001;
- if (msb)
- sethae(0);
}
-void xf86WriteSparse32(Value, Base, Offset)
-int Value;
-pointer Base;
-unsigned long Offset;
+static void
+writeSparseJensen32(int Value, pointer Base, register unsigned long Offset)
{
- unsigned long msb = 0;
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value;
+}
- if (xf86SparseShift != 7) { /* not JENSEN */
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
- Offset -= msb;
- if (msb) {
- sethae(msb);
- }
- }
- }
- *(vuip)((unsigned long)Base+(Offset<<xf86SparseShift)+(3<<(xf86SparseShift-2))) = Value;
- if (msb)
- sethae(0);
+static void
+writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned int b = Value & 0xffU;
+
+ *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101;
}
+
+static void
+writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned int w = Value & 0xffffU;
+
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) =
+ w * 0x00010001;
+}
+
+static void
+writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value;
+}
+#endif /* JENSEN_SUPPORT */
+
#endif /* __alpha__ */
diff --git a/hw/xfree86/os-support/lynxos/lynx_init.c b/hw/xfree86/os-support/lynxos/lynx_init.c
index 6c0e00aa3..8565dcc5c 100644
--- a/hw/xfree86/os-support/lynxos/lynx_init.c
+++ b/hw/xfree86/os-support/lynxos/lynx_init.c
@@ -22,36 +22,33 @@
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c,v 3.1.6.1 1998/02/06 22:36:51 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c,v 3.3 1998/08/29 05:43:58 dawes Exp $ */
#include "X.h"
#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
static int VTnum = -1;
-void xf86OpenConsole()
+void
+xf86OpenConsole()
{
struct vt_mode VT;
char vtname1[11];
- int i, fd, pgrp;
+ int fd, pgrp;
+ MessageType from = X_PROBED;
if (serverGeneration == 1)
{
/* check if we're run with euid==0 */
if (geteuid() != 0)
{
- FatalError("xf86OpenConsole: Server must be running with root "
- "permissions\n"
- "You should be using Xwrapper to start the server or xdm.\n"
- "We strongly advise against making the server SUID root!\n");
+ FatalError("xf86OpenConsole: Server must be suid root\n");
}
/*
@@ -67,6 +64,7 @@ void xf86OpenConsole()
if (VTnum != -1)
{
xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
}
else
{
@@ -88,7 +86,7 @@ void xf86OpenConsole()
}
close(fd);
}
- ErrorF("(using VT number %d)\n\n", xf86Info.vtno);
+ xf86Msg(from, "using VT number %d\n", xf86Info.vtno);
sprintf(vtname1,"/dev/atc%d",xf86Info.vtno);
@@ -104,19 +102,12 @@ void xf86OpenConsole()
/* change ownership of the vt */
chown(vtname1, getuid(), getgid());
- /* Reading Config after opening the VT get's rid of */
- /* problems with LynxOS VT handling (i.e. VT_OPENQUERY */
- /* without open() leaves the vtxx busy until next */
- /* open/close) */
-
- xf86Config(FALSE); /* Read XF86Config */
-
/*
* now get the VT
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
{
@@ -142,20 +133,21 @@ void xf86OpenConsole()
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
/*
* If the server doesn't have the VT when the reset occurs,
* this is to make sure we don't continue until the activate
* signal is received.
*/
- if (!xf86VTSema)
+ if (!xf86Screens[0]->vtSema)
sleep(5);
}
return;
}
-void xf86CloseConsole()
+void
+xf86CloseConsole()
{
struct vt_mode VT;
@@ -172,10 +164,8 @@ void xf86CloseConsole()
return;
}
-int xf86ProcessArgument (argc, argv, i)
-int argc;
-char *argv[];
-int i;
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
{
if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
{
@@ -190,7 +180,8 @@ int i;
return(0);
}
-void xf86UseMsg()
+void
+xf86UseMsg()
{
ErrorF("vtXX use the specified VT number\n");
return;
diff --git a/hw/xfree86/os-support/lynxos/lynx_io.c b/hw/xfree86/os-support/lynxos/lynx_io.c
index e0134609e..e61ce76b7 100644
--- a/hw/xfree86/os-support/lynxos/lynx_io.c
+++ b/hw/xfree86/os-support/lynxos/lynx_io.c
@@ -21,25 +21,20 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c,v 3.3 1996/08/10 13:07:36 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c,v 3.10 2003/02/17 15:11:57 dawes Exp $ */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
#if defined(KDMKTONE) || defined(KIOCSOUND)
/* Lynx 2.2.1 has sophisticated atc stuff.... */
-void xf86SoundKbdBell(loudness, pitch, duration)
-int loudness;
-int pitch;
-int duration;
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
{
if (loudness && pitch)
{
@@ -73,10 +68,8 @@ int duration;
#define FREQ_LO(f) ((TIMER_CONSTANT / (f)) % 256)
#define FREQ_HI(f) ((TIMER_CONSTANT / (f)) / 256)
-void xf86SoundKbdBell(loudness, pitch, duration)
-int loudness;
-int pitch;
-int duration;
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
{
int flo = FREQ_LO(pitch);
int fhi = FREQ_HI(pitch);
@@ -93,28 +86,43 @@ int duration;
}
#endif
-void xf86SetKbdLeds(leds)
-int leds;
+void
+xf86SetKbdLeds(int leds)
{
+#ifdef KBD_SET_LEDS
+ ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds);
+#endif
}
-int xf86GetKbdLeds()
+int
+xf86GetKbdLeds()
{
+#ifdef KBD_SET_LEDS
+ int leds;
+
+ if (ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds) < 0)
+ return 0;
+
+ return leds;
+#endif
return 0;
}
-void xf86SetKbdRepeat(char rad)
+void
+xf86SetKbdRepeat(char rad)
{
}
static struct termio kbdtty;
-void xf86KbdInit()
+void
+xf86KbdInit()
{
ioctl(xf86Info.consoleFd, TCGETA, &kbdtty);
}
-int xf86KbdOn()
+int
+xf86KbdOn()
{
struct termio nTty;
@@ -136,7 +144,8 @@ int xf86KbdOn()
return(xf86Info.consoleFd);
}
-int xf86KbdOff()
+int
+xf86KbdOff()
{
/* disable scan mode */
ioctl(xf86Info.consoleFd, TIO_DISSCANMODE, NULL);
@@ -144,29 +153,10 @@ int xf86KbdOff()
return(xf86Info.consoleFd);
}
-void xf86MouseInit(mouse)
-MouseDevPtr mouse;
-{
- return;
-}
+#include "xf86OSKbd.h"
-int xf86MouseOn(mouse)
-MouseDevPtr mouse;
+Bool
+xf86OSKbdPreInit(InputInfoPtr pInfo)
{
- if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Cannot open mouse (%s) - Continuing...\n",
- strerror(errno));
- return(-2);
- }
- FatalError("Cannot open mouse (%s)\n", strerror(errno));
- }
-
- /* assert DTR */
- ioctl(mouse->mseFd, TIOCSDTR, NULL);
-
- xf86SetupMouse(mouse);
-
- return(mouse->mseFd);
+ return FALSE;
}
diff --git a/hw/xfree86/os-support/lynxos/lynx_mmap.c b/hw/xfree86/os-support/lynxos/lynx_mmap.c
index 621f42c5d..dcf734965 100644
--- a/hw/xfree86/os-support/lynxos/lynx_mmap.c
+++ b/hw/xfree86/os-support/lynxos/lynx_mmap.c
@@ -21,11 +21,9 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c,v 3.2 1996/09/29 13:38:29 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c,v 3.6 2000/02/11 22:36:02 dawes Exp $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "xf86.h"
#include "xf86Priv.h"
@@ -35,26 +33,30 @@
* Read BIOS using smem_create facility
*/
-int xf86ReadBIOS(Base, Offset, Buf, Len)
-unsigned long Base;
-unsigned long Offset;
-unsigned char *Buf;
-int Len;
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
{
+#if defined(__powerpc__)
+ xf86Msg(X_WARNING, "xf86ReadBios: no BIOS-probe on PowerPC\n");
+ return(-1);
+#else
char *p;
int mlen;
- mlen = (Offset + Len + 4095) & ~4096;
+ mlen = (Offset + Len + 4095) & ~4095;
p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ);
if (p == NULL)
{
/* check if there is a stale segment around */
if (smem_remove("BIOS-probe") == 0) {
- ErrorF("xf86ReadBios: removed stale smem_ segment\n");
+ xf86Msg(X_INFO,
+ "xf86ReadBios: removed stale smem_ segment\n");
p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ);
}
if (p == NULL) {
- ErrorF("xf86ReadBios: Failed to smem_create Base %x len %x %s \n",
+ xf86Msg(X_WARNING, "xf86ReadBios: Failed to smem_create "
+ "Base %x len %x %s \n",
Base, mlen, strerror(errno));
return(-1);
}
@@ -63,4 +65,5 @@ int Len;
smem_create(NULL, p, 0, SM_DETACH);
smem_remove("BIOS-probe");
return(Len);
+#endif
}
diff --git a/hw/xfree86/os-support/lynxos/lynx_video.c b/hw/xfree86/os-support/lynxos/lynx_video.c
index 94b2f0ecd..c667994b3 100644
--- a/hw/xfree86/os-support/lynxos/lynx_video.c
+++ b/hw/xfree86/os-support/lynxos/lynx_video.c
@@ -21,7 +21,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.2.4.1 1997/05/09 07:15:24 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.18 2002/12/14 04:41:14 dawes Exp $ */
#include "X.h"
#include "input.h"
@@ -30,6 +30,81 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(__powerpc__)
+
+# if defined(USE_MACHINE_ABSOLUTE)
+# include <machine/absolute.h>
+# else
+# define __USER_SPACE_INCLUDE
+# include <hw_absolute.h>
+# endif
+
+void ppcPciIoMap(int bus);
+#endif
+
+#if 0
+#define DEBUG
+#endif
+
+#ifdef HAS_MTRR_SUPPORT
+#include <sys/memrange.h>
+#define X_MTRR_ID "XFree86"
+
+static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, pointer);
+static Bool cleanMTRR(void);
+static int devMemFd = -1;
+#define MTRR_DEVICE "/dev/mtrr"
+#endif
+
+
+#if !defined(NO_MMAP)
+#include <sys/mman.h>
+
+int smem_remove(char *name)
+{
+ return(0);
+}
+
+char *smem_create(char *name, char *arg_addr, long size, int mode)
+{
+ int fd;
+ void *addr = 0;
+ char *retval;
+ size_t len = size;
+ int prot = PROT_READ|PROT_WRITE|PROT_UNCACHE;
+ int flags = MAP_SHARED;
+ off_t off = (off_t)arg_addr;
+
+ if ((fd = open("/dev/mem" , O_RDWR)) < 0)
+ {
+ retval = (char *)-1;
+ }
+ else
+ {
+ if (mode == SM_DETACH)
+ {
+ munmap(arg_addr, len);
+ retval = 0;
+ }
+ else
+ {
+ if ((retval = mmap (addr, len, prot, flags, fd, off) ) == MAP_FAILED)
+ {
+ retval = (char *)-1;
+ }
+ }
+
+ close(fd);
+ }
+
+ return(retval);
+}
+
+#endif
+
/***************************************************************************/
/* Video Memory Mapping section */
@@ -38,19 +113,24 @@
typedef struct
{
char name[16];
- pointer Base;
- long Size;
+ unsigned long Base;
+ unsigned long Size;
char *ptr;
int RefCnt;
}
_SMEMS;
-#define MAX_SMEMS 8
+#define MAX_SMEMS 16
static _SMEMS smems[MAX_SMEMS];
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
static void
-smemCleanup()
+smemCleanup(void)
{
int i;
@@ -60,18 +140,15 @@ smemCleanup()
(void)smem_remove(smems[i].name);
*smems[i].name = '\0';
smems[i].ptr = NULL;
- smems[i].Base = NULL;
+ smems[i].Base = 0;
smems[i].Size = 0;
smems[i].RefCnt = 0;
}
}
}
-pointer xf86MapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static pointer
+MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
static int once;
int free_slot = -1;
@@ -86,14 +163,15 @@ unsigned long Size;
{
if (!*smems[i].name && free_slot == -1)
free_slot = i;
- if (smems[i].Base == Base && smems[i].Size == Size && *smems[i].name) {
+ if (smems[i].Base == Base && smems[i].Size == Size
+ && *smems[i].name) {
smems[i].RefCnt++;
return smems[i].ptr;
}
}
if (i == MAX_SMEMS && free_slot == -1)
{
- FatalError("xf86MapVidMem: failed to smem_create Base %x Size %x (out of SMEMS entries)\n",
+ FatalError("MapVidMem: failed to smem_create Base %x Size %x (out of SMEMS entries)\n",
Base, Size);
}
@@ -101,53 +179,85 @@ unsigned long Size;
sprintf(smems[i].name, "Video-%d", i);
smems[i].Base = Base;
smems[i].Size = Size;
- smems[i].ptr = smem_create(smems[i].name, Base, Size, SM_READ|SM_WRITE);
+
+ xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x\n",
+ Base, Size);
+
+#if defined(__powerpc__)
+ if (((unsigned long)Base & PHYS_IO_MEM_START) != PHYS_IO_MEM_START) {
+ Base = Base | PHYS_IO_MEM_START;
+ }
+#endif
+
+ smems[i].ptr = smem_create(smems[i].name, (char *)Base, Size, SM_READ|SM_WRITE);
smems[i].RefCnt = 1;
if (smems[i].ptr == NULL)
{
/* check if there is a stale segment around */
if (smem_remove(smems[i].name) == 0) {
- ErrorF("xf86MapVidMem: removed stale smem_ segment %s\n",
- smems[i].name);
+ xf86Msg(X_INFO,
+ "MapVidMem: removed stale smem_ segment %s\n",
+ smems[i].name);
smems[i].ptr = smem_create(smems[i].name,
- Base, Size, SM_READ|SM_WRITE);
+ (char *)Base, Size, SM_READ|SM_WRITE);
}
if (smems[i].ptr == NULL) {
*smems[i].name = '\0';
- FatalError("xf86MapVidMem: failed to smem_create Base %x Size %x (%s)\n",
+ FatalError("MapVidMem: failed to smem_create Base %x Size %x (%s)\n",
Base, Size, strerror(errno));
}
}
+ xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x Ptr=0x%x\n",
+ Base, Size, smems[i].ptr);
return smems[i].ptr;
}
-void xf86UnMapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static void
+UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
int i;
+ xf86MsgVerb(X_INFO, 3, "UnMapVidMem: Base/Ptr=0x%x Size=0x%x\n",
+ Base, Size);
for (i = 0; i < MAX_SMEMS; i++)
{
- if (*smems[i].name && smems[i].ptr == Base && smems[i].Size == Size)
+ if (*smems[i].name && smems[i].ptr == Base
+ && smems[i].Size == Size)
{
if (--smems[i].RefCnt > 0)
return;
+
(void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH);
+ xf86MsgVerb(X_INFO, 3,
+ "UnMapVidMem: smem_create(%s, 0x%08x, ... "
+ "SM_DETACH)\n", smems[i].name, smems[i].ptr);
(void)smem_remove(smems[i].name);
*smems[i].name = '\0';
smems[i].RefCnt = 0;
return;
}
}
- ErrorF("xf86UnMapVidMem: no SMEM found for Base = %lx Size = %lx\n", Base, Size);
+ xf86MsgVerb(X_WARNING, 2,
+ "UnMapVidMem: no SMEM found for Base = %lx Size = %lx\n",
+ Base, Size);
}
-Bool xf86LinearVidMem()
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- return(TRUE);
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = MapVidMem;
+ pVidMem->unmapMem = UnMapVidMem;
+ pVidMem->setWC = 0;
+ pVidMem->undoWC = 0;
+#ifdef HAS_MTRR_SUPPORT
+ if (cleanMTRR()) {
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
+ }
+#endif
+ pVidMem->initialised = TRUE;
}
@@ -155,13 +265,442 @@ Bool xf86LinearVidMem()
/* Interrupt Handling section */
/***************************************************************************/
-Bool xf86DisableInterrupts()
+Bool
+xf86DisableInterrupts()
{
return(TRUE);
}
-void xf86EnableInterrupts()
+void
+xf86EnableInterrupts()
+{
+ return;
+}
+
+/***************************************************************************/
+/* I/O Permissions section for PowerPC */
+/***************************************************************************/
+
+#if defined(__powerpc__)
+
+volatile unsigned char *ioBase = MAP_FAILED;
+volatile unsigned char *pciConfBase = MAP_FAILED;
+
+static int IOEnabled;
+
+
+static void
+removeIOSmem(void)
+{
+ smem_create(NULL, (char *) ioBase, 0, SM_DETACH);
+ smem_remove("IOBASE");
+ ioBase = MAP_FAILED;
+}
+
+void
+xf86EnableIO()
{
+ if (IOEnabled++ == 0) {
+ ioBase = (unsigned char *) smem_create("IOBASE",
+ (char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE);
+ if (ioBase == MAP_FAILED) {
+ --IOEnabled;
+ FatalError("xf86EnableIO: Failed to map I/O\n");
+ } else {
+#ifdef DEBUG
+ ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n",
+ ioBase);
+#endif
+ atexit(removeIOSmem);
+ }
+ }
return;
}
+void
+xf86DisableIO()
+{
+ if (!IOEnabled)
+ return;
+
+ if (--IOEnabled == 0)
+ removeIOSmem();
+ return;
+}
+
+#if 0
+void
+xf86DisableIOPrivs(void)
+{
+ return;
+}
+#endif
+void
+ppcPciIoMap(int bus)
+{
+ xf86EnableIO();
+}
+
+#endif
+
+
+#ifdef HAS_MTRR_SUPPORT
+/* memory range (MTRR) support for LynxOS (taken from BSD MTRR support) */
+
+/*
+ * This code is experimental. Some parts may be overkill, and other parts
+ * may be incomplete.
+ */
+
+/*
+ * getAllRanges returns the full list of memory ranges with attributes set.
+ */
+
+static struct mem_range_desc *
+getAllRanges(int *nmr)
+{
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+
+ /*
+ * Find how many ranges there are. If this fails, then the kernel
+ * probably doesn't have MTRR support.
+ */
+ mro.mo_arg[0] = 0;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro))
+ return NULL;
+ *nmr = mro.mo_arg[0];
+ mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
+ mro.mo_arg[0] = *nmr;
+ mro.mo_desc = mrd;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
+ xfree(mrd);
+ return NULL;
+ }
+ return mrd;
+}
+
+/*
+ * cleanMTRR removes any memory attribute that may be left by a previous
+ * X server. Normally there won't be any, but this takes care of the
+ * case where a server crashed without being able finish cleaning up.
+ */
+
+static Bool
+cleanMTRR()
+{
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+ int nmr, i;
+
+ /* This shouldn't happen */
+ if (devMemFd < 0) {
+ if ((devMemFd = open(MTRR_DEVICE, O_RDONLY)) < 0) {
+perror("open MTRR");
+ return FALSE;
+ }
+ }
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return FALSE;
+
+ for (i = 0; i < nmr; i++) {
+ if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
+ (mrd[i].mr_flags & MDF_ACTIVE)) {
+#ifdef DEBUG
+ ErrorF("Clean for (0x%lx,0x%lx)\n",
+ (unsigned long)mrd[i].mr_base,
+ (unsigned long)mrd[i].mr_len);
+#endif
+ if (mrd[i].mr_flags & MDF_FIXACTIVE) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ mrd[i].mr_flags = MDF_UNCACHEABLE;
+ } else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = mrd + i;
+ ioctl(devMemFd, MEMRANGE_SET, &mro);
+ }
+ }
+#ifdef DEBUG
+ sleep(10);
+#endif
+ xfree(mrd);
+ return TRUE;
+}
+
+typedef struct x_RangeRec {
+ struct mem_range_desc mrd;
+ Bool wasWC;
+ struct x_RangeRec * next;
+} RangeRec, *RangePtr;
+
+static void
+freeRangeList(RangePtr range)
+{
+ RangePtr rp;
+
+ while (range) {
+ rp = range;
+ range = rp->next;
+ xfree(rp);
+ }
+}
+
+static RangePtr
+dupRangeList(RangePtr list)
+{
+ RangePtr new = NULL, rp, p;
+
+ rp = list;
+ while (rp) {
+ p = xnfalloc(sizeof(RangeRec));
+ *p = *rp;
+ p->next = new;
+ new = p;
+ rp = rp->next;
+ }
+ return new;
+}
+
+static RangePtr
+sortRangeList(RangePtr list)
+{
+ RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
+ unsigned long minBase;
+
+ /* Sort by base address */
+ rp1 = copy = dupRangeList(list);
+ while (rp1) {
+ minBase = rp1->mrd.mr_base;
+ minp = rp1;
+ minprev = NULL;
+ prev = rp1;
+ rp2 = rp1->next;
+ while (rp2) {
+ if (rp2->mrd.mr_base < minBase) {
+ minBase = rp2->mrd.mr_base;
+ minp = rp2;
+ minprev = prev;
+ }
+ prev = rp2;
+ rp2 = rp2->next;
+ }
+ if (minprev) {
+ minprev->next = minp->next;
+ rp1 = copy;
+ } else {
+ rp1 = minp->next;
+ }
+ minp->next = sorted;
+ sorted = minp;
+ }
+ return sorted;
+}
+
+/*
+ * findRanges returns a list of ranges that overlap the specified range.
+ */
+
+static void
+findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
+{
+ struct mem_range_desc *mrd;
+ int nmr, i;
+ RangePtr rp, *p;
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return;
+
+ for (i = 0; i < nmr; i++) {
+ if ((mrd[i].mr_flags & MDF_ACTIVE) &&
+ mrd[i].mr_base < base + size &&
+ mrd[i].mr_base + mrd[i].mr_len > base) {
+ if (mrd[i].mr_flags & MDF_WRITECOMBINE)
+ p = wcp;
+ else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
+ p = ucp;
+ else
+ continue;
+ rp = xnfalloc(sizeof(RangeRec));
+ rp->mrd = mrd[i];
+ rp->next = *p;
+ *p = rp;
+ }
+ }
+ xfree(mrd);
+}
+
+/*
+ * This checks if the existing overlapping ranges fully cover the requested
+ * range. Is this overkill?
+ */
+
+static Bool
+fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
+{
+ RangePtr rp1, sorted = NULL;
+ unsigned long end;
+
+ sorted = sortRangeList(overlap);
+ /* Look for gaps */
+ rp1 = sorted;
+ end = base + size;
+ while (rp1) {
+ if (rp1->mrd.mr_base > base) {
+ freeRangeList(sorted);
+ return FALSE;
+ } else {
+ base = rp1->mrd.mr_base + rp1->mrd.mr_len;
+ }
+ if (base >= end) {
+ freeRangeList(sorted);
+ return TRUE;
+ }
+ rp1 = rp1->next;
+ }
+ freeRangeList(sorted);
+ return FALSE;
+}
+
+static pointer
+addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
+{
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /* See of the full range is already WC */
+ if (!uc && fullCoverage(base, size, wc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already set\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_WRITECOMBINE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to set write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ return NULL;
+ } else {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n", base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = FALSE;
+ retlist->next = NULL;
+ return retlist;
+ }
+}
+
+static pointer
+delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
+{
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /*
+ * See of the full range is already not WC, or if there is full
+ * coverage from UC ranges.
+ */
+ if (!wc || fullCoverage(base, size, uc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already clear\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_UNCACHEABLE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to remove write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ /* XXX Should then remove all of the overlapping WC ranges */
+ return NULL;
+ } else {
+ xf86DrvMsg(screenNum, from,
+ "Removed Write-combining range (0x%lx,0x%lx)\n",
+ base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = TRUE;
+ retlist->next = NULL;
+ return retlist;
+ }
+}
+
+static pointer
+setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ if (enable)
+ return addWC(screenNum, base, size, from);
+ else
+ return delWC(screenNum, base, size, from);
+}
+
+static void
+undoWC(int screenNum, pointer list)
+{
+ RangePtr rp;
+ struct mem_range_op mro;
+ Bool failed;
+
+ rp = list;
+ while (rp) {
+#ifdef DEBUG
+ ErrorF("Undo for (0x%lx,0x%lx), %d\n",
+ (unsigned long)rp->mrd.mr_base,
+ (unsigned long)rp->mrd.mr_len, rp->wasWC);
+#endif
+ failed = FALSE;
+ if (rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_WRITECOMBINE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ } else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = &rp->mrd;
+
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ if (!rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_UNCACHEABLE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro))
+ failed = TRUE;
+ } else
+ failed = TRUE;
+ }
+ if (failed) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to restore MTRR range (0x%lx,0x%lx)\n",
+ (unsigned long)rp->mrd.mr_base,
+ (unsigned long)rp->mrd.mr_len);
+ }
+ rp = rp->next;
+ }
+}
+
+#endif /* HAS_MTRR_SUPPORT */
+
diff --git a/hw/xfree86/os-support/misc/xf86_IlHack.c b/hw/xfree86/os-support/misc/xf86_IlHack.c
index 204fe4717..019156357 100644
--- a/hw/xfree86/os-support/misc/xf86_IlHack.c
+++ b/hw/xfree86/os-support/misc/xf86_IlHack.c
@@ -1,14 +1,15 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_IlHack.c,v 3.4 1996/12/23 06:50:24 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_IlHack.c,v 3.5 1998/07/25 16:56:51 dawes Exp $ */
/*
* This file is an incredible crock to get the normally-inline functions
* built into the server so that things can be debugged properly.
*
* Note: this doesn't work when using a compiler other than GCC.
*/
-/* $Xorg: xf86_IlHack.c,v 1.3 2000/08/17 19:51:25 cpqbld Exp $ */
+/* $XConsortium: xf86_IlHack.c /main/4 1996/02/21 17:52:26 kaleb $ */
#define static /**/
#define __inline__ /**/
#undef NO_INLINE
+#define DO_PROTOTYPES
#include "compiler.h"
diff --git a/hw/xfree86/os-support/misc/xf86_Util.c b/hw/xfree86/os-support/misc/xf86_Util.c
index a68d2ca89..7889617e3 100644
--- a/hw/xfree86/os-support/misc/xf86_Util.c
+++ b/hw/xfree86/os-support/misc/xf86_Util.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c,v 3.4 1996/12/23 06:50:25 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c,v 3.8 2001/10/28 03:34:02 tsi Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
*
@@ -21,7 +21,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86_Util.c,v 1.3 2000/08/17 19:51:26 cpqbld Exp $ */
+/* $XConsortium: xf86_Util.c /main/5 1996/10/23 13:13:10 kaleb $ */
/*
* This file is for utility functions that will be shared by other pieces
@@ -31,70 +31,34 @@
#include <ctype.h>
-/*
- * A portable hack at implementing strcasecmp()
- * The characters '_', ' ', and '\t' are ignored in the comparison
- */
-int StrCaseCmp(s1, s2)
-const char *s1, *s2;
-{
- char c1, c2;
-
- if (*s1 == 0)
- if (*s2 == 0)
- return(0);
- else
- return(1);
-
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
- c1 = (isupper(*s1) ? tolower(*s1) : *s1);
- c2 = (isupper(*s2) ? tolower(*s2) : *s2);
- while (c1 == c2)
- {
- if (c1 == '\0')
- return(0);
- s1++; s2++;
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
- c1 = (isupper(*s1) ? tolower(*s1) : *s1);
- c2 = (isupper(*s2) ? tolower(*s2) : *s2);
- }
- return(c1 - c2);
-}
-
+/* To prevent empty source file warnings */
+int _xf86misc;
+#if 0
/* For use only with gcc */
#ifdef __GNUC__
#include "os.h"
-char *debug_alloca(file, line, size)
-char *file;
-int line;
-int size;
+char *
+debug_alloca(char *file, int line, int size)
{
char *ptr;
- ptr = (char *)Xalloc(size);
+ ptr = Xalloc(size);
ErrorF("Alloc: %s line %d; ptr = 0x%x, length = %d\n", file, line,
ptr, size);
return ptr;
}
-void debug_dealloca(file, line, ptr)
-char *file;
-int line;
-char *ptr;
+void
+debug_dealloca(char *file, int line, char *ptr)
{
ErrorF("Dealloc: %s line %d; ptr = 0x%x\n", file, line, ptr);
Xfree(ptr);
}
#endif
+#endif
#if defined(ISC) || defined(Lynx)
@@ -103,13 +67,15 @@ char *ptr;
/* Needed for apm_driver.c */
/* These functions are modeled after the functions inside gnu's libc */
-static double copysign(double x, double y)
+static double
+copysign(double x, double y)
{
x = fabs(x);
return y < 0 ? - x : x;
}
-double RInt(double x)
+double
+RInt(double x)
{
double s,t;
const double one = 1.0;
diff --git a/hw/xfree86/os-support/sco/VTsw_sco.c b/hw/xfree86/os-support/sco/VTsw_sco.c
index 386cd21ff..d06bd3949 100644
--- a/hw/xfree86/os-support/sco/VTsw_sco.c
+++ b/hw/xfree86/os-support/sco/VTsw_sco.c
@@ -1,4 +1,4 @@
-/* XFree86: $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c,v 1.3 2001/06/30 22:41:49 tsi Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
* Copyright 1993 by David McCullough <davidm@stallion.oz.au>
@@ -22,73 +22,93 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: VTsw_sco.c,v 1.3 2000/08/17 19:51:28 cpqbld Exp $ */
+/* $XConsortium: VTsw_sco.c /main/2 1995/11/13 06:08:36 kaleb $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
+/* For the event driver prototypes */
+#include <sys/event.h>
+#include <mouse.h>
+
/*
* Handle the VT-switching interface for SCO
*/
/*
* This function is the signal handler for the VT-switching signal. It
- * is only referenced inside the OS-support layer.
+ * is only referenced inside the OS-support layer. NOTE: we do NOT need
+ * to re-arm the signal here, since we used sigaction() to set the signal
+ * disposition in sco_init.c. If we had used signal(), we would need to
+ * re-arm the signal here. All we need to do now is record the fact that
+ * we got the signal. XFree86 handles the rest.
*/
-void xf86VTRequest(sig)
-int sig;
+void
+xf86VTRequest(int sig)
{
- signal(sig, (void(*)())xf86VTRequest);
- xf86Info.vtRequestsPending = TRUE;
- return;
+ xf86Info.vtRequestsPending = TRUE;
+ return;
}
-Bool xf86VTSwitchPending()
+Bool
+xf86VTSwitchPending()
{
- return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
}
-Bool xf86VTSwitchAway()
+/*
+ * When we switch away, we need to flush and suspend the event driver
+ * before the VT_RELDISP. We also need to get the current LED status
+ * and preserve it, so that we can restore it when we come back.
+ */
+static int sco_ledstatus = -1;
+static unsigned int sco_ledstate = 0;
+
+Bool
+xf86VTSwitchAway()
{
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
- {
- return(FALSE);
- }
- else
- {
- return(TRUE);
- }
+ ev_flush();
+ ev_suspend();
+ sco_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &sco_ledstate);
+
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_TRUE) < 0) {
+ return(FALSE);
+ } else {
+ return(TRUE);
+ }
}
-Bool xf86VTSwitchTo()
+/*
+ * When we come back to the X server, we need to resume the event driver,
+ * and we need to restore the LED settings to what they were when we
+ * switched away.
+ */
+Bool
+xf86VTSwitchTo()
{
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
- {
- return(FALSE);
- }
- else
- {
- /*
- * make sure the console driver thinks the console is in
- * graphics mode. Under mono we have to do the two as the
- * console driver only allows valid modes for the current
- * video card and Herc or vga are the only devices currently
- * supported.
- */
- if (ioctl(xf86Info.consoleFd, SW_VGA12, 0) < 0)
- if (ioctl(xf86Info.consoleFd, SW_HGC_P0, 0) < 0)
- {
- ErrorF("Failed to set graphics mode : %s\n",
- strerror(errno));
- }
+ ev_resume();
+
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
+ return(FALSE);
+ } else {
+ if (sco_ledstatus >= 0) {
+ ioctl (xf86Info.consoleFd, KDSETLED, &sco_ledstate);
+ }
+ sco_ledstatus = -1;
+
+ /*
+ * Convince the console driver this screen is in graphics mode,
+ * otherwise it assumes it can do more to the screen than it should.
+ */
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
+ }
- return(TRUE);
- }
+ return TRUE;
+ }
}
diff --git a/hw/xfree86/os-support/sco/sco_init.c b/hw/xfree86/os-support/sco/sco_init.c
index a61dcdfce..389664647 100644
--- a/hw/xfree86/os-support/sco/sco_init.c
+++ b/hw/xfree86/os-support/sco/sco_init.c
@@ -1,261 +1,324 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.10.2.1 1998/02/06 22:36:53 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.14 2002/11/20 23:00:44 dawes Exp $ */
/*
- * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
*
* 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 names of David McCullough and David Wexelblat
- * not be used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission. David McCullough and
- * David Wexelblat makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID MCCULLOUGH AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL DAVID MCCULLOUGH OR DAVID WEXELBLAT 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.
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
*
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON 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.
*/
-/* $Xorg: sco_init.c,v 1.3 2000/08/17 19:51:28 cpqbld Exp $ */
+/* $XConsortium$ */
+
+/* Re-written May 2001 to represent the current state of reality */
#include "X.h"
#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
static Bool KeepTty = FALSE;
static int VTnum = -1;
+static char *vtdevice = NULL;
static int sco_console_mode = -1;
-extern void xf86VTRequest(
-#if NeedFunctionPrototypes
- int
-#endif
-);
+extern Bool mpxLock;
-void xf86OpenConsole()
+void
+xf86OpenConsole()
{
- int fd,wc;
- struct vt_mode VT;
- struct stat status;
- char vtname[11];
-
- if (serverGeneration == 1)
- {
- /* check if we're run with euid==0 */
- if (geteuid() != 0)
- {
- FatalError("xf86OpenConsole: Server must be running with root "
- "permissions\n"
- "You should be using Xwrapper to start the server or xdm.\n"
- "We strongly advise against making the server SUID root!\n");
- }
-
- /*
- * setup the virtual terminal manager
- *
- * SCO vts start at tty01 which is vt00, if you could call them VT's.
- * We use the numbers 1..X as it fits nicer with the device naming
- * scheme.
- *
- * In os/osinit.c we took the precuation of not closing stdin so that
- * we can use the current vt if no vt was specified on the command line
- *
- * Under SCO VT_OPENQRY does nothing at all
- * if nothing was specified we try to determine the VT from stdin
- */
- if ((VTnum != -1) && (VTnum != 0))
- {
- wc = VTnum - 1;
- }
- else
- {
- if ((fstat(0, &status) >= 0) && (status.st_mode & S_IFCHR))
- {
- wc = minor(status.st_rdev);
- }
- else
- {
- ErrorF("%s: Failed to stat stdin, using tty02 (%s)\n",
- "xf86OpenConsole", strerror(errno));
- wc = 1; /* tty02 */
- }
- }
- ErrorF("(using VT number %d)\n\n", wc + 1);
-
- sprintf(vtname,"/dev/tty%02d", wc+1); /* /dev/tty[01-12] */
-
- if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0)
- {
- FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
- vtname, strerror(errno));
- }
-
- /* now we can dispose of stdin */
-
- if (freopen(vtname, "r+", stdin) == (FILE *) NULL)
- {
- FatalError("xf86OpenConsole: Cannot reopen stdin as %s (%s)\n",
- vtname, strerror(errno));
- }
-
- /* now we can fixup stdout */
-
- if (freopen(vtname, "r+", stdout) == (FILE *) NULL)
- {
- FatalError("xf86OpenConsole: Cannot reopen stdout as %s (%s)\n",
- vtname, strerror(errno));
- }
-
- /* We activate the console just in case its not the one we are on */
- xf86Info.vtno = wc;
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, wc) != 0)
- {
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
- }
-
- xf86Config(FALSE); /* Read XF86Config */
-
- if (!KeepTty)
- {
- setpgrp();
- }
-
- /*
- * now get the VT
- */
- if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0)
- {
- FatalError("xf86OpenConsole: VT_GETMODE failed on console (%s)\n",
- strerror(errno));
- }
- if (ioctl(xf86Info.consoleFd, VGA_IOPRIVL, 1) < 0)
- {
- FatalError("xf86OpenConsole: VGA_IOPRIVL failed for VGA acc (%s)\n",
- strerror(errno));
- }
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
- {
- FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n",
+ int fd,i, ioctl_ret;
+ struct vt_mode VT;
+ static char vtname[32];
+ struct vid_info vidinf;
+ struct sigaction sigvtsw;
+
+ if (serverGeneration == 1) {
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0) {
+ FatalError("xf86OpenConsole: Server must be setuid root\n");
+ }
+
+ /*
+ * Set up the virtual terminal (multiscreen in SCO parlance).
+ * For the actual console itself, screens are numbered from
+ * 1 to (usually) 16. However, it is possible to have a nested
+ * server, and it is also possible to be on a multi-console
+ * system such as MaxSpeed or SunRiver. Therefore, we should
+ * not make any assumptions about the TTY name we are on, and
+ * instead we rely on ttyname() to give us the real TTY name.
+ * Previously, XFree86 tried to determine the TTY name manually.
+ * This is wrong. The only time we need to futz with the TTY name
+ * if if we were given the name of a TTY to run on explicity on
+ * the command line.
+ */
+
+ if (VTnum == -1) {
+ /*
+ * We can query the current VT number using CONS_GETINFO.
+ */
+ char *ttn;
+
+ vidinf.size = sizeof(vidinf);
+ if (ioctl (0, CONS_GETINFO, &vidinf) < 0) {
+ FatalError ("xf86OpenConsole: Not on a console device "
+ "or error querying device (%s)\n", strerror (errno));
+ }
+
+ VTnum = vidinf.m_num + 1; /* 0-based */
+ ttn = ttyname (0);
+
+ if (ttn == (char *)0) {
+ ErrorF ("xf86OpenConsole: Error determining TTY name (%s)\n",
+ strerror(errno));
+ snprintf (vtname, sizeof(vtname)-1, "/dev/tty%02d", VTnum);
+ } else {
+ strlcpy (vtname, ttn, sizeof(vtname));
+ }
+ vtdevice = vtname;
+ } else if (VTnum == -2 || VTnum >= 0) {
+ /*
+ * An explicit device was specified. Make sure its a console device.
+ */
+ if (VTnum != -2) {
+ snprintf (vtname, sizeof(vtname)-1, "/dev/tty%02d", VTnum);
+ vtdevice = vtname;
+ }
+
+ fd = open (vtdevice, O_RDWR | O_NDELAY, 0);
+ if (fd < 0) {
+ FatalError ("xf86OpenConsole: Can not open device '%s' (%s)\n",
+ vtdevice, strerror(errno));
+ }
+
+ vidinf.size = sizeof(vidinf);
+ if (ioctl (fd, CONS_GETINFO, &vidinf) < 0) {
+ FatalError ("xf86OpenConsole: '%s' is not a console device "
+ "or error querying device (%s)\n", vtname, strerror (errno));
+ }
+ VTnum = vidinf.m_num + 1; /* 0-based */
+ close (fd); /* We're done with it for now */
+ }
+
+ ErrorF("(using VT%02d device %s)\n\n", VTnum, vtdevice);
+
+ if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NDELAY, 0)) < 0) {
+ FatalError("xf86OpenConsole: Cannot open %s (%s)\n", vtdevice,
strerror(errno));
- }
-
- signal(SIGUSR1, xf86VTRequest);
-
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- VT.frsig = SIGUSR1;
- VT.waitv = 0;
- if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
- {
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
- }
- /*
- * make sure the console driver thinks the console is in graphics
- * mode. Under mono we have to do the two as the console driver only
- * allows valid modes for the current video card and Herc or vga are
- * the only devices currently supported.
- */
- if (ioctl(xf86Info.consoleFd, SW_VGA12, 0) < 0)
- if (ioctl(xf86Info.consoleFd, SW_HGC_P0, 0) < 0)
- {
- ErrorF("Failed to set graphics mode (%s)\n",
- strerror(errno));
- }
+ }
+ /* Dispose of stdin and stdout */
+ if (freopen(vtdevice, "r+", stdin) == (FILE *) NULL) {
+ FatalError("xf86OpenConsole: Cannot reopen stdin as %s (%s)\n",
+ vtdevice, strerror(errno));
}
- else
- {
- /* serverGeneration != 1 */
- /*
- * now get the VT
- */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
- {
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
- }
+
+ if (freopen(vtname, "r+", stdout) == (FILE *) NULL) {
+ FatalError("xf86OpenConsole: Cannot reopen stdout as %s (%s)\n",
+ vtdevice, strerror(errno));
}
- return;
-}
-void xf86CloseConsole()
-{
- struct vt_mode VT;
+ /*
+ * We make 100% sure we use the correct VT number. This can get ugly
+ * where there are multi-consoles in use, so we make sure we query
+ * the kernel for the correct VT number. It knows best, we don't.
+ */
+ vidinf.size = sizeof(vidinf);
+ if (ioctl (xf86Info.consoleFd, CONS_GETINFO, &vidinf) < 0) {
+ FatalError ("xf86OpenConsole: Failed to query console number (%s)\n",
+ strerror (errno));
+ }
+ xf86Info.vtno = vidinf.m_num;
- ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
- if (sco_console_mode != -1)
- {
- ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L);
+ /* We activate the console just in case its not the one we are on */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
}
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
- {
- VT.mode = VT_AUTO;
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
+
+ /* Disassociate from controling TTY */
+ if (!KeepTty) {
+ setpgrp();
+ }
+
+ /*
+ * Now we get the current mode that the console device is on. We will
+ * use this later when we close the console device to restore it to
+ * that same mode.
+ */
+ if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0) {
+ FatalError("xf86OpenConsole: CONS_GET failed on console (%s)\n",
+ strerror(errno));
}
- close(xf86Info.consoleFd); /* make the vt-manager happy */
- return;
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) {
+ FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n", strerror(errno));
+ }
+
+ sigvtsw.sa_handler = xf86VTRequest;
+ sigfillset(&sigvtsw.sa_mask);
+ sigvtsw.sa_flags = 0;
+
+ /* NOTE: Using sigaction means we dont have to re-arm the signal */
+ sigaction(SIGUSR1, &sigvtsw, NULL);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ VT.frsig = SIGINT; /* Not implemented */
+ VT.waitv = 0;
+
+ /*
+ * The SCO X server tries the following call 5 times. Lets do the same
+ * thing. It shouldn't really be required but sometimes things take a
+ * while to settle down when switching screens. *helpless shrug* I know
+ * its sucks but ...
+ */
+
+ ioctl_ret = 0;
+ for (i = 0; i < 5; i++) {
+ ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
+ if (ioctl_ret >= 0)
+ break;
+ usleep(999999); /* Dont use nap() - it forces linking with -lx */
+ }
+
+ if (ioctl_ret < 0) {
+ FatalError("xf86OpenConsole: VT_SETMODE failed (%s)\n", strerror(errno));
+ }
+
+ /*
+ * Convince the console driver we are in graphics mode.
+ */
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
+ }
+ } else { /* serverGeneration != 1 */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
+ }
+ }
}
-int xf86ProcessArgument(argc, argv, i)
-int argc;
-char *argv[];
-int i;
+/*
+ * Restore the console to its previous state. This may cause flicker if
+ * the screen was previous in a graphics mode, because we first set it
+ * to text mode. This has the advantage of getting the console driver
+ * to do a soft reset on the card, which really does help settle the
+ * video card down again after coming out of Xfree86.
+ */
+void
+xf86CloseConsole()
{
- /*
- * Keep server from detaching from controlling tty. This is useful
- * when debugging (so the server can receive keyboard signals.
- */
- if (!strcmp(argv[i], "-keeptty"))
- {
- KeepTty = TRUE;
- return(1);
- }
- if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
- {
- if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
- {
- UseMsg();
- VTnum = -1;
- return(0);
- }
- return(1);
- }
- if (!strcmp(argv[i], "-crt"))
- {
- if ((++i > argc) ||
- (sscanf(argv[i], "/dev/tty%2d", &VTnum) == 0))
- {
- UseMsg();
- VTnum = -1;
- return(0);
- }
- else
- {
- return(2);
- }
- }
- return(0);
+ struct vt_mode VT;
+ struct sigaction sigvtsw;
+
+ /* Set text mode (possibly briefly) */
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0);
+
+ /* Restore the original mode */
+ if (sco_console_mode != -1) {
+ ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L);
+ }
+
+ ioctl(xf86Info.consoleFd, VT_RELDISP, 1); /* Release the display */
+
+ sigvtsw.sa_handler = SIG_DFL;
+ sigfillset(&sigvtsw.sa_mask);
+ sigvtsw.sa_flags = 0;
+
+ sigaction(SIGUSR1, &sigvtsw, NULL);
+
+ VT.mode = VT_AUTO;
+ VT.waitv = 0;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ VT.frsig = SIGINT;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* Revert to auto handling */
+
+ close(xf86Info.consoleFd); /* We're done with the device */
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals).
+ */
+ if (!strcmp(argv[i], "-keeptty")) {
+ KeepTty = TRUE;
+ return(1);
+ }
+
+ /*
+ * By default, the X server wants to bind itself to CPU 0. This makes
+ * sure that the server has full access to the I/O ports at IOPL 3.
+ * Some SMP systems have trouble with I/O on CPU's other than 0. If,
+ * however, you have a system that is well behaved, you can specify
+ * this argument and let the scheduler decide which CPU the server
+ * should run on.
+ */
+ if (!strcmp(argv[i], "-nompxlock")) {
+ mpxLock = FALSE;
+ return (1);
+ }
+
+ /*
+ * Specify the VT number to run on (NOT the device).
+ */
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ if (VTnum <= 0) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ return(1);
+ }
+
+ /*
+ * Use a device the user specifies.
+ */
+ if (!strcmp(argv[i], "-crt")) {
+ if (++i > argc) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ } else {
+ VTnum = -2;
+ vtdevice = argv[i];
+ return(2);
+ }
+ }
+ return(0);
}
-void xf86UseMsg()
+void
+xf86UseMsg()
{
ErrorF("vtXX use the specified VT number\n");
- ErrorF("-crt /dev/ttyXX use the specified VT number\n");
+ ErrorF("-crt DEVICE use the specified VT device\n");
+ ErrorF("-nompxlock dont bind X server to CPU 0\n");
ErrorF("-keeptty ");
ErrorF("don't detach controlling tty (for debugging only)\n");
- return;
}
diff --git a/hw/xfree86/os-support/sco/sco_io.c b/hw/xfree86/os-support/sco/sco_io.c
index 162d1b76b..a018e3434 100644
--- a/hw/xfree86/os-support/sco/sco_io.c
+++ b/hw/xfree86/os-support/sco/sco_io.c
@@ -1,117 +1,273 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.3 1996/12/23 06:50:49 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.10 2003/02/17 15:11:59 dawes Exp $ */
/*
- * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
- * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
+ * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
*
* 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 names of David McCullough and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. David McCullough
- * and David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID MCCULLOUGH AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL DAVID MCCULLOUGH OR DAVID DAWES 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.
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
*
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON 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.
*/
-/* $Xorg: sco_io.c,v 1.3 2000/08/17 19:51:29 cpqbld Exp $ */
+/* $XConsortium$ */
+
+/* Re-written May 2001 to represent the current state of reality */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "xf86Procs.h"
+#define _NEED_SYSI86
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86OSpriv.h"
#include "xf86_OSlib.h"
-#include "xf86_Config.h"
-void xf86SoundKbdBell(loudness, pitch, duration)
-int loudness;
-int pitch;
-int duration;
+#include <sys/param.h>
+#include <sys/emap.h>
+#include <sys/nmap.h>
+
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
+{
+ if (loudness && pitch) {
+ ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
+ usleep(duration * loudness * 20);
+ ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
+ }
+}
+
+void
+xf86SetKbdLeds(int leds)
+{
+ /*
+ * sleep the first time through under SCO. There appears to be a
+ * timing problem in the driver which causes the keyboard to be lost.
+ * This usleep stops it from occurring. NOTE: this was in the old code.
+ * I am not convinced it is true any longer, but it doesn't hurt to
+ * leave this in here.
+ */
+ static int once = 1;
+
+ if (once) {
+ usleep(100);
+ once = 0;
+ }
+
+ ioctl(xf86Info.consoleFd, KDSETLED, leds );
+}
+
+int
+xf86GetKbdLeds()
{
- if (loudness && pitch)
- {
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
- }
+ int leds;
+
+ ioctl (xf86Info.consoleFd, KDGETLED, &leds);
+ return leds;
+}
+
+/*
+ * Much of the code in this function is duplicated from the Linux code
+ * by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
+ * Please see the file ../linux/lnx_io.c for full copyright information.
+ *
+ * NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A
+ * and later have the required ioctl. 5.0.6A or higher is HIGHLY
+ * recommended. The console driver is quite a different beast on that OS.
+ */
+void
+xf86SetKbdRepeat(char rad)
+{
+#if defined(KBIO_SETRATE)
+ int i;
+ int value = 0x7f; /* Maximum delay with slowest rate */
+ int delay = 250; /* Default delay */
+ int rate = 300; /* Default repeat rate */
+
+ static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
+ 133, 120, 109, 100, 92, 86, 80, 75, 67,
+ 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
+ 25, 23, 21, 20 };
+#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
+
+ static int valid_delays[] = { 250, 500, 750, 1000 };
+#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
+
+ if (xf86Info.kbdRate >= 0)
+ rate = xf86Info.kbdRate * 10;
+ if (xf86Info.kbdDelay >= 0)
+ delay = xf86Info.kbdDelay;
+
+ for (i = 0; i < RATE_COUNT; i++)
+ if (rate >= valid_rates[i]) {
+ value &= 0x60;
+ value |= i;
+ break;
+ }
+
+ for (i = 0; i < DELAY_COUNT; i++)
+ if (delay <= valid_delays[i]) {
+ value &= 0x1f;
+ value |= i << 5;
+ break;
+ }
+
+ ioctl (xf86Info.consoleFd, KBIO_SETRATE, value);
+#endif /* defined(KBIO_SETRATE) */
}
-void xf86SetKbdLeds(leds)
-int leds;
+static Bool use_tcs = TRUE, use_kd = TRUE;
+static Bool no_nmap = TRUE, no_emap = TRUE;
+static int orig_getsc, orig_kbm;
+static struct termios orig_termios;
+static keymap_t keymap, noledmap;
+static uchar_t *sc_mapbuf;
+static uchar_t *sc_mapbuf2;
+
+void
+xf86KbdInit()
{
- /*
- * sleep the first time through under SCO. There appears to be a
- * timing problem in the driver which causes the keyboard to be lost.
- * This sleep stops it from occurring. The sleep could proably be
- * a lot shorter as even trace can fix the problem. You may
- * prefer a usleep(100).
- */
- static int once = 1;
-
- if (once)
- {
- sleep(1);
- once = 0;
- }
- ioctl(xf86Info.consoleFd, KDSETLED, leds );
+ orig_getsc = 0;
+ if (ioctl (xf86Info.consoleFd, TCGETSC, &orig_getsc) < 0)
+ use_tcs = FALSE;
+ if (ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm) < 0)
+ use_kd = FALSE;
+
+ if (!use_tcs && !use_kd)
+ FatalError ("xf86KbdInit: Could not determine keyboard mode\n");
+
+ /*
+ * One day this should be fixed to translate normal ASCII characters
+ * back into scancodes or into events that XFree86 wants, but not
+ * now. For the time being, we only support scancode mode screens.
+ */
+ if (use_tcs && !(orig_getsc & KB_ISSCANCODE))
+ FatalError ("xf86KbdInit: Keyboard can not send scancodes\n");
+
+ /*
+ * We need to get the original keyboard map and NUL out the lock
+ * modifiers. This prevents the scancode API from messing with
+ * the keyboard LED's. We restore the original map when we exit.
+ */
+ if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
+ FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
+ strerror(errno));
+ }
+ if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
+ FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
+ strerror(errno));
+ } else {
+ int i, j;
+
+ for (i = 0; i < noledmap.n_keys; i++) {
+ for (j = 0; j < NUM_STATES; j++) {
+ if (IS_SPECIAL(noledmap, i, j) &&
+ ((noledmap.key[i].map[j] == K_CLK) ||
+ (noledmap.key[i].map[j] == K_NLK) ||
+ (noledmap.key[i].map[j] == K_SLK))) {
+ noledmap.key[i].map[j] = K_NOP;
+ }
+ }
+ }
+ }
+
+ if (ioctl (xf86Info.consoleFd, XCGETA, &orig_termios) < 0) {
+ FatalError ("xf86KbdInit: Failed to get terminal modes (%s)\n",
+ strerror(errno));
+ }
+
+ sc_mapbuf = xalloc (10*BSIZE);
+ sc_mapbuf2 = xalloc(10*BSIZE);
+
+ /* Get the emap */
+ if (ioctl (xf86Info.consoleFd, LDGMAP, sc_mapbuf) < 0) {
+ if (errno != ENAVAIL) {
+ FatalError ("xf86KbdInit: Failed to retrieve e-map (%s)\n",
+ strerror (errno));
+ }
+ no_emap = FALSE;
+ }
+
+ /* Get the nmap */
+ if (ioctl (xf86Info.consoleFd, NMGMAP, sc_mapbuf2) < 0) {
+ if (errno != ENAVAIL) {
+ FatalError ("xf86KbdInit: Failed to retrieve n-map (%s)\n",
+ strerror (errno));
+ }
+ no_nmap = FALSE;
+ }
}
-void xf86MouseInit(mouse)
-MouseDevPtr mouse;
+int
+xf86KbdOn()
{
- if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Cannot open mouse (%s) - Continuing...\n",
- strerror(errno));
- return;
- }
- FatalError("Cannot open mouse (%s)\n", strerror(errno));
- }
+ struct termios newtio;
+
+ ioctl (xf86Info.consoleFd, LDNMAP); /* Turn e-mapping off */
+ ioctl (xf86Info.consoleFd, NMNMAP); /* Turn n-mapping off */
+
+ newtio = orig_termios; /* structure copy */
+ newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ newtio.c_oflag = 0;
+ newtio.c_cflag = CREAD | CS8 | B9600;
+ newtio.c_lflag = 0;
+ newtio.c_cc[VTIME]=0;
+ newtio.c_cc[VMIN]=1;
+ cfsetispeed(&newtio, 9600);
+ cfsetospeed(&newtio, 9600);
+ ioctl(xf86Info.consoleFd, XCSETA, &newtio);
+
+ /* Now tell the keyboard driver to send us raw scancodes */
+ if (use_tcs) {
+ int nm = orig_getsc;
+ nm &= ~KB_XSCANCODE;
+ ioctl (xf86Info.consoleFd, TCSETSC, &nm);
+ }
+
+ if (use_kd)
+ ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
+
+ ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
+
+ return(xf86Info.consoleFd);
}
-int xf86MouseOn(mouse)
-MouseDevPtr mouse;
+int
+xf86KbdOff()
{
- xf86SetupMouse(mouse);
+ /* Revert back to original translate scancode mode */
+ if (use_tcs)
+ ioctl (xf86Info.consoleFd, TCSETSC, &orig_getsc);
+ if (use_kd)
+ ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
+
+ ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
- /* Flush any pending input */
- ioctl(mouse->mseFd, TCFLSH, 0);
+ if (no_emap)
+ ioctl (xf86Info.consoleFd, LDSMAP, sc_mapbuf);
+ if (no_nmap)
+ ioctl (xf86Info.consoleFd, NMSMAP, sc_mapbuf2);
- return(mouse->mseFd);
+ ioctl(xf86Info.consoleFd, XCSETA, &orig_termios);
+
+ return(xf86Info.consoleFd);
}
-int xf86MouseOff(mouse, doclose)
-MouseDevPtr mouse;
-Bool doclose;
+#include "xf86OSKbd.h"
+
+Bool
+xf86OSKbdPreInit(InputInfoPtr pInfo)
{
- if (mouse->mseFd >= 0)
- {
- if (mouse->mseType == P_LOGI)
- {
- write(mouse->mseFd, "U", 1);
- xf86SetMouseSpeed(mouse, mouse->baudRate,
- mouse->oldBaudRate,
- xf86MouseCflags[P_LOGI]);
- }
- if (doclose)
- {
- close(mouse->mseFd);
- }
- }
- return(mouse->mseFd);
+ return FALSE;
}
diff --git a/hw/xfree86/os-support/sco/sco_mouse.c b/hw/xfree86/os-support/sco/sco_mouse.c
index 564852ae3..37b9eb5a8 100644
--- a/hw/xfree86/os-support/sco/sco_mouse.c
+++ b/hw/xfree86/os-support/sco/sco_mouse.c
@@ -1,175 +1,265 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.8 1996/12/23 06:50:50 dawes Exp $ */
-
-
-
-
-
-/* $Xorg: sco_mouse.c,v 1.3 2000/08/17 19:51:29 cpqbld Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.13 2002/11/20 23:07:50 dawes Exp $ */
+/*
+ * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
+ *
+ * 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 J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON 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.
+ */
-/******************************************************************************/
+/* $XConsortium$ */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "mipointer.h"
+#include <sys/event.h>
+#include <mouse.h>
-/******************************************************************************/
-#ifdef USE_OSMOUSE
-/******************************************************************************/
+static int
+SupportedInterfaces (void)
+{
+ /* FIXME: Is this correct? Should we just return MSE_MISC? */
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_MISC | MSE_AUTO;
+}
-#include <sys/event.h>
-#include <mouse.h>
-#include "xf86_Config.h"
+static const char *internalNames[] = {
+ "OSMouse",
+ NULL
+};
-static dmask_t real_mask = (dmask_t) (D_REL | D_BUTTON);
-static int config_buttons = 0;
+static const char **
+BuiltinNames (void)
+{
+ return internalNames;
+}
-extern int miPointerGetMotionEvents(DeviceIntPtr pPtr, xTimecoord *coords,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
+static Bool
+CheckProtocol (const char *protocol)
+{
+ int i;
-/******************************************************************************/
-/*
- * Handle any XF86Config options for "OsMouse", How you treat errors
- * is up to you, they may or may not be Fatal
- */
+ for (i = 0; internalNames[i]; i++) {
+ if (xf86NameCmp (protocol, internalNames[i]) == 0)
+ return TRUE;
+ }
-void
-xf86OsMouseOption(lt, lp)
- int lt; /* type returned by gettoken */
- pointer lp; /* The lexical return symbol */
+ return FALSE;
+}
+
+static const char *
+DefaultProtocol (void)
{
- if (lt != NUMBER) {
- ErrorF("%s: Invalid Argument to OsMouse, %s\n",
- "xf86OsMouseOption", "Number of buttons expected");
- return;
- }
- config_buttons = ((LexPtr)lp)->num;
+ return "OSMouse";
}
-/******************************************************************************/
-/*
- * xf86OsMouseProc --
- * Handle the initialization, etc. of a mouse
- */
+static const char *
+evtErrStr (int evterr)
+{
+ switch (evterr) {
+ case -1: return "error in config files";
+ case -2: return "no mouse devices to attach";
+ case -3: return "unable to open device";
+ case -4: return "unable to open event queue";
+ case -999: return "unable to initialize event driver";
+ default: return "unknown event driver error";
+ }
+}
-int
-xf86OsMouseProc(pPointer, what)
- DeviceIntPtr pPointer;
- int what;
+static int
+OsMouseProc (DeviceIntPtr pPointer, int what)
{
- unchar *map;
- int i, err, buttons;
- struct devinfo *dip;
- dmask_t dmask;
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ unsigned char map[9];
+ dmask_t dmask;
+ MessageType from = X_CONFIG;
+ int evi;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
switch (what) {
- case DEVICE_INIT:
-
- pPointer->public.on = FALSE;
-
- if (ev_init() < 0)
- ErrorF("ev_init: Failed to initialize event driver\n");
-
- dmask = real_mask;
- xf86Info.mouseDev->mseFd = ev_open(&dmask);
- switch (xf86Info.mouseDev->mseFd) {
- case -1: FatalError("ev_open: Error in Configuration files\n");
- case -2: FatalError("ev_open: No mouse devices to attach\n");
- case -3: FatalError("ev_open: Unable to open a found device\n");
- case -4: FatalError("ev_open: unable to open an event queue\n");
- default:
- if (xf86Info.mouseDev->mseFd < 0)
- FatalError("ev_open: Failed to open device, reason unkown\n");
- break;
- }
- if (dmask != real_mask)
- FatalError("Could not attach the mouse device (0x%x)\n", dmask);
-
- dip = (struct devinfo *) NULL;
- if ((dip = ev_getdev(D_REL, dip)) == (struct devinfo *) NULL)
- FatalError("Could not find info on mouse device\n");
-
- buttons = config_buttons > 0 ? config_buttons : ((int) dip->buttons);
- buttons = buttons > 0 ? buttons : 3; /* just in case */
-
- ErrorF("%s OsMouse has %d buttons\n",
- buttons == config_buttons ? XCONFIG_GIVEN : XCONFIG_PROBED,
- buttons);
-
- map = (unchar *) xalloc(buttons + 1);
- if (map == (unchar *) NULL)
- FatalError("Failed to allocate OsMouse map structure\n");
-
- for (i = 1; i <= buttons; i++)
- map[i] = i;
-
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- buttons,
- miPointerGetMotionEvents,
- (PtrCtrlProcPtr)xf86MseCtrl,
- 0);
- xfree(map);
- ev_suspend(); /* suspend device until its turned on */
- break;
-
- case DEVICE_ON:
- ev_resume();
- AddEnabledDevice(xf86Info.mouseDev->mseFd);
- xf86Info.mouseDev->lastButtons = 0;
- xf86Info.mouseDev->emulateState = 0;
- pPointer->public.on = TRUE;
- break;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- RemoveEnabledDevice(xf86Info.mouseDev->mseFd);
- if (what == DEVICE_CLOSE) {
- ev_close();
- xf86Info.mouseDev->mseFd = -1;
- } else
- ev_suspend();
- break;
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ dmask = D_REL | D_BUTTON;
+ if ((evi = ev_init()) < 0) {
+ FatalError ("OsMouseProc: Event driver initialization failed (%s)\n",
+ evtErrStr(evi));
}
-
+ pInfo->fd = ev_open (&dmask);
+ if (pInfo->fd < 0) {
+ FatalError ("OsMouseProc: DEVICE_INIT failed (%s)\n", evtErrStr(pInfo->fd));
+ }
+
+ pMse->buttons = xf86SetIntOption (pInfo->options, "Buttons", 0);
+ if (pMse->buttons == 0) {
+ pMse->buttons = 8;
+ from = X_DEFAULT;
+ }
+ xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
+
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ map[4] = 6;
+ map[5] = 7;
+ map[6] = 8;
+ map[7] = 4;
+ map[8] = 5; /* Compatibile with SCO X server */
+
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, 8,
+ 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);
+
+ ev_flush();
+ ev_suspend();
+ break;
+
+ case DEVICE_ON:
+ pMse->lastButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ ev_resume();
+ AddEnabledDevice (pInfo->fd);
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ pPointer->public.on = TRUE;
+ RemoveEnabledDevice (pInfo->fd);
+ if (what == DEVICE_CLOSE) {
+ ev_close();
+ pInfo->fd = -1;
+ } else {
+ ev_suspend();
+ }
+ break;
+ }
+
return Success;
}
-/******************************************************************************/
-/*
- * xf86OsMouseEvents --
- * Get some events from our queue. Process all outstanding events now.
- */
+static void
+OsMouseReadInput (InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ EVENT *evp;
+
+ pMse = pInfo->private;
+
+ while ((evp = ev_read()) != (EVENT *)0) {
+ int buttons = EV_BUTTONS(*evp);
+ int dx = EV_DX(*evp), dy = -(EV_DY(*evp)), dz = 0, dw = 0;
+
+ if (EV_TAG(*evp) & T_WHEEL) {
+ dz = (dy & 0x08) ? (dy & 0x0f) - 16 : (dy & 0x0f);
+ dx = dy = 0;
+ pMse->PostEvent (pInfo, buttons, dx, dy, dz, dw);
+ /* Simulate button release */
+ dz = 0;
+ buttons &= ~(WHEEL_FWD | WHEEL_BACK);
+ }
+
+ pMse->PostEvent (pInfo, buttons, dx, dy, dz, dw);
+ ev_pop();
+ }
+}
-void
-xf86OsMouseEvents()
+static Bool
+OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
{
- EVENT *evp;
- static long time = -1;
-
- while ((evp = ev_read()) != (EVENT *) NULL ) {
-#if DEBUG
- if (time == -1)
- time = EV_TIME(*evp);
- ErrorF("sco_event time(%ld) tag(%d) butts(%d) x(%ld) y(%ld)\n",
- EV_TIME(*evp) - time, EV_TAG(*evp), EV_BUTTONS(*evp),
- EV_DX(*evp), EV_DY(*evp));
-#endif
- xf86PostMseEvent(xf86Info.pMouse,EV_BUTTONS(*evp), EV_DX(*evp), -(EV_DY(*evp)));
- ev_pop();
- }
-
- xf86Info.inputPending = TRUE;
+ MouseDevPtr pMse;
+
+ /* This is called when the protocol is "OSMouse". */
+
+ pMse = pInfo->private;
+ 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 = ev_init();
+ if (pInfo->fd != -1) {
+ dmask_t dmask = (D_REL | D_BUTTON);
+ pInfo->fd = ev_open(&dmask);
+ } else {
+ pInfo->fd = -999;
+ }
+
+ if (pInfo->fd < 0) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open event manager (%s)\n",
+ pInfo->name, evtErrStr(pInfo->fd));
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open event manager (%s)\n",
+ pInfo->name, evtErrStr(pInfo->fd));
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+ ev_close();
+ pInfo->fd = -1;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = OsMouseProc;
+ pInfo->read_input = OsMouseReadInput;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
}
-/******************************************************************************/
-#endif /* USE_OSMOUSE */
-/******************************************************************************/
+OSMouseInfoPtr
+xf86OSMouseInit (int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = OsMousePreInit;
+
+ return p;
+}
diff --git a/hw/xfree86/os-support/sco/sco_video.c b/hw/xfree86/os-support/sco/sco_video.c
index 14947fa85..eb4b80c48 100644
--- a/hw/xfree86/os-support/sco/sco_video.c
+++ b/hw/xfree86/os-support/sco/sco_video.c
@@ -1,29 +1,41 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.2.2.1 1997/07/19 04:59:31 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.8 2002/06/03 21:22:10 dawes Exp $ */
/*
- * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
*
* 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 names of David McCullough and David Wexelblat
- * not be used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission. David McCullough and
- * David Wexelblat makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
*
- * DAVID MCCULLOUGH AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL DAVID MCCULLOUGH OR DAVID WEXELBLAT 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.
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON 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.
+ */
+/* $XConsortium$ */
+
+/* Re-written May 2001 to represent the current state of reality */
+
+/*
+ * This file contains the completely re-written SCO OpenServer video
+ * routines for XFree86 4.x. Much of this is based on the SCO X server
+ * code (which is an X11R5 server) and will probably only work on
+ * OpenServer versions 5.0.5, 5.0.6 and later. Please send me (jkj@sco.com)
+ * email if you have any questions.
*
+ * Ideally, you should use OSR5.0.6A or later, with the updated console
+ * driver for 5.0.6A (its the default driver in 5.0.7 and later).
+ * However, if you are running on an older system, this code will detect
+ * that and adjust accordingly.
*/
-/* $Xorg: sco_video.c,v 1.3 2000/08/17 19:51:29 cpqbld Exp $ */
#include "X.h"
#include "input.h"
@@ -32,253 +44,248 @@
#define _NEED_SYSI86
#include "xf86.h"
#include "xf86Priv.h"
+#include "xf86OSpriv.h"
#include "xf86_OSlib.h"
+#include <sys/ci/ciioctl.h>
+#define MPXNAME "/dev/atp1"
+#define BASECPU 1
+
+Bool mpxLock = TRUE;
+
+#define USE_VASMETHOD 1
+
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
-static struct kd_memloc MapDSC[MAXSCREENS][NUM_REGIONS];
-static int ver_once = 1;
+static int sco_mcdone = 0, sco_ismc = 0;
/***************************************************************************/
/*
- * To map the video-memory, we use the MAP_CLASS ioctl.
- * Different drivers may have to do another one of these
- * for their own special registers (ie., ATI). To find
- * out which strings are valid look in /etc/conf/pack.d/cn/class.h
+ * To map the video memory, we first need to see if we are on a multi-console
+ * system. If we are, we need to try to use an existing video class in the
+ * kernel. We do this by retrieving the list of currently defined classes
+ * (via the new CONS_GETCLASS ioctl()) to see if we have a class that will
+ * match the range of memory we desire. If we can't find one, we have an
+ * error and we abort.
*
- * if we fail to find one of these we try for the dmmap driver
+ * If we are not using a multi-console, we can simply use mmap() to map in
+ * the frame buffer, using the classs-access method as a fall-back only if
+ * the mmap() fails (it shouldn't). We always set the appropriate pointers
+ * in the config structure to point ot the right function to map and unmap
+ * the video memory. An alternative to using mmap() is to use the new
+ * CONS_ADDVAS call, which will use vasmalloc() and vasbind() in the kernel
+ * to map the physical address to a virtual one, which it then returns.
+ * I am not 100% sure if this is faster or not, but it may prove easier to
+ * debug things. Just to be on the safe side, I have included both methods
+ * here, and the mmap() method can be used by setting USE_VASMETHOD to 0
+ * above.
*/
-struct {
- unsigned long base, size;
- char *class;
-} SCO_Mapping[] = {
- {0xA0000, 0x10000, "VGA"},
- {0xA0000, 0x20000, "SVGA"},
- {0xB0000, 0x08000, "HGA"},
- {0x0, 0x0, ""},
-};
+#if !defined(CONS_ADDVAS)
+# undef USE_VASMETHOD
+# define USE_VASMETHOD 0
+#endif
-/* ARGSUSED */
-pointer xf86MapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static int
+scoIsMultiConsole (void)
{
- int i;
- char *class = (char *)NULL;
- pointer base;
-
- for (i=0; SCO_Mapping[i].base != 0; i++)
- {
- if (((pointer)SCO_Mapping[i].base == Base) &&
- (SCO_Mapping[i].size == Size))
- {
- class = SCO_Mapping[i].class;
- break;
- }
- }
- if (class == (char *)NULL)
- {
- int fd;
-
-#if defined(SVR4) || defined(SCO325)
- if ((fd = open(DEV_MEM, O_RDWR)) < 0)
- {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = (pointer)mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, (off_t)Base);
- close(fd);
- if ((long)base == -1)
- {
- FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
- "xf86MapVidMem", Size, Base, strerror(errno));
- }
-
- return(base);
-#else
- MapDSC[ScreenNum][Region].vaddr = (char *) NULL;
- MapDSC[ScreenNum][Region].physaddr = (char *) Base;
- MapDSC[ScreenNum][Region].length = Size;
- MapDSC[ScreenNum][Region].ioflg = 1;
- if ((fd = open("/dev/dmmap", O_RDWR)) >= 0) {
- if (ioctl(fd, KDMAPDISP, &MapDSC[ScreenNum][Region]) == -1)
- ErrorF("xf86MapVidMem: dmmap KDMAPDISP failed (%s)\n",
- strerror(errno));
- else {
- if (ver_once)
- ErrorF("Using dmmap version 0x%04x.\n",
- ioctl(fd, -1));
- ver_once = 0;
- close(fd);
- return(MapDSC[ScreenNum][Region].vaddr);
- }
- close(fd);
- }
- FatalError("xf86MapVidMem:No class map defined for (%x,%x)\n",
- Base, Size);
- /* NOTREACHED */
-#endif
- }
-
- base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class);
- if ((int)base == -1)
- {
- FatalError("xf86MapVidMem:Failed to map video mem class %s\n",
- class);
- /* NOTREACHED */
- }
- return(base);
+ int x;
+
+ if (sco_mcdone)
+ return sco_ismc;
+ x = access ("/usr/lib/vidconf/.multiconsole", F_OK);
+ if (x == 0)
+ sco_ismc = 1;
+ sco_mcdone = 1;
+ return sco_ismc;
}
/*
- * Nothing to do here if it wasn't mapped using the dmmap driver
+ * This maps memory using mmap()
*/
-/* ARGSUSED */
-void xf86UnMapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static pointer
+mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- int fd;
-
-#if defined (SVR4) || defined(SCO325)
- munmap(Base, Size);
-#else /* SVR4 */
- if (MapDSC[ScreenNum][Region].vaddr) {
- if ((fd = open("/dev/dmmap", O_RDWR)) < 0) {
- if (ioctl(fd, KDUNMAPDISP, &MapDSC[ScreenNum][Region]) == -1)
- ErrorF("xf86UnMapVidMem: dmmap KDUNMAPDISP failed (%s)\n",
- strerror(errno));
- close(fd);
- }
- MapDSC[ScreenNum][Region].vaddr = (char *) NULL;
- MapDSC[ScreenNum][Region].physaddr = (char *) NULL;
- MapDSC[ScreenNum][Region].length = 0;
- MapDSC[ScreenNum][Region].ioflg = 0;
- }
+ int fd;
+ unsigned long realBase, alignOff;
+ pointer base;
+
+ fd = open (DEV_MEM, O_RDWR);
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM,
+ strerror(errno));
+ return 0; /* NOTREACHED */
+ }
+
+ realBase = Base & ~(getpagesize() - 1);
+ alignOff = Base - realBase;
+
+#ifdef DEBUG
+ ErrorF("base: %lx, realBase: %lx, alignOff: %lx\n", Base,realBase,alignOff);
#endif
- return;
-}
-
-/* ARGSUSED */
-Bool xf86LinearVidMem()
-{
- int fd, ver;
-#if defined(SVR4) || defined(SCO325)
- return TRUE;
-#else
- if ((fd = open("/dev/dmmap", O_RDWR)) >= 0) {
- ver = ioctl(fd, -1);
- close(fd);
- if (ver >= 0) {
- if (ver_once)
- ErrorF("Using dmmap version 0x%04x.\n", ver);
- ver_once = 0;
- return(TRUE);
- }
- }
- return(FALSE);
+ base = mmap((caddr_t)0, Size + alignOff, PROT_READ|PROT_WRITE,
+ MAP_SHARED, fd, (off_t)realBase);
+ close(fd);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer (0x%08x,0x%x) (%s)\n",
+ Base, Size, strerror(errno));
+ return 0; /* NOTREACHED */
+ }
+
+#ifdef DEBUG
+ ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff);
#endif
+ return (pointer)((char *)base + alignOff);
}
-/***************************************************************************/
-/* I/O Permissions section */
-/***************************************************************************/
+#if (USE_VASMETHOD)
+/*
+ * This maps memory using the virtual address space (VAS) console calls.
+ */
+static pointer
+mapVidMemVAS(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ struct vidvasmem vas;
+ pointer base;
-static Bool ScreenEnabled[MAXSCREENS];
-static Bool IOEnabled = FALSE;
-static Bool InitDone = FALSE;
+ vas.base = (long)Base;
+ vas.size = (long)Size;
-void xf86ClearIOPortList(ScreenNum)
-int ScreenNum;
-{
- int i;
-
- if (!InitDone)
- {
- for (i = 0; i < MAXSCREENS; i++)
- ScreenEnabled[i] = FALSE;
- InitDone = TRUE;
- }
+ base = (pointer)ioctl (xf86Info.consoleFd, CONS_ADDVAS, &vas);
+ if (base == (pointer)-1) {
+ return mapVidMemMMAP(ScreenNum, Base, Size, flags);
+ }
+ return base;
}
+#endif /* USE_VASMETHOD */
+
+struct vidclass vidclasslist[] = {
+ { "VBE", "", 0xf0000000, 0x2000000, 0 },
+ { "P9000", "", 0xc0000000, 0x400000, 0 },
+ { "TULIP", "", 0x80000000, 0x400000, 0 },
+ { "VIPER", "", 0xa0000000, 0x400000, 0 },
+ { "S3T", "", 0xa0000000, 0x200000, 0 },
+ { "S3DT", "", 0x4000000, 0x400000, 0 },
+ { "MGA", "", 0x2200000, 0x4000, 0 },
+ { "CLVGA", "", 0xa0000, 0x20000, 0 },
+ { "OLIVE", "", 0xd8000000, 0x400000, 0 },
+ { "S3C", "", 0xa0000, 0x10000, 0 },
+ { "MGAVLB", "", 0xac000, 0x34000, 0 },
+ { "ATI8514", "", 0xFF000, 0x1000, 0 },
+ { "GXREGS", "", 0xb0000, 0x10000, 0 },
+ { "GX", "", 0xa0000, 0x10000, 0 },
+ { "CT64300", "", 0xa0000000, 0x400000, 0 },
+ { "SVGA", "", 0xa0000, 0x20000, 0 },
+ { "S3V", "", 0xa0000000, 0x400000, 0 },
+ { "8514A", "", 0xFF000, 0x1000, 0 },
+ { "VGA", "", 0xa0000, 0x10000, 0 },
+ { 0 }
+};
-/* ARGSUSED */
-void xf86AddIOPorts(ScreenNum, NumPorts, Ports)
-int ScreenNum;
-int NumPorts;
-unsigned *Ports;
+static pointer
+mapVidMemVC(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
+ struct vidclass *vcp;
+ char *class = NULL;
+ pointer base;
+
+ for (vcp = vidclasslist; vcp->name; vcp++) {
+ if ((vcp->base == Base) && (vcp->size == Size)) {
+ class = vcp->name;
+ break;
+ }
+ }
+
+ if (class == NULL) {
+ /*
+ * As a fall-back, we will try and use the mmap() approach. This may
+ * prove to be the wrong thing to do, but time and testing will tell.
+ */
+ ErrorF("xf86MapVidMem: No class map defined for (0x%08x,0x%08x)\n", Base, Size);
+#if USE_VASMETHOD
+ return mapVidMemVAS(ScreenNum, Base, Size, flags);
+#else /* !USE_VASMETHOD */
+ return mapVidMemMMAP(ScreenNum, Base, Size, flags);
+#endif
+ }
+
+ /*
+ * We found a suitable class. Try and use it.
+ */
+ base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class);
+ if ((int)base == -1) {
+ FatalError("xf86MapVidMem: Failed to map video memory class `%s'\n", class);
+ return 0; /* NOTREACHED */
+ }
+
+ return base;
}
-void xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
-{
- ScreenEnabled[ScreenNum] = TRUE;
-
- if (IOEnabled)
- return;
-
- if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
- FatalError("Failed to set IOPL for extended I/O\n");
- IOEnabled = TRUE;
- return;
-}
+/*
+ * Unmapping the video memory is easy. We always call munmap(), as it is
+ * safe to do so even if we haven't actually mapped in any pages via mmap().
+ * In the case where we used the video class, we don't need to do anything
+ * as the kernel will clean up the TSS when we exit, and will undo the
+ * vasbind() that was done when the class was originally mapped. If we used
+ * vasmap, we simply undo the map. Again, it is benign to call vasunmap
+ * even if we got the frame buffer via some other mechanism (like mmap).
+ */
-void xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- int i;
+#if USE_VASMETHOD
+ struct vidvasmem vas;
+ int x;
- ScreenEnabled[ScreenNum] = FALSE;
+ vas.base = (long)Base;
+ vas.size = (long)Size;
- if (!IOEnabled)
- return;
+ x = ioctl (xf86Info.consoleFd, CONS_DELVAS, &vas);
+ if (x == 0)
+ return;
+#endif /* USE_VASMETHOD */
- for (i = 0; i < MAXSCREENS; i++)
- if (ScreenEnabled[i])
- return;
- sysi86(SI86V86, V86SC_IOPL, 0);
- IOEnabled = FALSE;
- return;
+ munmap(Base, Size);
}
-void xf86DisableIOPrivs()
+/*
+ * Set things up to point to our local functions. When the kernel gets
+ * MTRR support, we will need to add the required functions for that
+ * here too. MTRR support will most likely appear in 5.0.8 or 5.1.0.
+ *
+ * We also want to lock the X server process to the base CPU in an MPX
+ * system, since we will be going to IOPL 3. Most engine drivers can cope
+ * with I/O access on any CPU but there are a few (AST Manhattan I believe)
+ * that can't, so the server needs to be locked to CPU0.
+ */
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- if (IOEnabled)
- sysi86(SI86V86, V86SC_IOPL, 0);
- return;
-}
+ int mpx_fd;
-/***************************************************************************/
-/* Interrupt Handling section */
-/***************************************************************************/
-
-Bool xf86DisableInterrupts()
-{
-#ifdef __GNUC__
- __asm__ __volatile__("cli");
-#else
- asm("cli");
-#endif /* __GNUC__ */
-
- return(TRUE);
+ if (scoIsMultiConsole ()) {
+ pVidMem->mapMem = mapVidMemVC;
+ } else {
+#if USE_VASMETHOD
+ pVidMem->mapMem = mapVidMemVAS;
+#else
+ pVidMem->mapMem = mapVidMemMMAP;
+#endif
+ }
+
+ pVidMem->unmapMem = unmapVidMem;
+ pVidMem->linearSupported = TRUE;
+ pVidMem->initialised = TRUE;
+
+ if (mpxLock && (mpx_fd = open (MPXNAME, O_RDONLY)) > 0) {
+ if (ioctl (mpx_fd, ACPU_XLOCK, BASECPU) < 0)
+ ErrorF ("xf86OSInitVidMem: Can not bind to CPU 0 (%s)\n",
+ strerror(errno));
+ close (mpx_fd);
+ }
}
-void xf86EnableInterrupts()
-{
-#ifdef __GNUC__
- __asm__ __volatile__("sti");
-#else
- asm("sti");
-#endif /* __GNUC__ */
-
- return;
-}
diff --git a/hw/xfree86/os-support/shared/VTsw_noop.c b/hw/xfree86/os-support/shared/VTsw_noop.c
index 960ca9935..265a45f91 100644
--- a/hw/xfree86/os-support/shared/VTsw_noop.c
+++ b/hw/xfree86/os-support/shared/VTsw_noop.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c,v 3.1 1996/12/23 06:50:56 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c,v 3.2 1998/07/25 16:56:59 dawes Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
*
@@ -21,11 +21,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: VTsw_noop.c,v 1.3 2000/08/17 19:51:29 cpqbld Exp $ */
+/* $XConsortium: VTsw_noop.c /main/3 1996/02/21 17:53:25 kaleb $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "xf86.h"
#include "xf86Priv.h"
@@ -35,17 +33,20 @@
* No-op functions for OSs without VTs
*/
-Bool xf86VTSwitchPending()
+Bool
+xf86VTSwitchPending()
{
return(FALSE);
}
-Bool xf86VTSwitchAway()
+Bool
+xf86VTSwitchAway()
{
return(FALSE);
}
-Bool xf86VTSwitchTo()
+Bool
+xf86VTSwitchTo()
{
return(TRUE);
}
diff --git a/hw/xfree86/os-support/shared/VTsw_usl.c b/hw/xfree86/os-support/shared/VTsw_usl.c
index 47c4c5f9d..81aac54de 100644
--- a/hw/xfree86/os-support/shared/VTsw_usl.c
+++ b/hw/xfree86/os-support/shared/VTsw_usl.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c,v 3.1 1996/12/23 06:50:57 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c,v 3.4 2002/09/16 18:06:14 eich Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
*
@@ -21,11 +21,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: VTsw_usl.c,v 1.3 2000/08/17 19:51:30 cpqbld Exp $ */
+/* $XConsortium: VTsw_usl.c /main/3 1996/02/21 17:53:28 kaleb $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "xf86.h"
#include "xf86Priv.h"
@@ -40,20 +38,22 @@
* This function is the signal handler for the VT-switching signal. It
* is only referenced inside the OS-support layer.
*/
-void xf86VTRequest(sig)
-int sig;
+void
+xf86VTRequest(int sig)
{
- signal(sig, (void(*)())xf86VTRequest);
+ signal(sig, (void(*)(int))xf86VTRequest);
xf86Info.vtRequestsPending = TRUE;
return;
}
-Bool xf86VTSwitchPending()
+Bool
+xf86VTSwitchPending()
{
- return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
}
-Bool xf86VTSwitchAway()
+Bool
+xf86VTSwitchAway()
{
xf86Info.vtRequestsPending = FALSE;
if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
@@ -66,7 +66,8 @@ Bool xf86VTSwitchAway()
}
}
-Bool xf86VTSwitchTo()
+Bool
+xf86VTSwitchTo()
{
xf86Info.vtRequestsPending = FALSE;
if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
diff --git a/hw/xfree86/os-support/shared/bios_devmem.c b/hw/xfree86/os-support/shared/bios_devmem.c
index f26d7a524..5c24b9751 100644
--- a/hw/xfree86/os-support/shared/bios_devmem.c
+++ b/hw/xfree86/os-support/shared/bios_devmem.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c,v 3.3 1996/12/23 06:50:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c,v 3.7 2000/09/19 12:46:22 eich Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
*
@@ -21,12 +21,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: bios_devmem.c,v 1.3 2000/08/17 19:51:30 cpqbld Exp $ */
+/* $XConsortium: bios_devmem.c /main/5 1996/10/19 18:07:41 kaleb $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
-
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
@@ -40,100 +37,37 @@
# define DEV_MEM "/dev/mem"
#endif
-int xf86ReadBIOS(Base, Offset, Buf, Len)
-unsigned long Base;
-unsigned long Offset;
-unsigned char *Buf;
-int Len;
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
{
-#ifdef __alpha__
- /*
- * The Alpha version uses "mmap" instead of "lseek/read",
- * because these (currently) don't work for BUS memory.
- * We trick "mmap" into mapping BUS memory for us via BUS_BASE,
- * which is the KSEG address of the start of the DENSE memory
- * area.
- */
-
- /*
- * NOTE: there prolly ought to be more validity checks and all
- * re: boundaries and sizes and such...
- */
-
-/*
- * The Jensen lacks dense memory, thus we have to address the bus via
- * the sparse addressing scheme.
- *
- * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
- */
+ int fd;
-#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
-#define SPARSE (5)
-#define isJensen (1)
+#ifdef __ia64__
+ if ((fd = open(DEV_MEM, O_RDONLY | O_SYNC)) < 0)
#else
-#define isJensen (!_bus_base())
-#define SPARSE (7)
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
#endif
-
-extern unsigned long _bus_base(void);
-extern unsigned long _bus_base_sparse(void);
-#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base())
-#define JENSEN_SHIFT(x) (isJensen ? ((long)x<<SPARSE) : (long)x)
-
-#define SIZE (64*1024)
-
- caddr_t base;
- int fd;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
- {
- ErrorF("xf86ReadBios: Failed to open %s (%s)\n", DEV_MEM,
- strerror(errno));
- return(-1);
- }
-
- base = mmap((caddr_t)0, JENSEN_SHIFT(SIZE), PROT_READ,
- MAP_SHARED, fd, (off_t)(JENSEN_SHIFT(Base) + BUS_BASE));
-
- if (base == (caddr_t)-1UL)
- {
- ErrorF("xf86ReadBios: Failed to mmap %s (%s)\n", DEV_MEM,
- strerror(errno));
- return(-1);
- }
-
- SlowBCopyFromBus(base+JENSEN_SHIFT(Offset), Buf, Len);
-
- munmap((caddr_t)JENSEN_SHIFT(base), JENSEN_SHIFT(SIZE));
- close(fd);
- return(Len);
-
-#else /* __alpha__ */
-
- int fd;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
{
- ErrorF("xf86ReadBios: Failed to open %s (%s)\n", DEV_MEM,
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
return(-1);
}
if (lseek(fd, (Base+Offset), SEEK_SET) < 0)
{
- ErrorF("xf86ReadBios: %s seek failed (%s)\n", DEV_MEM,
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s seek failed (%s)\n",
+ DEV_MEM, strerror(errno));
close(fd);
return(-1);
}
if (read(fd, Buf, Len) != Len)
{
- ErrorF("xf86ReadBios: %s read failed (%s)\n", DEV_MEM,
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s read failed (%s)\n",
+ DEV_MEM, strerror(errno));
close(fd);
return(-1);
}
close(fd);
return(Len);
-#endif /* __alpha__ */
}
diff --git a/hw/xfree86/os-support/shared/ioperm_noop.c b/hw/xfree86/os-support/shared/ioperm_noop.c
index 4451d6f38..c24f4f1b2 100644
--- a/hw/xfree86/os-support/shared/ioperm_noop.c
+++ b/hw/xfree86/os-support/shared/ioperm_noop.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.1 1996/12/23 06:50:59 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.4 2001/07/23 13:15:48 dawes Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
*
@@ -21,40 +21,27 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: ioperm_noop.c,v 1.3 2000/08/17 19:51:30 cpqbld Exp $ */
+/* $XConsortium: ioperm_noop.c /main/3 1996/02/21 17:53:39 kaleb $ */
/*
- * Amoeba, Minix and 386BSD don't bother with I/O permissions,
+ * Some platforms don't bother with I/O permissions,
* or the permissions are implicit with opening/enabling the console.
*/
-void xf86ClearIOPortList(ScreenNum)
-int ScreenNum;
-{
- return;
-}
-/* ARGSUSED */
-void xf86AddIOPorts(ScreenNum, NumPorts, Ports)
-int ScreenNum;
-int NumPorts;
-unsigned *Ports;
-{
- return;
-}
+#include "X.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
-void xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
+void
+xf86EnableIO()
{
return;
}
-void xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
+void
+xf86DisableIO()
{
return;
}
-void xf86DisableIOPrivs()
-{
- return;
-}
diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c
index 8e92511d3..a4f487025 100644
--- a/hw/xfree86/os-support/shared/posix_tty.c
+++ b/hw/xfree86/os-support/shared/posix_tty.c
@@ -1,174 +1,690 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.8.2.1 1998/02/07 14:27:25 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.28 2003/02/17 15:11:59 dawes Exp $ */
/*
- * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
+ * Copyright 1993-1999 by The XFree86 Project, Inc.
*
- * 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 David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission.
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
+ * Permission is hereby granted, free of charge, to 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:
*
- * DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL DAVID DAWES 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.
+ * 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 XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project 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.
+ */
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to 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 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
*
*/
-/* $Xorg: posix_tty.c,v 1.3 2000/08/17 19:51:30 cpqbld Exp $ */
-#define NEED_EVENTS
-#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
+/* $XConsortium: posix_tty.c /main/7 1996/10/19 18:07:47 kaleb $ */
-#include "xf86Procs.h"
+#include "X.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#include "xf86_Config.h"
-
-static Bool not_a_tty = FALSE;
-
-void xf86SetMouseSpeed(mouse, old, new, cflag)
-MouseDevPtr mouse;
-int old;
-int new;
-unsigned cflag;
-{
- struct termios tty;
- char *c;
-
- if (not_a_tty)
- return;
-
- if (tcgetattr(mouse->mseFd, &tty) < 0)
- {
- not_a_tty = TRUE;
- ErrorF("Warning: %s unable to get status of mouse fd (%s)\n",
- mouse->mseDevice, strerror(errno));
- return;
- }
-
- /* this will query the initial baudrate only once */
- if (mouse->oldBaudRate < 0) {
- switch (cfgetispeed(&tty))
- {
- case B9600:
- mouse->oldBaudRate = 9600;
- break;
- case B4800:
- mouse->oldBaudRate = 4800;
- break;
- case B2400:
- mouse->oldBaudRate = 2400;
- break;
- case B1200:
- default:
- mouse->oldBaudRate = 1200;
- break;
- }
- }
-
- tty.c_iflag = IGNBRK | IGNPAR;
- tty.c_oflag = 0;
- tty.c_lflag = 0;
- tty.c_cflag = (tcflag_t)cflag;
- tty.c_cc[VTIME] = 0;
- tty.c_cc[VMIN] = 1;
-
- switch (old)
- {
- case 9600:
- cfsetispeed(&tty, B9600);
- cfsetospeed(&tty, B9600);
- break;
- case 4800:
- cfsetispeed(&tty, B4800);
- cfsetospeed(&tty, B4800);
- break;
- case 2400:
- cfsetispeed(&tty, B2400);
- cfsetospeed(&tty, B2400);
- break;
- case 1200:
- default:
- cfsetispeed(&tty, B1200);
- cfsetospeed(&tty, B1200);
- }
-
- if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n",
- strerror(errno));
- return;
+
+static int
+GetBaud (int baudrate)
+{
+#ifdef B300
+ if (baudrate == 300)
+ return B300;
+#endif
+#ifdef B1200
+ if (baudrate == 1200)
+ return B1200;
+#endif
+#ifdef B2400
+ if (baudrate == 2400)
+ return B2400;
+#endif
+#ifdef B4800
+ if (baudrate == 4800)
+ return B4800;
+#endif
+#ifdef B9600
+ if (baudrate == 9600)
+ return B9600;
+#endif
+#ifdef B19200
+ if (baudrate == 19200)
+ return B19200;
+#endif
+#ifdef B38400
+ if (baudrate == 38400)
+ return B38400;
+#endif
+#ifdef B57600
+ if (baudrate == 57600)
+ return B57600;
+#endif
+#ifdef B115200
+ if (baudrate == 115200)
+ return B115200;
+#endif
+#ifdef B230400
+ if (baudrate == 230400)
+ return B230400;
+#endif
+#ifdef B460800
+ if (baudrate == 460800)
+ return B460800;
+#endif
+ return (0);
+}
+
+int
+xf86OpenSerial (pointer options)
+{
+#ifdef Lynx
+ struct sgttyb ms_sgtty;
+#endif
+ struct termios t;
+ int fd, i;
+ char *dev;
+
+ dev = xf86SetStrOption (options, "Device", NULL);
+ if (!dev)
+ {
+ xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n");
+ return (-1);
+ }
+
+#ifndef Lynx
+ SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK | O_EXCL));
+#else
+ /* O_EXCL yields an EEXIST on LynxOS */
+ SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK));
+#endif
+ if (fd == -1)
+ {
+ xf86Msg (X_ERROR,
+ "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
+ dev, strerror (errno));
+ xfree(dev);
+ return (-1);
+ }
+
+ if (!isatty (fd))
+ {
+#if 1
+ /* Allow non-tty devices to be opened. */
+ xfree(dev);
+ return (fd);
+#else
+ xf86Msg (X_WARNING,
+ "xf86OpenSerial: Specified device %s is not a tty\n",
+ dev);
+ SYSCALL (close (fd));
+ errno = EINVAL;
+ xfree(dev);
+ return (-1);
+#endif
+ }
+
+#ifdef Lynx
+ /* LynxOS does not assert DTR without this */
+ ioctl (fd, TIOCGETP, (char *) &ms_sgtty);
+ ioctl (fd, TIOCSDTR, (char *) &ms_sgtty);
+#endif
+
+ /* set up default port parameters */
+ SYSCALL (tcgetattr (fd, &t));
+ t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR\
+ |IGNCR|ICRNL|IXON);
+ t.c_oflag &= ~OPOST;
+ t.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ t.c_cflag &= ~(CSIZE|PARENB);
+ t.c_cflag |= CS8|CLOCAL;
+
+ cfsetispeed (&t, B9600);
+ cfsetospeed (&t, B9600);
+ t.c_cc[VMIN] = 1;
+ t.c_cc[VTIME] = 0;
+
+ SYSCALL (tcsetattr (fd, TCSANOW, &t));
+
+ if (xf86SetSerial (fd, options) == -1)
+ {
+ SYSCALL (close (fd));
+ xfree(dev);
+ return (-1);
+ }
+
+ SYSCALL (i = fcntl (fd, F_GETFL, 0));
+ if (i == -1)
+ {
+ SYSCALL (close (fd));
+ xfree(dev);
+ return (-1);
+ }
+ i &= ~O_NONBLOCK;
+ SYSCALL (i = fcntl (fd, F_SETFL, i));
+ if (i == -1)
+ {
+ SYSCALL (close (fd));
+ xfree(dev);
+ return (-1);
+ }
+ xfree(dev);
+ return (fd);
+}
+
+int
+xf86SetSerial (int fd, pointer options)
+{
+ struct termios t;
+ int val;
+ const char *s;
+ int baud, r;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+ SYSCALL (tcgetattr (fd, &t));
+
+ if ((val = xf86SetIntOption (options, "BaudRate", 0)))
+ {
+ if ((baud = GetBaud (val)))
+ {
+ cfsetispeed (&t, baud);
+ cfsetospeed (&t, baud);
+ }
+ else
+ {
+ xf86Msg (X_ERROR,
+ "Invalid Option BaudRate value: %d\n", val);
+ return (-1);
+ }
+ }
+
+ if ((val = xf86SetIntOption (options, "StopBits", 0)))
+ {
+ switch (val)
+ {
+ case 1:
+ t.c_cflag &= ~(CSTOPB);
+ break;
+ case 2:
+ t.c_cflag |= CSTOPB;
+ break;
+ default:
+ xf86Msg (X_ERROR,
+ "Invalid Option StopBits value: %d\n", val);
+ return (-1);
+ break;
+ }
+ }
+
+ if ((val = xf86SetIntOption (options, "DataBits", 0)))
+ {
+ switch (val)
+ {
+ case 5:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS5;
+ break;
+ case 6:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS6;
+ break;
+ case 7:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS7;
+ break;
+ case 8:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS8;
+ break;
+ default:
+ xf86Msg (X_ERROR,
+ "Invalid Option DataBits value: %d\n", val);
+ return (-1);
+ break;
+ }
+ }
+
+ if ((s = xf86SetStrOption (options, "Parity", NULL)))
+ {
+ if (xf86NameCmp (s, "Odd") == 0)
+ {
+ t.c_cflag |= PARENB | PARODD;
+ }
+ else if (xf86NameCmp (s, "Even") == 0)
+ {
+ t.c_cflag |= PARENB;
+ t.c_cflag &= ~(PARODD);
}
- xf86FatalError("Unable to set status of mouse fd (%s)\n",
- strerror(errno));
- }
-
- switch (new)
- {
- case 9600:
- c = "*q";
- cfsetispeed(&tty, B9600);
- cfsetospeed(&tty, B9600);
- break;
- case 4800:
- c = "*p";
- cfsetispeed(&tty, B4800);
- cfsetospeed(&tty, B4800);
- break;
- case 2400:
- c = "*o";
- cfsetispeed(&tty, B2400);
- cfsetospeed(&tty, B2400);
- break;
- case 1200:
- default:
- c = "*n";
- cfsetispeed(&tty, B1200);
- cfsetospeed(&tty, B1200);
- }
-
- if (mouse->mseType == P_LOGIMAN || mouse->mseType == P_LOGI)
- {
- if (write(mouse->mseFd, c, 2) != 2)
+ else if (xf86NameCmp (s, "None") == 0)
{
- if (xf86AllowMouseOpenFail) {
- ErrorF("Unable to write to mouse fd (%s) - Continuing...\n",
- strerror(errno));
- return;
- }
- xf86FatalError("Unable to write to mouse fd (%s)\n",
- strerror(errno));
+ t.c_cflag &= ~(PARENB);
+ }
+ else
+ {
+ xf86Msg (X_ERROR, "Invalid Option Parity value: %s\n",
+ s);
+ return (-1);
}
}
- usleep(100000);
- if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0)
+ if ((val = xf86SetIntOption (options, "Vmin", -1)) != -1)
+ {
+ t.c_cc[VMIN] = val;
+ }
+ if ((val = xf86SetIntOption (options, "Vtime", -1)) != -1)
{
- if (xf86AllowMouseOpenFail) {
- ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n",
- strerror(errno));
- return;
+ t.c_cc[VTIME] = val;
+ }
+
+ if ((s = xf86SetStrOption (options, "FlowControl", NULL)))
+ {
+ xf86MarkOptionUsedByName (options, "FlowControl");
+ if (xf86NameCmp (s, "Xoff") == 0)
+ {
+ t.c_iflag |= IXOFF;
+ }
+ else if (xf86NameCmp (s, "Xon") == 0)
+ {
+ t.c_iflag |= IXON;
+ }
+ else if (xf86NameCmp (s, "XonXoff") == 0)
+ {
+ t.c_iflag |= IXON|IXOFF;
+ }
+ else if (xf86NameCmp (s, "None") == 0)
+ {
+ t.c_iflag &= ~(IXON | IXOFF);
}
- xf86FatalError("Unable to set status of mouse fd (%s)\n",
- strerror(errno));
+ else
+ {
+ xf86Msg (X_ERROR,
+ "Invalid Option FlowControl value: %s\n", s);
+ return (-1);
+ }
+ }
+
+ if ((xf86SetBoolOption (options, "ClearDTR", FALSE)))
+ {
+#ifdef CLEARDTR_SUPPORT
+# if !defined(Lynx) || defined(TIOCMBIC)
+ val = TIOCM_DTR;
+ SYSCALL (ioctl(fd, TIOCMBIC, &val));
+# else
+ SYSCALL (ioctl(fd, TIOCCDTR, NULL));
+# endif
+#else
+ xf86Msg (X_WARNING,
+ "Option ClearDTR not supported on this OS\n");
+ return (-1);
+#endif
+ xf86MarkOptionUsedByName (options, "ClearDTR");
+ }
+
+ if ((xf86SetBoolOption (options, "ClearRTS", FALSE)))
+ {
+#ifdef CLEARRTS_SUPPORT
+ val = TIOCM_RTS;
+ SYSCALL (ioctl(fd, TIOCMBIC, &val));
+#else
+ xf86Msg (X_WARNING,
+ "Option ClearRTS not supported on this OS\n");
+ return (-1);
+#endif
+ xf86MarkOptionUsedByName (options, "ClearRTS");
}
+
+ SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
+ return (r);
+}
+
+int
+xf86SetSerialSpeed (int fd, int speed)
+{
+ struct termios t;
+ int baud, r;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+ SYSCALL (tcgetattr (fd, &t));
+
+ if ((baud = GetBaud (speed)))
+ {
+ cfsetispeed (&t, baud);
+ cfsetospeed (&t, baud);
+ }
+ else
+ {
+ xf86Msg (X_ERROR,
+ "Invalid Option BaudRate value: %d\n", speed);
+ return (-1);
+ }
+
+ SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
+ return (r);
+}
+
+int
+xf86ReadSerial (int fd, void *buf, int count)
+{
+ int r;
+#ifdef DEBUG
+ int i;
+#endif
+ SYSCALL (r = read (fd, buf, count));
+#ifdef DEBUG
+ ErrorF("ReadingSerial: 0x%x",
+ (unsigned char)*(((unsigned char *)buf)));
+ for (i = 1; i < r; i++)
+ ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
+ ErrorF("\n");
+#endif
+ return (r);
+}
+
+int
+xf86WriteSerial (int fd, const void *buf, int count)
+{
+ int r;
+#ifdef DEBUG
+ int i;
+
+ ErrorF("WritingSerial: 0x%x",(unsigned char)*(((unsigned char *)buf)));
+ for (i = 1; i < count; i++)
+ ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
+ ErrorF("\n");
+#endif
+ SYSCALL (r = write (fd, buf, count));
+ return (r);
+}
+
+int
+xf86CloseSerial (int fd)
+{
+ int r;
+
+ SYSCALL (r = close (fd));
+ return (r);
+}
+
+int
+xf86WaitForInput (int fd, int timeout)
+{
+ fd_set readfds;
+ struct timeval to;
+ int r;
+
+ FD_ZERO(&readfds);
+
+ if (fd >= 0) {
+ FD_SET(fd, &readfds);
+ }
+
+ to.tv_sec = timeout / 1000000;
+ to.tv_usec = timeout % 1000000;
+
+ if (fd >= 0) {
+ SYSCALL (r = select (FD_SETSIZE, &readfds, NULL, NULL, &to));
+ }
+ else {
+ SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to));
+ }
+ xf86ErrorFVerb (9,"select returned %d\n", r);
+ return (r);
+}
+
+int
+xf86SerialSendBreak (int fd, int duration)
+{
+ int r;
+
+ SYSCALL (r = tcsendbreak (fd, duration));
+ return (r);
+
+}
+
+int
+xf86FlushInput(int fd)
+{
+ fd_set fds;
+ struct timeval timeout;
+ char c[4];
+
+#ifdef DEBUG
+ ErrorF("FlushingSerial\n");
+#endif
+ if (tcflush(fd, TCIFLUSH) == 0)
+ return 0;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ while (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) {
+ if (read(fd, &c, sizeof(c)) < 1)
+ return 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ }
+ return 0;
+}
+
+static struct states {
+ int xf;
+ int os;
+} modemStates[] = {
+#ifdef TIOCM_LE
+ { XF86_M_LE, TIOCM_LE },
+#endif
+#ifdef TIOCM_DTR
+ { XF86_M_DTR, TIOCM_DTR },
+#endif
+#ifdef TIOCM_RTS
+ { XF86_M_RTS, TIOCM_RTS },
+#endif
+#ifdef TIOCM_ST
+ { XF86_M_ST, TIOCM_ST },
+#endif
+#ifdef TIOCM_SR
+ { XF86_M_SR, TIOCM_SR },
+#endif
+#ifdef TIOCM_CTS
+ { XF86_M_CTS, TIOCM_CTS },
+#endif
+#ifdef TIOCM_CAR
+ { XF86_M_CAR, TIOCM_CAR },
+#elif defined(TIOCM_CD)
+ { XF86_M_CAR, TIOCM_CD },
+#endif
+#ifdef TIOCM_RNG
+ { XF86_M_RNG, TIOCM_RNG },
+#elif defined(TIOCM_RI)
+ { XF86_M_CAR, TIOCM_RI },
+#endif
+#ifdef TIOCM_DSR
+ { XF86_M_DSR, TIOCM_DSR },
+#endif
+};
+
+static int numStates = sizeof(modemStates) / sizeof(modemStates[0]);
+
+static int
+xf2osState(int state)
+{
+ int i;
+ int ret = 0;
+
+ for (i = 0; i < numStates; i++)
+ if (state & modemStates[i].xf)
+ ret |= modemStates[i].os;
+ return ret;
+}
+
+static int
+os2xfState(int state)
+{
+ int i;
+ int ret = 0;
+
+ for (i = 0; i < numStates; i++)
+ if (state & modemStates[i].os)
+ ret |= modemStates[i].xf;
+ return ret;
+}
+
+static int
+getOsStateMask(void)
+{
+ int i;
+ int ret = 0;
+ for (i = 0; i < numStates; i++)
+ ret |= modemStates[i].os;
+ return ret;
+}
+
+static int osStateMask = 0;
+
+int
+xf86SetSerialModemState(int fd, int state)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ if (!osStateMask)
+ osStateMask = getOsStateMask();
+
+ state = xf2osState(state);
+ SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
+ if (ret < 0)
+ return -1;
+ s &= ~osStateMask;
+ s |= state;
+ SYSCALL((ret = ioctl(fd, TIOCMSET, &s)));
+ if (ret < 0)
+ return -1;
+ else
+ return 0;
+#endif
+}
+
+int
+xf86GetSerialModemState(int fd)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
+ if (ret < 0)
+ return -1;
+ return os2xfState(s);
+#endif
}
int
-xf86FlushInput(fd)
-int fd;
+xf86SerialModemSetBits(int fd, int bits)
{
- return tcflush(fd, TCIFLUSH);
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ s = xf2osState(bits);
+ SYSCALL((ret = ioctl(fd, TIOCMBIS, &s)));
+ return ret;
+#endif
}
+int
+xf86SerialModemClearBits(int fd, int bits)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ s = xf2osState(bits);
+ SYSCALL((ret = ioctl(fd, TIOCMBIC, &s)));
+ return ret;
+#endif
+}
diff --git a/hw/xfree86/os-support/shared/std_kbdEv.c b/hw/xfree86/os-support/shared/std_kbdEv.c
index bca8061db..329346910 100644
--- a/hw/xfree86/os-support/shared/std_kbdEv.c
+++ b/hw/xfree86/os-support/shared/std_kbdEv.c
@@ -1,7 +1,7 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c,v 3.1 1996/12/23 06:51:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c,v 3.3 1999/05/07 02:56:23 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
+ * Copyright 1993 by David Dawes <dawes@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
@@ -23,18 +23,15 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: std_kbdEv.c,v 1.3 2000/08/17 19:51:30 cpqbld Exp $ */
+/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-void xf86KbdEvents()
+void
+xf86KbdEvents()
{
unsigned char rBuf[64];
int nBytes, i;
diff --git a/hw/xfree86/os-support/shared/sysv_kbd.c b/hw/xfree86/os-support/shared/sysv_kbd.c
index 2270be9f1..1bb2da386 100644
--- a/hw/xfree86/os-support/shared/sysv_kbd.c
+++ b/hw/xfree86/os-support/shared/sysv_kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c,v 3.2 1996/12/23 06:51:07 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c,v 3.4 1999/01/14 13:05:11 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Dawes <dawes@XFree86.org>
@@ -23,20 +23,18 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: sysv_kbd.c,v 1.3 2000/08/17 19:51:30 cpqbld Exp $ */
+/* $XConsortium: sysv_kbd.c /main/3 1996/02/21 17:53:59 kaleb $ */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-int xf86GetKbdLeds()
+int
+xf86GetKbdLeds()
{
int leds;
@@ -44,12 +42,8 @@ int xf86GetKbdLeds()
return(leds);
}
-#if NeedFunctionPrototypes
-void xf86SetKbdRepeat(char rad)
-#else
-void xf86SetKbdRepeat(rad)
-char rad;
-#endif
+void
+xf86SetKbdRepeat(char rad)
{
#ifdef KDSETRAD
ioctl(xf86Info.consoleFd, KDSETRAD, rad);
@@ -60,14 +54,15 @@ static int kbdtrans;
static struct termio kbdtty;
static char *kbdemap = NULL;
-void xf86KbdInit()
+void
+xf86KbdInit()
{
#ifdef KDGKBMODE
ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
#endif
ioctl (xf86Info.consoleFd, TCGETA, &kbdtty);
#if defined(E_TABSZ) && !defined(SCO325)
- kbdemap = (char *)xalloc(E_TABSZ);
+ kbdemap = xalloc(E_TABSZ);
if (ioctl(xf86Info.consoleFd, LDGMAP, kbdemap) < 0)
{
xfree(kbdemap);
@@ -76,7 +71,8 @@ void xf86KbdInit()
#endif
}
-int xf86KbdOn()
+int
+xf86KbdOn()
{
struct termio nTty;
@@ -93,7 +89,8 @@ int xf86KbdOn()
return(xf86Info.consoleFd);
}
-int xf86KbdOff()
+int
+xf86KbdOff()
{
if (kbdemap)
{
diff --git a/hw/xfree86/os-support/sysv/sysv_init.c b/hw/xfree86/os-support/sysv/sysv_init.c
index a253ab0b0..1e9166712 100644
--- a/hw/xfree86/os-support/sysv/sysv_init.c
+++ b/hw/xfree86/os-support/sysv/sysv_init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_init.c,v 3.4.2.1 1998/02/06 22:36:54 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_init.c,v 3.5 1998/07/25 16:57:08 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -23,17 +23,15 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: sysv_init.c,v 1.3 2000/08/17 19:51:32 cpqbld Exp $ */
+/* $XConsortium: sysv_init.c /main/4 1996/02/21 17:54:31 kaleb $ */
#include "X.h"
#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
static Bool KeepTty = FALSE;
@@ -42,27 +40,21 @@ static Bool Protect0 = FALSE;
#endif
static int VTnum = -1;
-extern void xf86VTRequest(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-void xf86OpenConsole()
+void
+xf86OpenConsole()
{
int fd;
struct vt_mode VT;
char vtname1[10],vtname2[10];
+ MessageType from = X_PROBED;
if (serverGeneration == 1)
{
/* check if we're run with euid==0 */
if (geteuid() != 0)
{
- FatalError("xf86OpenConsole: Server must be running with root "
- "permissions\n"
- "You should be using Xwrapper to start the server or xdm.\n"
- "We strongly advise against making the server SUID root!\n");
+ FatalError("xf86OpenConsole: Server must be suid root\n");
}
#ifdef SVR4
@@ -74,16 +66,18 @@ void xf86OpenConsole()
if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0)
{
- ErrorF("xf86OpenConsole: cannot open /dev/zero (%s)\n",
- strerror(errno));
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: cannot open /dev/zero (%s)\n",
+ strerror(errno));
}
else
{
if ((int)mmap(0, 0x1000, PROT_NONE,
MAP_FIXED | MAP_SHARED, fd, 0) == -1)
{
- ErrorF("xf86OpenConsole: failed to protect page 0 (%s)\n",
- strerror(errno));
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: failed to protect page 0 (%s)\n",
+ strerror(errno));
}
close(fd);
}
@@ -95,6 +89,7 @@ void xf86OpenConsole()
if (VTnum != -1)
{
xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
}
else
{
@@ -111,13 +106,11 @@ void xf86OpenConsole()
}
close(fd);
}
- ErrorF("(using VT number %d)\n\n", xf86Info.vtno);
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
sprintf(vtname1,"/dev/vc%02d",xf86Info.vtno); /* ESIX */
sprintf(vtname2,"/dev/vt%02d",xf86Info.vtno); /* rest of the world */
- xf86Config(FALSE); /* Read XF86Config */
-
if (!KeepTty)
{
setpgrp();
@@ -141,11 +134,11 @@ void xf86OpenConsole()
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_WAITACTIVE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
{
@@ -174,24 +167,25 @@ void xf86OpenConsole()
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
{
- ErrorF("xf86OpenConsole: VT_WAITACTIVE failed\n");
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
/*
* If the server doesn't have the VT when the reset occurs,
* this is to make sure we don't continue until the activate
* signal is received.
*/
- if (!xf86VTSema)
+ if (!xf86Screens[0]->vtSema)
sleep(5);
}
return;
}
-void xf86CloseConsole()
+void
+xf86CloseConsole()
{
struct vt_mode VT;
@@ -209,10 +203,8 @@ void xf86CloseConsole()
return;
}
-int xf86ProcessArgument(argc, argv, i)
-int argc;
-char *argv[];
-int i;
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
{
/*
* Keep server from detaching from controlling tty. This is useful
@@ -248,7 +240,8 @@ int i;
return(0);
}
-void xf86UseMsg()
+void
+xf86UseMsg()
{
ErrorF("vtXX use the specified VT number\n");
ErrorF("-keeptty ");
diff --git a/hw/xfree86/os-support/sysv/sysv_io.c b/hw/xfree86/os-support/sysv/sysv_io.c
index 150290c40..d48efd76e 100644
--- a/hw/xfree86/os-support/sysv/sysv_io.c
+++ b/hw/xfree86/os-support/sysv/sysv_io.c
@@ -1,7 +1,7 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c,v 3.4 1996/12/23 06:51:26 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c,v 3.11 2003/02/17 15:12:00 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
+ * Copyright 1993 by David Dawes <dawes@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
@@ -23,23 +23,18 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: sysv_io.c,v 1.3 2000/08/17 19:51:32 cpqbld Exp $ */
+/* $XConsortium: sysv_io.c /main/8 1996/10/19 18:08:06 kaleb $ */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
-void xf86SoundKbdBell(loudness, pitch, duration)
-int loudness;
-int pitch;
-int duration;
+void
+xf86SoundKbdBell(int loudness, int pitch, int duration)
{
if (loudness && pitch)
{
@@ -60,8 +55,8 @@ int duration;
}
}
-void xf86SetKbdLeds(leds)
-int leds;
+void
+xf86SetKbdLeds(int leds)
{
#ifdef KBIO_SETMODE
ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_AT);
@@ -70,29 +65,10 @@ int leds;
#endif
}
-void xf86MouseInit(mouse)
-MouseDevPtr mouse;
-{
- return;
-}
+#include "xf86OSKbd.h"
-int xf86MouseOn(mouse)
-MouseDevPtr mouse;
+Bool
+xf86OSKbdPreInit(InputInfoPtr pInfo)
{
- if ((mouse->mseFd = open(mouse->mseDevice, O_RDWR | O_NDELAY)) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Cannot open mouse (%s) - Continuing...\n",
- strerror(errno));
- return(-2);
- }
- FatalError("Cannot open mouse (%s)\n", strerror(errno));
- }
-
- xf86SetupMouse(mouse);
-
- /* Flush any pending input */
- ioctl(mouse->mseFd, TCFLSH, 0);
-
- return(mouse->mseFd);
+ return FALSE;
}
diff --git a/hw/xfree86/os-support/sysv/sysv_video.c b/hw/xfree86/os-support/sysv/sysv_video.c
index 7dd1575fc..ab604e95a 100644
--- a/hw/xfree86/os-support/sysv/sysv_video.c
+++ b/hw/xfree86/os-support/sysv/sysv_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.9 1996/12/23 06:51:27 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.20 2000/10/28 01:42:29 mvojkovi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -23,16 +23,19 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: sysv_video.c,v 1.3 2000/08/17 19:51:33 cpqbld Exp $ */
+/* $XConsortium: sysv_video.c /main/8 1996/10/25 11:38:09 kaleb $ */
#include "X.h"
-#include "input.h"
-#include "scrnintstr.h"
#define _NEED_SYSI86
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
#ifndef SI86IOPL
#define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
@@ -46,53 +49,96 @@
/* Video Memory Mapping section */
/***************************************************************************/
-struct kd_memloc MapDSC[MAXSCREENS][NUM_REGIONS];
-pointer AllocAddress[MAXSCREENS][NUM_REGIONS];
-#ifndef SVR4
-static int mmapFd = -2;
-#endif
-#if 0
-/* inserted for DGA support Tue Dec 5 21:33:00 MET 1995 mr */
-#if defined(SVR4) || defined(HAS_SVR3_MMAPDRV)
-static struct xf86memMap {
- int offset;
- int memSize;
-} xf86memMaps[MAXSCREENS];
+/*
+ * XXX Support for SVR3 will need to be reworked if needed. In particular
+ * the Region parameter is no longer passed, and will need to be dealt
+ * with internally if required.
+ * OK, i'll rework that thing ... (clean it up a lot)
+ * SVR3 Support only with SVR3_MMAPDRV (mr)
+ *
+ */
+
+#ifdef HAS_SVR3_MMAPDRV
+#ifndef MMAP_DEBUG
+#define MMAP_DEBUG 3
#endif
+
+struct kd_memloc MapDSC;
+int mmapFd = -2;
+
+static int
+mmapStat(pointer Base, unsigned long Size) {
+
+ int nmmreg,i=0,region=-1;
+ mmapinfo_t *ibuf;
+
+ nmmreg = ioctl(mmapFd, GETNMMREG);
+
+ if(nmmreg <= 0)
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "\nNo physical memory mapped currently.\n\n");
+ else {
+ if((ibuf = (mmapinfo_t *)malloc(nmmreg*sizeof(mmapinfo_t))) == NULL)
+ xf86Msg(X_WARNING,
+ "Couldn't allocate memory 4 mmapinfo_t\n");
+ else {
+ if(ioctl(mmapFd, GETMMREG, ibuf) != -1)
+ {
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# mmapStat: [Size=%x,Base=%x]\n", Size, Base);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# Physical Address Size Reference Count\n");
+ for(i = 0; i < nmmreg; i++) {
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "%-4d 0x%08X %5dk %5d ",
+ i, ibuf[i].physaddr, ibuf[i].length/1024, ibuf[i].refcnt);
+ if (ibuf[i].physaddr == Base || ibuf[i].length == Size ) {
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,"MATCH !!!");
+ if (region==-1) region=i;
+ }
+ xf86ErrorFVerb(MMAP_DEBUG, "\n");
+ }
+ xf86ErrorFVerb(MMAP_DEBUG, "\n");
+ }
+ free(ibuf);
+ }
+ }
+ if (region == -1 && nmmreg > 0) region=region * i;
+ return(region);
+}
#endif
-Bool xf86LinearVidMem()
+
+static Bool
+linearVidMem()
{
#ifdef SVR4
return TRUE;
-#else
-#ifdef HAS_SVR3_MMAPDRV
- if(mmapFd >= 0)
- {
- return TRUE;
- }
+#elif defined(HAS_SVR3_MMAPDRV)
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# xf86LinearVidMem: MMAP 2.2.2 called\n");
+
+ if(mmapFd >= 0) return TRUE;
+
if ((mmapFd = open("/dev/mmap", O_RDWR)) != -1)
{
if(ioctl(mmapFd, GETVERSION) < 0x0222) {
- ErrorF("xf86LinearVidMem: MMAP 2.2.2 or above required\n");
- ErrorF(" linear memory access disabled\n");
+ xf86Msg(X_WARNING,
+ "xf86LinearVidMem: MMAP 2.2.2 or above required\n");
+ xf86ErrorF("\tlinear memory access disabled\n");
return FALSE;
}
return TRUE;
}
- ErrorF("xf86LinearVidMem: failed to open /dev/mmap (%s)\n",
- strerror(errno));
- ErrorF(" linear memory access disabled\n");
-#endif
+ xf86Msg(X_WARNING, "xf86LinearVidMem: failed to open /dev/mmap (%s)\n",
+ strerror(errno));
+ xf86ErrorF("\tlinear memory access disabled\n");
return FALSE;
#endif
}
-pointer xf86MapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
pointer base;
int fd;
@@ -103,47 +149,40 @@ unsigned long Size;
FatalError("xf86MapVidMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
- base = (pointer)mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, (off_t)Base);
+ base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE,
+ MAP_SHARED, fd, (off_t)Base);
close(fd);
- if ((long)base == -1)
+ if (base == MAP_FAILED)
{
FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
"xf86MapVidMem", Size, Base, strerror(errno));
}
#else /* SVR4 */
#ifdef HAS_SVR3_MMAPDRV
- if (mmapFd == -2)
- {
- mmapFd = open("/dev/mmap", O_RDWR);
- }
-#endif
- if (mmapFd >= 0)
- {
- /* To force the MMAP driver to provide the address */
- base = (pointer)0;
- }
- else
+
+ xf86MsgVerb(X_INFO, MMAP_DEBUG, "# xf86MapVidMem: MMAP 2.2.2 called\n");
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
+ if (ioctl(mmapFd, GETVERSION) == -1)
{
- AllocAddress[ScreenNum][Region] = (pointer)xalloc(Size + 0x1000);
- if (AllocAddress[ScreenNum][Region] == (pointer)0)
- {
- FatalError("xf86MapVidMem: can't alloc framebuffer space\n");
- /* NOTREACHED */
- }
- base = (pointer)(((unsigned int)AllocAddress[ScreenNum][Region]
- & ~0xFFF) + 0x1000);
+ xf86LinearVidMem();
}
- MapDSC[ScreenNum][Region].vaddr = (char *)base;
- MapDSC[ScreenNum][Region].physaddr = (char *)Base;
- MapDSC[ScreenNum][Region].length = Size;
- MapDSC[ScreenNum][Region].ioflg = 1;
-
-#ifdef HAS_SVR3_MMAPDRV
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: Screen: %d\n", ScreenNum);
+ mmapStat(Base,Size);
+ /* To force the MMAP driver to provide the address */
+ base = (pointer)0;
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: [s=%x,a=%x]\n", Size, Base);
+ MapDSC.vaddr = (char *)base;
+ MapDSC.physaddr = (char *)Base;
+ MapDSC.length = Size;
+ MapDSC.ioflg = 1;
if(mmapFd >= 0)
{
- if((base = (pointer)ioctl(mmapFd, MAP,
- &(MapDSC[ScreenNum][Region]))) == (pointer)-1)
+ if((base = (pointer)ioctl(mmapFd, MAP, &MapDSC)) == (pointer)-1)
{
FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
"xf86MapVidMem", Size, Base, strerror(errno));
@@ -151,152 +190,106 @@ unsigned long Size;
}
/* Next time we want the same address! */
- MapDSC[ScreenNum][Region].vaddr = (char *)base;
-#if 0
-/* inserted for DGA support Tue Dec 5 21:33:00 MET 1995 mr */
- xf86memMaps[ScreenNum].offset = (int) Base;
- xf86memMaps[ScreenNum].memSize = Size;
-#endif
- return((pointer)base);
+ MapDSC.vaddr = (char *)base;
}
-#endif
- if (ioctl(xf86Info.consoleFd, KDMAPDISP,
- &(MapDSC[ScreenNum][Region])) < 0)
- {
- FatalError("xf86MapVidMem: Failed to map video mem (%x,%x) (%s)\n",
- Base, Size, strerror(errno));
- /* NOTREACHED */
- }
-#endif /* SVR4 */
-#if 0
- xf86memMaps[ScreenNum].offset = (int) Base;
- xf86memMaps[ScreenNum].memSize = Size;
-#endif
- return((pointer)base);
-}
-#if 0
-/* inserted for DGA support Tue Dec 5 21:33:00 MET 1995 mr */
-#if defined(SVR4) || defined(HAS_SVR3_MMAPDRV)
-void xf86GetVidMemData(ScreenNum, Base, Size)
-int ScreenNum;
-int *Base;
-int *Size;
-{
- *Base = xf86memMaps[ScreenNum].offset;
- *Size = xf86memMaps[ScreenNum].memSize;
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MapDSC.vaddr : 0x%x\n", MapDSC.vaddr);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MapDSC.physaddr: 0x%x\n", MapDSC.physaddr);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MapDSC.length : %d\n", MapDSC.length);
+ mmapStat(Base,Size);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: [s=%x,a=%x,b=%x]\n", Size, Base, base);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: SUCCEED Mapping FrameBuffer \n");
+#endif /* HAS_SVR3_MMAPDRV */
+#endif /* SVR4 */
+ return(base);
}
-#endif
-#endif
/* ARGSUSED */
-void xf86UnMapVidMem(ScreenNum, Region, Base, Size)
-int ScreenNum;
-int Region;
-pointer Base;
-unsigned long Size;
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
#if defined (SVR4)
munmap(Base, Size);
#else /* SVR4 */
#ifdef HAS_SVR3_MMAPDRV
- if(mmapFd >= 0)
- {
- ioctl(mmapFd, UNMAPRM, MapDSC[ScreenNum][Region].vaddr);
- return;
- }
-#endif
- /* XXXX This is a problem because it unmaps all regions */
- ioctl(xf86Info.consoleFd, KDUNMAPDISP, 0);
- xfree(AllocAddress[ScreenNum][Region]);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# xf86UnMapVidMem: UNMapping FrameBuffer\n");
+ mmapStat(Base,Size);
+ ioctl(mmapFd, UNMAPRM , Base);
+ mmapStat(Base,Size);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# xf86UnMapVidMem: Screen: %d [v=%x]\n", ScreenNum, Base);
+#endif /* HAS_SVR3_MMAPDRV */
#endif /* SVR4 */
+ return;
}
-/* ARGSUSED */
-void xf86MapDisplay(ScreenNum, Region)
-int ScreenNum;
-int Region;
+#if defined(SVR4) && defined(i386) && !defined(sun)
+/*
+ * For some SVR4 versions, a 32-bit read is done for the first location
+ * in each page when the page is first mapped. If this is done while
+ * memory access is enabled for regions that have read side-effects,
+ * this can cause unexpected results, including lockups on some hardware.
+ * This function is called to make sure each page is mapped while it is
+ * safe to do so.
+ */
+
+/*
+ * XXX Should get this the correct way (see os/xalloc.c), but since this is
+ * for one platform I'll be lazy.
+ */
+#define X_PAGE_SIZE 4096
+
+static void
+readSideEffects(int ScreenNum, pointer Base, unsigned long Size)
{
-#if !defined(SVR4)
-#ifdef HAS_SVR3_MMAPDRV
- if(mmapFd >= 0)
- {
- ioctl(mmapFd, MAP, &(MapDSC[ScreenNum][Region]));
- return;
- }
-#endif
- ioctl(xf86Info.consoleFd, KDMAPDISP, &(MapDSC[ScreenNum][Region]));
-#endif /* SVR4 */
- return;
+ unsigned long base, end, addr;
+ CARD32 val;
+
+ base = (unsigned long)Base;
+ end = base + Size;
+
+ for (addr = base; addr < end; addr += X_PAGE_SIZE)
+ val = *(volatile CARD32 *)addr;
}
+#endif
-/* ARGSUSED */
-void xf86UnMapDisplay(ScreenNum, Region)
-int ScreenNum;
-int Region;
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
-#if !defined(SVR4)
-#ifdef HAS_SVR3_MMAPDRV
- if(mmapFd > 0)
- {
- ioctl(mmapFd, UNMAP, MapDSC[ScreenNum][Region].vaddr);
- return;
- }
+ pVidMem->linearSupported = linearVidMem();
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+#if defined(SVR4) && defined(i386) && !defined(sun)
+ pVidMem->readSideEffects = readSideEffects;
#endif
- ioctl(xf86Info.consoleFd, KDUNMAPDISP, 0);
-#endif /* SVR4 */
- return;
+ pVidMem->initialised = TRUE;
}
-
+
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
-#define ALWAYS_USE_EXTENDED
-#ifdef ALWAYS_USE_EXTENDED
-
-static Bool ScreenEnabled[MAXSCREENS];
static Bool ExtendedEnabled = FALSE;
static Bool InitDone = FALSE;
void
-xf86ClearIOPortList(ScreenNum)
-int ScreenNum;
-{
- if (!InitDone)
- {
- int i;
- for (i = 0; i < MAXSCREENS; i++)
- ScreenEnabled[i] = FALSE;
- InitDone = TRUE;
- }
- return;
-}
-
-void
-xf86AddIOPorts(ScreenNum, NumPorts, Ports)
-int ScreenNum;
-int NumPorts;
-unsigned *Ports;
-{
- return;
-}
-
-void
-xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
+xf86EnableIO()
{
int i;
- ScreenEnabled[ScreenNum] = TRUE;
-
if (ExtendedEnabled)
return;
if (SET_IOPL() < 0)
{
- FatalError("%s: Failed to set IOPL for extended I/O\n",
- "xf86EnableIOPorts");
+ FatalError(
+ "xf86EnableIO: Failed to set IOPL for extended I/O\n");
}
ExtendedEnabled = TRUE;
@@ -304,245 +297,23 @@ int ScreenNum;
}
void
-xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
+xf86DisableIO()
{
- int i;
-
- ScreenEnabled[ScreenNum] = FALSE;
-
if (!ExtendedEnabled)
return;
- for (i = 0; i < MAXSCREENS; i++)
- if (ScreenEnabled[i])
- return;
-
RESET_IOPL();
ExtendedEnabled = FALSE;
return;
}
-#else /* !ALWAYS_USE_EXTENDED */
-
-#define DISABLED 0
-#define NON_EXTENDED 1
-#define EXTENDED 2
-
-static unsigned *EnabledPorts[MAXSCREENS];
-static int NumEnabledPorts[MAXSCREENS];
-static Bool ScreenEnabled[MAXSCREENS];
-static Bool ExtendedPorts[MAXSCREENS];
-static Bool ExtendedEnabled = FALSE;
-static Bool InitDone = FALSE;
-static struct kd_disparam OrigParams;
-
-void xf86ClearIOPortList(ScreenNum)
-int ScreenNum;
-{
- if (!InitDone)
- {
- xf86InitPortLists(EnabledPorts, NumEnabledPorts, ScreenEnabled,
- ExtendedPorts, MAXSCREENS);
- if (ioctl(xf86Info.consoleFd, KDDISPTYPE, &OrigParams) < 0)
- {
- FatalError("%s: Could not get display parameters\n",
- "xf86ClearIOPortList");
- }
- InitDone = TRUE;
- return;
- }
- ExtendedPorts[ScreenNum] = FALSE;
- if (EnabledPorts[ScreenNum] != (unsigned *)NULL)
- xfree(EnabledPorts[ScreenNum]);
- EnabledPorts[ScreenNum] = (unsigned *)NULL;
- NumEnabledPorts[ScreenNum] = 0;
-}
-
-void xf86AddIOPorts(ScreenNum, NumPorts, Ports)
-int ScreenNum;
-int NumPorts;
-unsigned *Ports;
-{
- int i;
-
- if (!InitDone)
- {
- FatalError("xf86AddIOPorts: I/O control lists not initialised\n");
- }
- EnabledPorts[ScreenNum] = (unsigned *)xrealloc(EnabledPorts[ScreenNum],
- (NumEnabledPorts[ScreenNum]+NumPorts)*sizeof(unsigned));
- for (i = 0; i < NumPorts; i++)
- {
- EnabledPorts[ScreenNum][NumEnabledPorts[ScreenNum] + i] =
- Ports[i];
- if (Ports[i] > 0x3FF)
- ExtendedPorts[ScreenNum] = TRUE;
- }
- NumEnabledPorts[ScreenNum] += NumPorts;
-}
-
-void xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
-{
- struct kd_disparam param;
- int i, j;
-
- if (ScreenEnabled[ScreenNum])
- return;
-
- for (i = 0; i < MAXSCREENS; i++)
- {
- if (ExtendedPorts[i] && (ScreenEnabled[i] || i == ScreenNum))
- {
- if (SET_IOPL() < 0)
- {
- FatalError("%s: Failed to set IOPL for extended I/O\n",
- "xf86EnableIOPorts");
- }
- ExtendedEnabled = TRUE;
- break;
- }
- }
- /* If extended I/O was used, but isn't any more */
- if (ExtendedEnabled && i == MAXSCREENS)
- {
- RESET_IOPL();
- ExtendedEnabled = FALSE;
- }
- /*
- * Turn on non-extended ports even when using extended I/O
- * so they are there if extended I/O gets turned off when it's no
- * longer needed.
- */
- if (ioctl(xf86Info.consoleFd, KDDISPTYPE, &param) < 0)
- {
- FatalError("%s: Could not get display parameters\n",
- "xf86EnableIOPorts");
- }
- for (i = 0; i < NumEnabledPorts[ScreenNum]; i++)
- {
- unsigned port = EnabledPorts[ScreenNum][i];
-
- if (port > 0x3FF)
- continue;
-
- if (!xf86CheckPorts(port, EnabledPorts, NumEnabledPorts,
- ScreenEnabled, MAXSCREENS))
- {
- continue;
- }
- for (j=0; j < MKDIOADDR; j++)
- {
- if (param.ioaddr[j] == port)
- {
- break;
- }
- }
- if (j == MKDIOADDR)
- {
- if (ioctl(xf86Info.consoleFd, KDADDIO, port) < 0)
- {
- FatalError("%s: Failed to enable port 0x%x\n",
- "xf86EnableIOPorts", port);
- }
- }
- }
- if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
- {
- FatalError("xf86EnableIOPorts: I/O port enable failed (%s)\n",
- strerror(errno));
- }
- ScreenEnabled[ScreenNum] = TRUE;
- return;
-}
-
-void xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
-{
- struct kd_disparam param;
- int i, j;
-
- if (!ScreenEnabled[ScreenNum])
- return;
-
- ScreenEnabled[ScreenNum] = FALSE;
- for (i = 0; i < MAXSCREENS; i++)
- {
- if (ScreenEnabled[i] && ExtendedPorts[i])
- break;
- }
- if (ExtendedEnabled && i == MAXSCREENS)
- {
- RESET_IOPL();
- ExtendedEnabled = FALSE;
- }
- /* Turn off I/O before changing the access list */
- ioctl(xf86Info.consoleFd, KDDISABIO, 0);
- if (ioctl(xf86Info.consoleFd, KDDISPTYPE, &param) < 0)
- {
- ErrorF("%s: Could not get display parameters\n",
- "xf86DisableIOPorts");
- return;
- }
-
- for (i=0; i < MKDIOADDR; i++)
- {
- /* 0 indicates end of list */
- if (param.ioaddr[i] == 0)
- {
- break;
- }
- if (!xf86CheckPorts(param.ioaddr[i], EnabledPorts,
- NumEnabledPorts, ScreenEnabled, MAXSCREENS))
- {
- continue;
- }
- for (j=0; j < MKDIOADDR; j++)
- {
- if (param.ioaddr[i] == OrigParams.ioaddr[j])
- {
- /*
- * Port was one of the original ones; don't
- * touch it.
- */
- break;
- }
- }
- if (j == MKDIOADDR)
- {
- /*
- * We added this port, so remove it.
- */
- ioctl(xf86Info.consoleFd, KDDELIO, param.ioaddr[i]);
- }
- }
- /* If any other screens are enabled, turn I/O back on */
- for (i = 0; i < MAXSCREENS; i++)
- {
- if (ScreenEnabled[i])
- {
- ioctl(xf86Info.consoleFd, KDENABIO, 0);
- break;
- }
- }
- return;
-}
-#endif /* ALWAYS_USE_EXTENDED */
-
-void xf86DisableIOPrivs()
-{
- if (ExtendedEnabled)
- RESET_IOPL();
- return;
-}
-
/***************************************************************************/
/* Interrupt Handling section */
/***************************************************************************/
-Bool xf86DisableInterrupts()
+Bool
+xf86DisableInterrupts()
{
if (!ExtendedEnabled)
{
@@ -565,7 +336,8 @@ Bool xf86DisableInterrupts()
return(TRUE);
}
-void xf86EnableInterrupts()
+void
+xf86EnableInterrupts()
{
if (!ExtendedEnabled)
{
diff --git a/hw/xfree86/os-support/sysv/xqueue.c b/hw/xfree86/os-support/sysv/xqueue.c
index 5e3c8e9fc..0478ee65e 100644
--- a/hw/xfree86/os-support/sysv/xqueue.c
+++ b/hw/xfree86/os-support/sysv/xqueue.c
@@ -1,38 +1,38 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.8.2.1 1997/07/13 14:45:04 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.
*
* 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 Thomas Roell not be used in
+ * documentation, and that the name of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
+ * specific, written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
*
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
*
*/
-/* $Xorg: xqueue.c,v 1.3 2000/08/17 19:51:33 cpqbld Exp $ */
+/* $XConsortium: xqueue.c /main/8 1996/10/19 18:08:11 kaleb $ */
-#define NEED_EVENTS
#include "X.h"
-#include "Xproto.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
-#include "xf86Procs.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "xqueue.h"
#ifdef XQUEUE
@@ -43,19 +43,23 @@ static int xquePipe[2];
#endif
#ifdef XKB
+#include "inputstr.h"
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBstr.h>
#include <X11/extensions/XKBsrv.h>
extern Bool noXkbExtension;
#endif
-#ifdef XINPUT
-#include "xf86_Config.h"
#include "xf86Xinput.h"
-#endif
-extern int miPointerGetMotionEvents(DeviceIntPtr pPtr, xTimecoord *coords,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
+#include "mipointer.h"
+
+typedef struct {
+ int xquePending;
+ int xqueSema;
+} XqInfoRec, *XqInfoPtr;
+
+InputInfoPtr XqMouse = NULL;
+InputInfoPtr XqKeyboard = NULL;
#ifndef XQUEUE_ASYNC
/*
@@ -67,7 +71,7 @@ extern int miPointerGetMotionEvents(DeviceIntPtr pPtr, xTimecoord *coords,
static void
xf86XqueSignal(int signum)
{
- xf86Info.mouseDev->xquePending = 1;
+ ((XqInfoPtr)(((MouseDevPtr)(XqMouse->private))->mousePriv))->xquePending = 1;
/*
* This is a hack, but it is the only reliable way I can find of letting
* the main select() loop know that there is more input waiting. Receiving
@@ -78,223 +82,14 @@ xf86XqueSignal(int signum)
* Suggestions for better ways of dealing with this without going back to
* asynchronous event processing are welcome.
*/
- write(xquePipe[1], "X", 1);
- signal(SIGUSR2, xf86XqueSignal);
-}
-#endif
-
-
-/*
- * xf86XqueRequest --
- * Notice an i/o request from the xqueue.
- */
-
-void
-xf86XqueRequest()
-{
- xqEvent *XqueEvents = XqueQaddr->xq_events;
- int XqueHead = XqueQaddr->xq_head;
- char buf[100];
-
- while (XqueHead != XqueQaddr->xq_tail)
- {
-
- switch(XqueEvents[XqueHead].xq_type) {
-
- case XQ_BUTTON:
- xf86PostMseEvent(xf86Info.pMouse,
- ~(XqueEvents[XqueHead].xq_code) & 0x07, 0, 0);
- break;
-
- case XQ_MOTION:
- xf86PostMseEvent(xf86Info.pMouse,
- ~(XqueEvents[XqueHead].xq_code) & 0x07,
- XqueEvents[XqueHead].xq_x,
- XqueEvents[XqueHead].xq_y);
- break;
-
- case XQ_KEY:
- xf86PostKbdEvent(XqueEvents[XqueHead].xq_code);
- break;
-
- default:
- ErrorF("Unknown Xque Event: 0x%02x\n", XqueEvents[XqueHead].xq_type);
- }
-
- if ((++XqueHead) == XqueQaddr->xq_size) XqueHead = 0;
- }
-
- /* reenable the signal-processing */
- xf86Info.inputPending = TRUE;
-#ifdef XQUEUE_ASYNC
- signal(SIGUSR2, (void (*)()) xf86XqueRequest);
-#else
-#if 0
- signal(SIGUSR2, (void (*)()) xf86XqueSignal);
-#endif
-#endif
-
-#ifndef XQUEUE_ASYNC
- {
- int rval;
-
- while ((rval = read(xquePipe[0], buf, sizeof(buf))) > 0)
#ifdef DEBUG
- ErrorF("Read %d bytes from xquePipe[0]\n", rval);
-#else
- ;
-#endif
- }
+ ErrorF("xf86XqueSignal\n");
#endif
-
- XqueQaddr->xq_head = XqueQaddr->xq_tail;
- xf86Info.mouseDev->xquePending = 0;
- XqueQaddr->xq_sigenable = 1; /* UNLOCK */
-}
-
-
-
-/*
- * xf86XqueEnable --
- * Enable the handling of the Xque
- */
-
-static int
-xf86XqueEnable()
-{
- static struct kd_quemode xqueMode;
- static Bool was_here = FALSE;
-
- if (!was_here) {
- if ((xqueFd = open("/dev/mouse", O_RDONLY|O_NDELAY)) < 0)
- {
- if (xf86AllowMouseOpenFail) {
- ErrorF("Cannot open /dev/mouse (%s) - Continuing...\n",
- strerror(errno));
- return (Success);
- } else {
- Error ("Cannot open /dev/mouse");
- return (!Success);
- }
- }
-#ifndef XQUEUE_ASYNC
- pipe(xquePipe);
- fcntl(xquePipe[0],F_SETFL,fcntl(xquePipe[0],F_GETFL,0)|O_NDELAY);
- fcntl(xquePipe[1],F_SETFL,fcntl(xquePipe[1],F_GETFL,0)|O_NDELAY);
-#endif
- was_here = TRUE;
- }
-
- if (xf86Info.mouseDev->xqueSema++ == 0)
- {
-#ifdef XQUEUE_ASYNC
- (void) signal(SIGUSR2, (void (*)()) xf86XqueRequest);
-#else
- (void) signal(SIGUSR2, (void (*)()) xf86XqueSignal);
-#endif
- xqueMode.qsize = 64; /* max events */
- xqueMode.signo = SIGUSR2;
- ioctl(xf86Info.consoleFd, KDQUEMODE, NULL);
-
- if (ioctl(xf86Info.consoleFd, KDQUEMODE, &xqueMode) < 0) {
- Error ("Cannot set KDQUEMODE");
- /* CONSTCOND */
- return (!Success);
- }
-
- XqueQaddr = (xqEventQueue *)xqueMode.qaddr;
- XqueQaddr->xq_sigenable = 1; /* UNLOCK */
- }
-
- return(Success);
-}
-
-
-
-/*
- * xf86XqueDisable --
- * disable the handling of the Xque
- */
-
-static int
-xf86XqueDisable()
-{
- if (xf86Info.mouseDev->xqueSema-- == 1)
- {
-
- XqueQaddr->xq_sigenable = 0; /* LOCK */
-
- if (ioctl(xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
- Error ("Cannot unset KDQUEMODE");
- /* CONSTCOND */
- return (!Success);
- }
- }
-
- return(Success);
+ write(xquePipe[1], "X", 1);
+ signal(SIGUSR2, xf86XqueSignal);
}
-
-
-
-/*
- * xf86XqueMseProc --
- * Handle the initialization, etc. of a mouse
- */
-
-int
-xf86XqueMseProc(pPointer, what)
- DeviceIntPtr pPointer;
- int what;
-{
- MouseDevPtr mouse = MOUSE_DEV(pPointer);
- unchar map[4];
- int ret;
-
- mouse->device = pPointer;
-
- switch (what)
- {
- case DEVICE_INIT:
-
- pPointer->public.on = FALSE;
-
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- 3,
- miPointerGetMotionEvents,
- (PtrCtrlProcPtr)xf86MseCtrl,
- miPointerGetMotionBufferSize());
- break;
-
- case DEVICE_ON:
- mouse->lastButtons = 0;
- mouse->emulateState = 0;
- pPointer->public.on = TRUE;
- ret = xf86XqueEnable();
-#ifndef XQUEUE_ASYNC
- if (xquePipe[0] != -1)
- AddEnabledDevice(xquePipe[0]);
-#endif
- return(ret);
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- ret = xf86XqueDisable();
-#ifndef XQUEUE_ASYNC
- if (xquePipe[0] != -1)
- RemoveEnabledDevice(xquePipe[0]);
#endif
- return(ret);
- }
- return Success;
-}
-
-
/*
* xf86XqueKbdProc --
@@ -302,9 +97,7 @@ xf86XqueMseProc(pPointer, what)
*/
int
-xf86XqueKbdProc (pKeyboard, what)
- DeviceIntPtr pKeyboard; /* Keyboard to manipulate */
- int what; /* What to do to it */
+xf86XqueKbdProc(DeviceIntPtr pKeyboard, int what)
{
KeySymsRec keySyms;
CARD8 modMap[MAP_LENGTH];
@@ -381,12 +174,12 @@ xf86XqueKbdProc (pKeyboard, what)
case DEVICE_ON:
pKeyboard->public.on = TRUE;
xf86InitKBD(FALSE);
- return(xf86XqueEnable());
+ break;
case DEVICE_CLOSE:
case DEVICE_OFF:
pKeyboard->public.on = FALSE;
- return(xf86XqueDisable());
+ break;
}
return (Success);
@@ -403,4 +196,343 @@ xf86XqueEvents()
{
}
+
+#ifdef XQUEUE_ASYNC
+static void XqDoInput(int signum);
+#endif
+
+void
+XqReadInput(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ XqInfoPtr pXq;
+ xqEvent *XqueEvents;
+ int XqueHead;
+ char buf[100];
+ signed char dx, dy;
+
+ if (xqueFd < 0)
+ return;
+
+ pMse = pInfo->private;
+ pXq = pMse->mousePriv;
+
+ XqueEvents = XqueQaddr->xq_events;
+ XqueHead = XqueQaddr->xq_head;
+
+ while (XqueHead != XqueQaddr->xq_tail) {
+ switch (XqueEvents[XqueHead].xq_type) {
+ case XQ_BUTTON:
+ pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
+ 0, 0, 0, 0);
+#ifdef DEBUG
+ ErrorF("xqueue: buttons: %d\n", ~(XqueEvents[XqueHead].xq_code) & 0x07);
+#endif
+ break;
+
+ case XQ_MOTION:
+ dx = (signed char)XqueEvents[XqueHead].xq_x;
+ dy = (signed char)XqueEvents[XqueHead].xq_y;
+ pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
+ (int)dx, (int)dy, 0, 0);
+#ifdef DEBUG
+ ErrorF("xqueue: Motion: (%d, %d) (buttons: %d)\n", dx, dy, ~(XqueEvents[XqueHead].xq_code) & 0x07);
+#endif
+ break;
+
+ case XQ_KEY:
+ /* XXX Need to deal with the keyboard part nicely. */
+#ifdef DEBUG
+ ErrorF("xqueue: key: %d\n", XqueEvents[XqueHead].xq_code);
+#endif
+ xf86PostKbdEvent(XqueEvents[XqueHead].xq_code);
+ break;
+ default:
+ xf86Msg(X_WARNING, "Unknown Xque Event: 0x%02x\n",
+ XqueEvents[XqueHead].xq_type);
+ }
+
+ if ((++XqueHead) == XqueQaddr->xq_size) XqueHead = 0;
+ xf86Info.inputPending = TRUE;
+ }
+
+ /* reenable the signal-processing */
+#ifdef XQUEUE_ASYNC
+ signal(SIGUSR2, XqDoInput);
+#endif
+
+#ifndef XQUEUE_ASYNC
+ {
+ int rval;
+
+ while ((rval = read(xquePipe[0], buf, sizeof(buf))) > 0)
+#ifdef DEBUG
+ ErrorF("Read %d bytes from xquePipe[0]\n", rval);
+#else
+ ;
+#endif
+ }
+#endif
+
+#ifdef DEBUG
+ ErrorF("Leaving XqReadInput()\n");
+#endif
+ pXq->xquePending = 0;
+ XqueQaddr->xq_head = XqueQaddr->xq_tail;
+ XqueQaddr->xq_sigenable = 1; /* UNLOCK */
+}
+
+#ifdef XQUEUE_ASYNC
+static void
+XqDoInput(int signum)
+{
+ if (XqMouse)
+ XqReadInput(XqMouse);
+}
+#endif
+
+static void
+XqBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ XqInfoPtr pXq;
+ /*
+ * On MP SVR4 boxes, a race condition exists because the XQUEUE does
+ * not have anyway to lock it for exclusive access. This results in one
+ * processor putting something on the queue at the same time the other
+ * processor is taking it something off. The count of items in the queue
+ * can get off by 1. This just goes and checks to see if an extra event
+ * was put in the queue a during this period. The signal for this event
+ * was ignored while processing the previous event.
+ */
+
+ pInfo = blockData;
+ pMse = pInfo->private;
+ pXq = pMse-> mousePriv;
+ if (!pXq->xquePending) {
+#ifdef DEBUG
+ ErrorF("XqBlock: calling XqReadInput()\n");
+#endif
+ XqReadInput((InputInfoPtr)blockData);
+ } else {
+#ifdef DEBUG
+ ErrorF("XqBlock: not calling XqReadInput()\n");
+#endif
+ ;
+ }
+ /*
+ * Make sure that any events that come in here are passed on without.
+ * waiting for the next wakeup.
+ */
+ if (xf86Info.inputPending) {
+#ifdef DEBUG
+ ErrorF("XqBlock: calling ProcessInputEvents()\n");
+#endif
+ ProcessInputEvents();
+ } else {
+#ifdef DEBUG
+ ErrorF("XqBlock: not calling ProcessInputEvents()\n");
+#endif
+ ;
+ }
+}
+
+/*
+ * XqEnable --
+ * Enable the handling of the Xque
+ */
+
+static int
+XqEnable(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ XqInfoPtr pXq;
+ static struct kd_quemode xqueMode;
+ static Bool was_here = FALSE;
+
+ pMse = pInfo->private;
+ pXq = pMse->mousePriv;
+
+ if (xqueFd < 0) {
+ if ((xqueFd = open("/dev/mouse", O_RDONLY | O_NDELAY)) < 0) {
+ if (xf86GetAllowMouseOpenFail()) {
+ xf86Msg(X_WARNING,
+ "%s: Cannot open /dev/mouse (%s) - Continuing...\n",
+ pInfo->name, strerror(errno));
+ return Success;
+ } else {
+ xf86Msg(X_ERROR, "%s: Cannot open /dev/mouse (%s)\n",
+ pInfo->name, strerror(errno));
+ return !Success;
+ }
+ }
+ }
+#ifndef XQUEUE_ASYNC
+ if (!was_here) {
+ pipe(xquePipe);
+ fcntl(xquePipe[0], F_SETFL, fcntl(xquePipe[0], F_GETFL, 0) | O_NDELAY);
+ fcntl(xquePipe[1], F_SETFL, fcntl(xquePipe[1], F_GETFL, 0) | O_NDELAY);
+ was_here = TRUE;
+ }
+#endif
+
+ if (pXq->xqueSema++ == 0) {
+#ifdef XQUEUE_ASYNC
+ (void) signal(SIGUSR2, XqDoInput);
+#else
+ (void) signal(SIGUSR2, xf86XqueSignal);
+#endif
+ xqueMode.qsize = 64; /* max events */
+ xqueMode.signo = SIGUSR2;
+ ioctl(xf86Info.consoleFd, KDQUEMODE, NULL);
+
+ if (ioctl(xf86Info.consoleFd, KDQUEMODE, &xqueMode) < 0) {
+ xf86Msg(X_ERROR, "%s: Cannot set KDQUEMODE", pInfo->name);
+ return !Success;
+ }
+ XqueQaddr = (xqEventQueue *)xqueMode.qaddr;
+ XqueQaddr->xq_sigenable = 1; /* UNLOCK */
+ }
+
+ return Success;
+}
+
+
+
+/*
+ * xf86XqueDisable --
+ * disable the handling of the Xque
+ */
+
+static int
+XqDisable(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ XqInfoPtr pXq;
+
+ pMse = pInfo->private;
+ pXq = pMse->mousePriv;
+
+ if (pXq->xqueSema-- == 1)
+ {
+ XqueQaddr->xq_sigenable = 0; /* LOCK */
+
+ if (ioctl(xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
+ xf86Msg(X_ERROR, "%s: Cannot unset KDQUEMODE", pInfo->name);
+ return !Success;
+ }
+ }
+
+ if (xqueFd >= 0) {
+ close(xqueFd);
+ xqueFd = -1;
+ }
+
+ return Success;
+}
+
+/*
+ * XqMouseProc --
+ * Handle the initialization, etc. of a mouse
+ */
+
+static int
+XqMouseProc(DeviceIntPtr pPointer, int what)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ unchar map[4];
+ int ret;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+
+ InitPointerDeviceStruct((DevicePtr)pPointer,
+ map,
+ 3,
+ 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);
+ RegisterBlockAndWakeupHandlers(XqBlock, (WakeupHandlerProcPtr)NoopDDA,
+ pInfo);
+ break;
+
+ case DEVICE_ON:
+ pMse->lastButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ ret = XqEnable(pInfo);
+#ifndef XQUEUE_ASYNC
+ if (xquePipe[0] != -1) {
+ pInfo->fd = xquePipe[0];
+ AddEnabledDevice(xquePipe[0]);
+ }
+#endif
+ return ret;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ ret = XqDisable(pInfo);
+#ifndef XQUEUE_ASYNC
+ if (xquePipe[0] != -1) {
+ RemoveEnabledDevice(xquePipe[0]);
+ pInfo->fd = -1;
+ }
+#endif
+ return ret;
+ }
+ return Success;
+}
+
+Bool
+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);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = XqMouseProc;
+#ifdef XQUEUE_ASYNC
+ pInfo->read_input = NULL;
+#else
+ pInfo->read_input = XqReadInput;
+#endif
+ pInfo->fd = -1;
+
+ XqMouse = pInfo;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
#endif /* XQUEUE */
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 72722a2c8..b35186724 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.36.2.5 1998/02/15 16:09:30 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.90 2002/05/31 18:46:00 dawes Exp $ */
/*
* Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1992 by David Dawes <dawes@XFree86.org>
@@ -9,7 +9,8 @@
* Copyright 1993 by Vrije Universiteit, The Netherlands
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
* Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
- * Copyright 1994, 1995 by The XFree86 Project, Inc
+ * Copyright 1997 by Takis Psarogiannakopoulos <takis@dpmms.cam.ac.uk>
+ * Copyright 1994-1998 by The XFree86 Project, Inc
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -31,7 +32,46 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86_OSlib.h,v 1.3 2000/08/17 19:51:20 cpqbld Exp $ */
+
+/*
+ * The ARM32 code here carries the following copyright:
+ *
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
+ * transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain
+ * this copyright notice and list of conditions as they appear in the
+ * source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation"
+ * name nor any trademark or logo of Digital Equipment Corporation may be
+ * used to endorse or promote products derived from this software without
+ * the prior written permission of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed.
+ * In no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for lost profits, loss
+ * of revenue or loss of use, whether such damages arise in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even
+ * if advised of the possibility of such damage.
+ *
+ */
+
+/* $XConsortium: xf86_OSlib.h /main/22 1996/10/27 11:06:31 kaleb $ */
+
+/*
+ * This is private, and should not be included by any drivers. Drivers
+ * may include xf86_OSproc.h to get prototypes for public interfaces.
+ */
#ifndef _XF86_OSLIB_H
#define _XF86_OSLIB_H
@@ -39,21 +79,43 @@
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
-#include "compiler.h"
-
-#if defined(MACH386) || defined(__OSF__)
-# undef NULL
-#endif /* MACH386 || __OSF__ */
+/*
+ * Define some things from the "ANSI" C wrappers that are needed in the
+ * the core server.
+ */
+#ifndef HAVE_WRAPPER_DECLS
+#define HAVE_WRAPPER_DECLS
+#undef usleep
+#define usleep(a) xf86usleep(a)
+extern void xf86usleep(unsigned long);
+extern int xf86getpagesize(void);
+extern int xf86GetErrno(void);
+typedef unsigned long xf86size_t;
+typedef signed long xf86ssize_t;
+#ifdef NEED_SNPRINTF
+extern int snprintf(char *str, size_t size, const char *format, ...);
+extern int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+#endif
+#endif
#include <stdio.h>
#include <ctype.h>
+#include <stddef.h>
/**************************************************************************/
-/* SYSV386 (SVR3, SVR4) */
+/* SYSV386 (SVR3, SVR4) - But not Solaris8 */
/**************************************************************************/
-#if defined(SYSV) || defined(SVR4)
+#if (defined(SYSV) || defined(SVR4)) && \
+ !defined(DGUX) && \
+ !defined(__SOL8__) && \
+ (!defined(sun) || defined(i386))
# ifdef SCO325
-# define _SVID3
+# ifndef _SVID3
+# define _SVID3
+# endif
+# ifndef _NO_STATIC
+# define _NO_STATIC
+# endif
# endif
# include <sys/ioctl.h>
# include <signal.h>
@@ -64,9 +126,20 @@
# include <sys/param.h>
# endif
+# ifdef ISC
+# define TIOCMSET (TIOC|26) /* set all modem bits */
+# define TIOCMBIS (TIOC|27) /* bis modem bits */
+# define TIOCMBIC (TIOC|28) /* bic modem bits */
+# define TIOCMGET (TIOC|29) /* get all modem bits */
+# endif
+
# include <errno.h>
-# if defined(_NEED_SYSI86)
+# if defined(PowerMAX_OS)
+# define HAS_USL_VTS
+# include <sys/immu.h>
+# include <sys/sysmacros.h>
+# elif defined(_NEED_SYSI86)
# include <sys/immu.h>
# if !(defined (sun) && defined (i386) && defined (SVR4))
# include <sys/region.h>
@@ -77,22 +150,30 @@
# if defined(SVR4) && !defined(sun)
# include <sys/seg.h>
# endif /* SVR4 && !sun */
-# include <sys/v86.h>
+# if defined(sun) && defined (i386) && defined (SVR4) /* Solaris? */
+# if !defined(V86SC_IOPL) /* Solaris 7? */
+# include <sys/v86.h> /* Nope */
+# endif /* V86SC_IOPL */
+# else
+# include <sys/v86.h> /* Not solaris */
+# endif /* sun && i386 && SVR4 */
# if defined(sun) && defined (i386) && defined (SVR4)
# include <sys/psw.h>
# endif
# endif /* _NEED_SYSI86 */
-#if defined(HAS_SVR3_MMAPDRV)
-# include <sys/sysmacros.h>
-# if !defined(_NEED_SYSI86)
-# include <sys/immu.h>
-# include <sys/region.h>
+# if defined(HAS_SVR3_MMAPDRV)
+# include <sys/sysmacros.h>
+# if !defined(_NEED_SYSI86)
+# include <sys/immu.h>
+# include <sys/region.h>
+# endif
+# include <sys/mmap.h> /* MMAP driver header */
# endif
-# include <sys/mmap.h> /* MMAP driver header */
-#endif
-# define HAS_USL_VTS
+# if !defined(sun) || !defined(sparc)
+# define HAS_USL_VTS
+# endif
# if !defined(sun)
# include <sys/emap.h>
# endif
@@ -104,7 +185,7 @@
# define LED_CAP 0x01
# define LED_NUM 0x02
# define LED_SCR 0x04
-# else /* SCO */
+# elif defined(HAS_USL_VTS)
# include <sys/at_ansi.h>
# include <sys/kd.h>
# include <sys/vt.h>
@@ -123,6 +204,8 @@
# include <sys/mman.h>
# if !(defined(sun) && defined (i386) && defined (SVR4))
# define DEV_MEM "/dev/pmem"
+# elif defined(PowerMAX_OS)
+# define DEV_MEM "/dev/iomem"
# endif
# ifdef SCO325
# undef DEV_MEM
@@ -143,33 +226,115 @@
# endif
# if defined(ATT) && !defined(i386)
-# define i386 /* note defined in ANSI C mode */
+# define i386 /* not defined in ANSI C mode */
# endif /* ATT && !i386 */
-# if (defined(ATT) || defined(SVR4)) && !(defined(sun) && defined (i386) && defined (SVR4)) && !defined(SCO325)
-# define XQUEUE
+# if (defined(ATT) || defined(SVR4)) && !defined(sun) && !defined(SCO325)
+# ifndef XQUEUE
+# define XQUEUE
+# endif
# include <sys/xque.h>
# endif /* ATT || SVR4 */
-/* Hack on SVR3 and SVR4 to avoid linking in Xenix or BSD support */
-#if defined (sun) && defined (i386) && defined (SVR4)
-extern int xf86_solx86usleep(unsigned long);
-# define usleep(usec) xf86_solx86usleep(usec)
-#else
-# define usleep(usec) syscall(3112, (usec) / 1000 + 1)
-#endif /* sun && i386 && SVR4 */
-
# ifdef SYSV
# if !defined(ISC) || defined(ISC202) || defined(ISC22)
# define NEED_STRERROR
# endif
# endif
-#ifndef NULL
-# define NULL 0
-#endif
+#endif /* (SYSV || SVR4) && !DGUX */
+
+/**********
+ * Good ol' Solaris8, and its lack of VT support
+ ***********/
+
+#if defined(__SOL8__) || (defined(sun) && !defined(i386))
+# include <sys/mman.h>
+# include <errno.h>
+# ifdef i386
+# include <sys/sysi86.h>
+# endif
+# include <sys/psw.h>
+
+# include <termio.h>
+# include <sys/fbio.h>
+# include <sys/kbd.h>
+# include <sys/kbio.h>
+
+# define LED_CAP LED_CAPS_LOCK
+# define LED_NUM LED_NUM_LOCK
+# define LED_SCR LED_SCROLL_LOCK
+
+# include <signal.h>
+
+#endif /* __SOL8__ */
+
+
+
+/**************************************************************************/
+/* DG/ux R4.20MU03 Intel AViion Machines */
+/**************************************************************************/
+#if defined(DGUX) && defined(SVR4)
+#include <sys/ioctl.h>
+#include <signal.h>
+#include <ctype.h>
+#include <termios.h> /* Use termios for BSD Flavor ttys */
+#include <sys/termios.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <errno.h>
+#include <sys/sysi86.h>
+#include <unistd.h>
+#include <sys/proc.h>
+#include <sys/map.h>
+#include <sys/sysmacros.h>
+#include <sys/mman.h> /* Memory handling */
+#include <sys/kd.h> /* definitios for KDENABIO KDDISABIO needed for IOPL s */
+#include <sys/kbd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/stream.h>
+#include <sys/ptms.h>
+
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <sys/stropts.h>
+#include <sys/sockio.h>
+
+
+#define POSIX_TTY
-#endif /* SYSV || SVR4 */
+#undef HAS_USL_VTS
+#undef USE_VT_SYSREQ
+#undef VT_ACKACQ
+
+#define LED_CAP KBD_LED_CAPS_LOCK
+#define LED_NUM KBD_LED_NUM_LOCK
+#define LED_SCR KBD_LED_SCROLL_LOCK
+
+#define KDGKBTYPE KBD_GET_LANGUAGE
+
+
+/* General keyboard types */
+# define KB_84 2
+# define KB_101 1 /* Because ioctl(dgkeybdFd,KBD_GET_LANGUAGE,&type) gives 1=US keyboard */
+# define KB_OTHER 3
+
+#define KDSETLED KBD_SET_LED
+#define KDGETLED KBD_GET_STATE
+#undef KDMKTONE
+#define KDMKTONE KBD_TONE_HIGH
+
+
+#undef DEV_MEM
+#define DEV_MEM "/dev/mem"
+#define CLEARDTR_SUPPORT
+
+#undef VT_SYSREQ_DEFAULT
+#define VT_SYSREQ_DEFAULT FALSE /* Make sure that we dont define any VTs since DG/ux has none */
+
+#endif /* DGUX && SVR4 */
/**************************************************************************/
/* Linux */
@@ -178,9 +343,11 @@ extern int xf86_solx86usleep(unsigned long);
# include <sys/ioctl.h>
# include <signal.h>
# include <termio.h>
+# ifdef __sparc__
+# include <sys/param.h>
+# endif
# include <errno.h>
-extern int errno;
# include <sys/stat.h>
@@ -228,6 +395,14 @@ extern int errno;
# include <termios.h>
# define POSIX_TTY
+# define CLEARDTR_SUPPORT
+
+/* LynxOS 2.5.1 has these */
+# ifdef LED_NUMLOCK
+# define LED_CAP LED_CAPSLOCK
+# define LED_NUM LED_NUMLOCK
+# define LED_SCR LED_SCROLLOCK
+# endif
#endif /* Lynx */
@@ -241,9 +416,6 @@ extern int errno;
#ifdef CSRG_BASED
# include <sys/ioctl.h>
-# if defined(__OpenBSD__) && defined(_status)
-# undef _status
-# endif
# include <signal.h>
# include <termios.h>
@@ -251,7 +423,6 @@ extern int errno;
# define POSIX_TTY
# include <errno.h>
-extern int errno;
# if !defined(LINKKIT)
/* Don't need this stuff for the Link Kit */
@@ -269,30 +440,38 @@ extern int errno;
# undef CONSOLE_X_BELL
# endif
# endif
-# ifdef CODRV_SUPPORT
-# define COMPAT_CO011
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
-# include <machine/ioctl_pc.h>
-# else
-# include <sys/ioctl_pc.h>
-# endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
-# endif /* CODRV_SUPPORT */
# 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(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__FreeBSD__)
# include <machine/pcvt_ioctl.h>
# else
-# include <sys/pcvt_ioctl.h>
-# endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+# if !defined(WSCONS_SUPPORT)
+# include <machine/pcvt_ioctl.h>
+# endif /* WSCONS_SUPPORT */
+# else
+# include <sys/pcvt_ioctl.h>
+# endif /* __NetBSD__ */
+# endif /* __FreeBSD__ || __OpenBSD__ */
# else /* pcvt and syscons: hard-code the ID magic */
# define VGAPCVTID _IOWR('V',113, struct pcvtid)
struct pcvtid {
@@ -301,9 +480,18 @@ extern int errno;
};
# endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
# endif /* PCVT_SUPPORT */
+# ifdef WSCONS_SUPPORT
+# include <dev/wscons/wsconsio.h>
+# include <dev/wscons/wsdisplay_usl_io.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
@@ -315,6 +503,25 @@ extern int errno;
# ifndef CONSOLE_X_BELL
# define CONSOLE_X_BELL _IOW('t',123,int[2])
# endif
+# ifndef CONSOLE_X_TV_ON
+# define CONSOLE_X_TV_ON _IOW('t',155,int)
+# define XMODE_RGB 0
+# define XMODE_NTSC 1
+# define XMODE_PAL 2
+# define XMODE_SECAM 3
+# endif
+# ifndef CONSOLE_X_TV_OFF
+# define CONSOLE_X_TV_OFF _IO('t',156)
+# endif
+#ifndef CONSOLE_GET_LINEAR_INFO
+# define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
+#endif
+#ifndef CONSOLE_GET_IO_INFO
+# define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
+#endif
+#ifndef CONSOLE_GET_MEM_INFO
+# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
+#endif
# endif /* __bsdi__ */
# endif /* !LINKKIT */
@@ -329,111 +536,23 @@ extern int errno;
# endif
# endif /* __bsdi__ */
+#ifdef USE_I386_IOPL
+#include <machine/sysarch.h>
+#endif
+
# 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
-# ifndef NULL
-# define NULL 0
-# endif
-
#endif /* CSRG_BASED */
/**************************************************************************/
-/* Mach and OSF/1 */
-/**************************************************************************/
-#if defined(MACH386) || defined(__OSF__)
-# include <sys/ioctl.h>
-
-# include <signal.h>
-
-# include <errno.h>
-extern int errno;
-
-# if defined(__OSF__)
-# include <sys/param.h>
-# include <machine/kd.h>
-# else /* __OSF__ */
-# if !defined(__STDC__)
-# define __STDC__ 1
-# include <i386at/kd.h>
-# include <i386at/kd_queue.h>
-# undef __STDC__
-# else /* !__STDC__ */
-# include <i386at/kd.h>
-# include <i386at/kd_queue.h>
-# endif /* !__STDC__ */
-# include <sys/file.h>
-# define SEEK_SET L_SET
-# endif /* __OSF__ */
-
-# ifdef MACH386
-# define NEED_STRERROR
-# endif
-
-# include <sys/mman.h>
-# include <sys/stat.h>
-# define MOUSE_PROTOCOL_IN_KERNEL
-
-#endif /* MACH386 || __OSF__ */
-
-/**************************************************************************/
-/* Minix */
-/**************************************************************************/
-#if defined(MINIX)
-# include <sys/ioctl.h>
-# include <signal.h>
-
-# include <termios.h>
-# define termio termios
-# define POSIX_TTY
-
-# include <errno.h>
-
-# include <assert.h>
-# include <limits.h>
-# include <sys/memio.h>
-# include <sys/kbdio.h>
-
-# include <sys/stat.h>
-
-#endif /* MINIX */
-
-/**************************************************************************/
-/* Amoeba */
-/**************************************************************************/
-#if defined(AMOEBA)
-# define port am_port_t
-# include <amoeba.h>
-# include <cmdreg.h>
-# include <stderr.h>
-# include <ampolicy.h>
-# include <proc.h>
-# include <signal.h>
-# include <server/iop/iop.h>
-# include <errno.h>
-# undef port
-
-# undef _POSIX_SOURCE /* to get the BSD-compatible symbols */
-# include <sys/stat.h>
-
- /* keyboard types */
-# define KB_84 1
-# define KB_101 2
-# define KB_OTHER 3
-
-extern capability iopcap;
-# define MOUSE_PROTOCOL_IN_KERNEL
-
-#endif /* AMOEBA */
-
-/**************************************************************************/
/* OS/2 */
/**************************************************************************/
-/* currently OS/2 with EMX/GCC compiler only */
-#if defined(__EMX__)
+/* currently OS/2 with a modified EMX/GCC compiler only */
+#if defined(__UNIXOS2__)
# include <signal.h>
# include <errno.h>
# include <sys/stat.h>
@@ -468,9 +587,99 @@ extern char* __XOS2RedirRoot(char*);
#endif
/**************************************************************************/
+/* QNX4 */
+/**************************************************************************/
+/* This is the QNX code for Watcom 10.6 and QNX 4.x */
+#if defined(QNX4)
+#include <signal.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <termios.h>
+#include <ioctl.h>
+#include <sys/param.h>
+
+/* Warning: by default, the fd_set size is 32 in QNX! */
+#define FD_SETSIZE 256
+#include <sys/select.h>
+
+ /* keyboard types */
+# define KB_84 1
+# define KB_101 2
+# define KB_OTHER 3
+
+ /* LEDs */
+# define LED_CAP 0x04
+# define LED_NUM 0x02
+# define LED_SCR 0x01
+
+# define POSIX_TTY
+# define OSMOUSE_ONLY
+# define MOUSE_PROTOCOL_IN_KERNEL
+
+#define TIOCM_DTR 0x0001 /* data terminal ready */
+#define TIOCM_RTS 0x0002 /* request to send */
+#define TIOCM_CTS 0x1000 /* clear to send */
+#define TIOCM_DSR 0x2000 /* data set ready */
+#define TIOCM_RI 0x4000 /* ring */
+#define TIOCM_RNG TIOCM_RI
+#define TIOCM_CD 0x8000 /* carrier detect */
+#define TIOCM_CAR TIOCM_CD
+#define TIOCM_LE 0x0100 /* line enable */
+#define TIOCM_ST 0x0200 /* secondary transmit */
+#define TIOCM_SR 0x0400 /* secondary receive */
+
+#endif
+
+/**************************************************************************/
+/* QNX/Neutrino */
+/**************************************************************************/
+/* This is the Neutrino code for for NTO2.0 and GCC */
+#if defined(__QNXNTO__)
+#include <signal.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <termios.h>
+#include <ioctl.h>
+#include <sys/param.h>
+
+/* Warning: by default, the fd_set size is 32 in NTO! */
+#define FD_SETSIZE 256
+#include <sys/select.h>
+
+ /* keyboard types */
+# define KB_84 1
+# define KB_101 2
+# define KB_OTHER 3
+
+# define POSIX_TTY
+
+#endif
+
+/**************************************************************************/
+/* GNU/Hurd */
+/**************************************************************************/
+#if defined(__GNU__)
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <sys/stat.h>
+#include <assert.h>
+
+#define POSIX_TTY
+#define USE_OSMOUSE
+
+#endif /* __GNU__ */
+
+/**************************************************************************/
/* Generic */
/**************************************************************************/
+#include <sys/wait.h> /* May need to adjust this for other OSs */
+
/*
* Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
* and it's safe, so just do it.
@@ -518,6 +727,10 @@ double RInt(
);
#endif
+#ifndef DEV_MEM
+#define DEV_MEM "/dev/mem"
+#endif
+
#ifndef VT_SYSREQ_DEFAULT
#define VT_SYSREQ_DEFAULT FALSE
#endif
@@ -528,6 +741,13 @@ double RInt(
# endif
#endif
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+
+#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
+#ifndef NO_COMPILER_H
+#include "compiler.h"
+#endif
+
#endif /* _XF86_OSLIB_H */
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index 9f5c49e27..4f067d5e0 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -1,4 +1,3 @@
-/* $Xorg: xf86_OSproc.h,v 1.3 2000/08/17 19:51:20 cpqbld Exp $ */
/*
* Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1992 by David Dawes <dawes@XFree86.org>
@@ -9,7 +8,7 @@
* Copyright 1993 by Vrije Universiteit, The Netherlands
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
* Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
- * Copyright 1994, 1995 by The XFree86 Project, Inc
+ * Copyright 1994-1999 by The XFree86 Project, Inc
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -32,36 +31,99 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.0.2.1 1998/02/07 14:27:24 dawes Exp $ */
+/*
+ * The ARM32 code here carries the following copyright:
+ *
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
+ * transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain
+ * this copyright notice and list of conditions as they appear in the
+ * source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation"
+ * name nor any trademark or logo of Digital Equipment Corporation may be
+ * used to endorse or promote products derived from this software without
+ * the prior written permission of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed.
+ * In no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for lost profits, loss
+ * of revenue or loss of use, whether such damages arise in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even
+ * if advised of the possibility of such damage.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.55 2002/01/25 21:56:17 tsi Exp $ */
#ifndef _XF86_OSPROC_H
#define _XF86_OSPROC_H
+#ifdef XF86_OS_PRIVS
+#include "xf86Pci.h"
+#endif
+
/*
* The actual prototypes have been pulled into this seperate file so
* that they can can be used without pulling in all of the OS specific
* stuff like sys/stat.h, etc. This casues problem for loadable modules.
*/
-/* The Region arg to xf86[Un]Map* */
-#define NUM_REGIONS 4
-#define VGA_REGION 0
-#define LINEAR_REGION 1
-#define EXTENDED_REGION 2
-#define MMIO_REGION 3
+/*
+ * Flags for xf86MapVidMem(). Multiple flags can be or'd together. The
+ * flags may be used as hints. For example it would be permissible to
+ * enable write combining for memory marked only for framebuffer use.
+ */
+
+#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
+#define VIDMEM_MMIO 0x02 /* memory for I/O use */
+#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
+#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
+#define VIDMEM_SPARSE 0x10 /* sparse mapping required
+ * assumed when VIDMEM_MMIO is
+ * set. May be used with
+ * VIDMEM_FRAMEBUFFER) */
+#define VIDMEM_READONLY 0x20 /* read-only mapping
+ * used when reading BIOS images
+ * through xf86MapVidMem() */
+
+/*
+ * OS-independent modem state flags for xf86SetSerialModemState() and
+ * xf86GetSerialModemState().
+ */
+#define XF86_M_LE 0x001 /* line enable */
+#define XF86_M_DTR 0x002 /* data terminal ready */
+#define XF86_M_RTS 0x004 /* request to send */
+#define XF86_M_ST 0x008 /* secondary transmit */
+#define XF86_M_SR 0x010 /* secondary receive */
+#define XF86_M_CTS 0x020 /* clear to send */
+#define XF86_M_CAR 0x040 /* carrier detect */
+#define XF86_M_RNG 0x080 /* ring */
+#define XF86_M_DSR 0x100 /* data set ready */
+
+#ifdef XF86_OS_PRIVS
+extern void xf86WrapperInit(void);
+#endif
#ifndef NO_OSLIB_PROTOTYPES
/*
* This is to prevent re-entrancy to FatalError() when aborting.
* Anything that can be called as a result of AbortDDX() should use this
- * instead of FatalError(). (xf86Exiting gets set to TRUE the first time
- * AbortDDX() is called.)
+ * instead of FatalError().
*/
-extern Bool xf86Exiting;
-
#define xf86FatalError(a, b) \
- if (xf86Exiting) { \
+ if (dispatchException & DE_TERMINATE) { \
ErrorF(a, b); \
return; \
} else FatalError(a, b)
@@ -71,322 +133,134 @@ extern Bool xf86Exiting;
/***************************************************************************/
#include <X11/Xfuncproto.h>
+#include "opaque.h"
_XFUNCPROTOBEGIN
-/* xf86_Util.c */
-extern int StrCaseCmp(
-#if NeedFunctionPrototypes
- const char *,
- const char *
-#endif
-);
+/* public functions */
+extern Bool xf86LinearVidMem(void);
+extern Bool xf86CheckMTRR(int);
+extern pointer xf86MapVidMem(int, int, unsigned long, unsigned long);
+extern void xf86UnMapVidMem(int, pointer, unsigned long);
+extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
+extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
+extern void xf86EnableIO(void);
+extern void xf86DisableIO(void);
+extern Bool xf86DisableInterrupts(void);
+extern void xf86EnableInterrupts(void);
+extern void xf86SetTVOut(int);
+extern void xf86SetRGBOut(void);
+extern void xf86SoundKbdBell(int, int, int);
+#if defined(QNX4)
+#pragma aux xf86BusToMem modify [eax ebx ecx edx esi edi];
+#pragma aux xf86MemToBus modify [eax ebx ecx edx esi edi];
+#endif
+extern void xf86BusToMem(unsigned char *, unsigned char *, int);
+extern void xf86MemToBus(unsigned char *, unsigned char *, int);
+extern void xf86IODelay(void);
+extern void xf86UDelay(long usec);
+extern void xf86SlowBcopy(unsigned char *, unsigned char *, int);
+extern int xf86OpenSerial(pointer options);
+extern int xf86SetSerial(int fd, pointer options);
+extern int xf86SetSerialSpeed(int fd, int speed);
+extern int xf86ReadSerial(int fd, void *buf, int count);
+extern int xf86WriteSerial(int fd, const void *buf, int count);
+extern int xf86CloseSerial(int fd);
+extern int xf86FlushInput(int fd);
+extern int xf86WaitForInput(int fd, int timeout);
+extern int xf86SerialSendBreak(int fd, int duration);
+extern int xf86SetSerialModemState(int fd, int state);
+extern int xf86GetSerialModemState(int fd);
+extern int xf86SerialModemSetBits(int fd, int bits);
+extern int xf86SerialModemClearBits(int fd, int bits);
+extern int xf86LoadKernelModule(const char *pathname);
-/* OS-support layer */
-extern void xf86OpenConsole(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86CloseConsole(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern Bool xf86VTSwitchPending(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern Bool xf86VTSwitchAway(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern Bool xf86VTSwitchTo(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern Bool xf86LinearVidMem(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern pointer xf86MapVidMem(
-#if NeedFunctionPrototypes
- int,
- int,
- pointer,
- unsigned long
-#endif
-);
-extern void xf86UnMapVidMem(
-#if NeedFunctionPrototypes
- int,
- int,
- pointer,
- unsigned long
-#endif
-);
-#if defined(__alpha__)
-/* entry points for SPARSE memory access routines */
-extern pointer xf86MapVidMemSparse(
-#if NeedFunctionPrototypes
- int,
- int,
- pointer,
- unsigned long
-#endif
-);
-extern void xf86UnMapVidMemSparse(
-#if NeedFunctionPrototypes
- int,
- int,
- pointer,
- unsigned long
-#endif
-);
-extern int xf86ReadSparse8(
-#if NeedFunctionPrototypes
- pointer,
- unsigned long
-#endif
-);
-extern int xf86ReadSparse16(
-#if NeedFunctionPrototypes
- pointer,
- unsigned long
-#endif
-);
-extern int xf86ReadSparse32(
-#if NeedFunctionPrototypes
- pointer,
- unsigned long
-#endif
-);
-extern void xf86WriteSparse8(
-#if NeedFunctionPrototypes
- int,
- pointer,
- unsigned long
-#endif
-);
-extern void xf86WriteSparse16(
-#if NeedFunctionPrototypes
- int,
- pointer,
- unsigned long
-#endif
-);
-extern void xf86WriteSparse32(
-#if NeedFunctionPrototypes
- int,
- pointer,
- unsigned long
-#endif
-);
-#endif /* __alpha__ */
-extern void xf86MapDisplay(
-#if NeedFunctionPrototypes
- int,
- int
-#endif
-);
-extern void xf86UnMapDisplay(
-#if NeedFunctionPrototypes
- int,
- int
-#endif
-);
-extern int xf86ReadBIOS(
-#if NeedFunctionPrototypes
- unsigned long,
- unsigned long,
- unsigned char *,
- int
-#endif
-);
-extern void xf86ClearIOPortList(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-extern void xf86AddIOPorts(
-#if NeedFunctionPrototypes
- int,
- int,
- unsigned *
-#endif
-);
-void xf86EnableIOPorts(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-void xf86DisableIOPorts(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-void xf86DisableIOPrivs(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern Bool xf86DisableInterrupts(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86EnableInterrupts(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern int xf86ProcessArgument(
-#if NeedFunctionPrototypes
- int,
- char **,
- int
-#endif
-);
-extern void xf86UseMsg(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86SoundKbdBell(
-#if NeedFunctionPrototypes
- int,
- int,
- int
-#endif
-);
-extern void xf86SetKbdLeds(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-extern int xf86GetKbdLeds(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86SetKbdRepeat(
-#if NeedFunctionPrototypes
- char
-#endif
-);
-extern void xf86KbdInit(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern int xf86KbdOn(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern int xf86KbdOff(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86KbdEvents(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86SetMouseSpeed(
-#if NeedFunctionPrototypes
- MouseDevPtr,
- int,
- int,
- unsigned
-#endif
-);
-extern void xf86MouseInit(
-#if NeedFunctionPrototypes
- MouseDevPtr
-#endif
-);
-extern int xf86MouseOn(
-#if NeedFunctionPrototypes
- MouseDevPtr
-#endif
-);
-extern int xf86MouseOff(
-#if NeedFunctionPrototypes
- MouseDevPtr,
- Bool
-#endif
-);
-extern void xf86MouseEvents(
-#if NeedFunctionPrototypes
- MouseDevPtr
-#endif
-);
-extern int xf86FlushInput(
-#if NeedFunctionPrototypes
- int
-#endif
-);
-extern int xf86XqueKbdProc(
-#if NeedFunctionPrototypes
- DeviceIntPtr,
- int
-#endif
-);
-extern int xf86XqueMseProc(
-#if NeedFunctionPrototypes
- DeviceIntPtr,
- int
-#endif
-);
-extern void xf86XqueEvents(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+/* AGP GART interface */
+typedef struct _AgpInfo {
+ CARD32 bridgeId;
+ CARD32 agpMode;
+ unsigned long base;
+ unsigned long size;
+ unsigned long totalPages;
+ unsigned long systemPages;
+ unsigned long usedPages;
+} AgpInfo, *AgpInfoPtr;
+
+extern Bool xf86AgpGARTSupported(void);
+extern AgpInfoPtr xf86GetAGPInfo(int screenNum);
+extern Bool xf86AcquireGART(int screenNum);
+extern Bool xf86ReleaseGART(int screenNum);
+extern int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical);
+extern Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset);
+extern Bool xf86UnbindGARTMemory(int screenNum, int key);
+extern Bool xf86EnableAGP(int screenNum, CARD32 mode);
+extern Bool xf86GARTCloseScreen(int screenNum);
+
+/* These routines are in shared/sigio.c and are not loaded as part of the
+ module. These routines are small, and the code if very POSIX-signal (or
+ OS-signal) specific, so it seemed better to provide more complex
+ wrappers than to wrap each individual function called. */
+extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *);
+extern int xf86RemoveSIGIOHandler(int fd);
+extern int xf86BlockSIGIO (void);
+extern void xf86UnblockSIGIO (int);
+#ifdef XFree86Server
+extern void xf86AssertBlockedSIGIO (char *);
+#endif
+extern Bool xf86SIGIOSupported (void);
+
+#ifdef XF86_OS_PRIVS
+typedef void (*PMClose)(void);
+extern void xf86OpenConsole(void);
+extern void xf86CloseConsole(void);
+extern Bool xf86VTSwitchPending(void);
+extern Bool xf86VTSwitchAway(void);
+extern Bool xf86VTSwitchTo(void);
+extern void xf86VTRequest(int sig);
+extern int xf86ProcessArgument(int, char **, int);
+extern void xf86UseMsg(void);
+extern void xf86SetKbdLeds(int);
+extern int xf86GetKbdLeds(void);
+extern void xf86SetKbdRepeat(char);
+extern void xf86KbdInit(void);
+extern int xf86KbdOn(void);
+extern int xf86KbdOff(void);
+extern void xf86KbdEvents(void);
+#ifdef XQUEUE
+extern int xf86XqueKbdProc(DeviceIntPtr, int);
+extern void xf86XqueEvents(void);
+#endif
+#ifdef WSCONS_SUPPORT
+extern void xf86WSKbdEvents(void);
+#endif
+extern PMClose xf86OSPMOpen(void);
+
+#ifdef NEED_OS_RAC_PROTOS
+/* RAC-related privs */
+/* internal to os-support layer */
+resPtr xf86StdBusAccWindowsFromOS(void);
+resPtr xf86StdPciAccWindowsFromOS(void);
+resPtr xf86StdIsaAccWindowsFromOS(void);
+resPtr xf86StdAccResFromOS(resPtr ret);
+
+/* available to the common layer */
+resPtr xf86BusAccWindowsFromOS(void);
+resPtr xf86PciBusAccWindowsFromOS(void);
+#ifdef INCLUDE_UNUSED
+resPtr xf86IsaBusAccWindowsFromOS(void);
+#endif
+resPtr xf86AccResFromOS(resPtr ret);
+#endif /* NEED_OS_RAC_PROTOS */
+
+extern Bool xf86GetPciSizeFromOS(PCITAG tag, int indx, int* bits);
+
+extern void xf86MakeNewMapping(int, int, unsigned long, unsigned long, pointer);
+extern void xf86InitVidMem(void);
+
+#endif /* XF86_OS_PRIVS */
-/* These are privates */
-extern void xf86InitPortLists(
-#if NeedFunctionPrototypes
- unsigned **,
- int *,
- Bool *,
- Bool *,
- int
-#endif
-);
-extern Bool xf86CheckPorts(
-#if NeedFunctionPrototypes
- unsigned,
- unsigned **,
- int *,
- Bool *,
- int
-#endif
-);
-extern int xf86OsMouseProc(
-#if NeedFunctionPrototypes
- DeviceIntPtr,
- int
-#endif
-);
-extern void xf86OsMouseEvents(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-extern void xf86OsMouseOption(
-#if NeedFunctionPrototypes
- int,
- pointer /* gets cast to LexPtr later, saves include file hassles */
-#endif
-);
_XFUNCPROTOEND
#endif /* NO_OSLIB_PROTOTYPES */
diff --git a/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c b/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c
index 37c23cfea..f7d07eb79 100644
--- a/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c
+++ b/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c
@@ -1,10 +1,10 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.c,v 3.5 1996/12/23 06:47:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.c,v 3.6 1998/07/26 09:56:17 dawes Exp $ */
/* Keyboard mode control program for 386BSD */
-/* $Xorg: kbd_mode.c,v 1.3 2000/08/17 19:51:09 cpqbld Exp $ */
+/* $XConsortium: kbd_mode.c /main/7 1996/03/11 10:46:12 kaleb $ */
#include <sys/types.h>
#include <fcntl.h>
@@ -20,6 +20,7 @@
#include "scrnintstr.h"
#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
static int fd;
diff --git a/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre b/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre
index c959d2332..677663d7e 100644
--- a/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre
+++ b/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre
@@ -1,5 +1,5 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man,v 3.2 1996/12/23 06:47:14 dawes Exp $
-.TH KBD_MODE 1 "Release 6.3 (XFree86 3.2)" "X Version 11"
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man,v 3.5 2001/01/27 18:20:56 dawes Exp $
+.TH KBD_MODE 1 __vendorversion__
.SH NAME
kbd_mode \- recover the PC console keyboard
.SH SYNOPSIS
@@ -33,4 +33,4 @@ reset it typing:
kbd_mode -u
.sp
-.\" $Xorg: kbd_mode.man,v 1.3 2000/08/17 19:51:10 cpqbld Exp $
+.\" $TOG: kbd_mode.man /main/6 1997/07/19 10:37:14 kaleb $
diff --git a/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c b/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c
index 294787354..6e81fd247 100644
--- a/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c
+++ b/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c
@@ -27,10 +27,11 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/hw/sun/kbd_mode.c,v 3.11 2002/10/23 16:23:36 tsi Exp $ */
-#ifndef lint
+/*
static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
-#endif
+ */
/*
* Copyright 1986 by Sun Microsystems, Inc.
@@ -41,7 +42,7 @@ static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
#include <sys/types.h>
#include <sys/file.h>
#include <sys/ioctl.h>
-#if defined(SVR4) || defined(__bsdi_)
+#if defined(SVR4) || defined(__bsdi__)
#include <fcntl.h>
#ifndef __bsdi__
#include <sys/kbio.h>
@@ -61,15 +62,18 @@ static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
#endif
#endif
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
static void die(), usage();
static int kbd_fd;
+int
main(argc, argv)
int argc;
char** argv;
{
- int code, translate, direct = -1;
+ int code = 0, translate, direct = -1;
char led;
int click;
diff --git a/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre b/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre
index 88c4a89b4..528ed12f0 100644
--- a/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre
+++ b/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre
@@ -23,7 +23,10 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
-.TH KBD_MODE 1 "Release 6.4" "X Version 11"
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/sun/kbd_mode.man,v 1.7 2001/12/14 19:59:42 dawes Exp $
+.\"
+.TH KBD_MODE 1 __xorgversion__
.SH NAME
kbd_mode \- recover the Sun console keyboard
.SH SYNOPSIS
diff --git a/hw/xfree86/utils/scanpci/scanpci.c b/hw/xfree86/utils/scanpci/scanpci.c
index f3a142fba..6093bd31a 100644
--- a/hw/xfree86/utils/scanpci/scanpci.c
+++ b/hw/xfree86/utils/scanpci/scanpci.c
@@ -1,30 +1,7 @@
-/* $Xorg: scanpci.c,v 1.3 2000/08/17 19:51:10 cpqbld Exp $ */
-/*
- * name: scanpci.c
- *
- * purpose: This program will scan for and print details of
- * devices on the PCI bus.
-
- * author: Robin Cutshaw (robin@xfree86.org)
- *
- * supported O/S's: SVR4, UnixWare, SCO, Solaris,
- * FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
- * Linux, Mach/386, ISC
- * DOS (WATCOM 9.5 compiler)
- *
- * compiling: [g]cc scanpci.c -o scanpci
- * for SVR4 (not Solaris), UnixWare use:
- * [g]cc -DSVR4 scanpci.c -o scanpci
- * for DOS, watcom 9.5:
- * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c
- * and link with PharLap or other dos extender for exe
- *
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.10 1998/02/27 17:13:22 robin Exp $ */
-
/*
+ * Copyright 2000 by Egbert Eich
* Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
+ * Copyright 2002 by David Dawes
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -46,1510 +23,505 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.92 2003/02/13 12:17:14 tsi Exp $ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSproc.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "xf86ScanPci.h"
+#include "dummylib.h"
+
+#include <stdarg.h>
+#include <stdlib.h>
+#ifdef __linux__
+/* to get getopt on Linux */
+#ifndef __USE_POSIX2
+#define __USE_POSIX2
+#endif
+#endif
+#include <unistd.h>
+
+#if defined(ISC) || defined(Lynx)
+extern char *optarg;
+extern int optind, opterr;
+#endif
+
+pciVideoPtr *xf86PciVideoInfo = NULL;
+
+static void usage(void);
+static void identify_card(pciConfigPtr pcr, int verbose);
+static void print_default_class(pciConfigPtr pcr);
+static void print_bridge_pci_class(pciConfigPtr pcr);
+static void print_mach64(pciConfigPtr pcr);
+static void print_i128(pciConfigPtr pcr);
+static void print_dc21050(pciConfigPtr pcr);
+static void print_simba(pciConfigPtr pcr);
+static void print_460gx_sac(pciConfigPtr pcr);
+static void print_460gx_pxb(pciConfigPtr pcr);
+static void print_460gx_gxb(pciConfigPtr pcr);
+
+#define MAX_DEV_PER_VENDOR 40
+
+typedef struct {
+ unsigned int Vendor;
+ struct {
+ int DeviceID;
+ void(*func)(pciConfigPtr);
+ } Device[MAX_DEV_PER_VENDOR];
+} pciVendorDevFuncInfo;
+
+static pciVendorDevFuncInfo vendorDeviceFuncInfo[] = {
+ { PCI_VENDOR_ATI, {
+ { PCI_CHIP_MACH64CT, print_mach64 },
+ { PCI_CHIP_MACH64CX, print_mach64 },
+ { PCI_CHIP_MACH64ET, print_mach64 },
+ { PCI_CHIP_MACH64GB, print_mach64 },
+ { PCI_CHIP_MACH64GD, print_mach64 },
+ { PCI_CHIP_MACH64GI, print_mach64 },
+ { PCI_CHIP_MACH64GL, print_mach64 },
+ { PCI_CHIP_MACH64GM, print_mach64 },
+ { PCI_CHIP_MACH64GN, print_mach64 },
+ { PCI_CHIP_MACH64GO, print_mach64 },
+ { PCI_CHIP_MACH64GP, print_mach64 },
+ { PCI_CHIP_MACH64GQ, print_mach64 },
+ { PCI_CHIP_MACH64GR, print_mach64 },
+ { PCI_CHIP_MACH64GS, print_mach64 },
+ { PCI_CHIP_MACH64GT, print_mach64 },
+ { PCI_CHIP_MACH64GU, print_mach64 },
+ { PCI_CHIP_MACH64GV, print_mach64 },
+ { PCI_CHIP_MACH64GW, print_mach64 },
+ { PCI_CHIP_MACH64GX, print_mach64 },
+ { PCI_CHIP_MACH64GY, print_mach64 },
+ { PCI_CHIP_MACH64GZ, print_mach64 },
+ { PCI_CHIP_MACH64LB, print_mach64 },
+ { PCI_CHIP_MACH64LD, print_mach64 },
+ { PCI_CHIP_MACH64LG, print_mach64 },
+ { PCI_CHIP_MACH64LI, print_mach64 },
+ { PCI_CHIP_MACH64LM, print_mach64 },
+ { PCI_CHIP_MACH64LN, print_mach64 },
+ { PCI_CHIP_MACH64LP, print_mach64 },
+ { PCI_CHIP_MACH64LQ, print_mach64 },
+ { PCI_CHIP_MACH64LR, print_mach64 },
+ { PCI_CHIP_MACH64LS, print_mach64 },
+ { PCI_CHIP_MACH64VT, print_mach64 },
+ { PCI_CHIP_MACH64VU, print_mach64 },
+ { PCI_CHIP_MACH64VV, print_mach64 },
+ { 0x0000, NULL } } },
+ { PCI_VENDOR_DIGITAL, {
+ { PCI_CHIP_DC21050, print_dc21050},
+ { 0x0000, NULL } } },
+ { PCI_VENDOR_NUMNINE, {
+ { PCI_CHIP_I128, print_i128 },
+ { PCI_CHIP_I128_2, print_i128 },
+ { PCI_CHIP_I128_T2R, print_i128 },
+ { PCI_CHIP_I128_T2R4, print_i128 },
+ { 0x0000, NULL } } },
+ { PCI_VENDOR_SUN, {
+ { PCI_CHIP_SIMBA, print_simba },
+ { 0x0000, NULL } } },
+ { PCI_VENDOR_INTEL, {
+ { PCI_CHIP_460GX_SAC, print_460gx_sac },
+ { PCI_CHIP_460GX_PXB, print_460gx_pxb },
+ { PCI_CHIP_460GX_GXB_1, print_460gx_gxb },
+ { PCI_CHIP_460GX_WXB, print_460gx_pxb }, /* Uncertain */
+ { 0x0000, NULL } } },
+ { 0x0000, {
+ { 0x0000, NULL } } }
+};
-#if defined(__SVR4)
-#if !defined(SVR4)
-#define SVR4
-#endif
-#endif
+static void
+usage(void)
+{
+ printf("Usage: scanpci [-v12OfV]\n");
+ printf(" -v print config space\n");
+ printf(" -1 config type 1\n");
+ printf(" -2 config type 2\n");
+ printf(" -O use OS config support\n");
+ printf(" -f force config type\n");
+ printf(" -V set message verbosity level\n");
+}
-#ifdef __EMX__
-#define INCL_DOSFILEMGR
-#include <os2.h>
-#endif
+int
+main(int argc, char *argv[])
+{
+ pciConfigPtr *pcrpp = NULL;
+ int Verbose = 0;
+ int i = 0;
+ int force = 0;
+ int c;
-#include <stdio.h>
-#include <sys/types.h>
-#if defined(SVR4)
-#if defined(sun)
-#define __EXTENSIONS__
-#endif
-#include <sys/proc.h>
-#include <sys/tss.h>
-#if defined(NCR)
-#define __STDC
-#include <sys/sysi86.h>
-#undef __STDC
-#else
-#include <sys/sysi86.h>
-#endif
-#if defined(__SUNPRO_C) || defined(sun) || defined(__sun)
-#include <sys/psw.h>
-#else
-#include <sys/seg.h>
-#endif
-#include <sys/v86.h>
-#endif
-#if defined(__FreeBSD__) || defined(__386BSD__)
-#include <sys/file.h>
-#include <machine/console.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-#endif
-#if defined(__NetBSD__)
-#include <sys/param.h>
-#include <sys/file.h>
-#include <machine/sysarch.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-#endif
-#if defined(__bsdi__)
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <i386/isa/pcconsioctl.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-#endif
-#if defined(SCO) || defined(ISC)
-#ifndef ISC
-#include <sys/console.h>
-#endif
-#include <sys/param.h>
-#include <sys/immu.h>
-#include <sys/region.h>
-#include <sys/proc.h>
-#include <sys/tss.h>
-#include <sys/sysi86.h>
-#include <sys/v86.h>
-#endif
-#if defined(Lynx_22)
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-#endif
+ xf86Info.pciFlags = PCIProbe1;
+ while ((c = getopt(argc, argv, "?v12OfV:")) != -1)
+ switch(c) {
+ case 'v':
+ Verbose = 1;
+ break;
+ case '1':
+ xf86Info.pciFlags = PCIProbe1;
+ break;
+ case '2':
+ xf86Info.pciFlags = PCIProbe2;
+ break;
+ case 'O':
+ xf86Info.pciFlags = PCIOsConfig;
+ break;
+ case 'f':
+ force = 1;
+ break;
+ case 'V':
+ xf86Verbose = atoi(optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ exit (1);
+ break;
+ }
-#if defined(__WATCOMC__)
+ if (force)
+ switch (xf86Info.pciFlags) {
+ case PCIProbe1:
+ xf86Info.pciFlags = PCIForceConfig1;
+ break;
+ case PCIProbe2:
+ xf86Info.pciFlags = PCIForceConfig2;
+ break;
+ default:
+ break;
+ }
-#include <stdlib.h>
-void outl(unsigned port, unsigned data);
-#pragma aux outl = "out dx, eax" parm [dx] [eax];
-void outb(unsigned port, unsigned data);
-#pragma aux outb = "out dx, al" parm [dx] [eax];
-unsigned inl(unsigned port);
-#pragma aux inl = "in eax, dx" parm [dx];
-unsigned inb(unsigned port);
-#pragma aux inb = "xor eax,eax" "in al, dx" parm [dx];
+ xf86EnableIO();
+ pcrpp = xf86scanpci(0);
-#else /* __WATCOMC__ */
+ if (!pcrpp) {
+ printf("No PCI devices found\n");
+ xf86DisableIO();
+ exit (1);
+ }
-#if defined(__GNUC__)
+ while (pcrpp[i])
+ identify_card(pcrpp[i++],Verbose);
-#if !defined(__alpha__) && !defined(__powerpc__)
-#if defined(GCCUSESGAS)
-#define OUTB_GCC "outb %0,%1"
-#define OUTL_GCC "outl %0,%1"
-#define INB_GCC "inb %1,%0"
-#define INL_GCC "inl %1,%0"
-#else
-#define OUTB_GCC "out%B0 (%1)"
-#define OUTL_GCC "out%L0 (%1)"
-#define INB_GCC "in%B0 (%1)"
-#define INL_GCC "in%L0 (%1)"
-#endif /* GCCUSESGAS */
+ xf86DisableIO();
+ exit(0);
+}
-static void outb(unsigned short port, unsigned char val) {
- __asm__ __volatile__(OUTB_GCC : :"a" (val), "d" (port)); }
-static void outl(unsigned short port, unsigned long val) {
- __asm__ __volatile__(OUTL_GCC : :"a" (val), "d" (port)); }
-static unsigned char inb(unsigned short port) { unsigned char ret;
- __asm__ __volatile__(INB_GCC : "=a" (ret) : "d" (port)); return ret; }
-static unsigned long inl(unsigned short port) { unsigned long ret;
- __asm__ __volatile__(INL_GCC : "=a" (ret) : "d" (port)); return ret; }
+static void
+identify_card(pciConfigPtr pcr, int verbose)
+{
+ int i, j;
+ int foundit = 0;
+ int foundvendor = 0;
+ const char *vname, *dname, *svname, *sname;
-#endif /* !defined(__alpha__) && !defined(__powerpc__) */
-#else /* __GNUC__ */
+ pciVendorDevFuncInfo *vdf = vendorDeviceFuncInfo;
-#if defined(__STDC__) && (__STDC__ == 1)
-# if !defined(NCR)
-# define asm __asm
-# endif
-#endif
+ if (!ScanPciSetupPciIds()) {
+ fprintf(stderr, "xf86SetupPciIds() failed\n");
+ exit(1);
+ }
-#if defined(__SUNPRO_C)
-/*
- * This section is a gross hack in if you tell anyone that I wrote it,
- * I'll deny it. :-)
- * The leave/ret instructions are the big hack to leave %eax alone on return.
- */
- unsigned char inb(int port) {
- asm(" movl 8(%esp),%edx");
- asm(" subl %eax,%eax");
- asm(" inb (%dx)");
- asm(" leave");
- asm(" ret");
- }
+ printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:"
+ " vendor 0x%04x device 0x%04x\n",
+ pcr->busnum, pcr->devnum, pcr->funcnum,
+ pcr->pci_vendor, pcr->pci_device);
- unsigned short inw(int port) {
- asm(" movl 8(%esp),%edx");
- asm(" subl %eax,%eax");
- asm(" inw (%dx)");
- asm(" leave");
- asm(" ret");
- }
+ ScanPciFindPciNamesByDevice(pcr->pci_vendor, pcr->pci_device,
+ pcr->pci_subsys_vendor, pcr->pci_subsys_card,
+ &vname, &dname, &svname, &sname);
- unsigned long inl(int port) {
- asm(" movl 8(%esp),%edx");
- asm(" inl (%dx)");
- asm(" leave");
- asm(" ret");
+ if (vname) {
+ printf(" %s ", vname);
+ if (dname) {
+ printf("%s", dname);
+ foundit = 1;
}
+ }
- void outb(int port, unsigned char value) {
- asm(" movl 8(%esp),%edx");
- asm(" movl 12(%esp),%eax");
- asm(" outb (%dx)");
+ if (!foundit)
+ printf(" Device unknown\n");
+ else {
+ printf("\n");
+ if (verbose) {
+ for (i = 0; vdf[i].Vendor; i++) {
+ if (vdf[i].Vendor == pcr->pci_vendor) {
+ for (j = 0; vdf[i].Device[j].DeviceID; j++) {
+ if (vdf[i].Device[j].DeviceID == pcr->pci_device) {
+ (*vdf[i].Device[j].func)(pcr);
+ return;
+ }
+ }
+ break;
+ }
+ }
}
+ }
- void outw(int port, unsigned short value) {
- asm(" movl 8(%esp),%edx");
- asm(" movl 12(%esp),%eax");
- asm(" outw (%dx)");
+ if (verbose && !(pcr->pci_header_type & 0x7f) &&
+ (pcr->pci_subsys_vendor != 0 || pcr->pci_subsys_card != 0) &&
+ (pcr->pci_vendor != pcr->pci_subsys_vendor ||
+ pcr->pci_device != pcr->pci_subsys_card)) {
+ foundit = 0;
+ foundvendor = 0;
+ printf(" CardVendor 0x%04x card 0x%04x",
+ pcr->pci_subsys_vendor, pcr->pci_subsys_card);
+ if (svname) {
+ printf(" (%s", svname);
+ foundvendor = 1;
+ if (sname) {
+ printf(" %s)", sname);
+ foundit = 1;
+ }
}
- void outl(int port, unsigned long value) {
- asm(" movl 8(%esp),%edx");
- asm(" movl 12(%esp),%eax");
- asm(" outl (%dx)");
+ if (!foundit) {
+ if (!foundvendor)
+ printf(" (");
+ else
+ printf(", ");
+ printf("Card unknown)");
}
-#else
-
-#if defined(SVR4)
-# if !defined(__USLC__)
-# define __USLC__
-# endif
-#endif
-
-#ifndef SCO325
-# include <sys/inline.h>
-#else
-# include "scoasm.h"
-#endif
-
-#endif /* SUNPRO_C */
-
-#endif /* __GNUC__ */
-#endif /* __WATCOMC__ */
-
-
-#if defined(__alpha__)
-#if defined(linux)
-#include <asm/unistd.h>
-#define BUS(tag) (((tag)>>16)&0xff)
-#define DFN(tag) (((tag)>>8)&0xff)
-int pciconfig_read(
- unsigned char bus,
- unsigned char dfn,
- unsigned char off,
- unsigned char len,
- void * buf)
-{
- return __syscall(__NR_pciconfig_read, bus, dfn, off, len, buf);
-}
-int pciconfig_write(
- unsigned char bus,
- unsigned char dfn,
- unsigned char off,
- unsigned char len,
- void * buf)
-{
- return __syscall(__NR_pciconfig_write, bus, dfn, off, len, buf);
-}
-#else
-Generate compiler error - scanpci unsupported on non-linux alpha platforms
-#endif /* linux */
-#endif /* __alpha__ */
-#if defined(Lynx) && defined(__powerpc__)
-/* let's mimick the Linux Alpha stuff for LynxOS so we don't have
- * to change too much code
- */
-#include <smem.h>
-
-unsigned char *pciConfBase;
+ printf("\n");
+ }
-static __inline__ unsigned long
-swapl(unsigned long val)
-{
- unsigned char *p = (unsigned char *)&val;
- return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0));
+ if (verbose) {
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+ if ((pcr->pci_base_class == PCI_CLASS_BRIDGE) &&
+ (pcr->pci_sub_class == PCI_SUBCLASS_BRIDGE_PCI))
+ print_bridge_pci_class(pcr);
+ else
+ print_default_class(pcr);
+ }
}
-
-#define BUS(tag) (((tag)>>16)&0xff)
-#define DFN(tag) (((tag)>>8)&0xff)
-
-#define PCIBIOS_DEVICE_NOT_FOUND 0x86
-#define PCIBIOS_SUCCESSFUL 0x00
-
-int pciconfig_read(
- unsigned char bus,
- unsigned char dev,
- unsigned char offset,
- int len, /* unused, alway 4 */
- unsigned long *val)
+static void
+print_default_class(pciConfigPtr pcr)
{
- unsigned long _val;
- unsigned long *ptr;
-
- dev >>= 3;
- if (bus || dev >= 16) {
- *val = 0xFFFFFFFF;
- return PCIBIOS_DEVICE_NOT_FOUND;
+ printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
+ pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer,
+ pcr->pci_cache_line_size);
+ if (pcr->pci_base0) {
+ if ((pcr->pci_base0 & 0x7) == 0x4) {
+ printf(" BASE0 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n",
+ (int)pcr->pci_base1, (int)pcr->pci_base0,
+ (int)pcr->pci_base1,
+ (int)(pcr->pci_base0 &
+ (pcr->pci_base0 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base0 & 0x8) ? " PREFETCHABLE" :"");
} else {
- ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));
- _val = swapl(*ptr);
+ printf(" BASE0 0x%08x addr 0x%08x %s%s\n",
+ (int)pcr->pci_base0,
+ (int)(pcr->pci_base0 &
+ (pcr->pci_base0 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base0 & 0x1) ? "I/O" : "MEM",
+ ((pcr->pci_base0 & 0x9) == 0x8) ? " PREFETCHABLE" :"");
}
- *val = _val;
- return PCIBIOS_SUCCESSFUL;
-}
-
-int pciconfig_write(
- unsigned char bus,
- unsigned char dev,
- unsigned char offset,
- int len, /* unused, alway 4 */
- unsigned long val)
-{
- unsigned long _val;
- unsigned long *ptr;
-
- dev >>= 3;
- _val = swapl(val);
- if (bus || dev >= 16) {
- return PCIBIOS_DEVICE_NOT_FOUND;
+ }
+ if ((pcr->pci_base1) && ((pcr->pci_base0 & 0x7) != 0x4)) {
+ if ((pcr->pci_base1 & 0x7) == 0x4) {
+ printf(" BASE1 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n",
+ (int)pcr->pci_base2, (int)pcr->pci_base1,
+ (int)pcr->pci_base2,
+ (int)(pcr->pci_base1 &
+ (pcr->pci_base1 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base1 & 0x8) ? " PREFETCHABLE" :"");
} else {
- ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));
- *ptr = _val;
+ printf(" BASE1 0x%08x addr 0x%08x %s%s\n",
+ (int)pcr->pci_base1,
+ (int)(pcr->pci_base1 &
+ (pcr->pci_base1 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base1 & 0x1) ? "I/O" : "MEM",
+ ((pcr->pci_base1 & 0x9) == 0x8) ? " PREFETCHABLE" :"");
}
- return PCIBIOS_SUCCESSFUL;
-}
-#endif
-
-#if !defined(__powerpc__)
-struct pci_config_reg {
- /* start of official PCI config space header */
- union {
- unsigned long device_vendor;
- struct {
- unsigned short vendor;
- unsigned short device;
- } dv;
- } dv_id;
-#define _device_vendor dv_id.device_vendor
-#define _vendor dv_id.dv.vendor
-#define _device dv_id.dv.device
- union {
- unsigned long status_command;
- struct {
- unsigned short command;
- unsigned short status;
- } sc;
- } stat_cmd;
-#define _status_command stat_cmd.status_command
-#define _command stat_cmd.sc.command
-#define _status stat_cmd.sc.status
- union {
- unsigned long class_revision;
- struct {
- unsigned char rev_id;
- unsigned char prog_if;
- unsigned char sub_class;
- unsigned char base_class;
- } cr;
- } class_rev;
-#define _class_revision class_rev.class_revision
-#define _rev_id class_rev.cr.rev_id
-#define _prog_if class_rev.cr.prog_if
-#define _sub_class class_rev.cr.sub_class
-#define _base_class class_rev.cr.base_class
- union {
- unsigned long bist_header_latency_cache;
- struct {
- unsigned char cache_line_size;
- unsigned char latency_timer;
- unsigned char header_type;
- unsigned char bist;
- } bhlc;
- } bhlc;
-#define _bist_header_latency_cache bhlc.bist_header_latency_cache
-#define _cache_line_size bhlc.bhlc.cache_line_size
-#define _latency_timer bhlc.bhlc.latency_timer
-#define _header_type bhlc.bhlc.header_type
-#define _bist bhlc.bhlc.bist
- union {
- struct {
- unsigned long dv_base0;
- unsigned long dv_base1;
- unsigned long dv_base2;
- unsigned long dv_base3;
- unsigned long dv_base4;
- unsigned long dv_base5;
- } dv;
- struct {
- unsigned long bg_rsrvd[2];
- unsigned char primary_bus_number;
- unsigned char secondary_bus_number;
- unsigned char subordinate_bus_number;
- unsigned char secondary_latency_timer;
- unsigned char io_base;
- unsigned char io_limit;
- unsigned short secondary_status;
- unsigned short mem_base;
- unsigned short mem_limit;
- unsigned short prefetch_mem_base;
- unsigned short prefetch_mem_limit;
- } bg;
- } bc;
-#define _base0 bc.dv.dv_base0
-#define _base1 bc.dv.dv_base1
-#define _base2 bc.dv.dv_base2
-#define _base3 bc.dv.dv_base3
-#define _base4 bc.dv.dv_base4
-#define _base5 bc.dv.dv_base5
-#define _primary_bus_number bc.bg.primary_bus_number
-#define _secondary_bus_number bc.bg.secondary_bus_number
-#define _subordinate_bus_number bc.bg.subordinate_bus_number
-#define _secondary_latency_timer bc.bg.secondary_latency_timer
-#define _io_base bc.bg.io_base
-#define _io_limit bc.bg.io_limit
-#define _secondary_status bc.bg.secondary_status
-#define _mem_base bc.bg.mem_base
-#define _mem_limit bc.bg.mem_limit
-#define _prefetch_mem_base bc.bg.prefetch_mem_base
-#define _prefetch_mem_limit bc.bg.prefetch_mem_limit
- unsigned long rsvd1;
- unsigned long rsvd2;
- unsigned long _baserom;
- unsigned long rsvd3;
- unsigned long rsvd4;
- union {
- unsigned long max_min_ipin_iline;
- struct {
- unsigned char int_line;
- unsigned char int_pin;
- unsigned char min_gnt;
- unsigned char max_lat;
- } mmii;
- } mmii;
-#define _max_min_ipin_iline mmii.max_min_ipin_iline
-#define _int_line mmii.mmii.int_line
-#define _int_pin mmii.mmii.int_pin
-#define _min_gnt mmii.mmii.min_gnt
-#define _max_lat mmii.mmii.max_lat
- /* I don't know how accurate or standard this is (DHD) */
- union {
- unsigned long user_config;
- struct {
- unsigned char user_config_0;
- unsigned char user_config_1;
- unsigned char user_config_2;
- unsigned char user_config_3;
- } uc;
- } uc;
-#define _user_config uc.user_config
-#define _user_config_0 uc.uc.user_config_0
-#define _user_config_1 uc.uc.user_config_1
-#define _user_config_2 uc.uc.user_config_2
-#define _user_config_3 uc.uc.user_config_3
- /* end of official PCI config space header */
- unsigned long _pcibusidx;
- unsigned long _pcinumbus;
- unsigned long _pcibuses[16];
- unsigned short _configtype; /* config type found */
- unsigned short _ioaddr; /* config type 1 - private I/O addr */
- unsigned long _cardnum; /* config type 2 - private card number */
-};
-#else
-/* ppc is big endian, swapping bytes is not quite enough
- * to interpret the PCI config registers...
- */
-struct pci_config_reg {
- /* start of official PCI config space header */
- union {
- unsigned long device_vendor;
- struct {
- unsigned short device;
- unsigned short vendor;
- } dv;
- } dv_id;
-#define _device_vendor dv_id.device_vendor
-#define _vendor dv_id.dv.vendor
-#define _device dv_id.dv.device
- union {
- unsigned long status_command;
- struct {
- unsigned short status;
- unsigned short command;
- } sc;
- } stat_cmd;
-#define _status_command stat_cmd.status_command
-#define _command stat_cmd.sc.command
-#define _status stat_cmd.sc.status
- union {
- unsigned long class_revision;
- struct {
- unsigned char base_class;
- unsigned char sub_class;
- unsigned char prog_if;
- unsigned char rev_id;
- } cr;
- } class_rev;
-#define _class_revision class_rev.class_revision
-#define _rev_id class_rev.cr.rev_id
-#define _prog_if class_rev.cr.prog_if
-#define _sub_class class_rev.cr.sub_class
-#define _base_class class_rev.cr.base_class
- union {
- unsigned long bist_header_latency_cache;
- struct {
- unsigned char bist;
- unsigned char header_type;
- unsigned char latency_timer;
- unsigned char cache_line_size;
- } bhlc;
- } bhlc;
-#define _bist_header_latency_cache bhlc.bist_header_latency_cache
-#define _cache_line_size bhlc.bhlc.cache_line_size
-#define _latency_timer bhlc.bhlc.latency_timer
-#define _header_type bhlc.bhlc.header_type
-#define _bist bhlc.bhlc.bist
- union {
- struct {
- unsigned long dv_base0;
- unsigned long dv_base1;
- unsigned long dv_base2;
- unsigned long dv_base3;
- unsigned long dv_base4;
- unsigned long dv_base5;
- } dv;
-/* ?? */
- struct {
- unsigned long bg_rsrvd[2];
-
- unsigned char secondary_latency_timer;
- unsigned char subordinate_bus_number;
- unsigned char secondary_bus_number;
- unsigned char primary_bus_number;
-
- unsigned short secondary_status;
- unsigned char io_limit;
- unsigned char io_base;
-
- unsigned short mem_limit;
- unsigned short mem_base;
-
- unsigned short prefetch_mem_limit;
- unsigned short prefetch_mem_base;
- } bg;
- } bc;
-#define _base0 bc.dv.dv_base0
-#define _base1 bc.dv.dv_base1
-#define _base2 bc.dv.dv_base2
-#define _base3 bc.dv.dv_base3
-#define _base4 bc.dv.dv_base4
-#define _base5 bc.dv.dv_base5
-#define _primary_bus_number bc.bg.primary_bus_number
-#define _secondary_bus_number bc.bg.secondary_bus_number
-#define _subordinate_bus_number bc.bg.subordinate_bus_number
-#define _secondary_latency_timer bc.bg.secondary_latency_timer
-#define _io_base bc.bg.io_base
-#define _io_limit bc.bg.io_limit
-#define _secondary_status bc.bg.secondary_status
-#define _mem_base bc.bg.mem_base
-#define _mem_limit bc.bg.mem_limit
-#define _prefetch_mem_base bc.bg.prefetch_mem_base
-#define _prefetch_mem_limit bc.bg.prefetch_mem_limit
- unsigned long rsvd1;
- unsigned long rsvd2;
- unsigned long _baserom;
- unsigned long rsvd3;
- unsigned long rsvd4;
- union {
- unsigned long max_min_ipin_iline;
- struct {
- unsigned char max_lat;
- unsigned char min_gnt;
- unsigned char int_pin;
- unsigned char int_line;
- } mmii;
- } mmii;
-#define _max_min_ipin_iline mmii.max_min_ipin_iline
-#define _int_line mmii.mmii.int_line
-#define _int_pin mmii.mmii.int_pin
-#define _min_gnt mmii.mmii.min_gnt
-#define _max_lat mmii.mmii.max_lat
- /* I don't know how accurate or standard this is (DHD) */
- union {
- unsigned long user_config;
- struct {
- unsigned char user_config_3;
- unsigned char user_config_2;
- unsigned char user_config_1;
- unsigned char user_config_0;
- } uc;
- } uc;
-#define _user_config uc.user_config
-#define _user_config_0 uc.uc.user_config_0
-#define _user_config_1 uc.uc.user_config_1
-#define _user_config_2 uc.uc.user_config_2
-#define _user_config_3 uc.uc.user_config_3
- /* end of official PCI config space header */
- unsigned long _pcibusidx;
- unsigned long _pcinumbus;
- unsigned long _pcibuses[16];
- unsigned short _ioaddr; /* config type 1 - private I/O addr */
- unsigned short _configtype; /* config type found */
- unsigned long _cardnum; /* config type 2 - private card number */
-};
-#endif
-
-extern void identify_card(struct pci_config_reg *, int);
-extern void print_i128(struct pci_config_reg *);
-extern void print_mach64(struct pci_config_reg *);
-extern void print_pcibridge(struct pci_config_reg *);
-extern void enable_os_io();
-extern void disable_os_io();
-
-#define MAX_DEV_PER_VENDOR_CFG1 32
-#define MAX_DEV_PER_VENDOR_CFG2 16
-#define MAX_PCI_DEVICES 64
-#define NF ((void (*)())NULL)
-#define PCI_MULTIFUNC_DEV 0x80
-#if defined(__alpha__) || defined(__powerpc__)
-#define PCI_ID_REG 0x00
-#define PCI_CMD_STAT_REG 0x04
-#define PCI_CLASS_REG 0x08
-#define PCI_HEADER_MISC 0x0C
-#define PCI_MAP_REG_START 0x10
-#define PCI_MAP_ROM_REG 0x30
-#define PCI_INTERRUPT_REG 0x3C
-#define PCI_REG_USERCONFIG 0x40
-#endif
-
-struct pci_vendor_device {
- unsigned short vendor_id;
- char *vendorname;
- struct pci_device {
- unsigned short device_id;
- char *devicename;
- void (*print_func)(struct pci_config_reg *);
- } device[MAX_DEV_PER_VENDOR_CFG1];
-} pvd[] = {
- { 0x0e11, "Compaq", {
- { 0x3033, "QVision 1280/p", NF },
- { 0xae10, "Smart-2/P RAID Controller", NF },
- { 0xae32, "Netellignet 10/100", NF },
- { 0xae34, "Netellignet 10", NF },
- { 0xae35, "NetFlex 3", NF },
- { 0xae40, "Netellignet 10/100 Dual", NF },
- { 0xae43, "Netellignet 10/100 ProLiant", NF },
- { 0xb011, "Netellignet 10/100 Integrated", NF },
- { 0xf130, "ThunderLAN", NF },
- { 0xf150, "NetFlex 3 BNC", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1000, "NCR", {
- { 0x0001, "53C810", NF },
- { 0x0002, "53C820", NF },
- { 0x0003, "53C825", NF },
- { 0x0004, "53C815", NF },
- { 0x0005, "53C810AP", NF },
- { 0x0006, "53C860", NF },
- { 0x000B, "53C896", NF },
- { 0x000C, "53C895", NF },
- { 0x000D, "53C885", NF },
- { 0x000F, "53C875", NF },
- { 0x008F, "53C875J", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1002, "ATI", {
- { 0x4158, "Mach32", NF },
- { 0x4354, "Mach64 CT", print_mach64 },
- { 0x4358, "Mach64 CX", print_mach64 },
- { 0x4554, "Mach64 ET", print_mach64 },
- { 0x4742, "Mach64 GB", print_mach64 },
- { 0x4744, "Mach64 GD", print_mach64 },
- { 0x4750, "Mach64 GP", print_mach64 },
- { 0x4754, "Mach64 GT", print_mach64 },
- { 0x4755, "Mach64 GT", print_mach64 },
- { 0x4758, "Mach64 GX", print_mach64 },
- { 0x4C47, "Mach64 LT", print_mach64 },
- { 0x5654, "Mach64 VT", print_mach64 },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1004, "VLSI", {
- { 0x0005, "82C592-FC1", NF },
- { 0x0006, "82C593-FC1", NF },
- { 0x0007, "82C594-AFC2", NF },
- { 0x0009, "82C597-AFC2", NF },
- { 0x000C, "82C541 Lynx", NF },
- { 0x000D, "82C543 Lynx ISA", NF },
- { 0x0702, "VAS96011", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1005, "Avance Logic", {
- { 0x2301, "ALG2301", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x100B, "NS", {
- { 0x0002, "87415", NF },
- { 0xD001, "87410", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x100C, "Tseng Labs", {
- { 0x3202, "ET4000w32p rev A", NF },
- { 0x3205, "ET4000w32p rev B", NF },
- { 0x3206, "ET4000w32p rev D", NF },
- { 0x3207, "ET4000w32p rev C", NF },
- { 0x3208, "ET6000/6100", NF },
- { 0x4702, "ET6300", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x100E, "Weitek", {
- { 0x9001, "P9000", NF },
- { 0x9100, "P9100", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1011, "Digital Equipment Corporation", {
- { 0x0001, "DC21050 PCI-PCI Bridge",print_pcibridge},
- { 0x0002, "DC21040 10Mb/s Ethernet", NF },
- { 0x0004, "TGA", NF },
- { 0x0009, "DC21140 10/100 Mb/s Ethernet", NF },
- { 0x000D, "TGA2", NF },
- { 0x000F, "DEFPA (FDDI PCI)", NF },
- { 0x0014, "DC21041 10Mb/s Ethernet Plus", NF },
- { 0x0019, "DC21142 10/100 Mb/s Ethernet", NF },
- { 0x0021, "DC21052", NF },
- { 0x0024, "DC21152", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1013, "Cirrus Logic", {
- { 0x0038, "GD 7548", NF },
- { 0x00A0, "GD 5430", NF },
- { 0x00A4, "GD 5434-4", NF },
- { 0x00A8, "GD 5434-8", NF },
- { 0x00AC, "GD 5436", NF },
- { 0x00B8, "GD 5446", NF },
- { 0x00BC, "GD 5480", NF },
- { 0x00D0, "GD 5462", NF },
- { 0x00D4, "GD 5464", NF },
- { 0x1100, "CL 6729", NF },
- { 0x1110, "CL 6832", NF },
- { 0x1200, "GD 7542", NF },
- { 0x1202, "GD 7543", NF },
- { 0x1204, "GD 7541", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1014, "IBM", {
- { 0x000A, "Fire Coral", NF },
- { 0x0018, "Token Ring", NF },
- { 0x001D, "82G2675", NF },
- { 0x0022, "82351 pci-pci bridge", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x101A, "NCR", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x101C, "WD*", {
- { 0x3296, "WD 7197", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1022, "AMD", {
- { 0x2000, "79C970 Lance", NF },
- { 0x2020, "53C974 SCSI", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1023, "Trident", {
- { 0x9320, "TGUI 9320", NF },
- { 0x9420, "TGUI 9420", NF },
- { 0x9440, "TGUI 9440", NF },
- { 0x9660, "TGUI 9660/9680/9682", NF },
-#if 0
- { 0x9680, "TGUI 9680", NF },
- { 0x9682, "TGUI 9682", NF },
-#endif
- { 0x9750, "TGUI 9750", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1025, "ALI", {
- { 0x1435, "M1435", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x102B, "Matrox", {
- { 0x0518, "MGA-2 Atlas PX2085", NF },
- { 0x0519, "MGA Millennium", NF },
- { 0x051a, "MGA Mystique", NF },
- { 0x051b, "MGA Millennium II", NF },
- { 0x0D10, "MGA Impression", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x102C, "CT", {
- { 0x00D8, "65545", NF },
- { 0x00DC, "65548", NF },
- { 0x00E0, "65550", NF },
- { 0x00E4, "65554", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1031, "Miro", {
- { 0x5601, "ZR36050", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1033, "NEC", {
- { 0x0046, "PowerVR PCX2", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1036, "FD", {
- { 0x0000, "TMC-18C30 (36C70)", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1039, "SIS", {
- { 0x0001, "86C201", NF },
- { 0x0002, "86C202", NF },
- { 0x0008, "85C503", NF },
- { 0x0205, "86C205", NF },
- { 0x0406, "85C501", NF },
- { 0x0496, "85C496", NF },
- { 0x0601, "85C601", NF },
- { 0x5107, "5107", NF },
- { 0x5511, "85C5511", NF },
- { 0x5513, "85C5513", NF },
- { 0x5571, "5571", NF },
- { 0x5597, "5597", NF },
- { 0x7001, "7001", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x103C, "HP", {
- { 0x1030, "J2585A", NF },
- { 0x1031, "J2585B", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1042, "SMC/PCTECH", {
- { 0x1000, "FDC 37C665/RZ1000", NF },
- { 0x1001, "FDC /RZ1001", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1044, "DPT", {
- { 0xA400, "SmartCache/Raid", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1045, "Opti", {
- { 0xC178, "92C178", NF },
- { 0xC557, "82C557 Viper-M", NF },
- { 0xC558, "82C558 Viper-M ISA+IDE", NF },
- { 0xC621, "82C621", NF },
- { 0xC700, "82C700", NF },
- { 0xC701, "82C701 FireStar Plus", NF },
- { 0xC814, "82C814 Firebridge 1", NF },
- { 0xC822, "82C822", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x104A, "SGS Thomson", {
- { 0x0008, "STG2000", NF },
- { 0x0009, "STG1764", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x104B, "BusLogic", {
- { 0x0140, "946C 01", NF },
- { 0x1040, "946C 10", NF },
- { 0x8130, "FlashPoint", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x104C, "Texas Instruments", {
- { 0x3d04, "3DLabs Permedia", NF },
- { 0x3d07, "3DLabs Permedia 2", NF },
- { 0xAC12, "PCI1130", NF },
- { 0xAC15, "PCI1131", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x104E, "Oak", {
- { 0x0107, "OTI107", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1050, "Windbond", {
- { 0x0940, "89C940 NE2000-PCI", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1057, "Motorola", {
- { 0x0001, "MPC105 Eagle", NF },
- { 0x0002, "MPC105 Grackle", NF },
- { 0x4801, "Raven", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x105A, "Promise", {
- { 0x4D33, "IDE UltraDMA/33", NF },
- { 0x5300, "DC5030", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x105D, "Number Nine", {
- { 0x2309, "Imagine-128", print_i128 },
- { 0x2339, "Imagine-128-II", print_i128 },
- { 0x493D, "Imagine-128-T2R", print_i128 },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1060, "UMC", {
- { 0x0101, "UM8673F", NF },
- { 0x673A, "UM8886BF", NF },
- { 0x886A, "UM8886A", NF },
- { 0x8881, "UM8881F", NF },
- { 0x8886, "UM8886F", NF },
- { 0x8891, "UM8891A", NF },
- { 0x9017, "UM9017F", NF },
- { 0xE886, "UM8886N", NF },
- { 0xE891, "UM8891N", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1061, "X", {
- { 0x0001, "ITT AGX016", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1066, "PICOP", {
- { 0x0001, "PT86C52x Vesuvius", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x106B, "Apple", {
- { 0x0001, "Bandit", NF },
- { 0x0002, "Grand Central", NF },
- { 0x000E, "Hydra", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1074, "Nexgen", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x1077, "QLogic", {
- { 0x1020, "ISP1020", NF },
- { 0x1022, "ISP1022", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1078, "Cyrix", {
- { 0x0000, "5510", NF },
- { 0x0001, "PCI Master", NF },
- { 0x0002, "5520", NF },
- { 0x0100, "5530 Kahlua Legacy", NF },
- { 0x0101, "5530 Kahlua SMI", NF },
- { 0x0102, "5530 Kahlua IDE", NF },
- { 0x0103, "5530 Kahlua Audio", NF },
- { 0x0104, "5530 Kahlua Video", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x107D, "Leadtek", {
- { 0x0000, "S3 805", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1080, "Contaq", {
- { 0x0600, "82C599", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1083, "FOREX", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x108D, "Olicom", {
- { 0x0001, "OC-3136", NF },
- { 0x0011, "OC-2315", NF },
- { 0x0012, "OC-2325", NF },
- { 0x0013, "OC-2183", NF },
- { 0x0014, "OC-2326", NF },
- { 0x0021, "OC-6151", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x108E, "Sun", {
- { 0x1000, "EBUS", NF },
- { 0x1001, "Happy Meal", NF },
- { 0x8000, "PCI Bus Module", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1095, "CMD", {
- { 0x0640, "640A", NF },
- { 0x0643, "643", NF },
- { 0x0646, "646", NF },
- { 0x0670, "670", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1098, "Vision", {
- { 0x0001, "QD 8500", NF },
- { 0x0002, "QD 8580", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x109E, "Brooktree", {
- { 0x0350, "Bt848", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10A8, "Sierra", {
- { 0x0000, "STB Horizon 64", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10AA, "ACC", {
- { 0x0000, "2056", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10AD, "Winbond", {
- { 0x0001, "W83769F", NF },
- { 0x0105, "SL82C105", NF },
- { 0x0565, "W83C553", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10B3, "Databook", {
- { 0xB106, "DB87144", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10B7, "3COM", {
- { 0x5900, "3C590 10bT", NF },
- { 0x5950, "3C595 100bTX", NF },
- { 0x5951, "3C595 100bT4", NF },
- { 0x5952, "3C595 10b-MII", NF },
- { 0x9000, "3C900 10bTPO", NF },
- { 0x9001, "3C900 10b Combo", NF },
- { 0x9050, "3C905 100bTX", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10B8, "SMC", {
- { 0x0005, "9432 TX", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10B9, "ALI", {
- { 0x1445, "M1445", NF },
- { 0x1449, "M1449", NF },
- { 0x1451, "M1451", NF },
- { 0x1461, "M1461", NF },
- { 0x1489, "M1489", NF },
- { 0x1511, "M1511", NF },
- { 0x1513, "M1513", NF },
- { 0x1521, "M1521", NF },
- { 0x1523, "M1523", NF },
- { 0x1531, "M1531 Aladdin IV", NF },
- { 0x1533, "M1533 Aladdin IV", NF },
- { 0x5215, "M4803", NF },
- { 0x5219, "M5219", NF },
- { 0x5229, "M5229 TXpro", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10BA, "Mitsubishi", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x10BD, "Surecom", {
- { 0x0E34, "NE-34PCI Lan", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10C8, "Neomagic", {
- { 0x0001, "Magicgraph NM2070", NF },
- { 0x0002, "Magicgraph 128V", NF },
- { 0x0003, "Magicgraph 128ZV", NF },
- { 0x0004, "Magicgraph NM2160", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10CD, "Advanced System Products", {
- { 0x1200, "ABP940", NF },
- { 0x1300, "ABP940U", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10DC, "CERN", {
- { 0x0001, "STAR/RD24 SCI-PCI (PMC)", NF },
- { 0x0002, "STAR/RD24 SCI-PCI (PMC)", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10DE, "NVidia", {
- { 0x0008, "NV1", NF },
- { 0x0009, "DAC64", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10E0, "IMS", {
- { 0x8849, "8849", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10E1, "Tekram", {
- { 0x690C, "DC690C", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10E3, "Tundra", {
- { 0x0000, "CA91C042 Universe", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10E8, "AMCC", {
- { 0x8043, "Myrinet PCI (M2-PCI-32)", NF },
- { 0x807D, "S5933 PCI44", NF },
- { 0x809C, "S5933 Traquair HEPC3", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10EA, "Intergraphics", {
- { 0x1680, "IGA-1680", NF },
- { 0x1682, "IGA-1682", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10EC, "Realtek", {
- { 0x8029, "8029", NF },
- { 0x8129, "8129", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x10FA, "Truevision", {
- { 0x000C, "Targa 1000", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1101, "Initio Corp", {
- { 0x9100, "320 P", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1106, "VIA", {
- { 0x0505, "VT 82C505", NF },
- { 0x0561, "VT 82C505", NF },
- { 0x0576, "VT 82C576 3V", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1119, "Vortex", {
- { 0x0001, "GDT 6000b", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x111A, "EF", {
- { 0x0000, "155P-MF1", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1127, "Fore Systems", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x112F, "Imaging Technology", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x113C, "PLX", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x1142, "Alliance", {
- { 0x3210, "ProMotion 6410", NF },
- { 0x6422, "ProMotion 6422", NF },
- { 0x6424, "ProMotion AT24", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x114A, "VMIC", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x114F, "DIGI*", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x1159, "Mutech", {
- { 0x0001, "MV1000", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1163, "Rendition", {
- { 0x0001, "V1000", NF },
- { 0x2000, "V2100", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1179, "Toshiba", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x1193, "Zeinet", {
- { 0x0001, "1221", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x11CB, "Specialix", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x11FE, "Control", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x120E, "Cyclades", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x121A, "3Dfx Interactive", {
- { 0x0001, "Voodoo Graphics", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1236, "Sigma Designs", {
- { 0x6401, "REALmagic64/GX (SD 6425)", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1281, "YOKOGAWA", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x1292, "TriTech Microelectronics", {
- { 0xfc02, "Pyramid3D TR25202", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x12D2, "NVidia/SGS-Thomson", {
- { 0x0018, "Riva128", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1C1C, "Symphony", {
- { 0x0001, "82C101", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x1DE1, "Tekram", {
- { 0xDC29, "DC290", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x3D3D, "3Dlabs", {
- { 0x0001, "GLINT 300SX", NF },
- { 0x0002, "GLINT 500TX", NF },
- { 0x0003, "GLINT Delta", NF },
- { 0x0004, "GLINT Permedia", NF },
- { 0x0006, "GLINT MX", NF },
- { 0x0007, "GLINT Permedia 2", NF },
- { 0x0000, (char *)NULL, NF } } } ,
- { 0x4005, "Avance", {
- { 0x0000, (char *)NULL, NF } } },
- { 0x5333, "S3", {
- { 0x0551, "Plato/PX", NF },
- { 0x5631, "ViRGE", NF },
- { 0x8811, "Trio32/64", NF },
- { 0x8812, "Aurora64V+", NF },
- { 0x8814, "Trio64UV+", NF },
- { 0x883D, "ViRGE/VX", NF },
- { 0x8880, "868", NF },
- { 0x88B0, "928", NF },
- { 0x88C0, "864-0", NF },
- { 0x88C1, "864-1", NF },
- { 0x88D0, "964-0", NF },
- { 0x88D1, "964-1", NF },
- { 0x88F0, "968", NF },
- { 0x8901, "Trio64V2/DX or /GX", NF },
- { 0x8902, "PLATO/PX", NF },
- { 0x8A01, "ViRGE/DX or /GX", NF },
- { 0x8A10, "ViRGE/GX2", NF },
- { 0x8C01, "ViRGE/MX", NF },
- { 0x8C02, "ViRGE/MX+", NF },
- { 0x8C03, "ViRGE/MX+MV", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x8086, "Intel", {
- { 0x0482, "82375EB pci-eisa bridge", NF },
- { 0x0483, "82424ZX cache dram controller", NF },
- { 0x0484, "82378IB/ZB pci-isa bridge", NF },
- { 0x0486, "82430ZX Aries", NF },
- { 0x04A3, "82434LX/NX pci cache mem controller", NF },
- { 0x1230, "82371 bus-master IDE controller", NF },
- { 0x1223, "SAA7116", NF },
- { 0x1229, "82557 10/100MBit network controller",NF},
- { 0x122D, "82437 Triton", NF },
- { 0x122E, "82471 Triton", NF },
- { 0x1230, "82438", NF },
- { 0x1250, "82439", NF },
- { 0x7000, "82371 pci-isa bridge", NF },
- { 0x7010, "82371 bus-master IDE controller", NF },
- { 0x7100, "82439 TX", NF },
- { 0x7110, "82371AB PIIX4 ISA", NF },
- { 0x7111, "82371AB PIIX4 IDE", NF },
- { 0x7112, "82371AB PIIX4 USB", NF },
- { 0x7113, "82371AB PIIX4 ACPI", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x9004, "Adaptec", {
- { 0x5078, "7850", NF },
- { 0x5578, "7855", NF },
- { 0x6078, "7860", NF },
- { 0x7078, "294x", NF },
- { 0x7178, "2940", NF },
- { 0x7278, "7872", NF },
- { 0x7478, "2944", NF },
- { 0x8178, "2940U", NF },
- { 0x8278, "3940U", NF },
- { 0x8478, "2944U", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x907F, "Atronics", {
- { 0x2015, "IDE-2015PL", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0xEDD8, "ARK Logic", {
- { 0xA091, "1000PV", NF },
- { 0xA099, "2000PV", NF },
- { 0xA0A1, "2000MT", NF },
- { 0xA0A9, "2000MI", NF },
- { 0x0000, (char *)NULL, NF } } },
- { 0x0000, (char *)NULL, {
- { 0x0000, (char *)NULL, NF } } }
-};
-
-#if defined(__alpha__)
-#define PCI_EN 0x00000000
-#else
-#define PCI_EN 0x80000000
-#endif
-
-#define PCI_MODE1_ADDRESS_REG 0xCF8
-#define PCI_MODE1_DATA_REG 0xCFC
-
-#define PCI_MODE2_ENABLE_REG 0xCF8
-#ifdef PC98
-#define PCI_MODE2_FORWARD_REG 0xCF9
-#else
-#define PCI_MODE2_FORWARD_REG 0xCFA
-#endif
-
-
-main(int argc, unsigned char *argv[])
-{
- unsigned long tmplong1, tmplong2, config_cmd;
- unsigned char tmp1, tmp2;
- unsigned int idx;
- struct pci_config_reg pcr;
- int ch, verbose = 0, do_mode1_scan = 0, do_mode2_scan = 0;
- int func;
-
- while((ch = getopt(argc, argv, "v12")) != EOF) {
- switch((char)ch) {
- case '1':
- do_mode1_scan = 1;
- break;
- case '2':
- do_mode2_scan = 1;
- break;
- case 'v':
- verbose = 1;
- break;
- default :
- printf("Usage: %s [-v12] \n", argv[0]);
- exit(1);
- }
}
-#if !defined(MSDOS)
- if (getuid()) {
- printf("This program must be run as root\n");
- exit(1);
- }
-#endif
-
- enable_os_io();
-
-#if !defined(__alpha__) && !defined(__powerpc__)
- pcr._configtype = 0;
-
- outb(PCI_MODE2_ENABLE_REG, 0x00);
- outb(PCI_MODE2_FORWARD_REG, 0x00);
- tmp1 = inb(PCI_MODE2_ENABLE_REG);
- tmp2 = inb(PCI_MODE2_FORWARD_REG);
- if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
- pcr._configtype = 2;
- printf("PCI says configuration type 2\n");
- } else {
- tmplong1 = inl(PCI_MODE1_ADDRESS_REG);
- outl(PCI_MODE1_ADDRESS_REG, PCI_EN);
- tmplong2 = inl(PCI_MODE1_ADDRESS_REG);
- outl(PCI_MODE1_ADDRESS_REG, tmplong1);
- if (tmplong2 == PCI_EN) {
- pcr._configtype = 1;
- printf("PCI says configuration type 1\n");
+ if ((pcr->pci_base2) && ((pcr->pci_base1 & 0x7) != 0x4)) {
+ if ((pcr->pci_base2 & 0x7) == 0x4) {
+ printf(" BASE2 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n",
+ (int)pcr->pci_base3, (int)pcr->pci_base2,
+ (int)pcr->pci_base3,
+ (int)(pcr->pci_base2 &
+ (pcr->pci_base2 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base2 & 0x8) ? " PREFETCHABLE" :"");
} else {
- printf("No PCI !\n");
- disable_os_io();
- exit(1);
+ printf(" BASE2 0x%08x addr 0x%08x %s%s\n",
+ (int)pcr->pci_base2,
+ (int)(pcr->pci_base2 &
+ (pcr->pci_base2 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base2 & 0x1) ? "I/O" : "MEM",
+ ((pcr->pci_base2 & 0x9) == 0x8) ? " PREFETCHABLE" :"");
}
}
-#else
- pcr._configtype = 1;
-#endif
-
- /* Try pci config 1 probe first */
-
- if ((pcr._configtype == 1) || do_mode1_scan) {
- printf("\nPCI probing configuration type 1\n");
-
- pcr._ioaddr = 0xFFFF;
-
- pcr._pcibuses[0] = 0;
- pcr._pcinumbus = 1;
- pcr._pcibusidx = 0;
- idx = 0;
-
- do {
- printf("Probing for devices on PCI bus %d:\n\n", pcr._pcibusidx);
-
- for (pcr._cardnum = 0x0; pcr._cardnum < MAX_DEV_PER_VENDOR_CFG1;
- pcr._cardnum += 0x1) {
- func = 0;
- do { /* loop over the different functions, if present */
-#if !defined(__alpha__) && !defined(__powerpc__)
- config_cmd = PCI_EN | (pcr._pcibuses[pcr._pcibusidx]<<16) |
- (pcr._cardnum<<11) | (func<<8);
-
- outl(PCI_MODE1_ADDRESS_REG, config_cmd); /* ioreg 0 */
- pcr._device_vendor = inl(PCI_MODE1_DATA_REG);
-#else
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_ID_REG, 4, &pcr._device_vendor);
-#endif
-
- if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF))
- break; /* nothing there */
-
- printf("\npci bus 0x%x cardnum 0x%02x function 0x%04x: vendor 0x%04x device 0x%04x\n",
- pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, func,
- pcr._vendor, pcr._device);
-
-#if !defined(__alpha__) && !defined(__powerpc__)
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x04);
- pcr._status_command = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x08);
- pcr._class_revision = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x0C);
- pcr._bist_header_latency_cache = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x10);
- pcr._base0 = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x14);
- pcr._base1 = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x18);
- pcr._base2 = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x1C);
- pcr._base3 = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x20);
- pcr._base4 = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x24);
- pcr._base5 = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x30);
- pcr._baserom = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x3C);
- pcr._max_min_ipin_iline = inl(PCI_MODE1_DATA_REG);
- outl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x40);
- pcr._user_config = inl(PCI_MODE1_DATA_REG);
-#else
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_CMD_STAT_REG, 4, &pcr._status_command);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_CLASS_REG, 4, &pcr._class_revision);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_HEADER_MISC, 4, &pcr._bist_header_latency_cache);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_REG_START, 4, &pcr._base0);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_REG_START + 0x04, 4, &pcr._base1);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_REG_START + 0x08, 4, &pcr._base2);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_REG_START + 0x0C, 4, &pcr._base3);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_REG_START + 0x10, 4, &pcr._base4);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_REG_START + 0x14, 4, &pcr._base5);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_MAP_ROM_REG, 4, &pcr._baserom);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_INTERRUPT_REG, 4, &pcr._max_min_ipin_iline);
- pciconfig_read(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum<<3,
- PCI_REG_USERCONFIG, 4, &pcr._user_config);
-#endif
-
- /* check for pci-pci bridges */
-#define PCI_CLASS_MASK 0xff000000
-#define PCI_SUBCLASS_MASK 0x00ff0000
-#define PCI_CLASS_BRIDGE 0x06000000
-#define PCI_SUBCLASS_BRIDGE_PCI 0x00040000
- switch(pcr._class_revision & (PCI_CLASS_MASK|PCI_SUBCLASS_MASK)) {
- case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_PCI:
- if (pcr._secondary_bus_number > 0) {
- pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number;
- }
- break;
- default:
- break;
- }
- if((func==0) && ((pcr._header_type & PCI_MULTIFUNC_DEV) == 0)) {
- /* not a multi function device */
- func = 8;
- } else {
- func++;
- }
-
- if (idx++ >= MAX_PCI_DEVICES)
- continue;
-
- identify_card(&pcr, verbose);
- } while( func < 8 );
- }
- } while (++pcr._pcibusidx < pcr._pcinumbus);
+ if ((pcr->pci_base3) && ((pcr->pci_base2 & 0x7) != 0x4)) {
+ if ((pcr->pci_base3 & 0x7) == 0x4) {
+ printf(" BASE3 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n",
+ (int)pcr->pci_base4, (int)pcr->pci_base3,
+ (int)pcr->pci_base4,
+ (int)(pcr->pci_base3 &
+ (pcr->pci_base3 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base3 & 0x8) ? " PREFETCHABLE" :"");
+ } else {
+ printf(" BASE3 0x%08x addr 0x%08x %s%s\n",
+ (int)pcr->pci_base3,
+ (int)(pcr->pci_base3 &
+ (pcr->pci_base3 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base3 & 0x1) ? "I/O" : "MEM",
+ ((pcr->pci_base3 & 0x9) == 0x8) ? " PREFETCHABLE" :"");
+ }
}
-
-#if !defined(__alpha__) && !defined(__powerpc__)
- /* Now try pci config 2 probe (deprecated) */
-
- if ((pcr._configtype == 2) || do_mode2_scan) {
- outb(PCI_MODE2_ENABLE_REG, 0xF1);
- outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
-
- printf("\nPCI probing configuration type 2\n");
-
- pcr._pcibuses[0] = 0;
- pcr._pcinumbus = 1;
- pcr._pcibusidx = 0;
- idx = 0;
-
- do {
- for (pcr._ioaddr = 0xC000; pcr._ioaddr < 0xD000; pcr._ioaddr += 0x0100){
- outb(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */
- pcr._device_vendor = inl(pcr._ioaddr);
- outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
-
- if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF))
- continue;
- if ((pcr._vendor == 0xF0F0) || (pcr._device == 0xF0F0))
- continue; /* catch ASUS P55TP4XE motherboards */
-
- printf("\npci bus 0x%x slot at 0x%04x, vendor 0x%04x device 0x%04x\n",
- pcr._pcibuses[pcr._pcibusidx], pcr._ioaddr, pcr._vendor,
- pcr._device);
-
- outb(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */
- pcr._status_command = inl(pcr._ioaddr + 0x04);
- pcr._class_revision = inl(pcr._ioaddr + 0x08);
- pcr._bist_header_latency_cache = inl(pcr._ioaddr + 0x0C);
- pcr._base0 = inl(pcr._ioaddr + 0x10);
- pcr._base1 = inl(pcr._ioaddr + 0x14);
- pcr._base2 = inl(pcr._ioaddr + 0x18);
- pcr._base3 = inl(pcr._ioaddr + 0x1C);
- pcr._base4 = inl(pcr._ioaddr + 0x20);
- pcr._base5 = inl(pcr._ioaddr + 0x24);
- pcr._baserom = inl(pcr._ioaddr + 0x30);
- pcr._max_min_ipin_iline = inl(pcr._ioaddr + 0x3C);
- pcr._user_config = inl(pcr._ioaddr + 0x40);
- outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
-
- /* check for pci-pci bridges (currently we only know Digital) */
- if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001))
- if (pcr._secondary_bus_number > 0)
- pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number;
-
- if (idx++ >= MAX_PCI_DEVICES)
- continue;
-
- identify_card(&pcr, verbose);
+ if ((pcr->pci_base4) && ((pcr->pci_base3 & 0x7) != 0x4)) {
+ if ((pcr->pci_base4 & 0x7) == 0x4) {
+ printf(" BASE4 0x%08x%08x addr 0x%08x%08x MEM%s 64BIT\n",
+ (int)pcr->pci_base5, (int)pcr->pci_base4,
+ (int)pcr->pci_base5,
+ (int)(pcr->pci_base4 &
+ (pcr->pci_base4 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base4 & 0x8) ? " PREFETCHABLE" :"");
+ } else {
+ printf(" BASE4 0x%08x addr 0x%08x %s%s\n",
+ (int)pcr->pci_base4,
+ (int)(pcr->pci_base4 &
+ (pcr->pci_base4 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base4 & 0x1) ? "I/O" : "MEM",
+ ((pcr->pci_base4 & 0x9) == 0x8) ? " PREFETCHABLE" :"");
}
- } while (++pcr._pcibusidx < pcr._pcinumbus);
-
- outb(PCI_MODE2_ENABLE_REG, 0x00);
}
-
-#endif /* __alpha__ */
-
- disable_os_io();
+ if ((pcr->pci_base5) && ((pcr->pci_base4 & 0x7) != 0x4)) {
+ printf(" BASE5 0x%08x addr 0x%08x %s%s%s\n",
+ (int)pcr->pci_base5,
+ (int)(pcr->pci_base5 &
+ (pcr->pci_base5 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)),
+ (pcr->pci_base5 & 0x1) ? "I/O" : "MEM",
+ ((pcr->pci_base5 & 0x9) == 0x8) ? " PREFETCHABLE" :"",
+ ((pcr->pci_base5 & 0x7) == 0x4) ? " 64BIT" : "");
+ }
+ if (pcr->pci_baserom)
+ printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n",
+ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000),
+ pcr->pci_baserom & 0x1 ? "" : "not-");
+ if (pcr->pci_max_min_ipin_iline)
+ printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x"
+ " INT_PIN 0x%02x INT_LINE 0x%02x\n",
+ pcr->pci_max_lat, pcr->pci_min_gnt,
+ pcr->pci_int_pin, pcr->pci_int_line);
+ if (pcr->pci_user_config)
+ printf(" BYTE_0 0x%02x BYTE_1 0x%02x"
+ " BYTE_2 0x%02x BYTE_3 0x%02x\n",
+ (int)pcr->pci_user_config_0, (int)pcr->pci_user_config_1,
+ (int)pcr->pci_user_config_2, (int)pcr->pci_user_config_3);
}
+#define PCI_B_FAST_B_B 0x80
+#define PCI_B_SB_RESET 0x40
+#define PCI_B_M_ABORT 0x20
+#define PCI_B_VGA_EN 0x08
+#define PCI_B_ISA_EN 0x04
+#define PCI_B_SERR_EN 0x02
+#define PCI_B_P_ERR 0x01
-void
-identify_card(struct pci_config_reg *pcr, int verbose)
+static void
+print_bridge_pci_class(pciConfigPtr pcr)
{
-
- int i = 0, j, foundit = 0;
-
- while (pvd[i].vendorname != (char *)NULL) {
- if (pvd[i].vendor_id == pcr->_vendor) {
- j = 0;
- printf(" %s ", pvd[i].vendorname);
- while (pvd[i].device[j].devicename != (char *)NULL) {
- if (pvd[i].device[j].device_id == pcr->_device) {
- printf("%s", pvd[i].device[j].devicename);
- foundit = 1;
- break;
- }
- j++;
- }
- }
- if (foundit)
- break;
- i++;
+ printf(" HEADER 0x%02x LATENCY 0x%02x\n",
+ pcr->pci_header_type, pcr->pci_latency_timer);
+ printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x\n",
+ pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number,
+ pcr->pci_subordinate_bus_number);
+ printf(" SECLT 0x%02x SECSTATUS 0x%04x\n",
+ pcr->pci_secondary_latency_timer, pcr->pci_secondary_status);
+
+ if (pcr->pci_io_base || pcr->pci_io_limit ||
+ pcr->pci_upper_io_base || pcr->pci_upper_io_limit) {
+ if (((pcr->pci_io_base & 0x0f) == 0x01) ||
+ ((pcr->pci_io_limit & 0x0f) == 0x01)) {
+ printf(" IOBASE 0x%04x%04x IOLIM 0x%04x%04x\n",
+ pcr->pci_upper_io_base, (pcr->pci_io_base & 0x00f0) << 8,
+ pcr->pci_upper_io_limit, (pcr->pci_io_limit << 8) | 0x0fff);
+ } else {
+ printf(" IOBASE 0x%04x IOLIM 0x%04x\n",
+ (pcr->pci_io_base & 0x00f0) << 8,
+ (pcr->pci_io_limit << 8) | 0x0fff);
}
+ }
- if (!foundit)
- printf(" Device unknown\n");
- else {
- printf("\n");
- if (verbose) {
- if (pvd[i].device[j].print_func != (void (*)())NULL) {
- pvd[i].device[j].print_func(pcr);
- return;
- }
- }
+ if (pcr->pci_mem_base || pcr->pci_mem_limit)
+ printf(" NOPREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n",
+ (pcr->pci_mem_base & 0x00fff0) << 16,
+ (pcr->pci_mem_limit << 16) | 0x0fffff);
+
+ if (pcr->pci_prefetch_mem_base || pcr->pci_prefetch_mem_limit ||
+ pcr->pci_prefetch_upper_mem_base ||
+ pcr->pci_prefetch_upper_mem_limit) {
+ if (((pcr->pci_prefetch_mem_base & 0x0f) == 0x01) ||
+ ((pcr->pci_prefetch_mem_limit & 0x0f) == 0x01)) {
+ printf(" PREFETCH_MEMBASE 0x%08x%08x MEMLIM 0x%08x%08x\n",
+ (int)pcr->pci_prefetch_upper_mem_base,
+ (pcr->pci_prefetch_mem_base & 0x00fff0) << 16,
+ (int)pcr->pci_prefetch_upper_mem_limit,
+ (pcr->pci_prefetch_mem_limit << 16) | 0x0fffff);
+ } else {
+ printf(" PREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n",
+ (pcr->pci_prefetch_mem_base & 0x00fff0) << 16,
+ (pcr->pci_prefetch_mem_limit << 16) | 0x0fffff);
}
+ }
- if (verbose) {
- if (pcr->_status_command)
- printf(" STATUS 0x%04x COMMAND 0x%04x\n",
- pcr->_status, pcr->_command);
- if (pcr->_class_revision)
- printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
- pcr->_base_class, pcr->_sub_class, pcr->_prog_if,
- pcr->_rev_id);
- if (pcr->_bist_header_latency_cache)
- printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
- pcr->_bist, pcr->_header_type, pcr->_latency_timer,
- pcr->_cache_line_size);
- if (pcr->_base0)
- printf(" BASE0 0x%08x addr 0x%08x %s\n",
- pcr->_base0, pcr->_base0 & (pcr->_base0 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0),
- pcr->_base0 & 0x1 ? "I/O" : "MEM");
- if (pcr->_base1)
- printf(" BASE1 0x%08x addr 0x%08x %s\n",
- pcr->_base1, pcr->_base1 & (pcr->_base1 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0),
- pcr->_base1 & 0x1 ? "I/O" : "MEM");
- if (pcr->_base2)
- printf(" BASE2 0x%08x addr 0x%08x %s\n",
- pcr->_base2, pcr->_base2 & (pcr->_base2 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0),
- pcr->_base2 & 0x1 ? "I/O" : "MEM");
- if (pcr->_base3)
- printf(" BASE3 0x%08x addr 0x%08x %s\n",
- pcr->_base3, pcr->_base3 & (pcr->_base3 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0),
- pcr->_base3 & 0x1 ? "I/O" : "MEM");
- if (pcr->_base4)
- printf(" BASE4 0x%08x addr 0x%08x %s\n",
- pcr->_base4, pcr->_base4 & (pcr->_base4 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0),
- pcr->_base4 & 0x1 ? "I/O" : "MEM");
- if (pcr->_base5)
- printf(" BASE5 0x%08x addr 0x%08x %s\n",
- pcr->_base5, pcr->_base5 & (pcr->_base5 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0),
- pcr->_base5 & 0x1 ? "I/O" : "MEM");
- if (pcr->_baserom)
- printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n",
- pcr->_baserom, pcr->_baserom & 0xFFFF8000,
- pcr->_baserom & 0x1 ? "" : "not-");
- if (pcr->_max_min_ipin_iline)
- printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n",
- pcr->_max_lat, pcr->_min_gnt,
- pcr->_int_pin, pcr->_int_line);
- if (pcr->_user_config)
- printf(" BYTE_0 0x%02x BYTE_1 0x%02x BYTE_2 0x%02x BYTE_3 0x%02x\n",
- pcr->_user_config_0, pcr->_user_config_1,
- pcr->_user_config_2, pcr->_user_config_3);
- }
+ printf(" %sFAST_B2B %sSEC_BUS_RST %sM_ABRT %sVGA_EN %sISA_EN"
+ " %sSERR_EN %sPERR_EN\n",
+ (pcr->pci_bridge_control & PCI_B_FAST_B_B) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_SB_RESET) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_M_ABORT) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_VGA_EN) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_ISA_EN) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_SERR_EN) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_P_ERR) ? "" : "NO_");
}
-
-void
-print_mach64(struct pci_config_reg *pcr)
+static void
+print_mach64(pciConfigPtr pcr)
{
- unsigned long sparse_io = 0;
-
- if (pcr->_status_command)
- printf(" STATUS 0x%04x COMMAND 0x%04x\n",
- pcr->_status, pcr->_command);
- if (pcr->_class_revision)
- printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
- pcr->_base_class, pcr->_sub_class, pcr->_prog_if, pcr->_rev_id);
- if (pcr->_bist_header_latency_cache)
- printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
- pcr->_bist, pcr->_header_type, pcr->_latency_timer,
- pcr->_cache_line_size);
- if (pcr->_base0)
- printf(" APBASE 0x%08x addr 0x%08x\n",
- pcr->_base0, pcr->_base0 & (pcr->_base0 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0));
- if (pcr->_base1)
- printf(" BLOCKIO 0x%08x addr 0x%08x\n",
- pcr->_base1, pcr->_base1 & (pcr->_base1 & 0x1 ?
- 0xFFFFFFFC : 0xFFFFFFF0));
- if (pcr->_baserom)
- printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n",
- pcr->_baserom, pcr->_baserom & 0xFFFF8000,
- pcr->_baserom & 0x1 ? "" : "not-");
- if (pcr->_max_min_ipin_iline)
- printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n",
- pcr->_max_lat, pcr->_min_gnt, pcr->_int_pin, pcr->_int_line);
- switch (pcr->_user_config_0 & 0x03) {
+ CARD32 sparse_io = 0;
+
+ printf(" CardVendor 0x%04x card 0x%04x\n",
+ pcr->pci_subsys_vendor, pcr->pci_subsys_card);
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class,
+ pcr->pci_prog_if, pcr->pci_rev_id);
+ printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
+ pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer,
+ pcr->pci_cache_line_size);
+ if (pcr->pci_base0)
+ printf(" APBASE 0x%08x addr 0x%08x\n",
+ (int)pcr->pci_base0, (int)(pcr->pci_base0 &
+ (pcr->pci_base0 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)));
+ if (pcr->pci_base1)
+ printf(" BLOCKIO 0x%08x addr 0x%08x\n",
+ (int)pcr->pci_base1, (int)(pcr->pci_base1 &
+ (pcr->pci_base1 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)));
+ if (pcr->pci_base2)
+ printf(" REGBASE 0x%08x addr 0x%08x\n",
+ (int)pcr->pci_base2, (int)(pcr->pci_base2 &
+ (pcr->pci_base2 & 0x1 ? 0xFFFFFFFC : 0xFFFFFFF0)));
+ if (pcr->pci_baserom)
+ printf(" BASEROM 0x%08x addr 0x%08x %sdecode-enabled\n",
+ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000),
+ pcr->pci_baserom & 0x1 ? "" : "not-");
+ if (pcr->pci_max_min_ipin_iline)
+ printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x"
+ " INT_PIN 0x%02x INT_LINE 0x%02x\n",
+ pcr->pci_max_lat, pcr->pci_min_gnt,
+ pcr->pci_int_pin, pcr->pci_int_line);
+ switch (pcr->pci_user_config_0 & 0x03) {
case 0:
sparse_io = 0x2ec;
break;
@@ -1560,231 +532,248 @@ print_mach64(struct pci_config_reg *pcr)
sparse_io = 0x1c8;
break;
}
- printf(" SPARSEIO 0x%03x %s %s\n",
- sparse_io, pcr->_user_config_0 & 0x04 ? "Block IO enabled" :
- "Sparse IO enabled",
- pcr->_user_config_0 & 0x08 ? "Disable 0x46E8" : "Enable 0x46E8");
+ printf(" SPARSEIO 0x%03x %s IO enabled %sable 0x46E8\n",
+ (int)sparse_io, pcr->pci_user_config_0 & 0x04 ? "Block" : "Sparse",
+ pcr->pci_user_config_0 & 0x08 ? "Dis" : "En");
}
-void
-print_i128(struct pci_config_reg *pcr)
+static void
+print_i128(pciConfigPtr pcr)
{
- if (pcr->_status_command)
- printf(" STATUS 0x%04x COMMAND 0x%04x\n",
- pcr->_status, pcr->_command);
- if (pcr->_class_revision)
- printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
- pcr->_base_class, pcr->_sub_class, pcr->_prog_if, pcr->_rev_id);
- if (pcr->_bist_header_latency_cache)
- printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
- pcr->_bist, pcr->_header_type, pcr->_latency_timer,
- pcr->_cache_line_size);
+ printf(" CardVendor 0x%04x card 0x%04x\n",
+ pcr->pci_subsys_vendor, pcr->pci_subsys_card);
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+ printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
+ pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer,
+ pcr->pci_cache_line_size);
printf(" MW0_AD 0x%08x addr 0x%08x %spre-fetchable\n",
- pcr->_base0, pcr->_base0 & 0xFFC00000,
- pcr->_base0 & 0x8 ? "" : "not-");
+ (int)pcr->pci_base0, (int)(pcr->pci_base0 & 0xFFC00000),
+ pcr->pci_base0 & 0x8 ? "" : "not-");
printf(" MW1_AD 0x%08x addr 0x%08x %spre-fetchable\n",
- pcr->_base1, pcr->_base1 & 0xFFC00000,
- pcr->_base1 & 0x8 ? "" : "not-");
+ (int)pcr->pci_base1, (int)(pcr->pci_base1 & 0xFFC00000),
+ pcr->pci_base1 & 0x8 ? "" : "not-");
printf(" XYW_AD(A) 0x%08x addr 0x%08x\n",
- pcr->_base2, pcr->_base2 & 0xFFC00000);
+ (int)pcr->pci_base2, (int)(pcr->pci_base2 & 0xFFC00000));
printf(" XYW_AD(B) 0x%08x addr 0x%08x\n",
- pcr->_base3, pcr->_base3 & 0xFFC00000);
+ (int)pcr->pci_base3, (int)(pcr->pci_base3 & 0xFFC00000));
printf(" RBASE_G 0x%08x addr 0x%08x\n",
- pcr->_base4, pcr->_base4 & 0xFFFF0000);
+ (int)pcr->pci_base4, (int)(pcr->pci_base4 & 0xFFFF0000));
printf(" IO 0x%08x addr 0x%08x\n",
- pcr->_base5, pcr->_base5 & 0xFFFFFF00);
+ (int)pcr->pci_base5, (int)(pcr->pci_base5 & 0xFFFFFF00));
printf(" RBASE_E 0x%08x addr 0x%08x %sdecode-enabled\n",
- pcr->_baserom, pcr->_baserom & 0xFFFF8000,
- pcr->_baserom & 0x1 ? "" : "not-");
- if (pcr->_max_min_ipin_iline)
- printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n",
- pcr->_max_lat, pcr->_min_gnt, pcr->_int_pin, pcr->_int_line);
+ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000),
+ pcr->pci_baserom & 0x1 ? "" : "not-");
+ if (pcr->pci_max_min_ipin_iline)
+ printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x"
+ " INT_PIN 0x%02x INT_LINE 0x%02x\n",
+ pcr->pci_max_lat, pcr->pci_min_gnt,
+ pcr->pci_int_pin, pcr->pci_int_line);
}
-void
-print_pcibridge(struct pci_config_reg *pcr)
+static void
+print_dc21050(pciConfigPtr pcr)
{
- if (pcr->_status_command)
- printf(" STATUS 0x%04x COMMAND 0x%04x\n",
- pcr->_status, pcr->_command);
- if (pcr->_class_revision)
- printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
- pcr->_base_class, pcr->_sub_class, pcr->_prog_if, pcr->_rev_id);
- if (pcr->_bist_header_latency_cache)
- printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
- pcr->_bist, pcr->_header_type, pcr->_latency_timer,
- pcr->_cache_line_size);
- printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n",
- pcr->_primary_bus_number, pcr->_secondary_bus_number,
- pcr->_subordinate_bus_number, pcr->_secondary_latency_timer);
- printf(" IOBASE: 0x%02x00 IOLIM 0x%02x00 SECSTATUS 0x%04x\n",
- pcr->_io_base, pcr->_io_limit, pcr->_secondary_status);
- printf(" NOPREFETCH MEMBASE: 0x%08x MEMLIM 0x%08x\n",
- pcr->_mem_base, pcr->_mem_limit);
- printf(" PREFETCH MEMBASE: 0x%08x MEMLIM 0x%08x\n",
- pcr->_prefetch_mem_base, pcr->_prefetch_mem_limit);
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+ printf(" BIST 0x%02x HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
+ pcr->pci_bist, pcr->pci_header_type, pcr->pci_latency_timer,
+ pcr->pci_cache_line_size);
+ printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n",
+ pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number,
+ pcr->pci_subordinate_bus_number, pcr->pci_secondary_latency_timer);
+ printf(" IOBASE 0x%02x IOLIM 0x%02x SECSTATUS 0x%04x\n",
+ pcr->pci_io_base << 8, (pcr->pci_io_limit << 8) | 0xfff,
+ pcr->pci_secondary_status);
+ printf(" NOPREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n",
+ pcr->pci_mem_base << 16, (pcr->pci_mem_limit << 16) | 0xfffff);
+ printf(" PREFETCH_MEMBASE 0x%08x MEMLIM 0x%08x\n",
+ pcr->pci_prefetch_mem_base << 16,
+ (pcr->pci_prefetch_mem_limit << 16) | 0xfffff);
printf(" RBASE_E 0x%08x addr 0x%08x %sdecode-enabled\n",
- pcr->_baserom, pcr->_baserom & 0xFFFF8000,
- pcr->_baserom & 0x1 ? "" : "not-");
- if (pcr->_max_min_ipin_iline)
- printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x INT_PIN 0x%02x INT_LINE 0x%02x\n",
- pcr->_max_lat, pcr->_min_gnt, pcr->_int_pin, pcr->_int_line);
+ (int)pcr->pci_baserom, (int)(pcr->pci_baserom & 0xFFFF8000),
+ pcr->pci_baserom & 0x1 ? "" : "not-");
+ if (pcr->pci_max_min_ipin_iline)
+ printf(" MAX_LAT 0x%02x MIN_GNT 0x%02x"
+ " INT_PIN 0x%02x INT_LINE 0x%02x\n",
+ pcr->pci_max_lat, pcr->pci_min_gnt,
+ pcr->pci_int_pin, pcr->pci_int_line);
}
-static int io_fd;
-#ifdef __EMX__
-USHORT callgate[3] = {0,0,0};
-#endif
-
-void
-enable_os_io()
+static void
+print_simba(pciConfigPtr pcr)
{
-#if defined(SVR4) || defined(SCO) || defined(ISC)
-#if defined(SI86IOPL)
- sysi86(SI86IOPL, 3);
-#else
- sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
-#endif
-#endif
-#if defined(linux)
- iopl(3);
-#endif
-#if defined(__FreeBSD__) || defined(__386BSD__) || defined(__bsdi__)
- if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) {
- perror("/dev/console");
- exit(1);
- }
-#if defined(__FreeBSD__) || defined(__386BSD__)
- if (ioctl(io_fd, KDENABIO, 0) < 0) {
- perror("ioctl(KDENABIO)");
- exit(1);
- }
-#endif
-#if defined(__bsdi__)
- if (ioctl(io_fd, PCCONENABIOPL, 0) < 0) {
- perror("ioctl(PCCONENABIOPL)");
- exit(1);
- }
-#endif
-#endif
-#if defined(__NetBSD__)
-#if !defined(USE_I386_IOPL)
- if ((io_fd = open("/dev/io", O_RDWR, 0)) < 0) {
- perror("/dev/io");
- exit(1);
- }
-#else
- if (i386_iopl(1) < 0) {
- perror("i386_iopl");
- exit(1);
- }
-#endif /* USE_I386_IOPL */
-#endif /* __NetBSD__ */
-#if defined(__OpenBSD__)
- if (i386_iopl(1) < 0) {
- perror("i386_iopl");
- exit(1);
- }
-#endif /* __OpenBSD__ */
-#if defined(MACH386)
- if ((io_fd = open("/dev/iopl", O_RDWR, 0)) < 0) {
- perror("/dev/iopl");
- exit(1);
- }
-#endif
-#ifdef __EMX__
- {
- HFILE hfd;
- ULONG dlen,action;
- APIRET rc;
- static char *ioDrvPath = "/dev/fastio$";
-
- if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action,
- (ULONG)0, FILE_SYSTEM, FILE_OPEN,
- OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
- (ULONG)0) != 0) {
- fprintf(stderr,"Error opening fastio$ driver...\n");
- fprintf(stderr,"Please install xf86sup.sys in config.sys!\n");
- exit(42);
- }
- callgate[0] = callgate[1] = 0;
-
-/* Get callgate from driver for fast io to ports and other stuff */
+ int i;
+ CARD8 io, mem;
+
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+ printf(" HEADER 0x%02x LATENCY 0x%02x CACHE 0x%02x\n",
+ pcr->pci_header_type, pcr->pci_latency_timer,
+ pcr->pci_cache_line_size);
+ printf(" PRIBUS 0x%02x SECBUS 0x%02x SUBBUS 0x%02x SECLT 0x%02x\n",
+ pcr->pci_primary_bus_number, pcr->pci_secondary_bus_number,
+ pcr->pci_subordinate_bus_number, pcr->pci_secondary_latency_timer);
+ printf(" SECSTATUS 0x%04x\n",
+ pcr->pci_secondary_status);
+ printf(" %sFAST_B2B %sSEC_BUS_RST %sM_ABRT %sVGA_EN %sISA_EN"
+ " %sSERR_EN %sPERR_EN\n",
+ (pcr->pci_bridge_control & PCI_B_FAST_B_B) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_SB_RESET) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_M_ABORT) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_VGA_EN) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_ISA_EN) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_SERR_EN) ? "" : "NO_",
+ (pcr->pci_bridge_control & PCI_B_P_ERR) ? "" : "NO_");
+ printf(" TICK 0x%08lx SECCNTL 0x%02x\n", (long)
+ pciReadLong(pcr->tag, 0x00b0), pciReadByte(pcr->tag, 0x00dd));
+ printf(" MASTER RETRIES: PRIMARY 0x%02x, SECONDARY 0x%02x\n",
+ pciReadByte(pcr->tag, 0x00c0), pciReadByte(pcr->tag, 0x00dc));
+ printf(" TARGET RETRIES: PIO 0x%02x, DMA 0x%02x\n",
+ pciReadByte(pcr->tag, 0x00d8), pciReadByte(pcr->tag, 0x00da));
+ printf(" TARGET LATENCY: PIO 0x%02x, DMA 0x%02x\n",
+ pciReadByte(pcr->tag, 0x00d9), pciReadByte(pcr->tag, 0x00db));
+ printf(" DMA AFSR 0x%08lx%08lx AFAR 0x%08lx%08lx\n",
+ (long)pciReadLong(pcr->tag, 0x00cc),
+ (long)pciReadLong(pcr->tag, 0x00c8),
+ (long)pciReadLong(pcr->tag, 0x00d4),
+ (long)pciReadLong(pcr->tag, 0x00d0));
+ printf(" PIO AFSR 0x%08lx%08lx AFAR 0x%08lx%08lx\n",
+ (long)pciReadLong(pcr->tag, 0x00ec),
+ (long)pciReadLong(pcr->tag, 0x00e8),
+ (long)pciReadLong(pcr->tag, 0x00f4),
+ (long)pciReadLong(pcr->tag, 0x00f0));
+ printf(" PCI CNTL 0x%08lx%08lx DIAG 0x%08lx%08lx\n",
+ (long)pciReadLong(pcr->tag, 0x00e4),
+ (long)pciReadLong(pcr->tag, 0x00e0),
+ (long)pciReadLong(pcr->tag, 0x00fc),
+ (long)pciReadLong(pcr->tag, 0x00f8));
+ printf(" MAPS: I/O 0x%02x, MEM 0x%02x\n",
+ (io = pciReadByte(pcr->tag, 0x00de)),
+ (mem = pciReadByte(pcr->tag, 0x00df)));
+ for (i = 0; i < 8; i++)
+ if (io & (1 << i))
+ printf(" BUS I/O 0x%06x-0x%06x\n", i << 21, ((i + 1) << 21) - 1);
+ for (i = 0; i < 8; i++)
+ if (mem & (1 << i))
+ printf(" BUS MEM 0x%08x-0x%08x\n", i << 29, ((i + 1) << 29) - 1);
+}
- rc = DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64,
- NULL, 0, NULL,
- (ULONG*)&callgate[2], sizeof(USHORT), &dlen);
- if (rc) {
- fprintf(stderr,"xf86-OS/2: EnableIOPorts failed, rc=%d, dlen=%d; emergency exit\n",
- rc,dlen);
- DosClose(hfd);
- exit(42);
- }
+static int cbn_460gx = -1;
-/* Calling callgate with function 13 sets IOPL for the program */
+static void
+print_460gx_sac(pciConfigPtr pcr)
+{
+ CARD32 tmp;
+
+ /* Print generalities */
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+
+ tmp = pcr->pci_user_config;
+ pcr->pci_user_config = 0;
+ print_default_class(pcr);
+ pcr->pci_user_config = tmp;
+
+ /* Only print what XFree86 might be interested in */
+ if (pcr->busnum == 0) {
+ if ((pcr->devnum != 0x10) || (pcr->funcnum != 0))
+ return;
+
+ /* Get Chipset Bus Number */
+ cbn_460gx = (unsigned int)pciReadByte(pcr->tag, 0x0040);
+ printf(" CBN 0x%02x CBUSES 0x%02x\n",
+ cbn_460gx, pciReadByte(pcr->tag, 0x0044));
+
+ return;
+ }
- asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate"
- : /*no outputs */
- : /*no inputs */
- : "eax","ebx","ecx","edx","cc");
+ if ((pcr->busnum != cbn_460gx) || (pcr->funcnum != 0))
+ return;
- DosClose(hfd);
- }
-#endif
-#if defined(Lynx) && defined(__powerpc__)
- pciConfBase = (unsigned char *) smem_create("PCI-CONF",
- (char *)0x80800000, 64*1024, SM_READ|SM_WRITE);
- if (pciConfBase == (void *) -1)
- exit(1);
-#endif
+ switch (pcr->devnum) {
+ case 0:
+ printf(" F16NUM 0x%02x F16CPL 0x%02x DEVNPRES 0x%08lx\n",
+ pciReadByte(pcr->tag, 0x0060), pciReadByte(pcr->tag, 0x0078),
+ (long)pciReadLong(pcr->tag, 0x0070));
+
+ return;
+
+ case 0x10:
+ printf(" TOM 0x%04x IORD 0x%04x\n",
+ pciReadWord(pcr->tag, 0x0050), pciReadWord(pcr->tag, 0x008E));
+ /* Fall through */
+
+ case 0x11: case 0x12: case 0x13:
+ case 0x14: case 0x15: case 0x16: case 0x17:
+ printf(" BUSNO 0x%02x SUBNO 0x%02x\n",
+ pciReadByte(pcr->tag, 0x0048), pciReadByte(pcr->tag, 0x0049));
+ printf(" VGASE 0x%02x PCIS 0x%02x IOR 0x%02x\n",
+ pciReadByte(pcr->tag, 0x0080), pciReadByte(pcr->tag, 0x0084),
+ pciReadByte(pcr->tag, 0x008C));
+ /* Fall through */
+
+ default:
+ return;
+ }
}
+static void
+print_460gx_pxb(pciConfigPtr pcr)
+{
+ CARD32 tmp;
+
+ /* Print generalities */
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+
+ tmp = pcr->pci_user_config;
+ pcr->pci_user_config = 0;
+ print_default_class(pcr);
+ pcr->pci_user_config = tmp;
+
+ /* Only print what XFree86 might be interested in */
+ printf(" ERRCMD 0x%02x GAPEN 0x%02x\n",
+ pciReadByte(pcr->tag, 0x0046), pciReadByte(pcr->tag, 0x0060));
+}
-void
-disable_os_io()
+static void
+print_460gx_gxb(pciConfigPtr pcr)
{
-#if defined(SVR4) || defined(SCO) || defined(ISC)
-#if defined(SI86IOPL)
- sysi86(SI86IOPL, 0);
-#else
- sysi86(SI86V86, V86SC_IOPL, 0);
-#endif
-#endif
-#if defined(linux)
- iopl(0);
-#endif
-#if defined(__FreeBSD__) || defined(__386BSD__)
- if (ioctl(io_fd, KDDISABIO, 0) < 0) {
- perror("ioctl(KDDISABIO)");
- close(io_fd);
- exit(1);
- }
- close(io_fd);
-#endif
-#if defined(__NetBSD__)
-#if !defined(USE_I386_IOPL)
- close(io_fd);
-#else
- if (i386_iopl(0) < 0) {
- perror("i386_iopl");
- exit(1);
- }
-#endif /* NetBSD1_1 */
-#endif /* __NetBSD__ */
-#if defined(__bsdi__)
- if (ioctl(io_fd, PCCONDISABIOPL, 0) < 0) {
- perror("ioctl(PCCONDISABIOPL)");
- close(io_fd);
- exit(1);
- }
- close(io_fd);
-#endif
-#if defined(MACH386)
- close(io_fd);
-#endif
-#if defined(Lynx) && defined(__powerpc__)
- smem_create(NULL, (char *) pciConfBase, 0, SM_DETACH);
- smem_remove("PCI-CONF");
- pciConfBase = NULL;
-#endif
+ CARD32 tmp;
+
+ /* Print generalities */
+ printf(" STATUS 0x%04x COMMAND 0x%04x\n",
+ pcr->pci_status, pcr->pci_command);
+ printf(" CLASS 0x%02x 0x%02x 0x%02x REVISION 0x%02x\n",
+ pcr->pci_base_class, pcr->pci_sub_class, pcr->pci_prog_if,
+ pcr->pci_rev_id);
+
+ tmp = pcr->pci_user_config;
+ pcr->pci_user_config = 0;
+ print_default_class(pcr);
+ pcr->pci_user_config = tmp;
+
+ /* Only print what XFree86 might be interested in */
+ printf(" BAPBASE 0x%08lx%08lx AGPSIZ 0x%02x VGAGE 0x%02x\n",
+ (long)pciReadLong(pcr->tag, 0x009C),
+ (long)pciReadLong(pcr->tag, 0x0098),
+ pciReadByte(pcr->tag, 0x00A2), pciReadByte(pcr->tag, 0x0060));
}
+
+#include "xf86getpagesize.c"
diff --git a/hw/xfree86/utils/xorgconfig/Cards b/hw/xfree86/utils/xorgconfig/Cards
index 0412fdd61..83d8840ea 100644
--- a/hw/xfree86/utils/xorgconfig/Cards
+++ b/hw/xfree86/utils/xorgconfig/Cards
@@ -1,4 +1,4 @@
-# $Xorg: Cards,v 1.3 2000/08/17 19:53:04 cpqbld Exp $
+# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $
# This is the database of card definitions used by xf86config.
# Each definition should have a NAME entry, CHIPSET (descriptive) and
# SERVER (one of Mono, VGA16, SVGA, S3, 8514, Mach8, Mach32, Mach64, AGX,
@@ -18,7 +18,228 @@
# 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.51.2.15 1998/02/27 15:28:57 dawes Exp $
+# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.80 2002/11/18 05:24:19 paulo Exp $
+
+# VGA
+
+NAME * Generic VGA compatible
+SERVER VGA16
+DRIVER vga
+
+NAME * Generic VESA compatible
+SERVER VGA16
+DRIVER vesa
+
+NAME * Unsupported VGA compatible
+SERVER VGA16
+DRIVER vga
+UNSUPPORTED
+
+
+# #
+# generic #
+# #
+
+NAME ** Alliance Pro Motion (generic) [apm]
+#CHIPSET apm
+SERVER SVGA
+DRIVER apm
+LINE #Option "no_accel"
+
+NAME ** Ark Logic (generic) [ark]
+#CHIPSET ark
+SERVER SVGA
+DRIVER ark
+
+NAME ** ATI (generic) [ati]
+#CHIPSET ati
+SERVER SVGA
+DRIVER ati
+
+NAME ** ATI Rage 128 based (generic) [r128]
+#CHIPSET r128
+SERVER SVGA
+DRIVER r128
+
+NAME ** ATI Radeon (generic) [radeon]
+#CHIPSET radeon
+SERVER SVGA
+DRIVER radeon
+
+NAME ** Chips and Technologies (generic) [chips]
+#CHIPSET chips
+SERVER SVGA
+DRIVER chips
+LINE # Option "suspend_hack"
+LINE # Option "STN"
+LINE # Option "no_stretch"
+LINE # Option "no_center"
+LINE # Option "use_modeline"
+LINE # Option "fix_panel_size"
+LINE # videoram 512
+LINE # Option "noaccel"
+LINE # Option "no_bitblt"
+LINE # Option "xaa_no_color_exp"
+LINE # Option "xaa_benchmark"
+LINE # Option "hw_cursor"
+LINE # Option "nolinear"
+LINE # MemBase 0x03b00000
+LINE # Option "hw_clocks"
+LINE # Textclockfreq 25.175
+
+NAME ** Cirrus Logic (generic) [cirrus]
+#CHIPSET cirrus
+SERVER SVGA
+DRIVER cirrus
+LINE # MemBase 0x00e00000 # ISA card that maps to 14Mb
+LINE # MemBase 0x04000000 # VLB card that maps to 64Mb
+LINE # MemBase 0x80000000 # VLB card that maps to 2048Mb
+LINE # MemBase 0x02000000 # VLB card that maps to 32Mb
+LINE # Option "linear"
+LINE # Option "fifo_conservative"
+
+NAME ** Cyrix MediaGX (generic) [cyrix]
+#CHIPSET cyrix
+SERVER SVGA
+DRIVER cyrix
+
+NAME ** Linux framebuffer (generic) [fbdev]
+#CHIPSET fbdev
+SERVER SVGA
+DRIVER fbdev
+
+NAME ** 3DLabs, TI (generic) [glint]
+#CHIPSET glint
+SERVER SVGA
+DRIVER glint
+LINE #Option "no_accel"
+
+NAME ** Number Nine I128 (generic) [i128]
+#CHIPSET i128
+SERVER SVGA
+DRIVER i128
+
+NAME ** Intel i740 (generic) [i740]
+#CHIPSET i740
+SERVER SVGA
+DRIVER i740
+
+NAME ** Intel i810 (generic) [i810]
+#CHIPSET i810
+SERVER SVGA
+DRIVER i810
+
+NAME ** Matrox Graphics (generic) [mga]
+#CHIPSET mga
+SERVER SVGA
+DRIVER mga
+LINE # Option "mga_sdram"
+
+NAME ** NeoMagic (generic) [neomagic]
+#CHIPSET neomagic
+SERVER SVGA
+DRIVER neomagic
+LINE # Chipset "NM2160"
+LINE # IOBase 0xfea00000
+LINE # MemBase 0xfd000000
+LINE # VideoRam 2048
+LINE # DacSpeed 90
+LINE # Option "linear"
+LINE # Option "nolinear"
+LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
+LINE # Option "no_accel"
+LINE # Option "intern_disp"
+LINE # Option "extern_disp"
+LINE # Option "mmio"
+LINE # Option "no_mmio"
+LINE # Option "lcd_center"
+LINE # Option "no_stretch"
+
+NAME ** NVIDIA (generic) [nv]
+#CHIPSET nv
+SERVER SVGA
+DRIVER nv
+
+NAME ** Rendition (generic) [rendition]
+#CHIPSET rendition
+SERVER SVGA
+DRIVER rendition
+LINE # Option "sw_cursor"
+
+NAME ** S3 (not ViRGE or Savage) (generic) [s3]
+#CHIPSET s3
+SERVER SVGA
+DRIVER s3
+
+NAME ** S3 ViRGE (generic) [s3virge]
+#CHIPSET s3virge
+SERVER SVGA
+DRIVER s3virge
+LINE # Option "xaa_benchmark"
+LINE # Option "fifo_moderate"
+LINE # Option "pci_burst_on"
+LINE # Option "pci_retry"
+LINE # Option "lcd_center"
+LINE # Set_LCDClk <pixel_clock_for_LCD>
+
+NAME ** S3 Savage (generic) [savage]
+#CHIPSET savage
+SERVER SVGA
+DRIVER savage
+
+NAME ** Silicon Motion (generic) [siliconmotion]
+#CHIPSET siliconmotion
+SERVER SVGA
+DRIVER siliconmotion
+
+NAME ** SiS (generic) [sis]
+#CHIPSET sis
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel"
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "no_BitBlt"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark"
+LINE # Option "ext_eng_queue"
+
+NAME ** 3Dfx (generic) [tdfx]
+#CHIPSET tdfx
+SERVER SVGA
+DRIVER tdfx
+
+NAME ** DEC TGA (generic) [tga]
+#CHIPSET tga
+SERVER SVGA
+DRIVER tga
+
+NAME ** Trident (generic) [trident]
+#CHIPSET trident
+SERVER SVGA
+DRIVER trident
+
+NAME ** Tseng Labs (generic) [tseng]
+#CHIPSET tseng
+SERVER SVGA
+DRIVER tseng
+LINE # Option "linear"
+LINE # Option "noaccel"
+LINE # Option "power_saver"
+LINE # Option "fast_dram"
+LINE # Option "pci_retry"
+LINE # Option "hibit_high"
+LINE # Option "hibit_low"
+LINE # MemBase 0x3C00000
+
+NAME ** VMWare guest OS (generic) [vmware]
+#CHIPSET vmware
+SERVER SVGA
+DRIVER vmware
+
#Chips & Technologies
@@ -26,6 +247,7 @@
NAME Chips & Technologies CT65520
CHIPSET ct65520
SERVER SVGA
+DRIVER chips
LINE # Device section for C&T cards.
LINE # Option "suspend_hack"
LINE # Option "STN"
@@ -65,7 +287,7 @@ LINE # Option "noaccel"
LINE # Option "no_bitblt"
LINE # Option "xaa_no_color_exp"
LINE # Option "xaa_benchmark"
-LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
LINE # Option "mmio"
SEE Chips & Technologies CT65540
@@ -84,7 +306,7 @@ LINE # Option "noaccel"
LINE # Option "no_bitblt"
LINE # Option "xaa_no_color_exp"
LINE # Option "xaa_benchmark"
-LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
LINE # Option "sync_on_green"
LINE # Option "fast_dram"
LINE # Option "use_vclk1"
@@ -103,20 +325,30 @@ NAME Chips & Technologies CT68554
CHIPSET ct68554
SEE Chips & Technologies CT65550
+NAME Chips & Technologies CT69000
+CHIPSET ct69000
+SEE Chips & Technologies CT65550
+
+NAME Chips & Technologies CT69030
+CHIPSET ct69030
+SEE Chips & Technologies CT65550
+
NAME Chips & Technologies CT64200
CHIPSET ct64200
SERVER SVGA
+DRIVER chips
LINE # Device section for C&T cards.
LINE # videoram 1024
NAME Chips & Technologies CT64300
CHIPSET ct64300
SERVER SVGA
+DRIVER chips
LINE # Option "noaccel"
LINE # Option "no_bitblt"
LINE # Option "xaa_no_color_exp"
LINE # Option "xaa_benchmark"
-LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
LINE # Option "nolinear"
LINE # MemBase 0x03b00000
LINE # Option "hw_clocks"
@@ -127,8 +359,9 @@ SEE Chips & Technologies CT64200
#tested
NAME Cirrus Logic GD542x
-CHIPSET CL-GD5420/2/4/6/8/9
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
LINE # Device section for Cirrus Logic GD5420/2/4/6/8/9-based cards.
LINE #MemBase 0x00e00000
@@ -137,8 +370,9 @@ LINE #Option "linear"
#tested
NAME Cirrus Logic GD543x
-CHIPSET CL-GD5430/5434
+CHIPSET CL-GD5430/5434/5436
SERVER SVGA
+DRIVER cirrus
NOCLOCKPROBE
LINE # Device section for Cirrus Logic GD5430/34-based cards.
LINE #MemBase 0x00e00000 # ISA card that maps to 14Mb
@@ -150,6 +384,7 @@ LINE #Option "linear"
NAME Cirrus Logic GD544x
CHIPSET CL-GD544x
SERVER SVGA
+DRIVER cirrus
NOCLOCKPROBE
NAME Creative Labs Graphics Blaster MA201
@@ -162,13 +397,25 @@ SEE Cirrus Logic GD544x
NAME Cirrus Logic GD5462
CHIPSET CL-GD5462
SERVER SVGA
+DRIVER cirrus
NOCLOCKPROBE
+LINE #Option "fifo_conservative"
#tested
NAME Cirrus Logic GD5464
CHIPSET CL-GD5464
SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE #Option "fifo_conservative"
+
+#tested
+NAME Cirrus Logic GD5465
+CHIPSET CL-GD5465
+SERVER SVGA
+DRIVER cirrus
NOCLOCKPROBE
+LINE #Option "fifo_conservative"
NAME Creative Labs Graphics Blaster MA302
CHIPSET CL-GD5462
@@ -183,6 +430,13 @@ CHIPSET CL-GD5464
SEE Cirrus Logic GD5464
#tested
+NAME Cirrus Logic GD5480
+CHIPSET CL-GD5480
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+
+#tested
NAME Diamond SpeedStar 64
CHIPSET CL-GD5434
SEE Cirrus Logic GD543x
@@ -200,6 +454,7 @@ SEE Cirrus Logic GD542x
NAME Orchid Kelvin 64 VLB Rev A
CHIPSET CL-GD5434
SERVER SVGA
+DRIVER cirrus
NOCLOCKPROBE
LINE # Device section for Orchid Kelvin 64 VLB Rev A
LINE # Linear framebuffer maps at 2048Mb. Some motherboards make linear addressing
@@ -212,6 +467,7 @@ LINE #Option "linear"
NAME Orchid Kelvin 64 VLB Rev B
CHIPSET CL-GD5434
SERVER SVGA
+DRIVER cirrus
NOCLOCKPROBE
LINE # Device section for Orchid Kelvin 64 VLB Rev B
LINE # Linear framebuffer maps at 32Mb. Some motherboards make linear addressing
@@ -283,22 +539,90 @@ SEE Cirrus Logic GD543x
NAME Cirrus Logic GD62xx (laptop)
CHIPSET CL-GD6205/15/25/35
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME Cirrus Logic GD64xx (laptop)
CHIPSET CL-GD6420/6440
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Cirrus Logic GD754x (laptop)
CHIPSET CL-GD7541/42/43/48
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Techworks Ultimate 3D
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME VideoLogic GrafixStar 550
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME Jaton Video-70P
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME PixelView Combo TV Pro (Prolink)
+CHIPSET CL-GD5480, 4MB
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # COMMENT on card TV Tuner
+NOCLOCKPROBE
+
+NAME PixelView Combo TV 3D AGP (Prolink)
+CHIPSET CL-GD5465, 4MB
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # COMMENT on card TV+FM Tuner
+NOCLOCKPROBE
+
+NAME Creative Labs Graphics Blaster Eclipse (OEM Model CT6510)
+SEE Cirrus Logic GD5465
+
+NAME VideoLogic GrafixStar 560 (PCI/AGP)
+SEE Cirrus Logic GD5465
+
+NAME Cirrus Logic GD5446 (noname card)
+CHIPSET CL-GD5446, 1MB (upgradable to 2MB).
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
+NAME Octek VL-VGA-26
+CHIPSET CL-GD5426
+SEE Cirrus Logic GD542x
+
+NAME Octek VL-VGA-28
+CHIPSET CL-GD5428
+SEE Cirrus Logic GD542x
+
+NAME Octek Combo-26
+CHIPSET CL-GD5426
+SEE Cirrus Logic GD542x
+
+NAME Octek Combo-28
+CHIPSET CL-GD5428
+SEE Cirrus Logic GD542x
+
+NAME Octek AVGA-20
+SEE Cirrus Logic GD542x
+
# S3 801/805
NAME S3 801/805 (generic)
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
NAME S3 86C801 (generic)
SEE S3 801/805 (generic)
@@ -310,28 +634,38 @@ SEE S3 801/805 (generic)
NAME S3 801/805 with ATT20c490 RAMDAC
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
LINE #Option "dac_8_bit" # Not supported by some 20c490 clones
NAME S3 801/805 with SC1148{2,3,4} RAMDAC
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC sc11482
NAME S3 801/805 with SC1148{5,7,9} RAMDAC
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC sc11485
NAME S3 801/805 with S3 GenDAC
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC s3gendac
CLOCKCHIP s3gendac
NAME S3 801/805 with ATT20c490 RAMDAC and ICD2061A
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
CLOCKCHIP icd2061a
LINE #Option "dac_8_bit" # Not supported by some 20c490 clones
@@ -339,6 +673,8 @@ LINE #Option "dac_8_bit" # Not supported by some 20c490 clones
NAME S3 801/805 with Chrontel 8391
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
CLOCKCHIP ch8391
LINE Option "dac_8_bit"
@@ -347,21 +683,29 @@ LINE Option "dac_8_bit"
NAME Actix GE32+ 2MB
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
LINE #Option "dac_8_bit"
NAME Actix GE32i
CHIPSET S3 805i
SERVER S3
+DRIVER vga
+UNSUPPORTED
NAME Orchid Fahrenheit VA
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
NAME Orchid Fahrenheit 1280
CHIPSET S3 801
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Probable clocks:
LINE #Clocks 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00
LINE #Clocks 78.00 56.70 63.10 75.10 80.00 89.90 100.90 31.50
@@ -369,6 +713,8 @@ LINE #Clocks 78.00 56.70 63.10 75.10 80.00 89.90 100.90 31.50
NAME Orchid Fahrenheit-1280+
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20C490
LINE Dacspeed 110
LINE Option "dac_8_bit"
@@ -380,6 +726,8 @@ LINE #Clocks 130.0 120.20 80.0 31.50 110.30 65.0 75.0 94.60
NAME Diamond Stealth 24
CHIPSET S3 801/805
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
LINE #Option "nolinear"
LINE #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp
@@ -408,8 +756,9 @@ SEE S3 801/805 with Chrontel 8391
# S3 864/Trio64/Trio32/868
NAME S3 864 (generic)
-CHIPSET S3 864
SERVER S3
+DRIVER vga
+UNSUPPORTED
NAME S3 86C864 (generic)
SEE S3 864 (generic)
@@ -420,6 +769,8 @@ SEE S3 864 (generic)
NAME S3 864 with SDAC (86C716)
CHIPSET S3 864
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC s3_sdac
CLOCKCHIP s3_sdac
NOCLOCKPROBE
@@ -427,17 +778,23 @@ NOCLOCKPROBE
NAME S3 864 with ATT 20C498 or 21C498
CHIPSET S3 864
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c498
NAME S3 864 with STG1703
CHIPSET S3 864
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC stg1703
NOCLOCKPROBE
NAME S3 868 (generic)
CHIPSET S3 868
SERVER S3
+DRIVER vga
+UNSUPPORTED
NAME S3 86C868 (generic)
SEE S3 868 (generic)
@@ -448,16 +805,22 @@ SEE S3 868 (generic)
NAME S3 868 with SDAC (86C716)
CHIPSET S3 868
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME S3 868 with ATT 20C498 or 21C498
CHIPSET S3 868
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c498
NAME S3 868 with ATT 20C409
CHIPSET S3 868
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c409
NOCLOCKPROBE
@@ -466,16 +829,18 @@ CLOCKCHIP icd2061a
SEE S3 868 with ATT 20C498 or 21C498
NAME S3 Trio64 (generic)
-CHIPSET S3 Trio64
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME S3 86C764 (generic)
SEE S3 Trio64 (generic)
NAME S3 Trio64V+ (generic)
-CHIPSET S3 Trio64V+
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME S3 86C765 (generic)
@@ -484,6 +849,8 @@ SEE S3 Trio64V+ (generic)
NAME S3 Trio32 (generic)
CHIPSET S3 Trio32
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME Genoa Phantom 64i with S3 SDAC
@@ -493,6 +860,8 @@ SEE S3 864 with SDAC (86C716)
NAME Number Nine GXE64
CHIPSET S3 864
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
LINE Option "number_nine"
@@ -529,6 +898,8 @@ SEE S3 864 with SDAC (86C716)
NAME ELSA Winner 1000PRO with STG1700 or AT&T RAMDAC
CHIPSET S3 864
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
NAME ELSA Winner 1000PRO/X
@@ -537,6 +908,8 @@ SEE S3 868 with SDAC (86C716)
NAME ELSA Winner 1000ISA
CHIPSET S3 805i
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
LINE Option "dac_8_bit"
LINE # the following settings should be detected and set automatically by XF86_S3
@@ -626,8 +999,9 @@ SEE S3 Trio64V+ (generic)
# S3 Trio64V2
NAME S3 Trio64V2 (generic)
-CHIPSET S3 Trio64V2
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME S3 Trio64V2/DX (generic)
@@ -651,6 +1025,8 @@ SEE S3 Trio64V2/DX (generic)
NAME S3 Aurora64V+ (generic)
CHIPSET S3 Aurora64V+
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
LINE # Option "lcd_center"
LINE # Set_LCDClk <pixel_clock_for_LCD>
@@ -676,6 +1052,8 @@ SEE S3 Aurora64V+ (generic)
NAME S3 964 (generic)
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME S3 86C964 (generic)
@@ -687,6 +1065,8 @@ SEE S3 964 (generic)
NAME S3 968 (generic)
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME S3 86C968 (generic)
@@ -698,6 +1078,8 @@ SEE S3 968 (generic)
NAME Number Nine GXE64 Pro
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC ti3025
LINE Option "number_nine"
@@ -781,21 +1163,29 @@ SEE S3 964 (generic)
NAME Miro Crystal 20SV
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
NAME Miro Crystal 40SV
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP ti3025
NAME Miro Crystal 80SV
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME Miro Video 20SV
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c505
LINE #DacSpeed 150
CLOCKCHIP ics9161a
@@ -803,65 +1193,87 @@ CLOCKCHIP ics9161a
NAME SPEA Mercury 64
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP ics9161a
LINE #Option "spea_mercury"
NAME ELSA Winner 2000PRO-2
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "ELSA_w2000pro"
NOCLOCKPROBE
NAME ELSA Winner 2000PRO-4
CHIPSET S3 964
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "ELSA_w2000pro"
NOCLOCKPROBE
NAME ELSA Winner 2000PRO/X-2
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "sync_on_green"
NOCLOCKPROBE
NAME ELSA Winner 2000PRO/X-4
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "sync_on_green"
NOCLOCKPROBE
NAME ELSA Winner 2000PRO/X-8
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "sync_on_green"
NOCLOCKPROBE
NAME ELSA Winner 2000AVI
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "sync_on_green"
NOCLOCKPROBE
NAME ELSA Gloria-4
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "sync_on_green"
NOCLOCKPROBE
NAME ELSA Gloria-8
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Option "sync_on_green"
NOCLOCKPROBE
NAME VideoLogic GrafixStar 700
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME LeadTek WinFast S430
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME WinFast S430
@@ -870,6 +1282,8 @@ SEE LeadTek WinFast S430
NAME LeadTek WinFast S510
CHIPSET S3 968
SERVER S3
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME WinFast S510
@@ -880,6 +1294,8 @@ SEE LeadTek WinFast S510
NAME S3 928 (generic)
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
NAME S3 86C928 (generic)
SEE S3 928 (generic)
@@ -887,12 +1303,16 @@ SEE S3 928 (generic)
NAME Actix Ultra
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
LINE #Option "dac_8_bit"
NAME Diamond Stealth Pro
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
LINE #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp
LINE #Option "no_linear" # Some VLB machines may require this
@@ -900,6 +1320,8 @@ LINE #Option "no_linear" # Some VLB machines may require this
NAME ELSA Winner 1000VL
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE # the following settings should be detected and set automatically by XF86_S3
LINE # if the serial number of the ELSA card is printed correctly:
LINE #ClockChip "icd2061a"
@@ -917,12 +1339,16 @@ SEE S3 928 (generic)
NAME SPEA/V7 Mercury
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP sc11412
LINE Option "spea_mercury"
NAME STB Pegasus
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
RAMDAC bt485
CLOCKCHIP icd2061a
LINE Option "stb_pegasus"
@@ -931,6 +1357,8 @@ LINE #Option "sync_on_green"
NAME Number Nine GXE Level 14/16
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
DACSPEED 200
CLOCKCHIP icd2061a
LINE Option "number_nine"
@@ -940,12 +1368,16 @@ LINE #Option "nomemaccess"
NAME Number Nine GXE Level 10/11/12
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
LINE Option "number_nine"
NAME 928Movie
CHIPSET S3 928
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2595
RAMDAC bt485
LINE # pixel multiplexing not supported
@@ -955,6 +1387,8 @@ LINE # pixel multiplexing not supported
NAME S3 911/924 (generic)
CHIPSET S3 911/924
SERVER S3
+DRIVER vga
+UNSUPPORTED
NAME S3 86C911 (generic)
SEE S3 911/924 (generic)
@@ -965,6 +1399,8 @@ SEE S3 911/924 (generic)
NAME Diamond Stealth VRAM
CHIPSET S3 911/924
SERVER S3
+DRIVER vga
+UNSUPPORTED
CLOCKCHIP icd2061a
#NAME Orchid Fahrenheit 1280
@@ -973,6 +1409,8 @@ CLOCKCHIP icd2061a
NAME S3 924 with SC1148 DAC
CHIPSET S3 924
SERVER S3
+DRIVER vga
+UNSUPPORTED
LINE #Probable clocks:
LINE #Clocks 25.2 28.3 39.7 1.7 49.9 76.7 35.7 44
LINE #Clocks 130.2 119.5 79.4 31.2 110.0 65.2 74.9 71.3
@@ -982,11 +1420,13 @@ LINE #Clocks 130.2 119.5 79.4 31.2 110.0 65.2 74.9 71.3
NAME S3 ViRGE (old S3V server)
CHIPSET S3 ViRGE
SERVER S3V
+DRIVER s3virge
NOCLOCKPROBE
NAME S3 ViRGE (generic)
CHIPSET S3 ViRGE
SERVER SVGA
+DRIVER s3virge
NOCLOCKPROBE
LINE #Option "xaa_benchmark"
LINE #Option "fifo_moderate"
@@ -996,6 +1436,7 @@ LINE #Option "pci_retry"
NAME S3 ViRGE/DX (generic)
CHIPSET S3 ViRGE/DX
SERVER SVGA
+DRIVER s3virge
NOCLOCKPROBE
LINE #Option "xaa_benchmark"
LINE #Option "fifo_moderate"
@@ -1005,6 +1446,7 @@ LINE #Option "pci_retry"
NAME S3 ViRGE/GX (generic)
CHIPSET S3 ViRGE/GX
SERVER SVGA
+DRIVER s3virge
NOCLOCKPROBE
LINE #Option "xaa_benchmark"
LINE #Option "fifo_moderate"
@@ -1015,6 +1457,7 @@ LINE #Option "pci_retry"
NAME S3 ViRGE/GX2 (generic)
CHIPSET S3 ViRGE/GX2
SERVER SVGA
+DRIVER s3virge
NOCLOCKPROBE
LINE #Option "xaa_benchmark"
LINE #Option "fifo_moderate"
@@ -1024,6 +1467,7 @@ LINE #Option "pci_retry"
NAME S3 ViRGE/MX (generic)
CHIPSET S3 ViRGE/MX
SERVER SVGA
+DRIVER s3virge
NOCLOCKPROBE
LINE #Option "lcd_center"
LINE #Set_LCDClk <pixel_clock_for_LCD>
@@ -1032,6 +1476,9 @@ LINE #Option "fifo_moderate"
LINE #Option "pci_burst_on"
LINE #Option "pci_retry"
+NAME S3 ViRGE/MX+ (generic)
+SEE S3 ViRGE/MX (generic)
+
@@ -1050,6 +1497,9 @@ SEE S3 ViRGE/GX2 (generic)
NAME S3 86C260 (generic)
SEE S3 ViRGE/MX (generic)
+NAME S3 86C280 (generic)
+SEE S3 ViRGE/MX+ (generic)
+
NAME ELSA Victory 3D
SEE S3 ViRGE (generic)
@@ -1105,10 +1555,7 @@ SEE LeadTek WinFast 3D S600
NAME LeadTek WinFast 3D S680
SEE S3 ViRGE/GX2 (generic)
-NAME WinFast 3D S600
-SEE LeadTek WinFast 3D S680
-
-NAME miro miroMedia 3D
+NAME Miro MiroMedia 3D
SEE S3 ViRGE (generic)
NAME Orchid Technology Fahrenheit Video 3D
@@ -1131,6 +1578,7 @@ SEE S3 ViRGE (generic)
NAME S3 ViRGE/VX (generic)
CHIPSET S3 ViRGE/VX
SERVER SVGA
+DRIVER s3virge
NOCLOCKPROBE
LINE #Option "xaa_benchmark"
LINE #Option "fifo_moderate"
@@ -1162,6 +1610,8 @@ SEE S3 ViRGE/VX (generic)
NAME MELCO WGP-VX8
SEE S3 ViRGE/VX (generic)
+NAME Diamond Stealth 3D 4000
+SEE S3 ViRGE/GX2 (generic)
NAME Toshiba Tecra 750CDT
SEE S3 ViRGE/MX (generic)
@@ -1175,15 +1625,31 @@ SEE S3 ViRGE/MX (generic)
NAME Toshiba Tecra 550CDT
SEE S3 ViRGE/MX (generic)
+# currently unsupported S3
+NAME S3 86C365 (Trio3D)
+SEE * Unsupported VGA compatible
+NAME S3 86C391 (Savage3D)
+SEE * Unsupported VGA compatible
+NAME S3 Trio3D
+SEE * Unsupported VGA compatible
+
+NAME S3 Savage3D
+SEE * Unsupported VGA compatible
+
+NAME S3 Savage4
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
# ET4000/ET6000
NAME ET3000 (generic)
CHIPSET ET3000
SERVER SVGA
+DRIVER tseng
NAME Genoa 5400
SEE ET3000 (generic)
@@ -1191,14 +1657,17 @@ SEE ET3000 (generic)
NAME ET4000 (generic)
CHIPSET ET4000
SERVER SVGA
+DRIVER tseng
NAME ET4000/W32 (generic)
CHIPSET ET4000/W32
SERVER W32
+DRIVER tseng
NAME ET4000 W32i, W32p (generic)
CHIPSET ET4000/W32(i/p)
SERVER SVGA
+DRIVER tseng
LINE #Option "linear" # for linear mode at 8bpp
LINE #Option "noaccel" # when problems with accelerator
LINE #Option "power_saver" # enable VESA DPMS
@@ -1212,6 +1681,7 @@ LINE # -- see README.tseng for more (important) information on MemBase
NAME ET6000 (generic)
CHIPSET ET6000
SERVER SVGA
+DRIVER tseng
NOCLOCKPROBE
LINE #videoram 2304 # 2.25 MB, when memory probe is incorrect
LINE #Option "linear" # for linear mode at 8bpp
@@ -1223,8 +1693,7 @@ LINE #Option "xaa_no_color_exp" # When text (or bitmap) is not rendered cor
NAME ET6100 (generic)
CHIPSET ET6100
-SERVER XSuSE_Tseng
-NOCLOCKPROBE
+SEE ET6000 (generic)
NAME Diamond Stealth 32
CLOCKCHIP icd2061a
@@ -1358,184 +1827,174 @@ SEE ET6000 (generic)
NAME Interay PMC Viper
SEE ET6000 (generic)
-2-the-Max MAXColor 6000
+NAME 2-the-Max MAXColor 6000
SEE ET6000 (generic)
-Gainward Challenger EV
+NAME Gainward Challenger EV
SEE ET6000 (generic)
-MachSpeed VGA ET6000
+NAME MachSpeed VGA ET6000
SEE ET6000 (generic)
-KouTech KeyVision 128 EV
+NAME KouTech KeyVision 128 EV
SEE ET6000 (generic)
+NAME Jaton Video-58P
+SEE ET6000 (generic)
# ATI
+NAME ATI Rage 128
+CHIPSET ati
+SERVER SVGA
+DRIVER ati
+
NAME ATI 8514 Ultra (no VGA)
-CHIPSET ATI-Mach8
+CHIPSET ati
SERVER Mach8
+DRIVER vga
+UNSUPPORTED
NAME ATI Graphics Ultra
-CHIPSET ATI-Mach8
+CHIPSET ati
SERVER Mach8
-LINE #Probable clocks:
-LINE #Clocks 43 49 80 36 50 56 0 45 30 32 110 79 40 45 75 65
-LINE #Clocks 22 25 46 18 25 28 0 22 15 16 55 40 20 22 38 32
+DRIVER ati
NAME ATI Graphics Ultra Pro
-CHIPSET ATI-Mach32
+CHIPSET ati
SERVER Mach32
-LINE #Probable clocks:
-LINE #Clocks 100 126 92 36 51 57 0 44 135 32 110 80 39
-LINE #Clocks 45 75 65 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
-LINE #Option "dac_8_bit"
+DRIVER ati
NAME ATI Wonder SVGA
-CHIPSET ATI vgawonder
+CHIPSET ati
SERVER SVGA
-LINE #probable clocks:
-LINE #Clocks 30 32 11 80 42 48 92 36 40 45 75 65 50 56 0 0
-LINE #Clocks 15 16 55 0 21 24 46 18 20 22 37 32 25 28 0 0
+DRIVER ati
NAME ATI Ultra Plus
-CHIPSET ATI-Mach32
+CHIPSET ati
SERVER Mach32
+DRIVER ati
NAME ATI Mach32
-CHIPSET ATI-Mach32
+CHIPSET ati
SERVER Mach32
+DRIVER ati
NAME ATI Mach64
-CHIPSET ATI-Mach64
+CHIPSET ati
SERVER Mach64
+DRIVER ati
NOCLOCKPROBE
-NAME ATI Mach64 with AT&T 20C408 RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-LINE #Ramdac "att20c408"
-NOCLOCKPROBE
+NAME ATI Mach64 CT (264CT)
+SEE ATI Mach64
-NAME ATI Mach64 with CH8398 RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-LINE #Ramdac "ch8398"
-NOCLOCKPROBE
+NAME ATI Mach64 VT (264VT)
+SEE ATI Mach64
-NAME ATI Mach64 with IBM RGB514 RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-LINE #Ramdac "ibm_rgb514"
-NOCLOCKPROBE
+NAME ATI Mach64 GT (264GT), aka 3D RAGE
+SEE ATI Mach64
-NAME ATI Mach64 CT (264CT), Internal RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI Mach64 3D RAGE II
+SEE ATI Mach64
-NAME ATI Mach64 VT (264VT), Internal RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI Mach64 3D RAGE II+DVD
+SEE ATI Mach64
-NAME ATI Mach64 GT (264GT), aka 3D RAGE, Internal RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI Mach64 3D Rage IIC
+SEE ATI Mach64
-NAME ATI Mach64 3D RAGE II, Internal RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI Mach64 3D Rage Pro
+SEE ATI Mach64
-NAME ATI Mach64 3D RAGE II+, Internal RAMDAC
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI 3D Pro Turbo
+SEE ATI Mach64
-NAME ATI Xpert@Play PCI and AGP, 3D Rage Pro
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI 3D Pro Turbo PC2TV
+SEE ATI Mach64
-NAME ATI Xpert@Work, 3D Rage Pro
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI 3D Xpression
+SEE ATI Mach64
-NAME ATI Pro Turbo+PC2TV, 3D Rage II+DVD
-CHIPSET ATI-Mach64
-SERVER Mach64
-NOCLOCKPROBE
+NAME ATI 3D Xpression+
+SEE ATI Mach64
-NAME ATI Graphics Xpression with STG1702 RAMDAC
+NAME ATI 3D Xpression+ PC2TV
SEE ATI Mach64
-NAME ATI Graphics Xpression with 68875 RAMDAC
+NAME ATI All-in-Wonder
SEE ATI Mach64
-NAME ATI Graphics Xpression with CH8398 RAMDAC
-SEE ATI Mach64 with CH8398 RAMDAC
+NAME ATI All-in-Wonder Pro
+SEE ATI Mach64
-NAME ATI Graphics Xpression with AT&T 20C408 RAMDAC
-SEE ATI Mach64 with AT&T 20C408 RAMDAC
+NAME ATI Graphics Pro Turbo
+SEE ATI Mach64
-NAME ATI Graphics Xpression with Mach64 CT (264CT)
-SEE ATI Mach64 CT (264CT), Internal RAMDAC
+NAME ATI Graphics Pro Turbo 1600
+SEE ATI Mach64
-NAME ATI Video Xpression
-SEE ATI Mach64 VT (264VT), Internal RAMDAC
+NAME ATI Graphics Xpression
+SEE ATI Mach64
-NAME ATI 3D Xpression
-SEE ATI Mach64 GT (264GT), aka 3D RAGE, Internal RAMDAC
+NAME ATI Video Boost
+SEE ATI Mach64
-NAME ATI 3D Xpression+ PC2TV
-SEE ATI Mach64 3D RAGE II, Internal RAMDAC
+NAME ATI Video Charger
+SEE ATI Mach64
-NAME ATI 3D Pro Turbo
-SEE ATI Mach64 3D RAGE II, Internal RAMDAC
+NAME ATI Video Xpression
+SEE ATI Mach64
-NAME ATI All-in-Wonder
-SEE ATI Mach64 3D RAGE II+, Internal RAMDAC
+NAME ATI Video Xpression+
+SEE ATI Mach64
+
+NAME ATI WinBoost
+SEE ATI Mach64
-NAME ATI Win Boost with STG1702 RAMDAC
+NAME ATI WinCharger
SEE ATI Mach64
-NAME ATI Win Boost with CH8398 RAMDAC
-SEE ATI Mach64 with CH8398 RAMDAC
+NAME ATI WinTurbo
+SEE ATI Mach64
-NAME ATI Win Boost with AT&T 20C408 RAMDAC
-SEE ATI Mach64 with AT&T 20C408 RAMDAC
+NAME ATI Xpert 98
+SEE ATI Mach64
-NAME ATI Win Boost with Mach64 CT (264CT)
-SEE ATI Mach64 CT (264CT), Internal RAMDAC
+NAME ATI Xpert XL
+SEE ATI Mach64
-NAME ATI Graphics Pro Turbo
+NAME ATI Xpert@Play
SEE ATI Mach64
-NAME ATI Graphics Pro Turbo 1600
-SEE ATI Mach64 with IBM RGB514 RAMDAC
+NAME ATI Xpert@Play 98
+SEE ATI Mach64
+
+NAME ATI Xpert@Work
+SEE ATI Mach64
-NAME ATI Win Turbo
+NAME ATI integrated on Intel Maui MU440EX motherboard
SEE ATI Mach64
NAME ASUS PCI-V264CT
-SEE ATI Mach64 CT (264CT), Internal RAMDAC
+SEE ATI Mach64
NAME ASUS PCI-AV264CT
-SEE ATI Mach64 CT (264CT), Internal RAMDAC
+SEE ATI Mach64
# AGX
NAME AGX (generic)
CHIPSET AGX-014/15/16
SERVER AGX
+DRIVER vga
+UNSUPPORTED
NAME Boca Vortex (Sierra RAMDAC)
CHIPSET AGX-015
SERVER AGX
+DRIVER vga
+UNSUPPORTED
RAMDAC sc15025
LINE Option "dac_8_bit"
LINE Option "no_wait_state"
@@ -1547,6 +2006,8 @@ SEE AGX (generic)
NAME Orchid Celsius (AT&T RAMDAC)
CHIPSET AGX-015
SERVER AGX
+DRIVER vga
+UNSUPPORTED
RAMDAC att20c490
LINE Option "dac_8_bit"
LINE Option "no_wait_state"
@@ -1555,6 +2016,8 @@ LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
NAME Orchid Celsius (Sierra RAMDAC)
CHIPSET AGX-015
SERVER AGX
+DRIVER vga
+UNSUPPORTED
RAMDAC sc15025
LINE Option "dac_8_bit"
LINE Option "no_wait_state"
@@ -1564,6 +2027,8 @@ LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
NAME Spider Black Widow
CHIPSET AGX-015
SERVER AGX
+DRIVER vga
+UNSUPPORTED
RAMDAC sc15025
LINE Option "dac_8_bit"
LINE Option "no_wait_state"
@@ -1573,6 +2038,8 @@ LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
NAME Spider Black Widow Plus
CHIPSET AGX-016
SERVER AGX
+DRIVER vga
+UNSUPPORTED
RAMDAC sc15025
LINE Option "dac_8_bit"
LINE Option "no_wait_state"
@@ -1585,6 +2052,8 @@ LINE #Clocks 89.0 119.8 79.9 31.5 110.0 64.9 74.9 94.9
NAME Hercules Graphite HG210
CHIPSET AGX-014
SERVER AGX
+DRIVER vga
+UNSUPPORTED
RAMDAC bt482
DACSPEED 85
LINE Chipset "AGX-014"
@@ -1597,6 +2066,8 @@ LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
NAME Hercules Graphite Pro
CHIPSET AGX-015
SERVER AGX
+DRIVER vga
+UNSUPPORTED
# Card specific DAC, doesn't appear in ramdac menu
LINE Ramdac "herc_dual_dac"
LINE Chipset "AGX-015"
@@ -1610,6 +2081,8 @@ LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
NAME Hercules Graphite Power
CHIPSET AGX-016
SERVER AGX
+DRIVER vga
+UNSUPPORTED
# Card specific DAC, doesn't appear in ramdac menu
# The glue logic state machine for RAMDAC switching doesn't work as
# documented, for now we're stuck with the small RAMDAC
@@ -1626,6 +2099,8 @@ LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
NAME XGA-2 (ISA bus)
CHIPSET XGA-2
SERVER AGX
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
LINE #Instance 7 # XGA instance 0-7
LINE #COPbase 0xC8F00 # XGA memory-mapped register address
@@ -1634,6 +2109,8 @@ LINE #POSbase 0 # Disable probing if above are specified
NAME XGA-1 (ISA bus)
CHIPSET XGA-1
SERVER AGX
+DRIVER vga
+UNSUPPORTED
LINE #Instance 7 # XGA instance 0-7
LINE #COPbase 0xC8F00 # XGA memory-mapped register address
LINE #POSbase 0 # Disable probing if above are specified
@@ -1643,18 +2120,26 @@ LINE #POSbase 0 # Disable probing if above are specified
NAME Paradise/WD 90CXX
CHIPSET WD90CXX
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME DFI-WG6000
CHIPSET WD90C33
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Diamond SpeedStar 24X (not fully supported)
CHIPSET WD90C31
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME WD 90C24 (laptop)
CHIPSET WD90C24
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
LINE #Chipset "wd90c24"
LINE #Option "noaccel" # Use this if acceleration is causing problems
LINE #Clocks 25.175 28.322 65 36 # These are not programmable
@@ -1667,6 +2152,8 @@ LINE #Clocks 44.297 # Must match Mclk
NAME WD 90C24A or 90C24A2 (laptop)
CHIPSET WD90C24A
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
LINE #Chipset "wd90c24"
LINE #Clocks 25.175 28.322 65 36 # These are not programmable
LINE #Clocks 29.979 77.408 62.195 59.957 # These are programmable
@@ -1680,61 +2167,85 @@ NAME Avance Logic 2101
CHIPSET Avance Logic
LINE #chipset "al2101"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Avance Logic 2228
CHIPSET Avance Logic
LINE #chipset "ali2228"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Avance Logic 2301
CHIPSET Avance Logic
LINE #chipset "ali2301"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Avance Logic 2302
CHIPSET Avance Logic
LINE #chipset "ali2302"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Avance Logic 2308
CHIPSET Avance Logic
LINE #chipset "ali2308"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Avance Logic 2401
CHIPSET Avance Logic
LINE #chipset "ali2401"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Hercules Stingray
CHIPSET ALG-2228/2301/2302
LINE #chipset "ali2228"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME SPEA/V7 Mirage VEGA Plus
CHIPSET ALG-2228
LINE #chipset "ali2228"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
# ARK Logic
NAME Ark Logic ARK1000PV (generic)
CHIPSET ARK1000PV
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
# For now, treat the VL as a PV. This may be changed later
NAME Ark Logic ARK1000VL (generic)
CHIPSET ARK1000VL
LINE Chipset "ark1000pv"
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Ark Logic ARK2000PV (generic)
CHIPSET ARK1000PV
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Ark Logic ARK2000MT (generic)
CHIPSET ARK1000MT
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Hercules Stingray Pro
SEE Ark Logic ARK1000PV (generic)
@@ -1753,27 +2264,51 @@ NAME Hercules Stingray 64/V with ICS5342
CHIPSET ARK2000MT
RAMDAC ics5342
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Diamond Stealth64 Graphics 2001 series
CHIPSET ARK2000PV
RAMDAC ics5342
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
# Oak
-NAME Oak (generic)
-CHIPSET Oak-067/77/87
+NAME Oak ISA Card (generic)
+CHIPSET Oak OTI-067/77
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
-NAME Paradise Accelerator Value
+NAME Oak 87 VLB (generic)
CHIPSET Oak OTI-087
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE Option "fifo_aggressive" # Comment this if you experience streaks.
+LINE Option "no_wait" # Comment this if you find problems.
+LINE #Option "enable_bitblt" # You may enable this and see if it works (see README.Oak file)
+
+NAME Oak 87 ISA (generic)
+CHIPSET Oak OTI-087
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE Option "noaccel" # ISA cards seem to have Color Expansion support broken
+LINE #Option "enable_bitblt" # This should work on ISA, but lets not make it default just in case.
+
+NAME Paradise Accelerator Value
+SEE Oak 87 ISA (generic)
# P9000
NAME Diamond Viper VLB 2Mb
CHIPSET Weitek 9000
SERVER P9000
+DRIVER vga
+UNSUPPORTED
LINE #Clocks must match the mode clocks (XFree86 3.1 P9000 server)
LINE #Versions later than 3.1 do not require a clocks line
LINE Chipset "vipervlb" # Required for some cards which autodetect as PCI
@@ -1784,6 +2319,8 @@ NOCLOCKPROBE
NAME Diamond Viper PCI 2Mb
CHIPSET Weitek 9000
SERVER P9000
+DRIVER vga
+UNSUPPORTED
LINE #Clocks must match the mode clocks (XFree86 3.1 P9000 server)
LINE #Versions later than 3.1 do not require a clocks line
LINE Videoram 2048 # Required
@@ -1793,170 +2330,671 @@ NOCLOCKPROBE
NAME Orchid P9000 VLB
CHIPSET Weitek 9000
SERVER P9000
+DRIVER vga
+UNSUPPORTED
LINE Chipset "orchid_p9000"
LINE Membase 0xE0000000
NOCLOCKPROBE
+# P9100
+
+NAME Weitek P9100 (generic)
+CHIPSET Weitek P9100
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Diamond Viper Pro Video
+SEE Weitek P9100 (generic)
+
# Trident
NAME Trident 8900/9000 (generic)
CHIPSET TVGA8900/9000
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Trident 8900D (generic)
-CHIPSET TVGA8900D
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Trident TVGA9200CXr (generic)
CHIPSET TVGA9200CXr
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NAME Trident TGUI9400CXi (generic)
CHIPSET TGUI9400CXi
SERVER SVGA
+DRIVER trident
NAME Trident TGUI9420DGi (generic)
CHIPSET TGUI9420DGi
SERVER SVGA
+DRIVER trident
NAME Trident TGUI9430DGi (generic)
CHIPSET TGUI9430DGi
SERVER SVGA
+DRIVER trident
+
+NAME Trident TGUI9420 (generic)
+CHIPSET TGUI9420
+DRIVER trident
+NOCLOCKPROBE
NAME Trident TGUI9440 (generic)
CHIPSET TGUI9440
-SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
NAME Trident TGUI9660 (generic)
CHIPSET TGUI9660
-SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
NAME Trident TGUI9680 (generic)
CHIPSET TGUI9680
-SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
NAME Trident TGUI9682 (generic)
CHIPSET TGUI9682
SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
NAME Trident TGUI9685 (generic)
CHIPSET TGUI9685
SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9320 (generic)
+CHIPSET Cyber9320
+DRIVER trident
NOCLOCKPROBE
NAME Trident Cyber 9382 (generic)
CHIPSET Cyber9382
SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
NAME Trident Cyber 9385 (generic)
CHIPSET Cyber9385
SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
NAME Trident Cyber 9388 (generic)
CHIPSET Cyber9388
SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 939a (generic)
+CHIPSET Cyber939a
+DRIVER trident
NOCLOCKPROBE
NAME Trident Cyber 9397 (generic)
CHIPSET Cyber9397
SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9520 (generic)
+CHIPSET Cyber9520
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident 3DImage975 (generic)
+CHIPSET 3dimage975
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident 3DImage975 AGP (generic)
+CHIPSET 3dimage975
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident 3DImage985 (generic)
+CHIPSET 3dimage985
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Providia 9682 (generic)
+CHIPSET Providia9682
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Providia 9685 (generic)
+CHIPSET Providia9685
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TVGA 8800BR
+SEE * Generic VGA compatible
+
+NAME Trident TVGA 8800CS
+SEE * Generic VGA compatible
+
+NAME Trident CyberBlade (generic)
+CHIPSET CyberBlade
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Blade3D (generic)
+CHIPSET Blade3D
+SERVER SVGA
+DRIVER trident
NOCLOCKPROBE
# SiS
+NAME SiS 530
+CHIPSET SIS530
+SERVER SVGA
+DRIVER sis
+
+NAME SiS 620
+CHIPSET SIS620
+SERVER SVGA
+DRIVER sis
+
NAME SiS SG86C201
CHIPSET SIS86C201
SERVER SVGA
+DRIVER sis
-# Alliance ProMotion
+NAME SiS SG86C205
+CHIPSET SIS86C205
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+NOCLOCKPROBE
-NAME Alliance ProMotion 6422
-CHIPSET AP6422
+NAME SiS SG86C215
+CHIPSET SIS86C215
SERVER SVGA
+DRIVER sis
+LINE # This is a cheap version of 86c205. I am not sure if acceleration works
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "no_BitBlt" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+NOCLOCKPROBE
-# VGA
+NAME SiS SG86C225
+CHIPSET SIS86C225
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+NOCLOCKPROBE
-NAME Generic VGA compatible
-CHIPSET Generic VGA
-SERVER VGA16
+NAME SiS 5597
+CHIPSET SiS5597
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
+LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
+LINE # errors, but gives some accel
+NOCLOCKPROBE
-NAME Unsupported VGA compatible
-CHIPSET Generic VGA
-SERVER VGA16
+NAME SiS 5598
+CHIPSET SIS5598
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
+LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
+LINE # errors, but gives some accel
+NOCLOCKPROBE
+
+NAME SiS 6326
+CHIPSET SiS6326
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
+LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
+LINE # errors, but gives some accel
+NOCLOCKPROBE
+
+NAME MSI MS-4417
+SEE SiS 6326
+
+NAME SiS 3D PRO AGP
+SEE SiS 6326
+
+NAME Miro Crystal DVD
+SEE SiS 6326
+
+NAME PC-Chips M567 Mainboard
+SEE SiS 5597
+
+NAME Diamond SpeedStar A50
+SEE SiS 6326
+
+# Cyrix
+
+NAME MediaGX
+CHIPSET mediagx
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+# Alliance ProMotion
+
+NAME Alliance ProMotion 6422
+CHIPSET AP6422
+SERVER SVGA
+DRIVER vga
UNSUPPORTED
# Number 9 I128
-NAME Number Nine Imagine I-128 (2-8MB)
+NAME Number Nine Imagine I-128
+CHIPSET I128
+SERVER I128
+DRIVER i128
+NOCLOCKPROBE
+
+NAME Number Nine Imagine I-128 Series 2
+CHIPSET I128
+SERVER I128
+DRIVER i128
+NOCLOCKPROBE
+
+NAME Number Nine Revolution 3D (T2R)
CHIPSET I128
SERVER I128
+DRIVER i128
+NOCLOCKPROBE
-NAME Number Nine Imagine I-128 Series 2 (2-4MB)
+NAME Number Nine Imagine-128 Revolution IV (T2R4)
CHIPSET I128
SERVER I128
+DRIVER i128
+NOCLOCKPROBE
# Matrox
-NAME Matrox Millennium (MGA)
+NAME Matrox Millennium 2MB
+CHIPSET mga2064w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 2048
+NOCLOCKPROBE
+
+NAME Matrox Millennium 4MB
CHIPSET mga2064w
SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
NOCLOCKPROBE
-NAME Matrox Millennium II
+NAME Matrox Millennium 8MB
+CHIPSET mga2064w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium II 4MB
CHIPSET mga2164w
SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
NOCLOCKPROBE
-NAME Matrox Millennium II AGP
-CHIPSET mga2164w AGP
+NAME Matrox Millennium II 8MB
+CHIPSET mga2164w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium II 16MB
+CHIPSET mga2164w
SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 4MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 8MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 16MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 SD 4MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+LINE # Option "mga_sdram"
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 SD 8MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+LINE # Option "mga_sdram"
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 SD 16MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+LINE # Option "mga_sdram"
NOCLOCKPROBE
NAME Matrox Mystique
CHIPSET mga1064sg
SERVER SVGA
+DRIVER mga
+NOCLOCKPROBE
+
+NAME Matrox Mystique G200 4MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Mystique G200 8MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium G400
+CHIPSET mgag400
+SERVER SVGA
+DRIVER mga
+NOCLOCKPROBE
+
+NAME Matrox Mystique G200 16MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+NOCLOCKPROBE
+
+NAME Matrox Productiva G100 4MB
+CHIPSET mgag100
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Productiva G100 8MB
+CHIPSET mgag100
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
NOCLOCKPROBE
-# NV1
+# NVIDIA
NAME Diamond Edge 3D
CHIPSET nv1
SERVER SVGA
+DRIVER vga
+UNSUPPORTED
NOCLOCKPROBE
NAME RIVA128
CHIPSET RIVA128
SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME RIVA TNT
+CHIPSET RIVATNT
+SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME RIVA TNT2
+CHIPSET RIVATNT2
+SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME NVIDIA GeForce
+CHIPSET GeForce
+SERVER SVGA
+DRIVER nv
NOCLOCKPROBE
NAME ELSA VICTORY ERAZOR
SEE RIVA128
+NAME ELSA Winner 1000 R3D
+SEE RIVA128
+
+NAME ELSA ERAZOR II
+SEE RIVA TNT
+
NAME Diamond Viper 330
SEE RIVA128
+NAME Diamond Viper 550
+SEE RIVA TNT
+
+NAME Diamond Viper 770
+SEE RIVA TNT2
+
NAME STB Velocity 128
SEE RIVA128
+NAME STB nvidia 128
+SEE RIVA128
+
+NAME STB Velocity 4400
+SEE RIVA TNT
+
NAME ASUS 3Dexplorer
SEE RIVA128
+NAME Guillemot Maxi Gamer Xentor
+SEE RIVA TNT2
+
+NAME Guillemot Maxi Gamer Xentor 32
+SEE RIVA TNT2
+
+NAME Creative Graphics Blaster TNT
+SEE RIVA TNT
+
+NAME Creative Graphics Blaster TNT2
+SEE RIVA TNT2
+
+# 3Dfx
+NAME Voodoo Banshee (generic)
+SERVER SVGA
+CHIPSET Voodo Banshee
+DRIVER tdfx
+
+NAME Voodoo3 (generic)
+SERVER SVGA
+CHIPSET Voodoo3
+DRIVER tdfx
+
+NAME Elsa Victory II
+SEE Voodoo Banshee (generic)
+
+NAME Diamond Monster Fusion
+SEE Voodoo Banshee (generic)
+
+NAME AOpen PA2010
+SEE Voodoo Banshee (generic)
+
+NAME Chaintech Desperado 3F10
+SEE Voodoo Banshee (generic)
+
+# 3DLabs
+
+NAME ELSA GLoria-L/MX
+CHIPSET GLINT MX
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME ELSA GLoria-L
+CHIPSET GLINT 500TX
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+NAME ELSA GLoria-XL
+CHIPSET GLINT MX
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+NAME Diamond Fire GL 3000
+CHIPSET GLINT 500TX
+SERVER 3DLabs
+DRIVER glint
+LINE Option "firegl_3000"
+NOCLOCKPROBE
+
+NAME ELSA GLoria-S
+CHIPSET PERMEDIA
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+LINE #VideoRam 8192
+NOCLOCKPROBE
+
+NAME Diamond Fire GL 1000
+CHIPSET PERMEDIA
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+LINE #VideoRam 8192
+NOCLOCKPROBE
+
+NAME ELSA GLoria Synergy
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000/Office
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Diamond Fire GL 1000 PRO
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Creative Blaster Exxtreme
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME AccelStar Permedia II AGP
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Leadtek WinFast 2300
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+NAME 3DLabs Oxygen GMX
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Appian Jeronimo 2000
+CHIPSET PERMEDIA 3
+SERVER XFree86
+DRIVER glint
+NOCLOCKPROBE
+
# Alliance Semiconductor
NAME Diamond Stealth Video 2500
CHIPSET Alliance AT24
SERVER SVGA
+DRIVER apm
NOCLOCKPROBE
NAME AT3D
CHIPSET Alliance AT3D
SERVER SVGA
+DRIVER apm
NOCLOCKPROBE
LINE #Option "no_accel"
@@ -1966,26 +3004,68 @@ SEE AT3D
NAME Hercules Stingray 128 3D
SEE AT3D
-# Misc
+# NeoMagic
-NAME Techworks Ultimate 3D
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
+NAME NeoMagic (laptop/notebook)
+CHIPSET MagicGraph 128 series
+SERVER SVGA
+DRIVER neomagic
+LINE # Chipset "NM2160"
+LINE # IOBase 0xfea00000
+LINE # MemBase 0xfd000000
+LINE # VideoRam 2048
+LINE # DacSpeed 90
+LINE # Option "linear"
+LINE # Option "nolinear"
+LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
+LINE # Option "no_accel"
+LINE # Option "intern_disp"
+LINE # Option "extern_disp"
+LINE # Option "mmio"
+LINE # Option "no_mmio"
+LINE # Option "lcd_center"
+LINE # Option "no_stretch"
+
+# Epson SPC8110
+
+NAME EPSON SPC8110 (CardPC)
+CHIPSET SPC8110
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # Chipset "spc8110"
+LINE # MemBase 0x03e00000
+LINE # VideoRam 1024
+LINE # Option "nolinear"
+LINE # Option "sw_cursor"
+LINE # Option "noaccel"
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conservative"
-NAME VideoLogic GrafixStar 550
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
+# Silicon Motion, Inc.
-NAME Jaton Video-70P
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
+NAME Silicon Motion Lynx family
+CHIPSET Lynx
+SERVER SVGA
+DRIVER siliconmotion
+NOCLOCKPROBE
-NAME Jaton Video-58P
-SEE ET6000 (generic)
+# Rendition
NAME Rendition Verite 1000
CHIPSET Verite 1000
-SEE Unsupported VGA compatible
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # Option "sw_cursor"
+
+NAME Rendition Verite 2x00
+CHIPSET Verite 2x00
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # Option "sw_cursor"
NAME Creative Labs 3D Blaster PCI (Verite 1000)
SEE Rendition Verite 1000
@@ -1996,8 +3076,55 @@ SEE Rendition Verite 1000
NAME Sierra Screaming 3D
SEE Rendition Verite 1000
-NAME NeoMagic (laptop/notebook)
-CHIPSET NeoMagic 128/V/ZV
-SEE Unsupported VGA compatible
+NAME Miro CRYSTAL VRX
+SEE Rendition Verite 1000
+
+NAME Diamond Stealth II S220
+CHIPSET Verite 2100
+SEE Rendition Verite 2x00
+
+NAME Hercules Thriller3D
+CHIPSET Verite 2200
+SEE Rendition Verite 2x00
+
+# Digital
+
+NAME Digital 8-plane TGA (UDB/Multia)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt485
+
+NAME Digital 8-plane TGA (ZLXp-E1)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt485
+
+NAME Digital 24-plane TGA (ZLXp-E2)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt463
+
+NAME Digital 24-plane+3D TGA (ZLXp-E3)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt463
+
+# i810
+
+NAME Intel 810
+SERVER SVGA
+DRIVER i810
+
+# i740
+
+NAME Intel 740 (generic)
+SERVER SVGA
+DRIVER i740
+
+# Misc
END
diff --git a/hw/xfree86/utils/xorgconfig/cards.c b/hw/xfree86/utils/xorgconfig/cards.c
index a714d04ca..8aac06606 100644
--- a/hw/xfree86/utils/xorgconfig/cards.c
+++ b/hw/xfree86/utils/xorgconfig/cards.c
@@ -1,10 +1,10 @@
-/* $Xorg: cards.c,v 1.3 2000/08/17 19:53:05 cpqbld Exp $ */
+/* $XConsortium: cards.c /main/9 1996/10/19 18:15:32 kaleb $ */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.c,v 3.11.2.1 1998/01/18 10:35:45 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.c,v 3.17 2002/05/31 18:46:04 dawes Exp $ */
/*
* Functions to manipulate card database.
@@ -22,6 +22,7 @@
* NAME <name of card>
* CHIPSET <chipset description>
* SERVER <server name>
+ * DRIVER <driver name>
*
* Optional keywords:
* RAMDAC <ramdac identifier>
@@ -47,16 +48,13 @@ int lastcard;
Card card[MAX_CARDS];
-void sort_database();
-
-static int getline(f, l)
-FILE *f;
-char *l;
+static int
+getnextline(FILE *f, char *l)
{
if (fgets(l, 128, f) == NULL)
return -1;
-#ifdef __EMX__
+#ifdef __UNIXOS2__
{
char *p = strchr(l,'\r');
if (p) {
@@ -68,9 +66,8 @@ char *l;
return 0;
}
-static void appendstring(destp, src)
- char **destp;
- char *src;
+static void
+appendstring(char **destp, char *src)
{
char *newstr;
newstr = malloc(strlen(*destp) + strlen(src) + 1);
@@ -81,7 +78,8 @@ static void appendstring(destp, src)
*destp = newstr;
}
-int lookupcard( char *name ) {
+int
+lookupcard(char *name) {
int i;
for (i = 0; i <= lastcard; i++)
if (strcmp(name, card[i].name) == 0)
@@ -109,7 +107,7 @@ int parse_database() {
int i, lineno;
char filename[128];
-#ifndef __EMX__
+#ifndef __UNIXOS2__
strcpy(filename, CARD_DATABASE_FILE);
#else
strcpy(filename, (char*)__XOS2RedirRoot(CARD_DATABASE_FILE));
@@ -122,7 +120,7 @@ int parse_database() {
lineno = 0;
for (;;) {
- if (getline(f, buf))
+ if (getnextline(f, buf))
break;
lineno++;
if (buf[0] == '#')
@@ -133,7 +131,6 @@ int parse_database() {
break;
if (strncmp(buf, "LINE", 4) == 0 && lastcard>=0) {
/* Line of Device comment. */
- char *lines;
/* Append to existing lines. */
appendstring(&card[lastcard].lines, buf + 5);
continue;
@@ -158,7 +155,9 @@ int parse_database() {
card[lastcard].name = malloc(strlen(buf + 5) + 1);
strcpy(card[lastcard].name, buf + 5);
card[lastcard].chipset = NULL;
- card[lastcard].ramdac = NULL;
+ card[lastcard].server = NULL;
+ card[lastcard].driver = NULL;
+ card[lastcard].ramdac = NULL;
card[lastcard].clockchip = NULL;
card[lastcard].dacspeed = NULL;
card[lastcard].flags = 0;
@@ -182,6 +181,8 @@ int parse_database() {
card[lastcard].chipset = card[i].chipset;
if (card[lastcard].server == NULL)
card[lastcard].server = card[i].server;
+ if (card[lastcard].driver == NULL)
+ card[lastcard].driver = card[i].driver;
if (card[lastcard].ramdac == NULL)
card[lastcard].ramdac = card[i].ramdac;
if (card[lastcard].clockchip == NULL)
@@ -204,6 +205,12 @@ int parse_database() {
strcpy(card[lastcard].server, buf + 7);
continue;
}
+ if (strncmp(buf, "DRIVER", 6) == 0) {
+ /* Driver identifier. */
+ card[lastcard].driver = malloc(strlen(buf + 7) + 1);
+ strcpy(card[lastcard].driver, buf + 7);
+ continue;
+ }
if (strncmp(buf, "RAMDAC", 6) == 0) {
/* Ramdac indentifier. */
card[lastcard].ramdac = malloc(strlen(buf + 7) + 1);
@@ -232,12 +239,12 @@ int parse_database() {
continue;
}
/* test for missing required fields */
- if (card[lastcard].server == NULL) {
- fprintf(stderr, "Warning SERVER specification missing "
+ if (card[lastcard].driver == NULL) {
+ fprintf(stderr, "Warning DRIVER specification missing "
"in Card database entry %s (line %d).\n",
card[lastcard].name, lineno);
keypress();
- card[lastcard].server = "unknown";
+ card[lastcard].driver = "unknown";
}
if (card[lastcard].chipset == NULL) {
fprintf(stderr, "Warning CHIPSET specification missing "
@@ -266,20 +273,14 @@ int parse_database() {
return 0;
}
-#ifdef __STDC__
-#define CONST const
-#else
-#define CONST
-#endif
-
-static int compare_card(e1, e2)
- CONST void *e1;
- CONST void *e2;
+static int
+compare_card(const void *e1, const void *e2)
{
return strcmp(((Card *)e1)->name, ((Card *)e2)->name);
}
-void sort_database() {
+void
+sort_database() {
/* Each element is a bunch of words, but nothing too bad. */
qsort(card, lastcard + 1, sizeof(Card), compare_card);
}
diff --git a/hw/xfree86/utils/xorgconfig/cards.h b/hw/xfree86/utils/xorgconfig/cards.h
index 11976d978..c5299e899 100644
--- a/hw/xfree86/utils/xorgconfig/cards.h
+++ b/hw/xfree86/utils/xorgconfig/cards.h
@@ -1,10 +1,10 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.h,v 3.3 1996/12/23 07:04:44 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.h,v 3.5 1999/07/05 12:12:06 dawes Exp $ */
-/* $Xorg: cards.h,v 1.3 2000/08/17 19:53:05 cpqbld Exp $ */
+/* $XConsortium: cards.h /main/3 1996/02/21 18:12:53 kaleb $ */
#ifndef CARD_DATABASE_FILE
#define CARD_DATABASE_FILE "Cards"
@@ -16,7 +16,8 @@ typedef struct {
char *name; /* Name of the card. */
char *chipset; /* Chipset (decriptive). */
char *server; /* Server identifier. */
- char *ramdac; /* Ramdac identifier. */
+ char *driver; /* Driver identifier. */
+ char *ramdac; /* Ramdac identifier. */
char *clockchip; /* Clockchip identifier. */
char *dacspeed; /* DAC speed rating. */
int flags;
@@ -31,6 +32,7 @@ extern int lastcard;
extern Card card[MAX_CARDS];
-
-int parse_database();
-
+extern int lookupcard ( char *name );
+extern int parse_database ( void );
+extern void sort_database ( void );
+extern void keypress ( void );
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 76e71aeee..61b560800 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -30,8 +30,6 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Args.h"
-#define lowbit(x) ((x) & (~(x) + 1))
-
static ColormapPtr InstalledMaps[MAXSCREENS];
Bool xnestCreateColormap(pCmap)
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 6915df7a2..c20ec940a 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Cursor.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "screenint.h"
@@ -26,7 +28,7 @@ is" without express or implied warranty.
#include "Display.h"
#include "Screen.h"
-#include "Cursor.h"
+#include "XNCursor.h"
#include "Visual.h"
#include "Keyboard.h"
#include "Args.h"
diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index 5f3bdb9a5..d8cefcc6f 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -12,10 +12,11 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Display.c,v 3.4 2001/10/28 03:34:10 tsi Exp $ */
-#include "X.h"
-#include "Xproto.h"
+#include <X11/X.h>
+#include <X11/Xproto.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -89,7 +90,7 @@ void xnestOpenDisplay(argc, argv)
break;
}
if (xnestDefaultVisualIndex == UNDEFINED)
- FatalError("Uable to find desird default visual.\n");
+ FatalError("Unable to find desired default visual.\n");
}
else {
vi.visualid = XVisualIDFromVisual(DefaultVisual(xnestDisplay,
@@ -184,8 +185,6 @@ void xnestOpenDisplay(argc, argv)
void xnestCloseDisplay()
{
- int i;
-
if (!xnestDoFullGeneration || !xnestDisplay) return;
/*
diff --git a/hw/xnest/Display.h b/hw/xnest/Display.h
index 3699d18d5..14ed0bb0a 100644
--- a/hw/xnest/Display.h
+++ b/hw/xnest/Display.h
@@ -12,6 +12,7 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Display.h,v 1.6 2001/01/17 22:36:55 dawes Exp $ */
#ifndef XNESTCOMMON_H
#define XNESTCOMMON_H
@@ -19,7 +20,7 @@ is" without express or implied warranty.
#define UNDEFINED -1
#define MAXDEPTH 32
-#define MAXVISUALSPERDEPTH 6
+#define MAXVISUALSPERDEPTH 256
extern Display *xnestDisplay;
extern XVisualInfo *xnestVisuals;
diff --git a/hw/xnest/Drawable.h b/hw/xnest/Drawable.h
index 47b723731..6f52b286b 100644
--- a/hw/xnest/Drawable.h
+++ b/hw/xnest/Drawable.h
@@ -12,12 +12,13 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Drawable.h,v 1.3 2002/11/23 19:27:50 tsi Exp $ */
#ifndef XNESTDRAWABLE_H
#define XNESTDRAWABLE_H
#include "XNWindow.h"
-#include "Pixmap.h"
+#include "XNPixmap.h"
#define xnestDrawable(pDrawable) \
((pDrawable)->type == DRAWABLE_WINDOW ? \
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 760f1962a..729296f22 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Events.c,v 1.2 2001/08/01 00:44:57 tsi Exp $ */
+
#include "X.h"
#define NEED_EVENTS
#include "Xproto.h"
@@ -22,8 +24,11 @@ is" without express or implied warranty.
#include "windowstr.h"
#include "servermd.h"
+#include "mi.h"
+
#include "Xnest.h"
+#include "Color.h"
#include "Display.h"
#include "Screen.h"
#include "XNWindow.h"
diff --git a/hw/xnest/Font.c b/hw/xnest/Font.c
index 562db362d..b30cf45bf 100644
--- a/hw/xnest/Font.c
+++ b/hw/xnest/Font.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Font.c,v 3.5 2001/01/17 22:36:55 dawes Exp $ */
+
#include "X.h"
#include "Xatom.h"
#include "Xproto.h"
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 3e16c95c2..0816957de 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/GC.c,v 3.6 2001/10/28 03:34:11 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "gcstruct.h"
@@ -130,11 +132,12 @@ void xnestChangeGC(pGC, mask)
if (mask & GCFillRule)
values.fill_rule = pGC->fillRule;
- if (mask & GCTile)
+ if (mask & GCTile) {
if (pGC->tileIsPixel)
mask &= ~GCTile;
else
values.tile = xnestPixmap(pGC->tile.pixmap);
+ }
if (mask & GCStipple)
values.stipple = xnestPixmap(pGC->stipple);
@@ -279,9 +282,8 @@ void xnestChangeClip(pGC, type, pValue, nRects)
* other parts of server can only deal with CT_NONE,
* CT_PIXMAP and CT_REGION client clips.
*/
- pGC->clientClip = (pointer) (*pGC->pScreen->RectsToRegion)(nRects,
- (xRectangle *)pValue,
- type);
+ pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nRects,
+ (xRectangle *)pValue, type);
xfree(pValue);
pValue = pGC->clientClip;
type = CT_REGION;
@@ -326,8 +328,6 @@ void xnestCopyClip(pGCDst, pGCSrc)
GCPtr pGCDst;
{
RegionPtr pRgn;
- int nRects, size;
- xRectangle *pRects;
switch (pGCSrc->clientClipType)
{
diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index 745fd602f..3af24c35a 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/GCOps.c,v 3.4 2001/01/17 22:36:55 dawes Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "miscstruct.h"
diff --git a/hw/xnest/Handlers.c b/hw/xnest/Handlers.c
index 6feddebd7..d65116b0d 100644
--- a/hw/xnest/Handlers.c
+++ b/hw/xnest/Handlers.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Handlers.c,v 1.2 2001/08/01 00:44:57 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "screenint.h"
@@ -24,6 +26,7 @@ is" without express or implied warranty.
#include "Xnest.h"
#include "Display.h"
+#include "Events.h"
#include "Handlers.h"
void xnestBlockHandler(blockData, pTimeout, pReadMask)
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 00cd4f9ac..665aec182 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.24 2003/01/15 02:34:14 torrey Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "screenint.h"
@@ -20,6 +22,8 @@ is" without express or implied warranty.
#include "scrnintstr.h"
#include "windowstr.h"
#include "servermd.h"
+#include "mi.h"
+#include "fontstruct.h"
#include "Xnest.h"
@@ -53,7 +57,8 @@ void InitOutput(screenInfo, argc, argv)
screenInfo->numPixmapFormats = 0;
for (i = 0; i < xnestNumPixmapFormats; i++)
for (j = 0; j < xnestNumDepths; j++)
- if (xnestPixmapFormats[i].depth == xnestDepths[j]) {
+ if ((xnestPixmapFormats[i].depth == 1) ||
+ (xnestPixmapFormats[i].depth == xnestDepths[j])) {
screenInfo->formats[screenInfo->numPixmapFormats].depth =
xnestPixmapFormats[i].depth;
screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
@@ -61,6 +66,7 @@ void InitOutput(screenInfo, argc, argv)
screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
xnestPixmapFormats[i].scanline_pad;
screenInfo->numPixmapFormats++;
+ break;
}
xnestWindowPrivateIndex = AllocateWindowPrivateIndex();
@@ -81,8 +87,8 @@ void InitInput(argc, argv)
int argc;
char *argv[];
{
- DevicePtr ptr, kbd;
-
+ pointer ptr, kbd;
+
ptr = AddInputDevice(xnestPointerProc, TRUE);
kbd = AddInputDevice(xnestKeyboardProc, TRUE);
@@ -111,11 +117,39 @@ void ddxGiveUp()
AbortDDX();
}
+#ifdef __DARWIN__
+void
+DarwinHandleGUI(int argc, char *argv[])
+{
+}
+
+void GlxExtensionInit();
+void GlxWrapInitVisuals(void *procPtr);
+
+void
+DarwinGlxExtensionInit()
+{
+ GlxExtensionInit();
+}
+
+void
+DarwinGlxWrapInitVisuals(
+ void *procPtr)
+{
+ GlxWrapInitVisuals(procPtr);
+}
+#endif
+
void OsVendorInit()
{
return;
}
+void OsVendorFatalError()
+{
+ return;
+}
+
/* this is just to get the server to link on AIX */
#ifdef AIXV3
int SelectWaitTime = 10000; /* usec */
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index ce5d57f5d..107caee90 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.8 2001/10/28 03:34:11 tsi Exp $ */
+
#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
@@ -29,6 +31,63 @@ is" without express or implied warranty.
#include "Keyboard.h"
#include "Args.h"
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBsrv.h>
+#include <X11/extensions/XKBconfig.h>
+
+extern Bool XkbQueryExtension(
+#if NeedFunctionPrototypes
+ Display * /* dpy */,
+ int * /* opcodeReturn */,
+ int * /* eventBaseReturn */,
+ int * /* errorBaseReturn */,
+ int * /* majorRtrn */,
+ int * /* minorRtrn */
+#endif
+);
+
+extern XkbDescPtr XkbGetKeyboard(
+#if NeedFunctionPrototypes
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* deviceSpec */
+#endif
+);
+
+extern Status XkbGetControls(
+#if NeedFunctionPrototypes
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+#endif
+);
+
+#ifndef XKB_BASE_DIRECTORY
+#define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/"
+#endif
+#ifndef XKB_CONFIG_FILE
+#define XKB_CONFIG_FILE "X0-config.keyboard"
+#endif
+#ifndef XKB_DFLT_RULES_FILE
+#define XKB_DFLT_RULES_FILE "xfree86"
+#endif
+#ifndef XKB_DFLT_KB_LAYOUT
+#define XKB_DFLT_KB_LAYOUT "us"
+#endif
+#ifndef XKB_DFLT_KB_MODEL
+#define XKB_DFLT_KB_MODEL "pc101"
+#endif
+#ifndef XKB_DFLT_KB_VARIANT
+#define XKB_DFLT_KB_VARIANT NULL
+#endif
+#ifndef XKB_DFLT_KB_OPTIONS
+#define XKB_DFLT_KB_OPTIONS NULL
+#endif
+
+extern Bool noXkbExtension;
+#endif
+
void xnestBell(volume, pDev, ctrl, cls)
int volume;
DeviceIntPtr pDev;
@@ -42,6 +101,7 @@ void xnestChangeKeyboardControl(pDev, ctrl)
DeviceIntPtr pDev;
KeybdCtrl *ctrl;
{
+#if 0
unsigned long value_mask;
XKeyboardControl values;
int i;
@@ -73,6 +133,7 @@ void xnestChangeKeyboardControl(pDev, ctrl)
values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff;
XChangeKeyboardControl(xnestDisplay, value_mask, &values);
}
+#endif
}
int xnestKeyboardProc(pDev, onoff, argc, argv)
@@ -120,9 +181,9 @@ int xnestKeyboardProc(pDev, onoff, argc, argv)
for (j = 0; j < 8; j++)
for(i = 0; i < modifier_keymap->max_keypermod; i++) {
CARD8 keycode;
- if (keycode =
+ if ((keycode =
modifier_keymap->
- modifiermap[j * modifier_keymap->max_keypermod + i])
+ modifiermap[j * modifier_keymap->max_keypermod + i]))
modmap[keycode] |= 1<<j;
}
XFreeModifiermap(modifier_keymap);
@@ -132,6 +193,10 @@ int xnestKeyboardProc(pDev, onoff, argc, argv)
keySyms.mapWidth = mapWidth;
keySyms.map = keymap;
+#ifdef XKB
+ if (noXkbExtension) {
+XkbError:
+#endif
XGetKeyboardControl(xnestDisplay, &values);
memmove((char *) defaultKeyboardControl.autoRepeats,
@@ -139,7 +204,73 @@ int xnestKeyboardProc(pDev, onoff, argc, argv)
InitKeyboardDeviceStruct(pDev, &keySyms, modmap,
xnestBell, xnestChangeKeyboardControl);
+#ifdef XKB
+ } else {
+ FILE *file;
+ XkbConfigRtrnRec config;
+
+ XkbComponentNamesRec names;
+ char *rules, *model, *layout, *variants, *options;
+
+ XkbDescPtr xkb;
+ int op, event, error, major, minor;
+
+ if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) {
+ ErrorF("Unable to initialize XKEYBOARD extension.\n");
+ goto XkbError;
+ }
+ xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
+ if (xkb == NULL || xkb->geom == NULL) {
+ ErrorF("Couldn't get keyboard.\n");
+ goto XkbError;
+ }
+ XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
+
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+ rules = XKB_DFLT_RULES_FILE;
+ model = XKB_DFLT_KB_MODEL;
+ layout = XKB_DFLT_KB_LAYOUT;
+ variants = XKB_DFLT_KB_VARIANT;
+ options = XKB_DFLT_KB_OPTIONS;
+ if (XkbInitialMap) {
+ if ((names.keymap = strchr(XkbInitialMap, '/')) != NULL)
+ ++names.keymap;
+ else
+ names.keymap = XkbInitialMap;
+ }
+
+ if ((file = fopen(XKB_BASE_DIRECTORY XKB_CONFIG_FILE, "r")) != NULL) {
+ if (XkbCFParse(file, XkbCFDflts, xkb, &config) == 0) {
+ ErrorF("Error parsing config file.\n");
+ fclose(file);
+ goto XkbError;
+ }
+ if (config.rules_file)
+ rules = config.rules_file;
+ if (config.model)
+ model = config.model;
+ if (config.layout)
+ layout = config.layout;
+ if (config.variant)
+ variants = config.variant;
+ if (config.options)
+ options = config.options;
+
+ fclose(file);
+ }
+
+ XkbSetRulesDflts(rules, model, layout, variants, options);
+ XkbInitKeyboardDeviceStruct((pointer)pDev, &names, &keySyms, modmap,
+ xnestBell, xnestChangeKeyboardControl);
+ XkbDDXChangeControls((pointer)pDev, xkb->ctrls, xkb->ctrls);
+ XkbFreeKeyboard(xkb, 0, False);
+ }
+#endif
+#ifdef _XSERVER64
+ xfree(keymap);
+#else
XFree(keymap);
+#endif
break;
case DEVICE_ON:
xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 51180a4f5..f93dcac52 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Pixmap.c,v 3.6 2003/01/10 13:29:40 eich Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "miscstruct.h"
@@ -26,7 +28,11 @@ is" without express or implied warranty.
#include "Display.h"
#include "Screen.h"
-#include "Pixmap.h"
+#include "XNPixmap.h"
+
+#ifdef PIXPRIV
+int xnestPixmapPrivateIndex;
+#endif
PixmapPtr xnestCreatePixmap(pScreen, width, height, depth)
ScreenPtr pScreen;
@@ -36,7 +42,7 @@ PixmapPtr xnestCreatePixmap(pScreen, width, height, depth)
{
PixmapPtr pPixmap;
- pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + sizeof(xnestPrivPixmap));
+ pPixmap = AllocatePixmap(pScreen, sizeof(xnestPrivPixmap));
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
@@ -52,7 +58,12 @@ PixmapPtr xnestCreatePixmap(pScreen, width, height, depth)
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
+#ifdef PIXPRIV
+ pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr =
+ (pointer)((char *)pPixmap + pScreen->totalPixmapSize);
+#else
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
+#endif
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
@@ -82,7 +93,6 @@ RegionPtr xnestPixmapToRegion(pPixmap)
register int x, y;
unsigned long previousPixel, currentPixel;
BoxRec Box;
- int nWidth;
Bool overlap;
ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0,
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 4d718cb5d..bef6a75dd 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.11 2003/01/10 13:29:40 eich Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "scrnintstr.h"
@@ -25,27 +27,27 @@ is" without express or implied warranty.
#include "Display.h"
#include "Screen.h"
-#include "Args.h"
#include "XNGC.h"
#include "GCOps.h"
#include "Drawable.h"
#include "XNFont.h"
#include "Color.h"
-#include "Cursor.h"
+#include "XNCursor.h"
#include "Visual.h"
#include "Events.h"
#include "Init.h"
+#include "mipointer.h"
#include "Args.h"
-extern Bool miModifyPixmapHeader();
-extern Bool miCreateScreenResources();
-extern Bool miCloseScreen();
-extern Bool miScreenInit();
extern Window xnestParentWindow;
Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
+#ifdef PIXPRIV
+int xnestScreenGeneration = -1;
+#endif
+
ScreenPtr xnestScreen(window)
Window window;
{
@@ -102,6 +104,28 @@ static Bool xnestSaveScreen(pScreen, what)
}
}
+static Bool
+xnestCursorOffScreen (ppScreen, x, y)
+ ScreenPtr *ppScreen;
+ int *x, *y;
+{
+ return FALSE;
+}
+
+static void
+xnestCrossScreen (pScreen, entering)
+ ScreenPtr pScreen;
+ Bool entering;
+{
+}
+
+static miPointerScreenFuncRec xnestPointerCursorFuncs =
+{
+ xnestCursorOffScreen,
+ xnestCrossScreen,
+ miPointerWarpCursor
+};
+
Bool xnestOpenScreen(index, pScreen, argc, argv)
int index;
register ScreenPtr pScreen;
@@ -123,6 +147,17 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
sizeof(xnestPrivGC))))
return False;
+#ifdef PIXPRIV
+ if (xnestScreenGeneration != serverGeneration) {
+ if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
+ return False;
+ xnestScreenGeneration = serverGeneration;
+ }
+
+ if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
+ sizeof (xnestPrivPixmap)))
+ return False;
+#endif
visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
numVisuals = 0;
@@ -160,6 +195,9 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
(VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
numDepths++;
}
+ if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
+ FatalError("Visual table overflow");
+ }
depths[depthIndex].vids[depths[depthIndex].numVids] =
visuals[numVisuals].vid;
depths[depthIndex].numVids++;
@@ -179,7 +217,11 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
visuals[xnestDefaultVisualIndex].nplanes, /* rootDepth */
numDepths, depths,
visuals[xnestDefaultVisualIndex].vid, /* root visual */
- numVisuals, visuals, NULL);
+ numVisuals, visuals);
+
+ miInitializeBackingStore(pScreen);
+
+ miDCInitialize(pScreen, &xnestPointerCursorFuncs);
pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
DefaultScreen(xnestDisplay)) /
diff --git a/hw/xnest/TestExt.c b/hw/xnest/TestExt.c
index 7898bcd14..7f5a5907d 100644
--- a/hw/xnest/TestExt.c
+++ b/hw/xnest/TestExt.c
@@ -12,13 +12,18 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
-#include "X.h"
-#include "Xproto.h"
+/* $XFree86: xc/programs/Xserver/hw/xnest/TestExt.c,v 3.5 2001/08/27 17:41:00 dawes Exp $ */
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xlib.h>
+#undef Bool
#include "screenint.h"
#include "input.h"
#include "misc.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "mipointer.h"
#define XTestSERVER_SIDE
#include "xtestext1.h"
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index e345b49d1..a5dfc2de1 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -12,6 +12,8 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.7 2001/10/28 03:34:11 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "gcstruct.h"
@@ -22,6 +24,8 @@ is" without express or implied warranty.
#include "scrnintstr.h"
#include "region.h"
+#include "mi.h"
+
#include "Xnest.h"
#include "Display.h"
@@ -288,23 +292,26 @@ Bool xnestChangeWindowAttributes(pWin, mask)
break;
}
- if (mask & CWBackPixel)
+ if (mask & CWBackPixel) {
if (pWin->backgroundState == BackgroundPixel)
attributes.background_pixel = xnestPixel(pWin->background.pixel);
else
mask &= ~CWBackPixel;
+ }
- if (mask & CWBorderPixmap)
+ if (mask & CWBorderPixmap) {
if (pWin->borderIsPixel)
mask &= ~CWBorderPixmap;
else
attributes.border_pixmap = xnestPixmap(pWin->border.pixmap);
+ }
- if (mask & CWBorderPixel)
+ if (mask & CWBorderPixel) {
if (pWin->borderIsPixel)
attributes.border_pixel = xnestPixel(pWin->border.pixel);
else
mask &= ~CWBorderPixel;
+ }
if (mask & CWBitGravity)
attributes.bit_gravity = pWin->bitGravity;
@@ -488,7 +495,6 @@ void xnestShapeWindow(pWin)
BoxPtr pBox;
XRectangle rect;
int i;
- Bool overlap;
if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
wBoundingShape(pWin))) {
diff --git a/hw/xnest/Xnest.h b/hw/xnest/Xnest.h
index 5ced40e28..64b09de7e 100644
--- a/hw/xnest/Xnest.h
+++ b/hw/xnest/Xnest.h
@@ -28,6 +28,7 @@ other dealings in this Software without prior written authorization
from the X Consortium.
*/
+/* $XFree86: xc/programs/Xserver/hw/xnest/Xnest.h,v 1.3 2001/08/28 16:48:08 tsi Exp $ */
/*
** Machines with a 64 bit library interface and a 32 bit server require
@@ -65,8 +66,8 @@ typedef XID KeySym64;
#endif /*_XSERVER64*/
#define GC XlibGC
-#include "Xlib.h"
-#include "Xutil.h"
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
#include <X11/extensions/shape.h>
#undef GC
diff --git a/hw/xnest/Xnest.man.pre b/hw/xnest/Xnest.man.pre
index 608c30dd1..474569a47 100644
--- a/hw/xnest/Xnest.man.pre
+++ b/hw/xnest/Xnest.man.pre
@@ -24,7 +24,10 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from the X Consortium.
-.TH XNEST 1 "Release 6.4" "X Version 11"
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/xnest/Xnest.man,v 1.6 2001/01/27 18:21:00 dawes Exp $
+.\"
+.TH XNEST 1 __xorgversion__
.SH NAME
Xnest \- a nested X server
.SH SYNOPSIS
diff --git a/include/closestr.h b/include/closestr.h
index 323a971bb..3bcb92634 100644
--- a/include/closestr.h
+++ b/include/closestr.h
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/include/closestr.h,v 3.4 2001/12/14 19:59:53 dawes Exp $ */
#ifndef CLOSESTR_H
@@ -102,6 +103,18 @@ typedef struct _LFclosure {
/* PolyText */
+typedef
+ int (* PolyTextPtr)(
+#if NeedNestedPrototypes
+ DrawablePtr /* pDraw */,
+ GCPtr /* pGC */,
+ int /* x */,
+ int /* y */,
+ int /* count */,
+ void * /* chars or shorts */
+#endif
+ );
+
typedef struct _PTclosure {
ClientPtr client;
DrawablePtr pDraw;
@@ -112,7 +125,7 @@ typedef struct _PTclosure {
int xorg;
int yorg;
CARD8 reqType;
- int (* polyText)();
+ PolyTextPtr polyText;
int itemSize;
XID did;
int err;
@@ -121,6 +134,18 @@ typedef struct _PTclosure {
/* ImageText */
+typedef
+ void (* ImageTextPtr)(
+#if NeedNestedPrototypes
+ DrawablePtr /* pDraw */,
+ GCPtr /* pGC */,
+ int /* x */,
+ int /* y */,
+ int /* count */,
+ void * /* chars or shorts */
+#endif
+ );
+
typedef struct _ITclosure {
ClientPtr client;
DrawablePtr pDraw;
@@ -130,7 +155,7 @@ typedef struct _ITclosure {
int xorg;
int yorg;
CARD8 reqType;
- void (* imageText)();
+ ImageTextPtr imageText;
int itemSize;
XID did;
Bool slept;
diff --git a/include/colormap.h b/include/colormap.h
index e2515a8ed..2a8f87f23 100644
--- a/include/colormap.h
+++ b/include/colormap.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.5 2001/12/14 19:59:53 dawes Exp $ */
/*
Copyright 1987, 1998 The Open Group
@@ -45,6 +46,7 @@ SOFTWARE.
*/
/* $Xorg: colormap.h,v 1.4 2001/02/09 02:05:14 xorgcvs Exp $ */
+
#ifndef CMAP_H
#define CMAP_H 1
@@ -73,7 +75,7 @@ SOFTWARE.
typedef CARD32 Pixel;
typedef struct _CMEntry *EntryPtr;
-typedef struct _ColormapRec *ColormapPtr;
+/* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */
typedef struct _colorResource *colorResourcePtr;
extern int CreateColormap(
diff --git a/include/cursor.h b/include/cursor.h
index 24200837c..82423cd9e 100644
--- a/include/cursor.h
+++ b/include/cursor.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/cursor.h,v 1.6 2002/09/17 01:15:14 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -54,6 +55,11 @@ SOFTWARE.
#define NullCursor ((CursorPtr)NULL)
+/* Provide support for alpha composited cursors */
+#ifdef RENDER
+#define ARGB_CURSOR
+#endif
+
typedef struct _Cursor *CursorPtr;
typedef struct _CursorMetric *CursorMetricPtr;
@@ -66,6 +72,11 @@ extern int FreeCursor(
#endif
);
+/* Quartz support on Mac OS X pulls in the QuickDraw
+ framework whose AllocCursor function conflicts here. */
+#ifdef __DARWIN__
+#define AllocCursor Darwin_X_AllocCursor
+#endif
extern CursorPtr AllocCursor(
#if NeedFunctionPrototypes
unsigned char* /*psrcbits*/,
@@ -80,6 +91,21 @@ extern CursorPtr AllocCursor(
#endif
);
+extern CursorPtr AllocCursorARGB(
+#if NeedFunctionPrototypes
+ unsigned char* /*psrcbits*/,
+ unsigned char* /*pmaskbits*/,
+ CARD32* /*argb*/,
+ CursorMetricPtr /*cm*/,
+ unsigned /*foreRed*/,
+ unsigned /*foreGreen*/,
+ unsigned /*foreBlue*/,
+ unsigned /*backRed*/,
+ unsigned /*backGreen*/,
+ unsigned /*backBlue*/
+#endif
+);
+
extern int AllocGlyphCursor(
#if NeedFunctionPrototypes
Font /*source*/,
@@ -148,4 +174,12 @@ extern void GetSpritePosition(
#endif
);
+#ifdef PANORAMIX
+extern int XineramaGetCursorScreen(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+#endif /* PANORAMIX */
+
#endif /* CURSOR_H */
diff --git a/include/cursorstr.h b/include/cursorstr.h
index 4d9efffda..0e2f04a6d 100644
--- a/include/cursorstr.h
+++ b/include/cursorstr.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.9 2003/01/12 02:44:27 dawes Exp $ */
+
#ifndef CURSORSTRUCT_H
#define CURSORSTRUCT_H
@@ -60,9 +62,13 @@ SOFTWARE.
typedef struct _CursorBits {
unsigned char *source; /* points to bits */
unsigned char *mask; /* points to bits */
+ Bool emptyMask; /* all zeros mask */
unsigned short width, height, xhot, yhot; /* metrics */
int refcnt; /* can be shared */
pointer devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/
+#ifdef ARGB_CURSOR
+ CARD32 *argb; /* full-color alpha blended */
+#endif
} CursorBits, *CursorBitsPtr;
typedef struct _Cursor {
diff --git a/include/dix.h b/include/dix.h
index b53deb374..ba10a3554 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.26 2003/01/12 02:44:27 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -269,11 +270,11 @@ SOFTWARE.
ValidateGC(pDraw, pGC);
-#define WriteReplyToClient(pClient, size, pReply) \
+#define WriteReplyToClient(pClient, size, pReply) { \
if ((pClient)->swapped) \
(*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
(pClient, (int)(size), pReply); \
- else (void) WriteToClient(pClient, (int)(size), (char *)(pReply));
+ else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); }
#define WriteSwappedDataToClient(pClient, size, pbuf) \
if ((pClient)->swapped) \
@@ -289,17 +290,12 @@ typedef struct _Client *ClientPtr; /* also in misc.h */
typedef struct _WorkQueue *WorkQueuePtr;
-
extern ClientPtr requestingClient;
extern ClientPtr *clients;
extern ClientPtr serverClient;
extern int currentMaxClients;
-#ifndef __alpha
-typedef long HWEventQueueType;
-#else
typedef int HWEventQueueType;
-#endif
typedef HWEventQueueType* HWEventQueuePtr;
extern HWEventQueuePtr checkForInput[2];
@@ -404,6 +400,36 @@ extern int GetGeometry(
#endif
);
+extern int SendConnSetup(
+#if NeedFunctionPrototypes
+ ClientPtr /*client*/,
+ char* /*reason*/
+#endif
+);
+
+extern int
+DoGetImage(
+#if NeedFunctionPrototypes
+ ClientPtr /*client*/,
+ int /*format*/,
+ Drawable /*drawable*/,
+ int /*x*/,
+ int /*y*/,
+ int /*width*/,
+ int /*height*/,
+ Mask /*planemask*/,
+ xGetImageReply **/*im_return*/
+#endif
+);
+
+#ifdef LBX
+extern void IncrementClientCount(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+#endif /* LBX */
+
/* dixutils.c */
extern void CopyISOLatin1Lowered(
@@ -478,9 +504,8 @@ extern ClientPtr LookupClient(
);
extern void NoopDDA(
-#if NeedVarargsPrototypes
- void *,
- ...
+#if NeedFunctionPrototypes
+ void
#endif
);
@@ -512,16 +537,6 @@ extern void WakeupHandler(
#endif
);
-typedef struct timeval ** OSTimePtr;
-
-typedef void (* BlockHandlerProcPtr)(
-#if NeedNestedPrototypes
- pointer /* blockData */,
- OSTimePtr /* pTimeout */,
- pointer /* pReadmask */
-#endif
-);
-
typedef void (* WakeupHandlerProcPtr)(
#if NeedNestedPrototypes
pointer /* blockData */,
@@ -558,9 +573,27 @@ extern void ProcessWorkQueue(
#endif
);
+extern void ProcessWorkQueueZombies(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
extern Bool QueueWorkProc(
#if NeedFunctionPrototypes
- Bool (* /*function*/)(),
+ Bool (* /*function*/)(
+#if NeedNestedPrototypes
+ ClientPtr /*clientUnused*/,
+ pointer /*closure*/
+#endif
+ ),
+ ClientPtr /*client*/,
+ pointer /*closure*/
+#endif
+);
+
+typedef Bool (* ClientSleepProcPtr)(
+#if NeedFunctionPrototypes
ClientPtr /*client*/,
pointer /*closure*/
#endif
@@ -569,16 +602,19 @@ extern Bool QueueWorkProc(
extern Bool ClientSleep(
#if NeedFunctionPrototypes
ClientPtr /*client*/,
- Bool (* /*function*/)(),
+ ClientSleepProcPtr /* function */,
pointer /*closure*/
#endif
);
+#ifndef ___CLIENTSIGNAL_DEFINED___
+#define ___CLIENTSIGNAL_DEFINED___
extern Bool ClientSignal(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
);
+#endif /* ___CLIENTSIGNAL_DEFINED___ */
extern void ClientWakeup(
#if NeedFunctionPrototypes
@@ -641,11 +677,6 @@ extern void SetMaskForEvent(
#endif
);
-extern Bool PointerConfinedToScreen(
-#if NeedFunctionPrototypes
- void
-#endif
-);
extern Bool IsParent(
#if NeedFunctionPrototypes
@@ -666,12 +697,6 @@ extern WindowPtr GetSpriteWindow(
#endif
);
-extern void GetSpritePosition(
-#if NeedFunctionPrototypes
- int * /* px */,
- int * /* py */
-#endif
-);
extern void NoticeEventTime(
#if NeedFunctionPrototypes
@@ -807,6 +832,15 @@ extern void DeliverGrabbedEvent(
#endif
);
+#ifdef XKB
+extern void FixKeyState(
+#if NeedFunctionPrototypes
+ xEvent * /* xE */,
+ DeviceIntPtr /* keybd */
+#endif
+);
+#endif /* XKB */
+
extern void RecalculateDeliverableEvents(
#if NeedFunctionPrototypes
WindowPtr /* pWin */
@@ -834,7 +868,7 @@ extern int SetInputFocus(
ClientPtr /* client */,
DeviceIntPtr /* dev */,
Window /* focusID */,
- int /* revertTo */,
+ CARD8 /* revertTo */,
Time /* ctime */,
Bool /* followOK */
#endif
@@ -860,6 +894,8 @@ extern void InitEvents(
#endif
);
+extern void CloseDownEvents(void);
+
extern void DeleteWindowFromAnyEvents(
#if NeedFunctionPrototypes
WindowPtr /* pWin */,
@@ -867,11 +903,6 @@ extern void DeleteWindowFromAnyEvents(
#endif
);
-extern void CheckCursorConfinement(
-#if NeedFunctionPrototypes
- WindowPtr /* pWin */
-#endif
-);
extern Mask EventMaskForClient(
#if NeedFunctionPrototypes
@@ -891,6 +922,7 @@ extern int DeliverEvents(
#endif
);
+
extern void WriteEventsToClient(
#if NeedFunctionPrototypes
ClientPtr /*pClient*/,
@@ -910,38 +942,17 @@ extern int TryClientEvents(
#endif
);
-extern int EventSelectForWindow(
-#if NeedFunctionPrototypes
- WindowPtr /*pWin*/,
- ClientPtr /*client*/,
- Mask /*mask*/
-#endif
-);
-
-extern int EventSuppressForWindow(
+extern void WindowsRestructured(
#if NeedFunctionPrototypes
- WindowPtr /*pWin*/,
- ClientPtr /*client*/,
- Mask /*mask*/,
- Bool * /*checkOptional*/
+ void
#endif
);
-extern int MaybeDeliverEventsToClient(
-#if NeedFunctionPrototypes
- WindowPtr /*pWin*/,
- xEventPtr /*pEvents*/,
- int /*count*/,
- Mask /*filter*/,
- ClientPtr /*dontClient*/
-#endif
-);
-extern void WindowsRestructured(
-#if NeedFunctionPrototypes
- void
+#ifdef RANDR
+void
+ScreenRestructured (ScreenPtr pScreen);
#endif
-);
extern void ResetClientPrivates(
#if NeedFunctionPrototypes
diff --git a/include/dixfont.h b/include/dixfont.h
index b35e252bf..2a6877de2 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -21,311 +21,135 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/dixfont.h,v 3.8 2001/04/05 17:42:35 dawes Exp $ */
#ifndef DIXFONT_H
#define DIXFONT_H 1
-#include <dix.h>
-#include <font.h>
-#include <closure.h>
+#include "dix.h"
+#include "font.h"
+#include "closure.h"
+#include "fontstruct.h"
#define NullDIXFontProp ((DIXFontPropPtr)0)
typedef struct _DIXFontProp *DIXFontPropPtr;
-extern int FontToXError(
-#if NeedFunctionPrototypes
- int /*err*/
-#endif
-);
+extern FPEFunctions *fpe_functions;
-extern Bool SetDefaultFont(
-#if NeedFunctionPrototypes
- char * /*defaultfontname*/
-#endif
-);
+extern int FontToXError(int /*err*/);
-extern void QueueFontWakeup(
-#if NeedFunctionPrototypes
- FontPathElementPtr /*fpe*/
-#endif
-);
+extern Bool SetDefaultFont(char * /*defaultfontname*/);
-extern void RemoveFontWakeup(
-#if NeedFunctionPrototypes
- FontPathElementPtr /*fpe*/
-#endif
-);
+extern void QueueFontWakeup(FontPathElementPtr /*fpe*/);
-extern void FontWakeup(
-#if NeedFunctionPrototypes
- pointer /*data*/,
- int /*count*/,
- pointer /*LastSelectMask*/
-#endif
-);
+extern void RemoveFontWakeup(FontPathElementPtr /*fpe*/);
-extern int OpenFont(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- XID /*fid*/,
- Mask /*flags*/,
- unsigned /*lenfname*/,
- char * /*pfontname*/
-#endif
-);
-
-extern int CloseFont(
-#if NeedFunctionPrototypes
- pointer /*pfont*/,
- XID /*fid*/
-#endif
-);
-
-typedef struct _xQueryFontReply *xQueryFontReplyPtr;
+extern void FontWakeup(pointer /*data*/,
+ int /*count*/,
+ pointer /*LastSelectMask*/);
-extern void QueryFont(
-#if NeedFunctionPrototypes
- FontPtr /*pFont*/,
- xQueryFontReplyPtr /*pReply*/,
- int /*nProtoCCIStructs*/
-#endif
-);
+extern int OpenFont(ClientPtr /*client*/,
+ XID /*fid*/,
+ Mask /*flags*/,
+ unsigned /*lenfname*/,
+ char * /*pfontname*/);
-extern int ListFonts(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- unsigned char * /*pattern*/,
- unsigned int /*length*/,
- unsigned int /*max_names*/
-#endif
-);
+extern int CloseFont(pointer /*pfont*/,
+ XID /*fid*/);
-extern int doPolyText(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- PTclosurePtr /*c*/
-#endif
-);
-
-extern int PolyText(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- unsigned char * /*pElt*/,
- unsigned char * /*endReq*/,
- int /*xorg*/,
- int /*yorg*/,
- int /*reqType*/,
- XID /*did*/
-#endif
-);
-
-extern int doImageText(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- ITclosurePtr /*c*/
-#endif
-);
-
-extern int ImageText(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*nChars*/,
- unsigned char * /*data*/,
- int /*xorg*/,
- int /*yorg*/,
- int /*reqType*/,
- XID /*did*/
-#endif
-);
-
-extern int SetFontPath(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- int /*npaths*/,
- unsigned char * /*paths*/,
- int * /*error*/
-#endif
-);
-
-extern int SetDefaultFontPath(
-#if NeedFunctionPrototypes
- char * /*path*/
-#endif
-);
-
-extern unsigned char *GetFontPath(
-#if NeedFunctionPrototypes
- int * /*count*/,
- int * /*length*/
-#endif
-);
+typedef struct _xQueryFontReply *xQueryFontReplyPtr;
-extern int LoadGlyphs(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- FontPtr /*pfont*/,
- unsigned /*nchars*/,
- int /*item_size*/,
- unsigned char * /*data*/
-#endif
-);
+extern void QueryFont(FontPtr /*pFont*/,
+ xQueryFontReplyPtr /*pReply*/,
+ int /*nProtoCCIStructs*/);
-extern void DeleteClientFontStuff(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/
-#endif
-);
+extern int ListFonts(ClientPtr /*client*/,
+ unsigned char * /*pattern*/,
+ unsigned int /*length*/,
+ unsigned int /*max_names*/);
-extern void InitFonts(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+int
+doListFontsWithInfo(ClientPtr /*client*/,
+ LFWIclosurePtr /*c*/);
-extern int GetDefaultPointSize(
-#if NeedFunctionPrototypes
- void
-#endif
+extern int doPolyText(ClientPtr /*client*/,
+ PTclosurePtr /*c*/
);
-extern FontResolutionPtr GetClientResolutions(
-#if NeedFunctionPrototypes
- int * /*num*/
-#endif
-);
+extern int PolyText(ClientPtr /*client*/,
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ unsigned char * /*pElt*/,
+ unsigned char * /*endReq*/,
+ int /*xorg*/,
+ int /*yorg*/,
+ int /*reqType*/,
+ XID /*did*/);
-/* XXX leave these unprototyped for now -- need to do groundwork in
- * fonts/include/fontstruct.h before we do these
- */
-extern int RegisterFPEFunctions(
-#if NeedFunctionPrototypes
- Bool (* /*name_func*/)(),
- int (* /*init_func*/)(),
- int (* /*free_func*/)(),
- int (* /*reset_func*/)(),
- int (* /*open_func*/)(),
- int (* /*close_func*/)(),
- int (* /*list_func*/)(),
- int (* /*start_lfwi_func*/)(),
- int (* /*next_lfwi_func*/)(),
- int (* /*wakeup_func*/)(),
- int (* /*client_died*/)(),
- int (* /*load_glyphs*/)(),
- int (* /*start_list_alias_func*/)(),
- int (* /*next_list_alias_func*/)(),
- void (* /* set_path_func*/) ()
-#endif
-);
+extern int doImageText(ClientPtr /*client*/,
+ ITclosurePtr /*c*/);
-extern void FreeFonts(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+extern int ImageText(ClientPtr /*client*/,
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*nChars*/,
+ unsigned char * /*data*/,
+ int /*xorg*/,
+ int /*yorg*/,
+ int /*reqType*/,
+ XID /*did*/);
-extern FontPtr find_old_font(
-#if NeedFunctionPrototypes
- XID /*id*/
-#endif
-);
+extern int SetFontPath(ClientPtr /*client*/,
+ int /*npaths*/,
+ unsigned char * /*paths*/,
+ int * /*error*/);
-extern Font GetNewFontClientID(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+extern int SetDefaultFontPath(char * /*path*/);
-extern int StoreFontClientFont(
-#if NeedFunctionPrototypes
- FontPtr /*pfont*/,
- Font /*id*/
-#endif
-);
+extern unsigned char *GetFontPath(int * /*count*/,
+ int * /*length*/);
-extern void DeleteFontClientID(
-#if NeedFunctionPrototypes
- Font /*id*/
-#endif
-);
+extern int LoadGlyphs(ClientPtr /*client*/,
+ FontPtr /*pfont*/,
+ unsigned /*nchars*/,
+ int /*item_size*/,
+ unsigned char * /*data*/);
-extern int client_auth_generation(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/
-#endif
-);
+extern void DeleteClientFontStuff(ClientPtr /*client*/);
-extern int init_fs_handlers(
-#if NeedFunctionPrototypes
- FontPathElementPtr /*fpe*/,
- BlockHandlerProcPtr /*block_handler*/
+/* Quartz support on Mac OS X pulls in the QuickDraw
+ framework whose InitFonts function conflicts here. */
+#ifdef __DARWIN__
+#define InitFonts Darwin_X_InitFonts
#endif
-);
+extern void InitFonts(void);
-extern void remove_fs_handlers(
-#if NeedFunctionPrototypes
- FontPathElementPtr /*fpe*/,
- BlockHandlerProcPtr /*block_handler*/,
- Bool /*all*/
-#endif
-);
+extern void FreeFonts(void);
-extern void GetGlyphs(
-#if NeedFunctionPrototypes
- FontPtr /*font*/,
- unsigned long /*count*/,
- unsigned char * /*chars*/,
- FontEncoding /*fontEncoding*/,
- unsigned long * /*glyphcount*/,
- CharInfoPtr * /*glyphs*/
-#endif
-);
+extern FontPtr find_old_font(XID /*id*/);
-extern void QueryGlyphExtents(
-#if NeedFunctionPrototypes
- FontPtr /*pFont*/,
- CharInfoPtr * /*charinfo*/,
- unsigned long /*count*/,
- ExtentInfoPtr /*info*/
-#endif
-);
+extern void GetGlyphs(FontPtr /*font*/,
+ unsigned long /*count*/,
+ unsigned char * /*chars*/,
+ FontEncoding /*fontEncoding*/,
+ unsigned long * /*glyphcount*/,
+ CharInfoPtr * /*glyphs*/);
-extern Bool QueryTextExtents(
-#if NeedFunctionPrototypes
- FontPtr /*pFont*/,
- unsigned long /*count*/,
- unsigned char * /*chars*/,
- ExtentInfoPtr /*info*/
-#endif
-);
+extern void QueryGlyphExtents(FontPtr /*pFont*/,
+ CharInfoPtr * /*charinfo*/,
+ unsigned long /*count*/,
+ ExtentInfoPtr /*info*/);
-extern Bool ParseGlyphCachingMode(
-#if NeedFunctionPrototypes
- char * /*str*/
-#endif
-);
+extern Bool QueryTextExtents(FontPtr /*pFont*/,
+ unsigned long /*count*/,
+ unsigned char * /*chars*/,
+ ExtentInfoPtr /*info*/);
-extern void InitGlyphCaching(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+extern Bool ParseGlyphCachingMode(char * /*str*/);
-extern void SetGlyphCachingMode(
-#if NeedFunctionPrototypes
- int /*newmode*/
-#endif
-);
+extern void InitGlyphCaching(void);
-void
-ResetFontPrivateIndex(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+extern void SetGlyphCachingMode(int /*newmode*/);
#endif /* DIXFONT_H */
diff --git a/include/dixstruct.h b/include/dixstruct.h
index d6db3f2b6..bcf29dc04 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.18 2003/01/12 02:44:27 dawes Exp $ */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -49,6 +50,22 @@ typedef struct {
xConnSetup *setup;
} NewClientInfoRec;
+typedef void (*ReplySwapPtr) (
+#if NeedNestedPrototypes
+ ClientPtr /* pClient */,
+ int /* size */,
+ void * /* pbuf */
+#endif
+);
+
+extern void ReplyNotSwappd (
+#if NeedNestedPrototypes
+ ClientPtr /* pClient */,
+ int /* size */,
+ void * /* pbuf */
+#endif
+);
+
typedef enum {ClientStateInitial,
ClientStateAuthenticating,
ClientStateRunning,
@@ -63,13 +80,7 @@ typedef struct _Client {
pointer requestBuffer;
pointer osPrivate; /* for OS layer, including scheduler */
Bool swapped;
- void (*pSwapReplyFunc) (
-#if NeedNestedPrototypes
- ClientPtr /* pClient */,
- int /* size */,
- void * /* pbuf */
-#endif
-);
+ ReplySwapPtr pSwapReplyFunc;
XID errorValue;
int sequence;
int closeDownMode;
@@ -135,8 +146,44 @@ typedef struct _Client {
int * /* num */
#endif
);
+#ifdef SMART_SCHEDULE
+ int smart_priority;
+ long smart_start_tick;
+ long smart_stop_tick;
+ long smart_check_tick;
+#endif
} ClientRec;
+#ifdef SMART_SCHEDULE
+/*
+ * Scheduling interface
+ */
+extern long SmartScheduleTime;
+extern long SmartScheduleInterval;
+extern long SmartScheduleSlice;
+extern long SmartScheduleMaxSlice;
+extern unsigned long SmartScheduleIdleCount;
+extern Bool SmartScheduleDisable;
+extern Bool SmartScheduleIdle;
+extern Bool SmartScheduleTimerStopped;
+extern Bool SmartScheduleStartTimer(void);
+#define SMART_MAX_PRIORITY 20
+#define SMART_MIN_PRIORITY -20
+
+extern Bool SmartScheduleInit(
+#ifdef NeedFunctionPrototypes
+ void
+#endif
+);
+
+#endif
+
+/* This prototype is used pervasively in Xext, dix */
+#if NeedFunctionPrototypes
+#define DISPATCH_PROC(func) int func(ClientPtr /* client */)
+#else
+#define DISPATCH_PROC(func) int func(/* ClientPtr client */)
+#endif
typedef struct _WorkQueue {
struct _WorkQueue *next;
@@ -209,7 +256,7 @@ extern int (*k5_Vector[256])() =
);
#endif
-extern void (* ReplySwapVector[256]) ();
+extern ReplySwapPtr ReplySwapVector[256];
extern int ProcBadRequest(
#if NeedFunctionPrototypes
diff --git a/include/extension.h b/include/extension.h
index 69b32feb1..304674fa6 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/extension.h,v 1.5 2001/12/14 19:59:54 dawes Exp $ */
+
#ifndef EXTENSION_H
#define EXTENSION_H
@@ -69,6 +71,8 @@ extern void InitExtensions(
#endif
);
+extern void InitVisualWrap(void);
+
extern void CloseDownExtensions(
#if NeedFunctionPrototypes
void
diff --git a/include/extnsionst.h b/include/extnsionst.h
index 6bb52767d..6de9be309 100644
--- a/include/extnsionst.h
+++ b/include/extnsionst.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/extnsionst.h,v 3.7 2001/12/14 19:59:54 dawes Exp $ */
+
#ifndef EXTENSIONSTRUCT_H
#define EXTENSIONSTRUCT_H
@@ -79,15 +81,32 @@ typedef struct _ExtensionEntry {
#endif
} ExtensionEntry;
-/* any attempt to declare the types of the parameters to the functions
- * in EventSwapVector fails. The functions take pointers to two events,
- * but the exact event types that are declared vary from one function
- * to another. You can't even put void *, void * (the ibm compiler
- * complains, anyway).
+/*
+ * The arguments may be different for extension event swapping functions.
+ * Deal with this by casting when initializing the event's EventSwapVector[]
+ * entries.
*/
-extern void (* EventSwapVector[128]) ();
+typedef void (*EventSwapPtr) (
+#if NeedFunctionPrototypes
+ xEvent *,
+ xEvent *
+#endif
+);
+
+extern EventSwapPtr EventSwapVector[128];
+
+extern void NotImplemented ( /* FIXME: this may move to another file... */
+#if NeedFunctionPrototypes
+ xEvent *,
+ xEvent *
+#endif
+);
-typedef void (* ExtensionLookupProc)(/*args indeterminate*/);
+typedef void (* ExtensionLookupProc)( /*args indeterminate*/
+#ifdef EXTENSION_PROC_ARGS
+ EXTENSION_PROC_ARGS
+#endif
+);
typedef struct _ProcEntry {
char *name;
@@ -140,6 +159,8 @@ extern Bool AddExtensionAlias(
#endif
);
+extern ExtensionEntry *CheckExtension(const char *extname);
+
extern ExtensionLookupProc LookupProc(
#if NeedFunctionPrototypes
char* /*name*/,
diff --git a/include/gc.h b/include/gc.h
index 5e220d68c..8d1b31fad 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/gc.h,v 1.5 2001/12/14 19:59:54 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -49,8 +50,8 @@ SOFTWARE.
#ifndef GC_H
#define GC_H
-#include "misc.h" /* for Bool */
#include "X11/X.h" /* for GContext, Mask */
+#include "Xdefs.h" /* for Bool */
#include "X11/Xproto.h"
#include "screenint.h" /* for ScreenPtr */
#include "pixmap.h" /* for DrawablePtr */
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 9d6040c9d..35ca1583d 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -46,6 +46,9 @@ SOFTWARE.
******************************************************************/
+
+/* $XFree86: xc/programs/Xserver/include/gcstruct.h,v 1.6 2001/12/14 19:59:54 dawes Exp $ */
+
#ifndef GCSTRUCT_H
#define GCSTRUCT_H
@@ -371,7 +374,9 @@ typedef struct _GC {
unsigned int clientClipType : 2; /* CT_<kind> */
unsigned int miTranslate:1; /* should mi things translate? */
unsigned int tileIsPixel:1; /* tile is solid pixel */
- unsigned int unused:16; /* see comment above */
+ unsigned int fExpose:1; /* Call exposure handling */
+ unsigned int freeCompClip:1; /* Free composite clip */
+ unsigned int unused:14; /* see comment above */
unsigned long planemask;
unsigned long fgPixel;
unsigned long bgPixel;
@@ -391,6 +396,14 @@ typedef struct _GC {
GCFuncs *funcs;
GCOps *ops;
DevUnion *devPrivates;
+ /*
+ * The following were moved here from private storage to allow device-
+ * independent access to them from screen wrappers.
+ * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org)
+ */
+ PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */
+ RegionPtr pCompositeClip;
+ /* fExpose & freeCompClip defined above */
} GC;
#endif /* GCSTRUCT_H */
diff --git a/include/input.h b/include/input.h
index 161af2d63..e34098f89 100644
--- a/include/input.h
+++ b/include/input.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/include/input.h,v 3.7 2001/12/14 19:59:54 dawes Exp $ */
+
#ifndef INPUT_H
#define INPUT_H
@@ -152,6 +154,7 @@ typedef struct {
extern KeybdCtrl defaultKeyboardControl;
extern PtrCtrl defaultPointerControl;
+#undef AddInputDevice
extern DevicePtr AddInputDevice(
#if NeedFunctionPrototypes
DeviceProc /*deviceProc*/,
@@ -159,6 +162,16 @@ extern DevicePtr AddInputDevice(
#endif
);
+#define AddInputDevice(deviceProc, autoStart) \
+ _AddInputDevice(deviceProc, autoStart)
+
+extern DeviceIntPtr _AddInputDevice(
+#if NeedFunctionPrototypes
+ DeviceProc /*deviceProc*/,
+ Bool /*autoStart*/
+#endif
+);
+
extern Bool EnableDevice(
#if NeedFunctionPrototypes
DeviceIntPtr /*device*/
@@ -183,24 +196,50 @@ extern void CloseDownDevices(
#endif
);
+extern void RemoveDevice(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /*dev*/
+#endif
+);
+
extern int NumMotionEvents(
#if NeedFunctionPrototypes
void
#endif
);
+#undef RegisterPointerDevice
extern void RegisterPointerDevice(
#if NeedFunctionPrototypes
DevicePtr /*device*/
#endif
);
+#define RegisterPointerDevice(device) \
+ _RegisterPointerDevice(device)
+
+extern void _RegisterPointerDevice(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /*device*/
+#endif
+);
+
+#undef RegisterKeyboardDevice
extern void RegisterKeyboardDevice(
#if NeedFunctionPrototypes
DevicePtr /*device*/
#endif
);
+#define RegisterKeyboardDevice(device) \
+ _RegisterKeyboardDevice(device)
+
+extern void _RegisterKeyboardDevice(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /*device*/
+#endif
+);
+
extern DevicePtr LookupKeyboardDevice(
#if NeedFunctionPrototypes
void
diff --git a/include/inputstr.h b/include/inputstr.h
index 43a50eb56..045e6a2de 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/inputstr.h,v 1.5 2001/12/14 19:59:54 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -59,7 +60,7 @@ SOFTWARE.
#define SameClient(obj,client) \
(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
-#define MAX_DEVICES 9
+#define MAX_DEVICES 20
#define EMASKSIZE MAX_DEVICES
diff --git a/include/misc.h b/include/misc.h
index 9627810d8..e3761c5ba 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.28 2001/12/14 19:59:55 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -80,17 +81,16 @@ extern unsigned long serverGeneration;
#include <X11/Xfuncproto.h>
#include <X11/Xmd.h>
#include <X11/X.h>
+#include <X11/Xdefs.h>
+#ifndef IN_MODULE
#ifndef NULL
-#ifndef X_NOT_STDC_ENV
#include <stddef.h>
-#else
-#define NULL 0
#endif
#endif
#ifndef MAXSCREENS
-#define MAXSCREENS 3
+#define MAXSCREENS 16
#endif
#define MAXCLIENTS 256
#define MAXDITS 1
@@ -98,12 +98,6 @@ extern unsigned long serverGeneration;
#define MAXFORMATS 8
#define MAXVISUALS_PER_SCREEN 50
-#if NeedFunctionPrototypes
-typedef void *pointer;
-#else
-typedef unsigned char *pointer;
-#endif
-typedef int Bool;
typedef unsigned long PIXEL;
typedef unsigned long ATOM;
@@ -113,16 +107,6 @@ typedef unsigned long ATOM;
#define FALSE 0
#endif
-#ifndef _XTYPEDEF_FONTPTR
-typedef struct _Font *FontPtr; /* also in fonts/include/font.h */
-#define _XTYPEDEF_FONTPTR
-#endif
-
-#ifndef _XTYPEDEF_CLIENTPTR
-typedef struct _Client *ClientPtr; /* also in dix.h */
-#define _XTYPEDEF_CLIENTPTR
-#endif
-
#ifndef _XTYPEDEF_CALLBACKLISTPTR
typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
#define _XTYPEDEF_CALLBACKLISTPTR
@@ -131,7 +115,9 @@ typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
typedef struct _xReq *xReqPtr;
#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
+#ifndef IN_MODULE
#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
+#endif
#define NullBox ((BoxPtr)0)
#define MILLI_PER_MIN (1000 * 60)
@@ -154,11 +140,17 @@ typedef struct _xReq *xReqPtr;
/* byte swap a short literal */
#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
+#undef min
+#undef max
+
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
-#ifndef abs
-#define abs(a) ((a) > 0 ? (a) : -(a))
-#endif
+#ifndef IN_MODULE
+/* abs() is a function, not a macro; include the file declaring
+ * it in case we haven't done that yet.
+ */
+#include <stdlib.h>
+#endif /* IN_MODULE */
#ifndef Fabs
#define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
#endif
@@ -174,13 +166,32 @@ typedef struct _xReq *xReqPtr;
*/
#define lowbit(x) ((x) & (~(x) + 1))
-#ifndef MAXSHORT
-#define MAXSHORT 32767
-#endif
-#ifndef MINSHORT
-#define MINSHORT -MAXSHORT
+#ifndef IN_MODULE
+/* XXX Not for modules */
+#include <limits.h>
+#if !defined(MAXSHORT) || !defined(MINSHORT) || \
+ !defined(MAXINT) || !defined(MININT)
+/*
+ * Some implementations #define these through <math.h>, so preclude
+ * #include'ing it later.
+ */
+
+#include <math.h>
#endif
+#undef MAXSHORT
+#define MAXSHORT SHRT_MAX
+#undef MINSHORT
+#define MINSHORT SHRT_MIN
+#undef MAXINT
+#define MAXINT INT_MAX
+#undef MININT
+#define MININT INT_MIN
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h> /* for fopen, etc... */
+#endif
/* some macros to help swap requests, replies, and events */
@@ -240,7 +251,7 @@ extern void SwapShorts(
#endif
);
-extern int MakePredeclaredAtoms(
+extern void MakePredeclaredAtoms(
#if NeedFunctionPrototypes
void
#endif
diff --git a/include/miscstruct.h b/include/miscstruct.h
index 01dd2821c..7d6dec0e8 100644
--- a/include/miscstruct.h
+++ b/include/miscstruct.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.3 2001/12/14 19:59:55 dawes Exp $ */
+
#ifndef MISCSTRUCT_H
#define MISCSTRUCT_H 1
@@ -61,7 +63,11 @@ typedef union _DevUnion {
pointer ptr;
long val;
unsigned long uval;
- pointer (*fptr)();
+ pointer (*fptr)(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
} DevUnion;
#endif /* MISCSTRUCT_H */
diff --git a/include/opaque.h b/include/opaque.h
index f35f39d29..1834202ae 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -26,16 +26,17 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.11 2002/10/08 23:55:22 dawes Exp $ */
#ifndef OPAQUE_H
#define OPAQUE_H
#include <X11/Xmd.h>
-extern char *defaultFontPath;
+#include "globals.h"
+
extern char *defaultTextFont;
extern char *defaultCursorFont;
-extern char *rgbPath;
extern int MaxClients;
extern char isItTimeToYield;
extern char dispatchException;
@@ -46,11 +47,36 @@ extern char dispatchException;
#define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */
extern CARD32 TimeOutValue;
-extern CARD32 ScreenSaverTime;
-extern CARD32 ScreenSaverInterval;
-extern int ScreenSaverBlanking;
-extern int ScreenSaverAllowExposures;
+extern int ScreenSaverBlanking;
+extern int ScreenSaverAllowExposures;
+extern int defaultScreenSaverBlanking;
+extern int defaultScreenSaverAllowExposures;
extern int argcGlobal;
extern char **argvGlobal;
+extern char *display;
+
+extern int defaultBackingStore;
+extern Bool disableBackingStore;
+extern Bool enableBackingStore;
+extern Bool disableSaveUnders;
+extern Bool PartialNetwork;
+#ifndef NOLOGOHACK
+extern int logoScreenSaver;
+#endif
+#ifdef RLIMIT_DATA
+extern int limitDataSpace;
+#endif
+#ifdef RLIMIT_STACK
+extern int limitStackSpace;
+#endif
+#ifdef RLIMIT_NOFILE
+extern int limitNoFile;
+#endif
+extern Bool permitOldBugs;
+extern Bool defeatAccessControl;
+extern char* protNoListen;
+extern Bool blackRoot;
+
+
#endif /* OPAQUE_H */
diff --git a/include/os.h b/include/os.h
index 99bfd386c..6aa6e29e4 100644
--- a/include/os.h
+++ b/include/os.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/os.h,v 3.43 2002/12/24 17:42:59 tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -53,6 +54,11 @@ SOFTWARE.
#define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
#define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
#include "Xalloca.h"
+#ifndef IN_MODULE
+#include <stdarg.h>
+#else
+#include "xf86_ansic.h"
+#endif
#define NullFID ((FID) 0)
@@ -72,21 +78,24 @@ typedef pointer FID;
typedef struct _FontPathRec *FontPathPtr;
typedef struct _NewClientRec *NewClientPtr;
+#ifndef xalloc
#define xnfalloc(size) XNFalloc((unsigned long)(size))
+#define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
#define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size))
#define xalloc(size) Xalloc((unsigned long)(size))
+#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
#define xfree(ptr) Xfree((pointer)(ptr))
+#define xstrdup(s) Xstrdup(s)
+#define xnfstrdup(s) XNFstrdup(s)
+#endif
-#ifndef X_NOT_STDC_ENV
-#include <string.h>
-#else
-#ifdef SYSV
-#include <string.h>
-#else
-#include <strings.h>
+#ifndef IN_MODULE
+#ifdef SCO
+#include <stdio.h>
#endif
+#include <string.h>
#endif
/* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */
@@ -96,6 +105,9 @@ typedef struct _NewClientRec *NewClientPtr;
#define SIGVAL void
#endif
+extern Bool OsDelayInitColors;
+extern void (*OsVendorVErrorFProc)(const char *, va_list args);
+
extern int WaitForSomething(
#if NeedFunctionPrototypes
int* /*pClientsReady*/
@@ -109,6 +121,12 @@ extern int StandardReadRequestFromClient(
ClientPtr /*client*/
#endif
);
+
+extern int ClientConnectionNumber(
+#if NeedFunctionPrototypes
+ ClientPtr /*client*/
+#endif
+);
#else
extern int ReadRequestFromClient(
#if NeedFunctionPrototypes
@@ -125,7 +143,7 @@ extern Bool InsertFakeRequest(
#endif
);
-extern int ResetCurrentRequest(
+extern void ResetCurrentRequest(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
@@ -163,6 +181,12 @@ extern void ResetOsBuffers(
#endif
);
+extern void InitConnectionLimits(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
extern void CreateWellKnownSockets(
#if NeedFunctionPrototypes
void
@@ -175,6 +199,12 @@ extern void ResetWellKnownSockets(
#endif
);
+extern void CloseWellKnownConnections(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
extern XID
AuthorizationIDOfClient(
#if NeedFunctionPrototypes
@@ -211,54 +241,68 @@ extern void CloseDownConnection(
#endif
);
-extern int AddEnabledDevice(
+extern void AddEnabledDevice(
#if NeedFunctionPrototypes
int /*fd*/
#endif
);
-extern int RemoveEnabledDevice(
+extern void RemoveEnabledDevice(
#if NeedFunctionPrototypes
int /*fd*/
#endif
);
-extern int OnlyListenToOneClient(
+extern void OnlyListenToOneClient(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
);
-extern int ListenToAllClients(
+extern void ListenToAllClients(
#if NeedFunctionPrototypes
void
#endif
);
-extern int IgnoreClient(
+extern void IgnoreClient(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
);
-extern int AttendClient(
+extern void AttendClient(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
);
-extern int MakeClientGrabImpervious(
+extern void MakeClientGrabImpervious(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
);
-extern int MakeClientGrabPervious(
+extern void MakeClientGrabPervious(
#if NeedFunctionPrototypes
ClientPtr /*client*/
#endif
);
+#ifdef LBX
+extern void CloseDownFileDescriptor(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+);
+#endif
+
+extern void AvailableClientInput(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+);
+
extern void Error(
#if NeedFunctionPrototypes
char* /*str*/
@@ -271,7 +315,7 @@ extern CARD32 GetTimeInMillis(
#endif
);
-extern int AdjustWaitForDelay(
+extern void AdjustWaitForDelay(
#if NeedFunctionPrototypes
pointer /*waitTime*/,
unsigned long /*newdelay*/
@@ -356,32 +400,38 @@ extern void ProcessCommandLine(
#endif
);
-extern unsigned long *Xalloc(
+extern pointer Xalloc(
#if NeedFunctionPrototypes
unsigned long /*amount*/
#endif
);
-extern unsigned long *XNFalloc(
+extern pointer XNFalloc(
#if NeedFunctionPrototypes
unsigned long /*amount*/
#endif
);
-extern unsigned long *Xcalloc(
+extern pointer Xcalloc(
#if NeedFunctionPrototypes
unsigned long /*amount*/
#endif
);
-extern unsigned long *Xrealloc(
+extern pointer XNFcalloc(
+#if NeedFunctionPrototypes
+ unsigned long /*amount*/
+#endif
+);
+
+extern pointer Xrealloc(
#if NeedFunctionPrototypes
pointer /*ptr*/,
unsigned long /*amount*/
#endif
);
-extern unsigned long *XNFrealloc(
+extern pointer XNFrealloc(
#if NeedFunctionPrototypes
pointer /*ptr*/,
unsigned long /*amount*/
@@ -394,12 +444,15 @@ extern void Xfree(
#endif
);
-extern int OsInitAllocator(
+extern void OsInitAllocator(
#if NeedFunctionPrototypes
void
#endif
);
+extern char *Xstrdup(const char *s);
+extern char *XNFstrdup(const char *s);
+
typedef SIGVAL (*OsSigHandlerPtr)(
#if NeedFunctionPrototypes
int /* sig */
@@ -415,27 +468,56 @@ extern OsSigHandlerPtr OsSignal(
extern int auditTrailLevel;
+extern void AuditPrefix(
+#if NeedFunctionPrototypes
+ const char *
+#endif
+);
+
extern void AuditF(
#if NeedVarargsPrototypes
- char* /*f*/,
+ const char* /*f*/,
...
#endif
);
extern void FatalError(
#if NeedVarargsPrototypes
- char* /*f*/,
+ const char* /*f*/,
...
#endif
-);
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
+__attribute((noreturn))
+#endif
+;
extern void ErrorF(
#if NeedVarargsPrototypes
- char* /*f*/,
+ const char* /*f*/,
...
#endif
);
+#if NeedVarargsPrototypes
+extern void VErrorF(const char *f, va_list args);
+#endif
+
+#ifdef SERVER_LOCK
+extern void LockServer(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void UnlockServer(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+#endif
+
extern int OsLookupColor(
#if NeedFunctionPrototypes
int /*screen*/,
@@ -453,6 +535,18 @@ extern void OsInit(
#endif
);
+extern void OsCleanup(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void OsVendorFatalError(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
extern void OsVendorInit(
#if NeedFunctionPrototypes
void
@@ -465,6 +559,31 @@ extern int OsInitColors(
#endif
);
+void OsBlockSignals (
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+
+void OsReleaseSignals (
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+
+#if !defined(WIN32) && !defined(__UNIXOS2__)
+extern int System(char *);
+extern pointer Popen(char *, char *);
+extern int Pclose(pointer);
+#else
+#define System(a) system(a)
+#define Popen(a,b) popen(a,b)
+#define Pclose(a) pclose(a)
+#endif
+
+extern void CheckUserParameters(int argc, char **argv, char **envp);
+extern void CheckUserAuthorization(void);
+
extern int AddHost(
#if NeedFunctionPrototypes
ClientPtr /*client*/,
@@ -477,7 +596,13 @@ extern int AddHost(
extern Bool ForEachHostInFamily (
#if NeedFunctionPrototypes
int /*family*/,
- Bool (* /*func*/ )(),
+ Bool (* /*func*/ )(
+#if NeedNestedPrototypes
+ unsigned char * /* addr */,
+ short /* len */,
+ pointer /* closure */
+#endif
+ ),
pointer /*closure*/
#endif
);
@@ -515,6 +640,8 @@ extern int LocalClient(
#endif
);
+extern int LocalClientCred(ClientPtr, int *, int *);
+
extern int ChangeAccessControl(
#if NeedFunctionPrototypes
ClientPtr /*client*/,
@@ -590,6 +717,19 @@ extern void RegisterAuthorizations(
#endif
);
+extern XID AuthorizationToID (
+ unsigned short name_length,
+ char *name,
+ unsigned short data_length,
+ char *data);
+
+extern int AuthorizationFromID (
+ XID id,
+ unsigned short *name_lenp,
+ char **namep,
+ unsigned short *data_lenp,
+ char **datap);
+
extern XID CheckAuthorization(
#if NeedFunctionPrototypes
unsigned int /*namelength*/,
@@ -607,12 +747,18 @@ extern void ResetAuthorization(
#endif
);
+extern int RemoveAuthorization (
+ unsigned short name_length,
+ char *name,
+ unsigned short data_length,
+ char *data);
+
extern int AddAuthorization(
#if NeedFunctionPrototypes
- unsigned int /*name_length*/,
- char * /*name*/,
- unsigned int /*data_length*/,
- char * /*data*/
+ unsigned int /*name_length*/,
+ char * /*name*/,
+ unsigned int /*data_length*/,
+ char * /*data*/
#endif
);
@@ -644,6 +790,8 @@ extern int ddxProcessArgument(
#endif
);
+extern void ddxUseMsg(void);
+
/*
* idiom processing stuff
*/
@@ -704,4 +852,8 @@ typedef struct {
/* stuff for FlushCallback */
extern CallbackListPtr FlushCallback;
+extern void AbortDDX(void);
+extern void ddxGiveUp(void);
+extern int TimeSinceLastInputEvent(void);
+
#endif /* OS_H */
diff --git a/include/property.h b/include/property.h
index a5dfbc914..c77b0735e 100644
--- a/include/property.h
+++ b/include/property.h
@@ -45,8 +45,13 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/property.h,v 1.3 2001/12/14 19:59:55 dawes Exp $ */
+
#ifndef PROPERTY_H
#define PROPERTY_H
+
+#include "window.h"
+
typedef struct _Property *PropertyPtr;
extern int ChangeWindowProperty(
diff --git a/include/propertyst.h b/include/propertyst.h
index b704b61fb..5c335d038 100644
--- a/include/propertyst.h
+++ b/include/propertyst.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/propertyst.h,v 3.3 2001/12/14 19:59:55 dawes Exp $ */
+
#ifndef PROPERTYSTRUCT_H
#define PROPERTYSTRUCT_H
#include "misc.h"
@@ -60,7 +62,7 @@ typedef struct _Property {
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
pointer data; /* private to client */
-#ifdef LBX
+#if defined(LBX) || defined(LBX_COMPAT)
/* If space is at a premium and binary compatibility is not
* an issue, you may want to put the owner_pid next to format
* so that the two shorts pack together without padding.
diff --git a/include/regionstr.h b/include/regionstr.h
index 55dc99656..1ac3f2f07 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.7 2001/12/14 19:59:56 dawes Exp $ */
+
#ifndef REGIONSTRUCT_H
#define REGIONSTRUCT_H
@@ -75,8 +77,11 @@ typedef struct _Region {
extern BoxRec miEmptyBox;
extern RegDataRec miEmptyData;
+extern RegDataRec miBrokenData;
#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
+/* not a region */
+#define REGION_NAR(reg) ((reg)->data == &miBrokenData)
#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
@@ -131,6 +136,12 @@ extern RegDataRec miEmptyData;
#define REGION_NOTEMPTY(_pScreen, _pReg) \
(*(_pScreen)->RegionNotEmpty)(_pReg)
+#define REGION_BROKEN(_pScreen, _pReg) \
+ (*(_pScreen)->RegionBroken)(_pReg)
+
+#define REGION_BREAK(_pScreen, _pReg) \
+ (*(_pScreen)->RegionBreak)(_pReg)
+
#define REGION_EMPTY(_pScreen, _pReg) \
(*(_pScreen)->RegionEmpty)(_pReg)
@@ -193,6 +204,9 @@ extern RegDataRec miEmptyData;
#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \
miRectsToRegion(nrects, prect, ctype)
+#define REGION_BREAK(_pScreen, _pReg) \
+ miRegionBreak(_pReg)
+
#ifdef DONT_INLINE_REGION_OPS
#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
@@ -207,6 +221,9 @@ extern RegDataRec miEmptyData;
#define REGION_NOTEMPTY(_pScreen, _pReg) \
miRegionNotEmpty(_pReg)
+#define REGION_BROKEN(_pScreen, _pReg) \
+ miRegionBroken(_pReg)
+
#define REGION_EMPTY(_pScreen, _pReg) \
miRegionEmpty(_pReg)
@@ -238,7 +255,10 @@ extern RegDataRec miEmptyData;
#define REGION_UNINIT(_pScreen, _pReg) \
{ \
- if ((_pReg)->data && (_pReg)->data->size) xfree((_pReg)->data); \
+ if ((_pReg)->data && (_pReg)->data->size) { \
+ xfree((_pReg)->data); \
+ (_pReg)->data = NULL; \
+ } \
}
#define REGION_RESET(_pScreen, _pReg, _pBox) \
@@ -251,6 +271,9 @@ extern RegDataRec miEmptyData;
#define REGION_NOTEMPTY(_pScreen, _pReg) \
!REGION_NIL(_pReg)
+#define REGION_BROKEN(_pScreen, _pReg) \
+ REGION_NAR(_pReg)
+
#define REGION_EMPTY(_pScreen, _pReg) \
{ \
REGION_UNINIT(_pScreen, _pReg); \
@@ -378,6 +401,12 @@ extern void miRegionReset(
#endif
);
+extern Bool miRegionBreak(
+#if NeedFunctionPrototypes
+ RegionPtr /*pReg*/
+#endif
+);
+
extern Bool miPointInRegion(
#if NeedFunctionPrototypes
RegionPtr /*pReg*/,
diff --git a/include/resource.h b/include/resource.h
index 537093061..63d7ff25a 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.11 2002/03/06 21:14:04 mvojkovi Exp $ */
+
#ifndef RESOURCE_H
#define RESOURCE_H 1
#include "misc.h"
@@ -74,6 +76,8 @@ typedef unsigned long RESTYPE;
#define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE)
#define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE)
#define RT_GC ((RESTYPE)3|RC_CACHED)
+#undef RT_FONT
+#undef RT_CURSOR
#define RT_FONT ((RESTYPE)4)
#define RT_CURSOR ((RESTYPE)5)
#define RT_COLORMAP ((RESTYPE)6)
@@ -84,11 +88,30 @@ typedef unsigned long RESTYPE;
#define RT_NONE ((RESTYPE)0)
/* bits and fields within a resource id */
-#define CLIENTOFFSET 22 /* client field */
-#define RESOURCE_ID_MASK 0x3FFFFF /* low 22 bits */
-#define CLIENT_BITS(id) ((id) & 0x3fc00000) /* next 8 bits */
+#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
+#if MAXCLIENTS == 64
+#define RESOURCE_CLIENT_BITS 6
+#endif
+#if MAXCLIENTS == 128
+#define RESOURCE_CLIENT_BITS 7
+#endif
+#if MAXCLIENTS == 256
+#define RESOURCE_CLIENT_BITS 8
+#endif
+#if MAXCLIENTS == 512
+#define RESOURCE_CLIENT_BITS 9
+#endif
+/* client field offset */
+#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
+/* resource field */
+#define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1)
+/* client field */
+#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
+/* extract the client mask from an XID */
+#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
+/* extract the client id from an XID */
#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
-#define SERVER_BIT 0x40000000 /* use illegal bit */
+#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
#ifdef INVALID
#undef INVALID /* needed on HP/UX */
@@ -114,6 +137,23 @@ typedef void (*FindResType)(
#endif
);
+typedef void (*FindAllRes)(
+#if NeedNestedPrototypes
+ pointer /*value*/,
+ XID /*id*/,
+ RESTYPE /*type*/,
+ pointer /*cdata*/
+#endif
+);
+
+typedef Bool (*FindComplexResType)(
+#if NeedNestedPrototypes
+ pointer /*value*/,
+ XID /*id*/,
+ pointer /*cdata*/
+#endif
+);
+
extern RESTYPE CreateNewResourceType(
#if NeedFunctionPrototypes
DeleteType /*deleteFunc*/
@@ -138,6 +178,11 @@ extern XID FakeClientID(
#endif
);
+/* Quartz support on Mac OS X uses the CarbonCore
+ framework whose AddResource function conflicts here. */
+#ifdef __DARWIN__
+#define AddResource Darwin_X_AddResource
+#endif
extern Bool AddResource(
#if NeedFunctionPrototypes
XID /*id*/,
@@ -178,6 +223,14 @@ extern void FindClientResourcesByType(
#endif
);
+extern void FindAllClientResources(
+#if NeedFunctionPrototypes
+ ClientPtr /*client*/,
+ FindAllRes /*func*/,
+ pointer /*cdata*/
+#endif
+);
+
extern void FreeClientNeverRetainResources(
#if NeedFunctionPrototypes
ClientPtr /*client*/
@@ -217,6 +270,15 @@ extern pointer LookupIDByClass(
#endif
);
+extern pointer LookupClientResourceComplex(
+#if NeedFunctionPrototypes
+ ClientPtr client,
+ RESTYPE type,
+ FindComplexResType func,
+ pointer cdata
+#endif
+);
+
/* These are the access modes that can be passed in the last parameter
* to SecurityLookupIDByType/Class. The Security extension doesn't
* currently make much use of these; they're mainly provided as an
@@ -277,5 +339,13 @@ extern unsigned int GetXIDList(
#endif
);
+extern RESTYPE lastResourceType;
+extern RESTYPE TypeMask;
+
+#ifdef XResExtension
+extern Atom *ResourceNames;
+void RegisterResourceName(RESTYPE type, char* name);
+#endif
+
#endif /* RESOURCE_H */
diff --git a/include/screenint.h b/include/screenint.h
index f4eb79725..c4ad2a627 100644
--- a/include/screenint.h
+++ b/include/screenint.h
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.5 2001/12/14 19:59:56 dawes Exp $ */
#ifndef SCREENINT_H
#define SCREENINT_H
@@ -153,7 +154,12 @@ extern void ResetColormapPrivates(
);
-typedef int (*InitCmapPrivFunc)(/* ColormapPtr */);
+typedef struct _ColormapRec *ColormapPtr;
+typedef int (*InitCmapPrivFunc)(
+#if NeedNestedPrototypes
+ ColormapPtr
+#endif
+);
extern int AllocateColormapPrivateIndex(
#if NeedFunctionPrototypes
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index ea821c7ff..cd4459c6e 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -45,18 +45,17 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/scrnintstr.h,v 1.10 2001/12/14 19:59:56 dawes Exp $ */
+
#ifndef SCREENINTSTRUCT_H
#define SCREENINTSTRUCT_H
#include "screenint.h"
#include "miscstruct.h"
-#include "region.h"
-#include "pixmap.h"
-#include "gc.h"
+#include "bstore.h"
#include "colormap.h"
#include "cursor.h"
#include "validate.h"
-#include "window.h"
#include "X11/Xproto.h"
#include "dix.h"
@@ -194,6 +193,13 @@ typedef Bool (* UnrealizeWindowProcPtr)(
#endif
);
+typedef void (* RestackWindowProcPtr)(
+#if NeedNestedPrototypes
+ WindowPtr /*pWindow*/,
+ WindowPtr /*pOldNextSib*/
+#endif
+);
+
typedef int (* ValidateTreeProcPtr)(
#if NeedNestedPrototypes
WindowPtr /*pParent*/,
@@ -218,7 +224,7 @@ typedef void (* WindowExposuresProcPtr)(
#endif
);
-typedef void (* PaintWindowBackgroundProcPtr)(
+typedef void (* PaintWindowProcPtr)(
#if NeedNestedPrototypes
WindowPtr /*pWindow*/,
RegionPtr /*pRegion*/,
@@ -226,13 +232,8 @@ typedef void (* PaintWindowBackgroundProcPtr)(
#endif
);
-typedef void (* PaintWindowBorderProcPtr)(
-#if NeedNestedPrototypes
- WindowPtr /*pWindow*/,
- RegionPtr /*pRegion*/,
- int /*what*/
-#endif
-);
+typedef PaintWindowProcPtr PaintWindowBackgroundProcPtr;
+typedef PaintWindowProcPtr PaintWindowBorderProcPtr;
typedef void (* CopyWindowProcPtr)(
#if NeedNestedPrototypes
@@ -458,6 +459,8 @@ typedef void (* ResolveColorProcPtr)(
#endif
);
+#ifdef NEED_SCREEN_REGIONS
+
typedef RegionPtr (* RegionCreateProcPtr)(
#if NeedNestedPrototypes
BoxPtr /*rect*/,
@@ -561,6 +564,18 @@ typedef Bool (* RegionNotEmptyProcPtr)(
#endif
);
+typedef Bool (* RegionBrokenProcPtr)(
+#if NeedNestedPrototypes
+ RegionPtr /*pReg*/
+#endif
+);
+
+typedef Bool (* RegionBreakProcPtr)(
+#if NeedNestedPrototypes
+ RegionPtr /*pReg*/
+#endif
+);
+
typedef void (* RegionEmptyProcPtr)(
#if NeedNestedPrototypes
RegionPtr /*pReg*/
@@ -587,12 +602,16 @@ typedef Bool (* RegionValidateProcPtr)(
#endif
);
+#endif /* NEED_SCREEN_REGIONS */
+
typedef RegionPtr (* BitmapToRegionProcPtr)(
#if NeedNestedPrototypes
PixmapPtr /*pPix*/
#endif
);
+#ifdef NEED_SCREEN_REGIONS
+
typedef RegionPtr (* RectsToRegionProcPtr)(
#if NeedNestedPrototypes
int /*nrects*/,
@@ -601,6 +620,8 @@ typedef RegionPtr (* RectsToRegionProcPtr)(
#endif
);
+#endif /* NEED_SCREEN_REGIONS */
+
typedef void (* SendGraphicsExposeProcPtr)(
#if NeedNestedPrototypes
ClientPtr /*client*/,
@@ -615,7 +636,7 @@ typedef void (* ScreenBlockHandlerProcPtr)(
#if NeedNestedPrototypes
int /*screenNum*/,
pointer /*blockData*/,
- struct timeval ** /*pTimeout*/,
+ pointer /*pTimeout*/,
pointer /*pReadmask*/
#endif
);
@@ -647,6 +668,31 @@ typedef Bool (* ModifyPixmapHeaderProcPtr)(
#endif
);
+typedef PixmapPtr (* GetWindowPixmapProcPtr)(
+#if NeedNestedPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+typedef void (* SetWindowPixmapProcPtr)(
+#if NeedNestedPrototypes
+ WindowPtr /*pWin*/,
+ PixmapPtr /*pPix*/
+#endif
+);
+
+typedef PixmapPtr (* GetScreenPixmapProcPtr)(
+#if NeedNestedPrototypes
+ ScreenPtr /*pScreen*/
+#endif
+);
+
+typedef void (* SetScreenPixmapProcPtr)(
+#if NeedNestedPrototypes
+ PixmapPtr /*pPix*/
+#endif
+);
+
typedef void (* MarkWindowProcPtr)(
#if NeedNestedPrototypes
WindowPtr /*pWin*/
@@ -797,6 +843,7 @@ typedef struct _Screen {
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
/* Pixmap procedures */
@@ -811,6 +858,11 @@ typedef struct _Screen {
TranslateBackingStoreProcPtr TranslateBackingStore;
ClearBackingStoreProcPtr ClearBackingStore;
DrawGuaranteeProcPtr DrawGuarantee;
+ /*
+ * A read/write copy of the lower level backing store vector is needed now
+ * that the functions can be wrapped.
+ */
+ BSFuncRec BackingStoreFuncs;
/* Font procedures */
@@ -843,6 +895,7 @@ typedef struct _Screen {
/* Region procedures */
+#ifdef NEED_SCREEN_REGIONS
RegionCreateProcPtr RegionCreate;
RegionInitProcPtr RegionInit;
RegionCopyProcPtr RegionCopy;
@@ -857,12 +910,17 @@ typedef struct _Screen {
RectInProcPtr RectIn;
PointInRegionProcPtr PointInRegion;
RegionNotEmptyProcPtr RegionNotEmpty;
+ RegionBrokenProcPtr RegionBroken;
+ RegionBreakProcPtr RegionBreak;
RegionEmptyProcPtr RegionEmpty;
RegionExtentsProcPtr RegionExtents;
RegionAppendProcPtr RegionAppend;
RegionValidateProcPtr RegionValidate;
+#endif /* NEED_SCREEN_REGIONS */
BitmapToRegionProcPtr BitmapToRegion;
+#ifdef NEED_SCREEN_REGIONS
RectsToRegionProcPtr RectsToRegion;
+#endif /* NEED_SCREEN_REGIONS */
SendGraphicsExposeProcPtr SendGraphicsExpose;
/* os layer procedures */
@@ -879,12 +937,17 @@ typedef struct _Screen {
CreateScreenResourcesProcPtr CreateScreenResources;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
+ GetWindowPixmapProcPtr GetWindowPixmap;
+ SetWindowPixmapProcPtr SetWindowPixmap;
+ GetScreenPixmapProcPtr GetScreenPixmap;
+ SetScreenPixmapProcPtr SetScreenPixmap;
+
PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
#ifdef PIXPRIV
int PixmapPrivateLen;
- unsigned *PixmapPrivateSizes;
- unsigned totalPixmapSize;
+ unsigned int *PixmapPrivateSizes;
+ unsigned int totalPixmapSize;
#endif
MarkWindowProcPtr MarkWindow;
diff --git a/include/servermd.h b/include/servermd.h
index eb6b7b272..9c413b0cb 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.53 2002/05/31 18:46:04 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -44,9 +45,10 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $Xorg: servermd.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
+
#ifndef SERVERMD_H
#define SERVERMD_H 1
-/* $Xorg: servermd.h,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */
/*
* Machine dependent values:
@@ -130,12 +132,87 @@ SOFTWARE.
#endif /* vax */
+#ifdef __arm32__
+
+#define IMAGE_BYTE_ORDER LSBFirst
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
+# define BITMAP_BIT_ORDER MSBFirst
+# else
+# define BITMAP_BIT_ORDER LSBFirst
+# endif
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16)
+# define BITMAP_SCANLINE_UNIT 8
+# endif
+
+#define GLYPHPADBYTES 4
+#define GETLEFTBITS_ALIGNMENT 1
+#define LARGE_INSTRUCTION_CACHE
+#define AVOID_MEMORY_READ
+
+#endif /* __arm32__ */
+
+#if defined (__hppa__)
+
+#define IMAGE_BYTE_ORDER MSBFirst
+#define BITMAP_BIT_ORDER MSBFirst
+#define GLYPHPADBYTES 4 /* to make fb work */
+#define GETLEFTBITS_ALIGNMENT 1 /* PA forces longs to 4 */
+ /* byte boundries */
+#define AVOID_MEMORY_READ
+#define FAST_CONSTANT_OFFSET_MODE
+#define LARGE_INSTRUCTION_CACHE
+#define PLENTIFUL_REGISTERS
+
+#endif /* __hppa__ */
+
+#if defined(__powerpc__)
+
+#define IMAGE_BYTE_ORDER MSBFirst
+#define BITMAP_BIT_ORDER MSBFirst
+#define GLYPHPADBYTES 4
+#define GETLEFTBITS_ALIGNMENT 1
+
+/* XXX Should this be for Lynx only? */
+#ifdef Lynx
+#define BITMAP_SCANLINE_UNIT 8
+#endif
+
+#define LARGE_INSTRUCTION_CACHE
+#define FAST_CONSTANT_OFFSET_MODE
+#define PLENTIFUL_REGISTERS
+#define AVOID_MEMORY_READ
+
+#define FAST_MEMCPY
+
+#endif /* PowerPC */
+
+#if defined(__sh__)
+
+#if defined(__BIG_ENDIAN__)
+# define IMAGE_BYTE_ORDER MSBFirst
+# define BITMAP_BIT_ORDER MSBFirst
+# define GLYPHPADBYTES 4
+# define GETLEFTBITS_ALIGNMENT 1
+#else
+# define IMAGE_BYTE_ORDER LSBFirst
+# define BITMAP_BIT_ORDER LSBFirst
+# define GLYPHPADBYTES 4
+# define GETLEFTBITS_ALIGNMENT 1
+#endif
+
+#define AVOID_MEMORY_READ
+#define FAST_CONSTANT_OFFSET_MODE
+#define LARGE_INSTRUCTION_CACHE
+#define PLENTIFUL_REGISTERS
+
+#endif /* SuperH */
+
+
#if (defined(sun) && !(defined(i386) && defined(SVR4))) || \
- (defined(AMOEBA) && (defined(sparc) || defined(mc68000))) || \
(defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \
- (defined(Lynx) && defined(__sparc__)) || \
- ((defined(__NetBSD__) || defined(__OpenBSD__)) && \
- (defined(__sparc__) || defined(__mc68000__)))
+ defined(__sparc__) || defined(__mc68000__)
#if defined(sun386) || defined(sun5)
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */
@@ -159,7 +236,7 @@ SOFTWARE.
#define GLYPHPADBYTES 4
#define GETLEFTBITS_ALIGNMENT 1
-#endif /* sun */
+#endif /* sun && !(i386 && SVR4) */
#if defined(AIXV3)
@@ -252,31 +329,100 @@ SOFTWARE.
#endif /* mips */
-#if defined(__alpha) || defined(__alphaCross)
+#if defined(__alpha) || defined(__alpha__) || defined(__alphaCross)
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */
-# define BITMAP_BIT_ORDER LSBFirst
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
+# define BITMAP_BIT_ORDER MSBFirst
+# else
+# define BITMAP_BIT_ORDER LSBFirst
+# endif
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16)
+# define BITMAP_SCANLINE_UNIT 8
+# endif
+
# define GLYPHPADBYTES 4
# define GETLEFTBITS_ALIGNMENT 1
# define FAST_CONSTANT_OFFSET_MODE
# define LARGE_INSTRUCTION_CACHE
# define PLENTIFUL_REGISTERS
-/* pad scanline to a longword */
-#define BITMAP_SCANLINE_UNIT 64
+#endif /* alpha */
+
+#if defined (linux) && defined (__s390__)
-#define BITMAP_SCANLINE_PAD 64
-#define LOG2_BITMAP_PAD 6
-#define LOG2_BYTES_PER_SCANLINE_PAD 3
+#define IMAGE_BYTE_ORDER MSBFirst
+#define BITMAP_BIT_ORDER MSBFirst
+#define GLYPHPADBYTES 4
+#define GETLEFTBITS_ALIGNMENT 1
+
+#define BITMAP_SCANLINE_UNIT 8
+#define LARGE_INSTRUCTION_CACHE
+#define FAST_CONSTANT_OFFSET_MODE
+#define FAST_UNALIGNED_READ
-/* Add for handling protocol XPutImage and XGetImage; see comment below */
-#define INTERNAL_VS_EXTERNAL_PADDING
-#define BITMAP_SCANLINE_UNIT_PROTO 32
+#define FAST_MEMCPY
-#define BITMAP_SCANLINE_PAD_PROTO 32
-#define LOG2_BITMAP_PAD_PROTO 5
-#define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2
+#endif /* linux/s390 */
-#endif /* alpha */
+#if defined (linux) && defined (__s390x__)
+
+#define IMAGE_BYTE_ORDER MSBFirst
+#define BITMAP_BIT_ORDER MSBFirst
+#define GLYPHPADBYTES 4
+#define GETLEFTBITS_ALIGNMENT 1
+
+#define BITMAP_SCANLINE_UNIT 8
+#define LARGE_INSTRUCTION_CACHE
+#define FAST_CONSTANT_OFFSET_MODE
+#define FAST_UNALIGNED_READ
+
+#define FAST_MEMCPY
+#endif /* linux/s390x */
+
+
+#if defined(__ia64__) || defined(ia64)
+# define IMAGE_BYTE_ORDER LSBFirst
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
+# define BITMAP_BIT_ORDER MSBFirst
+# else
+# define BITMAP_BIT_ORDER LSBFirst
+# endif
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16)
+# define BITMAP_SCANLINE_UNIT 8
+# endif
+
+# define GLYPHPADBYTES 4
+# define GETLEFTBITS_ALIGNMENT 1
+# define FAST_CONSTANT_OFFSET_MODE
+# define LARGE_INSTRUCTION_CACHE
+# define PLENTIFUL_REGISTERS
+
+#endif /* ia64 */
+
+#if defined(__x86_64__) || defined(x86_64)
+# define IMAGE_BYTE_ORDER LSBFirst
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
+# define BITMAP_BIT_ORDER MSBFirst
+# else
+# define BITMAP_BIT_ORDER LSBFirst
+# endif
+
+# if defined(XF86MONOVGA) || defined(XF86VGA16)
+# define BITMAP_SCANLINE_UNIT 8
+# endif
+
+# define GLYPHPADBYTES 4
+# define GETLEFTBITS_ALIGNMENT 1
+# define LARGE_INSTRUCTION_CACHE
+# define FAST_CONSTANT_OFFSET_MODE
+/* ???? */
+# define FAST_UNALIGNED_READS
+#endif /* x86_64 */
#ifdef stellar
@@ -308,18 +454,14 @@ SOFTWARE.
#endif /* luna */
-#if ((defined(SVR4) && defined(i386)) || \
- (defined(SYSV) && defined(i386)) || \
- (defined(sun) && defined (i386) && defined(SVR4)) || \
- defined(__bsdi__) || \
- (defined(__NetBSD__) && defined(__i386__)) || \
- defined(__FreeBSD__) || \
- defined(MACH386) || \
- defined(linux) || \
- (defined(AMOEBA) && defined(i80386)) || \
- defined(MINIX) || \
- defined(WIN32))
-
+#if (defined(SVR4) && defined(i386)) || \
+ defined(__alpha__) || defined(__alpha) || \
+ defined(__i386__) || \
+ defined(__UNIXOS2__) || \
+ defined(__OS2ELF__) || \
+ defined(__QNX__) || \
+ defined(__s390x__) || defined(__s390__)
+
#ifndef IMAGE_BYTE_ORDER
#define IMAGE_BYTE_ORDER LSBFirst
#endif
@@ -353,6 +495,15 @@ SOFTWARE.
#endif /* SVR4 / BSD / i386 */
+#if defined (linux) && defined (__mc68000__)
+
+#define IMAGE_BYTE_ORDER MSBFirst
+#define BITMAP_BIT_ORDER MSBFirst
+#define FAST_UNALIGNED_READS
+#define GLYPHPADBYTES 4
+#define GETLEFTBITS_ALIGNMENT 1
+
+#endif /* linux/m68k */
#ifdef sgi
@@ -364,21 +515,6 @@ SOFTWARE.
# define GLYPHPADBYTES 4
# define GETLEFTBITS_ALIGNMENT 1
-/* pad scanline to a longword */
-#define BITMAP_SCANLINE_UNIT 64
-
-#define BITMAP_SCANLINE_PAD 64
-#define LOG2_BITMAP_PAD 6
-#define LOG2_BYTES_PER_SCANLINE_PAD 3
-
-/* Add for handling protocol XPutImage and XGetImage; see comment below */
-#define INTERNAL_VS_EXTERNAL_PADDING
-#define BITMAP_SCANLINE_UNIT_PROTO 32
-
-#define BITMAP_SCANLINE_PAD_PROTO 32
-#define LOG2_BITMAP_PAD_PROTO 5
-#define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2
-
#else
#define GLYPHPADBYTES 2
@@ -393,18 +529,20 @@ SOFTWARE.
#endif
+/* linux on the Compaq Itsy */
+#if defined(linux) && defined(__arm__)
+#define IMAGE_BYTE_ORDER LSBFirst
+#define BITMAP_BIT_ORDER LSBFirst
+#define GLYPHPADBYTES 4
+#define GETLEFTBITS_ALIGNMENT 1
+#endif
+
/* size of buffer to use with GetImage, measured in bytes. There's obviously
* a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
* you) used and the number of times the ddx routine has to be called.
- *
- * for a 1024 x 864 bit monochrome screen with a 32 bit word we get
- * 8192/4 words per buffer
- * (1024/32) = 32 words per scanline
- * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
- * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
*/
#ifndef IMAGE_BUFSIZE
-#define IMAGE_BUFSIZE 8192
+#define IMAGE_BUFSIZE (64*1024)
#endif
/* pad scanline to a longword */
@@ -429,12 +567,22 @@ typedef struct _PaddingInfo {
int padRoundUp; /* pixels per pad unit - 1 */
int padPixelsLog2; /* log 2 (pixels per pad unit) */
int padBytesLog2; /* log 2 (bytes per pad unit) */
+ int notPower2; /* bitsPerPixel not a power of 2 */
+ int bytesPerPixel; /* only set when notPower2 is TRUE */
+ int bitsPerPixel; /* bits per pixel */
} PaddingInfo;
extern PaddingInfo PixmapWidthPaddingInfo[];
+/* The only portable way to get the bpp from the depth is to look it up */
+#define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel)
+
#define PixmapWidthInPadUnits(w, d) \
+ (PixmapWidthPaddingInfo[d].notPower2 ? \
+ (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
+ PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
+ PixmapWidthPaddingInfo[d].padBytesLog2) : \
((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
- PixmapWidthPaddingInfo[d].padPixelsLog2)
+ PixmapWidthPaddingInfo[d].padPixelsLog2))
/*
* Return the number of bytes to which a scanline of the given
@@ -446,38 +594,8 @@ extern PaddingInfo PixmapWidthPaddingInfo[];
#define BitmapBytePad(w) \
(((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
-
-/* This is defined if the server's internal padding is different from the padding
- * advertised in the protocol. The protocol does not allow for padding to
- * 64 bits, for example, so if the server wants to use 64 bit padding internally,
- * it has to advertise 32 bit padding and do padding fixups whenever images
- * cross the wire. (See ProcGetImage and ProcPutImage.)
- *
- * The macros and constants that end in Proto or PROTO refer to the advertised
- * padding, and the ones without Proto are for internal padding.
- */
-
-extern PaddingInfo PixmapWidthPaddingInfoProto[];
-
-#define PixmapWidthInPadUnitsProto(w, d) \
- ((int)((w) + PixmapWidthPaddingInfoProto[d].padRoundUp) >> \
- PixmapWidthPaddingInfoProto[d].padPixelsLog2)
-
-#define PixmapBytePadProto(w, d) \
- (PixmapWidthInPadUnitsProto(w, d) << \
- PixmapWidthPaddingInfoProto[d].padBytesLog2)
-
-#define BitmapBytePadProto(w) \
- ((((w) + BITMAP_SCANLINE_PAD_PROTO - 1) >> LOG2_BITMAP_PAD_PROTO) \
- << LOG2_BYTES_PER_SCANLINE_PAD_PROTO)
-
-#else /* protocol and internal padding is the same */
-
#define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d)
#define PixmapBytePadProto(w, d) PixmapBytePad(w, d)
#define BitmapBytePadProto(w) BitmapBytePad(w)
-#endif /* protocol vs. internal padding */
-
#endif /* SERVERMD_H */
diff --git a/include/site.h b/include/site.h
index 426842183..36a05eb73 100644
--- a/include/site.h
+++ b/include/site.h
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/include/site.h,v 1.8 2001/12/19 21:37:35 dawes Exp $ */
#ifndef SITE_H
#define SITE_H
@@ -99,19 +100,12 @@ SOFTWARE.
#else
#define DEFAULT_AUTOREPEAT FALSE
#endif
-#ifdef hpux
#define DEFAULT_AUTOREPEATS {\
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
-#else
-#define DEFAULT_AUTOREPEATS {\
- 0, 0, 0, 0, 0, 0, 0, 0,\
- 0, 0, 0, 0, 0, 0, 0, 0,\
- 0, 0, 0, 0, 0, 0, 0, 0,\
- 0, 0, 0, 0, 0, 0, 0, 0 }
-#endif
+
#define DEFAULT_LEDS 0x0 /* all off */
#define DEFAULT_LEDS_MASK 0xffffffff /* 32 */
#define DEFAULT_INT_RESOLUTION 1000
diff --git a/include/validate.h b/include/validate.h
index 7cff3a63d..2a13962a7 100644
--- a/include/validate.h
+++ b/include/validate.h
@@ -24,6 +24,7 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/include/validate.h,v 1.5 2001/12/14 19:59:56 dawes Exp $ */
#ifndef VALIDATE_H
#define VALIDATE_H
@@ -31,7 +32,7 @@ in this Software without prior written authorization from The Open Group.
#include "miscstruct.h"
#include "regionstr.h"
-typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap } VTKind;
+typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap, VTBroken } VTKind;
/* union _Validate is now device dependent; see mivalidate.h for an example */
typedef union _Validate *ValidatePtr;
diff --git a/include/window.h b/include/window.h
index 5c17f43be..c46714aab 100644
--- a/include/window.h
+++ b/include/window.h
@@ -161,6 +161,11 @@ extern void DestroySubwindows(
#endif
);
+/* Quartz support on Mac OS X uses the HIToolbox
+ framework whose ChangeWindowAttributes function conflicts here. */
+#ifdef __DARWIN__
+#define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes
+#endif
extern int ChangeWindowAttributes(
#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
@@ -170,7 +175,14 @@ extern int ChangeWindowAttributes(
#endif
);
+/* Quartz support on Mac OS X uses the HIToolbox
+ framework whose GetWindowAttributes function conflicts here. */
+#ifdef __DARWIN__
+#define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x)
+extern void Darwin_X_GetWindowAttributes(
+#else
extern void GetWindowAttributes(
+#endif
#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
ClientPtr /*client*/,
diff --git a/include/windowstr.h b/include/windowstr.h
index 31de609b8..4dee291d0 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.6 2001/12/14 19:59:57 dawes Exp $ */
#ifndef WINDOWSTRUCT_H
#define WINDOWSTRUCT_H
diff --git a/lbx/lbxcmap.c b/lbx/lbxcmap.c
index 6af20b03b..25ef34426 100644
--- a/lbx/lbxcmap.c
+++ b/lbx/lbxcmap.c
@@ -25,6 +25,7 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxcmap.c,v 1.10 2001/12/14 19:59:59 dawes Exp $ */
#include <sys/types.h>
#define NEED_REPLIES
@@ -38,6 +39,7 @@ from The Open Group.
#include "resource.h"
#include "scrnintstr.h"
#include "colormapst.h"
+#include "propertyst.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
#include "lbxserve.h"
@@ -50,6 +52,7 @@ static int lbxColormapPrivIndex; /* lbx colormap private index */
typedef struct { /* lbx screen private */
CreateColormapProcPtr CreateColormap;
DestroyColormapProcPtr DestroyColormap;
+ CloseScreenProcPtr CloseScreen;
} LbxScreenPriv;
typedef struct _LbxStalled {
@@ -70,8 +73,7 @@ typedef struct _LbxColormapPriv { /* lbx colormap private */
#define CMAP_GRABBED 1
#define CMAP_WAITING_FOR_UNGRAB 2
-static int LbxUnstallClient();
-void LbxReleaseCmap();
+static int LbxUnstallClient(pointer data, XID id);
static RESTYPE StalledResType;
@@ -80,8 +82,7 @@ static RESTYPE StalledResType;
*/
static LbxColormapPriv *
-LbxColormapPrivInit (pmap)
- ColormapPtr pmap;
+LbxColormapPrivInit (ColormapPtr pmap)
{
LbxColormapPriv *cmapPriv;
@@ -103,16 +104,18 @@ LbxColormapPrivInit (pmap)
static int
-LbxDefCmapPrivInit (pmap)
- ColormapPtr pmap;
+LbxDefCmapPrivInit (ColormapPtr pmap)
{
+#if 0
+ /* BUG: You can't do that. lbxColormapPrivIndex hasn't
+ been initialized yet. */
pmap->devPrivates[lbxColormapPrivIndex].ptr = NULL;
+#endif
return 1;
}
static Bool
-LbxCreateColormap (pmap)
- ColormapPtr pmap;
+LbxCreateColormap (ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
Bool ret;
@@ -129,8 +132,7 @@ LbxCreateColormap (pmap)
}
static void
-LbxDestroyColormap (pmap)
- ColormapPtr pmap;
+LbxDestroyColormap (ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
@@ -143,15 +145,30 @@ LbxDestroyColormap (pmap)
pScreen->DestroyColormap = LbxDestroyColormap;
}
+static Bool
+LbxCloseScreen(int i, ScreenPtr pScreen)
+{
+ LbxScreenPriv* pLbxScrPriv = ((LbxScreenPriv *)
+ (pScreen->devPrivates[lbxScreenPrivIndex].ptr));
+
+ pScreen->CloseScreen = pLbxScrPriv->CloseScreen;
+
+ xfree(pScreen->devPrivates[lbxScreenPrivIndex].ptr);
+ pScreen->devPrivates[lbxScreenPrivIndex].ptr = NULL;
+
+ return pScreen->CloseScreen(i, pScreen);
+}
+
/*
* Initialize LBX colormap private.
*/
int
-LbxCmapInit ()
+LbxCmapInit (void)
{
LbxScreenPriv *pScreenPriv;
+ ColormapPtr defMap;
ScreenPtr pScreen;
int i;
@@ -169,6 +186,12 @@ LbxCmapInit ()
{
pScreen = screenInfo.screens[i];
+ defMap = (ColormapPtr) LookupIDByType(
+ pScreen->defColormap, RT_COLORMAP);
+
+ /* now lbxColormapPrivIndex exists */
+ defMap->devPrivates[lbxColormapPrivIndex].ptr = NULL;
+
pScreenPriv = (LbxScreenPriv *) xalloc (sizeof (LbxScreenPriv));
if (!pScreenPriv)
return 0;
@@ -177,21 +200,21 @@ LbxCmapInit ()
pScreen->CreateColormap = LbxCreateColormap;
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
pScreen->DestroyColormap = LbxDestroyColormap;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = LbxCloseScreen;
pScreen->devPrivates[lbxScreenPrivIndex].ptr = (pointer) pScreenPriv;
}
return 1;
}
-
/*
* Return the number of allocated cells in the PSEUDO colormap.
*/
static int
-NumAllocatedCells (pent, size)
- EntryPtr pent;
- int size;
+NumAllocatedCells (EntryPtr pent,
+ int size)
{
Pixel pixel;
int count = 0;
@@ -222,13 +245,12 @@ NumAllocatedCells (pent, size)
*/
static CARD8 *
-OutputChannel(pmap, chan, size, ptr, flags, channels)
- ColormapPtr pmap;
- EntryPtr chan;
- int size;
- CARD8 *ptr;
- CARD8 flags;
- CARD8 channels;
+OutputChannel(ColormapPtr pmap,
+ EntryPtr chan,
+ int size,
+ CARD8 *ptr,
+ CARD8 flags,
+ CARD8 channels)
{
Bool px2;
Bool rgb2;
@@ -247,7 +269,7 @@ OutputChannel(pmap, chan, size, ptr, flags, channels)
else
shift = 15 - (flags & LBX_RGB_BITS_MASK);
rgb_sz = rgb2 + 1;
- if (channels == DoRed|DoGreen|DoBlue)
+ if (channels == (DoRed|DoGreen|DoBlue))
rgb_sz *= 3;
/* kinda gross, but ddxen use AllocAll on static maps */
allocpriv = (pmap->pVisual->class & DynamicClass) ? AllocPrivate : 0;
@@ -332,11 +354,10 @@ OutputChannel(pmap, chan, size, ptr, flags, channels)
}
static void
-GetAllocatedCells (pmap, flags, buf, bytes)
- ColormapPtr pmap;
- CARD8 *flags;
- CARD8 *buf;
- int *bytes;
+GetAllocatedCells (ColormapPtr pmap,
+ CARD8 *flags,
+ CARD8 *buf,
+ int *bytes)
{
CARD8 *ptr;
@@ -368,9 +389,8 @@ GetAllocatedCells (pmap, flags, buf, bytes)
*/
static void
-SendReleaseCmapEvent (proxy, cmap)
- LbxProxyPtr proxy;
- Colormap cmap;
+SendReleaseCmapEvent (LbxProxyPtr proxy,
+ Colormap cmap)
{
xLbxReleaseCmapEvent ev;
ClientPtr client;
@@ -413,9 +433,8 @@ SendReleaseCmapEvent (proxy, cmap)
*/
static Bool
-WaitForServerCmapControl (client, pmap)
- register ClientPtr client;
- register ColormapPtr pmap;
+WaitForServerCmapControl (ClientPtr client,
+ ColormapPtr pmap)
{
LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
(pmap->devPrivates[lbxColormapPrivIndex].ptr);
@@ -449,10 +468,9 @@ WaitForServerCmapControl (client, pmap)
*/
Bool
-LbxCheckColorRequest (client, pmap, req)
- ClientPtr client;
- ColormapPtr pmap;
- xReq *req;
+LbxCheckColorRequest (ClientPtr client,
+ ColormapPtr pmap,
+ xReq *req)
{
LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
(pmap->devPrivates[lbxColormapPrivIndex].ptr);
@@ -543,9 +561,8 @@ LbxCheckColorRequest (client, pmap, req)
}
static Bool
-LbxGrabbedByClient (client, pmap)
- ClientPtr client;
- ColormapPtr pmap;
+LbxGrabbedByClient (ClientPtr client,
+ ColormapPtr pmap)
{
LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
(pmap->devPrivates[lbxColormapPrivIndex].ptr);
@@ -559,8 +576,7 @@ LbxGrabbedByClient (client, pmap)
*/
int
-LbxCheckCmapGrabbed (pmap)
- ColormapPtr pmap;
+LbxCheckCmapGrabbed (ColormapPtr pmap)
{
LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
(pmap->devPrivates[lbxColormapPrivIndex].ptr);
@@ -574,8 +590,7 @@ LbxCheckCmapGrabbed (pmap)
*/
void
-LbxDisableSmartGrab (pmap)
- ColormapPtr pmap;
+LbxDisableSmartGrab (ColormapPtr pmap)
{
LbxColormapPriv *cmapPriv = (LbxColormapPriv *)
(pmap->devPrivates[lbxColormapPrivIndex].ptr);
@@ -590,11 +605,10 @@ LbxDisableSmartGrab (pmap)
*/
static void
-SendFreeCellsEvent (proxy, cmap, pixel_start, pixel_end)
- LbxProxyPtr proxy;
- Colormap cmap;
- Pixel pixel_start;
- Pixel pixel_end;
+SendFreeCellsEvent (LbxProxyPtr proxy,
+ Colormap cmap,
+ Pixel pixel_start,
+ Pixel pixel_end)
{
xLbxFreeCellsEvent ev;
ClientPtr client;
@@ -643,8 +657,7 @@ static long pixel_end;
/*ARGSUSED*/
void
-LbxBeginFreeCellsEvent (pmap)
- ColormapPtr pmap;
+LbxBeginFreeCellsEvent (ColormapPtr pmap)
{
pixel_start = -1;
pixel_end = -1;
@@ -652,9 +665,8 @@ LbxBeginFreeCellsEvent (pmap)
void
-LbxAddFreeCellToEvent (pmap, pixel)
- ColormapPtr pmap;
- Pixel pixel;
+LbxAddFreeCellToEvent (ColormapPtr pmap,
+ Pixel pixel)
{
/*
* We must notify the proxy that has this colormap
@@ -688,8 +700,7 @@ LbxAddFreeCellToEvent (pmap, pixel)
}
void
-LbxEndFreeCellsEvent (pmap)
- ColormapPtr pmap;
+LbxEndFreeCellsEvent (ColormapPtr pmap)
{
/*
* Check if there is an LbxFreeCellEvent we need to write.
@@ -713,9 +724,8 @@ LbxEndFreeCellsEvent (pmap)
*/
void
-LbxSortPixelList (pixels, count)
- Pixel *pixels;
- int count;
+LbxSortPixelList (Pixel *pixels,
+ int count)
{
int i, j;
@@ -735,8 +745,7 @@ LbxSortPixelList (pixels, count)
*/
int
-ProcLbxGrabCmap(client)
- register ClientPtr client;
+ProcLbxGrabCmap(ClientPtr client)
{
REQUEST(xLbxGrabCmapReq);
xLbxGrabCmapReply *reply;
@@ -928,9 +937,8 @@ ProcLbxGrabCmap(client)
}
static int
-LbxUnstallClient(data, id)
- pointer data;
- XID id;
+LbxUnstallClient(pointer data,
+ XID id)
{
LbxColormapPriv *cmapPriv = (LbxColormapPriv *)data;
LbxStalled **prev;
@@ -946,9 +954,8 @@ LbxUnstallClient(data, id)
}
void
-LbxReleaseCmap(pmap, smart)
- ColormapPtr pmap;
- Bool smart;
+LbxReleaseCmap(ColormapPtr pmap,
+ Bool smart)
{
LbxColormapPriv *cmapPriv;
ColormapPtr *prev;
@@ -980,8 +987,7 @@ LbxReleaseCmap(pmap, smart)
*/
int
-ProcLbxReleaseCmap(client)
- register ClientPtr client;
+ProcLbxReleaseCmap(ClientPtr client)
{
REQUEST(xLbxReleaseCmapReq);
ColormapPtr pmap;
@@ -1014,8 +1020,7 @@ ProcLbxReleaseCmap(client)
*/
int
-ProcLbxAllocColor(client)
- register ClientPtr client;
+ProcLbxAllocColor(ClientPtr client)
{
REQUEST(xLbxAllocColorReq);
ColormapPtr pmap;
@@ -1074,8 +1079,7 @@ ProcLbxAllocColor(client)
*/
int
-ProcLbxIncrementPixel(client)
- register ClientPtr client;
+ProcLbxIncrementPixel(ClientPtr client)
{
REQUEST(xLbxIncrementPixelReq);
ColormapPtr pmap;
diff --git a/lbx/lbxdix.c b/lbx/lbxdix.c
index e4822f190..5a40614f6 100644
--- a/lbx/lbxdix.c
+++ b/lbx/lbxdix.c
@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.8 2001/12/14 19:59:59 dawes Exp $ */
/* various bits of DIX-level mangling */
@@ -72,18 +73,15 @@ in this Software without prior written authorization from The Open Group.
#include "lbxtags.h"
#include "lbxdata.h"
#include "Xfuncproto.h"
+#ifdef XAPPGROUP
+#include "Xagsrv.h"
+#endif
+#include "swaprep.h"
-extern void CopySwap32Write();
-extern int (*ProcVector[256]) ();
-extern int (*SwappedProcVector[256]) ();
-extern void (*ReplySwapVector[256]) ();
-
-extern void LbxWriteSConnSetupPrefix();
-
-int lbx_font_private;
+int lbx_font_private = -1;
void
-LbxDixInit()
+LbxDixInit(void)
{
TagInit();
lbx_font_private = AllocateFontPrivateIndex();
@@ -91,23 +89,20 @@ LbxDixInit()
/* ARGSUSED */
void
-LbxAllowMotion(client, num)
- ClientPtr client;
- int num;
+LbxAllowMotion(ClientPtr client,
+ int num)
{
LbxProxyPtr proxy = LbxProxy(client);
proxy->motion_allowed_events += num;
}
-extern WindowPtr *WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
int
-LbxSendConnSetup(client, reason)
- ClientPtr client;
- char *reason;
+LbxSendConnSetup(ClientPtr client,
+ char *reason)
{
int dlength;
int i, ndex, lim, wndex;
@@ -190,13 +185,10 @@ LbxSendConnSetup(client, reason)
return client->noClientException;
}
-extern InputInfo inputInfo;
-
static XID modifier_map_tag;
int
-LbxGetModifierMapping(client)
- ClientPtr client;
+LbxGetModifierMapping(ClientPtr client)
{
TagData td;
pointer tagdata;
@@ -245,7 +237,7 @@ LbxGetModifierMapping(client)
}
void
-LbxFlushModifierMapTag()
+LbxFlushModifierMapTag(void)
{
if (modifier_map_tag)
@@ -255,8 +247,7 @@ LbxFlushModifierMapTag()
static XID keyboard_map_tag;
int
-LbxGetKeyboardMapping(client)
- ClientPtr client;
+LbxGetKeyboardMapping(ClientPtr client)
{
TagData td;
pointer tagdata;
@@ -318,7 +309,7 @@ LbxGetKeyboardMapping(client)
WriteToClient(client, sizeof(xLbxGetKeyboardMappingReply), (char *)&rep);
if (send_data) {
- client->pSwapReplyFunc = CopySwap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient(client,
curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
&curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) *
@@ -328,7 +319,7 @@ LbxGetKeyboardMapping(client)
}
void
-LbxFlushKeyboardMapTag()
+LbxFlushKeyboardMapTag(void)
{
if (keyboard_map_tag)
TagDeleteTag(keyboard_map_tag);
@@ -336,8 +327,7 @@ LbxFlushKeyboardMapTag()
/* counts number of bits needed to hold value */
static int
-_bitsize(val)
- int val;
+_bitsize(int val)
{
int bits = 1; /* always need one for sign bit */
@@ -364,10 +354,9 @@ _bitsize(val)
int _lbx_fi_junklen = sizeof(BYTE) * 2 + sizeof(CARD16) + sizeof(CARD32);
static int
-squish_font_info(qfr, rlen, sqrep)
- xQueryFontReply *qfr;
- int rlen;
- xLbxFontInfo **sqrep;
+squish_font_info(xQueryFontReply *qfr,
+ int rlen,
+ xLbxFontInfo **sqrep)
{
int len,
hlen;
@@ -459,8 +448,7 @@ squish_font_info(qfr, rlen, sqrep)
}
int
-LbxQueryFont(client)
- ClientPtr client;
+LbxQueryFont(ClientPtr client)
{
xQueryFontReply *reply;
xLbxQueryFontReply lbxrep;
@@ -596,8 +584,7 @@ LbxQueryFont(client)
}
void
-LbxFreeFontTag(pfont)
- FontPtr pfont;
+LbxFreeFontTag(FontPtr pfont)
{
FontTagInfoPtr ftip;
@@ -606,19 +593,18 @@ LbxFreeFontTag(pfont)
TagDeleteTag(ftip->tid);
}
-LbxInvalidateTag(client, tag)
- ClientPtr client;
- XID tag;
+int
+LbxInvalidateTag(ClientPtr client,
+ XID tag)
{
TagClearProxy(tag, LbxProxyID(client));
return client->noClientException;
}
void
-LbxSendInvalidateTag(client, tag, tagtype)
- ClientPtr client;
- XID tag;
- int tagtype;
+LbxSendInvalidateTag(ClientPtr client,
+ XID tag,
+ int tagtype)
{
xLbxInvalidateTagEvent ev;
int n;
@@ -641,10 +627,9 @@ LbxSendInvalidateTag(client, tag, tagtype)
}
static void
-LbxSendSendTagData(pid, tag, tagtype)
- int pid;
- XID tag;
- int tagtype;
+LbxSendSendTagData(int pid,
+ XID tag,
+ int tagtype)
{
xLbxSendTagDataEvent ev;
int n;
@@ -693,16 +678,15 @@ static SendTagQPtr queried_tags = NULL;
#define LbxSendTagAlreadySent 1
static Bool
-LbxQueueSendTag(client, tag)
- ClientPtr client;
- XID tag;
+LbxQueueSendTag(ClientPtr client,
+ XID tag)
{
SendTagQPtr stqp, *prev, new;
ClientPtr *newlist;
/* see if we're asking for one already in the pipeline */
- for (prev = &queried_tags; stqp = *prev; prev = &stqp->next) {
+ for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) {
if (stqp->tag == tag) {
/* add new client to list */
newlist = (ClientPtr *) xrealloc(stqp->stalled_clients,
@@ -735,9 +719,8 @@ LbxQueueSendTag(client, tag)
return LbxSendTagSendIt;
}
-SendTagQPtr
-LbxFindQTag(tag)
- XID tag;
+static SendTagQPtr
+LbxFindQTag(XID tag)
{
SendTagQPtr stqp;
@@ -749,20 +732,18 @@ LbxFindQTag(tag)
}
static void
-LbxFreeQTag(stqp)
- SendTagQPtr stqp;
+LbxFreeQTag(SendTagQPtr stqp)
{
xfree(stqp->stalled_clients);
xfree(stqp);
}
static void
-LbxRemoveQTag(tag)
- XID tag;
+LbxRemoveQTag(XID tag)
{
SendTagQPtr stqp, *prev;
- for (prev = &queried_tags; stqp = *prev; prev = &stqp->next) {
+ for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) {
if (stqp->tag == tag) {
*prev = stqp->next;
LbxFreeQTag(stqp);
@@ -772,8 +753,7 @@ LbxRemoveQTag(tag)
}
Bool
-LbxFlushQTag(tag)
- XID tag;
+LbxFlushQTag(XID tag)
{
SendTagQPtr stqp;
ClientPtr *cp;
@@ -788,7 +768,7 @@ LbxFlushQTag(tag)
}
void
-ProcessQTagZombies()
+ProcessQTagZombies(void)
{
SendTagQPtr stqp;
ClientPtr *out, *in;
@@ -810,11 +790,10 @@ ProcessQTagZombies()
*/
void
-LbxQueryTagData(client, owner_pid, tag, tagtype)
- ClientPtr client;
- int owner_pid;
- XID tag;
- int tagtype;
+LbxQueryTagData(ClientPtr client,
+ int owner_pid,
+ XID tag,
+ int tagtype)
{
/* save the info and the client being stalled */
if (LbxQueueSendTag(client, tag) == LbxSendTagSendIt)
@@ -825,11 +804,10 @@ LbxQueryTagData(client, owner_pid, tag, tagtype)
* server recieves this
*/
int
-LbxTagData(client, tag, len, data)
- ClientPtr client;
- XID tag;
- unsigned long len;
- pointer data;
+LbxTagData(ClientPtr client,
+ XID tag,
+ unsigned long len,
+ pointer data)
{
TagData td;
PropertyPtr pProp;
@@ -872,7 +850,7 @@ LbxTagData(client, tag, len, data)
/* when server resets, need to reset global tags */
void
-LbxResetTags()
+LbxResetTags(void)
{
SendTagQPtr stqp;
@@ -880,7 +858,7 @@ LbxResetTags()
keyboard_map_tag = 0;
/* clean out any pending tag requests */
- while (stqp = queried_tags) {
+ while ((stqp = queried_tags)) {
queried_tags = stqp->next;
LbxFreeQTag(stqp);
}
diff --git a/lbx/lbxexts.c b/lbx/lbxexts.c
index 4ee5f87c6..d611a7f2c 100644
--- a/lbx/lbxexts.c
+++ b/lbx/lbxexts.c
@@ -21,13 +21,17 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxexts.c,v 1.4 2001/02/16 13:24:10 eich Exp $ */
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "dixstruct.h"
+#include "colormapst.h"
+#include "propertyst.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
+#include "lbxserve.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include "extensions/security.h"
@@ -54,15 +58,14 @@ static int num_exts = 0;
Bool
-LbxAddExtension(name, opcode, ev_base, err_base)
- char *name;
- int opcode;
- int ev_base,
- err_base;
+LbxAddExtension(char *name,
+ int opcode,
+ int ev_base,
+ int err_base)
{
int i;
- register LbxExtensionEntry *ext,
- **newexts;
+ LbxExtensionEntry *ext,
+ **newexts;
ext = (LbxExtensionEntry *) xalloc(sizeof(LbxExtensionEntry));
if (!ext)
@@ -102,9 +105,8 @@ LbxAddExtension(name, opcode, ev_base, err_base)
}
Bool
-LbxAddExtensionAlias(idx, alias)
- int idx;
- char *alias;
+LbxAddExtensionAlias(int idx,
+ char *alias)
{
char *name;
char **aliases;
@@ -125,9 +127,8 @@ LbxAddExtensionAlias(idx, alias)
}
static int
-LbxFindExtension(extname, len)
- char *extname;
- int len;
+LbxFindExtension(char *extname,
+ int len)
{
int i, j;
@@ -145,9 +146,8 @@ LbxFindExtension(extname, len)
}
void
-LbxDeclareExtensionSecurity(extname, secure)
- char *extname;
- Bool secure;
+LbxDeclareExtensionSecurity(char *extname,
+ Bool secure)
{
#ifdef XCSECURITY
int i = LbxFindExtension(extname, strlen(extname));
@@ -157,11 +157,10 @@ LbxDeclareExtensionSecurity(extname, secure)
}
Bool
-LbxRegisterExtensionGenerationMasks(idx, num_reqs, rep_mask, ev_mask)
- int idx;
- int num_reqs;
- char *rep_mask,
- *ev_mask;
+LbxRegisterExtensionGenerationMasks(int idx,
+ int num_reqs,
+ char *rep_mask,
+ char *ev_mask)
{
LbxExtensionEntry *ext = lbx_extensions[idx];
CARD8 *nrm,
@@ -186,10 +185,9 @@ LbxRegisterExtensionGenerationMasks(idx, num_reqs, rep_mask, ev_mask)
}
int
-LbxQueryExtension(client, ename, nlen)
- ClientPtr client;
- char *ename;
- int nlen;
+LbxQueryExtension(ClientPtr client,
+ char *ename,
+ int nlen)
{
xLbxQueryExtensionReply rep;
int i;
@@ -237,12 +235,15 @@ LbxQueryExtension(client, ename, nlen)
return Success;
}
-LbxCloseDownExtensions()
+void
+LbxCloseDownExtensions(void)
{
- int i;
+ int i,j;
for (i = 0; i < num_exts; i++) {
xfree(lbx_extensions[i]->name);
+ for (j = 0; j < lbx_extensions[i]->num_aliases; j++)
+ xfree(lbx_extensions[i]->aliases[j]);
xfree(lbx_extensions[i]->aliases);
xfree(lbx_extensions[i]->rep_mask);
xfree(lbx_extensions[i]->ev_mask);
@@ -251,13 +252,13 @@ LbxCloseDownExtensions()
xfree(lbx_extensions);
lbx_extensions = NULL;
num_exts = 0;
+
}
void
-LbxSetReqMask(mask, req, on)
- CARD8 *mask;
- int req;
- Bool on;
+LbxSetReqMask(CARD8 *mask,
+ int req,
+ Bool on)
{
int mword = req / (8 * sizeof(CARD8));
diff --git a/lbx/lbxgfx.c b/lbx/lbxgfx.c
index 25e87cc63..6eb7af197 100644
--- a/lbx/lbxgfx.c
+++ b/lbx/lbxgfx.c
@@ -21,6 +21,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.4 2001/08/23 14:46:57 alanh Exp $ */
/* various bits of DIX-level mangling */
@@ -48,21 +49,17 @@
#define DrawableCache(client) (LbxClient(client)->drawableCache)
#define GContextCache(client) (LbxClient(client)->gcontextCache)
-extern int (*ProcVector[256])();
-
static void
-push (cache, xid)
- XID cache[GFX_CACHE_SIZE];
- XID xid;
+push (XID cache[GFX_CACHE_SIZE],
+ XID xid)
{
memmove (cache+1, cache, (GFX_CACHE_SIZE - 1) * sizeof (cache[0]));
cache[0] = xid;
}
static XID
-use (cache, i)
- XID cache[GFX_CACHE_SIZE];
- int i;
+use (XID cache[GFX_CACHE_SIZE],
+ int i)
{
XID tmp;
@@ -77,13 +74,12 @@ use (cache, i)
extern char *ConnectionInfo;
-int
-LbxDecodeGFXCache(client, cacheEnts, after, drawp, gcp)
- ClientPtr client;
- CARD8 cacheEnts;
- char *after;
- Drawable *drawp;
- GContext *gcp;
+static int
+LbxDecodeGFXCache(ClientPtr client,
+ CARD8 cacheEnts,
+ char *after,
+ Drawable *drawp,
+ GContext *gcp)
{
int skip;
int dcache, gcache;
@@ -111,12 +107,11 @@ LbxDecodeGFXCache(client, cacheEnts, after, drawp, gcp)
return skip;
}
-int
-LbxDecodeDrawableCache(client, cacheEnts, after, drawp)
- ClientPtr client;
- CARD8 cacheEnts;
- char *after;
- Drawable *drawp;
+static int
+LbxDecodeDrawableCache(ClientPtr client,
+ CARD8 cacheEnts,
+ char *after,
+ Drawable *drawp)
{
int skip;
int dcache;
@@ -135,12 +130,12 @@ LbxDecodeDrawableCache(client, cacheEnts, after, drawp)
return skip;
}
-int
-LbxDecodeGCCache(client, cacheEnts, after, gcp)
- ClientPtr client;
- CARD8 cacheEnts;
- char *after;
- GContext *gcp;
+#ifdef notyet
+static int
+LbxDecodeGCCache(ClientPtr client,
+ CARD8 cacheEnts,
+ char *after,
+ GContext *gcp)
{
int skip;
int gcache;
@@ -158,6 +153,7 @@ LbxDecodeGCCache(client, cacheEnts, after, gcp)
*gcp = use (GContextCache(client), gcache);
return skip;
}
+#endif
#define GFX_GET_DRAWABLE_AND_GC(type,in,len) {\
int skip; \
@@ -203,10 +199,9 @@ LbxDecodeGCCache(client, cacheEnts, after, gcp)
}
int
-LbxDecodePoly(client, xreqtype, decode_rtn)
- register ClientPtr client;
- CARD8 xreqtype;
- int (*decode_rtn)();
+LbxDecodePoly(ClientPtr client,
+ CARD8 xreqtype,
+ int (*decode_rtn)(char *, char *, short *))
{
REQUEST(xLbxPolyPointReq);
char *in;
@@ -220,7 +215,7 @@ LbxDecodePoly(client, xreqtype, decode_rtn)
if ((xreq = (xPolyPointReq *)
xalloc(sizeof(xPolyPointReq) + (len << 1))) == NULL)
return BadAlloc;
- len = (*decode_rtn)(in, in + len - stuff->padBytes, &xreq[1]);
+ len = (*decode_rtn)(in, in + len - stuff->padBytes, (short *)(&xreq[1]));
xreq->reqType = xreqtype;
xreq->coordMode = 1;
xreq->drawable = drawable;
@@ -234,8 +229,7 @@ LbxDecodePoly(client, xreqtype, decode_rtn)
}
int
-LbxDecodeFillPoly(client)
- register ClientPtr client;
+LbxDecodeFillPoly(ClientPtr client)
{
REQUEST(xLbxFillPolyReq);
char *in;
@@ -314,10 +308,9 @@ LbxDecodeFillPoly(client)
}
int
-LbxDecodePoints(in, inend, out)
- register char *in;
- char *inend;
- register short *out;
+LbxDecodePoints(char *in,
+ char *inend,
+ short *out)
{
char *start_out = (char *)out;
@@ -331,12 +324,11 @@ LbxDecodePoints(in, inend, out)
}
int
-LbxDecodeSegment(in, inend, out)
- register char *in;
- char *inend;
- register short *out;
+LbxDecodeSegment(char *in,
+ char *inend,
+ short *out)
{
- register short diff;
+ short diff;
short last_x = 0;
short last_y = 0;
char *start_out = (char *)out;
@@ -362,12 +354,11 @@ LbxDecodeSegment(in, inend, out)
}
int
-LbxDecodeRectangle(in, inend, out)
- register char *in;
- char *inend;
- register short *out;
+LbxDecodeRectangle(char *in,
+ char *inend,
+ short *out)
{
- register short diff;
+ short diff;
short last_x = 0;
short last_y = 0;
char *start_out = (char *)out;
@@ -391,12 +382,11 @@ LbxDecodeRectangle(in, inend, out)
}
int
-LbxDecodeArc(in, inend, out)
- register char *in;
- char *inend;
- register short *out;
+LbxDecodeArc(char *in,
+ char *inend,
+ short *out)
{
- register short diff;
+ short diff;
short last_x = 0;
short last_y = 0;
char *start_out = (char *)out;
@@ -425,8 +415,7 @@ LbxDecodeArc(in, inend, out)
}
int
-LbxDecodeCopyArea (client)
- ClientPtr client;
+LbxDecodeCopyArea (ClientPtr client)
{
REQUEST(xLbxCopyAreaReq);
char *in;
@@ -452,8 +441,7 @@ LbxDecodeCopyArea (client)
}
int
-LbxDecodeCopyPlane (client)
- ClientPtr client;
+LbxDecodeCopyPlane (ClientPtr client)
{
REQUEST(xLbxCopyPlaneReq);
char *in;
@@ -480,9 +468,8 @@ LbxDecodeCopyPlane (client)
}
static pointer
-get_gfx_buffer(client, len)
- ClientPtr client;
- int len;
+get_gfx_buffer(ClientPtr client,
+ int len)
{
LbxClientPtr lbxClient = LbxClient(client);
pointer tmp;
@@ -499,8 +486,7 @@ get_gfx_buffer(client, len)
}
int
-LbxDecodePolyText (client)
- ClientPtr client;
+LbxDecodePolyText (ClientPtr client)
{
REQUEST(xLbxPolyTextReq);
char *in, *pos;
@@ -527,8 +513,7 @@ LbxDecodePolyText (client)
}
int
-LbxDecodeImageText (client)
- ClientPtr client;
+LbxDecodeImageText (ClientPtr client)
{
REQUEST(xLbxImageTextReq);
char *in, *pos;
@@ -556,8 +541,7 @@ LbxDecodeImageText (client)
}
int
-LbxDecodePutImage (client)
- register ClientPtr client;
+LbxDecodePutImage (ClientPtr client)
{
REQUEST (xLbxPutImageReq);
char *in, *data;
@@ -698,13 +682,12 @@ LbxDecodePutImage (client)
}
int
-LbxDecodeGetImage (client)
- register ClientPtr client;
+LbxDecodeGetImage (ClientPtr client)
{
REQUEST (xLbxGetImageReq);
xLbxGetImageReply *reply = NULL;
int lbxLen, xLen, n;
- int method, bytes, status;
+ int method = 0, bytes, status;
xGetImageReply *theImage;
REQUEST_SIZE_MATCH(xLbxGetImageReq);
diff --git a/lbx/lbxmain.c b/lbx/lbxmain.c
index 3fa565fef..1a82ce3b3 100644
--- a/lbx/lbxmain.c
+++ b/lbx/lbxmain.c
@@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxmain.c,v 1.13 2001/12/14 20:00:00 dawes Exp $ */
#include <sys/types.h>
#define NEED_REPLIES
@@ -62,18 +63,20 @@ in this Software without prior written authorization from The Open Group.
#include "gcstruct.h"
#include "extnsionst.h"
#include "servermd.h"
-#include "lbxdeltastr.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
+#include "lbxdeltastr.h"
#include "lbxserve.h"
#include "lbximage.h"
#include "lbxsrvopts.h"
+#include "lbxtags.h"
#include "Xfuncproto.h"
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
+#ifndef Lynx
#include <sys/uio.h>
+#else
+#include <uio.h>
+#endif
#include <stdio.h>
#ifndef X_NOT_POSIX
@@ -84,26 +87,17 @@ extern int errno;
#define MAXBYTESDIFF 8
-extern void LbxAllowMotion();
-extern int LbxDecodePoints();
-extern int LbxDecodeSegment();
-extern int LbxDecodeRectangle();
-extern int LbxDecodeArc();
-
-extern int GrabInProgress;
-
int LbxWhoAmI = 1; /*
* for lbx zlib library to know who we are
* server = 1
* proxy = 0
*/
-int ProcLbxDispatch();
-extern int SProcLbxDispatch();
-static void LbxResetProc();
-static int DecodeLbxDelta();
-static void LbxFreeClient ();
-static void LbxShutdownProxy ();
+
+static void LbxResetProc ( ExtensionEntry *extEntry );
+static void LbxFreeClient ( ClientPtr client );
+static void LbxShutdownProxy ( LbxProxyPtr proxy );
+static int DecodeLbxDelta ( ClientPtr client );
static LbxProxyPtr proxyList;
unsigned char LbxReqCode;
@@ -117,7 +111,7 @@ LbxClientPtr lbxClients[MAXCLIENTS];
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
-extern int (*LbxInitialVector[3])();
+extern int (*LbxInitialVector[3])(ClientPtr);
#ifdef DEBUG
int lbxDebug = 0;
@@ -125,7 +119,7 @@ int lbxDebug = 0;
void
-LbxExtensionInit()
+LbxExtensionInit(void)
{
ExtensionEntry *extEntry;
@@ -148,16 +142,14 @@ LbxExtensionInit()
/*ARGSUSED*/
static void
-LbxResetProc (extEntry)
-ExtensionEntry *extEntry;
+LbxResetProc (ExtensionEntry *extEntry)
{
LbxResetTags();
uid_seed = 0;
}
void
-LbxCloseClient (client)
- ClientPtr client;
+LbxCloseClient (ClientPtr client)
{
xLbxCloseEvent closeEvent;
ClientPtr master;
@@ -204,10 +196,9 @@ LbxCloseClient (client)
}
static int
-LbxReencodeEvent(client, proxy, buf)
- ClientPtr client;
- LbxProxyPtr proxy;
- char *buf;
+LbxReencodeEvent(ClientPtr client,
+ LbxProxyPtr proxy,
+ char *buf)
{
xEvent *ev = (xEvent *)buf;
int n;
@@ -366,27 +357,26 @@ LbxReencodeEvent(client, proxy, buf)
}
static int
-LbxComposeDelta(proxy, reply, len, buf)
- LbxProxyPtr proxy;
- char *reply;
- int len;
- char *buf;
+LbxComposeDelta(LbxProxyPtr proxy,
+ char *reply,
+ int len,
+ char *buf)
{
int diffs;
int cindex;
int n;
xLbxDeltaReq *p = (xLbxDeltaReq *)buf;
- diffs = LBXDeltaMinDiffs(&proxy->outdeltas, reply, len,
+ diffs = LBXDeltaMinDiffs(&proxy->outdeltas, (unsigned char *)reply, len,
min(MAXBYTESDIFF, (len - sz_xLbxDeltaReq) >> 1),
&cindex);
if (diffs < 0) {
- LBXAddDeltaOut(&proxy->outdeltas, reply, len);
+ LBXAddDeltaOut(&proxy->outdeltas, (unsigned char *)reply, len);
return 0;
}
- LBXEncodeDelta(&proxy->outdeltas, reply, diffs, cindex,
- &buf[sz_xLbxDeltaReq]);
- LBXAddDeltaOut(&proxy->outdeltas, reply, len);
+ LBXEncodeDelta(&proxy->outdeltas, (unsigned char *)reply, diffs, cindex,
+ (unsigned char *)(&buf[sz_xLbxDeltaReq]));
+ LBXAddDeltaOut(&proxy->outdeltas, (unsigned char *)reply, len);
p->reqType = LbxEventCode;
p->lbxReqType = LbxDeltaEvent;
p->diffs = diffs;
@@ -400,12 +390,11 @@ LbxComposeDelta(proxy, reply, len, buf)
}
void
-LbxReencodeOutput(client, pbuf, pcount, cbuf, ccount)
- ClientPtr client;
- char *pbuf;
- int *pcount;
- char *cbuf;
- int *ccount;
+LbxReencodeOutput(ClientPtr client,
+ char *pbuf,
+ int *pcount,
+ char *cbuf,
+ int *ccount)
{
LbxClientPtr lbxClient = LbxClient(client);
LbxProxyPtr proxy = lbxClient->proxy;
@@ -497,10 +486,9 @@ LbxReencodeOutput(client, pbuf, pcount, cbuf, ccount)
/*ARGSUSED*/
static void
-LbxReplyCallback(pcbl, nulldata, calldata)
- CallbackListPtr *pcbl;
- pointer nulldata;
- pointer calldata;
+LbxReplyCallback(CallbackListPtr *pcbl,
+ pointer nulldata,
+ pointer calldata)
{
ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
ClientPtr client = pri->client;
@@ -520,9 +508,8 @@ LbxReplyCallback(pcbl, nulldata, calldata)
*/
/* ARGSUSED */
static Bool
-LbxCheckCompressInput (dummy1, dummy2)
- ClientPtr dummy1;
- pointer dummy2;
+LbxCheckCompressInput (ClientPtr dummy1,
+ pointer dummy2)
{
LbxProxyPtr proxy;
@@ -538,8 +525,7 @@ LbxCheckCompressInput (dummy1, dummy2)
}
static Bool
-LbxIsClientBlocked (lbxClient)
- LbxClientPtr lbxClient;
+LbxIsClientBlocked (LbxClientPtr lbxClient)
{
LbxProxyPtr proxy = lbxClient->proxy;
@@ -549,9 +535,8 @@ LbxIsClientBlocked (lbxClient)
}
static void
-LbxSwitchRecv (proxy, lbxClient)
- LbxProxyPtr proxy;
- LbxClientPtr lbxClient;
+LbxSwitchRecv (LbxProxyPtr proxy,
+ LbxClientPtr lbxClient)
{
ClientPtr client;
@@ -572,9 +557,8 @@ LbxSwitchRecv (proxy, lbxClient)
/* ARGSUSED */
static Bool
-LbxWaitForUnblocked (client, closure)
- ClientPtr client;
- pointer closure;
+LbxWaitForUnblocked (ClientPtr client,
+ pointer closure)
{
LbxClientPtr lbxClient;
LbxProxyPtr proxy;
@@ -598,8 +582,7 @@ LbxWaitForUnblocked (client, closure)
}
void
-LbxSetForBlock(lbxClient)
- LbxClientPtr lbxClient;
+LbxSetForBlock(LbxClientPtr lbxClient)
{
lbxClient->reqs_pending++;
if (!lbxClient->input_blocked)
@@ -611,9 +594,8 @@ LbxSetForBlock(lbxClient)
/* ARGSUSED */
static int
-LbxWaitForUngrab (client, closure)
- ClientPtr client;
- pointer closure;
+LbxWaitForUngrab (ClientPtr client,
+ pointer closure)
{
LbxClientPtr lbxClient = LbxClient(client);
LbxProxyPtr proxy;
@@ -637,8 +619,7 @@ LbxWaitForUngrab (client, closure)
}
static void
-LbxServerGrab(proxy)
- LbxProxyPtr proxy;
+LbxServerGrab(LbxProxyPtr proxy)
{
LbxClientPtr grabbingLbxClient;
xLbxListenToOneEvent grabEvent;
@@ -722,8 +703,7 @@ static Bool lbxCacheable[] = {
#define NUM(a) (sizeof (a) / sizeof (a[0]))
static int
-LbxReadRequestFromClient (client)
- ClientPtr client;
+LbxReadRequestFromClient (ClientPtr client)
{
int ret;
LbxClientPtr lbxClient = LbxClient(client);
@@ -801,10 +781,9 @@ LbxReadRequestFromClient (client)
}
static LbxClientPtr
-LbxInitClient (proxy, client, id)
- LbxProxyPtr proxy;
- ClientPtr client;
- CARD32 id;
+LbxInitClient (LbxProxyPtr proxy,
+ ClientPtr client,
+ CARD32 id)
{
LbxClientPtr lbxClient;
int i;
@@ -836,8 +815,7 @@ LbxInitClient (proxy, client, id)
}
static void
-LbxFreeClient (client)
- ClientPtr client;
+LbxFreeClient (ClientPtr client)
{
LbxClientPtr lbxClient = LbxClient(client);
LbxProxyPtr proxy = lbxClient->proxy;
@@ -866,8 +844,7 @@ LbxFreeClient (client)
}
static void
-LbxFreeProxy (proxy)
- LbxProxyPtr proxy;
+LbxFreeProxy (LbxProxyPtr proxy)
{
LbxProxyPtr *p;
@@ -907,8 +884,7 @@ LbxFreeProxy (proxy)
}
LbxProxyPtr
-LbxPidToProxy(pid)
- int pid;
+LbxPidToProxy(int pid)
{
LbxProxyPtr proxy;
@@ -920,8 +896,7 @@ LbxPidToProxy(pid)
}
static void
-LbxShutdownProxy (proxy)
- LbxProxyPtr proxy;
+LbxShutdownProxy (LbxProxyPtr proxy)
{
int i;
ClientPtr client;
@@ -945,10 +920,9 @@ LbxShutdownProxy (proxy)
int
-ProcLbxQueryVersion(client)
- register ClientPtr client;
+ProcLbxQueryVersion (ClientPtr client)
{
- REQUEST(xLbxQueryVersionReq);
+ /* REQUEST(xLbxQueryVersionReq); */
xLbxQueryVersionReply rep;
register int n;
@@ -971,7 +945,7 @@ ProcLbxQueryVersion(client)
}
static int
-NextProxyID()
+NextProxyID (void)
{
LbxProxyPtr proxy;
int id;
@@ -986,8 +960,7 @@ NextProxyID()
}
int
-ProcLbxStartProxy(client)
- register ClientPtr client;
+ProcLbxStartProxy (ClientPtr client)
{
REQUEST(xLbxStartProxyReq);
LbxProxyPtr proxy;
@@ -1036,9 +1009,9 @@ ProcLbxStartProxy(client)
LbxOptionInit(&negopt);
replylen = LbxOptionParse(&negopt,
- &stuff[1],
+ (unsigned char *)&stuff[1],
reqlen - sz_xLbxStartProxyReq,
- &replybuf->optDataStart);
+ (unsigned char *)&replybuf->optDataStart);
if (replylen < 0) {
/*
* Didn't understand option format, so we'll just end up
@@ -1136,10 +1109,9 @@ ProcLbxStartProxy(client)
}
int
-ProcLbxStopProxy(client)
- register ClientPtr client;
+ProcLbxStopProxy(ClientPtr client)
{
- REQUEST(xLbxStopProxyReq);
+ /* REQUEST(xLbxStopProxyReq); */
LbxProxyPtr proxy;
LbxClientPtr lbxClient = LbxClient(client);
@@ -1157,8 +1129,7 @@ ProcLbxStopProxy(client)
}
int
-ProcLbxSwitch(client)
- register ClientPtr client;
+ProcLbxSwitch(ClientPtr client)
{
REQUEST(xLbxSwitchReq);
LbxProxyPtr proxy = LbxMaybeProxy(client);
@@ -1180,8 +1151,7 @@ ProcLbxSwitch(client)
}
int
-ProcLbxBeginLargeRequest(client)
- register ClientPtr client;
+ProcLbxBeginLargeRequest(ClientPtr client)
{
REQUEST(xLbxBeginLargeRequestReq);
@@ -1194,8 +1164,7 @@ ProcLbxBeginLargeRequest(client)
int
-ProcLbxLargeRequestData(client)
- register ClientPtr client;
+ProcLbxLargeRequestData(ClientPtr client)
{
REQUEST(xLbxLargeRequestDataReq);
@@ -1209,10 +1178,9 @@ ProcLbxLargeRequestData(client)
int
-ProcLbxEndLargeRequest(client)
- register ClientPtr client;
+ProcLbxEndLargeRequest(ClientPtr client)
{
- REQUEST(xReq);
+ /* REQUEST(xReq); */
client->sequence--;
REQUEST_SIZE_MATCH(xReq);
@@ -1221,8 +1189,7 @@ ProcLbxEndLargeRequest(client)
int
-ProcLbxInternAtoms(client)
- register ClientPtr client;
+ProcLbxInternAtoms(ClientPtr client)
{
REQUEST(xLbxInternAtomsReq);
LbxClientPtr lbxClient = LbxClient(client);
@@ -1288,8 +1255,7 @@ ProcLbxInternAtoms(client)
int
-ProcLbxGetWinAttrAndGeom(client)
- register ClientPtr client;
+ProcLbxGetWinAttrAndGeom(ClientPtr client)
{
REQUEST(xLbxGetWinAttrAndGeomReq);
xGetWindowAttributesReply wa;
@@ -1368,8 +1334,7 @@ ProcLbxGetWinAttrAndGeom(client)
}
int
-ProcLbxNewClient(client)
- register ClientPtr client;
+ProcLbxNewClient(ClientPtr client)
{
REQUEST(xLbxNewClientReq);
ClientPtr newClient;
@@ -1417,8 +1382,7 @@ ProcLbxNewClient(client)
}
int
-ProcLbxEstablishConnection(client)
- register ClientPtr client;
+ProcLbxEstablishConnection(ClientPtr client)
{
char *reason = NULL;
char *auth_proto, *auth_string;
@@ -1445,8 +1409,7 @@ ProcLbxEstablishConnection(client)
}
int
-ProcLbxCloseClient (client)
- register ClientPtr client;
+ProcLbxCloseClient (ClientPtr client)
{
REQUEST(xLbxCloseClientReq);
LbxClientPtr lbxClient = LbxClient(client);
@@ -1460,8 +1423,7 @@ ProcLbxCloseClient (client)
}
int
-ProcLbxModifySequence (client)
- register ClientPtr client;
+ProcLbxModifySequence (ClientPtr client)
{
REQUEST(xLbxModifySequenceReq);
@@ -1471,8 +1433,7 @@ ProcLbxModifySequence (client)
}
int
-ProcLbxAllowMotion (client)
- register ClientPtr client;
+ProcLbxAllowMotion (ClientPtr client)
{
REQUEST(xLbxAllowMotionReq);
@@ -1484,17 +1445,17 @@ ProcLbxAllowMotion (client)
static int
-DecodeLbxDelta(client)
- register ClientPtr client;
+DecodeLbxDelta (ClientPtr client)
{
REQUEST(xLbxDeltaReq);
LbxClientPtr lbxClient = LbxClient(client);
LbxProxyPtr proxy = lbxClient->proxy;
int len;
- char *buf;
+ unsigned char *buf;
/* Note that LBXDecodeDelta decodes and adds current msg to the cache */
- len = LBXDecodeDelta(&proxy->indeltas, ((char *)stuff) + sz_xLbxDeltaReq,
+ len = LBXDecodeDelta(&proxy->indeltas,
+ (xLbxDiffItem *)(((char *)stuff) + sz_xLbxDeltaReq),
stuff->diffs, stuff->cindex, &buf);
/*
* Some requests, such as FillPoly, result in the protocol input
@@ -1511,58 +1472,52 @@ DecodeLbxDelta(client)
}
int
-ProcLbxGetModifierMapping(client)
- ClientPtr client;
+ProcLbxGetModifierMapping(ClientPtr client)
{
- REQUEST(xLbxGetModifierMappingReq);
+ /* REQUEST(xLbxGetModifierMappingReq); */
REQUEST_SIZE_MATCH(xLbxGetModifierMappingReq);
return LbxGetModifierMapping(client);
}
int
-ProcLbxGetKeyboardMapping(client)
- ClientPtr client;
+ProcLbxGetKeyboardMapping(ClientPtr client)
{
- REQUEST(xLbxGetKeyboardMappingReq);
+ /* REQUEST(xLbxGetKeyboardMappingReq); */
REQUEST_SIZE_MATCH(xLbxGetKeyboardMappingReq);
return LbxGetKeyboardMapping(client);
}
int
-ProcLbxQueryFont(client)
- ClientPtr client;
+ProcLbxQueryFont(ClientPtr client)
{
- REQUEST(xLbxQueryFontReq);
+ /* REQUEST(xLbxQueryFontReq); */
REQUEST_SIZE_MATCH(xLbxQueryFontReq);
return LbxQueryFont(client);
}
int
-ProcLbxChangeProperty(client)
- ClientPtr client;
+ProcLbxChangeProperty(ClientPtr client)
{
- REQUEST(xLbxChangePropertyReq);
+ /* REQUEST(xLbxChangePropertyReq); */
REQUEST_SIZE_MATCH(xLbxChangePropertyReq);
return LbxChangeProperty(client);
}
int
-ProcLbxGetProperty(client)
- ClientPtr client;
+ProcLbxGetProperty(ClientPtr client)
{
- REQUEST(xLbxGetPropertyReq);
+ /* REQUEST(xLbxGetPropertyReq); */
REQUEST_SIZE_MATCH(xLbxGetPropertyReq);
return LbxGetProperty(client);
}
int
-ProcLbxTagData(client)
- ClientPtr client;
+ProcLbxTagData(ClientPtr client)
{
REQUEST(xLbxTagDataReq);
@@ -1574,8 +1529,7 @@ ProcLbxTagData(client)
}
int
-ProcLbxInvalidateTag(client)
- ClientPtr client;
+ProcLbxInvalidateTag(ClientPtr client)
{
REQUEST(xLbxInvalidateTagReq);
@@ -1585,93 +1539,80 @@ ProcLbxInvalidateTag(client)
}
int
-ProcLbxPolyPoint(client)
- register ClientPtr client;
+ProcLbxPolyPoint(ClientPtr client)
{
return LbxDecodePoly(client, X_PolyPoint, LbxDecodePoints);
}
int
-ProcLbxPolyLine(client)
- register ClientPtr client;
+ProcLbxPolyLine(ClientPtr client)
{
return LbxDecodePoly(client, X_PolyLine, LbxDecodePoints);
}
int
-ProcLbxPolySegment(client)
- register ClientPtr client;
+ProcLbxPolySegment(ClientPtr client)
{
return LbxDecodePoly(client, X_PolySegment, LbxDecodeSegment);
}
int
-ProcLbxPolyRectangle(client)
- register ClientPtr client;
+ProcLbxPolyRectangle(ClientPtr client)
{
return LbxDecodePoly(client, X_PolyRectangle, LbxDecodeRectangle);
}
int
-ProcLbxPolyArc(client)
- register ClientPtr client;
+ProcLbxPolyArc(ClientPtr client)
{
return LbxDecodePoly(client, X_PolyArc, LbxDecodeArc);
}
int
-ProcLbxFillPoly(client)
- register ClientPtr client;
+ProcLbxFillPoly(ClientPtr client)
{
return LbxDecodeFillPoly(client);
}
int
-ProcLbxPolyFillRectangle(client)
- register ClientPtr client;
+ProcLbxPolyFillRectangle(ClientPtr client)
{
return LbxDecodePoly(client, X_PolyFillRectangle, LbxDecodeRectangle);
}
int
-ProcLbxPolyFillArc(client)
- register ClientPtr client;
+ProcLbxPolyFillArc(ClientPtr client)
{
return LbxDecodePoly(client, X_PolyFillArc, LbxDecodeArc);
}
int
-ProcLbxCopyArea (client)
- register ClientPtr client;
+ProcLbxCopyArea(ClientPtr client)
{
return LbxDecodeCopyArea(client);
}
int
-ProcLbxCopyPlane (client)
- register ClientPtr client;
+ProcLbxCopyPlane(ClientPtr client)
{
return LbxDecodeCopyPlane(client);
}
int
-ProcLbxPolyText (client)
- register ClientPtr client;
+ProcLbxPolyText(ClientPtr client)
{
return LbxDecodePolyText(client);
}
int
-ProcLbxImageText (client)
- register ClientPtr client;
+ProcLbxImageText(ClientPtr client)
{
return LbxDecodeImageText(client);
}
int
-ProcLbxQueryExtension(client)
- ClientPtr client;
+ProcLbxQueryExtension(ClientPtr client)
{
REQUEST(xLbxQueryExtensionReq);
char *ename;
@@ -1682,23 +1623,20 @@ ProcLbxQueryExtension(client)
}
int
-ProcLbxPutImage(client)
- register ClientPtr client;
+ProcLbxPutImage(ClientPtr client)
{
return LbxDecodePutImage(client);
}
int
-ProcLbxGetImage(client)
- register ClientPtr client;
+ProcLbxGetImage(ClientPtr client)
{
return LbxDecodeGetImage(client);
}
int
-ProcLbxSync(client)
- register ClientPtr client;
+ProcLbxSync(ClientPtr client)
{
xLbxSyncReply reply;
@@ -1727,8 +1665,7 @@ ProcLbxSync(client)
int
-ProcLbxDispatch (client)
- register ClientPtr client;
+ProcLbxDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
diff --git a/lbx/lbxopts.c b/lbx/lbxopts.c
index fe9af687e..461f0d778 100644
--- a/lbx/lbxopts.c
+++ b/lbx/lbxopts.c
@@ -21,6 +21,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.6 2001/10/28 03:34:12 tsi Exp $ */
#ifdef OPTDEBUG
#include <stdio.h>
@@ -28,6 +29,8 @@
#include "X.h"
#include "Xproto.h"
#include "misc.h"
+#include "colormapst.h"
+#include "propertyst.h"
#include "lbxserve.h"
#include "lbxstr.h"
#include "lbximage.h"
@@ -37,22 +40,35 @@
#include "lbxzlib.h"
#endif /* NO_ZLIB */
-static int LbxDeltaOpt();
-static int LbxProxyDeltaOpt();
-static int LbxServerDeltaOpt();
-static int LbxStreamCompOpt();
-static int LbxBitmapCompOpt();
-static int LbxPixmapCompOpt();
-static int LbxMessageCompOpt();
-static int LbxUseTagsOpt();
-static int LbxCmapAllOpt();
+static int LbxProxyDeltaOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int LbxServerDeltaOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int LbxDeltaOpt ( unsigned char *popt, int optlen,
+ unsigned char *preply, short *pn, short *pmaxlen );
+static int LbxStreamCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int ZlibParse ( LbxNegOptsPtr pno, unsigned char *popt, int optlen,
+ unsigned char *preply );
+static int LbxMessageCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int LbxUseTagsOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int LbxBitmapCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int LbxPixmapCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+static int MergeDepths ( int *depths, LbxPixmapCompMethod *method );
+static int LbxCmapAllOpt ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
/*
* List of LBX options we recognize and are willing to negotiate
*/
static struct _LbxOptionParser {
CARD8 optcode;
- int (*parser)();
+ int (*parser)(LbxNegOptsPtr, unsigned char *,
+ int, unsigned char *);
} LbxOptions[] = {
{ LBX_OPT_DELTA_PROXY, LbxProxyDeltaOpt },
{ LBX_OPT_DELTA_SERVER, LbxServerDeltaOpt },
@@ -69,8 +85,8 @@ static struct _LbxOptionParser {
/*
* Set option defaults
*/
-LbxOptionInit(pno)
- LbxNegOptsPtr pno;
+void
+LbxOptionInit(LbxNegOptsPtr pno)
{
bzero(pno, sizeof(LbxNegOptsRec));
pno->proxyDeltaN = pno->serverDeltaN = LBX_OPT_DELTA_NCACHE_DFLT;
@@ -85,11 +101,10 @@ LbxOptionInit(pno)
}
int
-LbxOptionParse(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+LbxOptionParse(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
int i;
int nopts = *popt++;
@@ -139,34 +154,31 @@ LbxOptionParse(pno, popt, optlen, preply)
}
static int
-LbxProxyDeltaOpt(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+LbxProxyDeltaOpt(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
return LbxDeltaOpt(popt, optlen, preply,
&pno->proxyDeltaN, &pno->proxyDeltaMaxLen);
}
static int
-LbxServerDeltaOpt(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+LbxServerDeltaOpt(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
return LbxDeltaOpt(popt, optlen, preply,
&pno->serverDeltaN, &pno->serverDeltaMaxLen);
}
static int
-LbxDeltaOpt(popt, optlen, preply, pn, pmaxlen)
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
- short *pn;
- short *pmaxlen;
+LbxDeltaOpt(unsigned char *popt,
+ int optlen,
+ unsigned char *preply,
+ short *pn,
+ short *pmaxlen)
{
short n;
short maxlen;
@@ -211,12 +223,12 @@ LbxDeltaOpt(popt, optlen, preply, pn, pmaxlen)
return LBX_OPT_DELTA_REPLYLEN;
}
-static int ZlibParse();
static struct _LbxStreamCompParser {
int typelen;
char *type;
- int (*parser)();
+ int (*parser)(LbxNegOptsPtr, unsigned char *,
+ int, unsigned char *);
} LbxStreamComp[] = {
#ifndef NO_ZLIB
{ ZLIB_STRCOMP_OPT_LEN, ZLIB_STRCOMP_OPT, ZlibParse },
@@ -227,11 +239,10 @@ static struct _LbxStreamCompParser {
(sizeof(LbxStreamComp) / sizeof(struct _LbxStreamCompParser))
static int
-LbxStreamCompOpt(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+LbxStreamCompOpt(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
int i;
int typelen;
@@ -277,18 +288,11 @@ LbxStreamCompOpt(pno, popt, optlen, preply)
}
-extern LbxStreamCompHandle ZlibInit();
-extern int ZlibStuffInput(), ZlibInputAvail(), ZlibFlush(),
- ZlibRead(), ZlibWriteV();
-extern void ZlibCompressOn(), ZlibCompressOff(), ZlibFree();
-
-
static int
-ZlibParse(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+ZlibParse(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
int level; /* compression level */
@@ -299,8 +303,9 @@ ZlibParse(pno, popt, optlen, preply)
if (level < 1 || level > 9)
return (-1);
- pno->streamOpts.streamCompInit = ZlibInit;
- pno->streamOpts.streamCompArg = (pointer) level;
+ pno->streamOpts.streamCompInit =
+ (LbxStreamCompHandle (*)(int, pointer))ZlibInit;
+ pno->streamOpts.streamCompArg = (pointer)(long)level;
pno->streamOpts.streamCompStuffInput = ZlibStuffInput;
pno->streamOpts.streamCompInputAvail = ZlibInputAvail;
pno->streamOpts.streamCompFlush = ZlibFlush;
@@ -308,17 +313,17 @@ ZlibParse(pno, popt, optlen, preply)
pno->streamOpts.streamCompWriteV = ZlibWriteV;
pno->streamOpts.streamCompOn = ZlibCompressOn;
pno->streamOpts.streamCompOff = ZlibCompressOff;
- pno->streamOpts.streamCompFreeHandle = ZlibFree;
+ pno->streamOpts.streamCompFreeHandle =
+ (void (*)(LbxStreamCompHandle))ZlibFree;
return (0);
}
static int
-LbxMessageCompOpt(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+LbxMessageCompOpt(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
if (optlen == 0) {
@@ -334,11 +339,10 @@ LbxMessageCompOpt(pno, popt, optlen, preply)
static int
-LbxUseTagsOpt(pno, popt, optlen, preply)
- LbxNegOptsPtr pno;
- unsigned char *popt;
- int optlen;
- unsigned char *preply;
+LbxUseTagsOpt(LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
if (optlen == 0) {
@@ -404,24 +408,20 @@ LbxPixmapCompMethods [] = {
(sizeof (LbxPixmapCompMethods) / sizeof (LbxPixmapCompMethod))
#endif
-static int MergeDepths ();
-
static int
-LbxImageCompOpt (pixmap, pno, popt, optlen, preply)
-
-Bool pixmap;
-LbxNegOptsPtr pno;
-unsigned char *popt;
-int optlen;
-unsigned char *preply;
+LbxImageCompOpt (Bool pixmap,
+ LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
unsigned char *preplyStart = preply;
int numMethods = *popt++;
- char *myIndices, *hisIndices;
- unsigned *retFormats;
- int **retDepths;
+ unsigned char *myIndices, *hisIndices;
+ unsigned int *retFormats = NULL;
+ int **retDepths = NULL;
int replyCount = 0;
int status, i, j;
@@ -436,8 +436,8 @@ unsigned char *preply;
return (1);
}
- myIndices = (char *) xalloc (numMethods);
- hisIndices = (char *) xalloc (numMethods);
+ myIndices = (unsigned char *) xalloc (numMethods);
+ hisIndices = (unsigned char *) xalloc (numMethods);
if (!myIndices || !hisIndices)
{
@@ -484,8 +484,8 @@ unsigned char *preply;
for (i = 0; i < numMethods; i++)
{
- unsigned formatMask, newFormatMask;
- int depthCount, *depths, len;
+ unsigned int formatMask = 0, newFormatMask = 0;
+ int depthCount, *depths = NULL, len;
int freeDepths;
char *methodName;
@@ -634,12 +634,10 @@ unsigned char *preply;
static int
-LbxBitmapCompOpt (pno, popt, optlen, preply)
-
-LbxNegOptsPtr pno;
-unsigned char *popt;
-int optlen;
-unsigned char *preply;
+LbxBitmapCompOpt (LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
return (LbxImageCompOpt (0 /* bitmap */, pno, popt, optlen, preply));
@@ -647,12 +645,10 @@ unsigned char *preply;
static int
-LbxPixmapCompOpt (pno, popt, optlen, preply)
-
-LbxNegOptsPtr pno;
-unsigned char *popt;
-int optlen;
-unsigned char *preply;
+LbxPixmapCompOpt (LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
return (LbxImageCompOpt (1 /* Pixmap */, pno, popt, optlen, preply));
@@ -660,10 +656,8 @@ unsigned char *preply;
LbxBitmapCompMethod *
-LbxSrvrLookupBitmapCompMethod (proxy, methodOpCode)
-
-LbxProxyPtr proxy;
-int methodOpCode;
+LbxSrvrLookupBitmapCompMethod (LbxProxyPtr proxy,
+ int methodOpCode)
{
int i;
@@ -683,10 +677,8 @@ int methodOpCode;
LbxPixmapCompMethod *
-LbxSrvrLookupPixmapCompMethod (proxy, methodOpCode)
-
-LbxProxyPtr proxy;
-int methodOpCode;
+LbxSrvrLookupPixmapCompMethod (LbxProxyPtr proxy,
+ int methodOpCode)
{
int i;
@@ -706,9 +698,7 @@ int methodOpCode;
LbxBitmapCompMethod *
-LbxSrvrFindPreferredBitmapCompMethod (proxy)
-
-LbxProxyPtr proxy;
+LbxSrvrFindPreferredBitmapCompMethod (LbxProxyPtr proxy)
{
if (proxy->numBitmapCompMethods == 0)
@@ -720,11 +710,9 @@ LbxProxyPtr proxy;
LbxPixmapCompMethod *
-LbxSrvrFindPreferredPixmapCompMethod (proxy, format, depth)
-
-LbxProxyPtr proxy;
-int format;
-int depth;
+LbxSrvrFindPreferredPixmapCompMethod (LbxProxyPtr proxy,
+ int format,
+ int depth)
{
if (proxy->numPixmapCompMethods == 0)
@@ -757,10 +745,9 @@ int depth;
}
-static int MergeDepths (depths, method)
-
-int *depths;
-LbxPixmapCompMethod *method;
+static int
+MergeDepths (int *depths,
+ LbxPixmapCompMethod *method)
{
int i, j, count;
@@ -788,12 +775,10 @@ LbxPixmapCompMethod *method;
#define LbxCmapAllMethod "XC-CMAP"
static int
-LbxCmapAllOpt (pno, popt, optlen, preply)
-
-LbxNegOptsPtr pno;
-unsigned char *popt;
-int optlen;
-unsigned char *preply;
+LbxCmapAllOpt (LbxNegOptsPtr pno,
+ unsigned char *popt,
+ int optlen,
+ unsigned char *preply)
{
int numMethods = *popt++;
diff --git a/lbx/lbxprop.c b/lbx/lbxprop.c
index b70fade72..e9a6d8a8e 100644
--- a/lbx/lbxprop.c
+++ b/lbx/lbxprop.c
@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.5 2001/12/14 20:00:00 dawes Exp $ */
/* various bits of DIX-level mangling */
@@ -61,6 +62,7 @@ in this Software without prior written authorization from The Open Group.
#include "resource.h"
#include "servermd.h"
#include "propertyst.h"
+#include "colormapst.h"
#include "windowstr.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
@@ -71,15 +73,11 @@ in this Software without prior written authorization from The Open Group.
#define _SECURITY_SERVER
#include "extensions/security.h"
#endif
-
-extern int (*ProcVector[256]) ();
-extern void (*ReplySwapVector[256]) ();
-extern void CopySwap16Write(), CopySwap32Write(), Swap32Write();
+#include "swaprep.h"
void
-LbxStallPropRequest(client, pProp)
- ClientPtr client;
- PropertyPtr pProp;
+LbxStallPropRequest(ClientPtr client,
+ PropertyPtr pProp)
{
xReq *req = (xReq *) client->requestBuffer;
register char n;
@@ -139,19 +137,17 @@ LbxStallPropRequest(client, pProp)
}
int
-LbxChangeWindowProperty(client, pWin, property, type, format, mode, len,
- have_data, value, sendevent, tag)
- ClientPtr client;
- WindowPtr pWin;
- Atom property,
- type;
- int format,
- mode;
- unsigned long len;
- Bool have_data;
- pointer value;
- Bool sendevent;
- XID *tag;
+LbxChangeWindowProperty(ClientPtr client,
+ WindowPtr pWin,
+ Atom property,
+ Atom type,
+ int format,
+ int mode,
+ unsigned long len,
+ Bool have_data,
+ pointer value,
+ Bool sendevent,
+ XID *tag)
{
PropertyPtr pProp;
xEvent event;
@@ -288,8 +284,7 @@ LbxChangeWindowProperty(client, pWin, property, type, format, mode, len,
}
int
-LbxChangeProperty(client)
- ClientPtr client;
+LbxChangeProperty(ClientPtr client)
{
WindowPtr pWin;
char format,
@@ -370,9 +365,8 @@ LbxChangeProperty(client)
}
static void
-LbxWriteGetpropReply(client, rep)
- ClientPtr client;
- xLbxGetPropertyReply *rep;
+LbxWriteGetpropReply(ClientPtr client,
+ xLbxGetPropertyReply *rep)
{
int n;
@@ -388,8 +382,7 @@ LbxWriteGetpropReply(client, rep)
}
int
-LbxGetProperty(client)
- ClientPtr client;
+LbxGetProperty(ClientPtr client)
{
PropertyPtr pProp,
prevProp;
@@ -525,13 +518,13 @@ LbxGetProperty(client)
if (len) {
switch (reply.format) {
case 32:
- client->pSwapReplyFunc = CopySwap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
break;
case 16:
- client->pSwapReplyFunc = CopySwap16Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
break;
default:
- client->pSwapReplyFunc = (void (*) ()) WriteToClient;
+ client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
break;
}
WriteSwappedDataToClient(client, len,
diff --git a/lbx/lbxserve.h b/lbx/lbxserve.h
index 3151207be..40a2ff0ae 100644
--- a/lbx/lbxserve.h
+++ b/lbx/lbxserve.h
@@ -45,12 +45,17 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.5 2001/12/14 20:00:00 dawes Exp $ */
#ifndef _LBXSERVE_H_
+
+#include "colormap.h"
+#include "property.h"
+
#define _LBXSERVE_H_
-#include "lbxdeltastr.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
+#include "lbxdeltastr.h"
#include "lbxopts.h"
#define MAX_LBX_CLIENTS MAXCLIENTS
@@ -104,9 +109,9 @@ typedef struct _LbxProxy {
LbxStreamOpts streamOpts;
int numBitmapCompMethods;
- char *bitmapCompMethods; /* array of indices */
+ unsigned char *bitmapCompMethods; /* array of indices */
int numPixmapCompMethods;
- char *pixmapCompMethods; /* array of indices */
+ unsigned char *pixmapCompMethods; /* array of indices */
int **pixmapCompDepths; /* depths supported from each method */
struct _ColormapRec *grabbedCmaps; /* chained via lbx private */
@@ -126,48 +131,155 @@ extern LbxClientPtr lbxClients[MAXCLIENTS];
extern int LbxEventCode;
-extern void LbxDixInit(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern LbxProxyPtr LbxPidToProxy(
-#if NeedFunctionPrototypes
- int /* pid */
-#endif
-);
-
-extern void LbxReencodeOutput(
-#if NeedFunctionPrototypes
- ClientPtr /*client*/,
- char* /*pbuf*/,
- int* /*pcount*/,
- char* /*cbuf*/,
- int* /*ccount*/
-#endif
-);
-
-extern int UncompressedWriteToClient(
-#if NeedFunctionPrototypes
- ClientPtr /*who*/,
- int /*count*/,
- char* /*buf*/
-#endif
-);
-
-extern ClientPtr AllocLbxClientConnection(
-#if NeedFunctionPrototypes
- ClientPtr /* client */,
- LbxProxyPtr /* proxy */
-#endif
-);
-
-extern void LbxProxyConnection(
-#if NeedFunctionPrototypes
- ClientPtr /* client */,
- LbxProxyPtr /* proxy */
-#endif
-);
+
+/* os/connection.c */
+extern ClientPtr AllocLbxClientConnection ( ClientPtr client,
+ LbxProxyPtr proxy );
+extern void LbxProxyConnection ( ClientPtr client, LbxProxyPtr proxy );
+
+/* os/libxio.c */
+extern int UncompressedWriteToClient ( ClientPtr who, int count, char *buf );
+extern void LbxForceOutput ( LbxProxyPtr proxy );
+extern void SwitchClientInput ( ClientPtr client, Bool pending );
+extern int PrepareLargeReqBuffer ( ClientPtr client );
+extern Bool AppendFakeRequest ( ClientPtr client, char *data, int count );
+extern void LbxFreeOsBuffers ( LbxProxyPtr proxy );
+extern Bool AllocateLargeReqBuffer ( ClientPtr client, int size );
+extern Bool AddToLargeReqBuffer ( ClientPtr client, char *data, int size );
+extern void LbxPrimeInput ( ClientPtr client, LbxProxyPtr proxy );
+
+/* lbxcmap.c */
+extern int LbxCmapInit ( void );
+extern Bool LbxCheckColorRequest ( ClientPtr client, ColormapPtr pmap,
+ xReq *req );
+extern int LbxCheckCmapGrabbed ( ColormapPtr pmap );
+extern void LbxDisableSmartGrab ( ColormapPtr pmap );
+extern void LbxBeginFreeCellsEvent ( ColormapPtr pmap );
+extern void LbxAddFreeCellToEvent ( ColormapPtr pmap, Pixel pixel );
+extern void LbxEndFreeCellsEvent ( ColormapPtr pmap );
+extern void LbxSortPixelList ( Pixel *pixels, int count );
+extern int ProcLbxGrabCmap ( ClientPtr client );
+extern void LbxReleaseCmap ( ColormapPtr pmap, Bool smart );
+extern int ProcLbxReleaseCmap ( ClientPtr client );
+extern int ProcLbxAllocColor ( ClientPtr client );
+extern int ProcLbxIncrementPixel ( ClientPtr client );
+
+/* lbxdix.h */
+extern void LbxDixInit ( void );
+extern void LbxResetTags ( void );
+extern int LbxSendConnSetup ( ClientPtr client, char *reason );
+extern int LbxGetModifierMapping ( ClientPtr client );
+extern int LbxGetKeyboardMapping ( ClientPtr client );
+extern int LbxQueryFont ( ClientPtr client );
+extern int LbxTagData ( ClientPtr client, XID tag, unsigned long len,
+ pointer data );
+extern int LbxInvalidateTag ( ClientPtr client, XID tag );
+extern void LbxAllowMotion ( ClientPtr client, int num );
+extern void LbxFlushModifierMapTag ( void );
+extern void LbxFlushKeyboardMapTag ( void );
+extern void LbxFreeFontTag ( FontPtr pfont );
+extern void LbxSendInvalidateTag ( ClientPtr client, XID tag, int tagtype );
+extern Bool LbxFlushQTag ( XID tag );
+extern void ProcessQTagZombies ( void );
+extern void LbxQueryTagData ( ClientPtr client, int owner_pid, XID tag,
+ int tagtype );
+
+/* lbxexts.c */
+extern Bool LbxAddExtension ( char *name, int opcode, int ev_base,
+ int err_base );
+extern Bool LbxAddExtensionAlias ( int idx, char *alias );
+extern void LbxDeclareExtensionSecurity ( char *extname, Bool secure );
+extern Bool LbxRegisterExtensionGenerationMasks ( int idx, int num_reqs,
+ char *rep_mask,
+ char *ev_mask );
+extern int LbxQueryExtension ( ClientPtr client, char *ename, int nlen );
+extern void LbxCloseDownExtensions ( void );
+extern void LbxSetReqMask ( CARD8 *mask, int req, Bool on );
+
+/* lbxgfx.c */
+extern int LbxDecodePoly( ClientPtr client, CARD8 xreqtype,
+ int (*decode_rtn)(char *, char *, short *) );
+extern int LbxDecodeFillPoly ( ClientPtr client );
+extern int LbxDecodeCopyArea ( ClientPtr client );
+extern int LbxDecodeCopyPlane ( ClientPtr client );
+extern int LbxDecodePolyText ( ClientPtr client );
+extern int LbxDecodeImageText ( ClientPtr client );
+extern int LbxDecodePutImage ( ClientPtr client );
+extern int LbxDecodeGetImage ( ClientPtr client );
+extern int LbxDecodePoints ( char *in, char *inend, short *out );
+extern int LbxDecodeSegment ( char *in, char *inend, short *out );
+extern int LbxDecodeRectangle ( char *in, char *inend, short *out );
+extern int LbxDecodeArc ( char *in, char *inend, short *out );
+
+/* lbxmain.c */
+extern LbxProxyPtr LbxPidToProxy ( int pid );
+extern void LbxReencodeOutput ( ClientPtr client, char *pbuf, int *pcount,
+ char *cbuf, int *ccount );
+extern void LbxExtensionInit ( void );
+extern void LbxCloseClient ( ClientPtr client );
+extern void LbxSetForBlock ( LbxClientPtr lbxClient );
+extern int ProcLbxDispatch ( ClientPtr client );
+extern int ProcLbxSwitch ( ClientPtr client );
+extern int ProcLbxQueryVersion ( ClientPtr client );
+extern int ProcLbxStartProxy ( ClientPtr client );
+extern int ProcLbxStopProxy ( ClientPtr client );
+extern int ProcLbxBeginLargeRequest ( ClientPtr client );
+extern int ProcLbxLargeRequestData ( ClientPtr client );
+extern int ProcLbxEndLargeRequest ( ClientPtr client );
+extern int ProcLbxInternAtoms ( ClientPtr client );
+extern int ProcLbxGetWinAttrAndGeom ( ClientPtr client );
+extern int ProcLbxNewClient ( ClientPtr client );
+extern int ProcLbxEstablishConnection ( ClientPtr client );
+extern int ProcLbxCloseClient ( ClientPtr client );
+extern int ProcLbxModifySequence ( ClientPtr client );
+extern int ProcLbxAllowMotion ( ClientPtr client );
+extern int ProcLbxGetModifierMapping ( ClientPtr client );
+extern int ProcLbxGetKeyboardMapping ( ClientPtr client );
+extern int ProcLbxQueryFont ( ClientPtr client );
+extern int ProcLbxChangeProperty ( ClientPtr client );
+extern int ProcLbxGetProperty ( ClientPtr client );
+extern int ProcLbxTagData ( ClientPtr client );
+extern int ProcLbxInvalidateTag ( ClientPtr client );
+extern int ProcLbxPolyPoint ( ClientPtr client );
+extern int ProcLbxPolyLine ( ClientPtr client );
+extern int ProcLbxPolySegment ( ClientPtr client );
+extern int ProcLbxPolyRectangle ( ClientPtr client );
+extern int ProcLbxPolyArc ( ClientPtr client );
+extern int ProcLbxFillPoly ( ClientPtr client );
+extern int ProcLbxPolyFillRectangle ( ClientPtr client );
+extern int ProcLbxPolyFillArc ( ClientPtr client );
+extern int ProcLbxCopyArea ( ClientPtr client );
+extern int ProcLbxCopyPlane ( ClientPtr client );
+extern int ProcLbxPolyText ( ClientPtr client );
+extern int ProcLbxImageText ( ClientPtr client );
+extern int ProcLbxQueryExtension ( ClientPtr client );
+extern int ProcLbxPutImage ( ClientPtr client );
+extern int ProcLbxGetImage ( ClientPtr client );
+extern int ProcLbxSync ( ClientPtr client );
+
+/* lbxprop.c */
+extern int LbxChangeProperty ( ClientPtr client );
+extern int LbxGetProperty ( ClientPtr client );
+extern void LbxStallPropRequest ( ClientPtr client, PropertyPtr pProp );
+extern int LbxChangeWindowProperty ( ClientPtr client, WindowPtr pWin,
+ Atom property, Atom type, int format,
+ int mode, unsigned long len,
+ Bool have_data, pointer value,
+ Bool sendevent, XID *tag );
+/* lbxsquish.c */
+extern int LbxSquishEvent ( char *buf );
+
+/* lbwswap.c */
+extern int SProcLbxDispatch( ClientPtr client );
+extern int SProcLbxSwitch ( ClientPtr client );
+extern int SProcLbxBeginLargeRequest ( ClientPtr client );
+extern int SProcLbxLargeRequestData ( ClientPtr client );
+extern int SProcLbxEndLargeRequest ( ClientPtr client );
+extern void LbxWriteSConnSetupPrefix ( ClientPtr pClient,
+ xLbxConnSetupPrefix *pcsp );
+extern void LbxSwapFontInfo ( xLbxFontInfo *pr, Bool compressed );
+
+/* lbxzerorep.c */
+extern void ZeroReplyPadBytes ( char *buf, int reqType );
#endif /* _LBXSERVE_H_ */
diff --git a/lbx/lbxsquish.c b/lbx/lbxsquish.c
index 6d3eddbfc..d71647091 100644
--- a/lbx/lbxsquish.c
+++ b/lbx/lbxsquish.c
@@ -46,12 +46,15 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.4 2001/12/14 20:00:01 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "Xos.h"
#include "misc.h"
+#include "colormapst.h"
+#include "propertyst.h"
#include "lbxserve.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
@@ -135,8 +138,7 @@ static char lbxevpad[] = {
};
int
-LbxSquishEvent(buf)
- char *buf;
+LbxSquishEvent(char *buf)
{
int delta = lbxevdelta[((xEvent *)buf)->u.u.type];
int pad = lbxevpad[((xEvent *)buf)->u.u.type];
diff --git a/lbx/lbxsrvopts.h b/lbx/lbxsrvopts.h
index a08f1fec8..eeb94f266 100644
--- a/lbx/lbxsrvopts.h
+++ b/lbx/lbxsrvopts.h
@@ -21,6 +21,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxsrvopts.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
#ifndef _LBX_SRVOPTS_H_
#define _LBX_SRVOPTS_H_
@@ -35,9 +36,9 @@ typedef struct _LbxNegOpts {
short serverDeltaMaxLen;
LbxStreamOpts streamOpts;
int numBitmapCompMethods;
- char *bitmapCompMethods; /* array of indices */
+ unsigned char *bitmapCompMethods; /* array of indices */
int numPixmapCompMethods;
- char *pixmapCompMethods; /* array of indices */
+ unsigned char *pixmapCompMethods; /* array of indices */
int **pixmapCompDepths; /* depths supported from each method */
Bool squish;
Bool useTags;
@@ -46,33 +47,17 @@ typedef struct _LbxNegOpts {
typedef LbxNegOptsRec *LbxNegOptsPtr;
-extern LbxBitmapCompMethod *LbxSrvrLookupBitmapCompMethod (
-#if NeedFunctionPrototypes
- LbxProxyPtr, /* proxy */
- int /* methodOpCode */
-#endif
-);
-
-extern LbxPixmapCompMethod *LbxSrvrLookupPixmapCompMethod (
-#if NeedFunctionPrototypes
- LbxProxyPtr, /* proxy */
- int /* methodOpCode */
-#endif
-);
-
-extern LbxBitmapCompMethod *LbxSrvrFindPreferredBitmapCompMethod (
-#if NeedFunctionPrototypes
- LbxProxyPtr /* proxy */
-#endif
-);
-
-extern LbxPixmapCompMethod *LbxSrvrFindPreferredPixmapCompMethod (
-#if NeedFunctionPrototypes
- LbxProxyPtr, /* proxy */
- int, /* format */
- int /* depth */
-#endif
-);
+extern void LbxOptionInit ( LbxNegOptsPtr pno );
+extern int LbxOptionParse ( LbxNegOptsPtr pno, unsigned char *popt,
+ int optlen, unsigned char *preply );
+extern LbxBitmapCompMethod *
+LbxSrvrLookupBitmapCompMethod ( LbxProxyPtr proxy, int methodOpCode );
+extern LbxPixmapCompMethod *
+LbxSrvrLookupPixmapCompMethod ( LbxProxyPtr proxy, int methodOpCode );
+extern LbxBitmapCompMethod *
+LbxSrvrFindPreferredBitmapCompMethod ( LbxProxyPtr proxy );
+extern LbxPixmapCompMethod *
+LbxSrvrFindPreferredPixmapCompMethod ( LbxProxyPtr proxy, int format, int depth );
#endif /* _LBX_SRVOPTS_H_ */
diff --git a/lbx/lbxswap.c b/lbx/lbxswap.c
index 38ba66b70..edfc0bea7 100644
--- a/lbx/lbxswap.c
+++ b/lbx/lbxswap.c
@@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.4 2001/12/14 20:00:01 dawes Exp $ */
#include <sys/types.h>
#define NEED_REPLIES
@@ -58,6 +59,8 @@ in this Software without prior written authorization from The Open Group.
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "swaprep.h"
+#include "propertyst.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
#include "lbxserve.h"
@@ -66,8 +69,7 @@ in this Software without prior written authorization from The Open Group.
#include <stdio.h>
static int
-SProcLbxQueryVersion(client)
- register ClientPtr client;
+SProcLbxQueryVersion(ClientPtr client)
{
register int n;
@@ -78,8 +80,7 @@ SProcLbxQueryVersion(client)
}
static int
-SProcLbxStartProxy(client)
- register ClientPtr client;
+SProcLbxStartProxy(ClientPtr client)
{
register int n;
@@ -90,8 +91,7 @@ SProcLbxStartProxy(client)
}
static int
-SProcLbxStopProxy(client)
- register ClientPtr client;
+SProcLbxStopProxy(ClientPtr client)
{
register int n;
@@ -102,8 +102,7 @@ SProcLbxStopProxy(client)
}
int
-SProcLbxSwitch(client)
- register ClientPtr client;
+SProcLbxSwitch(ClientPtr client)
{
register int n;
@@ -115,8 +114,7 @@ SProcLbxSwitch(client)
}
int
-SProcLbxBeginLargeRequest (client)
- register ClientPtr client;
+SProcLbxBeginLargeRequest (ClientPtr client)
{
register int n;
@@ -128,8 +126,7 @@ SProcLbxBeginLargeRequest (client)
}
int
-SProcLbxLargeRequestData (client)
- register ClientPtr client;
+SProcLbxLargeRequestData (ClientPtr client)
{
register int n;
@@ -140,8 +137,7 @@ SProcLbxLargeRequestData (client)
}
int
-SProcLbxEndLargeRequest (client)
- register ClientPtr client;
+SProcLbxEndLargeRequest (ClientPtr client)
{
register int n;
@@ -152,8 +148,7 @@ SProcLbxEndLargeRequest (client)
}
static int
-SProcLbxNewClient(client)
- register ClientPtr client;
+SProcLbxNewClient(ClientPtr client)
{
register int n;
@@ -165,8 +160,7 @@ SProcLbxNewClient(client)
}
static int
-SProcLbxCloseClient(client)
- register ClientPtr client;
+SProcLbxCloseClient(ClientPtr client)
{
register int n;
@@ -178,8 +172,7 @@ SProcLbxCloseClient(client)
}
static int
-SProcLbxModifySequence(client)
- register ClientPtr client;
+SProcLbxModifySequence(ClientPtr client)
{
register int n;
@@ -191,8 +184,7 @@ SProcLbxModifySequence(client)
}
static int
-SProcLbxAllowMotion(client)
- register ClientPtr client;
+SProcLbxAllowMotion(ClientPtr client)
{
register int n;
@@ -204,8 +196,7 @@ SProcLbxAllowMotion(client)
}
static int
-SProcLbxIncrementPixel(client)
- register ClientPtr client;
+SProcLbxIncrementPixel(ClientPtr client)
{
register int n;
@@ -218,8 +209,7 @@ SProcLbxIncrementPixel(client)
}
static int
-SProcLbxGrabCmap(client)
- register ClientPtr client;
+SProcLbxGrabCmap(ClientPtr client)
{
register int n;
@@ -232,8 +222,7 @@ SProcLbxGrabCmap(client)
}
static int
-SProcLbxReleaseCmap(client)
- register ClientPtr client;
+SProcLbxReleaseCmap(ClientPtr client)
{
register int n;
@@ -246,8 +235,7 @@ SProcLbxReleaseCmap(client)
}
static int
-SProcLbxAllocColor(client)
- register ClientPtr client;
+SProcLbxAllocColor(ClientPtr client)
{
register int n;
@@ -264,8 +252,7 @@ SProcLbxAllocColor(client)
}
static int
-SProcLbxGetModifierMapping(client)
- register ClientPtr client;
+SProcLbxGetModifierMapping(ClientPtr client)
{
register int n;
@@ -276,8 +263,7 @@ SProcLbxGetModifierMapping(client)
}
static int
-SProcLbxGetKeyboardMapping(client)
- register ClientPtr client;
+SProcLbxGetKeyboardMapping(ClientPtr client)
{
register int n;
@@ -288,8 +274,7 @@ SProcLbxGetKeyboardMapping(client)
}
static int
-SProcLbxQueryFont(client)
- register ClientPtr client;
+SProcLbxQueryFont(ClientPtr client)
{
register int n;
@@ -301,8 +286,7 @@ SProcLbxQueryFont(client)
}
static int
-SProcLbxChangeProperty(client)
- register ClientPtr client;
+SProcLbxChangeProperty(ClientPtr client)
{
register int n;
@@ -328,8 +312,7 @@ SProcLbxChangeProperty(client)
}
static int
-SProcLbxGetProperty(client)
- register ClientPtr client;
+SProcLbxGetProperty(ClientPtr client)
{
register int n;
@@ -345,8 +328,7 @@ SProcLbxGetProperty(client)
}
static int
-SProcLbxTagData(client)
- register ClientPtr client;
+SProcLbxTagData(ClientPtr client)
{
register int n;
@@ -359,8 +341,7 @@ SProcLbxTagData(client)
}
static int
-SProcLbxInvalidateTag(client)
- register ClientPtr client;
+SProcLbxInvalidateTag(ClientPtr client)
{
register int n;
@@ -372,8 +353,7 @@ SProcLbxInvalidateTag(client)
}
static int
-SProcLbxPoly(client)
- register ClientPtr client;
+SProcLbxPoly(ClientPtr client)
{
register int n;
@@ -393,8 +373,7 @@ SProcLbxPoly(client)
}
static int
-SProcLbxFillPoly(client)
- register ClientPtr client;
+SProcLbxFillPoly(ClientPtr client)
{
register int n;
@@ -414,10 +393,9 @@ SProcLbxFillPoly(client)
}
static int
-SProcLbxCopyArea (client)
- register ClientPtr client;
+SProcLbxCopyArea(ClientPtr client)
{
- register int n;
+ int n;
REQUEST(xLbxCopyAreaReq);
char *after;
@@ -440,10 +418,9 @@ SProcLbxCopyArea (client)
}
static int
-SProcLbxCopyPlane (client)
- register ClientPtr client;
+SProcLbxCopyPlane(ClientPtr client)
{
- register int n;
+ int n;
REQUEST(xLbxCopyPlaneReq);
char *after;
@@ -467,8 +444,7 @@ SProcLbxCopyPlane (client)
}
static int
-SProcLbxPolyText(client)
- register ClientPtr client;
+SProcLbxPolyText(ClientPtr client)
{
register int n;
@@ -488,8 +464,7 @@ SProcLbxPolyText(client)
}
static int
-SProcLbxImageText(client)
- register ClientPtr client;
+SProcLbxImageText(ClientPtr client)
{
register int n;
@@ -510,8 +485,7 @@ SProcLbxImageText(client)
static int
-SProcLbxPutImage(client)
- register ClientPtr client;
+SProcLbxPutImage(ClientPtr client)
{
register int n;
@@ -522,8 +496,7 @@ SProcLbxPutImage(client)
}
static int
-SProcLbxGetImage(client)
- register ClientPtr client;
+SProcLbxGetImage(ClientPtr client)
{
register int n;
@@ -540,8 +513,7 @@ SProcLbxGetImage(client)
}
static int
-SProcLbxInternAtoms(client)
- register ClientPtr client;
+SProcLbxInternAtoms(ClientPtr client)
{
register int n;
char *ptr;
@@ -569,8 +541,7 @@ SProcLbxInternAtoms(client)
static int
-SProcLbxGetWinAttrAndGeom(client)
- ClientPtr client;
+SProcLbxGetWinAttrAndGeom(ClientPtr client)
{
int n;
@@ -585,8 +556,7 @@ SProcLbxGetWinAttrAndGeom(client)
static int
-SProcLbxQueryExtension(client)
- ClientPtr client;
+SProcLbxQueryExtension(ClientPtr client)
{
int n;
@@ -598,8 +568,7 @@ SProcLbxQueryExtension(client)
}
int
-SProcLbxDispatch(client)
- register ClientPtr client;
+SProcLbxDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
@@ -682,10 +651,9 @@ SProcLbxDispatch(client)
#ifdef notyet
void
-LbxWriteSConnectionInfo(pClient, size, pInfo)
- ClientPtr pClient;
- unsigned long size;
- char *pInfo;
+LbxWriteSConnectionInfo(ClientPtr pClient,
+ unsigned long size,
+ char *pInfo)
{
int i, j, k;
ScreenPtr pScreen;
@@ -741,8 +709,8 @@ LbxWriteSConnectionInfo(pClient, size, pInfo)
}
void
-SwapConnSetup(pConnSetup, pConnSetupT)
- xConnSetup *pConnSetup, *pConnSetupT;
+SwapConnSetup(xConnSetup *pConnSetup,
+ xConnSetup *pConnSetupT)
{
cpswapl(pConnSetup->release, pConnSetupT->release);
cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
@@ -761,8 +729,8 @@ SwapConnSetup(pConnSetup, pConnSetupT)
}
void
-SwapWinRoot(pRoot, pRootT)
- xWindowRoot *pRoot, *pRootT;
+SwapWinRoot(xWindowRoot *pRoot,
+ xWindowRoot *pRootT)
{
cpswapl(pRoot->windowId, pRootT->windowId);
cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
@@ -783,8 +751,8 @@ SwapWinRoot(pRoot, pRootT)
}
void
-SwapVisual(pVis, pVisT)
- xVisualType *pVis, *pVisT;
+SwapVisual(xVisualType *pVis,
+ xVisualType *pVisT;
{
cpswapl(pVis->visualID, pVisT->visualID);
pVisT->class = pVis->class;
@@ -797,9 +765,8 @@ SwapVisual(pVis, pVisT)
#endif
void
-LbxWriteSConnSetupPrefix(pClient, pcsp)
- ClientPtr pClient;
- xLbxConnSetupPrefix *pcsp;
+LbxWriteSConnSetupPrefix(ClientPtr pClient,
+ xLbxConnSetupPrefix *pcsp)
{
xLbxConnSetupPrefix cspT;
@@ -814,9 +781,8 @@ LbxWriteSConnSetupPrefix(pClient, pcsp)
}
void
-LbxSwapFontInfo(pr, compressed)
- xLbxFontInfo *pr;
- Bool compressed;
+LbxSwapFontInfo(xLbxFontInfo *pr,
+ Bool compressed)
{
unsigned i;
xCharInfo *pxci;
diff --git a/lbx/lbxtables.c b/lbx/lbxtables.c
index c3d4f1270..e071846e3 100644
--- a/lbx/lbxtables.c
+++ b/lbx/lbxtables.c
@@ -21,11 +21,13 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxtables.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
+#include "dix.h"
-extern int ProcInitialConnection();
-extern int ProcLbxEstablishConnection();
+extern int ProcInitialConnection(ClientPtr client);
+extern int ProcLbxEstablishConnection(ClientPtr client);
-int (* LbxInitialVector[3]) () =
+int (* LbxInitialVector[3]) (ClientPtr) =
{
0,
ProcInitialConnection,
diff --git a/lbx/lbxtags.c b/lbx/lbxtags.c
index b2bc40ade..5b1d65a4a 100644
--- a/lbx/lbxtags.c
+++ b/lbx/lbxtags.c
@@ -46,30 +46,31 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.4 2001/12/14 20:00:01 dawes Exp $ */
#include "X.h"
#include "misc.h"
#include "lbxdata.h"
#include "resource.h"
+#include "colormapst.h"
+#include "propertyst.h"
#include "lbxtags.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
#include "propertyst.h"
-static int tag_free();
-
static RESTYPE TagResType;
+extern int _lbx_fi_junklen;
+
/* ARGSUSED */
static int
-tag_free(data, id)
- pointer data;
- XID id;
+tag_free(pointer data,
+ XID id)
{
TagData td = (TagData) data;
FontTagInfoPtr ftip;
char *t;
- extern int _lbx_fi_junklen;
if (td->global)
*(td->global) = 0;
@@ -88,21 +89,21 @@ tag_free(data, id)
return 0;
}
-TagInit()
+void
+TagInit(void)
{
TagResType = CreateNewResourceType(tag_free);
}
XID
-TagNewTag()
+TagNewTag(void)
{
return FakeClientID(0);
}
void
-TagClearProxy(tid, pid)
- XID tid;
- int pid;
+TagClearProxy(XID tid,
+ int pid)
{
TagData td;
@@ -112,9 +113,8 @@ TagClearProxy(tid, pid)
}
void
-TagMarkProxy(tid, pid)
- XID tid;
- int pid;
+TagMarkProxy(XID tid,
+ int pid)
{
TagData td;
@@ -123,9 +123,8 @@ TagMarkProxy(tid, pid)
}
Bool
-TagProxyMarked(tid, pid)
- XID tid;
- int pid;
+TagProxyMarked(XID tid,
+ int pid)
{
TagData td;
@@ -134,11 +133,10 @@ TagProxyMarked(tid, pid)
}
XID
-TagSaveTag(dtype, size, data, global)
- int dtype;
- int size;
- pointer data;
- XID *global;
+TagSaveTag(int dtype,
+ int size,
+ pointer data,
+ XID *global)
{
TagData td;
@@ -162,8 +160,7 @@ TagSaveTag(dtype, size, data, global)
}
void
-TagDeleteTag(tid)
- XID tid;
+TagDeleteTag(XID tid)
{
int pid;
TagData td;
@@ -192,8 +189,7 @@ TagDeleteTag(tid)
}
TagData
-TagGetTag(tid)
- XID tid;
+TagGetTag(XID tid)
{
TagData td;
@@ -202,10 +198,9 @@ TagGetTag(tid)
}
static void
-LbxFlushTag(value, tid, cdata)
- pointer value;
- XID tid;
- pointer cdata;
+LbxFlushTag(pointer value,
+ XID tid,
+ pointer cdata)
{
TagData td = (TagData)value;
LbxProxyPtr proxy = (LbxProxyPtr)cdata;
@@ -231,8 +226,8 @@ LbxFlushTag(value, tid, cdata)
/*
* clear out markers for proxies
*/
-LbxFlushTags(proxy)
- LbxProxyPtr proxy;
+void
+LbxFlushTags(LbxProxyPtr proxy)
{
FindClientResourcesByType(NULL, TagResType, LbxFlushTag, (pointer)proxy);
}
diff --git a/lbx/lbxtags.h b/lbx/lbxtags.h
index 3b6ab731a..e451ad091 100644
--- a/lbx/lbxtags.h
+++ b/lbx/lbxtags.h
@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.4 2001/12/14 20:00:01 dawes Exp $ */
#ifndef _LBXTAGS_H_
#define _LBXTAGS_H_
@@ -68,52 +69,14 @@ typedef struct _tagdata {
typedef struct _tagdata *TagData;
-extern TagData TagGetTag(
-#if NeedFunctionPrototypes
- XID /*tid*/
-#endif
-);
-
-extern XID TagNewTag(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void TagClearProxy(
-#if NeedFunctionPrototypes
- XID /*tid*/,
- int /*pid*/
-#endif
-);
-
-extern void TagMarkProxy(
-#if NeedFunctionPrototypes
- XID /*tid*/,
- int /*pid*/
-#endif
-);
-
-extern Bool TagProxyMarked(
-#if NeedFunctionPrototypes
- XID /*tid*/,
- int /*pid*/
-#endif
-);
-
-extern void TagDeleteTag(
-#if NeedFunctionPrototypes
- XID /*tid*/
-#endif
-);
-
-extern XID TagSaveTag(
-#if NeedFunctionPrototypes
- int /*dtype*/,
- int /*size*/,
- pointer /*data*/,
- XID* /*global*/
-#endif
-);
+extern void TagInit ( void );
+extern XID TagNewTag ( void );
+extern void TagClearProxy ( XID tid, int pid );
+extern void TagMarkProxy ( XID tid, int pid );
+extern Bool TagProxyMarked ( XID tid, int pid );
+extern XID TagSaveTag ( int dtype, int size, pointer data, XID *global );
+extern void TagDeleteTag ( XID tid );
+extern TagData TagGetTag ( XID tid );
+extern void LbxFlushTags ( LbxProxyPtr proxy );
#endif /* _LBXTAGS_H_ */
diff --git a/lbx/lbxzerorep.c b/lbx/lbxzerorep.c
index 350d7f0f9..50b424708 100644
--- a/lbx/lbxzerorep.c
+++ b/lbx/lbxzerorep.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.4 2001/12/14 20:00:02 dawes Exp $ */
/*
* This module handles zeroing out unused pad bytes in core X replies.
@@ -38,10 +39,9 @@ from The Open Group.
#include "X.h"
#include <X11/Xproto.h>
-
-ZeroReplyPadBytes (buf, reqType)
- char *buf;
- int reqType;
+void
+ZeroReplyPadBytes (char *buf,
+ int reqType)
{
switch (reqType) {
case X_GetWindowAttributes:
diff --git a/mfb/fastblt.h b/mfb/fastblt.h
index 6567a8936..f647eb6ba 100644
--- a/mfb/fastblt.h
+++ b/mfb/fastblt.h
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mfb/fastblt.h,v 1.5 2001/12/14 20:00:03 dawes Exp $ */
/*
* Fast bitblt macros for certain hardware. If your machine has an addressing
@@ -77,7 +78,6 @@ from The Open Group.
}
#endif
-#if PPW == 32
#define DuffL(counter,label,body) \
switch (counter & 3) { \
label: \
@@ -92,27 +92,3 @@ from The Open Group.
if ((counter -= 4) >= 0) \
goto label; \
}
-#else /* PPW == 64 */
-#define DuffL(counter,label,body) \
- switch (counter & 7) { \
- label: \
- body \
- case 7: \
- body \
- case 6: \
- body \
- case 5: \
- body \
- case 4: \
- body \
- case 3: \
- body \
- case 2: \
- body \
- case 1: \
- body \
- case 0: \
- if ((counter -= 8) >= 0) \
- goto label; \
- }
-#endif /* PPW */
diff --git a/mfb/maskbits.c b/mfb/maskbits.c
index deb62618a..4f3e0087b 100644
--- a/mfb/maskbits.c
+++ b/mfb/maskbits.c
@@ -48,6 +48,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
*/
+/* $XFree86: xc/programs/Xserver/mfb/maskbits.c,v 1.6 2001/12/14 20:00:03 dawes Exp $ */
#include "maskbits.h"
#include "servermd.h"
@@ -64,6 +65,10 @@ bit index PPW-n in a longword
see also maskbits.h
*/
+#if PPW != 32
+ ERROR MFB must be compiled with PPW 32
+#endif
+
#if (BITMAP_BIT_ORDER == MSBFirst)
/* NOTE:
the first element in starttab could be 0xffffffff. making it 0
@@ -74,40 +79,6 @@ have to do if we thought it was partial.
PixelType starttab[PPW+1] =
{
LONG2CHARS( 0x00000000 ),
-#if PPW == 64
- LONG2CHARS( 0x7FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x007FFFFFFFFFFFFF ),
- LONG2CHARS( 0x003FFFFFFFFFFFFF ),
- LONG2CHARS( 0x001FFFFFFFFFFFFF ),
- LONG2CHARS( 0x000FFFFFFFFFFFFF ),
- LONG2CHARS( 0x0007FFFFFFFFFFFF ),
- LONG2CHARS( 0x0003FFFFFFFFFFFF ),
- LONG2CHARS( 0x0001FFFFFFFFFFFF ),
- LONG2CHARS( 0x0000FFFFFFFFFFFF ),
- LONG2CHARS( 0x00007FFFFFFFFFFF ),
- LONG2CHARS( 0x00003FFFFFFFFFFF ),
- LONG2CHARS( 0x00001FFFFFFFFFFF ),
- LONG2CHARS( 0x00000FFFFFFFFFFF ),
- LONG2CHARS( 0x000007FFFFFFFFFF ),
- LONG2CHARS( 0x000003FFFFFFFFFF ),
- LONG2CHARS( 0x000001FFFFFFFFFF ),
- LONG2CHARS( 0x000000FFFFFFFFFF ),
- LONG2CHARS( 0x0000007FFFFFFFFF ),
- LONG2CHARS( 0x0000003FFFFFFFFF ),
- LONG2CHARS( 0x0000001FFFFFFFFF ),
- LONG2CHARS( 0x0000000FFFFFFFFF ),
- LONG2CHARS( 0x00000007FFFFFFFF ),
- LONG2CHARS( 0x00000003FFFFFFFF ),
- LONG2CHARS( 0x00000001FFFFFFFF ),
- LONG2CHARS( 0x00000000FFFFFFFF ),
-#endif /* PPW == 64 */
LONG2CHARS( 0x7FFFFFFF ),
LONG2CHARS( 0x3FFFFFFF ),
LONG2CHARS( 0x1FFFFFFF ),
@@ -144,7 +115,6 @@ PixelType starttab[PPW+1] =
PixelType endtab[PPW+1] =
{
-#if PPW == 32
LONG2CHARS( 0x00000000 ),
LONG2CHARS( 0x80000000 ),
LONG2CHARS( 0xC0000000 ),
@@ -178,78 +148,11 @@ PixelType endtab[PPW+1] =
LONG2CHARS( 0xFFFFFFFC ),
LONG2CHARS( 0xFFFFFFFE ),
LONG2CHARS( 0xFFFFFFFF )
-#else /* PPW */
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x8000000000000000 ),
- LONG2CHARS( 0xC000000000000000 ),
- LONG2CHARS( 0xE000000000000000 ),
- LONG2CHARS( 0xF000000000000000 ),
- LONG2CHARS( 0xF800000000000000 ),
- LONG2CHARS( 0xFC00000000000000 ),
- LONG2CHARS( 0xFE00000000000000 ),
- LONG2CHARS( 0xFF00000000000000 ),
- LONG2CHARS( 0xFF80000000000000 ),
- LONG2CHARS( 0xFFC0000000000000 ),
- LONG2CHARS( 0xFFE0000000000000 ),
- LONG2CHARS( 0xFFF0000000000000 ),
- LONG2CHARS( 0xFFF8000000000000 ),
- LONG2CHARS( 0xFFFC000000000000 ),
- LONG2CHARS( 0xFFFE000000000000 ),
- LONG2CHARS( 0xFFFF000000000000 ),
- LONG2CHARS( 0xFFFF800000000000 ),
- LONG2CHARS( 0xFFFFC00000000000 ),
- LONG2CHARS( 0xFFFFE00000000000 ),
- LONG2CHARS( 0xFFFFF00000000000 ),
- LONG2CHARS( 0xFFFFF80000000000 ),
- LONG2CHARS( 0xFFFFFC0000000000 ),
- LONG2CHARS( 0xFFFFFE0000000000 ),
- LONG2CHARS( 0xFFFFFF0000000000 ),
- LONG2CHARS( 0xFFFFFF8000000000 ),
- LONG2CHARS( 0xFFFFFFC000000000 ),
- LONG2CHARS( 0xFFFFFFE000000000 ),
- LONG2CHARS( 0xFFFFFFF000000000 ),
- LONG2CHARS( 0xFFFFFFF800000000 ),
- LONG2CHARS( 0xFFFFFFFC00000000 ),
- LONG2CHARS( 0xFFFFFFFE00000000 ),
- LONG2CHARS( 0xFFFFFFFF00000000 ),
- LONG2CHARS( 0xFFFFFFFF80000000 ),
- LONG2CHARS( 0xFFFFFFFFC0000000 ),
- LONG2CHARS( 0xFFFFFFFFE0000000 ),
- LONG2CHARS( 0xFFFFFFFFF0000000 ),
- LONG2CHARS( 0xFFFFFFFFF8000000 ),
- LONG2CHARS( 0xFFFFFFFFFC000000 ),
- LONG2CHARS( 0xFFFFFFFFFE000000 ),
- LONG2CHARS( 0xFFFFFFFFFF000000 ),
- LONG2CHARS( 0xFFFFFFFFFF800000 ),
- LONG2CHARS( 0xFFFFFFFFFFC00000 ),
- LONG2CHARS( 0xFFFFFFFFFFE00000 ),
- LONG2CHARS( 0xFFFFFFFFFFF00000 ),
- LONG2CHARS( 0xFFFFFFFFFFF80000 ),
- LONG2CHARS( 0xFFFFFFFFFFFC0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFE0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF8000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFC000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFE000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF800 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFC00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFE00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF80 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFC ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFE ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFF )
-#endif /* PPW */
};
#ifndef LOWMEMFTPT
-#if NEED_OLD_MFB_MASKS
+#ifdef NEED_OLD_MFB_MASKS
/* a hack, for now, since the entries for 0 need to be all
1 bits, not all zeros.
this means the code DOES NOT WORK for segments of length
@@ -332,7 +235,6 @@ PixelType endpartial[33] =
#endif /* ifndef LOWMEMFTPT */
-#if PPW == 32
PixelType partmasks[PPW][PPW] = {
{LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0xE0000000 ),
LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xFE000000 ),
@@ -591,4234 +493,6 @@ PixelType partmasks[PPW][PPW] = {
LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
};
-#else /* PPW == 64 */
-unsigned long partmasks[PPW][PPW] = {
- {
- LONG2CHARS( 0xFFFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x8000000000000000 ),
- LONG2CHARS( 0xC000000000000000 ),
- LONG2CHARS( 0xE000000000000000 ),
- LONG2CHARS( 0xF000000000000000 ),
- LONG2CHARS( 0xF800000000000000 ),
- LONG2CHARS( 0xFC00000000000000 ),
- LONG2CHARS( 0xFE00000000000000 ),
- LONG2CHARS( 0xFF00000000000000 ),
- LONG2CHARS( 0xFF80000000000000 ),
- LONG2CHARS( 0xFFC0000000000000 ),
- LONG2CHARS( 0xFFE0000000000000 ),
- LONG2CHARS( 0xFFF0000000000000 ),
- LONG2CHARS( 0xFFF8000000000000 ),
- LONG2CHARS( 0xFFFC000000000000 ),
- LONG2CHARS( 0xFFFE000000000000 ),
- LONG2CHARS( 0xFFFF000000000000 ),
- LONG2CHARS( 0xFFFF800000000000 ),
- LONG2CHARS( 0xFFFFC00000000000 ),
- LONG2CHARS( 0xFFFFE00000000000 ),
- LONG2CHARS( 0xFFFFF00000000000 ),
- LONG2CHARS( 0xFFFFF80000000000 ),
- LONG2CHARS( 0xFFFFFC0000000000 ),
- LONG2CHARS( 0xFFFFFE0000000000 ),
- LONG2CHARS( 0xFFFFFF0000000000 ),
- LONG2CHARS( 0xFFFFFF8000000000 ),
- LONG2CHARS( 0xFFFFFFC000000000 ),
- LONG2CHARS( 0xFFFFFFE000000000 ),
- LONG2CHARS( 0xFFFFFFF000000000 ),
- LONG2CHARS( 0xFFFFFFF800000000 ),
- LONG2CHARS( 0xFFFFFFFC00000000 ),
- LONG2CHARS( 0xFFFFFFFE00000000 ),
- LONG2CHARS( 0xFFFFFFFF00000000 ),
- LONG2CHARS( 0xFFFFFFFF80000000 ),
- LONG2CHARS( 0xFFFFFFFFC0000000 ),
- LONG2CHARS( 0xFFFFFFFFE0000000 ),
- LONG2CHARS( 0xFFFFFFFFF0000000 ),
- LONG2CHARS( 0xFFFFFFFFF8000000 ),
- LONG2CHARS( 0xFFFFFFFFFC000000 ),
- LONG2CHARS( 0xFFFFFFFFFE000000 ),
- LONG2CHARS( 0xFFFFFFFFFF000000 ),
- LONG2CHARS( 0xFFFFFFFFFF800000 ),
- LONG2CHARS( 0xFFFFFFFFFFC00000 ),
- LONG2CHARS( 0xFFFFFFFFFFE00000 ),
- LONG2CHARS( 0xFFFFFFFFFFF00000 ),
- LONG2CHARS( 0xFFFFFFFFFFF80000 ),
- LONG2CHARS( 0xFFFFFFFFFFFC0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFE0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF8000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFC000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFE000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF800 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFC00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFE00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF80 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFC ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFE ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x4000000000000000 ),
- LONG2CHARS( 0x6000000000000000 ),
- LONG2CHARS( 0x7000000000000000 ),
- LONG2CHARS( 0x7800000000000000 ),
- LONG2CHARS( 0x7C00000000000000 ),
- LONG2CHARS( 0x7E00000000000000 ),
- LONG2CHARS( 0x7F00000000000000 ),
- LONG2CHARS( 0x7F80000000000000 ),
- LONG2CHARS( 0x7FC0000000000000 ),
- LONG2CHARS( 0x7FE0000000000000 ),
- LONG2CHARS( 0x7FF0000000000000 ),
- LONG2CHARS( 0x7FF8000000000000 ),
- LONG2CHARS( 0x7FFC000000000000 ),
- LONG2CHARS( 0x7FFE000000000000 ),
- LONG2CHARS( 0x7FFF000000000000 ),
- LONG2CHARS( 0x7FFF800000000000 ),
- LONG2CHARS( 0x7FFFC00000000000 ),
- LONG2CHARS( 0x7FFFE00000000000 ),
- LONG2CHARS( 0x7FFFF00000000000 ),
- LONG2CHARS( 0x7FFFF80000000000 ),
- LONG2CHARS( 0x7FFFFC0000000000 ),
- LONG2CHARS( 0x7FFFFE0000000000 ),
- LONG2CHARS( 0x7FFFFF0000000000 ),
- LONG2CHARS( 0x7FFFFF8000000000 ),
- LONG2CHARS( 0x7FFFFFC000000000 ),
- LONG2CHARS( 0x7FFFFFE000000000 ),
- LONG2CHARS( 0x7FFFFFF000000000 ),
- LONG2CHARS( 0x7FFFFFF800000000 ),
- LONG2CHARS( 0x7FFFFFFC00000000 ),
- LONG2CHARS( 0x7FFFFFFE00000000 ),
- LONG2CHARS( 0x7FFFFFFF00000000 ),
- LONG2CHARS( 0x7FFFFFFF80000000 ),
- LONG2CHARS( 0x7FFFFFFFC0000000 ),
- LONG2CHARS( 0x7FFFFFFFE0000000 ),
- LONG2CHARS( 0x7FFFFFFFF0000000 ),
- LONG2CHARS( 0x7FFFFFFFF8000000 ),
- LONG2CHARS( 0x7FFFFFFFFC000000 ),
- LONG2CHARS( 0x7FFFFFFFFE000000 ),
- LONG2CHARS( 0x7FFFFFFFFF000000 ),
- LONG2CHARS( 0x7FFFFFFFFF800000 ),
- LONG2CHARS( 0x7FFFFFFFFFC00000 ),
- LONG2CHARS( 0x7FFFFFFFFFE00000 ),
- LONG2CHARS( 0x7FFFFFFFFFF00000 ),
- LONG2CHARS( 0x7FFFFFFFFFF80000 ),
- LONG2CHARS( 0x7FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x7FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x7FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x7FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFF ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x2000000000000000 ),
- LONG2CHARS( 0x3000000000000000 ),
- LONG2CHARS( 0x3800000000000000 ),
- LONG2CHARS( 0x3C00000000000000 ),
- LONG2CHARS( 0x3E00000000000000 ),
- LONG2CHARS( 0x3F00000000000000 ),
- LONG2CHARS( 0x3F80000000000000 ),
- LONG2CHARS( 0x3FC0000000000000 ),
- LONG2CHARS( 0x3FE0000000000000 ),
- LONG2CHARS( 0x3FF0000000000000 ),
- LONG2CHARS( 0x3FF8000000000000 ),
- LONG2CHARS( 0x3FFC000000000000 ),
- LONG2CHARS( 0x3FFE000000000000 ),
- LONG2CHARS( 0x3FFF000000000000 ),
- LONG2CHARS( 0x3FFF800000000000 ),
- LONG2CHARS( 0x3FFFC00000000000 ),
- LONG2CHARS( 0x3FFFE00000000000 ),
- LONG2CHARS( 0x3FFFF00000000000 ),
- LONG2CHARS( 0x3FFFF80000000000 ),
- LONG2CHARS( 0x3FFFFC0000000000 ),
- LONG2CHARS( 0x3FFFFE0000000000 ),
- LONG2CHARS( 0x3FFFFF0000000000 ),
- LONG2CHARS( 0x3FFFFF8000000000 ),
- LONG2CHARS( 0x3FFFFFC000000000 ),
- LONG2CHARS( 0x3FFFFFE000000000 ),
- LONG2CHARS( 0x3FFFFFF000000000 ),
- LONG2CHARS( 0x3FFFFFF800000000 ),
- LONG2CHARS( 0x3FFFFFFC00000000 ),
- LONG2CHARS( 0x3FFFFFFE00000000 ),
- LONG2CHARS( 0x3FFFFFFF00000000 ),
- LONG2CHARS( 0x3FFFFFFF80000000 ),
- LONG2CHARS( 0x3FFFFFFFC0000000 ),
- LONG2CHARS( 0x3FFFFFFFE0000000 ),
- LONG2CHARS( 0x3FFFFFFFF0000000 ),
- LONG2CHARS( 0x3FFFFFFFF8000000 ),
- LONG2CHARS( 0x3FFFFFFFFC000000 ),
- LONG2CHARS( 0x3FFFFFFFFE000000 ),
- LONG2CHARS( 0x3FFFFFFFFF000000 ),
- LONG2CHARS( 0x3FFFFFFFFF800000 ),
- LONG2CHARS( 0x3FFFFFFFFFC00000 ),
- LONG2CHARS( 0x3FFFFFFFFFE00000 ),
- LONG2CHARS( 0x3FFFFFFFFFF00000 ),
- LONG2CHARS( 0x3FFFFFFFFFF80000 ),
- LONG2CHARS( 0x3FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x3FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x3FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x3FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x1000000000000000 ),
- LONG2CHARS( 0x1800000000000000 ),
- LONG2CHARS( 0x1C00000000000000 ),
- LONG2CHARS( 0x1E00000000000000 ),
- LONG2CHARS( 0x1F00000000000000 ),
- LONG2CHARS( 0x1F80000000000000 ),
- LONG2CHARS( 0x1FC0000000000000 ),
- LONG2CHARS( 0x1FE0000000000000 ),
- LONG2CHARS( 0x1FF0000000000000 ),
- LONG2CHARS( 0x1FF8000000000000 ),
- LONG2CHARS( 0x1FFC000000000000 ),
- LONG2CHARS( 0x1FFE000000000000 ),
- LONG2CHARS( 0x1FFF000000000000 ),
- LONG2CHARS( 0x1FFF800000000000 ),
- LONG2CHARS( 0x1FFFC00000000000 ),
- LONG2CHARS( 0x1FFFE00000000000 ),
- LONG2CHARS( 0x1FFFF00000000000 ),
- LONG2CHARS( 0x1FFFF80000000000 ),
- LONG2CHARS( 0x1FFFFC0000000000 ),
- LONG2CHARS( 0x1FFFFE0000000000 ),
- LONG2CHARS( 0x1FFFFF0000000000 ),
- LONG2CHARS( 0x1FFFFF8000000000 ),
- LONG2CHARS( 0x1FFFFFC000000000 ),
- LONG2CHARS( 0x1FFFFFE000000000 ),
- LONG2CHARS( 0x1FFFFFF000000000 ),
- LONG2CHARS( 0x1FFFFFF800000000 ),
- LONG2CHARS( 0x1FFFFFFC00000000 ),
- LONG2CHARS( 0x1FFFFFFE00000000 ),
- LONG2CHARS( 0x1FFFFFFF00000000 ),
- LONG2CHARS( 0x1FFFFFFF80000000 ),
- LONG2CHARS( 0x1FFFFFFFC0000000 ),
- LONG2CHARS( 0x1FFFFFFFE0000000 ),
- LONG2CHARS( 0x1FFFFFFFF0000000 ),
- LONG2CHARS( 0x1FFFFFFFF8000000 ),
- LONG2CHARS( 0x1FFFFFFFFC000000 ),
- LONG2CHARS( 0x1FFFFFFFFE000000 ),
- LONG2CHARS( 0x1FFFFFFFFF000000 ),
- LONG2CHARS( 0x1FFFFFFFFF800000 ),
- LONG2CHARS( 0x1FFFFFFFFFC00000 ),
- LONG2CHARS( 0x1FFFFFFFFFE00000 ),
- LONG2CHARS( 0x1FFFFFFFFFF00000 ),
- LONG2CHARS( 0x1FFFFFFFFFF80000 ),
- LONG2CHARS( 0x1FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x1FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x1FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x1FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0800000000000000 ),
- LONG2CHARS( 0x0C00000000000000 ),
- LONG2CHARS( 0x0E00000000000000 ),
- LONG2CHARS( 0x0F00000000000000 ),
- LONG2CHARS( 0x0F80000000000000 ),
- LONG2CHARS( 0x0FC0000000000000 ),
- LONG2CHARS( 0x0FE0000000000000 ),
- LONG2CHARS( 0x0FF0000000000000 ),
- LONG2CHARS( 0x0FF8000000000000 ),
- LONG2CHARS( 0x0FFC000000000000 ),
- LONG2CHARS( 0x0FFE000000000000 ),
- LONG2CHARS( 0x0FFF000000000000 ),
- LONG2CHARS( 0x0FFF800000000000 ),
- LONG2CHARS( 0x0FFFC00000000000 ),
- LONG2CHARS( 0x0FFFE00000000000 ),
- LONG2CHARS( 0x0FFFF00000000000 ),
- LONG2CHARS( 0x0FFFF80000000000 ),
- LONG2CHARS( 0x0FFFFC0000000000 ),
- LONG2CHARS( 0x0FFFFE0000000000 ),
- LONG2CHARS( 0x0FFFFF0000000000 ),
- LONG2CHARS( 0x0FFFFF8000000000 ),
- LONG2CHARS( 0x0FFFFFC000000000 ),
- LONG2CHARS( 0x0FFFFFE000000000 ),
- LONG2CHARS( 0x0FFFFFF000000000 ),
- LONG2CHARS( 0x0FFFFFF800000000 ),
- LONG2CHARS( 0x0FFFFFFC00000000 ),
- LONG2CHARS( 0x0FFFFFFE00000000 ),
- LONG2CHARS( 0x0FFFFFFF00000000 ),
- LONG2CHARS( 0x0FFFFFFF80000000 ),
- LONG2CHARS( 0x0FFFFFFFC0000000 ),
- LONG2CHARS( 0x0FFFFFFFE0000000 ),
- LONG2CHARS( 0x0FFFFFFFF0000000 ),
- LONG2CHARS( 0x0FFFFFFFF8000000 ),
- LONG2CHARS( 0x0FFFFFFFFC000000 ),
- LONG2CHARS( 0x0FFFFFFFFE000000 ),
- LONG2CHARS( 0x0FFFFFFFFF000000 ),
- LONG2CHARS( 0x0FFFFFFFFF800000 ),
- LONG2CHARS( 0x0FFFFFFFFFC00000 ),
- LONG2CHARS( 0x0FFFFFFFFFE00000 ),
- LONG2CHARS( 0x0FFFFFFFFFF00000 ),
- LONG2CHARS( 0x0FFFFFFFFFF80000 ),
- LONG2CHARS( 0x0FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x0FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x0FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x0FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0400000000000000 ),
- LONG2CHARS( 0x0600000000000000 ),
- LONG2CHARS( 0x0700000000000000 ),
- LONG2CHARS( 0x0780000000000000 ),
- LONG2CHARS( 0x07C0000000000000 ),
- LONG2CHARS( 0x07E0000000000000 ),
- LONG2CHARS( 0x07F0000000000000 ),
- LONG2CHARS( 0x07F8000000000000 ),
- LONG2CHARS( 0x07FC000000000000 ),
- LONG2CHARS( 0x07FE000000000000 ),
- LONG2CHARS( 0x07FF000000000000 ),
- LONG2CHARS( 0x07FF800000000000 ),
- LONG2CHARS( 0x07FFC00000000000 ),
- LONG2CHARS( 0x07FFE00000000000 ),
- LONG2CHARS( 0x07FFF00000000000 ),
- LONG2CHARS( 0x07FFF80000000000 ),
- LONG2CHARS( 0x07FFFC0000000000 ),
- LONG2CHARS( 0x07FFFE0000000000 ),
- LONG2CHARS( 0x07FFFF0000000000 ),
- LONG2CHARS( 0x07FFFF8000000000 ),
- LONG2CHARS( 0x07FFFFC000000000 ),
- LONG2CHARS( 0x07FFFFE000000000 ),
- LONG2CHARS( 0x07FFFFF000000000 ),
- LONG2CHARS( 0x07FFFFF800000000 ),
- LONG2CHARS( 0x07FFFFFC00000000 ),
- LONG2CHARS( 0x07FFFFFE00000000 ),
- LONG2CHARS( 0x07FFFFFF00000000 ),
- LONG2CHARS( 0x07FFFFFF80000000 ),
- LONG2CHARS( 0x07FFFFFFC0000000 ),
- LONG2CHARS( 0x07FFFFFFE0000000 ),
- LONG2CHARS( 0x07FFFFFFF0000000 ),
- LONG2CHARS( 0x07FFFFFFF8000000 ),
- LONG2CHARS( 0x07FFFFFFFC000000 ),
- LONG2CHARS( 0x07FFFFFFFE000000 ),
- LONG2CHARS( 0x07FFFFFFFF000000 ),
- LONG2CHARS( 0x07FFFFFFFF800000 ),
- LONG2CHARS( 0x07FFFFFFFFC00000 ),
- LONG2CHARS( 0x07FFFFFFFFE00000 ),
- LONG2CHARS( 0x07FFFFFFFFF00000 ),
- LONG2CHARS( 0x07FFFFFFFFF80000 ),
- LONG2CHARS( 0x07FFFFFFFFFC0000 ),
- LONG2CHARS( 0x07FFFFFFFFFE0000 ),
- LONG2CHARS( 0x07FFFFFFFFFF0000 ),
- LONG2CHARS( 0x07FFFFFFFFFF8000 ),
- LONG2CHARS( 0x07FFFFFFFFFFC000 ),
- LONG2CHARS( 0x07FFFFFFFFFFE000 ),
- LONG2CHARS( 0x07FFFFFFFFFFF000 ),
- LONG2CHARS( 0x07FFFFFFFFFFF800 ),
- LONG2CHARS( 0x07FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x07FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x07FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x07FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0200000000000000 ),
- LONG2CHARS( 0x0300000000000000 ),
- LONG2CHARS( 0x0380000000000000 ),
- LONG2CHARS( 0x03C0000000000000 ),
- LONG2CHARS( 0x03E0000000000000 ),
- LONG2CHARS( 0x03F0000000000000 ),
- LONG2CHARS( 0x03F8000000000000 ),
- LONG2CHARS( 0x03FC000000000000 ),
- LONG2CHARS( 0x03FE000000000000 ),
- LONG2CHARS( 0x03FF000000000000 ),
- LONG2CHARS( 0x03FF800000000000 ),
- LONG2CHARS( 0x03FFC00000000000 ),
- LONG2CHARS( 0x03FFE00000000000 ),
- LONG2CHARS( 0x03FFF00000000000 ),
- LONG2CHARS( 0x03FFF80000000000 ),
- LONG2CHARS( 0x03FFFC0000000000 ),
- LONG2CHARS( 0x03FFFE0000000000 ),
- LONG2CHARS( 0x03FFFF0000000000 ),
- LONG2CHARS( 0x03FFFF8000000000 ),
- LONG2CHARS( 0x03FFFFC000000000 ),
- LONG2CHARS( 0x03FFFFE000000000 ),
- LONG2CHARS( 0x03FFFFF000000000 ),
- LONG2CHARS( 0x03FFFFF800000000 ),
- LONG2CHARS( 0x03FFFFFC00000000 ),
- LONG2CHARS( 0x03FFFFFE00000000 ),
- LONG2CHARS( 0x03FFFFFF00000000 ),
- LONG2CHARS( 0x03FFFFFF80000000 ),
- LONG2CHARS( 0x03FFFFFFC0000000 ),
- LONG2CHARS( 0x03FFFFFFE0000000 ),
- LONG2CHARS( 0x03FFFFFFF0000000 ),
- LONG2CHARS( 0x03FFFFFFF8000000 ),
- LONG2CHARS( 0x03FFFFFFFC000000 ),
- LONG2CHARS( 0x03FFFFFFFE000000 ),
- LONG2CHARS( 0x03FFFFFFFF000000 ),
- LONG2CHARS( 0x03FFFFFFFF800000 ),
- LONG2CHARS( 0x03FFFFFFFFC00000 ),
- LONG2CHARS( 0x03FFFFFFFFE00000 ),
- LONG2CHARS( 0x03FFFFFFFFF00000 ),
- LONG2CHARS( 0x03FFFFFFFFF80000 ),
- LONG2CHARS( 0x03FFFFFFFFFC0000 ),
- LONG2CHARS( 0x03FFFFFFFFFE0000 ),
- LONG2CHARS( 0x03FFFFFFFFFF0000 ),
- LONG2CHARS( 0x03FFFFFFFFFF8000 ),
- LONG2CHARS( 0x03FFFFFFFFFFC000 ),
- LONG2CHARS( 0x03FFFFFFFFFFE000 ),
- LONG2CHARS( 0x03FFFFFFFFFFF000 ),
- LONG2CHARS( 0x03FFFFFFFFFFF800 ),
- LONG2CHARS( 0x03FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x03FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x03FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x03FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0100000000000000 ),
- LONG2CHARS( 0x0180000000000000 ),
- LONG2CHARS( 0x01C0000000000000 ),
- LONG2CHARS( 0x01E0000000000000 ),
- LONG2CHARS( 0x01F0000000000000 ),
- LONG2CHARS( 0x01F8000000000000 ),
- LONG2CHARS( 0x01FC000000000000 ),
- LONG2CHARS( 0x01FE000000000000 ),
- LONG2CHARS( 0x01FF000000000000 ),
- LONG2CHARS( 0x01FF800000000000 ),
- LONG2CHARS( 0x01FFC00000000000 ),
- LONG2CHARS( 0x01FFE00000000000 ),
- LONG2CHARS( 0x01FFF00000000000 ),
- LONG2CHARS( 0x01FFF80000000000 ),
- LONG2CHARS( 0x01FFFC0000000000 ),
- LONG2CHARS( 0x01FFFE0000000000 ),
- LONG2CHARS( 0x01FFFF0000000000 ),
- LONG2CHARS( 0x01FFFF8000000000 ),
- LONG2CHARS( 0x01FFFFC000000000 ),
- LONG2CHARS( 0x01FFFFE000000000 ),
- LONG2CHARS( 0x01FFFFF000000000 ),
- LONG2CHARS( 0x01FFFFF800000000 ),
- LONG2CHARS( 0x01FFFFFC00000000 ),
- LONG2CHARS( 0x01FFFFFE00000000 ),
- LONG2CHARS( 0x01FFFFFF00000000 ),
- LONG2CHARS( 0x01FFFFFF80000000 ),
- LONG2CHARS( 0x01FFFFFFC0000000 ),
- LONG2CHARS( 0x01FFFFFFE0000000 ),
- LONG2CHARS( 0x01FFFFFFF0000000 ),
- LONG2CHARS( 0x01FFFFFFF8000000 ),
- LONG2CHARS( 0x01FFFFFFFC000000 ),
- LONG2CHARS( 0x01FFFFFFFE000000 ),
- LONG2CHARS( 0x01FFFFFFFF000000 ),
- LONG2CHARS( 0x01FFFFFFFF800000 ),
- LONG2CHARS( 0x01FFFFFFFFC00000 ),
- LONG2CHARS( 0x01FFFFFFFFE00000 ),
- LONG2CHARS( 0x01FFFFFFFFF00000 ),
- LONG2CHARS( 0x01FFFFFFFFF80000 ),
- LONG2CHARS( 0x01FFFFFFFFFC0000 ),
- LONG2CHARS( 0x01FFFFFFFFFE0000 ),
- LONG2CHARS( 0x01FFFFFFFFFF0000 ),
- LONG2CHARS( 0x01FFFFFFFFFF8000 ),
- LONG2CHARS( 0x01FFFFFFFFFFC000 ),
- LONG2CHARS( 0x01FFFFFFFFFFE000 ),
- LONG2CHARS( 0x01FFFFFFFFFFF000 ),
- LONG2CHARS( 0x01FFFFFFFFFFF800 ),
- LONG2CHARS( 0x01FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x01FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x01FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x01FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0080000000000000 ),
- LONG2CHARS( 0x00C0000000000000 ),
- LONG2CHARS( 0x00E0000000000000 ),
- LONG2CHARS( 0x00F0000000000000 ),
- LONG2CHARS( 0x00F8000000000000 ),
- LONG2CHARS( 0x00FC000000000000 ),
- LONG2CHARS( 0x00FE000000000000 ),
- LONG2CHARS( 0x00FF000000000000 ),
- LONG2CHARS( 0x00FF800000000000 ),
- LONG2CHARS( 0x00FFC00000000000 ),
- LONG2CHARS( 0x00FFE00000000000 ),
- LONG2CHARS( 0x00FFF00000000000 ),
- LONG2CHARS( 0x00FFF80000000000 ),
- LONG2CHARS( 0x00FFFC0000000000 ),
- LONG2CHARS( 0x00FFFE0000000000 ),
- LONG2CHARS( 0x00FFFF0000000000 ),
- LONG2CHARS( 0x00FFFF8000000000 ),
- LONG2CHARS( 0x00FFFFC000000000 ),
- LONG2CHARS( 0x00FFFFE000000000 ),
- LONG2CHARS( 0x00FFFFF000000000 ),
- LONG2CHARS( 0x00FFFFF800000000 ),
- LONG2CHARS( 0x00FFFFFC00000000 ),
- LONG2CHARS( 0x00FFFFFE00000000 ),
- LONG2CHARS( 0x00FFFFFF00000000 ),
- LONG2CHARS( 0x00FFFFFF80000000 ),
- LONG2CHARS( 0x00FFFFFFC0000000 ),
- LONG2CHARS( 0x00FFFFFFE0000000 ),
- LONG2CHARS( 0x00FFFFFFF0000000 ),
- LONG2CHARS( 0x00FFFFFFF8000000 ),
- LONG2CHARS( 0x00FFFFFFFC000000 ),
- LONG2CHARS( 0x00FFFFFFFE000000 ),
- LONG2CHARS( 0x00FFFFFFFF000000 ),
- LONG2CHARS( 0x00FFFFFFFF800000 ),
- LONG2CHARS( 0x00FFFFFFFFC00000 ),
- LONG2CHARS( 0x00FFFFFFFFE00000 ),
- LONG2CHARS( 0x00FFFFFFFFF00000 ),
- LONG2CHARS( 0x00FFFFFFFFF80000 ),
- LONG2CHARS( 0x00FFFFFFFFFC0000 ),
- LONG2CHARS( 0x00FFFFFFFFFE0000 ),
- LONG2CHARS( 0x00FFFFFFFFFF0000 ),
- LONG2CHARS( 0x00FFFFFFFFFF8000 ),
- LONG2CHARS( 0x00FFFFFFFFFFC000 ),
- LONG2CHARS( 0x00FFFFFFFFFFE000 ),
- LONG2CHARS( 0x00FFFFFFFFFFF000 ),
- LONG2CHARS( 0x00FFFFFFFFFFF800 ),
- LONG2CHARS( 0x00FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x00FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x00FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x00FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0040000000000000 ),
- LONG2CHARS( 0x0060000000000000 ),
- LONG2CHARS( 0x0070000000000000 ),
- LONG2CHARS( 0x0078000000000000 ),
- LONG2CHARS( 0x007C000000000000 ),
- LONG2CHARS( 0x007E000000000000 ),
- LONG2CHARS( 0x007F000000000000 ),
- LONG2CHARS( 0x007F800000000000 ),
- LONG2CHARS( 0x007FC00000000000 ),
- LONG2CHARS( 0x007FE00000000000 ),
- LONG2CHARS( 0x007FF00000000000 ),
- LONG2CHARS( 0x007FF80000000000 ),
- LONG2CHARS( 0x007FFC0000000000 ),
- LONG2CHARS( 0x007FFE0000000000 ),
- LONG2CHARS( 0x007FFF0000000000 ),
- LONG2CHARS( 0x007FFF8000000000 ),
- LONG2CHARS( 0x007FFFC000000000 ),
- LONG2CHARS( 0x007FFFE000000000 ),
- LONG2CHARS( 0x007FFFF000000000 ),
- LONG2CHARS( 0x007FFFF800000000 ),
- LONG2CHARS( 0x007FFFFC00000000 ),
- LONG2CHARS( 0x007FFFFE00000000 ),
- LONG2CHARS( 0x007FFFFF00000000 ),
- LONG2CHARS( 0x007FFFFF80000000 ),
- LONG2CHARS( 0x007FFFFFC0000000 ),
- LONG2CHARS( 0x007FFFFFE0000000 ),
- LONG2CHARS( 0x007FFFFFF0000000 ),
- LONG2CHARS( 0x007FFFFFF8000000 ),
- LONG2CHARS( 0x007FFFFFFC000000 ),
- LONG2CHARS( 0x007FFFFFFE000000 ),
- LONG2CHARS( 0x007FFFFFFF000000 ),
- LONG2CHARS( 0x007FFFFFFF800000 ),
- LONG2CHARS( 0x007FFFFFFFC00000 ),
- LONG2CHARS( 0x007FFFFFFFE00000 ),
- LONG2CHARS( 0x007FFFFFFFF00000 ),
- LONG2CHARS( 0x007FFFFFFFF80000 ),
- LONG2CHARS( 0x007FFFFFFFFC0000 ),
- LONG2CHARS( 0x007FFFFFFFFE0000 ),
- LONG2CHARS( 0x007FFFFFFFFF0000 ),
- LONG2CHARS( 0x007FFFFFFFFF8000 ),
- LONG2CHARS( 0x007FFFFFFFFFC000 ),
- LONG2CHARS( 0x007FFFFFFFFFE000 ),
- LONG2CHARS( 0x007FFFFFFFFFF000 ),
- LONG2CHARS( 0x007FFFFFFFFFF800 ),
- LONG2CHARS( 0x007FFFFFFFFFFC00 ),
- LONG2CHARS( 0x007FFFFFFFFFFE00 ),
- LONG2CHARS( 0x007FFFFFFFFFFF00 ),
- LONG2CHARS( 0x007FFFFFFFFFFF80 ),
- LONG2CHARS( 0x007FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x007FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x007FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x007FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x007FFFFFFFFFFFFC ),
- LONG2CHARS( 0x007FFFFFFFFFFFFE ),
- LONG2CHARS( 0x007FFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0020000000000000 ),
- LONG2CHARS( 0x0030000000000000 ),
- LONG2CHARS( 0x0038000000000000 ),
- LONG2CHARS( 0x003C000000000000 ),
- LONG2CHARS( 0x003E000000000000 ),
- LONG2CHARS( 0x003F000000000000 ),
- LONG2CHARS( 0x003F800000000000 ),
- LONG2CHARS( 0x003FC00000000000 ),
- LONG2CHARS( 0x003FE00000000000 ),
- LONG2CHARS( 0x003FF00000000000 ),
- LONG2CHARS( 0x003FF80000000000 ),
- LONG2CHARS( 0x003FFC0000000000 ),
- LONG2CHARS( 0x003FFE0000000000 ),
- LONG2CHARS( 0x003FFF0000000000 ),
- LONG2CHARS( 0x003FFF8000000000 ),
- LONG2CHARS( 0x003FFFC000000000 ),
- LONG2CHARS( 0x003FFFE000000000 ),
- LONG2CHARS( 0x003FFFF000000000 ),
- LONG2CHARS( 0x003FFFF800000000 ),
- LONG2CHARS( 0x003FFFFC00000000 ),
- LONG2CHARS( 0x003FFFFE00000000 ),
- LONG2CHARS( 0x003FFFFF00000000 ),
- LONG2CHARS( 0x003FFFFF80000000 ),
- LONG2CHARS( 0x003FFFFFC0000000 ),
- LONG2CHARS( 0x003FFFFFE0000000 ),
- LONG2CHARS( 0x003FFFFFF0000000 ),
- LONG2CHARS( 0x003FFFFFF8000000 ),
- LONG2CHARS( 0x003FFFFFFC000000 ),
- LONG2CHARS( 0x003FFFFFFE000000 ),
- LONG2CHARS( 0x003FFFFFFF000000 ),
- LONG2CHARS( 0x003FFFFFFF800000 ),
- LONG2CHARS( 0x003FFFFFFFC00000 ),
- LONG2CHARS( 0x003FFFFFFFE00000 ),
- LONG2CHARS( 0x003FFFFFFFF00000 ),
- LONG2CHARS( 0x003FFFFFFFF80000 ),
- LONG2CHARS( 0x003FFFFFFFFC0000 ),
- LONG2CHARS( 0x003FFFFFFFFE0000 ),
- LONG2CHARS( 0x003FFFFFFFFF0000 ),
- LONG2CHARS( 0x003FFFFFFFFF8000 ),
- LONG2CHARS( 0x003FFFFFFFFFC000 ),
- LONG2CHARS( 0x003FFFFFFFFFE000 ),
- LONG2CHARS( 0x003FFFFFFFFFF000 ),
- LONG2CHARS( 0x003FFFFFFFFFF800 ),
- LONG2CHARS( 0x003FFFFFFFFFFC00 ),
- LONG2CHARS( 0x003FFFFFFFFFFE00 ),
- LONG2CHARS( 0x003FFFFFFFFFFF00 ),
- LONG2CHARS( 0x003FFFFFFFFFFF80 ),
- LONG2CHARS( 0x003FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x003FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x003FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x003FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x003FFFFFFFFFFFFC ),
- LONG2CHARS( 0x003FFFFFFFFFFFFE ),
- LONG2CHARS( 0x003FFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0010000000000000 ),
- LONG2CHARS( 0x0018000000000000 ),
- LONG2CHARS( 0x001C000000000000 ),
- LONG2CHARS( 0x001E000000000000 ),
- LONG2CHARS( 0x001F000000000000 ),
- LONG2CHARS( 0x001F800000000000 ),
- LONG2CHARS( 0x001FC00000000000 ),
- LONG2CHARS( 0x001FE00000000000 ),
- LONG2CHARS( 0x001FF00000000000 ),
- LONG2CHARS( 0x001FF80000000000 ),
- LONG2CHARS( 0x001FFC0000000000 ),
- LONG2CHARS( 0x001FFE0000000000 ),
- LONG2CHARS( 0x001FFF0000000000 ),
- LONG2CHARS( 0x001FFF8000000000 ),
- LONG2CHARS( 0x001FFFC000000000 ),
- LONG2CHARS( 0x001FFFE000000000 ),
- LONG2CHARS( 0x001FFFF000000000 ),
- LONG2CHARS( 0x001FFFF800000000 ),
- LONG2CHARS( 0x001FFFFC00000000 ),
- LONG2CHARS( 0x001FFFFE00000000 ),
- LONG2CHARS( 0x001FFFFF00000000 ),
- LONG2CHARS( 0x001FFFFF80000000 ),
- LONG2CHARS( 0x001FFFFFC0000000 ),
- LONG2CHARS( 0x001FFFFFE0000000 ),
- LONG2CHARS( 0x001FFFFFF0000000 ),
- LONG2CHARS( 0x001FFFFFF8000000 ),
- LONG2CHARS( 0x001FFFFFFC000000 ),
- LONG2CHARS( 0x001FFFFFFE000000 ),
- LONG2CHARS( 0x001FFFFFFF000000 ),
- LONG2CHARS( 0x001FFFFFFF800000 ),
- LONG2CHARS( 0x001FFFFFFFC00000 ),
- LONG2CHARS( 0x001FFFFFFFE00000 ),
- LONG2CHARS( 0x001FFFFFFFF00000 ),
- LONG2CHARS( 0x001FFFFFFFF80000 ),
- LONG2CHARS( 0x001FFFFFFFFC0000 ),
- LONG2CHARS( 0x001FFFFFFFFE0000 ),
- LONG2CHARS( 0x001FFFFFFFFF0000 ),
- LONG2CHARS( 0x001FFFFFFFFF8000 ),
- LONG2CHARS( 0x001FFFFFFFFFC000 ),
- LONG2CHARS( 0x001FFFFFFFFFE000 ),
- LONG2CHARS( 0x001FFFFFFFFFF000 ),
- LONG2CHARS( 0x001FFFFFFFFFF800 ),
- LONG2CHARS( 0x001FFFFFFFFFFC00 ),
- LONG2CHARS( 0x001FFFFFFFFFFE00 ),
- LONG2CHARS( 0x001FFFFFFFFFFF00 ),
- LONG2CHARS( 0x001FFFFFFFFFFF80 ),
- LONG2CHARS( 0x001FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x001FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x001FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x001FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x001FFFFFFFFFFFFC ),
- LONG2CHARS( 0x001FFFFFFFFFFFFE ),
- LONG2CHARS( 0x001FFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0008000000000000 ),
- LONG2CHARS( 0x000C000000000000 ),
- LONG2CHARS( 0x000E000000000000 ),
- LONG2CHARS( 0x000F000000000000 ),
- LONG2CHARS( 0x000F800000000000 ),
- LONG2CHARS( 0x000FC00000000000 ),
- LONG2CHARS( 0x000FE00000000000 ),
- LONG2CHARS( 0x000FF00000000000 ),
- LONG2CHARS( 0x000FF80000000000 ),
- LONG2CHARS( 0x000FFC0000000000 ),
- LONG2CHARS( 0x000FFE0000000000 ),
- LONG2CHARS( 0x000FFF0000000000 ),
- LONG2CHARS( 0x000FFF8000000000 ),
- LONG2CHARS( 0x000FFFC000000000 ),
- LONG2CHARS( 0x000FFFE000000000 ),
- LONG2CHARS( 0x000FFFF000000000 ),
- LONG2CHARS( 0x000FFFF800000000 ),
- LONG2CHARS( 0x000FFFFC00000000 ),
- LONG2CHARS( 0x000FFFFE00000000 ),
- LONG2CHARS( 0x000FFFFF00000000 ),
- LONG2CHARS( 0x000FFFFF80000000 ),
- LONG2CHARS( 0x000FFFFFC0000000 ),
- LONG2CHARS( 0x000FFFFFE0000000 ),
- LONG2CHARS( 0x000FFFFFF0000000 ),
- LONG2CHARS( 0x000FFFFFF8000000 ),
- LONG2CHARS( 0x000FFFFFFC000000 ),
- LONG2CHARS( 0x000FFFFFFE000000 ),
- LONG2CHARS( 0x000FFFFFFF000000 ),
- LONG2CHARS( 0x000FFFFFFF800000 ),
- LONG2CHARS( 0x000FFFFFFFC00000 ),
- LONG2CHARS( 0x000FFFFFFFE00000 ),
- LONG2CHARS( 0x000FFFFFFFF00000 ),
- LONG2CHARS( 0x000FFFFFFFF80000 ),
- LONG2CHARS( 0x000FFFFFFFFC0000 ),
- LONG2CHARS( 0x000FFFFFFFFE0000 ),
- LONG2CHARS( 0x000FFFFFFFFF0000 ),
- LONG2CHARS( 0x000FFFFFFFFF8000 ),
- LONG2CHARS( 0x000FFFFFFFFFC000 ),
- LONG2CHARS( 0x000FFFFFFFFFE000 ),
- LONG2CHARS( 0x000FFFFFFFFFF000 ),
- LONG2CHARS( 0x000FFFFFFFFFF800 ),
- LONG2CHARS( 0x000FFFFFFFFFFC00 ),
- LONG2CHARS( 0x000FFFFFFFFFFE00 ),
- LONG2CHARS( 0x000FFFFFFFFFFF00 ),
- LONG2CHARS( 0x000FFFFFFFFFFF80 ),
- LONG2CHARS( 0x000FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x000FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x000FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x000FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x000FFFFFFFFFFFFC ),
- LONG2CHARS( 0x000FFFFFFFFFFFFE ),
- LONG2CHARS( 0x000FFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0004000000000000 ),
- LONG2CHARS( 0x0006000000000000 ),
- LONG2CHARS( 0x0007000000000000 ),
- LONG2CHARS( 0x0007800000000000 ),
- LONG2CHARS( 0x0007C00000000000 ),
- LONG2CHARS( 0x0007E00000000000 ),
- LONG2CHARS( 0x0007F00000000000 ),
- LONG2CHARS( 0x0007F80000000000 ),
- LONG2CHARS( 0x0007FC0000000000 ),
- LONG2CHARS( 0x0007FE0000000000 ),
- LONG2CHARS( 0x0007FF0000000000 ),
- LONG2CHARS( 0x0007FF8000000000 ),
- LONG2CHARS( 0x0007FFC000000000 ),
- LONG2CHARS( 0x0007FFE000000000 ),
- LONG2CHARS( 0x0007FFF000000000 ),
- LONG2CHARS( 0x0007FFF800000000 ),
- LONG2CHARS( 0x0007FFFC00000000 ),
- LONG2CHARS( 0x0007FFFE00000000 ),
- LONG2CHARS( 0x0007FFFF00000000 ),
- LONG2CHARS( 0x0007FFFF80000000 ),
- LONG2CHARS( 0x0007FFFFC0000000 ),
- LONG2CHARS( 0x0007FFFFE0000000 ),
- LONG2CHARS( 0x0007FFFFF0000000 ),
- LONG2CHARS( 0x0007FFFFF8000000 ),
- LONG2CHARS( 0x0007FFFFFC000000 ),
- LONG2CHARS( 0x0007FFFFFE000000 ),
- LONG2CHARS( 0x0007FFFFFF000000 ),
- LONG2CHARS( 0x0007FFFFFF800000 ),
- LONG2CHARS( 0x0007FFFFFFC00000 ),
- LONG2CHARS( 0x0007FFFFFFE00000 ),
- LONG2CHARS( 0x0007FFFFFFF00000 ),
- LONG2CHARS( 0x0007FFFFFFF80000 ),
- LONG2CHARS( 0x0007FFFFFFFC0000 ),
- LONG2CHARS( 0x0007FFFFFFFE0000 ),
- LONG2CHARS( 0x0007FFFFFFFF0000 ),
- LONG2CHARS( 0x0007FFFFFFFF8000 ),
- LONG2CHARS( 0x0007FFFFFFFFC000 ),
- LONG2CHARS( 0x0007FFFFFFFFE000 ),
- LONG2CHARS( 0x0007FFFFFFFFF000 ),
- LONG2CHARS( 0x0007FFFFFFFFF800 ),
- LONG2CHARS( 0x0007FFFFFFFFFC00 ),
- LONG2CHARS( 0x0007FFFFFFFFFE00 ),
- LONG2CHARS( 0x0007FFFFFFFFFF00 ),
- LONG2CHARS( 0x0007FFFFFFFFFF80 ),
- LONG2CHARS( 0x0007FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0007FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0007FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0007FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0007FFFFFFFFFFFC ),
- LONG2CHARS( 0x0007FFFFFFFFFFFE ),
- LONG2CHARS( 0x0007FFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0002000000000000 ),
- LONG2CHARS( 0x0003000000000000 ),
- LONG2CHARS( 0x0003800000000000 ),
- LONG2CHARS( 0x0003C00000000000 ),
- LONG2CHARS( 0x0003E00000000000 ),
- LONG2CHARS( 0x0003F00000000000 ),
- LONG2CHARS( 0x0003F80000000000 ),
- LONG2CHARS( 0x0003FC0000000000 ),
- LONG2CHARS( 0x0003FE0000000000 ),
- LONG2CHARS( 0x0003FF0000000000 ),
- LONG2CHARS( 0x0003FF8000000000 ),
- LONG2CHARS( 0x0003FFC000000000 ),
- LONG2CHARS( 0x0003FFE000000000 ),
- LONG2CHARS( 0x0003FFF000000000 ),
- LONG2CHARS( 0x0003FFF800000000 ),
- LONG2CHARS( 0x0003FFFC00000000 ),
- LONG2CHARS( 0x0003FFFE00000000 ),
- LONG2CHARS( 0x0003FFFF00000000 ),
- LONG2CHARS( 0x0003FFFF80000000 ),
- LONG2CHARS( 0x0003FFFFC0000000 ),
- LONG2CHARS( 0x0003FFFFE0000000 ),
- LONG2CHARS( 0x0003FFFFF0000000 ),
- LONG2CHARS( 0x0003FFFFF8000000 ),
- LONG2CHARS( 0x0003FFFFFC000000 ),
- LONG2CHARS( 0x0003FFFFFE000000 ),
- LONG2CHARS( 0x0003FFFFFF000000 ),
- LONG2CHARS( 0x0003FFFFFF800000 ),
- LONG2CHARS( 0x0003FFFFFFC00000 ),
- LONG2CHARS( 0x0003FFFFFFE00000 ),
- LONG2CHARS( 0x0003FFFFFFF00000 ),
- LONG2CHARS( 0x0003FFFFFFF80000 ),
- LONG2CHARS( 0x0003FFFFFFFC0000 ),
- LONG2CHARS( 0x0003FFFFFFFE0000 ),
- LONG2CHARS( 0x0003FFFFFFFF0000 ),
- LONG2CHARS( 0x0003FFFFFFFF8000 ),
- LONG2CHARS( 0x0003FFFFFFFFC000 ),
- LONG2CHARS( 0x0003FFFFFFFFE000 ),
- LONG2CHARS( 0x0003FFFFFFFFF000 ),
- LONG2CHARS( 0x0003FFFFFFFFF800 ),
- LONG2CHARS( 0x0003FFFFFFFFFC00 ),
- LONG2CHARS( 0x0003FFFFFFFFFE00 ),
- LONG2CHARS( 0x0003FFFFFFFFFF00 ),
- LONG2CHARS( 0x0003FFFFFFFFFF80 ),
- LONG2CHARS( 0x0003FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0003FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0003FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0003FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0003FFFFFFFFFFFC ),
- LONG2CHARS( 0x0003FFFFFFFFFFFE ),
- LONG2CHARS( 0x0003FFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0001000000000000 ),
- LONG2CHARS( 0x0001800000000000 ),
- LONG2CHARS( 0x0001C00000000000 ),
- LONG2CHARS( 0x0001E00000000000 ),
- LONG2CHARS( 0x0001F00000000000 ),
- LONG2CHARS( 0x0001F80000000000 ),
- LONG2CHARS( 0x0001FC0000000000 ),
- LONG2CHARS( 0x0001FE0000000000 ),
- LONG2CHARS( 0x0001FF0000000000 ),
- LONG2CHARS( 0x0001FF8000000000 ),
- LONG2CHARS( 0x0001FFC000000000 ),
- LONG2CHARS( 0x0001FFE000000000 ),
- LONG2CHARS( 0x0001FFF000000000 ),
- LONG2CHARS( 0x0001FFF800000000 ),
- LONG2CHARS( 0x0001FFFC00000000 ),
- LONG2CHARS( 0x0001FFFE00000000 ),
- LONG2CHARS( 0x0001FFFF00000000 ),
- LONG2CHARS( 0x0001FFFF80000000 ),
- LONG2CHARS( 0x0001FFFFC0000000 ),
- LONG2CHARS( 0x0001FFFFE0000000 ),
- LONG2CHARS( 0x0001FFFFF0000000 ),
- LONG2CHARS( 0x0001FFFFF8000000 ),
- LONG2CHARS( 0x0001FFFFFC000000 ),
- LONG2CHARS( 0x0001FFFFFE000000 ),
- LONG2CHARS( 0x0001FFFFFF000000 ),
- LONG2CHARS( 0x0001FFFFFF800000 ),
- LONG2CHARS( 0x0001FFFFFFC00000 ),
- LONG2CHARS( 0x0001FFFFFFE00000 ),
- LONG2CHARS( 0x0001FFFFFFF00000 ),
- LONG2CHARS( 0x0001FFFFFFF80000 ),
- LONG2CHARS( 0x0001FFFFFFFC0000 ),
- LONG2CHARS( 0x0001FFFFFFFE0000 ),
- LONG2CHARS( 0x0001FFFFFFFF0000 ),
- LONG2CHARS( 0x0001FFFFFFFF8000 ),
- LONG2CHARS( 0x0001FFFFFFFFC000 ),
- LONG2CHARS( 0x0001FFFFFFFFE000 ),
- LONG2CHARS( 0x0001FFFFFFFFF000 ),
- LONG2CHARS( 0x0001FFFFFFFFF800 ),
- LONG2CHARS( 0x0001FFFFFFFFFC00 ),
- LONG2CHARS( 0x0001FFFFFFFFFE00 ),
- LONG2CHARS( 0x0001FFFFFFFFFF00 ),
- LONG2CHARS( 0x0001FFFFFFFFFF80 ),
- LONG2CHARS( 0x0001FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0001FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0001FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0001FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0001FFFFFFFFFFFC ),
- LONG2CHARS( 0x0001FFFFFFFFFFFE ),
- LONG2CHARS( 0x0001FFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000800000000000 ),
- LONG2CHARS( 0x0000C00000000000 ),
- LONG2CHARS( 0x0000E00000000000 ),
- LONG2CHARS( 0x0000F00000000000 ),
- LONG2CHARS( 0x0000F80000000000 ),
- LONG2CHARS( 0x0000FC0000000000 ),
- LONG2CHARS( 0x0000FE0000000000 ),
- LONG2CHARS( 0x0000FF0000000000 ),
- LONG2CHARS( 0x0000FF8000000000 ),
- LONG2CHARS( 0x0000FFC000000000 ),
- LONG2CHARS( 0x0000FFE000000000 ),
- LONG2CHARS( 0x0000FFF000000000 ),
- LONG2CHARS( 0x0000FFF800000000 ),
- LONG2CHARS( 0x0000FFFC00000000 ),
- LONG2CHARS( 0x0000FFFE00000000 ),
- LONG2CHARS( 0x0000FFFF00000000 ),
- LONG2CHARS( 0x0000FFFF80000000 ),
- LONG2CHARS( 0x0000FFFFC0000000 ),
- LONG2CHARS( 0x0000FFFFE0000000 ),
- LONG2CHARS( 0x0000FFFFF0000000 ),
- LONG2CHARS( 0x0000FFFFF8000000 ),
- LONG2CHARS( 0x0000FFFFFC000000 ),
- LONG2CHARS( 0x0000FFFFFE000000 ),
- LONG2CHARS( 0x0000FFFFFF000000 ),
- LONG2CHARS( 0x0000FFFFFF800000 ),
- LONG2CHARS( 0x0000FFFFFFC00000 ),
- LONG2CHARS( 0x0000FFFFFFE00000 ),
- LONG2CHARS( 0x0000FFFFFFF00000 ),
- LONG2CHARS( 0x0000FFFFFFF80000 ),
- LONG2CHARS( 0x0000FFFFFFFC0000 ),
- LONG2CHARS( 0x0000FFFFFFFE0000 ),
- LONG2CHARS( 0x0000FFFFFFFF0000 ),
- LONG2CHARS( 0x0000FFFFFFFF8000 ),
- LONG2CHARS( 0x0000FFFFFFFFC000 ),
- LONG2CHARS( 0x0000FFFFFFFFE000 ),
- LONG2CHARS( 0x0000FFFFFFFFF000 ),
- LONG2CHARS( 0x0000FFFFFFFFF800 ),
- LONG2CHARS( 0x0000FFFFFFFFFC00 ),
- LONG2CHARS( 0x0000FFFFFFFFFE00 ),
- LONG2CHARS( 0x0000FFFFFFFFFF00 ),
- LONG2CHARS( 0x0000FFFFFFFFFF80 ),
- LONG2CHARS( 0x0000FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0000FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0000FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0000FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0000FFFFFFFFFFFC ),
- LONG2CHARS( 0x0000FFFFFFFFFFFE ),
- LONG2CHARS( 0x0000FFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000400000000000 ),
- LONG2CHARS( 0x0000600000000000 ),
- LONG2CHARS( 0x0000700000000000 ),
- LONG2CHARS( 0x0000780000000000 ),
- LONG2CHARS( 0x00007C0000000000 ),
- LONG2CHARS( 0x00007E0000000000 ),
- LONG2CHARS( 0x00007F0000000000 ),
- LONG2CHARS( 0x00007F8000000000 ),
- LONG2CHARS( 0x00007FC000000000 ),
- LONG2CHARS( 0x00007FE000000000 ),
- LONG2CHARS( 0x00007FF000000000 ),
- LONG2CHARS( 0x00007FF800000000 ),
- LONG2CHARS( 0x00007FFC00000000 ),
- LONG2CHARS( 0x00007FFE00000000 ),
- LONG2CHARS( 0x00007FFF00000000 ),
- LONG2CHARS( 0x00007FFF80000000 ),
- LONG2CHARS( 0x00007FFFC0000000 ),
- LONG2CHARS( 0x00007FFFE0000000 ),
- LONG2CHARS( 0x00007FFFF0000000 ),
- LONG2CHARS( 0x00007FFFF8000000 ),
- LONG2CHARS( 0x00007FFFFC000000 ),
- LONG2CHARS( 0x00007FFFFE000000 ),
- LONG2CHARS( 0x00007FFFFF000000 ),
- LONG2CHARS( 0x00007FFFFF800000 ),
- LONG2CHARS( 0x00007FFFFFC00000 ),
- LONG2CHARS( 0x00007FFFFFE00000 ),
- LONG2CHARS( 0x00007FFFFFF00000 ),
- LONG2CHARS( 0x00007FFFFFF80000 ),
- LONG2CHARS( 0x00007FFFFFFC0000 ),
- LONG2CHARS( 0x00007FFFFFFE0000 ),
- LONG2CHARS( 0x00007FFFFFFF0000 ),
- LONG2CHARS( 0x00007FFFFFFF8000 ),
- LONG2CHARS( 0x00007FFFFFFFC000 ),
- LONG2CHARS( 0x00007FFFFFFFE000 ),
- LONG2CHARS( 0x00007FFFFFFFF000 ),
- LONG2CHARS( 0x00007FFFFFFFF800 ),
- LONG2CHARS( 0x00007FFFFFFFFC00 ),
- LONG2CHARS( 0x00007FFFFFFFFE00 ),
- LONG2CHARS( 0x00007FFFFFFFFF00 ),
- LONG2CHARS( 0x00007FFFFFFFFF80 ),
- LONG2CHARS( 0x00007FFFFFFFFFC0 ),
- LONG2CHARS( 0x00007FFFFFFFFFE0 ),
- LONG2CHARS( 0x00007FFFFFFFFFF0 ),
- LONG2CHARS( 0x00007FFFFFFFFFF8 ),
- LONG2CHARS( 0x00007FFFFFFFFFFC ),
- LONG2CHARS( 0x00007FFFFFFFFFFE ),
- LONG2CHARS( 0x00007FFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000200000000000 ),
- LONG2CHARS( 0x0000300000000000 ),
- LONG2CHARS( 0x0000380000000000 ),
- LONG2CHARS( 0x00003C0000000000 ),
- LONG2CHARS( 0x00003E0000000000 ),
- LONG2CHARS( 0x00003F0000000000 ),
- LONG2CHARS( 0x00003F8000000000 ),
- LONG2CHARS( 0x00003FC000000000 ),
- LONG2CHARS( 0x00003FE000000000 ),
- LONG2CHARS( 0x00003FF000000000 ),
- LONG2CHARS( 0x00003FF800000000 ),
- LONG2CHARS( 0x00003FFC00000000 ),
- LONG2CHARS( 0x00003FFE00000000 ),
- LONG2CHARS( 0x00003FFF00000000 ),
- LONG2CHARS( 0x00003FFF80000000 ),
- LONG2CHARS( 0x00003FFFC0000000 ),
- LONG2CHARS( 0x00003FFFE0000000 ),
- LONG2CHARS( 0x00003FFFF0000000 ),
- LONG2CHARS( 0x00003FFFF8000000 ),
- LONG2CHARS( 0x00003FFFFC000000 ),
- LONG2CHARS( 0x00003FFFFE000000 ),
- LONG2CHARS( 0x00003FFFFF000000 ),
- LONG2CHARS( 0x00003FFFFF800000 ),
- LONG2CHARS( 0x00003FFFFFC00000 ),
- LONG2CHARS( 0x00003FFFFFE00000 ),
- LONG2CHARS( 0x00003FFFFFF00000 ),
- LONG2CHARS( 0x00003FFFFFF80000 ),
- LONG2CHARS( 0x00003FFFFFFC0000 ),
- LONG2CHARS( 0x00003FFFFFFE0000 ),
- LONG2CHARS( 0x00003FFFFFFF0000 ),
- LONG2CHARS( 0x00003FFFFFFF8000 ),
- LONG2CHARS( 0x00003FFFFFFFC000 ),
- LONG2CHARS( 0x00003FFFFFFFE000 ),
- LONG2CHARS( 0x00003FFFFFFFF000 ),
- LONG2CHARS( 0x00003FFFFFFFF800 ),
- LONG2CHARS( 0x00003FFFFFFFFC00 ),
- LONG2CHARS( 0x00003FFFFFFFFE00 ),
- LONG2CHARS( 0x00003FFFFFFFFF00 ),
- LONG2CHARS( 0x00003FFFFFFFFF80 ),
- LONG2CHARS( 0x00003FFFFFFFFFC0 ),
- LONG2CHARS( 0x00003FFFFFFFFFE0 ),
- LONG2CHARS( 0x00003FFFFFFFFFF0 ),
- LONG2CHARS( 0x00003FFFFFFFFFF8 ),
- LONG2CHARS( 0x00003FFFFFFFFFFC ),
- LONG2CHARS( 0x00003FFFFFFFFFFE ),
- LONG2CHARS( 0x00003FFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000100000000000 ),
- LONG2CHARS( 0x0000180000000000 ),
- LONG2CHARS( 0x00001C0000000000 ),
- LONG2CHARS( 0x00001E0000000000 ),
- LONG2CHARS( 0x00001F0000000000 ),
- LONG2CHARS( 0x00001F8000000000 ),
- LONG2CHARS( 0x00001FC000000000 ),
- LONG2CHARS( 0x00001FE000000000 ),
- LONG2CHARS( 0x00001FF000000000 ),
- LONG2CHARS( 0x00001FF800000000 ),
- LONG2CHARS( 0x00001FFC00000000 ),
- LONG2CHARS( 0x00001FFE00000000 ),
- LONG2CHARS( 0x00001FFF00000000 ),
- LONG2CHARS( 0x00001FFF80000000 ),
- LONG2CHARS( 0x00001FFFC0000000 ),
- LONG2CHARS( 0x00001FFFE0000000 ),
- LONG2CHARS( 0x00001FFFF0000000 ),
- LONG2CHARS( 0x00001FFFF8000000 ),
- LONG2CHARS( 0x00001FFFFC000000 ),
- LONG2CHARS( 0x00001FFFFE000000 ),
- LONG2CHARS( 0x00001FFFFF000000 ),
- LONG2CHARS( 0x00001FFFFF800000 ),
- LONG2CHARS( 0x00001FFFFFC00000 ),
- LONG2CHARS( 0x00001FFFFFE00000 ),
- LONG2CHARS( 0x00001FFFFFF00000 ),
- LONG2CHARS( 0x00001FFFFFF80000 ),
- LONG2CHARS( 0x00001FFFFFFC0000 ),
- LONG2CHARS( 0x00001FFFFFFE0000 ),
- LONG2CHARS( 0x00001FFFFFFF0000 ),
- LONG2CHARS( 0x00001FFFFFFF8000 ),
- LONG2CHARS( 0x00001FFFFFFFC000 ),
- LONG2CHARS( 0x00001FFFFFFFE000 ),
- LONG2CHARS( 0x00001FFFFFFFF000 ),
- LONG2CHARS( 0x00001FFFFFFFF800 ),
- LONG2CHARS( 0x00001FFFFFFFFC00 ),
- LONG2CHARS( 0x00001FFFFFFFFE00 ),
- LONG2CHARS( 0x00001FFFFFFFFF00 ),
- LONG2CHARS( 0x00001FFFFFFFFF80 ),
- LONG2CHARS( 0x00001FFFFFFFFFC0 ),
- LONG2CHARS( 0x00001FFFFFFFFFE0 ),
- LONG2CHARS( 0x00001FFFFFFFFFF0 ),
- LONG2CHARS( 0x00001FFFFFFFFFF8 ),
- LONG2CHARS( 0x00001FFFFFFFFFFC ),
- LONG2CHARS( 0x00001FFFFFFFFFFE ),
- LONG2CHARS( 0x00001FFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000080000000000 ),
- LONG2CHARS( 0x00000C0000000000 ),
- LONG2CHARS( 0x00000E0000000000 ),
- LONG2CHARS( 0x00000F0000000000 ),
- LONG2CHARS( 0x00000F8000000000 ),
- LONG2CHARS( 0x00000FC000000000 ),
- LONG2CHARS( 0x00000FE000000000 ),
- LONG2CHARS( 0x00000FF000000000 ),
- LONG2CHARS( 0x00000FF800000000 ),
- LONG2CHARS( 0x00000FFC00000000 ),
- LONG2CHARS( 0x00000FFE00000000 ),
- LONG2CHARS( 0x00000FFF00000000 ),
- LONG2CHARS( 0x00000FFF80000000 ),
- LONG2CHARS( 0x00000FFFC0000000 ),
- LONG2CHARS( 0x00000FFFE0000000 ),
- LONG2CHARS( 0x00000FFFF0000000 ),
- LONG2CHARS( 0x00000FFFF8000000 ),
- LONG2CHARS( 0x00000FFFFC000000 ),
- LONG2CHARS( 0x00000FFFFE000000 ),
- LONG2CHARS( 0x00000FFFFF000000 ),
- LONG2CHARS( 0x00000FFFFF800000 ),
- LONG2CHARS( 0x00000FFFFFC00000 ),
- LONG2CHARS( 0x00000FFFFFE00000 ),
- LONG2CHARS( 0x00000FFFFFF00000 ),
- LONG2CHARS( 0x00000FFFFFF80000 ),
- LONG2CHARS( 0x00000FFFFFFC0000 ),
- LONG2CHARS( 0x00000FFFFFFE0000 ),
- LONG2CHARS( 0x00000FFFFFFF0000 ),
- LONG2CHARS( 0x00000FFFFFFF8000 ),
- LONG2CHARS( 0x00000FFFFFFFC000 ),
- LONG2CHARS( 0x00000FFFFFFFE000 ),
- LONG2CHARS( 0x00000FFFFFFFF000 ),
- LONG2CHARS( 0x00000FFFFFFFF800 ),
- LONG2CHARS( 0x00000FFFFFFFFC00 ),
- LONG2CHARS( 0x00000FFFFFFFFE00 ),
- LONG2CHARS( 0x00000FFFFFFFFF00 ),
- LONG2CHARS( 0x00000FFFFFFFFF80 ),
- LONG2CHARS( 0x00000FFFFFFFFFC0 ),
- LONG2CHARS( 0x00000FFFFFFFFFE0 ),
- LONG2CHARS( 0x00000FFFFFFFFFF0 ),
- LONG2CHARS( 0x00000FFFFFFFFFF8 ),
- LONG2CHARS( 0x00000FFFFFFFFFFC ),
- LONG2CHARS( 0x00000FFFFFFFFFFE ),
- LONG2CHARS( 0x00000FFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000040000000000 ),
- LONG2CHARS( 0x0000060000000000 ),
- LONG2CHARS( 0x0000070000000000 ),
- LONG2CHARS( 0x0000078000000000 ),
- LONG2CHARS( 0x000007C000000000 ),
- LONG2CHARS( 0x000007E000000000 ),
- LONG2CHARS( 0x000007F000000000 ),
- LONG2CHARS( 0x000007F800000000 ),
- LONG2CHARS( 0x000007FC00000000 ),
- LONG2CHARS( 0x000007FE00000000 ),
- LONG2CHARS( 0x000007FF00000000 ),
- LONG2CHARS( 0x000007FF80000000 ),
- LONG2CHARS( 0x000007FFC0000000 ),
- LONG2CHARS( 0x000007FFE0000000 ),
- LONG2CHARS( 0x000007FFF0000000 ),
- LONG2CHARS( 0x000007FFF8000000 ),
- LONG2CHARS( 0x000007FFFC000000 ),
- LONG2CHARS( 0x000007FFFE000000 ),
- LONG2CHARS( 0x000007FFFF000000 ),
- LONG2CHARS( 0x000007FFFF800000 ),
- LONG2CHARS( 0x000007FFFFC00000 ),
- LONG2CHARS( 0x000007FFFFE00000 ),
- LONG2CHARS( 0x000007FFFFF00000 ),
- LONG2CHARS( 0x000007FFFFF80000 ),
- LONG2CHARS( 0x000007FFFFFC0000 ),
- LONG2CHARS( 0x000007FFFFFE0000 ),
- LONG2CHARS( 0x000007FFFFFF0000 ),
- LONG2CHARS( 0x000007FFFFFF8000 ),
- LONG2CHARS( 0x000007FFFFFFC000 ),
- LONG2CHARS( 0x000007FFFFFFE000 ),
- LONG2CHARS( 0x000007FFFFFFF000 ),
- LONG2CHARS( 0x000007FFFFFFF800 ),
- LONG2CHARS( 0x000007FFFFFFFC00 ),
- LONG2CHARS( 0x000007FFFFFFFE00 ),
- LONG2CHARS( 0x000007FFFFFFFF00 ),
- LONG2CHARS( 0x000007FFFFFFFF80 ),
- LONG2CHARS( 0x000007FFFFFFFFC0 ),
- LONG2CHARS( 0x000007FFFFFFFFE0 ),
- LONG2CHARS( 0x000007FFFFFFFFF0 ),
- LONG2CHARS( 0x000007FFFFFFFFF8 ),
- LONG2CHARS( 0x000007FFFFFFFFFC ),
- LONG2CHARS( 0x000007FFFFFFFFFE ),
- LONG2CHARS( 0x000007FFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000020000000000 ),
- LONG2CHARS( 0x0000030000000000 ),
- LONG2CHARS( 0x0000038000000000 ),
- LONG2CHARS( 0x000003C000000000 ),
- LONG2CHARS( 0x000003E000000000 ),
- LONG2CHARS( 0x000003F000000000 ),
- LONG2CHARS( 0x000003F800000000 ),
- LONG2CHARS( 0x000003FC00000000 ),
- LONG2CHARS( 0x000003FE00000000 ),
- LONG2CHARS( 0x000003FF00000000 ),
- LONG2CHARS( 0x000003FF80000000 ),
- LONG2CHARS( 0x000003FFC0000000 ),
- LONG2CHARS( 0x000003FFE0000000 ),
- LONG2CHARS( 0x000003FFF0000000 ),
- LONG2CHARS( 0x000003FFF8000000 ),
- LONG2CHARS( 0x000003FFFC000000 ),
- LONG2CHARS( 0x000003FFFE000000 ),
- LONG2CHARS( 0x000003FFFF000000 ),
- LONG2CHARS( 0x000003FFFF800000 ),
- LONG2CHARS( 0x000003FFFFC00000 ),
- LONG2CHARS( 0x000003FFFFE00000 ),
- LONG2CHARS( 0x000003FFFFF00000 ),
- LONG2CHARS( 0x000003FFFFF80000 ),
- LONG2CHARS( 0x000003FFFFFC0000 ),
- LONG2CHARS( 0x000003FFFFFE0000 ),
- LONG2CHARS( 0x000003FFFFFF0000 ),
- LONG2CHARS( 0x000003FFFFFF8000 ),
- LONG2CHARS( 0x000003FFFFFFC000 ),
- LONG2CHARS( 0x000003FFFFFFE000 ),
- LONG2CHARS( 0x000003FFFFFFF000 ),
- LONG2CHARS( 0x000003FFFFFFF800 ),
- LONG2CHARS( 0x000003FFFFFFFC00 ),
- LONG2CHARS( 0x000003FFFFFFFE00 ),
- LONG2CHARS( 0x000003FFFFFFFF00 ),
- LONG2CHARS( 0x000003FFFFFFFF80 ),
- LONG2CHARS( 0x000003FFFFFFFFC0 ),
- LONG2CHARS( 0x000003FFFFFFFFE0 ),
- LONG2CHARS( 0x000003FFFFFFFFF0 ),
- LONG2CHARS( 0x000003FFFFFFFFF8 ),
- LONG2CHARS( 0x000003FFFFFFFFFC ),
- LONG2CHARS( 0x000003FFFFFFFFFE ),
- LONG2CHARS( 0x000003FFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000010000000000 ),
- LONG2CHARS( 0x0000018000000000 ),
- LONG2CHARS( 0x000001C000000000 ),
- LONG2CHARS( 0x000001E000000000 ),
- LONG2CHARS( 0x000001F000000000 ),
- LONG2CHARS( 0x000001F800000000 ),
- LONG2CHARS( 0x000001FC00000000 ),
- LONG2CHARS( 0x000001FE00000000 ),
- LONG2CHARS( 0x000001FF00000000 ),
- LONG2CHARS( 0x000001FF80000000 ),
- LONG2CHARS( 0x000001FFC0000000 ),
- LONG2CHARS( 0x000001FFE0000000 ),
- LONG2CHARS( 0x000001FFF0000000 ),
- LONG2CHARS( 0x000001FFF8000000 ),
- LONG2CHARS( 0x000001FFFC000000 ),
- LONG2CHARS( 0x000001FFFE000000 ),
- LONG2CHARS( 0x000001FFFF000000 ),
- LONG2CHARS( 0x000001FFFF800000 ),
- LONG2CHARS( 0x000001FFFFC00000 ),
- LONG2CHARS( 0x000001FFFFE00000 ),
- LONG2CHARS( 0x000001FFFFF00000 ),
- LONG2CHARS( 0x000001FFFFF80000 ),
- LONG2CHARS( 0x000001FFFFFC0000 ),
- LONG2CHARS( 0x000001FFFFFE0000 ),
- LONG2CHARS( 0x000001FFFFFF0000 ),
- LONG2CHARS( 0x000001FFFFFF8000 ),
- LONG2CHARS( 0x000001FFFFFFC000 ),
- LONG2CHARS( 0x000001FFFFFFE000 ),
- LONG2CHARS( 0x000001FFFFFFF000 ),
- LONG2CHARS( 0x000001FFFFFFF800 ),
- LONG2CHARS( 0x000001FFFFFFFC00 ),
- LONG2CHARS( 0x000001FFFFFFFE00 ),
- LONG2CHARS( 0x000001FFFFFFFF00 ),
- LONG2CHARS( 0x000001FFFFFFFF80 ),
- LONG2CHARS( 0x000001FFFFFFFFC0 ),
- LONG2CHARS( 0x000001FFFFFFFFE0 ),
- LONG2CHARS( 0x000001FFFFFFFFF0 ),
- LONG2CHARS( 0x000001FFFFFFFFF8 ),
- LONG2CHARS( 0x000001FFFFFFFFFC ),
- LONG2CHARS( 0x000001FFFFFFFFFE ),
- LONG2CHARS( 0x000001FFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000008000000000 ),
- LONG2CHARS( 0x000000C000000000 ),
- LONG2CHARS( 0x000000E000000000 ),
- LONG2CHARS( 0x000000F000000000 ),
- LONG2CHARS( 0x000000F800000000 ),
- LONG2CHARS( 0x000000FC00000000 ),
- LONG2CHARS( 0x000000FE00000000 ),
- LONG2CHARS( 0x000000FF00000000 ),
- LONG2CHARS( 0x000000FF80000000 ),
- LONG2CHARS( 0x000000FFC0000000 ),
- LONG2CHARS( 0x000000FFE0000000 ),
- LONG2CHARS( 0x000000FFF0000000 ),
- LONG2CHARS( 0x000000FFF8000000 ),
- LONG2CHARS( 0x000000FFFC000000 ),
- LONG2CHARS( 0x000000FFFE000000 ),
- LONG2CHARS( 0x000000FFFF000000 ),
- LONG2CHARS( 0x000000FFFF800000 ),
- LONG2CHARS( 0x000000FFFFC00000 ),
- LONG2CHARS( 0x000000FFFFE00000 ),
- LONG2CHARS( 0x000000FFFFF00000 ),
- LONG2CHARS( 0x000000FFFFF80000 ),
- LONG2CHARS( 0x000000FFFFFC0000 ),
- LONG2CHARS( 0x000000FFFFFE0000 ),
- LONG2CHARS( 0x000000FFFFFF0000 ),
- LONG2CHARS( 0x000000FFFFFF8000 ),
- LONG2CHARS( 0x000000FFFFFFC000 ),
- LONG2CHARS( 0x000000FFFFFFE000 ),
- LONG2CHARS( 0x000000FFFFFFF000 ),
- LONG2CHARS( 0x000000FFFFFFF800 ),
- LONG2CHARS( 0x000000FFFFFFFC00 ),
- LONG2CHARS( 0x000000FFFFFFFE00 ),
- LONG2CHARS( 0x000000FFFFFFFF00 ),
- LONG2CHARS( 0x000000FFFFFFFF80 ),
- LONG2CHARS( 0x000000FFFFFFFFC0 ),
- LONG2CHARS( 0x000000FFFFFFFFE0 ),
- LONG2CHARS( 0x000000FFFFFFFFF0 ),
- LONG2CHARS( 0x000000FFFFFFFFF8 ),
- LONG2CHARS( 0x000000FFFFFFFFFC ),
- LONG2CHARS( 0x000000FFFFFFFFFE ),
- LONG2CHARS( 0x000000FFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000004000000000 ),
- LONG2CHARS( 0x0000006000000000 ),
- LONG2CHARS( 0x0000007000000000 ),
- LONG2CHARS( 0x0000007800000000 ),
- LONG2CHARS( 0x0000007C00000000 ),
- LONG2CHARS( 0x0000007E00000000 ),
- LONG2CHARS( 0x0000007F00000000 ),
- LONG2CHARS( 0x0000007F80000000 ),
- LONG2CHARS( 0x0000007FC0000000 ),
- LONG2CHARS( 0x0000007FE0000000 ),
- LONG2CHARS( 0x0000007FF0000000 ),
- LONG2CHARS( 0x0000007FF8000000 ),
- LONG2CHARS( 0x0000007FFC000000 ),
- LONG2CHARS( 0x0000007FFE000000 ),
- LONG2CHARS( 0x0000007FFF000000 ),
- LONG2CHARS( 0x0000007FFF800000 ),
- LONG2CHARS( 0x0000007FFFC00000 ),
- LONG2CHARS( 0x0000007FFFE00000 ),
- LONG2CHARS( 0x0000007FFFF00000 ),
- LONG2CHARS( 0x0000007FFFF80000 ),
- LONG2CHARS( 0x0000007FFFFC0000 ),
- LONG2CHARS( 0x0000007FFFFE0000 ),
- LONG2CHARS( 0x0000007FFFFF0000 ),
- LONG2CHARS( 0x0000007FFFFF8000 ),
- LONG2CHARS( 0x0000007FFFFFC000 ),
- LONG2CHARS( 0x0000007FFFFFE000 ),
- LONG2CHARS( 0x0000007FFFFFF000 ),
- LONG2CHARS( 0x0000007FFFFFF800 ),
- LONG2CHARS( 0x0000007FFFFFFC00 ),
- LONG2CHARS( 0x0000007FFFFFFE00 ),
- LONG2CHARS( 0x0000007FFFFFFF00 ),
- LONG2CHARS( 0x0000007FFFFFFF80 ),
- LONG2CHARS( 0x0000007FFFFFFFC0 ),
- LONG2CHARS( 0x0000007FFFFFFFE0 ),
- LONG2CHARS( 0x0000007FFFFFFFF0 ),
- LONG2CHARS( 0x0000007FFFFFFFF8 ),
- LONG2CHARS( 0x0000007FFFFFFFFC ),
- LONG2CHARS( 0x0000007FFFFFFFFE ),
- LONG2CHARS( 0x0000007FFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000002000000000 ),
- LONG2CHARS( 0x0000003000000000 ),
- LONG2CHARS( 0x0000003800000000 ),
- LONG2CHARS( 0x0000003C00000000 ),
- LONG2CHARS( 0x0000003E00000000 ),
- LONG2CHARS( 0x0000003F00000000 ),
- LONG2CHARS( 0x0000003F80000000 ),
- LONG2CHARS( 0x0000003FC0000000 ),
- LONG2CHARS( 0x0000003FE0000000 ),
- LONG2CHARS( 0x0000003FF0000000 ),
- LONG2CHARS( 0x0000003FF8000000 ),
- LONG2CHARS( 0x0000003FFC000000 ),
- LONG2CHARS( 0x0000003FFE000000 ),
- LONG2CHARS( 0x0000003FFF000000 ),
- LONG2CHARS( 0x0000003FFF800000 ),
- LONG2CHARS( 0x0000003FFFC00000 ),
- LONG2CHARS( 0x0000003FFFE00000 ),
- LONG2CHARS( 0x0000003FFFF00000 ),
- LONG2CHARS( 0x0000003FFFF80000 ),
- LONG2CHARS( 0x0000003FFFFC0000 ),
- LONG2CHARS( 0x0000003FFFFE0000 ),
- LONG2CHARS( 0x0000003FFFFF0000 ),
- LONG2CHARS( 0x0000003FFFFF8000 ),
- LONG2CHARS( 0x0000003FFFFFC000 ),
- LONG2CHARS( 0x0000003FFFFFE000 ),
- LONG2CHARS( 0x0000003FFFFFF000 ),
- LONG2CHARS( 0x0000003FFFFFF800 ),
- LONG2CHARS( 0x0000003FFFFFFC00 ),
- LONG2CHARS( 0x0000003FFFFFFE00 ),
- LONG2CHARS( 0x0000003FFFFFFF00 ),
- LONG2CHARS( 0x0000003FFFFFFF80 ),
- LONG2CHARS( 0x0000003FFFFFFFC0 ),
- LONG2CHARS( 0x0000003FFFFFFFE0 ),
- LONG2CHARS( 0x0000003FFFFFFFF0 ),
- LONG2CHARS( 0x0000003FFFFFFFF8 ),
- LONG2CHARS( 0x0000003FFFFFFFFC ),
- LONG2CHARS( 0x0000003FFFFFFFFE ),
- LONG2CHARS( 0x0000003FFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000001000000000 ),
- LONG2CHARS( 0x0000001800000000 ),
- LONG2CHARS( 0x0000001C00000000 ),
- LONG2CHARS( 0x0000001E00000000 ),
- LONG2CHARS( 0x0000001F00000000 ),
- LONG2CHARS( 0x0000001F80000000 ),
- LONG2CHARS( 0x0000001FC0000000 ),
- LONG2CHARS( 0x0000001FE0000000 ),
- LONG2CHARS( 0x0000001FF0000000 ),
- LONG2CHARS( 0x0000001FF8000000 ),
- LONG2CHARS( 0x0000001FFC000000 ),
- LONG2CHARS( 0x0000001FFE000000 ),
- LONG2CHARS( 0x0000001FFF000000 ),
- LONG2CHARS( 0x0000001FFF800000 ),
- LONG2CHARS( 0x0000001FFFC00000 ),
- LONG2CHARS( 0x0000001FFFE00000 ),
- LONG2CHARS( 0x0000001FFFF00000 ),
- LONG2CHARS( 0x0000001FFFF80000 ),
- LONG2CHARS( 0x0000001FFFFC0000 ),
- LONG2CHARS( 0x0000001FFFFE0000 ),
- LONG2CHARS( 0x0000001FFFFF0000 ),
- LONG2CHARS( 0x0000001FFFFF8000 ),
- LONG2CHARS( 0x0000001FFFFFC000 ),
- LONG2CHARS( 0x0000001FFFFFE000 ),
- LONG2CHARS( 0x0000001FFFFFF000 ),
- LONG2CHARS( 0x0000001FFFFFF800 ),
- LONG2CHARS( 0x0000001FFFFFFC00 ),
- LONG2CHARS( 0x0000001FFFFFFE00 ),
- LONG2CHARS( 0x0000001FFFFFFF00 ),
- LONG2CHARS( 0x0000001FFFFFFF80 ),
- LONG2CHARS( 0x0000001FFFFFFFC0 ),
- LONG2CHARS( 0x0000001FFFFFFFE0 ),
- LONG2CHARS( 0x0000001FFFFFFFF0 ),
- LONG2CHARS( 0x0000001FFFFFFFF8 ),
- LONG2CHARS( 0x0000001FFFFFFFFC ),
- LONG2CHARS( 0x0000001FFFFFFFFE ),
- LONG2CHARS( 0x0000001FFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000800000000 ),
- LONG2CHARS( 0x0000000C00000000 ),
- LONG2CHARS( 0x0000000E00000000 ),
- LONG2CHARS( 0x0000000F00000000 ),
- LONG2CHARS( 0x0000000F80000000 ),
- LONG2CHARS( 0x0000000FC0000000 ),
- LONG2CHARS( 0x0000000FE0000000 ),
- LONG2CHARS( 0x0000000FF0000000 ),
- LONG2CHARS( 0x0000000FF8000000 ),
- LONG2CHARS( 0x0000000FFC000000 ),
- LONG2CHARS( 0x0000000FFE000000 ),
- LONG2CHARS( 0x0000000FFF000000 ),
- LONG2CHARS( 0x0000000FFF800000 ),
- LONG2CHARS( 0x0000000FFFC00000 ),
- LONG2CHARS( 0x0000000FFFE00000 ),
- LONG2CHARS( 0x0000000FFFF00000 ),
- LONG2CHARS( 0x0000000FFFF80000 ),
- LONG2CHARS( 0x0000000FFFFC0000 ),
- LONG2CHARS( 0x0000000FFFFE0000 ),
- LONG2CHARS( 0x0000000FFFFF0000 ),
- LONG2CHARS( 0x0000000FFFFF8000 ),
- LONG2CHARS( 0x0000000FFFFFC000 ),
- LONG2CHARS( 0x0000000FFFFFE000 ),
- LONG2CHARS( 0x0000000FFFFFF000 ),
- LONG2CHARS( 0x0000000FFFFFF800 ),
- LONG2CHARS( 0x0000000FFFFFFC00 ),
- LONG2CHARS( 0x0000000FFFFFFE00 ),
- LONG2CHARS( 0x0000000FFFFFFF00 ),
- LONG2CHARS( 0x0000000FFFFFFF80 ),
- LONG2CHARS( 0x0000000FFFFFFFC0 ),
- LONG2CHARS( 0x0000000FFFFFFFE0 ),
- LONG2CHARS( 0x0000000FFFFFFFF0 ),
- LONG2CHARS( 0x0000000FFFFFFFF8 ),
- LONG2CHARS( 0x0000000FFFFFFFFC ),
- LONG2CHARS( 0x0000000FFFFFFFFE ),
- LONG2CHARS( 0x0000000FFFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000400000000 ),
- LONG2CHARS( 0x0000000600000000 ),
- LONG2CHARS( 0x0000000700000000 ),
- LONG2CHARS( 0x0000000780000000 ),
- LONG2CHARS( 0x00000007C0000000 ),
- LONG2CHARS( 0x00000007E0000000 ),
- LONG2CHARS( 0x00000007F0000000 ),
- LONG2CHARS( 0x00000007F8000000 ),
- LONG2CHARS( 0x00000007FC000000 ),
- LONG2CHARS( 0x00000007FE000000 ),
- LONG2CHARS( 0x00000007FF000000 ),
- LONG2CHARS( 0x00000007FF800000 ),
- LONG2CHARS( 0x00000007FFC00000 ),
- LONG2CHARS( 0x00000007FFE00000 ),
- LONG2CHARS( 0x00000007FFF00000 ),
- LONG2CHARS( 0x00000007FFF80000 ),
- LONG2CHARS( 0x00000007FFFC0000 ),
- LONG2CHARS( 0x00000007FFFE0000 ),
- LONG2CHARS( 0x00000007FFFF0000 ),
- LONG2CHARS( 0x00000007FFFF8000 ),
- LONG2CHARS( 0x00000007FFFFC000 ),
- LONG2CHARS( 0x00000007FFFFE000 ),
- LONG2CHARS( 0x00000007FFFFF000 ),
- LONG2CHARS( 0x00000007FFFFF800 ),
- LONG2CHARS( 0x00000007FFFFFC00 ),
- LONG2CHARS( 0x00000007FFFFFE00 ),
- LONG2CHARS( 0x00000007FFFFFF00 ),
- LONG2CHARS( 0x00000007FFFFFF80 ),
- LONG2CHARS( 0x00000007FFFFFFC0 ),
- LONG2CHARS( 0x00000007FFFFFFE0 ),
- LONG2CHARS( 0x00000007FFFFFFF0 ),
- LONG2CHARS( 0x00000007FFFFFFF8 ),
- LONG2CHARS( 0x00000007FFFFFFFC ),
- LONG2CHARS( 0x00000007FFFFFFFE ),
- LONG2CHARS( 0x00000007FFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000200000000 ),
- LONG2CHARS( 0x0000000300000000 ),
- LONG2CHARS( 0x0000000380000000 ),
- LONG2CHARS( 0x00000003C0000000 ),
- LONG2CHARS( 0x00000003E0000000 ),
- LONG2CHARS( 0x00000003F0000000 ),
- LONG2CHARS( 0x00000003F8000000 ),
- LONG2CHARS( 0x00000003FC000000 ),
- LONG2CHARS( 0x00000003FE000000 ),
- LONG2CHARS( 0x00000003FF000000 ),
- LONG2CHARS( 0x00000003FF800000 ),
- LONG2CHARS( 0x00000003FFC00000 ),
- LONG2CHARS( 0x00000003FFE00000 ),
- LONG2CHARS( 0x00000003FFF00000 ),
- LONG2CHARS( 0x00000003FFF80000 ),
- LONG2CHARS( 0x00000003FFFC0000 ),
- LONG2CHARS( 0x00000003FFFE0000 ),
- LONG2CHARS( 0x00000003FFFF0000 ),
- LONG2CHARS( 0x00000003FFFF8000 ),
- LONG2CHARS( 0x00000003FFFFC000 ),
- LONG2CHARS( 0x00000003FFFFE000 ),
- LONG2CHARS( 0x00000003FFFFF000 ),
- LONG2CHARS( 0x00000003FFFFF800 ),
- LONG2CHARS( 0x00000003FFFFFC00 ),
- LONG2CHARS( 0x00000003FFFFFE00 ),
- LONG2CHARS( 0x00000003FFFFFF00 ),
- LONG2CHARS( 0x00000003FFFFFF80 ),
- LONG2CHARS( 0x00000003FFFFFFC0 ),
- LONG2CHARS( 0x00000003FFFFFFE0 ),
- LONG2CHARS( 0x00000003FFFFFFF0 ),
- LONG2CHARS( 0x00000003FFFFFFF8 ),
- LONG2CHARS( 0x00000003FFFFFFFC ),
- LONG2CHARS( 0x00000003FFFFFFFE ),
- LONG2CHARS( 0x00000003FFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000100000000 ),
- LONG2CHARS( 0x0000000180000000 ),
- LONG2CHARS( 0x00000001C0000000 ),
- LONG2CHARS( 0x00000001E0000000 ),
- LONG2CHARS( 0x00000001F0000000 ),
- LONG2CHARS( 0x00000001F8000000 ),
- LONG2CHARS( 0x00000001FC000000 ),
- LONG2CHARS( 0x00000001FE000000 ),
- LONG2CHARS( 0x00000001FF000000 ),
- LONG2CHARS( 0x00000001FF800000 ),
- LONG2CHARS( 0x00000001FFC00000 ),
- LONG2CHARS( 0x00000001FFE00000 ),
- LONG2CHARS( 0x00000001FFF00000 ),
- LONG2CHARS( 0x00000001FFF80000 ),
- LONG2CHARS( 0x00000001FFFC0000 ),
- LONG2CHARS( 0x00000001FFFE0000 ),
- LONG2CHARS( 0x00000001FFFF0000 ),
- LONG2CHARS( 0x00000001FFFF8000 ),
- LONG2CHARS( 0x00000001FFFFC000 ),
- LONG2CHARS( 0x00000001FFFFE000 ),
- LONG2CHARS( 0x00000001FFFFF000 ),
- LONG2CHARS( 0x00000001FFFFF800 ),
- LONG2CHARS( 0x00000001FFFFFC00 ),
- LONG2CHARS( 0x00000001FFFFFE00 ),
- LONG2CHARS( 0x00000001FFFFFF00 ),
- LONG2CHARS( 0x00000001FFFFFF80 ),
- LONG2CHARS( 0x00000001FFFFFFC0 ),
- LONG2CHARS( 0x00000001FFFFFFE0 ),
- LONG2CHARS( 0x00000001FFFFFFF0 ),
- LONG2CHARS( 0x00000001FFFFFFF8 ),
- LONG2CHARS( 0x00000001FFFFFFFC ),
- LONG2CHARS( 0x00000001FFFFFFFE ),
- LONG2CHARS( 0x00000001FFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000080000000 ),
- LONG2CHARS( 0x00000000C0000000 ),
- LONG2CHARS( 0x00000000E0000000 ),
- LONG2CHARS( 0x00000000F0000000 ),
- LONG2CHARS( 0x00000000F8000000 ),
- LONG2CHARS( 0x00000000FC000000 ),
- LONG2CHARS( 0x00000000FE000000 ),
- LONG2CHARS( 0x00000000FF000000 ),
- LONG2CHARS( 0x00000000FF800000 ),
- LONG2CHARS( 0x00000000FFC00000 ),
- LONG2CHARS( 0x00000000FFE00000 ),
- LONG2CHARS( 0x00000000FFF00000 ),
- LONG2CHARS( 0x00000000FFF80000 ),
- LONG2CHARS( 0x00000000FFFC0000 ),
- LONG2CHARS( 0x00000000FFFE0000 ),
- LONG2CHARS( 0x00000000FFFF0000 ),
- LONG2CHARS( 0x00000000FFFF8000 ),
- LONG2CHARS( 0x00000000FFFFC000 ),
- LONG2CHARS( 0x00000000FFFFE000 ),
- LONG2CHARS( 0x00000000FFFFF000 ),
- LONG2CHARS( 0x00000000FFFFF800 ),
- LONG2CHARS( 0x00000000FFFFFC00 ),
- LONG2CHARS( 0x00000000FFFFFE00 ),
- LONG2CHARS( 0x00000000FFFFFF00 ),
- LONG2CHARS( 0x00000000FFFFFF80 ),
- LONG2CHARS( 0x00000000FFFFFFC0 ),
- LONG2CHARS( 0x00000000FFFFFFE0 ),
- LONG2CHARS( 0x00000000FFFFFFF0 ),
- LONG2CHARS( 0x00000000FFFFFFF8 ),
- LONG2CHARS( 0x00000000FFFFFFFC ),
- LONG2CHARS( 0x00000000FFFFFFFE ),
- LONG2CHARS( 0x00000000FFFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000040000000 ),
- LONG2CHARS( 0x0000000060000000 ),
- LONG2CHARS( 0x0000000070000000 ),
- LONG2CHARS( 0x0000000078000000 ),
- LONG2CHARS( 0x000000007C000000 ),
- LONG2CHARS( 0x000000007E000000 ),
- LONG2CHARS( 0x000000007F000000 ),
- LONG2CHARS( 0x000000007F800000 ),
- LONG2CHARS( 0x000000007FC00000 ),
- LONG2CHARS( 0x000000007FE00000 ),
- LONG2CHARS( 0x000000007FF00000 ),
- LONG2CHARS( 0x000000007FF80000 ),
- LONG2CHARS( 0x000000007FFC0000 ),
- LONG2CHARS( 0x000000007FFE0000 ),
- LONG2CHARS( 0x000000007FFF0000 ),
- LONG2CHARS( 0x000000007FFF8000 ),
- LONG2CHARS( 0x000000007FFFC000 ),
- LONG2CHARS( 0x000000007FFFE000 ),
- LONG2CHARS( 0x000000007FFFF000 ),
- LONG2CHARS( 0x000000007FFFF800 ),
- LONG2CHARS( 0x000000007FFFFC00 ),
- LONG2CHARS( 0x000000007FFFFE00 ),
- LONG2CHARS( 0x000000007FFFFF00 ),
- LONG2CHARS( 0x000000007FFFFF80 ),
- LONG2CHARS( 0x000000007FFFFFC0 ),
- LONG2CHARS( 0x000000007FFFFFE0 ),
- LONG2CHARS( 0x000000007FFFFFF0 ),
- LONG2CHARS( 0x000000007FFFFFF8 ),
- LONG2CHARS( 0x000000007FFFFFFC ),
- LONG2CHARS( 0x000000007FFFFFFE ),
- LONG2CHARS( 0x000000007FFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000020000000 ),
- LONG2CHARS( 0x0000000030000000 ),
- LONG2CHARS( 0x0000000038000000 ),
- LONG2CHARS( 0x000000003C000000 ),
- LONG2CHARS( 0x000000003E000000 ),
- LONG2CHARS( 0x000000003F000000 ),
- LONG2CHARS( 0x000000003F800000 ),
- LONG2CHARS( 0x000000003FC00000 ),
- LONG2CHARS( 0x000000003FE00000 ),
- LONG2CHARS( 0x000000003FF00000 ),
- LONG2CHARS( 0x000000003FF80000 ),
- LONG2CHARS( 0x000000003FFC0000 ),
- LONG2CHARS( 0x000000003FFE0000 ),
- LONG2CHARS( 0x000000003FFF0000 ),
- LONG2CHARS( 0x000000003FFF8000 ),
- LONG2CHARS( 0x000000003FFFC000 ),
- LONG2CHARS( 0x000000003FFFE000 ),
- LONG2CHARS( 0x000000003FFFF000 ),
- LONG2CHARS( 0x000000003FFFF800 ),
- LONG2CHARS( 0x000000003FFFFC00 ),
- LONG2CHARS( 0x000000003FFFFE00 ),
- LONG2CHARS( 0x000000003FFFFF00 ),
- LONG2CHARS( 0x000000003FFFFF80 ),
- LONG2CHARS( 0x000000003FFFFFC0 ),
- LONG2CHARS( 0x000000003FFFFFE0 ),
- LONG2CHARS( 0x000000003FFFFFF0 ),
- LONG2CHARS( 0x000000003FFFFFF8 ),
- LONG2CHARS( 0x000000003FFFFFFC ),
- LONG2CHARS( 0x000000003FFFFFFE ),
- LONG2CHARS( 0x000000003FFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000010000000 ),
- LONG2CHARS( 0x0000000018000000 ),
- LONG2CHARS( 0x000000001C000000 ),
- LONG2CHARS( 0x000000001E000000 ),
- LONG2CHARS( 0x000000001F000000 ),
- LONG2CHARS( 0x000000001F800000 ),
- LONG2CHARS( 0x000000001FC00000 ),
- LONG2CHARS( 0x000000001FE00000 ),
- LONG2CHARS( 0x000000001FF00000 ),
- LONG2CHARS( 0x000000001FF80000 ),
- LONG2CHARS( 0x000000001FFC0000 ),
- LONG2CHARS( 0x000000001FFE0000 ),
- LONG2CHARS( 0x000000001FFF0000 ),
- LONG2CHARS( 0x000000001FFF8000 ),
- LONG2CHARS( 0x000000001FFFC000 ),
- LONG2CHARS( 0x000000001FFFE000 ),
- LONG2CHARS( 0x000000001FFFF000 ),
- LONG2CHARS( 0x000000001FFFF800 ),
- LONG2CHARS( 0x000000001FFFFC00 ),
- LONG2CHARS( 0x000000001FFFFE00 ),
- LONG2CHARS( 0x000000001FFFFF00 ),
- LONG2CHARS( 0x000000001FFFFF80 ),
- LONG2CHARS( 0x000000001FFFFFC0 ),
- LONG2CHARS( 0x000000001FFFFFE0 ),
- LONG2CHARS( 0x000000001FFFFFF0 ),
- LONG2CHARS( 0x000000001FFFFFF8 ),
- LONG2CHARS( 0x000000001FFFFFFC ),
- LONG2CHARS( 0x000000001FFFFFFE ),
- LONG2CHARS( 0x000000001FFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000008000000 ),
- LONG2CHARS( 0x000000000C000000 ),
- LONG2CHARS( 0x000000000E000000 ),
- LONG2CHARS( 0x000000000F000000 ),
- LONG2CHARS( 0x000000000F800000 ),
- LONG2CHARS( 0x000000000FC00000 ),
- LONG2CHARS( 0x000000000FE00000 ),
- LONG2CHARS( 0x000000000FF00000 ),
- LONG2CHARS( 0x000000000FF80000 ),
- LONG2CHARS( 0x000000000FFC0000 ),
- LONG2CHARS( 0x000000000FFE0000 ),
- LONG2CHARS( 0x000000000FFF0000 ),
- LONG2CHARS( 0x000000000FFF8000 ),
- LONG2CHARS( 0x000000000FFFC000 ),
- LONG2CHARS( 0x000000000FFFE000 ),
- LONG2CHARS( 0x000000000FFFF000 ),
- LONG2CHARS( 0x000000000FFFF800 ),
- LONG2CHARS( 0x000000000FFFFC00 ),
- LONG2CHARS( 0x000000000FFFFE00 ),
- LONG2CHARS( 0x000000000FFFFF00 ),
- LONG2CHARS( 0x000000000FFFFF80 ),
- LONG2CHARS( 0x000000000FFFFFC0 ),
- LONG2CHARS( 0x000000000FFFFFE0 ),
- LONG2CHARS( 0x000000000FFFFFF0 ),
- LONG2CHARS( 0x000000000FFFFFF8 ),
- LONG2CHARS( 0x000000000FFFFFFC ),
- LONG2CHARS( 0x000000000FFFFFFE ),
- LONG2CHARS( 0x000000000FFFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000004000000 ),
- LONG2CHARS( 0x0000000006000000 ),
- LONG2CHARS( 0x0000000007000000 ),
- LONG2CHARS( 0x0000000007800000 ),
- LONG2CHARS( 0x0000000007C00000 ),
- LONG2CHARS( 0x0000000007E00000 ),
- LONG2CHARS( 0x0000000007F00000 ),
- LONG2CHARS( 0x0000000007F80000 ),
- LONG2CHARS( 0x0000000007FC0000 ),
- LONG2CHARS( 0x0000000007FE0000 ),
- LONG2CHARS( 0x0000000007FF0000 ),
- LONG2CHARS( 0x0000000007FF8000 ),
- LONG2CHARS( 0x0000000007FFC000 ),
- LONG2CHARS( 0x0000000007FFE000 ),
- LONG2CHARS( 0x0000000007FFF000 ),
- LONG2CHARS( 0x0000000007FFF800 ),
- LONG2CHARS( 0x0000000007FFFC00 ),
- LONG2CHARS( 0x0000000007FFFE00 ),
- LONG2CHARS( 0x0000000007FFFF00 ),
- LONG2CHARS( 0x0000000007FFFF80 ),
- LONG2CHARS( 0x0000000007FFFFC0 ),
- LONG2CHARS( 0x0000000007FFFFE0 ),
- LONG2CHARS( 0x0000000007FFFFF0 ),
- LONG2CHARS( 0x0000000007FFFFF8 ),
- LONG2CHARS( 0x0000000007FFFFFC ),
- LONG2CHARS( 0x0000000007FFFFFE ),
- LONG2CHARS( 0x0000000007FFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000002000000 ),
- LONG2CHARS( 0x0000000003000000 ),
- LONG2CHARS( 0x0000000003800000 ),
- LONG2CHARS( 0x0000000003C00000 ),
- LONG2CHARS( 0x0000000003E00000 ),
- LONG2CHARS( 0x0000000003F00000 ),
- LONG2CHARS( 0x0000000003F80000 ),
- LONG2CHARS( 0x0000000003FC0000 ),
- LONG2CHARS( 0x0000000003FE0000 ),
- LONG2CHARS( 0x0000000003FF0000 ),
- LONG2CHARS( 0x0000000003FF8000 ),
- LONG2CHARS( 0x0000000003FFC000 ),
- LONG2CHARS( 0x0000000003FFE000 ),
- LONG2CHARS( 0x0000000003FFF000 ),
- LONG2CHARS( 0x0000000003FFF800 ),
- LONG2CHARS( 0x0000000003FFFC00 ),
- LONG2CHARS( 0x0000000003FFFE00 ),
- LONG2CHARS( 0x0000000003FFFF00 ),
- LONG2CHARS( 0x0000000003FFFF80 ),
- LONG2CHARS( 0x0000000003FFFFC0 ),
- LONG2CHARS( 0x0000000003FFFFE0 ),
- LONG2CHARS( 0x0000000003FFFFF0 ),
- LONG2CHARS( 0x0000000003FFFFF8 ),
- LONG2CHARS( 0x0000000003FFFFFC ),
- LONG2CHARS( 0x0000000003FFFFFE ),
- LONG2CHARS( 0x0000000003FFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000001000000 ),
- LONG2CHARS( 0x0000000001800000 ),
- LONG2CHARS( 0x0000000001C00000 ),
- LONG2CHARS( 0x0000000001E00000 ),
- LONG2CHARS( 0x0000000001F00000 ),
- LONG2CHARS( 0x0000000001F80000 ),
- LONG2CHARS( 0x0000000001FC0000 ),
- LONG2CHARS( 0x0000000001FE0000 ),
- LONG2CHARS( 0x0000000001FF0000 ),
- LONG2CHARS( 0x0000000001FF8000 ),
- LONG2CHARS( 0x0000000001FFC000 ),
- LONG2CHARS( 0x0000000001FFE000 ),
- LONG2CHARS( 0x0000000001FFF000 ),
- LONG2CHARS( 0x0000000001FFF800 ),
- LONG2CHARS( 0x0000000001FFFC00 ),
- LONG2CHARS( 0x0000000001FFFE00 ),
- LONG2CHARS( 0x0000000001FFFF00 ),
- LONG2CHARS( 0x0000000001FFFF80 ),
- LONG2CHARS( 0x0000000001FFFFC0 ),
- LONG2CHARS( 0x0000000001FFFFE0 ),
- LONG2CHARS( 0x0000000001FFFFF0 ),
- LONG2CHARS( 0x0000000001FFFFF8 ),
- LONG2CHARS( 0x0000000001FFFFFC ),
- LONG2CHARS( 0x0000000001FFFFFE ),
- LONG2CHARS( 0x0000000001FFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000800000 ),
- LONG2CHARS( 0x0000000000C00000 ),
- LONG2CHARS( 0x0000000000E00000 ),
- LONG2CHARS( 0x0000000000F00000 ),
- LONG2CHARS( 0x0000000000F80000 ),
- LONG2CHARS( 0x0000000000FC0000 ),
- LONG2CHARS( 0x0000000000FE0000 ),
- LONG2CHARS( 0x0000000000FF0000 ),
- LONG2CHARS( 0x0000000000FF8000 ),
- LONG2CHARS( 0x0000000000FFC000 ),
- LONG2CHARS( 0x0000000000FFE000 ),
- LONG2CHARS( 0x0000000000FFF000 ),
- LONG2CHARS( 0x0000000000FFF800 ),
- LONG2CHARS( 0x0000000000FFFC00 ),
- LONG2CHARS( 0x0000000000FFFE00 ),
- LONG2CHARS( 0x0000000000FFFF00 ),
- LONG2CHARS( 0x0000000000FFFF80 ),
- LONG2CHARS( 0x0000000000FFFFC0 ),
- LONG2CHARS( 0x0000000000FFFFE0 ),
- LONG2CHARS( 0x0000000000FFFFF0 ),
- LONG2CHARS( 0x0000000000FFFFF8 ),
- LONG2CHARS( 0x0000000000FFFFFC ),
- LONG2CHARS( 0x0000000000FFFFFE ),
- LONG2CHARS( 0x0000000000FFFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000400000 ),
- LONG2CHARS( 0x0000000000600000 ),
- LONG2CHARS( 0x0000000000700000 ),
- LONG2CHARS( 0x0000000000780000 ),
- LONG2CHARS( 0x00000000007C0000 ),
- LONG2CHARS( 0x00000000007E0000 ),
- LONG2CHARS( 0x00000000007F0000 ),
- LONG2CHARS( 0x00000000007F8000 ),
- LONG2CHARS( 0x00000000007FC000 ),
- LONG2CHARS( 0x00000000007FE000 ),
- LONG2CHARS( 0x00000000007FF000 ),
- LONG2CHARS( 0x00000000007FF800 ),
- LONG2CHARS( 0x00000000007FFC00 ),
- LONG2CHARS( 0x00000000007FFE00 ),
- LONG2CHARS( 0x00000000007FFF00 ),
- LONG2CHARS( 0x00000000007FFF80 ),
- LONG2CHARS( 0x00000000007FFFC0 ),
- LONG2CHARS( 0x00000000007FFFE0 ),
- LONG2CHARS( 0x00000000007FFFF0 ),
- LONG2CHARS( 0x00000000007FFFF8 ),
- LONG2CHARS( 0x00000000007FFFFC ),
- LONG2CHARS( 0x00000000007FFFFE ),
- LONG2CHARS( 0x00000000007FFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000200000 ),
- LONG2CHARS( 0x0000000000300000 ),
- LONG2CHARS( 0x0000000000380000 ),
- LONG2CHARS( 0x00000000003C0000 ),
- LONG2CHARS( 0x00000000003E0000 ),
- LONG2CHARS( 0x00000000003F0000 ),
- LONG2CHARS( 0x00000000003F8000 ),
- LONG2CHARS( 0x00000000003FC000 ),
- LONG2CHARS( 0x00000000003FE000 ),
- LONG2CHARS( 0x00000000003FF000 ),
- LONG2CHARS( 0x00000000003FF800 ),
- LONG2CHARS( 0x00000000003FFC00 ),
- LONG2CHARS( 0x00000000003FFE00 ),
- LONG2CHARS( 0x00000000003FFF00 ),
- LONG2CHARS( 0x00000000003FFF80 ),
- LONG2CHARS( 0x00000000003FFFC0 ),
- LONG2CHARS( 0x00000000003FFFE0 ),
- LONG2CHARS( 0x00000000003FFFF0 ),
- LONG2CHARS( 0x00000000003FFFF8 ),
- LONG2CHARS( 0x00000000003FFFFC ),
- LONG2CHARS( 0x00000000003FFFFE ),
- LONG2CHARS( 0x00000000003FFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000100000 ),
- LONG2CHARS( 0x0000000000180000 ),
- LONG2CHARS( 0x00000000001C0000 ),
- LONG2CHARS( 0x00000000001E0000 ),
- LONG2CHARS( 0x00000000001F0000 ),
- LONG2CHARS( 0x00000000001F8000 ),
- LONG2CHARS( 0x00000000001FC000 ),
- LONG2CHARS( 0x00000000001FE000 ),
- LONG2CHARS( 0x00000000001FF000 ),
- LONG2CHARS( 0x00000000001FF800 ),
- LONG2CHARS( 0x00000000001FFC00 ),
- LONG2CHARS( 0x00000000001FFE00 ),
- LONG2CHARS( 0x00000000001FFF00 ),
- LONG2CHARS( 0x00000000001FFF80 ),
- LONG2CHARS( 0x00000000001FFFC0 ),
- LONG2CHARS( 0x00000000001FFFE0 ),
- LONG2CHARS( 0x00000000001FFFF0 ),
- LONG2CHARS( 0x00000000001FFFF8 ),
- LONG2CHARS( 0x00000000001FFFFC ),
- LONG2CHARS( 0x00000000001FFFFE ),
- LONG2CHARS( 0x00000000001FFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000080000 ),
- LONG2CHARS( 0x00000000000C0000 ),
- LONG2CHARS( 0x00000000000E0000 ),
- LONG2CHARS( 0x00000000000F0000 ),
- LONG2CHARS( 0x00000000000F8000 ),
- LONG2CHARS( 0x00000000000FC000 ),
- LONG2CHARS( 0x00000000000FE000 ),
- LONG2CHARS( 0x00000000000FF000 ),
- LONG2CHARS( 0x00000000000FF800 ),
- LONG2CHARS( 0x00000000000FFC00 ),
- LONG2CHARS( 0x00000000000FFE00 ),
- LONG2CHARS( 0x00000000000FFF00 ),
- LONG2CHARS( 0x00000000000FFF80 ),
- LONG2CHARS( 0x00000000000FFFC0 ),
- LONG2CHARS( 0x00000000000FFFE0 ),
- LONG2CHARS( 0x00000000000FFFF0 ),
- LONG2CHARS( 0x00000000000FFFF8 ),
- LONG2CHARS( 0x00000000000FFFFC ),
- LONG2CHARS( 0x00000000000FFFFE ),
- LONG2CHARS( 0x00000000000FFFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000040000 ),
- LONG2CHARS( 0x0000000000060000 ),
- LONG2CHARS( 0x0000000000070000 ),
- LONG2CHARS( 0x0000000000078000 ),
- LONG2CHARS( 0x000000000007C000 ),
- LONG2CHARS( 0x000000000007E000 ),
- LONG2CHARS( 0x000000000007F000 ),
- LONG2CHARS( 0x000000000007F800 ),
- LONG2CHARS( 0x000000000007FC00 ),
- LONG2CHARS( 0x000000000007FE00 ),
- LONG2CHARS( 0x000000000007FF00 ),
- LONG2CHARS( 0x000000000007FF80 ),
- LONG2CHARS( 0x000000000007FFC0 ),
- LONG2CHARS( 0x000000000007FFE0 ),
- LONG2CHARS( 0x000000000007FFF0 ),
- LONG2CHARS( 0x000000000007FFF8 ),
- LONG2CHARS( 0x000000000007FFFC ),
- LONG2CHARS( 0x000000000007FFFE ),
- LONG2CHARS( 0x000000000007FFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000020000 ),
- LONG2CHARS( 0x0000000000030000 ),
- LONG2CHARS( 0x0000000000038000 ),
- LONG2CHARS( 0x000000000003C000 ),
- LONG2CHARS( 0x000000000003E000 ),
- LONG2CHARS( 0x000000000003F000 ),
- LONG2CHARS( 0x000000000003F800 ),
- LONG2CHARS( 0x000000000003FC00 ),
- LONG2CHARS( 0x000000000003FE00 ),
- LONG2CHARS( 0x000000000003FF00 ),
- LONG2CHARS( 0x000000000003FF80 ),
- LONG2CHARS( 0x000000000003FFC0 ),
- LONG2CHARS( 0x000000000003FFE0 ),
- LONG2CHARS( 0x000000000003FFF0 ),
- LONG2CHARS( 0x000000000003FFF8 ),
- LONG2CHARS( 0x000000000003FFFC ),
- LONG2CHARS( 0x000000000003FFFE ),
- LONG2CHARS( 0x000000000003FFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000010000 ),
- LONG2CHARS( 0x0000000000018000 ),
- LONG2CHARS( 0x000000000001C000 ),
- LONG2CHARS( 0x000000000001E000 ),
- LONG2CHARS( 0x000000000001F000 ),
- LONG2CHARS( 0x000000000001F800 ),
- LONG2CHARS( 0x000000000001FC00 ),
- LONG2CHARS( 0x000000000001FE00 ),
- LONG2CHARS( 0x000000000001FF00 ),
- LONG2CHARS( 0x000000000001FF80 ),
- LONG2CHARS( 0x000000000001FFC0 ),
- LONG2CHARS( 0x000000000001FFE0 ),
- LONG2CHARS( 0x000000000001FFF0 ),
- LONG2CHARS( 0x000000000001FFF8 ),
- LONG2CHARS( 0x000000000001FFFC ),
- LONG2CHARS( 0x000000000001FFFE ),
- LONG2CHARS( 0x000000000001FFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000008000 ),
- LONG2CHARS( 0x000000000000C000 ),
- LONG2CHARS( 0x000000000000E000 ),
- LONG2CHARS( 0x000000000000F000 ),
- LONG2CHARS( 0x000000000000F800 ),
- LONG2CHARS( 0x000000000000FC00 ),
- LONG2CHARS( 0x000000000000FE00 ),
- LONG2CHARS( 0x000000000000FF00 ),
- LONG2CHARS( 0x000000000000FF80 ),
- LONG2CHARS( 0x000000000000FFC0 ),
- LONG2CHARS( 0x000000000000FFE0 ),
- LONG2CHARS( 0x000000000000FFF0 ),
- LONG2CHARS( 0x000000000000FFF8 ),
- LONG2CHARS( 0x000000000000FFFC ),
- LONG2CHARS( 0x000000000000FFFE ),
- LONG2CHARS( 0x000000000000FFFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000004000 ),
- LONG2CHARS( 0x0000000000006000 ),
- LONG2CHARS( 0x0000000000007000 ),
- LONG2CHARS( 0x0000000000007800 ),
- LONG2CHARS( 0x0000000000007C00 ),
- LONG2CHARS( 0x0000000000007E00 ),
- LONG2CHARS( 0x0000000000007F00 ),
- LONG2CHARS( 0x0000000000007F80 ),
- LONG2CHARS( 0x0000000000007FC0 ),
- LONG2CHARS( 0x0000000000007FE0 ),
- LONG2CHARS( 0x0000000000007FF0 ),
- LONG2CHARS( 0x0000000000007FF8 ),
- LONG2CHARS( 0x0000000000007FFC ),
- LONG2CHARS( 0x0000000000007FFE ),
- LONG2CHARS( 0x0000000000007FFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000002000 ),
- LONG2CHARS( 0x0000000000003000 ),
- LONG2CHARS( 0x0000000000003800 ),
- LONG2CHARS( 0x0000000000003C00 ),
- LONG2CHARS( 0x0000000000003E00 ),
- LONG2CHARS( 0x0000000000003F00 ),
- LONG2CHARS( 0x0000000000003F80 ),
- LONG2CHARS( 0x0000000000003FC0 ),
- LONG2CHARS( 0x0000000000003FE0 ),
- LONG2CHARS( 0x0000000000003FF0 ),
- LONG2CHARS( 0x0000000000003FF8 ),
- LONG2CHARS( 0x0000000000003FFC ),
- LONG2CHARS( 0x0000000000003FFE ),
- LONG2CHARS( 0x0000000000003FFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000001000 ),
- LONG2CHARS( 0x0000000000001800 ),
- LONG2CHARS( 0x0000000000001C00 ),
- LONG2CHARS( 0x0000000000001E00 ),
- LONG2CHARS( 0x0000000000001F00 ),
- LONG2CHARS( 0x0000000000001F80 ),
- LONG2CHARS( 0x0000000000001FC0 ),
- LONG2CHARS( 0x0000000000001FE0 ),
- LONG2CHARS( 0x0000000000001FF0 ),
- LONG2CHARS( 0x0000000000001FF8 ),
- LONG2CHARS( 0x0000000000001FFC ),
- LONG2CHARS( 0x0000000000001FFE ),
- LONG2CHARS( 0x0000000000001FFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000800 ),
- LONG2CHARS( 0x0000000000000C00 ),
- LONG2CHARS( 0x0000000000000E00 ),
- LONG2CHARS( 0x0000000000000F00 ),
- LONG2CHARS( 0x0000000000000F80 ),
- LONG2CHARS( 0x0000000000000FC0 ),
- LONG2CHARS( 0x0000000000000FE0 ),
- LONG2CHARS( 0x0000000000000FF0 ),
- LONG2CHARS( 0x0000000000000FF8 ),
- LONG2CHARS( 0x0000000000000FFC ),
- LONG2CHARS( 0x0000000000000FFE ),
- LONG2CHARS( 0x0000000000000FFF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000400 ),
- LONG2CHARS( 0x0000000000000600 ),
- LONG2CHARS( 0x0000000000000700 ),
- LONG2CHARS( 0x0000000000000780 ),
- LONG2CHARS( 0x00000000000007C0 ),
- LONG2CHARS( 0x00000000000007E0 ),
- LONG2CHARS( 0x00000000000007F0 ),
- LONG2CHARS( 0x00000000000007F8 ),
- LONG2CHARS( 0x00000000000007FC ),
- LONG2CHARS( 0x00000000000007FE ),
- LONG2CHARS( 0x00000000000007FF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000200 ),
- LONG2CHARS( 0x0000000000000300 ),
- LONG2CHARS( 0x0000000000000380 ),
- LONG2CHARS( 0x00000000000003C0 ),
- LONG2CHARS( 0x00000000000003E0 ),
- LONG2CHARS( 0x00000000000003F0 ),
- LONG2CHARS( 0x00000000000003F8 ),
- LONG2CHARS( 0x00000000000003FC ),
- LONG2CHARS( 0x00000000000003FE ),
- LONG2CHARS( 0x00000000000003FF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000100 ),
- LONG2CHARS( 0x0000000000000180 ),
- LONG2CHARS( 0x00000000000001C0 ),
- LONG2CHARS( 0x00000000000001E0 ),
- LONG2CHARS( 0x00000000000001F0 ),
- LONG2CHARS( 0x00000000000001F8 ),
- LONG2CHARS( 0x00000000000001FC ),
- LONG2CHARS( 0x00000000000001FE ),
- LONG2CHARS( 0x00000000000001FF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000080 ),
- LONG2CHARS( 0x00000000000000C0 ),
- LONG2CHARS( 0x00000000000000E0 ),
- LONG2CHARS( 0x00000000000000F0 ),
- LONG2CHARS( 0x00000000000000F8 ),
- LONG2CHARS( 0x00000000000000FC ),
- LONG2CHARS( 0x00000000000000FE ),
- LONG2CHARS( 0x00000000000000FF ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000040 ),
- LONG2CHARS( 0x0000000000000060 ),
- LONG2CHARS( 0x0000000000000070 ),
- LONG2CHARS( 0x0000000000000078 ),
- LONG2CHARS( 0x000000000000007C ),
- LONG2CHARS( 0x000000000000007E ),
- LONG2CHARS( 0x000000000000007F ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000020 ),
- LONG2CHARS( 0x0000000000000030 ),
- LONG2CHARS( 0x0000000000000038 ),
- LONG2CHARS( 0x000000000000003C ),
- LONG2CHARS( 0x000000000000003E ),
- LONG2CHARS( 0x000000000000003F ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000010 ),
- LONG2CHARS( 0x0000000000000018 ),
- LONG2CHARS( 0x000000000000001C ),
- LONG2CHARS( 0x000000000000001E ),
- LONG2CHARS( 0x000000000000001F ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000008 ),
- LONG2CHARS( 0x000000000000000C ),
- LONG2CHARS( 0x000000000000000E ),
- LONG2CHARS( 0x000000000000000F ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000004 ),
- LONG2CHARS( 0x0000000000000006 ),
- LONG2CHARS( 0x0000000000000007 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000002 ),
- LONG2CHARS( 0x0000000000000003 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000001 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
-};
-#endif /* PPW */
#else /* LSBFirst */
/* NOTE:
@@ -4829,7 +503,6 @@ have to do if we thought it was partial.
*/
PixelType starttab[PPW+1] =
{
-#if PPW == 32
LONG2CHARS( 0x00000000 ),
LONG2CHARS( 0xFFFFFFFE ),
LONG2CHARS( 0xFFFFFFFC ),
@@ -4863,73 +536,6 @@ PixelType starttab[PPW+1] =
LONG2CHARS( 0xC0000000 ),
LONG2CHARS( 0x80000000 ),
LONG2CHARS( 0x00000000 )
-#else /* PPW == 64 */
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFE ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFC ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF80 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFE00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFC00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF800 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFE000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFC000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF8000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFE0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFC0000 ),
- LONG2CHARS( 0xFFFFFFFFFFF80000 ),
- LONG2CHARS( 0xFFFFFFFFFFF00000 ),
- LONG2CHARS( 0xFFFFFFFFFFE00000 ),
- LONG2CHARS( 0xFFFFFFFFFFC00000 ),
- LONG2CHARS( 0xFFFFFFFFFF800000 ),
- LONG2CHARS( 0xFFFFFFFFFF000000 ),
- LONG2CHARS( 0xFFFFFFFFFE000000 ),
- LONG2CHARS( 0xFFFFFFFFFC000000 ),
- LONG2CHARS( 0xFFFFFFFFF8000000 ),
- LONG2CHARS( 0xFFFFFFFFF0000000 ),
- LONG2CHARS( 0xFFFFFFFFE0000000 ),
- LONG2CHARS( 0xFFFFFFFFC0000000 ),
- LONG2CHARS( 0xFFFFFFFF80000000 ),
- LONG2CHARS( 0xFFFFFFFF00000000 ),
- LONG2CHARS( 0xFFFFFFFE00000000 ),
- LONG2CHARS( 0xFFFFFFFC00000000 ),
- LONG2CHARS( 0xFFFFFFF800000000 ),
- LONG2CHARS( 0xFFFFFFF000000000 ),
- LONG2CHARS( 0xFFFFFFE000000000 ),
- LONG2CHARS( 0xFFFFFFC000000000 ),
- LONG2CHARS( 0xFFFFFF8000000000 ),
- LONG2CHARS( 0xFFFFFF0000000000 ),
- LONG2CHARS( 0xFFFFFE0000000000 ),
- LONG2CHARS( 0xFFFFFC0000000000 ),
- LONG2CHARS( 0xFFFFF80000000000 ),
- LONG2CHARS( 0xFFFFF00000000000 ),
- LONG2CHARS( 0xFFFFE00000000000 ),
- LONG2CHARS( 0xFFFFC00000000000 ),
- LONG2CHARS( 0xFFFF800000000000 ),
- LONG2CHARS( 0xFFFF000000000000 ),
- LONG2CHARS( 0xFFFE000000000000 ),
- LONG2CHARS( 0xFFFC000000000000 ),
- LONG2CHARS( 0xFFF8000000000000 ),
- LONG2CHARS( 0xFFF0000000000000 ),
- LONG2CHARS( 0xFFE0000000000000 ),
- LONG2CHARS( 0xFFC0000000000000 ),
- LONG2CHARS( 0xFF80000000000000 ),
- LONG2CHARS( 0xFF00000000000000 ),
- LONG2CHARS( 0xFE00000000000000 ),
- LONG2CHARS( 0xFC00000000000000 ),
- LONG2CHARS( 0xF800000000000000 ),
- LONG2CHARS( 0xF000000000000000 ),
- LONG2CHARS( 0xE000000000000000 ),
- LONG2CHARS( 0xC000000000000000 ),
- LONG2CHARS( 0x8000000000000000 ),
- LONG2CHARS( 0x0000000000000000 )
-#endif /* PPW */
};
PixelType endtab[PPW+1] =
@@ -4967,41 +573,6 @@ PixelType endtab[PPW+1] =
LONG2CHARS( 0x3FFFFFFF ),
LONG2CHARS( 0x7FFFFFFF ),
LONG2CHARS( 0xFFFFFFFF )
-#if PPW == 64
- ,
- LONG2CHARS( 0x00000001FFFFFFFF ),
- LONG2CHARS( 0x00000003FFFFFFFF ),
- LONG2CHARS( 0x00000007FFFFFFFF ),
- LONG2CHARS( 0x0000000FFFFFFFFF ),
- LONG2CHARS( 0x0000001FFFFFFFFF ),
- LONG2CHARS( 0x0000003FFFFFFFFF ),
- LONG2CHARS( 0x0000007FFFFFFFFF ),
- LONG2CHARS( 0x000000FFFFFFFFFF ),
- LONG2CHARS( 0x000001FFFFFFFFFF ),
- LONG2CHARS( 0x000003FFFFFFFFFF ),
- LONG2CHARS( 0x000007FFFFFFFFFF ),
- LONG2CHARS( 0x00000FFFFFFFFFFF ),
- LONG2CHARS( 0x00001FFFFFFFFFFF ),
- LONG2CHARS( 0x00003FFFFFFFFFFF ),
- LONG2CHARS( 0x00007FFFFFFFFFFF ),
- LONG2CHARS( 0x0000FFFFFFFFFFFF ),
- LONG2CHARS( 0x0001FFFFFFFFFFFF ),
- LONG2CHARS( 0x0003FFFFFFFFFFFF ),
- LONG2CHARS( 0x0007FFFFFFFFFFFF ),
- LONG2CHARS( 0x000FFFFFFFFFFFFF ),
- LONG2CHARS( 0x001FFFFFFFFFFFFF ),
- LONG2CHARS( 0x003FFFFFFFFFFFFF ),
- LONG2CHARS( 0x007FFFFFFFFFFFFF ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFF )
-#endif /* PPW */
};
#ifndef LOWMEMFTPT
@@ -5089,7 +660,6 @@ PixelType endpartial[33] =
#endif /* ifndef LOWMEMFTPT */
-#if PPW == 32
PixelType partmasks[PPW][PPW] = {
{LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000007 ),
LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000007F ),
@@ -5348,4236 +918,8 @@ PixelType partmasks[PPW][PPW] = {
LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
};
-#else /* PPW == 64 */
-unsigned long partmasks[PPW][PPW] = {
- {
- LONG2CHARS( 0xFFFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0000000000000001 ),
- LONG2CHARS( 0x0000000000000003 ),
- LONG2CHARS( 0x0000000000000007 ),
- LONG2CHARS( 0x000000000000000F ),
- LONG2CHARS( 0x000000000000001F ),
- LONG2CHARS( 0x000000000000003F ),
- LONG2CHARS( 0x000000000000007F ),
- LONG2CHARS( 0x00000000000000FF ),
- LONG2CHARS( 0x00000000000001FF ),
- LONG2CHARS( 0x00000000000003FF ),
- LONG2CHARS( 0x00000000000007FF ),
- LONG2CHARS( 0x0000000000000FFF ),
- LONG2CHARS( 0x0000000000001FFF ),
- LONG2CHARS( 0x0000000000003FFF ),
- LONG2CHARS( 0x0000000000007FFF ),
- LONG2CHARS( 0x000000000000FFFF ),
- LONG2CHARS( 0x000000000001FFFF ),
- LONG2CHARS( 0x000000000003FFFF ),
- LONG2CHARS( 0x000000000007FFFF ),
- LONG2CHARS( 0x00000000000FFFFF ),
- LONG2CHARS( 0x00000000001FFFFF ),
- LONG2CHARS( 0x00000000003FFFFF ),
- LONG2CHARS( 0x00000000007FFFFF ),
- LONG2CHARS( 0x0000000000FFFFFF ),
- LONG2CHARS( 0x0000000001FFFFFF ),
- LONG2CHARS( 0x0000000003FFFFFF ),
- LONG2CHARS( 0x0000000007FFFFFF ),
- LONG2CHARS( 0x000000000FFFFFFF ),
- LONG2CHARS( 0x000000001FFFFFFF ),
- LONG2CHARS( 0x000000003FFFFFFF ),
- LONG2CHARS( 0x000000007FFFFFFF ),
- LONG2CHARS( 0x00000000FFFFFFFF ),
- LONG2CHARS( 0x00000001FFFFFFFF ),
- LONG2CHARS( 0x00000003FFFFFFFF ),
- LONG2CHARS( 0x00000007FFFFFFFF ),
- LONG2CHARS( 0x0000000FFFFFFFFF ),
- LONG2CHARS( 0x0000001FFFFFFFFF ),
- LONG2CHARS( 0x0000003FFFFFFFFF ),
- LONG2CHARS( 0x0000007FFFFFFFFF ),
- LONG2CHARS( 0x000000FFFFFFFFFF ),
- LONG2CHARS( 0x000001FFFFFFFFFF ),
- LONG2CHARS( 0x000003FFFFFFFFFF ),
- LONG2CHARS( 0x000007FFFFFFFFFF ),
- LONG2CHARS( 0x00000FFFFFFFFFFF ),
- LONG2CHARS( 0x00001FFFFFFFFFFF ),
- LONG2CHARS( 0x00003FFFFFFFFFFF ),
- LONG2CHARS( 0x00007FFFFFFFFFFF ),
- LONG2CHARS( 0x0000FFFFFFFFFFFF ),
- LONG2CHARS( 0x0001FFFFFFFFFFFF ),
- LONG2CHARS( 0x0003FFFFFFFFFFFF ),
- LONG2CHARS( 0x0007FFFFFFFFFFFF ),
- LONG2CHARS( 0x000FFFFFFFFFFFFF ),
- LONG2CHARS( 0x001FFFFFFFFFFFFF ),
- LONG2CHARS( 0x003FFFFFFFFFFFFF ),
- LONG2CHARS( 0x007FFFFFFFFFFFFF ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFF ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFF ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFF ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000002 ),
- LONG2CHARS( 0x0000000000000006 ),
- LONG2CHARS( 0x000000000000000E ),
- LONG2CHARS( 0x000000000000001E ),
- LONG2CHARS( 0x000000000000003E ),
- LONG2CHARS( 0x000000000000007E ),
- LONG2CHARS( 0x00000000000000FE ),
- LONG2CHARS( 0x00000000000001FE ),
- LONG2CHARS( 0x00000000000003FE ),
- LONG2CHARS( 0x00000000000007FE ),
- LONG2CHARS( 0x0000000000000FFE ),
- LONG2CHARS( 0x0000000000001FFE ),
- LONG2CHARS( 0x0000000000003FFE ),
- LONG2CHARS( 0x0000000000007FFE ),
- LONG2CHARS( 0x000000000000FFFE ),
- LONG2CHARS( 0x000000000001FFFE ),
- LONG2CHARS( 0x000000000003FFFE ),
- LONG2CHARS( 0x000000000007FFFE ),
- LONG2CHARS( 0x00000000000FFFFE ),
- LONG2CHARS( 0x00000000001FFFFE ),
- LONG2CHARS( 0x00000000003FFFFE ),
- LONG2CHARS( 0x00000000007FFFFE ),
- LONG2CHARS( 0x0000000000FFFFFE ),
- LONG2CHARS( 0x0000000001FFFFFE ),
- LONG2CHARS( 0x0000000003FFFFFE ),
- LONG2CHARS( 0x0000000007FFFFFE ),
- LONG2CHARS( 0x000000000FFFFFFE ),
- LONG2CHARS( 0x000000001FFFFFFE ),
- LONG2CHARS( 0x000000003FFFFFFE ),
- LONG2CHARS( 0x000000007FFFFFFE ),
- LONG2CHARS( 0x00000000FFFFFFFE ),
- LONG2CHARS( 0x00000001FFFFFFFE ),
- LONG2CHARS( 0x00000003FFFFFFFE ),
- LONG2CHARS( 0x00000007FFFFFFFE ),
- LONG2CHARS( 0x0000000FFFFFFFFE ),
- LONG2CHARS( 0x0000001FFFFFFFFE ),
- LONG2CHARS( 0x0000003FFFFFFFFE ),
- LONG2CHARS( 0x0000007FFFFFFFFE ),
- LONG2CHARS( 0x000000FFFFFFFFFE ),
- LONG2CHARS( 0x000001FFFFFFFFFE ),
- LONG2CHARS( 0x000003FFFFFFFFFE ),
- LONG2CHARS( 0x000007FFFFFFFFFE ),
- LONG2CHARS( 0x00000FFFFFFFFFFE ),
- LONG2CHARS( 0x00001FFFFFFFFFFE ),
- LONG2CHARS( 0x00003FFFFFFFFFFE ),
- LONG2CHARS( 0x00007FFFFFFFFFFE ),
- LONG2CHARS( 0x0000FFFFFFFFFFFE ),
- LONG2CHARS( 0x0001FFFFFFFFFFFE ),
- LONG2CHARS( 0x0003FFFFFFFFFFFE ),
- LONG2CHARS( 0x0007FFFFFFFFFFFE ),
- LONG2CHARS( 0x000FFFFFFFFFFFFE ),
- LONG2CHARS( 0x001FFFFFFFFFFFFE ),
- LONG2CHARS( 0x003FFFFFFFFFFFFE ),
- LONG2CHARS( 0x007FFFFFFFFFFFFE ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFE ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFE ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFE ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000004 ),
- LONG2CHARS( 0x000000000000000C ),
- LONG2CHARS( 0x000000000000001C ),
- LONG2CHARS( 0x000000000000003C ),
- LONG2CHARS( 0x000000000000007C ),
- LONG2CHARS( 0x00000000000000FC ),
- LONG2CHARS( 0x00000000000001FC ),
- LONG2CHARS( 0x00000000000003FC ),
- LONG2CHARS( 0x00000000000007FC ),
- LONG2CHARS( 0x0000000000000FFC ),
- LONG2CHARS( 0x0000000000001FFC ),
- LONG2CHARS( 0x0000000000003FFC ),
- LONG2CHARS( 0x0000000000007FFC ),
- LONG2CHARS( 0x000000000000FFFC ),
- LONG2CHARS( 0x000000000001FFFC ),
- LONG2CHARS( 0x000000000003FFFC ),
- LONG2CHARS( 0x000000000007FFFC ),
- LONG2CHARS( 0x00000000000FFFFC ),
- LONG2CHARS( 0x00000000001FFFFC ),
- LONG2CHARS( 0x00000000003FFFFC ),
- LONG2CHARS( 0x00000000007FFFFC ),
- LONG2CHARS( 0x0000000000FFFFFC ),
- LONG2CHARS( 0x0000000001FFFFFC ),
- LONG2CHARS( 0x0000000003FFFFFC ),
- LONG2CHARS( 0x0000000007FFFFFC ),
- LONG2CHARS( 0x000000000FFFFFFC ),
- LONG2CHARS( 0x000000001FFFFFFC ),
- LONG2CHARS( 0x000000003FFFFFFC ),
- LONG2CHARS( 0x000000007FFFFFFC ),
- LONG2CHARS( 0x00000000FFFFFFFC ),
- LONG2CHARS( 0x00000001FFFFFFFC ),
- LONG2CHARS( 0x00000003FFFFFFFC ),
- LONG2CHARS( 0x00000007FFFFFFFC ),
- LONG2CHARS( 0x0000000FFFFFFFFC ),
- LONG2CHARS( 0x0000001FFFFFFFFC ),
- LONG2CHARS( 0x0000003FFFFFFFFC ),
- LONG2CHARS( 0x0000007FFFFFFFFC ),
- LONG2CHARS( 0x000000FFFFFFFFFC ),
- LONG2CHARS( 0x000001FFFFFFFFFC ),
- LONG2CHARS( 0x000003FFFFFFFFFC ),
- LONG2CHARS( 0x000007FFFFFFFFFC ),
- LONG2CHARS( 0x00000FFFFFFFFFFC ),
- LONG2CHARS( 0x00001FFFFFFFFFFC ),
- LONG2CHARS( 0x00003FFFFFFFFFFC ),
- LONG2CHARS( 0x00007FFFFFFFFFFC ),
- LONG2CHARS( 0x0000FFFFFFFFFFFC ),
- LONG2CHARS( 0x0001FFFFFFFFFFFC ),
- LONG2CHARS( 0x0003FFFFFFFFFFFC ),
- LONG2CHARS( 0x0007FFFFFFFFFFFC ),
- LONG2CHARS( 0x000FFFFFFFFFFFFC ),
- LONG2CHARS( 0x001FFFFFFFFFFFFC ),
- LONG2CHARS( 0x003FFFFFFFFFFFFC ),
- LONG2CHARS( 0x007FFFFFFFFFFFFC ),
- LONG2CHARS( 0x00FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x01FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x03FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x07FFFFFFFFFFFFFC ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFFC ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFFC ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000008 ),
- LONG2CHARS( 0x0000000000000018 ),
- LONG2CHARS( 0x0000000000000038 ),
- LONG2CHARS( 0x0000000000000078 ),
- LONG2CHARS( 0x00000000000000F8 ),
- LONG2CHARS( 0x00000000000001F8 ),
- LONG2CHARS( 0x00000000000003F8 ),
- LONG2CHARS( 0x00000000000007F8 ),
- LONG2CHARS( 0x0000000000000FF8 ),
- LONG2CHARS( 0x0000000000001FF8 ),
- LONG2CHARS( 0x0000000000003FF8 ),
- LONG2CHARS( 0x0000000000007FF8 ),
- LONG2CHARS( 0x000000000000FFF8 ),
- LONG2CHARS( 0x000000000001FFF8 ),
- LONG2CHARS( 0x000000000003FFF8 ),
- LONG2CHARS( 0x000000000007FFF8 ),
- LONG2CHARS( 0x00000000000FFFF8 ),
- LONG2CHARS( 0x00000000001FFFF8 ),
- LONG2CHARS( 0x00000000003FFFF8 ),
- LONG2CHARS( 0x00000000007FFFF8 ),
- LONG2CHARS( 0x0000000000FFFFF8 ),
- LONG2CHARS( 0x0000000001FFFFF8 ),
- LONG2CHARS( 0x0000000003FFFFF8 ),
- LONG2CHARS( 0x0000000007FFFFF8 ),
- LONG2CHARS( 0x000000000FFFFFF8 ),
- LONG2CHARS( 0x000000001FFFFFF8 ),
- LONG2CHARS( 0x000000003FFFFFF8 ),
- LONG2CHARS( 0x000000007FFFFFF8 ),
- LONG2CHARS( 0x00000000FFFFFFF8 ),
- LONG2CHARS( 0x00000001FFFFFFF8 ),
- LONG2CHARS( 0x00000003FFFFFFF8 ),
- LONG2CHARS( 0x00000007FFFFFFF8 ),
- LONG2CHARS( 0x0000000FFFFFFFF8 ),
- LONG2CHARS( 0x0000001FFFFFFFF8 ),
- LONG2CHARS( 0x0000003FFFFFFFF8 ),
- LONG2CHARS( 0x0000007FFFFFFFF8 ),
- LONG2CHARS( 0x000000FFFFFFFFF8 ),
- LONG2CHARS( 0x000001FFFFFFFFF8 ),
- LONG2CHARS( 0x000003FFFFFFFFF8 ),
- LONG2CHARS( 0x000007FFFFFFFFF8 ),
- LONG2CHARS( 0x00000FFFFFFFFFF8 ),
- LONG2CHARS( 0x00001FFFFFFFFFF8 ),
- LONG2CHARS( 0x00003FFFFFFFFFF8 ),
- LONG2CHARS( 0x00007FFFFFFFFFF8 ),
- LONG2CHARS( 0x0000FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0001FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0003FFFFFFFFFFF8 ),
- LONG2CHARS( 0x0007FFFFFFFFFFF8 ),
- LONG2CHARS( 0x000FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x001FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x003FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x007FFFFFFFFFFFF8 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000010 ),
- LONG2CHARS( 0x0000000000000030 ),
- LONG2CHARS( 0x0000000000000070 ),
- LONG2CHARS( 0x00000000000000F0 ),
- LONG2CHARS( 0x00000000000001F0 ),
- LONG2CHARS( 0x00000000000003F0 ),
- LONG2CHARS( 0x00000000000007F0 ),
- LONG2CHARS( 0x0000000000000FF0 ),
- LONG2CHARS( 0x0000000000001FF0 ),
- LONG2CHARS( 0x0000000000003FF0 ),
- LONG2CHARS( 0x0000000000007FF0 ),
- LONG2CHARS( 0x000000000000FFF0 ),
- LONG2CHARS( 0x000000000001FFF0 ),
- LONG2CHARS( 0x000000000003FFF0 ),
- LONG2CHARS( 0x000000000007FFF0 ),
- LONG2CHARS( 0x00000000000FFFF0 ),
- LONG2CHARS( 0x00000000001FFFF0 ),
- LONG2CHARS( 0x00000000003FFFF0 ),
- LONG2CHARS( 0x00000000007FFFF0 ),
- LONG2CHARS( 0x0000000000FFFFF0 ),
- LONG2CHARS( 0x0000000001FFFFF0 ),
- LONG2CHARS( 0x0000000003FFFFF0 ),
- LONG2CHARS( 0x0000000007FFFFF0 ),
- LONG2CHARS( 0x000000000FFFFFF0 ),
- LONG2CHARS( 0x000000001FFFFFF0 ),
- LONG2CHARS( 0x000000003FFFFFF0 ),
- LONG2CHARS( 0x000000007FFFFFF0 ),
- LONG2CHARS( 0x00000000FFFFFFF0 ),
- LONG2CHARS( 0x00000001FFFFFFF0 ),
- LONG2CHARS( 0x00000003FFFFFFF0 ),
- LONG2CHARS( 0x00000007FFFFFFF0 ),
- LONG2CHARS( 0x0000000FFFFFFFF0 ),
- LONG2CHARS( 0x0000001FFFFFFFF0 ),
- LONG2CHARS( 0x0000003FFFFFFFF0 ),
- LONG2CHARS( 0x0000007FFFFFFFF0 ),
- LONG2CHARS( 0x000000FFFFFFFFF0 ),
- LONG2CHARS( 0x000001FFFFFFFFF0 ),
- LONG2CHARS( 0x000003FFFFFFFFF0 ),
- LONG2CHARS( 0x000007FFFFFFFFF0 ),
- LONG2CHARS( 0x00000FFFFFFFFFF0 ),
- LONG2CHARS( 0x00001FFFFFFFFFF0 ),
- LONG2CHARS( 0x00003FFFFFFFFFF0 ),
- LONG2CHARS( 0x00007FFFFFFFFFF0 ),
- LONG2CHARS( 0x0000FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0001FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0003FFFFFFFFFFF0 ),
- LONG2CHARS( 0x0007FFFFFFFFFFF0 ),
- LONG2CHARS( 0x000FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x001FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x003FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x007FFFFFFFFFFFF0 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000020 ),
- LONG2CHARS( 0x0000000000000060 ),
- LONG2CHARS( 0x00000000000000E0 ),
- LONG2CHARS( 0x00000000000001E0 ),
- LONG2CHARS( 0x00000000000003E0 ),
- LONG2CHARS( 0x00000000000007E0 ),
- LONG2CHARS( 0x0000000000000FE0 ),
- LONG2CHARS( 0x0000000000001FE0 ),
- LONG2CHARS( 0x0000000000003FE0 ),
- LONG2CHARS( 0x0000000000007FE0 ),
- LONG2CHARS( 0x000000000000FFE0 ),
- LONG2CHARS( 0x000000000001FFE0 ),
- LONG2CHARS( 0x000000000003FFE0 ),
- LONG2CHARS( 0x000000000007FFE0 ),
- LONG2CHARS( 0x00000000000FFFE0 ),
- LONG2CHARS( 0x00000000001FFFE0 ),
- LONG2CHARS( 0x00000000003FFFE0 ),
- LONG2CHARS( 0x00000000007FFFE0 ),
- LONG2CHARS( 0x0000000000FFFFE0 ),
- LONG2CHARS( 0x0000000001FFFFE0 ),
- LONG2CHARS( 0x0000000003FFFFE0 ),
- LONG2CHARS( 0x0000000007FFFFE0 ),
- LONG2CHARS( 0x000000000FFFFFE0 ),
- LONG2CHARS( 0x000000001FFFFFE0 ),
- LONG2CHARS( 0x000000003FFFFFE0 ),
- LONG2CHARS( 0x000000007FFFFFE0 ),
- LONG2CHARS( 0x00000000FFFFFFE0 ),
- LONG2CHARS( 0x00000001FFFFFFE0 ),
- LONG2CHARS( 0x00000003FFFFFFE0 ),
- LONG2CHARS( 0x00000007FFFFFFE0 ),
- LONG2CHARS( 0x0000000FFFFFFFE0 ),
- LONG2CHARS( 0x0000001FFFFFFFE0 ),
- LONG2CHARS( 0x0000003FFFFFFFE0 ),
- LONG2CHARS( 0x0000007FFFFFFFE0 ),
- LONG2CHARS( 0x000000FFFFFFFFE0 ),
- LONG2CHARS( 0x000001FFFFFFFFE0 ),
- LONG2CHARS( 0x000003FFFFFFFFE0 ),
- LONG2CHARS( 0x000007FFFFFFFFE0 ),
- LONG2CHARS( 0x00000FFFFFFFFFE0 ),
- LONG2CHARS( 0x00001FFFFFFFFFE0 ),
- LONG2CHARS( 0x00003FFFFFFFFFE0 ),
- LONG2CHARS( 0x00007FFFFFFFFFE0 ),
- LONG2CHARS( 0x0000FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0001FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0003FFFFFFFFFFE0 ),
- LONG2CHARS( 0x0007FFFFFFFFFFE0 ),
- LONG2CHARS( 0x000FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x001FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x003FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x007FFFFFFFFFFFE0 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000040 ),
- LONG2CHARS( 0x00000000000000C0 ),
- LONG2CHARS( 0x00000000000001C0 ),
- LONG2CHARS( 0x00000000000003C0 ),
- LONG2CHARS( 0x00000000000007C0 ),
- LONG2CHARS( 0x0000000000000FC0 ),
- LONG2CHARS( 0x0000000000001FC0 ),
- LONG2CHARS( 0x0000000000003FC0 ),
- LONG2CHARS( 0x0000000000007FC0 ),
- LONG2CHARS( 0x000000000000FFC0 ),
- LONG2CHARS( 0x000000000001FFC0 ),
- LONG2CHARS( 0x000000000003FFC0 ),
- LONG2CHARS( 0x000000000007FFC0 ),
- LONG2CHARS( 0x00000000000FFFC0 ),
- LONG2CHARS( 0x00000000001FFFC0 ),
- LONG2CHARS( 0x00000000003FFFC0 ),
- LONG2CHARS( 0x00000000007FFFC0 ),
- LONG2CHARS( 0x0000000000FFFFC0 ),
- LONG2CHARS( 0x0000000001FFFFC0 ),
- LONG2CHARS( 0x0000000003FFFFC0 ),
- LONG2CHARS( 0x0000000007FFFFC0 ),
- LONG2CHARS( 0x000000000FFFFFC0 ),
- LONG2CHARS( 0x000000001FFFFFC0 ),
- LONG2CHARS( 0x000000003FFFFFC0 ),
- LONG2CHARS( 0x000000007FFFFFC0 ),
- LONG2CHARS( 0x00000000FFFFFFC0 ),
- LONG2CHARS( 0x00000001FFFFFFC0 ),
- LONG2CHARS( 0x00000003FFFFFFC0 ),
- LONG2CHARS( 0x00000007FFFFFFC0 ),
- LONG2CHARS( 0x0000000FFFFFFFC0 ),
- LONG2CHARS( 0x0000001FFFFFFFC0 ),
- LONG2CHARS( 0x0000003FFFFFFFC0 ),
- LONG2CHARS( 0x0000007FFFFFFFC0 ),
- LONG2CHARS( 0x000000FFFFFFFFC0 ),
- LONG2CHARS( 0x000001FFFFFFFFC0 ),
- LONG2CHARS( 0x000003FFFFFFFFC0 ),
- LONG2CHARS( 0x000007FFFFFFFFC0 ),
- LONG2CHARS( 0x00000FFFFFFFFFC0 ),
- LONG2CHARS( 0x00001FFFFFFFFFC0 ),
- LONG2CHARS( 0x00003FFFFFFFFFC0 ),
- LONG2CHARS( 0x00007FFFFFFFFFC0 ),
- LONG2CHARS( 0x0000FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0001FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0003FFFFFFFFFFC0 ),
- LONG2CHARS( 0x0007FFFFFFFFFFC0 ),
- LONG2CHARS( 0x000FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x001FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x003FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x007FFFFFFFFFFFC0 ),
- LONG2CHARS( 0x00FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x01FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x03FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x07FFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000080 ),
- LONG2CHARS( 0x0000000000000180 ),
- LONG2CHARS( 0x0000000000000380 ),
- LONG2CHARS( 0x0000000000000780 ),
- LONG2CHARS( 0x0000000000000F80 ),
- LONG2CHARS( 0x0000000000001F80 ),
- LONG2CHARS( 0x0000000000003F80 ),
- LONG2CHARS( 0x0000000000007F80 ),
- LONG2CHARS( 0x000000000000FF80 ),
- LONG2CHARS( 0x000000000001FF80 ),
- LONG2CHARS( 0x000000000003FF80 ),
- LONG2CHARS( 0x000000000007FF80 ),
- LONG2CHARS( 0x00000000000FFF80 ),
- LONG2CHARS( 0x00000000001FFF80 ),
- LONG2CHARS( 0x00000000003FFF80 ),
- LONG2CHARS( 0x00000000007FFF80 ),
- LONG2CHARS( 0x0000000000FFFF80 ),
- LONG2CHARS( 0x0000000001FFFF80 ),
- LONG2CHARS( 0x0000000003FFFF80 ),
- LONG2CHARS( 0x0000000007FFFF80 ),
- LONG2CHARS( 0x000000000FFFFF80 ),
- LONG2CHARS( 0x000000001FFFFF80 ),
- LONG2CHARS( 0x000000003FFFFF80 ),
- LONG2CHARS( 0x000000007FFFFF80 ),
- LONG2CHARS( 0x00000000FFFFFF80 ),
- LONG2CHARS( 0x00000001FFFFFF80 ),
- LONG2CHARS( 0x00000003FFFFFF80 ),
- LONG2CHARS( 0x00000007FFFFFF80 ),
- LONG2CHARS( 0x0000000FFFFFFF80 ),
- LONG2CHARS( 0x0000001FFFFFFF80 ),
- LONG2CHARS( 0x0000003FFFFFFF80 ),
- LONG2CHARS( 0x0000007FFFFFFF80 ),
- LONG2CHARS( 0x000000FFFFFFFF80 ),
- LONG2CHARS( 0x000001FFFFFFFF80 ),
- LONG2CHARS( 0x000003FFFFFFFF80 ),
- LONG2CHARS( 0x000007FFFFFFFF80 ),
- LONG2CHARS( 0x00000FFFFFFFFF80 ),
- LONG2CHARS( 0x00001FFFFFFFFF80 ),
- LONG2CHARS( 0x00003FFFFFFFFF80 ),
- LONG2CHARS( 0x00007FFFFFFFFF80 ),
- LONG2CHARS( 0x0000FFFFFFFFFF80 ),
- LONG2CHARS( 0x0001FFFFFFFFFF80 ),
- LONG2CHARS( 0x0003FFFFFFFFFF80 ),
- LONG2CHARS( 0x0007FFFFFFFFFF80 ),
- LONG2CHARS( 0x000FFFFFFFFFFF80 ),
- LONG2CHARS( 0x001FFFFFFFFFFF80 ),
- LONG2CHARS( 0x003FFFFFFFFFFF80 ),
- LONG2CHARS( 0x007FFFFFFFFFFF80 ),
- LONG2CHARS( 0x00FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x01FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x03FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x07FFFFFFFFFFFF80 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFF80 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF80 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000100 ),
- LONG2CHARS( 0x0000000000000300 ),
- LONG2CHARS( 0x0000000000000700 ),
- LONG2CHARS( 0x0000000000000F00 ),
- LONG2CHARS( 0x0000000000001F00 ),
- LONG2CHARS( 0x0000000000003F00 ),
- LONG2CHARS( 0x0000000000007F00 ),
- LONG2CHARS( 0x000000000000FF00 ),
- LONG2CHARS( 0x000000000001FF00 ),
- LONG2CHARS( 0x000000000003FF00 ),
- LONG2CHARS( 0x000000000007FF00 ),
- LONG2CHARS( 0x00000000000FFF00 ),
- LONG2CHARS( 0x00000000001FFF00 ),
- LONG2CHARS( 0x00000000003FFF00 ),
- LONG2CHARS( 0x00000000007FFF00 ),
- LONG2CHARS( 0x0000000000FFFF00 ),
- LONG2CHARS( 0x0000000001FFFF00 ),
- LONG2CHARS( 0x0000000003FFFF00 ),
- LONG2CHARS( 0x0000000007FFFF00 ),
- LONG2CHARS( 0x000000000FFFFF00 ),
- LONG2CHARS( 0x000000001FFFFF00 ),
- LONG2CHARS( 0x000000003FFFFF00 ),
- LONG2CHARS( 0x000000007FFFFF00 ),
- LONG2CHARS( 0x00000000FFFFFF00 ),
- LONG2CHARS( 0x00000001FFFFFF00 ),
- LONG2CHARS( 0x00000003FFFFFF00 ),
- LONG2CHARS( 0x00000007FFFFFF00 ),
- LONG2CHARS( 0x0000000FFFFFFF00 ),
- LONG2CHARS( 0x0000001FFFFFFF00 ),
- LONG2CHARS( 0x0000003FFFFFFF00 ),
- LONG2CHARS( 0x0000007FFFFFFF00 ),
- LONG2CHARS( 0x000000FFFFFFFF00 ),
- LONG2CHARS( 0x000001FFFFFFFF00 ),
- LONG2CHARS( 0x000003FFFFFFFF00 ),
- LONG2CHARS( 0x000007FFFFFFFF00 ),
- LONG2CHARS( 0x00000FFFFFFFFF00 ),
- LONG2CHARS( 0x00001FFFFFFFFF00 ),
- LONG2CHARS( 0x00003FFFFFFFFF00 ),
- LONG2CHARS( 0x00007FFFFFFFFF00 ),
- LONG2CHARS( 0x0000FFFFFFFFFF00 ),
- LONG2CHARS( 0x0001FFFFFFFFFF00 ),
- LONG2CHARS( 0x0003FFFFFFFFFF00 ),
- LONG2CHARS( 0x0007FFFFFFFFFF00 ),
- LONG2CHARS( 0x000FFFFFFFFFFF00 ),
- LONG2CHARS( 0x001FFFFFFFFFFF00 ),
- LONG2CHARS( 0x003FFFFFFFFFFF00 ),
- LONG2CHARS( 0x007FFFFFFFFFFF00 ),
- LONG2CHARS( 0x00FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x01FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x03FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x07FFFFFFFFFFFF00 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFF00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFF00 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000200 ),
- LONG2CHARS( 0x0000000000000600 ),
- LONG2CHARS( 0x0000000000000E00 ),
- LONG2CHARS( 0x0000000000001E00 ),
- LONG2CHARS( 0x0000000000003E00 ),
- LONG2CHARS( 0x0000000000007E00 ),
- LONG2CHARS( 0x000000000000FE00 ),
- LONG2CHARS( 0x000000000001FE00 ),
- LONG2CHARS( 0x000000000003FE00 ),
- LONG2CHARS( 0x000000000007FE00 ),
- LONG2CHARS( 0x00000000000FFE00 ),
- LONG2CHARS( 0x00000000001FFE00 ),
- LONG2CHARS( 0x00000000003FFE00 ),
- LONG2CHARS( 0x00000000007FFE00 ),
- LONG2CHARS( 0x0000000000FFFE00 ),
- LONG2CHARS( 0x0000000001FFFE00 ),
- LONG2CHARS( 0x0000000003FFFE00 ),
- LONG2CHARS( 0x0000000007FFFE00 ),
- LONG2CHARS( 0x000000000FFFFE00 ),
- LONG2CHARS( 0x000000001FFFFE00 ),
- LONG2CHARS( 0x000000003FFFFE00 ),
- LONG2CHARS( 0x000000007FFFFE00 ),
- LONG2CHARS( 0x00000000FFFFFE00 ),
- LONG2CHARS( 0x00000001FFFFFE00 ),
- LONG2CHARS( 0x00000003FFFFFE00 ),
- LONG2CHARS( 0x00000007FFFFFE00 ),
- LONG2CHARS( 0x0000000FFFFFFE00 ),
- LONG2CHARS( 0x0000001FFFFFFE00 ),
- LONG2CHARS( 0x0000003FFFFFFE00 ),
- LONG2CHARS( 0x0000007FFFFFFE00 ),
- LONG2CHARS( 0x000000FFFFFFFE00 ),
- LONG2CHARS( 0x000001FFFFFFFE00 ),
- LONG2CHARS( 0x000003FFFFFFFE00 ),
- LONG2CHARS( 0x000007FFFFFFFE00 ),
- LONG2CHARS( 0x00000FFFFFFFFE00 ),
- LONG2CHARS( 0x00001FFFFFFFFE00 ),
- LONG2CHARS( 0x00003FFFFFFFFE00 ),
- LONG2CHARS( 0x00007FFFFFFFFE00 ),
- LONG2CHARS( 0x0000FFFFFFFFFE00 ),
- LONG2CHARS( 0x0001FFFFFFFFFE00 ),
- LONG2CHARS( 0x0003FFFFFFFFFE00 ),
- LONG2CHARS( 0x0007FFFFFFFFFE00 ),
- LONG2CHARS( 0x000FFFFFFFFFFE00 ),
- LONG2CHARS( 0x001FFFFFFFFFFE00 ),
- LONG2CHARS( 0x003FFFFFFFFFFE00 ),
- LONG2CHARS( 0x007FFFFFFFFFFE00 ),
- LONG2CHARS( 0x00FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x01FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x03FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x07FFFFFFFFFFFE00 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFE00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFE00 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000400 ),
- LONG2CHARS( 0x0000000000000C00 ),
- LONG2CHARS( 0x0000000000001C00 ),
- LONG2CHARS( 0x0000000000003C00 ),
- LONG2CHARS( 0x0000000000007C00 ),
- LONG2CHARS( 0x000000000000FC00 ),
- LONG2CHARS( 0x000000000001FC00 ),
- LONG2CHARS( 0x000000000003FC00 ),
- LONG2CHARS( 0x000000000007FC00 ),
- LONG2CHARS( 0x00000000000FFC00 ),
- LONG2CHARS( 0x00000000001FFC00 ),
- LONG2CHARS( 0x00000000003FFC00 ),
- LONG2CHARS( 0x00000000007FFC00 ),
- LONG2CHARS( 0x0000000000FFFC00 ),
- LONG2CHARS( 0x0000000001FFFC00 ),
- LONG2CHARS( 0x0000000003FFFC00 ),
- LONG2CHARS( 0x0000000007FFFC00 ),
- LONG2CHARS( 0x000000000FFFFC00 ),
- LONG2CHARS( 0x000000001FFFFC00 ),
- LONG2CHARS( 0x000000003FFFFC00 ),
- LONG2CHARS( 0x000000007FFFFC00 ),
- LONG2CHARS( 0x00000000FFFFFC00 ),
- LONG2CHARS( 0x00000001FFFFFC00 ),
- LONG2CHARS( 0x00000003FFFFFC00 ),
- LONG2CHARS( 0x00000007FFFFFC00 ),
- LONG2CHARS( 0x0000000FFFFFFC00 ),
- LONG2CHARS( 0x0000001FFFFFFC00 ),
- LONG2CHARS( 0x0000003FFFFFFC00 ),
- LONG2CHARS( 0x0000007FFFFFFC00 ),
- LONG2CHARS( 0x000000FFFFFFFC00 ),
- LONG2CHARS( 0x000001FFFFFFFC00 ),
- LONG2CHARS( 0x000003FFFFFFFC00 ),
- LONG2CHARS( 0x000007FFFFFFFC00 ),
- LONG2CHARS( 0x00000FFFFFFFFC00 ),
- LONG2CHARS( 0x00001FFFFFFFFC00 ),
- LONG2CHARS( 0x00003FFFFFFFFC00 ),
- LONG2CHARS( 0x00007FFFFFFFFC00 ),
- LONG2CHARS( 0x0000FFFFFFFFFC00 ),
- LONG2CHARS( 0x0001FFFFFFFFFC00 ),
- LONG2CHARS( 0x0003FFFFFFFFFC00 ),
- LONG2CHARS( 0x0007FFFFFFFFFC00 ),
- LONG2CHARS( 0x000FFFFFFFFFFC00 ),
- LONG2CHARS( 0x001FFFFFFFFFFC00 ),
- LONG2CHARS( 0x003FFFFFFFFFFC00 ),
- LONG2CHARS( 0x007FFFFFFFFFFC00 ),
- LONG2CHARS( 0x00FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x01FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x03FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x07FFFFFFFFFFFC00 ),
- LONG2CHARS( 0x0FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x1FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x3FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x7FFFFFFFFFFFFC00 ),
- LONG2CHARS( 0xFFFFFFFFFFFFFC00 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000800 ),
- LONG2CHARS( 0x0000000000001800 ),
- LONG2CHARS( 0x0000000000003800 ),
- LONG2CHARS( 0x0000000000007800 ),
- LONG2CHARS( 0x000000000000F800 ),
- LONG2CHARS( 0x000000000001F800 ),
- LONG2CHARS( 0x000000000003F800 ),
- LONG2CHARS( 0x000000000007F800 ),
- LONG2CHARS( 0x00000000000FF800 ),
- LONG2CHARS( 0x00000000001FF800 ),
- LONG2CHARS( 0x00000000003FF800 ),
- LONG2CHARS( 0x00000000007FF800 ),
- LONG2CHARS( 0x0000000000FFF800 ),
- LONG2CHARS( 0x0000000001FFF800 ),
- LONG2CHARS( 0x0000000003FFF800 ),
- LONG2CHARS( 0x0000000007FFF800 ),
- LONG2CHARS( 0x000000000FFFF800 ),
- LONG2CHARS( 0x000000001FFFF800 ),
- LONG2CHARS( 0x000000003FFFF800 ),
- LONG2CHARS( 0x000000007FFFF800 ),
- LONG2CHARS( 0x00000000FFFFF800 ),
- LONG2CHARS( 0x00000001FFFFF800 ),
- LONG2CHARS( 0x00000003FFFFF800 ),
- LONG2CHARS( 0x00000007FFFFF800 ),
- LONG2CHARS( 0x0000000FFFFFF800 ),
- LONG2CHARS( 0x0000001FFFFFF800 ),
- LONG2CHARS( 0x0000003FFFFFF800 ),
- LONG2CHARS( 0x0000007FFFFFF800 ),
- LONG2CHARS( 0x000000FFFFFFF800 ),
- LONG2CHARS( 0x000001FFFFFFF800 ),
- LONG2CHARS( 0x000003FFFFFFF800 ),
- LONG2CHARS( 0x000007FFFFFFF800 ),
- LONG2CHARS( 0x00000FFFFFFFF800 ),
- LONG2CHARS( 0x00001FFFFFFFF800 ),
- LONG2CHARS( 0x00003FFFFFFFF800 ),
- LONG2CHARS( 0x00007FFFFFFFF800 ),
- LONG2CHARS( 0x0000FFFFFFFFF800 ),
- LONG2CHARS( 0x0001FFFFFFFFF800 ),
- LONG2CHARS( 0x0003FFFFFFFFF800 ),
- LONG2CHARS( 0x0007FFFFFFFFF800 ),
- LONG2CHARS( 0x000FFFFFFFFFF800 ),
- LONG2CHARS( 0x001FFFFFFFFFF800 ),
- LONG2CHARS( 0x003FFFFFFFFFF800 ),
- LONG2CHARS( 0x007FFFFFFFFFF800 ),
- LONG2CHARS( 0x00FFFFFFFFFFF800 ),
- LONG2CHARS( 0x01FFFFFFFFFFF800 ),
- LONG2CHARS( 0x03FFFFFFFFFFF800 ),
- LONG2CHARS( 0x07FFFFFFFFFFF800 ),
- LONG2CHARS( 0x0FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x1FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x3FFFFFFFFFFFF800 ),
- LONG2CHARS( 0x7FFFFFFFFFFFF800 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF800 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000001000 ),
- LONG2CHARS( 0x0000000000003000 ),
- LONG2CHARS( 0x0000000000007000 ),
- LONG2CHARS( 0x000000000000F000 ),
- LONG2CHARS( 0x000000000001F000 ),
- LONG2CHARS( 0x000000000003F000 ),
- LONG2CHARS( 0x000000000007F000 ),
- LONG2CHARS( 0x00000000000FF000 ),
- LONG2CHARS( 0x00000000001FF000 ),
- LONG2CHARS( 0x00000000003FF000 ),
- LONG2CHARS( 0x00000000007FF000 ),
- LONG2CHARS( 0x0000000000FFF000 ),
- LONG2CHARS( 0x0000000001FFF000 ),
- LONG2CHARS( 0x0000000003FFF000 ),
- LONG2CHARS( 0x0000000007FFF000 ),
- LONG2CHARS( 0x000000000FFFF000 ),
- LONG2CHARS( 0x000000001FFFF000 ),
- LONG2CHARS( 0x000000003FFFF000 ),
- LONG2CHARS( 0x000000007FFFF000 ),
- LONG2CHARS( 0x00000000FFFFF000 ),
- LONG2CHARS( 0x00000001FFFFF000 ),
- LONG2CHARS( 0x00000003FFFFF000 ),
- LONG2CHARS( 0x00000007FFFFF000 ),
- LONG2CHARS( 0x0000000FFFFFF000 ),
- LONG2CHARS( 0x0000001FFFFFF000 ),
- LONG2CHARS( 0x0000003FFFFFF000 ),
- LONG2CHARS( 0x0000007FFFFFF000 ),
- LONG2CHARS( 0x000000FFFFFFF000 ),
- LONG2CHARS( 0x000001FFFFFFF000 ),
- LONG2CHARS( 0x000003FFFFFFF000 ),
- LONG2CHARS( 0x000007FFFFFFF000 ),
- LONG2CHARS( 0x00000FFFFFFFF000 ),
- LONG2CHARS( 0x00001FFFFFFFF000 ),
- LONG2CHARS( 0x00003FFFFFFFF000 ),
- LONG2CHARS( 0x00007FFFFFFFF000 ),
- LONG2CHARS( 0x0000FFFFFFFFF000 ),
- LONG2CHARS( 0x0001FFFFFFFFF000 ),
- LONG2CHARS( 0x0003FFFFFFFFF000 ),
- LONG2CHARS( 0x0007FFFFFFFFF000 ),
- LONG2CHARS( 0x000FFFFFFFFFF000 ),
- LONG2CHARS( 0x001FFFFFFFFFF000 ),
- LONG2CHARS( 0x003FFFFFFFFFF000 ),
- LONG2CHARS( 0x007FFFFFFFFFF000 ),
- LONG2CHARS( 0x00FFFFFFFFFFF000 ),
- LONG2CHARS( 0x01FFFFFFFFFFF000 ),
- LONG2CHARS( 0x03FFFFFFFFFFF000 ),
- LONG2CHARS( 0x07FFFFFFFFFFF000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFF000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFF000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFF000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000002000 ),
- LONG2CHARS( 0x0000000000006000 ),
- LONG2CHARS( 0x000000000000E000 ),
- LONG2CHARS( 0x000000000001E000 ),
- LONG2CHARS( 0x000000000003E000 ),
- LONG2CHARS( 0x000000000007E000 ),
- LONG2CHARS( 0x00000000000FE000 ),
- LONG2CHARS( 0x00000000001FE000 ),
- LONG2CHARS( 0x00000000003FE000 ),
- LONG2CHARS( 0x00000000007FE000 ),
- LONG2CHARS( 0x0000000000FFE000 ),
- LONG2CHARS( 0x0000000001FFE000 ),
- LONG2CHARS( 0x0000000003FFE000 ),
- LONG2CHARS( 0x0000000007FFE000 ),
- LONG2CHARS( 0x000000000FFFE000 ),
- LONG2CHARS( 0x000000001FFFE000 ),
- LONG2CHARS( 0x000000003FFFE000 ),
- LONG2CHARS( 0x000000007FFFE000 ),
- LONG2CHARS( 0x00000000FFFFE000 ),
- LONG2CHARS( 0x00000001FFFFE000 ),
- LONG2CHARS( 0x00000003FFFFE000 ),
- LONG2CHARS( 0x00000007FFFFE000 ),
- LONG2CHARS( 0x0000000FFFFFE000 ),
- LONG2CHARS( 0x0000001FFFFFE000 ),
- LONG2CHARS( 0x0000003FFFFFE000 ),
- LONG2CHARS( 0x0000007FFFFFE000 ),
- LONG2CHARS( 0x000000FFFFFFE000 ),
- LONG2CHARS( 0x000001FFFFFFE000 ),
- LONG2CHARS( 0x000003FFFFFFE000 ),
- LONG2CHARS( 0x000007FFFFFFE000 ),
- LONG2CHARS( 0x00000FFFFFFFE000 ),
- LONG2CHARS( 0x00001FFFFFFFE000 ),
- LONG2CHARS( 0x00003FFFFFFFE000 ),
- LONG2CHARS( 0x00007FFFFFFFE000 ),
- LONG2CHARS( 0x0000FFFFFFFFE000 ),
- LONG2CHARS( 0x0001FFFFFFFFE000 ),
- LONG2CHARS( 0x0003FFFFFFFFE000 ),
- LONG2CHARS( 0x0007FFFFFFFFE000 ),
- LONG2CHARS( 0x000FFFFFFFFFE000 ),
- LONG2CHARS( 0x001FFFFFFFFFE000 ),
- LONG2CHARS( 0x003FFFFFFFFFE000 ),
- LONG2CHARS( 0x007FFFFFFFFFE000 ),
- LONG2CHARS( 0x00FFFFFFFFFFE000 ),
- LONG2CHARS( 0x01FFFFFFFFFFE000 ),
- LONG2CHARS( 0x03FFFFFFFFFFE000 ),
- LONG2CHARS( 0x07FFFFFFFFFFE000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFE000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFE000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFE000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000004000 ),
- LONG2CHARS( 0x000000000000C000 ),
- LONG2CHARS( 0x000000000001C000 ),
- LONG2CHARS( 0x000000000003C000 ),
- LONG2CHARS( 0x000000000007C000 ),
- LONG2CHARS( 0x00000000000FC000 ),
- LONG2CHARS( 0x00000000001FC000 ),
- LONG2CHARS( 0x00000000003FC000 ),
- LONG2CHARS( 0x00000000007FC000 ),
- LONG2CHARS( 0x0000000000FFC000 ),
- LONG2CHARS( 0x0000000001FFC000 ),
- LONG2CHARS( 0x0000000003FFC000 ),
- LONG2CHARS( 0x0000000007FFC000 ),
- LONG2CHARS( 0x000000000FFFC000 ),
- LONG2CHARS( 0x000000001FFFC000 ),
- LONG2CHARS( 0x000000003FFFC000 ),
- LONG2CHARS( 0x000000007FFFC000 ),
- LONG2CHARS( 0x00000000FFFFC000 ),
- LONG2CHARS( 0x00000001FFFFC000 ),
- LONG2CHARS( 0x00000003FFFFC000 ),
- LONG2CHARS( 0x00000007FFFFC000 ),
- LONG2CHARS( 0x0000000FFFFFC000 ),
- LONG2CHARS( 0x0000001FFFFFC000 ),
- LONG2CHARS( 0x0000003FFFFFC000 ),
- LONG2CHARS( 0x0000007FFFFFC000 ),
- LONG2CHARS( 0x000000FFFFFFC000 ),
- LONG2CHARS( 0x000001FFFFFFC000 ),
- LONG2CHARS( 0x000003FFFFFFC000 ),
- LONG2CHARS( 0x000007FFFFFFC000 ),
- LONG2CHARS( 0x00000FFFFFFFC000 ),
- LONG2CHARS( 0x00001FFFFFFFC000 ),
- LONG2CHARS( 0x00003FFFFFFFC000 ),
- LONG2CHARS( 0x00007FFFFFFFC000 ),
- LONG2CHARS( 0x0000FFFFFFFFC000 ),
- LONG2CHARS( 0x0001FFFFFFFFC000 ),
- LONG2CHARS( 0x0003FFFFFFFFC000 ),
- LONG2CHARS( 0x0007FFFFFFFFC000 ),
- LONG2CHARS( 0x000FFFFFFFFFC000 ),
- LONG2CHARS( 0x001FFFFFFFFFC000 ),
- LONG2CHARS( 0x003FFFFFFFFFC000 ),
- LONG2CHARS( 0x007FFFFFFFFFC000 ),
- LONG2CHARS( 0x00FFFFFFFFFFC000 ),
- LONG2CHARS( 0x01FFFFFFFFFFC000 ),
- LONG2CHARS( 0x03FFFFFFFFFFC000 ),
- LONG2CHARS( 0x07FFFFFFFFFFC000 ),
- LONG2CHARS( 0x0FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x1FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x3FFFFFFFFFFFC000 ),
- LONG2CHARS( 0x7FFFFFFFFFFFC000 ),
- LONG2CHARS( 0xFFFFFFFFFFFFC000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000008000 ),
- LONG2CHARS( 0x0000000000018000 ),
- LONG2CHARS( 0x0000000000038000 ),
- LONG2CHARS( 0x0000000000078000 ),
- LONG2CHARS( 0x00000000000F8000 ),
- LONG2CHARS( 0x00000000001F8000 ),
- LONG2CHARS( 0x00000000003F8000 ),
- LONG2CHARS( 0x00000000007F8000 ),
- LONG2CHARS( 0x0000000000FF8000 ),
- LONG2CHARS( 0x0000000001FF8000 ),
- LONG2CHARS( 0x0000000003FF8000 ),
- LONG2CHARS( 0x0000000007FF8000 ),
- LONG2CHARS( 0x000000000FFF8000 ),
- LONG2CHARS( 0x000000001FFF8000 ),
- LONG2CHARS( 0x000000003FFF8000 ),
- LONG2CHARS( 0x000000007FFF8000 ),
- LONG2CHARS( 0x00000000FFFF8000 ),
- LONG2CHARS( 0x00000001FFFF8000 ),
- LONG2CHARS( 0x00000003FFFF8000 ),
- LONG2CHARS( 0x00000007FFFF8000 ),
- LONG2CHARS( 0x0000000FFFFF8000 ),
- LONG2CHARS( 0x0000001FFFFF8000 ),
- LONG2CHARS( 0x0000003FFFFF8000 ),
- LONG2CHARS( 0x0000007FFFFF8000 ),
- LONG2CHARS( 0x000000FFFFFF8000 ),
- LONG2CHARS( 0x000001FFFFFF8000 ),
- LONG2CHARS( 0x000003FFFFFF8000 ),
- LONG2CHARS( 0x000007FFFFFF8000 ),
- LONG2CHARS( 0x00000FFFFFFF8000 ),
- LONG2CHARS( 0x00001FFFFFFF8000 ),
- LONG2CHARS( 0x00003FFFFFFF8000 ),
- LONG2CHARS( 0x00007FFFFFFF8000 ),
- LONG2CHARS( 0x0000FFFFFFFF8000 ),
- LONG2CHARS( 0x0001FFFFFFFF8000 ),
- LONG2CHARS( 0x0003FFFFFFFF8000 ),
- LONG2CHARS( 0x0007FFFFFFFF8000 ),
- LONG2CHARS( 0x000FFFFFFFFF8000 ),
- LONG2CHARS( 0x001FFFFFFFFF8000 ),
- LONG2CHARS( 0x003FFFFFFFFF8000 ),
- LONG2CHARS( 0x007FFFFFFFFF8000 ),
- LONG2CHARS( 0x00FFFFFFFFFF8000 ),
- LONG2CHARS( 0x01FFFFFFFFFF8000 ),
- LONG2CHARS( 0x03FFFFFFFFFF8000 ),
- LONG2CHARS( 0x07FFFFFFFFFF8000 ),
- LONG2CHARS( 0x0FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x1FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x3FFFFFFFFFFF8000 ),
- LONG2CHARS( 0x7FFFFFFFFFFF8000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF8000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000010000 ),
- LONG2CHARS( 0x0000000000030000 ),
- LONG2CHARS( 0x0000000000070000 ),
- LONG2CHARS( 0x00000000000F0000 ),
- LONG2CHARS( 0x00000000001F0000 ),
- LONG2CHARS( 0x00000000003F0000 ),
- LONG2CHARS( 0x00000000007F0000 ),
- LONG2CHARS( 0x0000000000FF0000 ),
- LONG2CHARS( 0x0000000001FF0000 ),
- LONG2CHARS( 0x0000000003FF0000 ),
- LONG2CHARS( 0x0000000007FF0000 ),
- LONG2CHARS( 0x000000000FFF0000 ),
- LONG2CHARS( 0x000000001FFF0000 ),
- LONG2CHARS( 0x000000003FFF0000 ),
- LONG2CHARS( 0x000000007FFF0000 ),
- LONG2CHARS( 0x00000000FFFF0000 ),
- LONG2CHARS( 0x00000001FFFF0000 ),
- LONG2CHARS( 0x00000003FFFF0000 ),
- LONG2CHARS( 0x00000007FFFF0000 ),
- LONG2CHARS( 0x0000000FFFFF0000 ),
- LONG2CHARS( 0x0000001FFFFF0000 ),
- LONG2CHARS( 0x0000003FFFFF0000 ),
- LONG2CHARS( 0x0000007FFFFF0000 ),
- LONG2CHARS( 0x000000FFFFFF0000 ),
- LONG2CHARS( 0x000001FFFFFF0000 ),
- LONG2CHARS( 0x000003FFFFFF0000 ),
- LONG2CHARS( 0x000007FFFFFF0000 ),
- LONG2CHARS( 0x00000FFFFFFF0000 ),
- LONG2CHARS( 0x00001FFFFFFF0000 ),
- LONG2CHARS( 0x00003FFFFFFF0000 ),
- LONG2CHARS( 0x00007FFFFFFF0000 ),
- LONG2CHARS( 0x0000FFFFFFFF0000 ),
- LONG2CHARS( 0x0001FFFFFFFF0000 ),
- LONG2CHARS( 0x0003FFFFFFFF0000 ),
- LONG2CHARS( 0x0007FFFFFFFF0000 ),
- LONG2CHARS( 0x000FFFFFFFFF0000 ),
- LONG2CHARS( 0x001FFFFFFFFF0000 ),
- LONG2CHARS( 0x003FFFFFFFFF0000 ),
- LONG2CHARS( 0x007FFFFFFFFF0000 ),
- LONG2CHARS( 0x00FFFFFFFFFF0000 ),
- LONG2CHARS( 0x01FFFFFFFFFF0000 ),
- LONG2CHARS( 0x03FFFFFFFFFF0000 ),
- LONG2CHARS( 0x07FFFFFFFFFF0000 ),
- LONG2CHARS( 0x0FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x1FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x3FFFFFFFFFFF0000 ),
- LONG2CHARS( 0x7FFFFFFFFFFF0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFF0000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000020000 ),
- LONG2CHARS( 0x0000000000060000 ),
- LONG2CHARS( 0x00000000000E0000 ),
- LONG2CHARS( 0x00000000001E0000 ),
- LONG2CHARS( 0x00000000003E0000 ),
- LONG2CHARS( 0x00000000007E0000 ),
- LONG2CHARS( 0x0000000000FE0000 ),
- LONG2CHARS( 0x0000000001FE0000 ),
- LONG2CHARS( 0x0000000003FE0000 ),
- LONG2CHARS( 0x0000000007FE0000 ),
- LONG2CHARS( 0x000000000FFE0000 ),
- LONG2CHARS( 0x000000001FFE0000 ),
- LONG2CHARS( 0x000000003FFE0000 ),
- LONG2CHARS( 0x000000007FFE0000 ),
- LONG2CHARS( 0x00000000FFFE0000 ),
- LONG2CHARS( 0x00000001FFFE0000 ),
- LONG2CHARS( 0x00000003FFFE0000 ),
- LONG2CHARS( 0x00000007FFFE0000 ),
- LONG2CHARS( 0x0000000FFFFE0000 ),
- LONG2CHARS( 0x0000001FFFFE0000 ),
- LONG2CHARS( 0x0000003FFFFE0000 ),
- LONG2CHARS( 0x0000007FFFFE0000 ),
- LONG2CHARS( 0x000000FFFFFE0000 ),
- LONG2CHARS( 0x000001FFFFFE0000 ),
- LONG2CHARS( 0x000003FFFFFE0000 ),
- LONG2CHARS( 0x000007FFFFFE0000 ),
- LONG2CHARS( 0x00000FFFFFFE0000 ),
- LONG2CHARS( 0x00001FFFFFFE0000 ),
- LONG2CHARS( 0x00003FFFFFFE0000 ),
- LONG2CHARS( 0x00007FFFFFFE0000 ),
- LONG2CHARS( 0x0000FFFFFFFE0000 ),
- LONG2CHARS( 0x0001FFFFFFFE0000 ),
- LONG2CHARS( 0x0003FFFFFFFE0000 ),
- LONG2CHARS( 0x0007FFFFFFFE0000 ),
- LONG2CHARS( 0x000FFFFFFFFE0000 ),
- LONG2CHARS( 0x001FFFFFFFFE0000 ),
- LONG2CHARS( 0x003FFFFFFFFE0000 ),
- LONG2CHARS( 0x007FFFFFFFFE0000 ),
- LONG2CHARS( 0x00FFFFFFFFFE0000 ),
- LONG2CHARS( 0x01FFFFFFFFFE0000 ),
- LONG2CHARS( 0x03FFFFFFFFFE0000 ),
- LONG2CHARS( 0x07FFFFFFFFFE0000 ),
- LONG2CHARS( 0x0FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x1FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x3FFFFFFFFFFE0000 ),
- LONG2CHARS( 0x7FFFFFFFFFFE0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFE0000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000040000 ),
- LONG2CHARS( 0x00000000000C0000 ),
- LONG2CHARS( 0x00000000001C0000 ),
- LONG2CHARS( 0x00000000003C0000 ),
- LONG2CHARS( 0x00000000007C0000 ),
- LONG2CHARS( 0x0000000000FC0000 ),
- LONG2CHARS( 0x0000000001FC0000 ),
- LONG2CHARS( 0x0000000003FC0000 ),
- LONG2CHARS( 0x0000000007FC0000 ),
- LONG2CHARS( 0x000000000FFC0000 ),
- LONG2CHARS( 0x000000001FFC0000 ),
- LONG2CHARS( 0x000000003FFC0000 ),
- LONG2CHARS( 0x000000007FFC0000 ),
- LONG2CHARS( 0x00000000FFFC0000 ),
- LONG2CHARS( 0x00000001FFFC0000 ),
- LONG2CHARS( 0x00000003FFFC0000 ),
- LONG2CHARS( 0x00000007FFFC0000 ),
- LONG2CHARS( 0x0000000FFFFC0000 ),
- LONG2CHARS( 0x0000001FFFFC0000 ),
- LONG2CHARS( 0x0000003FFFFC0000 ),
- LONG2CHARS( 0x0000007FFFFC0000 ),
- LONG2CHARS( 0x000000FFFFFC0000 ),
- LONG2CHARS( 0x000001FFFFFC0000 ),
- LONG2CHARS( 0x000003FFFFFC0000 ),
- LONG2CHARS( 0x000007FFFFFC0000 ),
- LONG2CHARS( 0x00000FFFFFFC0000 ),
- LONG2CHARS( 0x00001FFFFFFC0000 ),
- LONG2CHARS( 0x00003FFFFFFC0000 ),
- LONG2CHARS( 0x00007FFFFFFC0000 ),
- LONG2CHARS( 0x0000FFFFFFFC0000 ),
- LONG2CHARS( 0x0001FFFFFFFC0000 ),
- LONG2CHARS( 0x0003FFFFFFFC0000 ),
- LONG2CHARS( 0x0007FFFFFFFC0000 ),
- LONG2CHARS( 0x000FFFFFFFFC0000 ),
- LONG2CHARS( 0x001FFFFFFFFC0000 ),
- LONG2CHARS( 0x003FFFFFFFFC0000 ),
- LONG2CHARS( 0x007FFFFFFFFC0000 ),
- LONG2CHARS( 0x00FFFFFFFFFC0000 ),
- LONG2CHARS( 0x01FFFFFFFFFC0000 ),
- LONG2CHARS( 0x03FFFFFFFFFC0000 ),
- LONG2CHARS( 0x07FFFFFFFFFC0000 ),
- LONG2CHARS( 0x0FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x1FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x3FFFFFFFFFFC0000 ),
- LONG2CHARS( 0x7FFFFFFFFFFC0000 ),
- LONG2CHARS( 0xFFFFFFFFFFFC0000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000080000 ),
- LONG2CHARS( 0x0000000000180000 ),
- LONG2CHARS( 0x0000000000380000 ),
- LONG2CHARS( 0x0000000000780000 ),
- LONG2CHARS( 0x0000000000F80000 ),
- LONG2CHARS( 0x0000000001F80000 ),
- LONG2CHARS( 0x0000000003F80000 ),
- LONG2CHARS( 0x0000000007F80000 ),
- LONG2CHARS( 0x000000000FF80000 ),
- LONG2CHARS( 0x000000001FF80000 ),
- LONG2CHARS( 0x000000003FF80000 ),
- LONG2CHARS( 0x000000007FF80000 ),
- LONG2CHARS( 0x00000000FFF80000 ),
- LONG2CHARS( 0x00000001FFF80000 ),
- LONG2CHARS( 0x00000003FFF80000 ),
- LONG2CHARS( 0x00000007FFF80000 ),
- LONG2CHARS( 0x0000000FFFF80000 ),
- LONG2CHARS( 0x0000001FFFF80000 ),
- LONG2CHARS( 0x0000003FFFF80000 ),
- LONG2CHARS( 0x0000007FFFF80000 ),
- LONG2CHARS( 0x000000FFFFF80000 ),
- LONG2CHARS( 0x000001FFFFF80000 ),
- LONG2CHARS( 0x000003FFFFF80000 ),
- LONG2CHARS( 0x000007FFFFF80000 ),
- LONG2CHARS( 0x00000FFFFFF80000 ),
- LONG2CHARS( 0x00001FFFFFF80000 ),
- LONG2CHARS( 0x00003FFFFFF80000 ),
- LONG2CHARS( 0x00007FFFFFF80000 ),
- LONG2CHARS( 0x0000FFFFFFF80000 ),
- LONG2CHARS( 0x0001FFFFFFF80000 ),
- LONG2CHARS( 0x0003FFFFFFF80000 ),
- LONG2CHARS( 0x0007FFFFFFF80000 ),
- LONG2CHARS( 0x000FFFFFFFF80000 ),
- LONG2CHARS( 0x001FFFFFFFF80000 ),
- LONG2CHARS( 0x003FFFFFFFF80000 ),
- LONG2CHARS( 0x007FFFFFFFF80000 ),
- LONG2CHARS( 0x00FFFFFFFFF80000 ),
- LONG2CHARS( 0x01FFFFFFFFF80000 ),
- LONG2CHARS( 0x03FFFFFFFFF80000 ),
- LONG2CHARS( 0x07FFFFFFFFF80000 ),
- LONG2CHARS( 0x0FFFFFFFFFF80000 ),
- LONG2CHARS( 0x1FFFFFFFFFF80000 ),
- LONG2CHARS( 0x3FFFFFFFFFF80000 ),
- LONG2CHARS( 0x7FFFFFFFFFF80000 ),
- LONG2CHARS( 0xFFFFFFFFFFF80000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000100000 ),
- LONG2CHARS( 0x0000000000300000 ),
- LONG2CHARS( 0x0000000000700000 ),
- LONG2CHARS( 0x0000000000F00000 ),
- LONG2CHARS( 0x0000000001F00000 ),
- LONG2CHARS( 0x0000000003F00000 ),
- LONG2CHARS( 0x0000000007F00000 ),
- LONG2CHARS( 0x000000000FF00000 ),
- LONG2CHARS( 0x000000001FF00000 ),
- LONG2CHARS( 0x000000003FF00000 ),
- LONG2CHARS( 0x000000007FF00000 ),
- LONG2CHARS( 0x00000000FFF00000 ),
- LONG2CHARS( 0x00000001FFF00000 ),
- LONG2CHARS( 0x00000003FFF00000 ),
- LONG2CHARS( 0x00000007FFF00000 ),
- LONG2CHARS( 0x0000000FFFF00000 ),
- LONG2CHARS( 0x0000001FFFF00000 ),
- LONG2CHARS( 0x0000003FFFF00000 ),
- LONG2CHARS( 0x0000007FFFF00000 ),
- LONG2CHARS( 0x000000FFFFF00000 ),
- LONG2CHARS( 0x000001FFFFF00000 ),
- LONG2CHARS( 0x000003FFFFF00000 ),
- LONG2CHARS( 0x000007FFFFF00000 ),
- LONG2CHARS( 0x00000FFFFFF00000 ),
- LONG2CHARS( 0x00001FFFFFF00000 ),
- LONG2CHARS( 0x00003FFFFFF00000 ),
- LONG2CHARS( 0x00007FFFFFF00000 ),
- LONG2CHARS( 0x0000FFFFFFF00000 ),
- LONG2CHARS( 0x0001FFFFFFF00000 ),
- LONG2CHARS( 0x0003FFFFFFF00000 ),
- LONG2CHARS( 0x0007FFFFFFF00000 ),
- LONG2CHARS( 0x000FFFFFFFF00000 ),
- LONG2CHARS( 0x001FFFFFFFF00000 ),
- LONG2CHARS( 0x003FFFFFFFF00000 ),
- LONG2CHARS( 0x007FFFFFFFF00000 ),
- LONG2CHARS( 0x00FFFFFFFFF00000 ),
- LONG2CHARS( 0x01FFFFFFFFF00000 ),
- LONG2CHARS( 0x03FFFFFFFFF00000 ),
- LONG2CHARS( 0x07FFFFFFFFF00000 ),
- LONG2CHARS( 0x0FFFFFFFFFF00000 ),
- LONG2CHARS( 0x1FFFFFFFFFF00000 ),
- LONG2CHARS( 0x3FFFFFFFFFF00000 ),
- LONG2CHARS( 0x7FFFFFFFFFF00000 ),
- LONG2CHARS( 0xFFFFFFFFFFF00000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000200000 ),
- LONG2CHARS( 0x0000000000600000 ),
- LONG2CHARS( 0x0000000000E00000 ),
- LONG2CHARS( 0x0000000001E00000 ),
- LONG2CHARS( 0x0000000003E00000 ),
- LONG2CHARS( 0x0000000007E00000 ),
- LONG2CHARS( 0x000000000FE00000 ),
- LONG2CHARS( 0x000000001FE00000 ),
- LONG2CHARS( 0x000000003FE00000 ),
- LONG2CHARS( 0x000000007FE00000 ),
- LONG2CHARS( 0x00000000FFE00000 ),
- LONG2CHARS( 0x00000001FFE00000 ),
- LONG2CHARS( 0x00000003FFE00000 ),
- LONG2CHARS( 0x00000007FFE00000 ),
- LONG2CHARS( 0x0000000FFFE00000 ),
- LONG2CHARS( 0x0000001FFFE00000 ),
- LONG2CHARS( 0x0000003FFFE00000 ),
- LONG2CHARS( 0x0000007FFFE00000 ),
- LONG2CHARS( 0x000000FFFFE00000 ),
- LONG2CHARS( 0x000001FFFFE00000 ),
- LONG2CHARS( 0x000003FFFFE00000 ),
- LONG2CHARS( 0x000007FFFFE00000 ),
- LONG2CHARS( 0x00000FFFFFE00000 ),
- LONG2CHARS( 0x00001FFFFFE00000 ),
- LONG2CHARS( 0x00003FFFFFE00000 ),
- LONG2CHARS( 0x00007FFFFFE00000 ),
- LONG2CHARS( 0x0000FFFFFFE00000 ),
- LONG2CHARS( 0x0001FFFFFFE00000 ),
- LONG2CHARS( 0x0003FFFFFFE00000 ),
- LONG2CHARS( 0x0007FFFFFFE00000 ),
- LONG2CHARS( 0x000FFFFFFFE00000 ),
- LONG2CHARS( 0x001FFFFFFFE00000 ),
- LONG2CHARS( 0x003FFFFFFFE00000 ),
- LONG2CHARS( 0x007FFFFFFFE00000 ),
- LONG2CHARS( 0x00FFFFFFFFE00000 ),
- LONG2CHARS( 0x01FFFFFFFFE00000 ),
- LONG2CHARS( 0x03FFFFFFFFE00000 ),
- LONG2CHARS( 0x07FFFFFFFFE00000 ),
- LONG2CHARS( 0x0FFFFFFFFFE00000 ),
- LONG2CHARS( 0x1FFFFFFFFFE00000 ),
- LONG2CHARS( 0x3FFFFFFFFFE00000 ),
- LONG2CHARS( 0x7FFFFFFFFFE00000 ),
- LONG2CHARS( 0xFFFFFFFFFFE00000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000400000 ),
- LONG2CHARS( 0x0000000000C00000 ),
- LONG2CHARS( 0x0000000001C00000 ),
- LONG2CHARS( 0x0000000003C00000 ),
- LONG2CHARS( 0x0000000007C00000 ),
- LONG2CHARS( 0x000000000FC00000 ),
- LONG2CHARS( 0x000000001FC00000 ),
- LONG2CHARS( 0x000000003FC00000 ),
- LONG2CHARS( 0x000000007FC00000 ),
- LONG2CHARS( 0x00000000FFC00000 ),
- LONG2CHARS( 0x00000001FFC00000 ),
- LONG2CHARS( 0x00000003FFC00000 ),
- LONG2CHARS( 0x00000007FFC00000 ),
- LONG2CHARS( 0x0000000FFFC00000 ),
- LONG2CHARS( 0x0000001FFFC00000 ),
- LONG2CHARS( 0x0000003FFFC00000 ),
- LONG2CHARS( 0x0000007FFFC00000 ),
- LONG2CHARS( 0x000000FFFFC00000 ),
- LONG2CHARS( 0x000001FFFFC00000 ),
- LONG2CHARS( 0x000003FFFFC00000 ),
- LONG2CHARS( 0x000007FFFFC00000 ),
- LONG2CHARS( 0x00000FFFFFC00000 ),
- LONG2CHARS( 0x00001FFFFFC00000 ),
- LONG2CHARS( 0x00003FFFFFC00000 ),
- LONG2CHARS( 0x00007FFFFFC00000 ),
- LONG2CHARS( 0x0000FFFFFFC00000 ),
- LONG2CHARS( 0x0001FFFFFFC00000 ),
- LONG2CHARS( 0x0003FFFFFFC00000 ),
- LONG2CHARS( 0x0007FFFFFFC00000 ),
- LONG2CHARS( 0x000FFFFFFFC00000 ),
- LONG2CHARS( 0x001FFFFFFFC00000 ),
- LONG2CHARS( 0x003FFFFFFFC00000 ),
- LONG2CHARS( 0x007FFFFFFFC00000 ),
- LONG2CHARS( 0x00FFFFFFFFC00000 ),
- LONG2CHARS( 0x01FFFFFFFFC00000 ),
- LONG2CHARS( 0x03FFFFFFFFC00000 ),
- LONG2CHARS( 0x07FFFFFFFFC00000 ),
- LONG2CHARS( 0x0FFFFFFFFFC00000 ),
- LONG2CHARS( 0x1FFFFFFFFFC00000 ),
- LONG2CHARS( 0x3FFFFFFFFFC00000 ),
- LONG2CHARS( 0x7FFFFFFFFFC00000 ),
- LONG2CHARS( 0xFFFFFFFFFFC00000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000800000 ),
- LONG2CHARS( 0x0000000001800000 ),
- LONG2CHARS( 0x0000000003800000 ),
- LONG2CHARS( 0x0000000007800000 ),
- LONG2CHARS( 0x000000000F800000 ),
- LONG2CHARS( 0x000000001F800000 ),
- LONG2CHARS( 0x000000003F800000 ),
- LONG2CHARS( 0x000000007F800000 ),
- LONG2CHARS( 0x00000000FF800000 ),
- LONG2CHARS( 0x00000001FF800000 ),
- LONG2CHARS( 0x00000003FF800000 ),
- LONG2CHARS( 0x00000007FF800000 ),
- LONG2CHARS( 0x0000000FFF800000 ),
- LONG2CHARS( 0x0000001FFF800000 ),
- LONG2CHARS( 0x0000003FFF800000 ),
- LONG2CHARS( 0x0000007FFF800000 ),
- LONG2CHARS( 0x000000FFFF800000 ),
- LONG2CHARS( 0x000001FFFF800000 ),
- LONG2CHARS( 0x000003FFFF800000 ),
- LONG2CHARS( 0x000007FFFF800000 ),
- LONG2CHARS( 0x00000FFFFF800000 ),
- LONG2CHARS( 0x00001FFFFF800000 ),
- LONG2CHARS( 0x00003FFFFF800000 ),
- LONG2CHARS( 0x00007FFFFF800000 ),
- LONG2CHARS( 0x0000FFFFFF800000 ),
- LONG2CHARS( 0x0001FFFFFF800000 ),
- LONG2CHARS( 0x0003FFFFFF800000 ),
- LONG2CHARS( 0x0007FFFFFF800000 ),
- LONG2CHARS( 0x000FFFFFFF800000 ),
- LONG2CHARS( 0x001FFFFFFF800000 ),
- LONG2CHARS( 0x003FFFFFFF800000 ),
- LONG2CHARS( 0x007FFFFFFF800000 ),
- LONG2CHARS( 0x00FFFFFFFF800000 ),
- LONG2CHARS( 0x01FFFFFFFF800000 ),
- LONG2CHARS( 0x03FFFFFFFF800000 ),
- LONG2CHARS( 0x07FFFFFFFF800000 ),
- LONG2CHARS( 0x0FFFFFFFFF800000 ),
- LONG2CHARS( 0x1FFFFFFFFF800000 ),
- LONG2CHARS( 0x3FFFFFFFFF800000 ),
- LONG2CHARS( 0x7FFFFFFFFF800000 ),
- LONG2CHARS( 0xFFFFFFFFFF800000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000001000000 ),
- LONG2CHARS( 0x0000000003000000 ),
- LONG2CHARS( 0x0000000007000000 ),
- LONG2CHARS( 0x000000000F000000 ),
- LONG2CHARS( 0x000000001F000000 ),
- LONG2CHARS( 0x000000003F000000 ),
- LONG2CHARS( 0x000000007F000000 ),
- LONG2CHARS( 0x00000000FF000000 ),
- LONG2CHARS( 0x00000001FF000000 ),
- LONG2CHARS( 0x00000003FF000000 ),
- LONG2CHARS( 0x00000007FF000000 ),
- LONG2CHARS( 0x0000000FFF000000 ),
- LONG2CHARS( 0x0000001FFF000000 ),
- LONG2CHARS( 0x0000003FFF000000 ),
- LONG2CHARS( 0x0000007FFF000000 ),
- LONG2CHARS( 0x000000FFFF000000 ),
- LONG2CHARS( 0x000001FFFF000000 ),
- LONG2CHARS( 0x000003FFFF000000 ),
- LONG2CHARS( 0x000007FFFF000000 ),
- LONG2CHARS( 0x00000FFFFF000000 ),
- LONG2CHARS( 0x00001FFFFF000000 ),
- LONG2CHARS( 0x00003FFFFF000000 ),
- LONG2CHARS( 0x00007FFFFF000000 ),
- LONG2CHARS( 0x0000FFFFFF000000 ),
- LONG2CHARS( 0x0001FFFFFF000000 ),
- LONG2CHARS( 0x0003FFFFFF000000 ),
- LONG2CHARS( 0x0007FFFFFF000000 ),
- LONG2CHARS( 0x000FFFFFFF000000 ),
- LONG2CHARS( 0x001FFFFFFF000000 ),
- LONG2CHARS( 0x003FFFFFFF000000 ),
- LONG2CHARS( 0x007FFFFFFF000000 ),
- LONG2CHARS( 0x00FFFFFFFF000000 ),
- LONG2CHARS( 0x01FFFFFFFF000000 ),
- LONG2CHARS( 0x03FFFFFFFF000000 ),
- LONG2CHARS( 0x07FFFFFFFF000000 ),
- LONG2CHARS( 0x0FFFFFFFFF000000 ),
- LONG2CHARS( 0x1FFFFFFFFF000000 ),
- LONG2CHARS( 0x3FFFFFFFFF000000 ),
- LONG2CHARS( 0x7FFFFFFFFF000000 ),
- LONG2CHARS( 0xFFFFFFFFFF000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000002000000 ),
- LONG2CHARS( 0x0000000006000000 ),
- LONG2CHARS( 0x000000000E000000 ),
- LONG2CHARS( 0x000000001E000000 ),
- LONG2CHARS( 0x000000003E000000 ),
- LONG2CHARS( 0x000000007E000000 ),
- LONG2CHARS( 0x00000000FE000000 ),
- LONG2CHARS( 0x00000001FE000000 ),
- LONG2CHARS( 0x00000003FE000000 ),
- LONG2CHARS( 0x00000007FE000000 ),
- LONG2CHARS( 0x0000000FFE000000 ),
- LONG2CHARS( 0x0000001FFE000000 ),
- LONG2CHARS( 0x0000003FFE000000 ),
- LONG2CHARS( 0x0000007FFE000000 ),
- LONG2CHARS( 0x000000FFFE000000 ),
- LONG2CHARS( 0x000001FFFE000000 ),
- LONG2CHARS( 0x000003FFFE000000 ),
- LONG2CHARS( 0x000007FFFE000000 ),
- LONG2CHARS( 0x00000FFFFE000000 ),
- LONG2CHARS( 0x00001FFFFE000000 ),
- LONG2CHARS( 0x00003FFFFE000000 ),
- LONG2CHARS( 0x00007FFFFE000000 ),
- LONG2CHARS( 0x0000FFFFFE000000 ),
- LONG2CHARS( 0x0001FFFFFE000000 ),
- LONG2CHARS( 0x0003FFFFFE000000 ),
- LONG2CHARS( 0x0007FFFFFE000000 ),
- LONG2CHARS( 0x000FFFFFFE000000 ),
- LONG2CHARS( 0x001FFFFFFE000000 ),
- LONG2CHARS( 0x003FFFFFFE000000 ),
- LONG2CHARS( 0x007FFFFFFE000000 ),
- LONG2CHARS( 0x00FFFFFFFE000000 ),
- LONG2CHARS( 0x01FFFFFFFE000000 ),
- LONG2CHARS( 0x03FFFFFFFE000000 ),
- LONG2CHARS( 0x07FFFFFFFE000000 ),
- LONG2CHARS( 0x0FFFFFFFFE000000 ),
- LONG2CHARS( 0x1FFFFFFFFE000000 ),
- LONG2CHARS( 0x3FFFFFFFFE000000 ),
- LONG2CHARS( 0x7FFFFFFFFE000000 ),
- LONG2CHARS( 0xFFFFFFFFFE000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000004000000 ),
- LONG2CHARS( 0x000000000C000000 ),
- LONG2CHARS( 0x000000001C000000 ),
- LONG2CHARS( 0x000000003C000000 ),
- LONG2CHARS( 0x000000007C000000 ),
- LONG2CHARS( 0x00000000FC000000 ),
- LONG2CHARS( 0x00000001FC000000 ),
- LONG2CHARS( 0x00000003FC000000 ),
- LONG2CHARS( 0x00000007FC000000 ),
- LONG2CHARS( 0x0000000FFC000000 ),
- LONG2CHARS( 0x0000001FFC000000 ),
- LONG2CHARS( 0x0000003FFC000000 ),
- LONG2CHARS( 0x0000007FFC000000 ),
- LONG2CHARS( 0x000000FFFC000000 ),
- LONG2CHARS( 0x000001FFFC000000 ),
- LONG2CHARS( 0x000003FFFC000000 ),
- LONG2CHARS( 0x000007FFFC000000 ),
- LONG2CHARS( 0x00000FFFFC000000 ),
- LONG2CHARS( 0x00001FFFFC000000 ),
- LONG2CHARS( 0x00003FFFFC000000 ),
- LONG2CHARS( 0x00007FFFFC000000 ),
- LONG2CHARS( 0x0000FFFFFC000000 ),
- LONG2CHARS( 0x0001FFFFFC000000 ),
- LONG2CHARS( 0x0003FFFFFC000000 ),
- LONG2CHARS( 0x0007FFFFFC000000 ),
- LONG2CHARS( 0x000FFFFFFC000000 ),
- LONG2CHARS( 0x001FFFFFFC000000 ),
- LONG2CHARS( 0x003FFFFFFC000000 ),
- LONG2CHARS( 0x007FFFFFFC000000 ),
- LONG2CHARS( 0x00FFFFFFFC000000 ),
- LONG2CHARS( 0x01FFFFFFFC000000 ),
- LONG2CHARS( 0x03FFFFFFFC000000 ),
- LONG2CHARS( 0x07FFFFFFFC000000 ),
- LONG2CHARS( 0x0FFFFFFFFC000000 ),
- LONG2CHARS( 0x1FFFFFFFFC000000 ),
- LONG2CHARS( 0x3FFFFFFFFC000000 ),
- LONG2CHARS( 0x7FFFFFFFFC000000 ),
- LONG2CHARS( 0xFFFFFFFFFC000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000008000000 ),
- LONG2CHARS( 0x0000000018000000 ),
- LONG2CHARS( 0x0000000038000000 ),
- LONG2CHARS( 0x0000000078000000 ),
- LONG2CHARS( 0x00000000F8000000 ),
- LONG2CHARS( 0x00000001F8000000 ),
- LONG2CHARS( 0x00000003F8000000 ),
- LONG2CHARS( 0x00000007F8000000 ),
- LONG2CHARS( 0x0000000FF8000000 ),
- LONG2CHARS( 0x0000001FF8000000 ),
- LONG2CHARS( 0x0000003FF8000000 ),
- LONG2CHARS( 0x0000007FF8000000 ),
- LONG2CHARS( 0x000000FFF8000000 ),
- LONG2CHARS( 0x000001FFF8000000 ),
- LONG2CHARS( 0x000003FFF8000000 ),
- LONG2CHARS( 0x000007FFF8000000 ),
- LONG2CHARS( 0x00000FFFF8000000 ),
- LONG2CHARS( 0x00001FFFF8000000 ),
- LONG2CHARS( 0x00003FFFF8000000 ),
- LONG2CHARS( 0x00007FFFF8000000 ),
- LONG2CHARS( 0x0000FFFFF8000000 ),
- LONG2CHARS( 0x0001FFFFF8000000 ),
- LONG2CHARS( 0x0003FFFFF8000000 ),
- LONG2CHARS( 0x0007FFFFF8000000 ),
- LONG2CHARS( 0x000FFFFFF8000000 ),
- LONG2CHARS( 0x001FFFFFF8000000 ),
- LONG2CHARS( 0x003FFFFFF8000000 ),
- LONG2CHARS( 0x007FFFFFF8000000 ),
- LONG2CHARS( 0x00FFFFFFF8000000 ),
- LONG2CHARS( 0x01FFFFFFF8000000 ),
- LONG2CHARS( 0x03FFFFFFF8000000 ),
- LONG2CHARS( 0x07FFFFFFF8000000 ),
- LONG2CHARS( 0x0FFFFFFFF8000000 ),
- LONG2CHARS( 0x1FFFFFFFF8000000 ),
- LONG2CHARS( 0x3FFFFFFFF8000000 ),
- LONG2CHARS( 0x7FFFFFFFF8000000 ),
- LONG2CHARS( 0xFFFFFFFFF8000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000010000000 ),
- LONG2CHARS( 0x0000000030000000 ),
- LONG2CHARS( 0x0000000070000000 ),
- LONG2CHARS( 0x00000000F0000000 ),
- LONG2CHARS( 0x00000001F0000000 ),
- LONG2CHARS( 0x00000003F0000000 ),
- LONG2CHARS( 0x00000007F0000000 ),
- LONG2CHARS( 0x0000000FF0000000 ),
- LONG2CHARS( 0x0000001FF0000000 ),
- LONG2CHARS( 0x0000003FF0000000 ),
- LONG2CHARS( 0x0000007FF0000000 ),
- LONG2CHARS( 0x000000FFF0000000 ),
- LONG2CHARS( 0x000001FFF0000000 ),
- LONG2CHARS( 0x000003FFF0000000 ),
- LONG2CHARS( 0x000007FFF0000000 ),
- LONG2CHARS( 0x00000FFFF0000000 ),
- LONG2CHARS( 0x00001FFFF0000000 ),
- LONG2CHARS( 0x00003FFFF0000000 ),
- LONG2CHARS( 0x00007FFFF0000000 ),
- LONG2CHARS( 0x0000FFFFF0000000 ),
- LONG2CHARS( 0x0001FFFFF0000000 ),
- LONG2CHARS( 0x0003FFFFF0000000 ),
- LONG2CHARS( 0x0007FFFFF0000000 ),
- LONG2CHARS( 0x000FFFFFF0000000 ),
- LONG2CHARS( 0x001FFFFFF0000000 ),
- LONG2CHARS( 0x003FFFFFF0000000 ),
- LONG2CHARS( 0x007FFFFFF0000000 ),
- LONG2CHARS( 0x00FFFFFFF0000000 ),
- LONG2CHARS( 0x01FFFFFFF0000000 ),
- LONG2CHARS( 0x03FFFFFFF0000000 ),
- LONG2CHARS( 0x07FFFFFFF0000000 ),
- LONG2CHARS( 0x0FFFFFFFF0000000 ),
- LONG2CHARS( 0x1FFFFFFFF0000000 ),
- LONG2CHARS( 0x3FFFFFFFF0000000 ),
- LONG2CHARS( 0x7FFFFFFFF0000000 ),
- LONG2CHARS( 0xFFFFFFFFF0000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000020000000 ),
- LONG2CHARS( 0x0000000060000000 ),
- LONG2CHARS( 0x00000000E0000000 ),
- LONG2CHARS( 0x00000001E0000000 ),
- LONG2CHARS( 0x00000003E0000000 ),
- LONG2CHARS( 0x00000007E0000000 ),
- LONG2CHARS( 0x0000000FE0000000 ),
- LONG2CHARS( 0x0000001FE0000000 ),
- LONG2CHARS( 0x0000003FE0000000 ),
- LONG2CHARS( 0x0000007FE0000000 ),
- LONG2CHARS( 0x000000FFE0000000 ),
- LONG2CHARS( 0x000001FFE0000000 ),
- LONG2CHARS( 0x000003FFE0000000 ),
- LONG2CHARS( 0x000007FFE0000000 ),
- LONG2CHARS( 0x00000FFFE0000000 ),
- LONG2CHARS( 0x00001FFFE0000000 ),
- LONG2CHARS( 0x00003FFFE0000000 ),
- LONG2CHARS( 0x00007FFFE0000000 ),
- LONG2CHARS( 0x0000FFFFE0000000 ),
- LONG2CHARS( 0x0001FFFFE0000000 ),
- LONG2CHARS( 0x0003FFFFE0000000 ),
- LONG2CHARS( 0x0007FFFFE0000000 ),
- LONG2CHARS( 0x000FFFFFE0000000 ),
- LONG2CHARS( 0x001FFFFFE0000000 ),
- LONG2CHARS( 0x003FFFFFE0000000 ),
- LONG2CHARS( 0x007FFFFFE0000000 ),
- LONG2CHARS( 0x00FFFFFFE0000000 ),
- LONG2CHARS( 0x01FFFFFFE0000000 ),
- LONG2CHARS( 0x03FFFFFFE0000000 ),
- LONG2CHARS( 0x07FFFFFFE0000000 ),
- LONG2CHARS( 0x0FFFFFFFE0000000 ),
- LONG2CHARS( 0x1FFFFFFFE0000000 ),
- LONG2CHARS( 0x3FFFFFFFE0000000 ),
- LONG2CHARS( 0x7FFFFFFFE0000000 ),
- LONG2CHARS( 0xFFFFFFFFE0000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000040000000 ),
- LONG2CHARS( 0x00000000C0000000 ),
- LONG2CHARS( 0x00000001C0000000 ),
- LONG2CHARS( 0x00000003C0000000 ),
- LONG2CHARS( 0x00000007C0000000 ),
- LONG2CHARS( 0x0000000FC0000000 ),
- LONG2CHARS( 0x0000001FC0000000 ),
- LONG2CHARS( 0x0000003FC0000000 ),
- LONG2CHARS( 0x0000007FC0000000 ),
- LONG2CHARS( 0x000000FFC0000000 ),
- LONG2CHARS( 0x000001FFC0000000 ),
- LONG2CHARS( 0x000003FFC0000000 ),
- LONG2CHARS( 0x000007FFC0000000 ),
- LONG2CHARS( 0x00000FFFC0000000 ),
- LONG2CHARS( 0x00001FFFC0000000 ),
- LONG2CHARS( 0x00003FFFC0000000 ),
- LONG2CHARS( 0x00007FFFC0000000 ),
- LONG2CHARS( 0x0000FFFFC0000000 ),
- LONG2CHARS( 0x0001FFFFC0000000 ),
- LONG2CHARS( 0x0003FFFFC0000000 ),
- LONG2CHARS( 0x0007FFFFC0000000 ),
- LONG2CHARS( 0x000FFFFFC0000000 ),
- LONG2CHARS( 0x001FFFFFC0000000 ),
- LONG2CHARS( 0x003FFFFFC0000000 ),
- LONG2CHARS( 0x007FFFFFC0000000 ),
- LONG2CHARS( 0x00FFFFFFC0000000 ),
- LONG2CHARS( 0x01FFFFFFC0000000 ),
- LONG2CHARS( 0x03FFFFFFC0000000 ),
- LONG2CHARS( 0x07FFFFFFC0000000 ),
- LONG2CHARS( 0x0FFFFFFFC0000000 ),
- LONG2CHARS( 0x1FFFFFFFC0000000 ),
- LONG2CHARS( 0x3FFFFFFFC0000000 ),
- LONG2CHARS( 0x7FFFFFFFC0000000 ),
- LONG2CHARS( 0xFFFFFFFFC0000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000080000000 ),
- LONG2CHARS( 0x0000000180000000 ),
- LONG2CHARS( 0x0000000380000000 ),
- LONG2CHARS( 0x0000000780000000 ),
- LONG2CHARS( 0x0000000F80000000 ),
- LONG2CHARS( 0x0000001F80000000 ),
- LONG2CHARS( 0x0000003F80000000 ),
- LONG2CHARS( 0x0000007F80000000 ),
- LONG2CHARS( 0x000000FF80000000 ),
- LONG2CHARS( 0x000001FF80000000 ),
- LONG2CHARS( 0x000003FF80000000 ),
- LONG2CHARS( 0x000007FF80000000 ),
- LONG2CHARS( 0x00000FFF80000000 ),
- LONG2CHARS( 0x00001FFF80000000 ),
- LONG2CHARS( 0x00003FFF80000000 ),
- LONG2CHARS( 0x00007FFF80000000 ),
- LONG2CHARS( 0x0000FFFF80000000 ),
- LONG2CHARS( 0x0001FFFF80000000 ),
- LONG2CHARS( 0x0003FFFF80000000 ),
- LONG2CHARS( 0x0007FFFF80000000 ),
- LONG2CHARS( 0x000FFFFF80000000 ),
- LONG2CHARS( 0x001FFFFF80000000 ),
- LONG2CHARS( 0x003FFFFF80000000 ),
- LONG2CHARS( 0x007FFFFF80000000 ),
- LONG2CHARS( 0x00FFFFFF80000000 ),
- LONG2CHARS( 0x01FFFFFF80000000 ),
- LONG2CHARS( 0x03FFFFFF80000000 ),
- LONG2CHARS( 0x07FFFFFF80000000 ),
- LONG2CHARS( 0x0FFFFFFF80000000 ),
- LONG2CHARS( 0x1FFFFFFF80000000 ),
- LONG2CHARS( 0x3FFFFFFF80000000 ),
- LONG2CHARS( 0x7FFFFFFF80000000 ),
- LONG2CHARS( 0xFFFFFFFF80000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000100000000 ),
- LONG2CHARS( 0x0000000300000000 ),
- LONG2CHARS( 0x0000000700000000 ),
- LONG2CHARS( 0x0000000F00000000 ),
- LONG2CHARS( 0x0000001F00000000 ),
- LONG2CHARS( 0x0000003F00000000 ),
- LONG2CHARS( 0x0000007F00000000 ),
- LONG2CHARS( 0x000000FF00000000 ),
- LONG2CHARS( 0x000001FF00000000 ),
- LONG2CHARS( 0x000003FF00000000 ),
- LONG2CHARS( 0x000007FF00000000 ),
- LONG2CHARS( 0x00000FFF00000000 ),
- LONG2CHARS( 0x00001FFF00000000 ),
- LONG2CHARS( 0x00003FFF00000000 ),
- LONG2CHARS( 0x00007FFF00000000 ),
- LONG2CHARS( 0x0000FFFF00000000 ),
- LONG2CHARS( 0x0001FFFF00000000 ),
- LONG2CHARS( 0x0003FFFF00000000 ),
- LONG2CHARS( 0x0007FFFF00000000 ),
- LONG2CHARS( 0x000FFFFF00000000 ),
- LONG2CHARS( 0x001FFFFF00000000 ),
- LONG2CHARS( 0x003FFFFF00000000 ),
- LONG2CHARS( 0x007FFFFF00000000 ),
- LONG2CHARS( 0x00FFFFFF00000000 ),
- LONG2CHARS( 0x01FFFFFF00000000 ),
- LONG2CHARS( 0x03FFFFFF00000000 ),
- LONG2CHARS( 0x07FFFFFF00000000 ),
- LONG2CHARS( 0x0FFFFFFF00000000 ),
- LONG2CHARS( 0x1FFFFFFF00000000 ),
- LONG2CHARS( 0x3FFFFFFF00000000 ),
- LONG2CHARS( 0x7FFFFFFF00000000 ),
- LONG2CHARS( 0xFFFFFFFF00000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000200000000 ),
- LONG2CHARS( 0x0000000600000000 ),
- LONG2CHARS( 0x0000000E00000000 ),
- LONG2CHARS( 0x0000001E00000000 ),
- LONG2CHARS( 0x0000003E00000000 ),
- LONG2CHARS( 0x0000007E00000000 ),
- LONG2CHARS( 0x000000FE00000000 ),
- LONG2CHARS( 0x000001FE00000000 ),
- LONG2CHARS( 0x000003FE00000000 ),
- LONG2CHARS( 0x000007FE00000000 ),
- LONG2CHARS( 0x00000FFE00000000 ),
- LONG2CHARS( 0x00001FFE00000000 ),
- LONG2CHARS( 0x00003FFE00000000 ),
- LONG2CHARS( 0x00007FFE00000000 ),
- LONG2CHARS( 0x0000FFFE00000000 ),
- LONG2CHARS( 0x0001FFFE00000000 ),
- LONG2CHARS( 0x0003FFFE00000000 ),
- LONG2CHARS( 0x0007FFFE00000000 ),
- LONG2CHARS( 0x000FFFFE00000000 ),
- LONG2CHARS( 0x001FFFFE00000000 ),
- LONG2CHARS( 0x003FFFFE00000000 ),
- LONG2CHARS( 0x007FFFFE00000000 ),
- LONG2CHARS( 0x00FFFFFE00000000 ),
- LONG2CHARS( 0x01FFFFFE00000000 ),
- LONG2CHARS( 0x03FFFFFE00000000 ),
- LONG2CHARS( 0x07FFFFFE00000000 ),
- LONG2CHARS( 0x0FFFFFFE00000000 ),
- LONG2CHARS( 0x1FFFFFFE00000000 ),
- LONG2CHARS( 0x3FFFFFFE00000000 ),
- LONG2CHARS( 0x7FFFFFFE00000000 ),
- LONG2CHARS( 0xFFFFFFFE00000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000400000000 ),
- LONG2CHARS( 0x0000000C00000000 ),
- LONG2CHARS( 0x0000001C00000000 ),
- LONG2CHARS( 0x0000003C00000000 ),
- LONG2CHARS( 0x0000007C00000000 ),
- LONG2CHARS( 0x000000FC00000000 ),
- LONG2CHARS( 0x000001FC00000000 ),
- LONG2CHARS( 0x000003FC00000000 ),
- LONG2CHARS( 0x000007FC00000000 ),
- LONG2CHARS( 0x00000FFC00000000 ),
- LONG2CHARS( 0x00001FFC00000000 ),
- LONG2CHARS( 0x00003FFC00000000 ),
- LONG2CHARS( 0x00007FFC00000000 ),
- LONG2CHARS( 0x0000FFFC00000000 ),
- LONG2CHARS( 0x0001FFFC00000000 ),
- LONG2CHARS( 0x0003FFFC00000000 ),
- LONG2CHARS( 0x0007FFFC00000000 ),
- LONG2CHARS( 0x000FFFFC00000000 ),
- LONG2CHARS( 0x001FFFFC00000000 ),
- LONG2CHARS( 0x003FFFFC00000000 ),
- LONG2CHARS( 0x007FFFFC00000000 ),
- LONG2CHARS( 0x00FFFFFC00000000 ),
- LONG2CHARS( 0x01FFFFFC00000000 ),
- LONG2CHARS( 0x03FFFFFC00000000 ),
- LONG2CHARS( 0x07FFFFFC00000000 ),
- LONG2CHARS( 0x0FFFFFFC00000000 ),
- LONG2CHARS( 0x1FFFFFFC00000000 ),
- LONG2CHARS( 0x3FFFFFFC00000000 ),
- LONG2CHARS( 0x7FFFFFFC00000000 ),
- LONG2CHARS( 0xFFFFFFFC00000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000800000000 ),
- LONG2CHARS( 0x0000001800000000 ),
- LONG2CHARS( 0x0000003800000000 ),
- LONG2CHARS( 0x0000007800000000 ),
- LONG2CHARS( 0x000000F800000000 ),
- LONG2CHARS( 0x000001F800000000 ),
- LONG2CHARS( 0x000003F800000000 ),
- LONG2CHARS( 0x000007F800000000 ),
- LONG2CHARS( 0x00000FF800000000 ),
- LONG2CHARS( 0x00001FF800000000 ),
- LONG2CHARS( 0x00003FF800000000 ),
- LONG2CHARS( 0x00007FF800000000 ),
- LONG2CHARS( 0x0000FFF800000000 ),
- LONG2CHARS( 0x0001FFF800000000 ),
- LONG2CHARS( 0x0003FFF800000000 ),
- LONG2CHARS( 0x0007FFF800000000 ),
- LONG2CHARS( 0x000FFFF800000000 ),
- LONG2CHARS( 0x001FFFF800000000 ),
- LONG2CHARS( 0x003FFFF800000000 ),
- LONG2CHARS( 0x007FFFF800000000 ),
- LONG2CHARS( 0x00FFFFF800000000 ),
- LONG2CHARS( 0x01FFFFF800000000 ),
- LONG2CHARS( 0x03FFFFF800000000 ),
- LONG2CHARS( 0x07FFFFF800000000 ),
- LONG2CHARS( 0x0FFFFFF800000000 ),
- LONG2CHARS( 0x1FFFFFF800000000 ),
- LONG2CHARS( 0x3FFFFFF800000000 ),
- LONG2CHARS( 0x7FFFFFF800000000 ),
- LONG2CHARS( 0xFFFFFFF800000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000001000000000 ),
- LONG2CHARS( 0x0000003000000000 ),
- LONG2CHARS( 0x0000007000000000 ),
- LONG2CHARS( 0x000000F000000000 ),
- LONG2CHARS( 0x000001F000000000 ),
- LONG2CHARS( 0x000003F000000000 ),
- LONG2CHARS( 0x000007F000000000 ),
- LONG2CHARS( 0x00000FF000000000 ),
- LONG2CHARS( 0x00001FF000000000 ),
- LONG2CHARS( 0x00003FF000000000 ),
- LONG2CHARS( 0x00007FF000000000 ),
- LONG2CHARS( 0x0000FFF000000000 ),
- LONG2CHARS( 0x0001FFF000000000 ),
- LONG2CHARS( 0x0003FFF000000000 ),
- LONG2CHARS( 0x0007FFF000000000 ),
- LONG2CHARS( 0x000FFFF000000000 ),
- LONG2CHARS( 0x001FFFF000000000 ),
- LONG2CHARS( 0x003FFFF000000000 ),
- LONG2CHARS( 0x007FFFF000000000 ),
- LONG2CHARS( 0x00FFFFF000000000 ),
- LONG2CHARS( 0x01FFFFF000000000 ),
- LONG2CHARS( 0x03FFFFF000000000 ),
- LONG2CHARS( 0x07FFFFF000000000 ),
- LONG2CHARS( 0x0FFFFFF000000000 ),
- LONG2CHARS( 0x1FFFFFF000000000 ),
- LONG2CHARS( 0x3FFFFFF000000000 ),
- LONG2CHARS( 0x7FFFFFF000000000 ),
- LONG2CHARS( 0xFFFFFFF000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000002000000000 ),
- LONG2CHARS( 0x0000006000000000 ),
- LONG2CHARS( 0x000000E000000000 ),
- LONG2CHARS( 0x000001E000000000 ),
- LONG2CHARS( 0x000003E000000000 ),
- LONG2CHARS( 0x000007E000000000 ),
- LONG2CHARS( 0x00000FE000000000 ),
- LONG2CHARS( 0x00001FE000000000 ),
- LONG2CHARS( 0x00003FE000000000 ),
- LONG2CHARS( 0x00007FE000000000 ),
- LONG2CHARS( 0x0000FFE000000000 ),
- LONG2CHARS( 0x0001FFE000000000 ),
- LONG2CHARS( 0x0003FFE000000000 ),
- LONG2CHARS( 0x0007FFE000000000 ),
- LONG2CHARS( 0x000FFFE000000000 ),
- LONG2CHARS( 0x001FFFE000000000 ),
- LONG2CHARS( 0x003FFFE000000000 ),
- LONG2CHARS( 0x007FFFE000000000 ),
- LONG2CHARS( 0x00FFFFE000000000 ),
- LONG2CHARS( 0x01FFFFE000000000 ),
- LONG2CHARS( 0x03FFFFE000000000 ),
- LONG2CHARS( 0x07FFFFE000000000 ),
- LONG2CHARS( 0x0FFFFFE000000000 ),
- LONG2CHARS( 0x1FFFFFE000000000 ),
- LONG2CHARS( 0x3FFFFFE000000000 ),
- LONG2CHARS( 0x7FFFFFE000000000 ),
- LONG2CHARS( 0xFFFFFFE000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000004000000000 ),
- LONG2CHARS( 0x000000C000000000 ),
- LONG2CHARS( 0x000001C000000000 ),
- LONG2CHARS( 0x000003C000000000 ),
- LONG2CHARS( 0x000007C000000000 ),
- LONG2CHARS( 0x00000FC000000000 ),
- LONG2CHARS( 0x00001FC000000000 ),
- LONG2CHARS( 0x00003FC000000000 ),
- LONG2CHARS( 0x00007FC000000000 ),
- LONG2CHARS( 0x0000FFC000000000 ),
- LONG2CHARS( 0x0001FFC000000000 ),
- LONG2CHARS( 0x0003FFC000000000 ),
- LONG2CHARS( 0x0007FFC000000000 ),
- LONG2CHARS( 0x000FFFC000000000 ),
- LONG2CHARS( 0x001FFFC000000000 ),
- LONG2CHARS( 0x003FFFC000000000 ),
- LONG2CHARS( 0x007FFFC000000000 ),
- LONG2CHARS( 0x00FFFFC000000000 ),
- LONG2CHARS( 0x01FFFFC000000000 ),
- LONG2CHARS( 0x03FFFFC000000000 ),
- LONG2CHARS( 0x07FFFFC000000000 ),
- LONG2CHARS( 0x0FFFFFC000000000 ),
- LONG2CHARS( 0x1FFFFFC000000000 ),
- LONG2CHARS( 0x3FFFFFC000000000 ),
- LONG2CHARS( 0x7FFFFFC000000000 ),
- LONG2CHARS( 0xFFFFFFC000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000008000000000 ),
- LONG2CHARS( 0x0000018000000000 ),
- LONG2CHARS( 0x0000038000000000 ),
- LONG2CHARS( 0x0000078000000000 ),
- LONG2CHARS( 0x00000F8000000000 ),
- LONG2CHARS( 0x00001F8000000000 ),
- LONG2CHARS( 0x00003F8000000000 ),
- LONG2CHARS( 0x00007F8000000000 ),
- LONG2CHARS( 0x0000FF8000000000 ),
- LONG2CHARS( 0x0001FF8000000000 ),
- LONG2CHARS( 0x0003FF8000000000 ),
- LONG2CHARS( 0x0007FF8000000000 ),
- LONG2CHARS( 0x000FFF8000000000 ),
- LONG2CHARS( 0x001FFF8000000000 ),
- LONG2CHARS( 0x003FFF8000000000 ),
- LONG2CHARS( 0x007FFF8000000000 ),
- LONG2CHARS( 0x00FFFF8000000000 ),
- LONG2CHARS( 0x01FFFF8000000000 ),
- LONG2CHARS( 0x03FFFF8000000000 ),
- LONG2CHARS( 0x07FFFF8000000000 ),
- LONG2CHARS( 0x0FFFFF8000000000 ),
- LONG2CHARS( 0x1FFFFF8000000000 ),
- LONG2CHARS( 0x3FFFFF8000000000 ),
- LONG2CHARS( 0x7FFFFF8000000000 ),
- LONG2CHARS( 0xFFFFFF8000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000010000000000 ),
- LONG2CHARS( 0x0000030000000000 ),
- LONG2CHARS( 0x0000070000000000 ),
- LONG2CHARS( 0x00000F0000000000 ),
- LONG2CHARS( 0x00001F0000000000 ),
- LONG2CHARS( 0x00003F0000000000 ),
- LONG2CHARS( 0x00007F0000000000 ),
- LONG2CHARS( 0x0000FF0000000000 ),
- LONG2CHARS( 0x0001FF0000000000 ),
- LONG2CHARS( 0x0003FF0000000000 ),
- LONG2CHARS( 0x0007FF0000000000 ),
- LONG2CHARS( 0x000FFF0000000000 ),
- LONG2CHARS( 0x001FFF0000000000 ),
- LONG2CHARS( 0x003FFF0000000000 ),
- LONG2CHARS( 0x007FFF0000000000 ),
- LONG2CHARS( 0x00FFFF0000000000 ),
- LONG2CHARS( 0x01FFFF0000000000 ),
- LONG2CHARS( 0x03FFFF0000000000 ),
- LONG2CHARS( 0x07FFFF0000000000 ),
- LONG2CHARS( 0x0FFFFF0000000000 ),
- LONG2CHARS( 0x1FFFFF0000000000 ),
- LONG2CHARS( 0x3FFFFF0000000000 ),
- LONG2CHARS( 0x7FFFFF0000000000 ),
- LONG2CHARS( 0xFFFFFF0000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000020000000000 ),
- LONG2CHARS( 0x0000060000000000 ),
- LONG2CHARS( 0x00000E0000000000 ),
- LONG2CHARS( 0x00001E0000000000 ),
- LONG2CHARS( 0x00003E0000000000 ),
- LONG2CHARS( 0x00007E0000000000 ),
- LONG2CHARS( 0x0000FE0000000000 ),
- LONG2CHARS( 0x0001FE0000000000 ),
- LONG2CHARS( 0x0003FE0000000000 ),
- LONG2CHARS( 0x0007FE0000000000 ),
- LONG2CHARS( 0x000FFE0000000000 ),
- LONG2CHARS( 0x001FFE0000000000 ),
- LONG2CHARS( 0x003FFE0000000000 ),
- LONG2CHARS( 0x007FFE0000000000 ),
- LONG2CHARS( 0x00FFFE0000000000 ),
- LONG2CHARS( 0x01FFFE0000000000 ),
- LONG2CHARS( 0x03FFFE0000000000 ),
- LONG2CHARS( 0x07FFFE0000000000 ),
- LONG2CHARS( 0x0FFFFE0000000000 ),
- LONG2CHARS( 0x1FFFFE0000000000 ),
- LONG2CHARS( 0x3FFFFE0000000000 ),
- LONG2CHARS( 0x7FFFFE0000000000 ),
- LONG2CHARS( 0xFFFFFE0000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000040000000000 ),
- LONG2CHARS( 0x00000C0000000000 ),
- LONG2CHARS( 0x00001C0000000000 ),
- LONG2CHARS( 0x00003C0000000000 ),
- LONG2CHARS( 0x00007C0000000000 ),
- LONG2CHARS( 0x0000FC0000000000 ),
- LONG2CHARS( 0x0001FC0000000000 ),
- LONG2CHARS( 0x0003FC0000000000 ),
- LONG2CHARS( 0x0007FC0000000000 ),
- LONG2CHARS( 0x000FFC0000000000 ),
- LONG2CHARS( 0x001FFC0000000000 ),
- LONG2CHARS( 0x003FFC0000000000 ),
- LONG2CHARS( 0x007FFC0000000000 ),
- LONG2CHARS( 0x00FFFC0000000000 ),
- LONG2CHARS( 0x01FFFC0000000000 ),
- LONG2CHARS( 0x03FFFC0000000000 ),
- LONG2CHARS( 0x07FFFC0000000000 ),
- LONG2CHARS( 0x0FFFFC0000000000 ),
- LONG2CHARS( 0x1FFFFC0000000000 ),
- LONG2CHARS( 0x3FFFFC0000000000 ),
- LONG2CHARS( 0x7FFFFC0000000000 ),
- LONG2CHARS( 0xFFFFFC0000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000080000000000 ),
- LONG2CHARS( 0x0000180000000000 ),
- LONG2CHARS( 0x0000380000000000 ),
- LONG2CHARS( 0x0000780000000000 ),
- LONG2CHARS( 0x0000F80000000000 ),
- LONG2CHARS( 0x0001F80000000000 ),
- LONG2CHARS( 0x0003F80000000000 ),
- LONG2CHARS( 0x0007F80000000000 ),
- LONG2CHARS( 0x000FF80000000000 ),
- LONG2CHARS( 0x001FF80000000000 ),
- LONG2CHARS( 0x003FF80000000000 ),
- LONG2CHARS( 0x007FF80000000000 ),
- LONG2CHARS( 0x00FFF80000000000 ),
- LONG2CHARS( 0x01FFF80000000000 ),
- LONG2CHARS( 0x03FFF80000000000 ),
- LONG2CHARS( 0x07FFF80000000000 ),
- LONG2CHARS( 0x0FFFF80000000000 ),
- LONG2CHARS( 0x1FFFF80000000000 ),
- LONG2CHARS( 0x3FFFF80000000000 ),
- LONG2CHARS( 0x7FFFF80000000000 ),
- LONG2CHARS( 0xFFFFF80000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000100000000000 ),
- LONG2CHARS( 0x0000300000000000 ),
- LONG2CHARS( 0x0000700000000000 ),
- LONG2CHARS( 0x0000F00000000000 ),
- LONG2CHARS( 0x0001F00000000000 ),
- LONG2CHARS( 0x0003F00000000000 ),
- LONG2CHARS( 0x0007F00000000000 ),
- LONG2CHARS( 0x000FF00000000000 ),
- LONG2CHARS( 0x001FF00000000000 ),
- LONG2CHARS( 0x003FF00000000000 ),
- LONG2CHARS( 0x007FF00000000000 ),
- LONG2CHARS( 0x00FFF00000000000 ),
- LONG2CHARS( 0x01FFF00000000000 ),
- LONG2CHARS( 0x03FFF00000000000 ),
- LONG2CHARS( 0x07FFF00000000000 ),
- LONG2CHARS( 0x0FFFF00000000000 ),
- LONG2CHARS( 0x1FFFF00000000000 ),
- LONG2CHARS( 0x3FFFF00000000000 ),
- LONG2CHARS( 0x7FFFF00000000000 ),
- LONG2CHARS( 0xFFFFF00000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000200000000000 ),
- LONG2CHARS( 0x0000600000000000 ),
- LONG2CHARS( 0x0000E00000000000 ),
- LONG2CHARS( 0x0001E00000000000 ),
- LONG2CHARS( 0x0003E00000000000 ),
- LONG2CHARS( 0x0007E00000000000 ),
- LONG2CHARS( 0x000FE00000000000 ),
- LONG2CHARS( 0x001FE00000000000 ),
- LONG2CHARS( 0x003FE00000000000 ),
- LONG2CHARS( 0x007FE00000000000 ),
- LONG2CHARS( 0x00FFE00000000000 ),
- LONG2CHARS( 0x01FFE00000000000 ),
- LONG2CHARS( 0x03FFE00000000000 ),
- LONG2CHARS( 0x07FFE00000000000 ),
- LONG2CHARS( 0x0FFFE00000000000 ),
- LONG2CHARS( 0x1FFFE00000000000 ),
- LONG2CHARS( 0x3FFFE00000000000 ),
- LONG2CHARS( 0x7FFFE00000000000 ),
- LONG2CHARS( 0xFFFFE00000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000400000000000 ),
- LONG2CHARS( 0x0000C00000000000 ),
- LONG2CHARS( 0x0001C00000000000 ),
- LONG2CHARS( 0x0003C00000000000 ),
- LONG2CHARS( 0x0007C00000000000 ),
- LONG2CHARS( 0x000FC00000000000 ),
- LONG2CHARS( 0x001FC00000000000 ),
- LONG2CHARS( 0x003FC00000000000 ),
- LONG2CHARS( 0x007FC00000000000 ),
- LONG2CHARS( 0x00FFC00000000000 ),
- LONG2CHARS( 0x01FFC00000000000 ),
- LONG2CHARS( 0x03FFC00000000000 ),
- LONG2CHARS( 0x07FFC00000000000 ),
- LONG2CHARS( 0x0FFFC00000000000 ),
- LONG2CHARS( 0x1FFFC00000000000 ),
- LONG2CHARS( 0x3FFFC00000000000 ),
- LONG2CHARS( 0x7FFFC00000000000 ),
- LONG2CHARS( 0xFFFFC00000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000800000000000 ),
- LONG2CHARS( 0x0001800000000000 ),
- LONG2CHARS( 0x0003800000000000 ),
- LONG2CHARS( 0x0007800000000000 ),
- LONG2CHARS( 0x000F800000000000 ),
- LONG2CHARS( 0x001F800000000000 ),
- LONG2CHARS( 0x003F800000000000 ),
- LONG2CHARS( 0x007F800000000000 ),
- LONG2CHARS( 0x00FF800000000000 ),
- LONG2CHARS( 0x01FF800000000000 ),
- LONG2CHARS( 0x03FF800000000000 ),
- LONG2CHARS( 0x07FF800000000000 ),
- LONG2CHARS( 0x0FFF800000000000 ),
- LONG2CHARS( 0x1FFF800000000000 ),
- LONG2CHARS( 0x3FFF800000000000 ),
- LONG2CHARS( 0x7FFF800000000000 ),
- LONG2CHARS( 0xFFFF800000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0001000000000000 ),
- LONG2CHARS( 0x0003000000000000 ),
- LONG2CHARS( 0x0007000000000000 ),
- LONG2CHARS( 0x000F000000000000 ),
- LONG2CHARS( 0x001F000000000000 ),
- LONG2CHARS( 0x003F000000000000 ),
- LONG2CHARS( 0x007F000000000000 ),
- LONG2CHARS( 0x00FF000000000000 ),
- LONG2CHARS( 0x01FF000000000000 ),
- LONG2CHARS( 0x03FF000000000000 ),
- LONG2CHARS( 0x07FF000000000000 ),
- LONG2CHARS( 0x0FFF000000000000 ),
- LONG2CHARS( 0x1FFF000000000000 ),
- LONG2CHARS( 0x3FFF000000000000 ),
- LONG2CHARS( 0x7FFF000000000000 ),
- LONG2CHARS( 0xFFFF000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0002000000000000 ),
- LONG2CHARS( 0x0006000000000000 ),
- LONG2CHARS( 0x000E000000000000 ),
- LONG2CHARS( 0x001E000000000000 ),
- LONG2CHARS( 0x003E000000000000 ),
- LONG2CHARS( 0x007E000000000000 ),
- LONG2CHARS( 0x00FE000000000000 ),
- LONG2CHARS( 0x01FE000000000000 ),
- LONG2CHARS( 0x03FE000000000000 ),
- LONG2CHARS( 0x07FE000000000000 ),
- LONG2CHARS( 0x0FFE000000000000 ),
- LONG2CHARS( 0x1FFE000000000000 ),
- LONG2CHARS( 0x3FFE000000000000 ),
- LONG2CHARS( 0x7FFE000000000000 ),
- LONG2CHARS( 0xFFFE000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0004000000000000 ),
- LONG2CHARS( 0x000C000000000000 ),
- LONG2CHARS( 0x001C000000000000 ),
- LONG2CHARS( 0x003C000000000000 ),
- LONG2CHARS( 0x007C000000000000 ),
- LONG2CHARS( 0x00FC000000000000 ),
- LONG2CHARS( 0x01FC000000000000 ),
- LONG2CHARS( 0x03FC000000000000 ),
- LONG2CHARS( 0x07FC000000000000 ),
- LONG2CHARS( 0x0FFC000000000000 ),
- LONG2CHARS( 0x1FFC000000000000 ),
- LONG2CHARS( 0x3FFC000000000000 ),
- LONG2CHARS( 0x7FFC000000000000 ),
- LONG2CHARS( 0xFFFC000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0008000000000000 ),
- LONG2CHARS( 0x0018000000000000 ),
- LONG2CHARS( 0x0038000000000000 ),
- LONG2CHARS( 0x0078000000000000 ),
- LONG2CHARS( 0x00F8000000000000 ),
- LONG2CHARS( 0x01F8000000000000 ),
- LONG2CHARS( 0x03F8000000000000 ),
- LONG2CHARS( 0x07F8000000000000 ),
- LONG2CHARS( 0x0FF8000000000000 ),
- LONG2CHARS( 0x1FF8000000000000 ),
- LONG2CHARS( 0x3FF8000000000000 ),
- LONG2CHARS( 0x7FF8000000000000 ),
- LONG2CHARS( 0xFFF8000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0010000000000000 ),
- LONG2CHARS( 0x0030000000000000 ),
- LONG2CHARS( 0x0070000000000000 ),
- LONG2CHARS( 0x00F0000000000000 ),
- LONG2CHARS( 0x01F0000000000000 ),
- LONG2CHARS( 0x03F0000000000000 ),
- LONG2CHARS( 0x07F0000000000000 ),
- LONG2CHARS( 0x0FF0000000000000 ),
- LONG2CHARS( 0x1FF0000000000000 ),
- LONG2CHARS( 0x3FF0000000000000 ),
- LONG2CHARS( 0x7FF0000000000000 ),
- LONG2CHARS( 0xFFF0000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0020000000000000 ),
- LONG2CHARS( 0x0060000000000000 ),
- LONG2CHARS( 0x00E0000000000000 ),
- LONG2CHARS( 0x01E0000000000000 ),
- LONG2CHARS( 0x03E0000000000000 ),
- LONG2CHARS( 0x07E0000000000000 ),
- LONG2CHARS( 0x0FE0000000000000 ),
- LONG2CHARS( 0x1FE0000000000000 ),
- LONG2CHARS( 0x3FE0000000000000 ),
- LONG2CHARS( 0x7FE0000000000000 ),
- LONG2CHARS( 0xFFE0000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0040000000000000 ),
- LONG2CHARS( 0x00C0000000000000 ),
- LONG2CHARS( 0x01C0000000000000 ),
- LONG2CHARS( 0x03C0000000000000 ),
- LONG2CHARS( 0x07C0000000000000 ),
- LONG2CHARS( 0x0FC0000000000000 ),
- LONG2CHARS( 0x1FC0000000000000 ),
- LONG2CHARS( 0x3FC0000000000000 ),
- LONG2CHARS( 0x7FC0000000000000 ),
- LONG2CHARS( 0xFFC0000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0080000000000000 ),
- LONG2CHARS( 0x0180000000000000 ),
- LONG2CHARS( 0x0380000000000000 ),
- LONG2CHARS( 0x0780000000000000 ),
- LONG2CHARS( 0x0F80000000000000 ),
- LONG2CHARS( 0x1F80000000000000 ),
- LONG2CHARS( 0x3F80000000000000 ),
- LONG2CHARS( 0x7F80000000000000 ),
- LONG2CHARS( 0xFF80000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0100000000000000 ),
- LONG2CHARS( 0x0300000000000000 ),
- LONG2CHARS( 0x0700000000000000 ),
- LONG2CHARS( 0x0F00000000000000 ),
- LONG2CHARS( 0x1F00000000000000 ),
- LONG2CHARS( 0x3F00000000000000 ),
- LONG2CHARS( 0x7F00000000000000 ),
- LONG2CHARS( 0xFF00000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0200000000000000 ),
- LONG2CHARS( 0x0600000000000000 ),
- LONG2CHARS( 0x0E00000000000000 ),
- LONG2CHARS( 0x1E00000000000000 ),
- LONG2CHARS( 0x3E00000000000000 ),
- LONG2CHARS( 0x7E00000000000000 ),
- LONG2CHARS( 0xFE00000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0400000000000000 ),
- LONG2CHARS( 0x0C00000000000000 ),
- LONG2CHARS( 0x1C00000000000000 ),
- LONG2CHARS( 0x3C00000000000000 ),
- LONG2CHARS( 0x7C00000000000000 ),
- LONG2CHARS( 0xFC00000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0800000000000000 ),
- LONG2CHARS( 0x1800000000000000 ),
- LONG2CHARS( 0x3800000000000000 ),
- LONG2CHARS( 0x7800000000000000 ),
- LONG2CHARS( 0xF800000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x1000000000000000 ),
- LONG2CHARS( 0x3000000000000000 ),
- LONG2CHARS( 0x7000000000000000 ),
- LONG2CHARS( 0xF000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x2000000000000000 ),
- LONG2CHARS( 0x6000000000000000 ),
- LONG2CHARS( 0xE000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x4000000000000000 ),
- LONG2CHARS( 0xC000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
- {
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x8000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- LONG2CHARS( 0x0000000000000000 ),
- },
-};
-#endif /* PPW */
-#endif
+#endif /* BITMAP_BIT_ORDER */
/* used for masking bits in bresenham lines
mask[n] is used to mask out all but bit n in a longword (n is a
@@ -9591,19 +933,6 @@ is a screen posiotion.)
#if (BITMAP_BIT_ORDER == MSBFirst)
PixelType mask[PPW] =
{
-#if PPW == 64
- LONG2CHARS( _1_<<63 ), LONG2CHARS( 1L<<62 ), LONG2CHARS( 1L<<61 ),
- LONG2CHARS( 1L<<60 ), LONG2CHARS( 1L<<59 ),
- LONG2CHARS( 1L<<58 ), LONG2CHARS( 1L<<57 ), LONG2CHARS( 1L<<56 ),
- LONG2CHARS( 1L<<55 ), LONG2CHARS( 1L<<54 ), LONG2CHARS( 1L<<53 ),
- LONG2CHARS( 1L<<52 ), LONG2CHARS( 1L<<51 ), LONG2CHARS( 1L<<50 ),
- LONG2CHARS( 1L<<49 ), LONG2CHARS( 1L<<48 ), LONG2CHARS( 1L<<47 ),
- LONG2CHARS( 1L<<46 ), LONG2CHARS( 1L<<45 ), LONG2CHARS( 1L<<44 ),
- LONG2CHARS( 1L<<43 ), LONG2CHARS( 1L<<42 ), LONG2CHARS( 1L<<41 ),
- LONG2CHARS( 1L<<40 ), LONG2CHARS( 1L<<39 ), LONG2CHARS( 1L<<38 ),
- LONG2CHARS( 1L<<37 ), LONG2CHARS( 1L<<36 ), LONG2CHARS( 1L<<35 ),
- LONG2CHARS( 1L<<34 ), LONG2CHARS( 1L<<33 ), LONG2CHARS( 1L<<32 ),
-#endif /* PPW */
LONG2CHARS( _1_<<31 ), LONG2CHARS( 1<<30 ), LONG2CHARS( 1<<29 ),
LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<26 ),
LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<23 ),
@@ -9619,72 +948,6 @@ PixelType mask[PPW] =
PixelType rmask[] =
{
-#if PPW == 64
- 0xffffffffffffffff ^ LONG2CHARS( _1_<<63 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<62 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<61 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<60 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<59 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<58 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<57 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<56 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<55 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<54 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<53 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<52 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<51 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<50 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<49 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<48 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<47 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<46 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<45 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<44 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<43 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<42 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<41 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<40 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<39 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<38 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<37 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<36 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<35 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<34 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<33 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<32 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<31 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<30 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<29 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<28 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<27 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<26 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<25 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<24 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<23 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<22 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<21 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<20 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<19 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<18 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<17 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<16 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<15 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<14 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<13 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<12 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<11 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<10 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<9 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<8 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<7 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<6 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<5 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<4 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<3 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<2 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<1 ),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<0 )
-#else /* PPW */
0xffffffff ^ LONG2CHARS( _1_<<31 ), 0xffffffff ^ LONG2CHARS( 1<<30 ),
0xffffffff ^ LONG2CHARS( 1<<29 ), 0xffffffff ^ LONG2CHARS( 1<<28),
0xffffffff ^ LONG2CHARS( 1<<27 ), 0xffffffff ^ LONG2CHARS( 1<<26),
@@ -9701,7 +964,6 @@ PixelType rmask[] =
0xffffffff ^ LONG2CHARS( 1<<5 ), 0xffffffff ^ LONG2CHARS( 1<<4),
0xffffffff ^ LONG2CHARS( 1<<3 ), 0xffffffff ^ LONG2CHARS( 1<<2),
0xffffffff ^ LONG2CHARS( 1<<1 ), 0xffffffff ^ LONG2CHARS( 1<<0)
-#endif /* PPW */
};
#else /* LSBFirst */
PixelType mask[] =
@@ -9717,25 +979,9 @@ PixelType mask[] =
LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<26),
LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<29),
LONG2CHARS( 1<<30 ), LONG2CHARS( _1_<<31 )
-#if PPW == 64
- ,
- LONG2CHARS( 1L<<32),
- LONG2CHARS( 1L<<33 ), LONG2CHARS( 1L<<34 ), LONG2CHARS( 1L<<35),
- LONG2CHARS( 1L<<36 ), LONG2CHARS( 1L<<37 ), LONG2CHARS( 1L<<38),
- LONG2CHARS( 1L<<39 ), LONG2CHARS( 1L<<40 ), LONG2CHARS( 1L<<41),
- LONG2CHARS( 1L<<42 ), LONG2CHARS( 1L<<43 ), LONG2CHARS( 1L<<44),
- LONG2CHARS( 1L<<45 ), LONG2CHARS( 1L<<46 ), LONG2CHARS( 1L<<47),
- LONG2CHARS( 1L<<48 ), LONG2CHARS( 1L<<49 ), LONG2CHARS( 1L<<50),
- LONG2CHARS( 1L<<51 ), LONG2CHARS( 1L<<52 ), LONG2CHARS( 1L<<53),
- LONG2CHARS( 1L<<54 ), LONG2CHARS( 1L<<55 ), LONG2CHARS( 1L<<56),
- LONG2CHARS( 1L<<57 ), LONG2CHARS( 1L<<58 ), LONG2CHARS( 1L<<59),
- LONG2CHARS( 1L<<60 ), LONG2CHARS( 1L<<61 ),
- LONG2CHARS( 1L<<62 ), LONG2CHARS( _1_<<63 ),
-#endif /* PPW */
};
PixelType rmask[] =
{
-#if PPW == 32
0xffffffff ^ LONG2CHARS( 1<<0), 0xffffffff ^ LONG2CHARS( 1<<1),
0xffffffff ^ LONG2CHARS( 1<<2), 0xffffffff ^ LONG2CHARS( 1<<3),
0xffffffff ^ LONG2CHARS( 1<<4), 0xffffffff ^ LONG2CHARS( 1<<5),
@@ -9752,72 +998,6 @@ PixelType rmask[] =
0xffffffff ^ LONG2CHARS( 1<<26), 0xffffffff ^ LONG2CHARS( 1<<27),
0xffffffff ^ LONG2CHARS( 1<<28), 0xffffffff ^ LONG2CHARS( 1<<29),
0xffffffff ^ LONG2CHARS( 1<<30), 0xffffffff ^ LONG2CHARS( _1_<<31)
-#else /* PPW */
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<0),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<1),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<2),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<3),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<4),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<5),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<6),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<7),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<8),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<9),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<10),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<11),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<12),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<13),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<14),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<15),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<16),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<17),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<18),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<19),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<20),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<21),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<22),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<23),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<24),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<25),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<26),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<27),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<28),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<29),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<30),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<31),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<32),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<33),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<34),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<35),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<36),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<37),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<38),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<39),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<40),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<41),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<42),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<43),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<44),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<45),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<46),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<47),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<48),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<49),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<50),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<51),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<52),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<53),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<54),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<55),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<56),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<57),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<58),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<59),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<60),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<61),
- 0xffffffffffffffff ^ LONG2CHARS( 1L<<62),
- 0xffffffffffffffff ^ LONG2CHARS( _1_<<63),
-#endif /* PPW */
};
#endif /* BITMAP_BIT_ORDER */
@@ -9846,25 +1026,25 @@ PixelType rmask[] =
#include "mergerop.h"
#define O 0
-#define I ~((unsigned long)0)
+#define I ~((MfbBits)0)
mergeRopRec mergeRopBits[16] = {
-O,O,O,O, /* clear 0x0 0 */
-I,O,O,O, /* and 0x1 src AND dst */
-I,O,I,O, /* andReverse 0x2 src AND NOT dst */
-O,O,I,O, /* copy 0x3 src */
-I,I,O,O, /* andInverted 0x4 NOT src AND dst */
-O,I,O,O, /* noop 0x5 dst */
-O,I,I,O, /* xor 0x6 src XOR dst */
-I,I,I,O, /* or 0x7 src OR dst */
-I,I,I,I, /* nor 0x8 NOT src AND NOT dst */
-O,I,I,I, /* equiv 0x9 NOT src XOR dst */
-O,I,O,I, /* invert 0xa NOT dst */
-I,I,O,I, /* orReverse 0xb src OR NOT dst */
-O,O,I,I, /* copyInverted 0xc NOT src */
-I,O,I,I, /* orInverted 0xd NOT src OR dst */
-I,O,O,I, /* nand 0xe NOT src OR NOT dst */
-O,O,O,I, /* set 0xf 1 */
+{ O,O,O,O, }, /* clear 0x0 0 */
+{ I,O,O,O, }, /* and 0x1 src AND dst */
+{ I,O,I,O, }, /* andReverse 0x2 src AND NOT dst */
+{ O,O,I,O, }, /* copy 0x3 src */
+{ I,I,O,O, }, /* andInverted 0x4 NOT src AND dst */
+{ O,I,O,O, }, /* noop 0x5 dst */
+{ O,I,I,O, }, /* xor 0x6 src XOR dst */
+{ I,I,I,O, }, /* or 0x7 src OR dst */
+{ I,I,I,I, }, /* nor 0x8 NOT src AND NOT dst */
+{ O,I,I,I, }, /* equiv 0x9 NOT src XOR dst */
+{ O,I,O,I, }, /* invert 0xa NOT dst */
+{ I,I,O,I, }, /* orReverse 0xb src OR NOT dst */
+{ O,O,I,I, }, /* copyInverted 0xc NOT src */
+{ I,O,I,I, }, /* orInverted 0xd NOT src OR dst */
+{ I,O,O,I, }, /* nand 0xe NOT src OR NOT dst */
+{ O,O,O,I, }, /* set 0xf 1 */
};
#undef O
diff --git a/mfb/maskbits.h b/mfb/maskbits.h
index e8a7faa90..711731660 100644
--- a/mfb/maskbits.h
+++ b/mfb/maskbits.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/maskbits.h,v 3.9 2003/02/18 21:30:00 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -22,6 +23,7 @@ SOFTWARE.
******************************************************************/
/* $Xorg: maskbits.h,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */
+
#include "X.h"
#include "Xmd.h"
#include "servermd.h"
@@ -196,18 +198,21 @@ getshiftedleftbits(psrc, offset, w, dst)
*
* The MFB_ versions are here so that cfb can include maskbits.h to get
* the bitmap constants without conflicting with its own P* constants.
+ *
+ * Keith Packard (keithp@suse.com):
+ * Note mfb64 is no longer supported; it requires DIX support
+ * for realigning images which costs too much
*/
/* warning: PixelType definition duplicated in mfb.h */
#ifndef PixelType
-#define PixelType unsigned long
+#define PixelType CARD32
#endif /* PixelType */
+#ifndef MfbBits
+#define MfbBits CARD32
+#endif
-#ifdef LONG64
-#define MFB_PGSZB 8
-#else
#define MFB_PGSZB 4
-#endif /* LONG64 */
#define MFB_PPW (MFB_PGSZB<<3) /* assuming 8 bits per byte */
#define MFB_PGSZ MFB_PPW
#define MFB_PLST (MFB_PPW-1)
@@ -217,10 +222,6 @@ getshiftedleftbits(psrc, offset, w, dst)
#if MFB_PPW == 32
#define MFB_PWSH 5
-#else
-#if MFB_PPW == 64
-#define MFB_PWSH 6
-#endif /* MFB_PPW == 64 */
#endif /* MFB_PPW == 32 */
extern PixelType starttab[];
@@ -241,29 +242,25 @@ extern PixelType mask[];
#define BitLeft(b,s) SCRLEFT(b,s)
#define BitRight(b,s) SCRRIGHT(b,s)
+#ifdef XFree86Server
+#define LONG2CHARSSAMEORDER(x) ((MfbBits)(x))
+#define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \
+ | ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \
+ | ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \
+ | ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) )
+#endif /* XFree86Server */
+
#if (BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER)
-#define LONG2CHARS(x) (x)
+#define LONG2CHARS(x) ((MfbBits)(x))
#else
/*
* the unsigned case below is for compilers like
* the Danbury C and i386cc
*/
-#if PPW == 32
-#define LONG2CHARS( x ) ( ( ( ( x ) & 0x000000FF ) << 0x18 ) \
- | ( ( ( x ) & 0x0000FF00 ) << 0x08 ) \
- | ( ( ( x ) & 0x00FF0000 ) >> 0x08 ) \
- | ( ( ( x ) & (unsigned long)0xFF000000 ) >> 0x18 ) )
-#else /* PPW == 64 */
-#define LONG2CHARS( x ) \
- ( ( ( ( x ) & 0x000000FF) << 0x18 ) \
- | ( ( ( x ) & 0x0000FF00) << 0x08 ) \
- | ( ( ( x ) & 0x00FF0000) >> 0x08 ) \
- | ( ( ( x ) & (unsigned long)0xFF000000) >> 0x18 ) \
- | ( ( ( x ) & 0x000000FF00000000) << 0x18 ) \
- | ( ( ( x ) & 0x0000FF0000000000) << 0x08 ) \
- | ( ( ( x ) & 0x00FF000000000000) >> 0x08 ) \
- | ( ( ( x ) & (unsigned long)0xFF00000000000000) >> 0x18 ) )
-#endif /* PPW */
+#define LONG2CHARS( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \
+ | ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \
+ | ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \
+ | ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) )
#endif /* BITMAP_BIT_ORDER */
#ifdef STRICT_ANSI_SHIFT
@@ -288,7 +285,6 @@ extern PixelType mask[];
((alu) == RROP_INVERT) ? ((dst) ^ (src)) : \
(dst))
-#if PPW == 32
/* A generalized form of a x4 Duff's Device */
#define Duff(counter, block) { \
while (counter >= 4) {\
@@ -306,34 +302,6 @@ extern PixelType mask[];
counter = 0; \
} \
}
-#else /* PPW == 64 */
-/* A generalized form of a x8 Duff's Device */
-#define Duff(counter, block) { \
- while (counter >= 8) {\
- { block; } \
- { block; } \
- { block; } \
- { block; } \
- { block; } \
- { block; } \
- { block; } \
- { block; } \
- counter -= 8; \
- } \
- switch (counter & 7) { \
- case 7: { block; } \
- case 6: { block; } \
- case 5: { block; } \
- case 4: { block; } \
- case 3: { block; } \
- case 2: { block; } \
- case 1: { block; } \
- case 0: \
- counter = 0; \
- } \
-}
-#endif /* PPW */
-
#define maskbits(x, w, startmask, endmask, nlw) \
startmask = starttab[(x) & PIM]; \
@@ -420,9 +388,10 @@ extern PixelType mask[];
} \
else \
{ \
+ register int d = PPW-(x); \
*(pdst) = (*(pdst) & endtab[x]) | (SCRRIGHT((src), x)); \
(pdst)[1] = ((pdst)[1] & starttab[n]) | \
- (SCRLEFT(src, PPW-(x)) & endtab[n]); \
+ (SCRLEFT(src, d) & endtab[n]); \
} \
}
@@ -554,7 +523,7 @@ extern PixelType mask[];
#endif
#if GETLEFTBITS_ALIGNMENT == 1
-#define getleftbits(psrc, w, dst) dst = *((CARD32 *) psrc)
+#define getleftbits(psrc, w, dst) dst = *((CARD32 *)(pointer) psrc)
#endif /* GETLEFTBITS_ALIGNMENT == 1 */
#if GETLEFTBITS_ALIGNMENT == 2
@@ -588,7 +557,7 @@ extern PixelType mask[];
* getbits and putbits, but they work if used together.
*
* On a MSBFirst machine, a cpu bitfield extract instruction (like bfextu)
- * could normally assign its result to a long word register in the screen
+ * could normally assign its result to a 32-bit word register in the screen
* right position. This saves canceling register shifts by not fighting the
* natural cpu byte order.
*
diff --git a/mfb/mergerop.h b/mfb/mergerop.h
index b797c245a..ee3a33fe9 100644
--- a/mfb/mergerop.h
+++ b/mfb/mergerop.h
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/mfb/mergerop.h,v 3.14 2001/12/14 20:00:03 dawes Exp $ */
#ifndef _MERGEROP_H_
#define _MERGEROP_H_
@@ -34,17 +35,28 @@ in this Software without prior written authorization from The Open Group.
#endif
typedef struct _mergeRopBits {
- unsigned long ca1, cx1, ca2, cx2;
+ MfbBits ca1, cx1, ca2, cx2;
} mergeRopRec, *mergeRopPtr;
extern mergeRopRec mergeRopBits[16];
-#define DeclareMergeRop() unsigned long _ca1, _cx1, _ca2, _cx2;
-#define DeclarePrebuiltMergeRop() unsigned long _cca, _ccx;
+#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */
+#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0;
+#define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx;
+#if PSZ == 24 /* both for PGSZ == 32 and 64 */
+#define DeclareMergeRop24() \
+ MfbBits _ca1u[4], _cx1u[4], _ca2u[4], _cx2u[4];
+ /* int _unrollidx[3]={0,0,1,2};*/
+#define DeclarePrebuiltMergeRop24() MfbBits _ccau[4], _ccxu[4];
+#endif /* PSZ == 24 */
+#else /* mfb */
+#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0;
+#define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx;
+#endif
-#if PPW != PGSZ /* cfb */
+#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */
#define InitializeMergeRop(alu,pm) {\
- unsigned long _pm; \
+ MfbBits _pm; \
mergeRopPtr _bits; \
_pm = PFILL(pm); \
_bits = &mergeRopBits[alu]; \
@@ -53,6 +65,49 @@ extern mergeRopRec mergeRopBits[16];
_ca2 = _bits->ca2 & _pm; \
_cx2 = _bits->cx2 & _pm; \
}
+#if PSZ == 24
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define InitializeMergeRop24(alu,pm) {\
+ register int i; \
+ register MfbBits _pm = (pm) & 0xFFFFFF; \
+ mergeRopPtr _bits = &mergeRopBits[alu]; \
+ MfbBits _bits_ca1 = _bits->ca1; \
+ MfbBits _bits_cx1 = _bits->cx1; \
+ MfbBits _bits_ca2 = _bits->ca2; \
+ MfbBits _bits_cx2 = _bits->cx2; \
+ _pm = (_pm << 8) | (_pm >> 16); \
+ for(i = 0; i < 4; i++){ \
+ _ca1u[i] = _bits_ca1 & _pm; \
+ _cx1u[i] = _bits_cx1 | ~_pm; \
+ _ca2u[i] = _bits_ca2 & _pm; \
+ _cx2u[i] = _bits_cx2 & _pm; \
+ _pm = (_pm << 16)|(_pm >> 8); \
+ } \
+}
+#else /*(BITMAP_BIT_ORDER == LSBFirst)*/
+#define InitializeMergeRop24(alu,pm) {\
+ register int i; \
+ register MfbBits _pm = (pm) & cfbmask[0]; \
+ mergeRopPtr _bits = &mergeRopBits[alu]; \
+ MfbBits _bits_ca1 = _bits->ca1 & cfbmask[0]; \
+ MfbBits _bits_cx1 = _bits->cx1 & cfbmask[0]; \
+ MfbBits _bits_ca2 = _bits->ca2 & cfbmask[0]; \
+ MfbBits _bits_cx2 = _bits->cx2 & cfbmask[0]; \
+ _pm |= (_pm << 24); \
+ _bits_ca1 |= (_bits->ca1 << 24); \
+ _bits_cx1 |= (_bits->cx1 << 24); \
+ _bits_ca2 |= (_bits->ca2 << 24); \
+ _bits_cx2 |= (_bits->cx2 << 24); \
+ for(i = 0; i < 4; i++){ \
+ _ca1u[i] = _bits_ca1 & _pm; \
+ _cx1u[i] = _bits_cx1 | ~_pm; \
+ _ca2u[i] = _bits_ca2 & _pm; \
+ _cx2u[i] = _bits_cx2 & _pm; \
+ _pm = (_pm << 16)|(_pm >> 8); \
+ } \
+}
+#endif /*(BITMAP_BIT_ORDER == MSBFirst)*/
+#endif /* PSZ == 24 */
#else /* mfb */
#define InitializeMergeRop(alu,pm) {\
mergeRopPtr _bits; \
@@ -67,18 +122,69 @@ extern mergeRopRec mergeRopBits[16];
/* AND has higher precedence than XOR */
#define DoMergeRop(src, dst) \
- ((dst) & ((src) & _ca1 ^ _cx1) ^ ((src) & _ca2 ^ _cx2))
+ (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2))
-#define DoPrebuiltMergeRop(dst) ((dst) & _cca ^ _ccx)
+#define DoMergeRop24u(src, dst, i) \
+(((dst) & (((src) & _ca1u[i]) ^ _cx1u[i])) ^ (((src) & _ca2u[i]) ^ _cx2u[i]))
-#define DoMaskPrebuiltMergeRop(dst,mask) \
- ((dst) & (_cca | ~(mask)) ^ (_ccx & (mask)))
-
-#define PrebuildMergeRop(src) ((_cca = (src) & _ca1 ^ _cx1), \
- (_ccx = (src) & _ca2 ^ _cx2))
+#define DoMaskMergeRop24(src, dst, mask, index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src0 = (src);\
+ MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \
+ MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \
+ *(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \
+ (((( _src1 |(~mask))<<cfb24Shift[idx])&cfbmask[idx]) ^ \
+ ((( _src2&(mask))<<cfb24Shift[idx])&cfbmask[idx])))); \
+ idx++; \
+ (dst)++; \
+ *(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \
+ ((((_src1 |(~mask))>>cfb24Shift[idx])&cfbmask[idx]) ^ \
+ (((_src2 &(mask))>>cfb24Shift[idx])&cfbmask[idx])))); \
+ (dst)--; \
+ }
#define DoMaskMergeRop(src, dst, mask) \
- ((dst) & (((src) & _ca1 ^ _cx1) | ~(mask)) ^ (((src) & _ca2 ^ _cx2) & (mask)))
+ (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask)))
+
+#define DoMaskMergeRop24u(src, dst, mask, i) \
+(((dst) & ((((src) & _ca1u[(i)]) ^ _cx1u[(i)]) | ~(mask))) ^ ((((src) & _ca2u[(i)]) ^ _cx2u[(i)]) & (mask)))
+
+#define DoMergeRop24(src,dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src0 = (src);\
+ MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \
+ MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \
+ *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \
+ ((_src1 << cfb24Shift[idx])&cfbmask[idx])) ^ \
+ ((_src2 << cfb24Shift[idx])&cfbmask[idx]))); \
+ idx++; \
+ (dst)++; \
+ *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \
+ ((_src1 >> cfb24Shift[idx])&cfbmask[idx])) ^ \
+ ((_src2 >> cfb24Shift[idx])&cfbmask[idx]))); \
+ (dst)--; \
+ }
+
+#define DoPrebuiltMergeRop(dst) (((dst) & _cca) ^ _ccx)
+
+#define DoPrebuiltMergeRop24(dst,index) { \
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\
+ (( _cca <<cfb24Shift[idx])&cfbmask[idx])) ^ \
+ (( _ccx <<cfb24Shift[idx])&cfbmask[idx]))); \
+ idx++; \
+ (dst)++; \
+ *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\
+ (( _cca >>cfb24Shift[idx])&cfbmask[idx])) ^ \
+ (( _ccx >>cfb24Shift[idx])&cfbmask[idx]))); \
+ (dst)--; \
+ }
+
+#define DoMaskPrebuiltMergeRop(dst,mask) \
+ (((dst) & (_cca | ~(mask))) ^ (_ccx & (mask)))
+
+#define PrebuildMergeRop(src) ((_cca = ((src) & _ca1) ^ _cx1), \
+ (_ccx = ((src) & _ca2) ^ _cx2))
#ifndef MROP
#define MROP 0
@@ -101,12 +207,38 @@ extern mergeRopRec mergeRopBits[16];
#define Mnand (1<<GXnand)
#define Mset (1<<GXset)
+#define MROP_PIXEL24(pix, idx) \
+ (((*(pix) & cfbmask[(idx)<<1]) >> cfb24Shift[(idx)<<1])| \
+ ((*((pix)+1) & cfbmask[((idx)<<1)+1]) << cfb24Shift[((idx)<<1)+1]))
+
+#define MROP_SOLID24P(src,dst,sindex, index) \
+ MROP_SOLID24(MROP_PIXEL24(src,sindex),dst,index)
+
+#define MROP_MASK24P(src,dst,mask,sindex,index) \
+ MROP_MASK24(MROP_PIXEL24(src,sindex),dst,mask,index)
+
#if (MROP) == Mcopy
#define MROP_DECLARE()
#define MROP_DECLARE_REG()
#define MROP_INITIALIZE(alu,pm)
#define MROP_SOLID(src,dst) (src)
-#define MROP_MASK(src,dst,mask) ((dst) & ~(mask) | (src) & (mask))
+#define MROP_SOLID24(src,dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src = (src); \
+ *(dst) = (*(dst) & cfbrmask[idx])|((_src<<cfb24Shift[idx])&cfbmask[idx]); \
+ idx++; \
+ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|((_src>>cfb24Shift[idx])&cfbmask[idx]); \
+ }
+#define MROP_MASK(src,dst,mask) (((dst) & ~(mask)) | ((src) & (mask)))
+#define MROP_MASK24(src,dst,mask,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src = (src); \
+ *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \
+ (((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx])); \
+ idx++; \
+ *((dst)+1) = (*((dst)+1) & cfbrmask[idx] &(~(((mask)>>cfb24Shift[idx])&cfbmask[idx])) | \
+ (((_src&(mask))>>cfb24Shift[idx])&cfbmask[idx])); \
+ }
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Copy)
#endif
@@ -115,7 +247,27 @@ extern mergeRopRec mergeRopBits[16];
#define MROP_DECLARE_REG()
#define MROP_INITIALIZE(alu,pm)
#define MROP_SOLID(src,dst) (~(src))
-#define MROP_MASK(src,dst,mask) ((dst) & ~(mask) | (~(src)) & (mask))
+#define MROP_SOLID24(src,dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src = ~(src); \
+ *(dst) = (*(dst) & cfbrmask[idx])|((_src << cfb24Shift[idx])&cfbmask[idx]); \
+ idx++; \
+ (dst)++; \
+ *(dst) = (*(dst) & cfbrmask[idx])|((_src >>cfb24Shift[idx])&cfbmask[idx]); \
+ (dst)--; \
+ }
+#define MROP_MASK(src,dst,mask) (((dst) & ~(mask)) | ((~(src)) & (mask)))
+#define MROP_MASK24(src,dst,mask,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src = ~(src); \
+ *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \
+ (((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx])); \
+ idx++; \
+ (dst)++; \
+ *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)>>cfb24Shift[idx])&cfbmask[idx])) | \
+ ((((_src & (mask))>>cfb24Shift[idx])&cfbmask[idx])); \
+ (dst)--; \
+ }
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyInverted)
#endif
@@ -124,7 +276,24 @@ extern mergeRopRec mergeRopBits[16];
#define MROP_DECLARE_REG()
#define MROP_INITIALIZE(alu,pm)
#define MROP_SOLID(src,dst) ((src) ^ (dst))
+#define MROP_SOLID24(src,dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src = (src); \
+ *(dst) ^= ((_src << cfb24Shift[idx])&cfbmask[idx]); \
+ idx++; \
+ (dst)++; \
+ *(dst) ^= ((_src >>cfb24Shift[idx])&cfbmask[idx]); \
+ (dst)--; \
+ }
#define MROP_MASK(src,dst,mask) (((src) & (mask)) ^ (dst))
+#define MROP_MASK24(src,dst,mask,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) ^= ((((src)&(mask))<<cfb24Shift[idx])&cfbmask[idx]); \
+ idx++; \
+ (dst)++; \
+ *(dst) ^= ((((src)&(mask))>>cfb24Shift[idx])&cfbmask[idx]); \
+ (dst)--; \
+ }
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Xor)
#endif
@@ -133,12 +302,29 @@ extern mergeRopRec mergeRopBits[16];
#define MROP_DECLARE_REG()
#define MROP_INITIALIZE(alu,pm)
#define MROP_SOLID(src,dst) ((src) | (dst))
+#define MROP_SOLID24(src,dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) |= (((src)<<cfb24Shift[idx])&cfbmask[idx]); \
+ idx++; \
+ (dst)++; \
+ *(dst) |= (((src)>>cfb24Shift[idx])&cfbmask[idx]); \
+ (dst)--; \
+ }
#define MROP_MASK(src,dst,mask) (((src) & (mask)) | (dst))
+#define MROP_MASK24(src,dst,mask,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ MfbBits _src = (src); \
+ *(dst) |= (((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx]); \
+ idx++; \
+ (dst)++; \
+ *(dst) |= (((_src &(mask))>>cfb24Shift[idx])&cfbmask[idx]); \
+ (dst)--; \
+ }
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Or)
#endif
#if (MROP) == (Mcopy|Mxor|MandReverse|Mor)
-#define MROP_DECLARE() unsigned long _ca1, _cx1;
+#define MROP_DECLARE() MfbBits _ca1 = 0, _cx1 = 0;
#define MROP_DECLARE_REG() register MROP_DECLARE()
#define MROP_INITIALIZE(alu,pm) { \
mergeRopPtr _bits; \
@@ -147,37 +333,60 @@ extern mergeRopRec mergeRopBits[16];
_cx1 = _bits->cx1; \
}
#define MROP_SOLID(src,dst) \
- ((dst) & ((src) & _ca1 ^ _cx1) ^ (src))
+ (((dst) & (((src) & _ca1) ^ _cx1)) ^ (src))
#define MROP_MASK(src,dst,mask) \
- ((dst) & (((src) & _ca1 ^ _cx1) | ~(mask)) ^ ((src) & (mask)))
+ (((dst) & ((((src) & _ca1) ^ _cx1)) | (~(mask)) ^ ((src) & (mask))))
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyXorAndReverseOr)
#define MROP_PREBUILD(src) PrebuildMergeRop(src)
#define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop()
#define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst)
+#define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index)
#define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask)
+#define MROP_PREBUILT_MASK24(src,dst,mask,index) DoMaskPrebuiltMergeRop24(dst,mask,index)
#endif
#if (MROP) == 0
+#if !defined(PSZ) || (PSZ != 24)
#define MROP_DECLARE() DeclareMergeRop()
#define MROP_DECLARE_REG() register DeclareMergeRop()
#define MROP_INITIALIZE(alu,pm) InitializeMergeRop(alu,pm)
#define MROP_SOLID(src,dst) DoMergeRop(src,dst)
#define MROP_MASK(src,dst,mask) DoMaskMergeRop(src, dst, mask)
+#else
+#define MROP_DECLARE() \
+ DeclareMergeRop() \
+ DeclareMergeRop24()
+#define MROP_DECLARE_REG() \
+ register DeclareMergeRop()\
+ DeclareMergeRop24()
+#define MROP_INITIALIZE(alu,pm) \
+ InitializeMergeRop(alu,pm)\
+ InitializeMergeRop24(alu,pm)
+#define MROP_SOLID(src,dst) DoMergeRop24u(src,dst,((int)(&(dst)-pdstBase) % 3))
+#define MROP_MASK(src,dst,mask) DoMaskMergeRop24u(src, dst, mask,((int)(&(dst) - pdstBase)%3))
+#endif
+#define MROP_SOLID24(src,dst,index) DoMergeRop24(src,dst,index)
+#define MROP_MASK24(src,dst,mask,index) DoMaskMergeRop24(src, dst, mask,index)
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,General)
#define MROP_PREBUILD(src) PrebuildMergeRop(src)
#define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop()
#define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst)
+#define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index)
#define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask)
+#define MROP_PREBUILT_MASK24(src,dst,mask,index) \
+ DoMaskPrebuiltMergeRop24(dst,mask,index)
#endif
#ifndef MROP_PREBUILD
#define MROP_PREBUILD(src)
#define MROP_PREBUILT_DECLARE()
#define MROP_PREBUILT_SOLID(src,dst) MROP_SOLID(src,dst)
+#define MROP_PREBUILT_SOLID24(src,dst,index) MROP_SOLID24(src,dst,index)
#define MROP_PREBUILT_MASK(src,dst,mask) MROP_MASK(src,dst,mask)
+#define MROP_PREBUILT_MASK24(src,dst,mask,index) MROP_MASK24(src,dst,mask,index)
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define MROP_NAME_CAT(prefix,suffix) prefix##suffix
#else
#define MROP_NAME_CAT(prefix,suffix) prefix/**/suffix
diff --git a/mfb/mfb.h b/mfb/mfb.h
index 56c0f9667..c41a2077f 100644
--- a/mfb/mfb.h
+++ b/mfb/mfb.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.19 2003/02/18 21:30:01 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -46,6 +47,12 @@ SOFTWARE.
******************************************************************/
/* $Xorg: mfb.h,v 1.4 2001/02/09 02:05:18 xorgcvs Exp $ */
+
+#if !defined(_MFB_H_) || defined(MFB_PROTOTYPES_ONLY)
+#ifndef MFB_PROTOTYPES_ONLY
+#define _MFB_H_
+#endif
+
/* Monochrome Frame Buffer definitions
written by drewry, september 1986
*/
@@ -58,10 +65,14 @@ SOFTWARE.
extern int InverseAlu[];
+
/* warning: PixelType definition duplicated in maskbits.h */
#ifndef PixelType
-#define PixelType unsigned long
+#define PixelType CARD32
#endif /* PixelType */
+#ifndef MfbBits
+#define MfbBits CARD32
+#endif
/* mfbbitblt.c */
@@ -92,7 +103,20 @@ extern RegionPtr mfbCopyArea(
extern Bool mfbRegisterCopyPlaneProc(
#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
- RegionPtr (* /*proc*/)()
+ RegionPtr (* /*proc*/)(
+#if NeedNestedPrototypes
+ DrawablePtr /* pSrcDrawable */,
+ DrawablePtr /* pDstDrawable */,
+ GCPtr /* pGC */,
+ int /* srcx */,
+ int /* srcy */,
+ int /* width */,
+ int /* height */,
+ int /* dstx */,
+ int /* dsty */,
+ unsigned long /* bitPlane */
+#endif
+ )
#endif
);
@@ -454,7 +478,7 @@ extern void mfbGetSpans(
);
/* mfbhrzvert.c */
-extern int mfbHorzS(
+extern void mfbHorzS(
#if NeedFunctionPrototypes
int /*rop*/,
PixelType * /*addrl*/,
@@ -465,7 +489,7 @@ extern int mfbHorzS(
#endif
);
-extern int mfbVertS(
+extern void mfbVertS(
#if NeedFunctionPrototypes
int /*rop*/,
PixelType * /*addrl*/,
@@ -825,6 +849,20 @@ extern Bool mfbScreenInit(
int /*width*/
#endif
);
+
+extern PixmapPtr mfbGetWindowPixmap(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern void mfbSetWindowPixmap(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ PixmapPtr /*pPix*/
+#endif
+);
+
/* mfbseg.c */
extern void mfbSegmentSS(
@@ -846,7 +884,7 @@ extern void mfbSegmentSD(
);
/* mfbsetsp.c */
-extern int mfbSetScanline(
+extern void mfbSetScanline(
#if NeedFunctionPrototypes
int /*y*/,
int /*xOrigin*/,
@@ -987,6 +1025,7 @@ extern void mfbZeroPolyArcSS(
#endif
);
+#ifndef MFB_PROTOTYPES_ONLY
/*
private filed of pixmap
pixmap.devPrivate = (PixelType *)pointer_to_bits
@@ -1000,23 +1039,26 @@ displayable screen (e.g. the early vsII, which displayed 960 pixels
across, but was 1024 in the hardware.)
private field of GC
- Freeing pCompositeClip is done based on the value of
-freeCompClip; if freeCompClip is not carefully maintained, we will end
-up losing storage or freeing something that isn't ours.
*/
+typedef void (*mfbFillAreaProcPtr)(
+#if NeedNestedPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*nop*/
+#endif
+ );
typedef struct {
unsigned char rop; /* reduction of rasterop to 1 of 3 */
unsigned char ropOpStip; /* rop for opaque stipple */
unsigned char ropFillArea; /* == alu, rop, or ropOpStip */
- unsigned fExpose:1; /* callexposure handling ? */
- unsigned freeCompClip:1;
- PixmapPtr pRotatedPixmap; /* tile/stipple rotated to align */
- RegionPtr pCompositeClip; /* free this based on freeCompClip
- flag rather than NULLness */
- void (* FillArea)(); /* fills regions; look at the code */
+ unsigned char unused1[sizeof(long) - 3]; /* Alignment */
+ mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */
} mfbPrivGC;
typedef mfbPrivGC *mfbPrivGCPtr;
+#endif
extern int mfbGCPrivateIndex; /* index into GC private array */
extern int mfbWindowPrivateIndex; /* index into Window private array */
@@ -1024,6 +1066,7 @@ extern int mfbWindowPrivateIndex; /* index into Window private array */
extern int frameWindowPrivateIndex; /* index into Window private array */
#endif
+#ifndef MFB_PROTOTYPES_ONLY
/* private field of window */
typedef struct {
unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */
@@ -1036,10 +1079,10 @@ typedef struct {
/* Common macros for extracting drawing information */
-#define mfbGetTypedWidth(pDrawable,type) (\
+#define mfbGetTypedWidth(pDrawable,wtype) (\
(((pDrawable)->type == DRAWABLE_WINDOW) ? \
(int) (((PixmapPtr)((pDrawable)->pScreen->devPrivate))->devKind) : \
- (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (type))
+ (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
#define mfbGetByteWidth(pDrawable) mfbGetTypedWidth(pDrawable, unsigned char)
@@ -1161,7 +1204,8 @@ than a switch on the rop per item (span or rectangle.)
#define fnCOPYINVERTED(src, dst)(~src)
#define fnORINVERTED(src, dst) (~src | dst)
#define fnNAND(src, dst) (~(src & dst))
-#define fnSET(src, dst) (~0)
+#undef fnSET
+#define fnSET(src, dst) (MfbBits)(~0)
/* Using a "switch" statement is much faster in most cases
* since the compiler can do a look-up table or multi-way branch
@@ -1177,6 +1221,7 @@ than a switch on the rop per item (span or rectangle.)
* Note that this requires a change to the "calling sequence"
* since we can't engineer a "switch" statement to have an lvalue.
*/
+#undef DoRop
#define DoRop(result, alu, src, dst) \
{ \
if (alu == GXcopy) \
@@ -1198,6 +1243,7 @@ than a switch on the rop per item (span or rectangle.)
case GXandInverted: \
result = fnANDINVERTED (src, dst); \
break; \
+ default: \
case GXnoop: \
result = fnNOOP (src, dst); \
break; \
@@ -1248,3 +1294,13 @@ than a switch on the rop per item (span or rectangle.)
#define MFB_EQWHOLEWORD_INVERT ^=~0
#define MFB_OP_WHITE /* nothing */
#define MFB_OP_BLACK ~
+
+/*
+ * if MFB is built as a module, it shouldn't call libc functions.
+ */
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+#endif
+
+#endif /* MFB_PROTOTYPES_ONLY */
+#endif /* _MFB_H_ */
diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c
index 7fe20aec2..601f59d54 100644
--- a/mfb/mfbbitblt.c
+++ b/mfb/mfbbitblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbbitblt.c,v 1.6 2001/12/14 20:00:04 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -132,7 +133,7 @@ int srcx, srcy;
int width, height;
int dstx, dsty;
{
- RegionPtr prgnSrcClip; /* may be a new region, or just a copy */
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
Bool freeSrcClip = FALSE;
RegionPtr prgnExposed;
@@ -192,7 +193,7 @@ int dstx, dsty;
if ((pSrcDrawable == pDstDrawable) &&
(pGC->clientClipType == CT_NONE))
{
- prgnSrcClip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ prgnSrcClip = pGC->pCompositeClip;
}
else
{
@@ -214,7 +215,7 @@ int dstx, dsty;
else if ((pSrcDrawable == pDstDrawable) &&
(pGC->clientClipType == CT_NONE))
{
- prgnSrcClip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ prgnSrcClip = pGC->pCompositeClip;
}
else
{
@@ -300,7 +301,7 @@ int dstx, dsty;
/* If the destination composite clip is one rectangle we can
do the clip directly. Otherwise we have to create a full
blown region and call intersect */
- cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ cclip = pGC->pCompositeClip;
if (REGION_NUM_RECTS(cclip) == 1)
{
BoxPtr pBox = REGION_RECTS(cclip);
@@ -336,8 +337,7 @@ int dstx, dsty;
if (!fastClip)
{
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
}
/* Do bit blitting */
@@ -367,7 +367,7 @@ int dstx, dsty;
}
prgnExposed = NULL;
- if (((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->fExpose)
+ if (pGC->fExpose)
{
/* Pixmap sources generate a NoExposed (we return NULL to do this) */
if (!fastExpose)
diff --git a/mfb/mfbblt.c b/mfb/mfbblt.c
index 28f16febc..59968110b 100644
--- a/mfb/mfbblt.c
+++ b/mfb/mfbblt.c
@@ -1,6 +1,7 @@
/*
* mfb copy area
*/
+/* $XFree86: xc/programs/Xserver/mfb/mfbblt.c,v 3.4 2001/12/14 20:00:04 dawes Exp $ */
/*
@@ -82,14 +83,7 @@ MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc)
register PixelType bits;
register PixelType bits1;
register int nl; /* temp copy of nlMiddle */
-
- /* place to store full source word */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
int careful;
- int tmpSrc;
MROP_INITIALIZE(alu,0);
@@ -336,8 +330,10 @@ psrc += UNROLL;
if (startmask)
{
bits1 = BitLeft(bits,leftShift);
- bits = *psrc++;
- bits1 |= BitRight(bits,rightShift);
+ if (BitLeft(startmask, rightShift)) {
+ bits = *psrc++;
+ bits1 |= BitRight(bits,rightShift);
+ }
*pdst = MROP_MASK(bits1, *pdst, startmask);
pdst++;
}
@@ -500,8 +496,10 @@ psrc -= UNROLL;
if (endmask)
{
bits1 = BitRight(bits, rightShift);
- bits = *--psrc;
- bits1 |= BitLeft(bits, leftShift);
+ if (BitRight(endmask, leftShift)) {
+ bits = *--psrc;
+ bits1 |= BitLeft(bits, leftShift);
+ }
pdst--;
*pdst = MROP_MASK(bits1, *pdst, endmask);
}
diff --git a/mfb/mfbbres.c b/mfb/mfbbres.c
index 6eb954281..d43bd2e00 100644
--- a/mfb/mfbbres.c
+++ b/mfb/mfbbres.c
@@ -1,4 +1,5 @@
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/* $XFree86: xc/programs/Xserver/mfb/mfbbres.c,v 1.5 2001/12/14 20:00:05 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -71,7 +72,7 @@ int e2;
int len; /* length of line */
{
register int yinc; /* increment to next scanline, in bytes */
- register PixelType *addrl; /* bitmask long pointer */
+ register PixelType *addrl; /* bitmask 32-bit pointer */
register PixelType bit; /* current bit being set/cleared/etc. */
PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
diff --git a/mfb/mfbbresd.c b/mfb/mfbbresd.c
index f71070773..182744d6e 100644
--- a/mfb/mfbbresd.c
+++ b/mfb/mfbbresd.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbbresd.c,v 1.5 2001/12/14 20:00:05 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -87,7 +88,7 @@ int len; /* length of line */
register int yinc; /* increment to next scanline, in bytes */
register PixelType *addrl;
register int e3 = e2-e1;
- register unsigned long bit;
+ register MfbBits bit;
PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
int dashIndex;
diff --git a/mfb/mfbclip.c b/mfb/mfbclip.c
index 65d902162..0de94b3f9 100644
--- a/mfb/mfbclip.c
+++ b/mfb/mfbclip.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbclip.c,v 1.5 2001/12/14 20:00:05 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -53,6 +54,7 @@ SOFTWARE.
#include "gc.h"
#include "maskbits.h"
#include "mi.h"
+#include "mfb.h"
#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \
if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
@@ -93,7 +95,7 @@ mfbPixmapToRegion(pPix)
register RegionPtr pReg;
register PixelType *pw, w;
register int ib;
- int width, h, base, rx1, crects;
+ int width, h, base, rx1 = 0, crects;
PixelType *pwLineEnd;
int irectPrevStart, irectLineStart;
register BoxPtr prectO, prectN;
diff --git a/mfb/mfbcmap.c b/mfb/mfbcmap.c
index 656c9daf6..d5dfbf47f 100644
--- a/mfb/mfbcmap.c
+++ b/mfb/mfbcmap.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.8 2003/02/18 21:30:01 tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -49,6 +50,8 @@ SOFTWARE.
#include "scrnintstr.h"
#include "colormapst.h"
#include "resource.h"
+#include "micmap.h"
+#include "mfb.h"
/* A monochrome frame buffer is a static gray colormap with two entries.
* We have a "required list" of length 1. Because we can only support 1
@@ -63,17 +66,13 @@ SOFTWARE.
* The required list concept is pretty much irrelevant when you can only
* have one map installed at a time.
*/
-static ColormapPtr InstalledMaps[MAXSCREENS];
int
mfbListInstalledColormaps(pScreen, pmaps)
ScreenPtr pScreen;
Colormap *pmaps;
{
- /* By the time we are processing requests, we can guarantee that there
- * is always a colormap installed */
- *pmaps = InstalledMaps[pScreen->myNum]->mid;
- return (1);
+ return miListInstalledColormaps(pScreen, pmaps);
}
@@ -81,38 +80,14 @@ void
mfbInstallColormap(pmap)
ColormapPtr pmap;
{
- int index = pmap->pScreen->myNum;
- ColormapPtr oldpmap = InstalledMaps[index];
-
- if(pmap != oldpmap)
- {
- /* Uninstall pInstalledMap. No hardware changes required, just
- * notify all interested parties. */
- if(oldpmap != (ColormapPtr)None)
- WalkTree(pmap->pScreen, TellLostMap, (pointer)&oldpmap->mid);
- /* Install pmap */
- InstalledMaps[index] = pmap;
- WalkTree(pmap->pScreen, TellGainedMap, (pointer)&pmap->mid);
-
- }
+ miInstallColormap(pmap);
}
void
mfbUninstallColormap(pmap)
ColormapPtr pmap;
{
- int index = pmap->pScreen->myNum;
- ColormapPtr curpmap = InstalledMaps[index];
-
- if(pmap == curpmap)
- {
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
- RT_COLORMAP);
- (*pmap->pScreen->InstallColormap)(curpmap);
- }
- }
+ miUninstallColormap(pmap);
}
/*ARGSUSED*/
@@ -181,18 +156,5 @@ Bool
mfbCreateDefColormap (pScreen)
ScreenPtr pScreen;
{
- VisualPtr pVisual;
- ColormapPtr pColormap;
-
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++)
- ;
- if (CreateColormap (pScreen->defColormap, pScreen, pVisual,
- &pColormap, AllocNone, 0) != Success)
- {
- return FALSE;
- }
- (*pScreen->InstallColormap) (pColormap);
- return TRUE;
+ return miCreateDefColormap(pScreen);
}
diff --git a/mfb/mfbfillarc.c b/mfb/mfbfillarc.c
index 0d78decf1..5484e9259 100644
--- a/mfb/mfbfillarc.c
+++ b/mfb/mfbfillarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbfillarc.c,v 1.5 2001/12/14 20:00:06 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -288,7 +289,7 @@ mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs)
rop = priv->rop;
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
return;
- cclip = priv->pCompositeClip;
+ cclip = pGC->pCompositeClip;
for (arc = parcs, i = narcs; --i >= 0; arc++)
{
if (miFillArcEmpty(arc))
diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c
index 1c4c2e617..cd1b66845 100644
--- a/mfb/mfbfillrct.c
+++ b/mfb/mfbfillrct.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.6 2003/02/18 21:30:01 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -59,7 +60,6 @@ SOFTWARE.
#include "maskbits.h"
#define MODEQ(a, b) ((a) %= (b))
-void mfbPaintOddSize();
/*
filled rectangles.
@@ -88,7 +88,7 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
int xorg, yorg;
mfbPrivGC *priv;
int alu;
- void (* pfn) ();
+ mfbFillAreaProcPtr pfn;
PixmapPtr ppix;
if (!(pGC->planemask & 1))
@@ -97,8 +97,8 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr;
alu = priv->ropFillArea;
pfn = priv->FillArea;
- ppix = priv->pRotatedPixmap;
- prgnClip = priv->pCompositeClip;
+ ppix = pGC->pRotatedPixmap;
+ prgnClip = pGC->pCompositeClip;
prect = prectInit;
xorg = pDrawable->x;
diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c
index 0ba5fc9a7..5a095757f 100644
--- a/mfb/mfbfillsp.c
+++ b/mfb/mfbfillsp.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbfillsp.c,v 1.9 2001/12/14 20:00:06 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -107,7 +108,7 @@ mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -118,8 +119,7 @@ mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
@@ -180,7 +180,7 @@ mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -191,8 +191,7 @@ mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
@@ -253,7 +252,7 @@ mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -264,8 +263,7 @@ mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
@@ -329,7 +327,7 @@ mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -340,13 +338,12 @@ mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
- pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
+ pStipple = pGC->pRotatedPixmap;
tileHeight = pStipple->drawable.height;
psrc = (PixelType *)(pStipple->devPrivate.ptr);
@@ -407,7 +404,7 @@ mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -418,13 +415,12 @@ mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
- pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
+ pStipple = pGC->pRotatedPixmap;
tileHeight = pStipple->drawable.height;
psrc = (PixelType *)(pStipple->devPrivate.ptr);
@@ -485,7 +481,7 @@ mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -496,13 +492,12 @@ mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
- pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
+ pStipple = pGC->pRotatedPixmap;
tileHeight = pStipple->drawable.height;
psrc = (PixelType *)(pStipple->devPrivate.ptr);
@@ -599,13 +594,13 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
int rop;
int *pwidthFree; /* copies of the pointers to free */
DDXPointPtr pptFree;
- unsigned long flip;
+ MfbBits flip;
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -616,13 +611,12 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
- pTile = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
+ pTile = pGC->pRotatedPixmap;
tileHeight = pTile->drawable.height;
psrc = (PixelType *)(pTile->devPrivate.ptr);
if (pGC->fillStyle == FillTiled)
@@ -638,7 +632,7 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
case GXcopy:
{
-#define DoMaskCopyRop(src,dst,mask) ((dst) & ~(mask) | (src) & (mask))
+#define DoMaskCopyRop(src,dst,mask) (((dst) & ~(mask)) | ((src) & (mask)))
while (n--)
{
@@ -749,7 +743,7 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -760,8 +754,7 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
if (pGC->fillStyle == FillTiled)
@@ -848,8 +841,16 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
{
putbitsrop(*psrc, (x & PIM), nstart, pdst, rop);
pdst++;
+#if defined(__alpha__) || defined(__alpha)
+ /*
+ * XXX workaround an egcs 1.1.2 code generation
+ * bug. This version might actually be faster.
+ */
+ psrc += srcStartOver;
+#else
if(srcStartOver)
psrc++;
+#endif
}
while(nlMiddle--)
@@ -908,7 +909,7 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (!(pGC->planemask & 1))
return;
- n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
@@ -919,8 +920,7 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
}
pwidth = pwidthFree;
ppt = pptFree;
- n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
- pptInit, pwidthInit, nInit,
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
pTile = pGC->stipple;
diff --git a/mfb/mfbgc.c b/mfb/mfbgc.c
index 8ab76ad37..314af0b4a 100644
--- a/mfb/mfbgc.c
+++ b/mfb/mfbgc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.8 2003/02/18 21:30:01 tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -735,10 +736,10 @@ mfbCreateGC(pGC)
pPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr);
pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel);
- pPriv->fExpose = TRUE;
- pPriv->pRotatedPixmap = NullPixmap;
- pPriv->freeCompClip = FALSE;
- pPriv->FillArea = mfbSolidWhiteArea;
+ pGC->fExpose = TRUE;
+ pGC->pRotatedPixmap = NullPixmap;
+ pGC->freeCompClip = FALSE;
+ pPriv->FillArea = mfbSolidInvertArea;
return TRUE;
}
@@ -909,7 +910,7 @@ mfbValidateGC(pGC, changes, pDrawable)
!(pGC->tile.pixmap->drawable.width & (pGC->tile.pixmap->drawable.width - 1)))
{
mfbCopyRotatePixmap(pGC->tile.pixmap,
- &devPriv->pRotatedPixmap, xrot, yrot);
+ &pGC->pRotatedPixmap, xrot, yrot);
new_pix = TRUE;
}
break;
@@ -919,15 +920,15 @@ mfbValidateGC(pGC, changes, pDrawable)
!(pGC->stipple->drawable.width & (pGC->stipple->drawable.width - 1)))
{
mfbCopyRotatePixmap(pGC->stipple,
- &devPriv->pRotatedPixmap, xrot, yrot);
+ &pGC->pRotatedPixmap, xrot, yrot);
new_pix = TRUE;
}
}
/* destroy any previously rotated tile or stipple */
- if (!new_pix && devPriv->pRotatedPixmap)
+ if (!new_pix && pGC->pRotatedPixmap)
{
- (*pDrawable->pScreen->DestroyPixmap)(devPriv->pRotatedPixmap);
- devPriv->pRotatedPixmap = (PixmapPtr)NULL;
+ (*pDrawable->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
+ pGC->pRotatedPixmap = (PixmapPtr)NULL;
}
}
@@ -981,7 +982,7 @@ mfbValidateGC(pGC, changes, pDrawable)
{
GCOps *newops;
- if (newops = matchCommon (pGC))
+ if ((newops = matchCommon (pGC)))
{
if (pGC->ops->devPrivate.val)
miDestroyGCOps (pGC->ops);
@@ -1151,11 +1152,11 @@ mfbValidateGC(pGC, changes, pDrawable)
/* beyond this point, opaqueStippled ==> fg != bg */
else if (((pGC->fillStyle == FillTiled) ||
(pGC->fillStyle == FillOpaqueStippled)) &&
- !devPriv->pRotatedPixmap)
+ !pGC->pRotatedPixmap)
{
pGC->ops->FillSpans = mfbUnnaturalTileFS;
}
- else if ((pGC->fillStyle == FillStippled) && !devPriv->pRotatedPixmap)
+ else if ((pGC->fillStyle == FillStippled) && !pGC->pRotatedPixmap)
{
pGC->ops->FillSpans = mfbUnnaturalStippleFS;
}
@@ -1190,7 +1191,7 @@ mfbValidateGC(pGC, changes, pDrawable)
*/
if ((((pGC->fillStyle == FillTiled) ||
(pGC->fillStyle == FillStippled)) &&
- !devPriv->pRotatedPixmap) ||
+ !pGC->pRotatedPixmap) ||
((pGC->fillStyle == FillOpaqueStippled) &&
((pGC->fgPixel & 1) != (pGC->bgPixel & 1)))
)
@@ -1217,7 +1218,7 @@ mfbValidateGC(pGC, changes, pDrawable)
devPriv->FillArea = mfbSolidInvertArea;
break;
case RROP_NOP:
- devPriv->FillArea = (void (*)())NoopDDA;
+ devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA;
break;
}
}
@@ -1235,7 +1236,7 @@ mfbValidateGC(pGC, changes, pDrawable)
devPriv->FillArea = mfbStippleInvertArea;
break;
case RROP_NOP:
- devPriv->FillArea = (void (*)())NoopDDA;
+ devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA;
break;
}
}
@@ -1288,11 +1289,11 @@ mfbValidateGC(pGC, changes, pDrawable)
/* beyond this point, opaqueStippled ==> fg != bg */
else if (((pGC->fillStyle == FillTiled) ||
(pGC->fillStyle == FillOpaqueStippled)) &&
- !devPriv->pRotatedPixmap)
+ !pGC->pRotatedPixmap)
{
pGC->ops->FillSpans = mfbUnnaturalTileFS;
}
- else if ((pGC->fillStyle == FillStippled) && !devPriv->pRotatedPixmap)
+ else if ((pGC->fillStyle == FillStippled) && !pGC->pRotatedPixmap)
{
pGC->ops->FillSpans = mfbUnnaturalStippleFS;
}
@@ -1321,7 +1322,7 @@ mfbValidateGC(pGC, changes, pDrawable)
*/
if ((((pGC->fillStyle == FillTiled) ||
(pGC->fillStyle == FillStippled)) &&
- !devPriv->pRotatedPixmap) ||
+ !pGC->pRotatedPixmap) ||
((pGC->fillStyle == FillOpaqueStippled) &&
((pGC->fgPixel & 1) != (pGC->bgPixel & 1)))
)
@@ -1348,7 +1349,7 @@ mfbValidateGC(pGC, changes, pDrawable)
devPriv->FillArea = mfbSolidInvertArea;
break;
case RROP_NOP:
- devPriv->FillArea = (void (*)())NoopDDA;
+ devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA;
break;
}
}
@@ -1366,7 +1367,7 @@ mfbValidateGC(pGC, changes, pDrawable)
devPriv->FillArea = mfbStippleInvertArea;
break;
case RROP_NOP:
- devPriv->FillArea = (void (*)())NoopDDA;
+ devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA;
break;
}
}
@@ -1414,7 +1415,7 @@ mfbReduceRop(alu, src)
register int alu;
register Pixel src;
{
- int rop;
+ int rop = 0;
if ((src & 1) == 0) /* src is black */
{
switch(alu)
diff --git a/mfb/mfbgetsp.c b/mfb/mfbgetsp.c
index 9e0a5b513..59bd7e538 100644
--- a/mfb/mfbgetsp.c
+++ b/mfb/mfbgetsp.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbgetsp.c,v 1.4 2003/02/18 21:30:01 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -76,7 +77,7 @@ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
int nspans; /* number of scanlines to copy */
char *pchardstStart; /* where to put the bits */
{
- PixelType *pdstStart = (PixelType *)pchardstStart;
+ PixelType *pdstStart = (PixelType *)(pointer)pchardstStart;
register PixelType *pdst; /* where to put the bits */
register PixelType *psrc; /* where to get the bits */
register PixelType tmpSrc; /* scratch buffer for bits */
@@ -85,7 +86,7 @@ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
register DDXPointPtr pptLast; /* one past last point to get */
int xEnd; /* last pixel to copy from */
register int nstart;
- int nend;
+ int nend = 0;
int srcStartOver;
PixelType startmask, endmask;
unsigned int srcBit;
diff --git a/mfb/mfbhrzvert.c b/mfb/mfbhrzvert.c
index 5498a4c0b..237e337f5 100644
--- a/mfb/mfbhrzvert.c
+++ b/mfb/mfbhrzvert.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbhrzvert.c,v 1.5 2001/12/14 20:00:08 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -59,6 +60,7 @@ SOFTWARE.
/* horizontal solid line
abs(len) > 1
*/
+void
mfbHorzS(rop, addrl, nlwidth, x1, y1, len)
int rop; /* a reduced rasterop */
register PixelType *addrl; /* pointer to base of bitmap */
@@ -137,6 +139,7 @@ int len; /* length of line */
it's OK to use it.
*/
+void
mfbVertS(rop, addrl, nlwidth, x1, y1, len)
int rop; /* a reduced rasterop */
register PixelType *addrl; /* pointer to base of bitmap */
diff --git a/mfb/mfbimage.c b/mfb/mfbimage.c
index 93b01db02..4d616ed8b 100644
--- a/mfb/mfbimage.c
+++ b/mfb/mfbimage.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbimage.c,v 1.6 2001/12/14 20:00:08 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -109,14 +110,14 @@ mfbPutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pImage)
if (!pPixmap)
return;
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->fExpose = FALSE;
+ pGC->fExpose = FALSE;
if (format != XYBitmap)
(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0,
w, h, x, y);
else
(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0,
w, h, x, y, 1);
- ((mfbPrivGC*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->fExpose = TRUE;
+ pGC->fExpose = TRUE;
FreeScratchPixmapHeader(pPixmap);
}
@@ -139,7 +140,6 @@ mfbGetImage( pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
unsigned long planeMask;
char *pdstLine;
{
- PixmapPtr pPixmap;
BoxRec box;
DDXPointRec ptSrc;
RegionRec rgnDst;
diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c
index 9542b5556..428e4c46b 100644
--- a/mfb/mfbimggblt.c
+++ b/mfb/mfbimggblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.5 2003/02/18 21:30:01 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -138,7 +139,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
register PixelType endmask;
register int nFirst;/* bits of glyph in current longword */
- void (* oldFillArea)();
+ mfbPrivGC *pPrivGC;
+ mfbFillAreaProcPtr oldFillArea;
/* we might temporarily usurp this
field in devPriv */
@@ -165,9 +167,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
bbox.y2 = y + info.overallDescent;
/* UNCLEAN CODE
- we know the mfbPolyFillRect uses only three fields in
- devPrivate[mfbGCPrivateIndex].ptr, two of which (the rotated
- tile/stipple and the ropFillArea) are
+ we know the mfbPolyFillRect uses only two fields in
+ devPrivate[mfbGCPrivateIndex].ptr, one of which (ropFillArea) is
irrelevant for solid filling, so we just poke the FillArea
field. the GC is now in an inconsistent state, but we'll fix
it as soon as PolyFillRect returns. fortunately, the server
@@ -181,27 +182,23 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
but that is usually not a cheap thing to do.
*/
- oldFillArea = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea;
+ pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr;
+ oldFillArea = pPrivGC->FillArea;
-/* pcc doesn't like this. why?
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea =
- ((pGC->bgPixel & 1) ? mfbSolidWhiteArea : mfbSolidBlackArea);
-*/
if (pGC->bgPixel & 1)
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = mfbSolidWhiteArea;
+ pPrivGC->FillArea = mfbSolidWhiteArea;
else
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = mfbSolidBlackArea;
+ pPrivGC->FillArea = mfbSolidBlackArea;
#ifndef LOWMEMFTPT
mfbPolyFillRect(pDrawable, pGC, 1, &backrect);
#else
miPolyFillRect(pDrawable, pGC, 1, &backrect);
#endif
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = oldFillArea;
+ pPrivGC->FillArea = oldFillArea;
/* the faint-hearted can open their eyes now */
- switch (RECT_IN_REGION(pGC->pScreen,
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox))
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
{
case rgnOUT:
break;
@@ -218,7 +215,7 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
/* start at top scanline of glyph */
- pdst = mfbScanlineDelta(pdstBase, -pci->metrics.ascent, widthDst);
+ pdst = pdstBase;
/* find correct word in scanline and x offset within it
for left edge of glyph
@@ -235,6 +232,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pdst--;
}
+ pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst);
+
if ((xoff + w) <= PPW)
{
/* glyph all in one longword */
@@ -328,7 +327,7 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
}
}
- cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ cclip = pGC->pCompositeClip;
pbox = REGION_RECTS(cclip);
nbox = REGION_NUM_RECTS(cclip);
@@ -388,7 +387,7 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pglyph = FONTGLYPHBITS(pglyphBase, pci);
pglyph += (glyphRow * widthGlyph);
- pdst = mfbScanlineDelta(ppos[i].pdstBase, -(y-topEdge), widthDst);
+ pdst = ppos[i].pdstBase;
glyphCol = (leftEdge - ppos[i].xpos) -
(pci->metrics.leftSideBearing);
@@ -405,6 +404,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pdst--;
}
+ pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst);
+
if ((xoff + w) <= PPW)
{
maskpartialbits(xoff, w, startmask);
diff --git a/mfb/mfbline.c b/mfb/mfbline.c
index 70e61e6ed..e7e678983 100644
--- a/mfb/mfbline.c
+++ b/mfb/mfbline.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbline.c,v 1.7 2001/12/14 20:00:09 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -115,7 +116,9 @@ mfbLineSS (pDrawable, pGC, mode, npt, pptInit)
unsigned int oc2; /* outcode of point 2 */
PixelType *addrlBase; /* pointer to start of drawable */
+#ifndef POLYSEGMENT
PixelType *addrl; /* address of destination pixmap */
+#endif
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
@@ -138,7 +141,7 @@ mfbLineSS (pDrawable, pGC, mode, npt, pptInit)
if (!(pGC->planemask & 1))
return;
- cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ cclip = pGC->pCompositeClip;
alu = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
@@ -505,7 +508,7 @@ mfbLineSD( pDrawable, pGC, mode, npt, pptInit)
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
int x1, x2, y1, y2;
RegionPtr cclip;
- int fgrop, bgrop;
+ int fgrop = 0, bgrop = 0;
unsigned char *pDash;
int dashOffset;
int numInDashList;
@@ -517,7 +520,7 @@ mfbLineSD( pDrawable, pGC, mode, npt, pptInit)
if (!(pGC->planemask & 1))
return;
- cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ cclip = pGC->pCompositeClip;
fgrop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
@@ -723,7 +726,7 @@ dontStep: ;
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
- unsigned long _mask;
+ MfbBits _mask;
int rop;
rop = fgrop;
diff --git a/mfb/mfbply1rct.c b/mfb/mfbply1rct.c
index 5cb81df53..980e57246 100644
--- a/mfb/mfbply1rct.c
+++ b/mfb/mfbply1rct.c
@@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.8 2002/12/09 04:10:57 tsi Exp $ */
+
#include "X.h"
#include "gcstruct.h"
@@ -46,12 +48,12 @@ in this Software without prior written authorization from The Open Group.
#if IMAGE_BYTE_ORDER == MSBFirst
#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
-#define coordToInt(x,y) (((x) << 16) | (y))
+#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff))
#define intToX(i) (GetHighWord(i))
#define intToY(i) ((int) ((short) i))
#else
#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
-#define coordToInt(x,y) (((y) << 16) | (x))
+#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff))
#define intToX(i) ((int) ((short) (i)))
#define intToY(i) (GetHighWord(i))
#endif
@@ -60,10 +62,11 @@ void
MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn)
DrawablePtr pDrawable;
GCPtr pGC;
+ int shape;
+ int mode;
int count;
DDXPointPtr ptsIn;
{
- mfbPrivGCPtr devPriv;
int nlwidth;
PixelType *addrl, *addr;
int maxy;
@@ -73,29 +76,28 @@ MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn)
BoxPtr extents;
int clip;
int y;
- int *vertex1p, *vertex2p;
+ int *vertex1p = NULL, *vertex2p;
int *endp;
- int x1, x2;
- int dx1, dx2;
- int dy1, dy2;
- int e1, e2;
- int step1, step2;
- int sign1, sign2;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0;
+ int dy1 = 0, dy2 = 0;
+ int e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0;
+ int sign1 = 0, sign2 = 0;
int h;
int l, r;
PixelType mask, bits = ~((PixelType)0);
int nmiddle;
- devPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr);
if (mode == CoordModePrevious || shape != Convex ||
- REGION_NUM_RECTS(devPriv->pCompositeClip) != 1)
+ REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
{
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
return;
}
origin = *((int *) &pDrawable->x);
vertex2 = origin - ((origin & 0x8000) << 1);
- extents = &devPriv->pCompositeClip->extents;
+ extents = &pGC->pCompositeClip->extents;
vertex1 = *((int *) &extents->x1) - vertex2;
vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
clip = 0;
@@ -135,7 +137,7 @@ MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn)
vertex2p = (int *) ptsIn;
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
x = intToX(vertex); \
- if (dy = intToY(c) - y) { \
+ if ((dy = intToY(c) - y)) { \
dx = intToX(c) - x; \
step = 0; \
if (dx >= 0) \
@@ -239,7 +241,7 @@ MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn)
}
nmiddle >>= PWSH;
Duff (nmiddle, *addr++ EQWHOLEWORD)
- if (mask = ~SCRRIGHT(bits, r & PIM))
+ if ((mask = ~SCRRIGHT(bits, r & PIM)))
*addr OPEQ mask;
}
if (!--h)
diff --git a/mfb/mfbplygblt.c b/mfb/mfbplygblt.c
index f8931b5c2..661590e5e 100644
--- a/mfb/mfbplygblt.c
+++ b/mfb/mfbplygblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbplygblt.c,v 3.4 2001/12/14 20:00:10 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -154,8 +155,7 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
bbox.y1 = y - info.overallAscent;
bbox.y2 = y + info.overallDescent;
- switch (RECT_IN_REGION(pGC->pScreen,
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox))
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
{
case rgnOUT:
break;
@@ -172,7 +172,7 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
/* start at top scanline of glyph */
- pdst = mfbScanlineDelta(pdstBase, -pci->metrics.ascent, widthDst);
+ pdst = pdstBase;
/* find correct word in scanline and x offset within it
for left edge of glyph
@@ -189,6 +189,8 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pdst--;
}
+ pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst);
+
if ((xoff + w) <= PPW)
{
/* glyph all in one longword */
@@ -282,7 +284,7 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
}
}
- cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ cclip = pGC->pCompositeClip;
pbox = REGION_RECTS(cclip);
nbox = REGION_NUM_RECTS(cclip);
@@ -335,7 +337,7 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pglyph = FONTGLYPHBITS(pglyphBase, pci);
pglyph += (glyphRow * widthGlyph);
- pdst = mfbScanlineDelta(ppos[i].pdstBase, -(y-topEdge), widthDst);
+ pdst = ppos[i].pdstBase;
glyphCol = (leftEdge - ppos[i].xpos) -
(pci->metrics.leftSideBearing);
@@ -352,6 +354,8 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
pdst--;
}
+ pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst);
+
if ((xoff + w) <= PPW)
{
maskpartialbits(xoff, w, startmask);
diff --git a/mfb/mfbpolypnt.c b/mfb/mfbpolypnt.c
index 8b6efab98..38cd4aee8 100644
--- a/mfb/mfbpolypnt.c
+++ b/mfb/mfbpolypnt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbpolypnt.c,v 1.5 2001/12/14 20:00:11 dawes Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -99,8 +100,8 @@ mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
}
}
- nbox = REGION_NUM_RECTS(pGCPriv->pCompositeClip);
- pbox = REGION_RECTS(pGCPriv->pCompositeClip);
+ nbox = REGION_NUM_RECTS(pGC->pCompositeClip);
+ pbox = REGION_RECTS(pGC->pCompositeClip);
for (; --nbox >= 0; pbox++)
{
if (rop == RROP_BLACK)
diff --git a/mfb/mfbpushpxl.c b/mfb/mfbpushpxl.c
index 12b94f6b1..f10e39046 100644
--- a/mfb/mfbpushpxl.c
+++ b/mfb/mfbpushpxl.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.7 2003/02/18 21:30:01 tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -107,7 +108,7 @@ mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
register BoxPtr pbox;
int i;
- if (!pGC->planemask & 1) return;
+ if (!(pGC->planemask & 1)) return;
/* compute the reduced rop function */
alu = pGC->alu;
@@ -122,8 +123,7 @@ mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1);
/* clip the shape of the dst to the destination composite clip */
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
if (!REGION_NIL(&rgnDst))
{
@@ -179,7 +179,7 @@ mfbPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
for(h = 0; h < dy; h++)
{
- pw = (PixelType *)
+ pw = (PixelType *)(pointer)
(((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind));
pwLineStart = pw;
/* Process all words which are fully in the pixmap */
diff --git a/mfb/mfbscrclse.c b/mfb/mfbscrclse.c
index a93e7f07b..28b0c24c3 100644
--- a/mfb/mfbscrclse.c
+++ b/mfb/mfbscrclse.c
@@ -45,12 +45,15 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mfb/mfbscrclse.c,v 1.4 2003/02/18 21:30:01 tsi Exp $ */
+#include "mfb.h"
#include "scrnintstr.h"
/*ARGSUSED*/
Bool
mfbCloseScreen(index, pScreen)
+ int index;
register ScreenPtr pScreen;
{
xfree(pScreen->devPrivate);
diff --git a/mfb/mfbscrinit.c b/mfb/mfbscrinit.c
index 080e8d2e8..d07aadb80 100644
--- a/mfb/mfbscrinit.c
+++ b/mfb/mfbscrinit.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.9 2003/02/18 21:30:01 tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,6 +52,7 @@ SOFTWARE.
#include "Xmd.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
+#include "windowstr.h"
#include "resource.h"
#include "colormap.h"
#include "mfb.h"
@@ -82,12 +84,12 @@ static DepthRec depth = {
#ifndef LOWMEMFTPT
-miBSFuncRec mfbBSFuncRec = {
+BSFuncRec mfbBSFuncRec = {
mfbSaveAreas,
mfbRestoreAreas,
- (void (*)()) 0,
- (PixmapPtr (*)()) 0,
- (PixmapPtr (*)()) 0,
+ (BackingStoreSetClipmaskRgnProcPtr) 0,
+ (BackingStoreGetImagePixmapProcPtr) 0,
+ (BackingStoreGetSpansPixmapProcPtr) 0,
};
#endif /* ifndef LOWMEMFTPT */
@@ -103,8 +105,7 @@ mfbAllocatePrivates(pScreen, pWinIndex, pGCIndex)
frameWindowPrivateIndex = AllocateWindowPrivateIndex();
#endif
mfbWindowPrivateIndex = AllocateWindowPrivateIndex();
- mfbGCPrivateIndex = AllocateGCPrivateIndex();
- miRegisterGCPrivateIndex(mfbGCPrivateIndex);
+ mfbGCPrivateIndex = miAllocateGCPrivateIndex();
visual.vid = FakeClientID(0);
VID = visual.vid;
mfbGeneration = serverGeneration;
@@ -113,6 +114,8 @@ mfbAllocatePrivates(pScreen, pWinIndex, pGCIndex)
*pWinIndex = mfbWindowPrivateIndex;
if (pGCIndex)
*pGCIndex = mfbGCPrivateIndex;
+ pScreen->GetWindowPixmap = mfbGetWindowPixmap;
+ pScreen->SetWindowPixmap = mfbSetWindowPixmap;
return (AllocateWindowPrivate(pScreen, mfbWindowPrivateIndex,
sizeof(mfbPrivWin)) &&
AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC)));
@@ -156,11 +159,39 @@ mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
pScreen->InstallColormap = mfbInstallColormap;
pScreen->UninstallColormap = mfbUninstallColormap;
pScreen->ListInstalledColormaps = mfbListInstalledColormaps;
- pScreen->StoreColors = (void (*)())NoopDDA;
+ pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA;
pScreen->ResolveColor = mfbResolveColor;
pScreen->BitmapToRegion = mfbPixmapToRegion;
- return miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- 1, 1, &depth, VID, 1, &visual, &mfbBSFuncRec);
+ if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ 1, 1, &depth, VID, 1, &visual))
+ return FALSE;
+ pScreen->BackingStoreFuncs = mfbBSFuncRec;
+ return TRUE;
}
-
#endif /* ifndef LOWMEMFTPT */
+
+PixmapPtr
+mfbGetWindowPixmap(pWin)
+ WindowPtr pWin;
+{
+#ifdef PIXMAP_PER_WINDOW
+ return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
+#else
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return (* pScreen->GetScreenPixmap)(pScreen);
+#endif
+}
+
+void
+mfbSetWindowPixmap(pWin, pPix)
+ WindowPtr pWin;
+ PixmapPtr pPix;
+{
+#ifdef PIXMAP_PER_WINDOW
+ pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
+#else
+ (* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
+#endif
+}
+
diff --git a/mfb/mfbsetsp.c b/mfb/mfbsetsp.c
index 08578c0f7..a56935dbe 100644
--- a/mfb/mfbsetsp.c
+++ b/mfb/mfbsetsp.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.7 2003/02/18 21:30:01 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -69,6 +70,7 @@ SOFTWARE.
* boxes, we may not want to start grabbing bits at psrc but at some offset
* further on.)
*/
+void
mfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst)
int y;
int xOrigin; /* where this scanline starts */
@@ -157,7 +159,7 @@ mfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
int nspans;
int fSorted;
{
- PixelType *psrc = (PixelType *)pcharsrc;
+ PixelType *psrc = (PixelType *)(pointer)pcharsrc;
PixelType *pdstBase; /* start of dst bitmap */
int widthDst; /* width of bitmap in words */
register BoxPtr pbox, pboxLast, pboxTest;
@@ -168,7 +170,7 @@ mfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
int yMax;
alu = pGC->alu;
- prgnDst = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ prgnDst = pGC->pCompositeClip;
pptLast = ppt + nspans;
diff --git a/mfb/mfbtegblt.c b/mfb/mfbtegblt.c
index aa5b01f3d..1e0da0f02 100644
--- a/mfb/mfbtegblt.c
+++ b/mfb/mfbtegblt.c
@@ -46,6 +46,9 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+
+/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.8 2001/12/14 20:00:12 dawes Exp $ */
+
#include "X.h"
#include "Xmd.h"
#include "Xproto.h"
@@ -100,83 +103,42 @@ two times:
#endif
/*
+ * XXX XXX XXX There is something horribly, massively wrong here. There are
+ * hardcoded shifts by 64 below; these cannot work on any present-day
+ * architecture.
+ */
+
+/*
* Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its
* first argument more than once. Thus the imbedded char++ have to be moved.
* (DHD)
*/
#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
-#if PPW == 32
#define GetBits4 c = (*char1++ << ShiftAmnt) | \
SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \
SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \
SCRRIGHT (*char4++ << ShiftAmnt, xoff4);
-#else /* PPW */
-#define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \
- (SCRRIGHT (*char2++ << ShiftAmnt, xoff2) << 32 ) | \
- (SCRRIGHT (*char3++ << ShiftAmnt, xoff3) << 32 ) | \
- (SCRRIGHT (*char4++ << ShiftAmnt, xoff4) << 32 ) | \
- (*char5++ << ShiftAmnt) | \
- SCRRIGHT (*char6++ << ShiftAmnt, xoff6) | \
- SCRRIGHT (*char7++ << ShiftAmnt, xoff7) | \
- SCRRIGHT (*char8++ << ShiftAmnt, xoff8);
-#endif /* PPW */
#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
-#if PPW == 32
#define GetBits4 c = (*char1++ << ShiftAmnt) | \
SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \
SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \
SCRRIGHT (*char4 << ShiftAmnt, xoff4); \
char2++; char3++; char4++;
-#else /* PPW == 64 */
-#define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \
- (SCRRIGHT (*char2 << ShiftAmnt, xoff2) << 32 ) | \
- (SCRRIGHT (*char3 << ShiftAmnt, xoff3) << 32 ) | \
- (SCRRIGHT (*char4 << ShiftAmnt, xoff4) << 32 ) | \
- (*char5++ << ShiftAmnt) | \
- SCRRIGHT (*char6 << ShiftAmnt, xoff6) | \
- SCRRIGHT (*char7 << ShiftAmnt, xoff7) | \
- SCRRIGHT (*char8 << ShiftAmnt, xoff8); \
- char2++; char3++; char4++; char6++; char7++; char8++;
-#endif /* PPW */
#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
#else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */
#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
-#if PPW == 32
#define GetBits4 c = *char1++ | \
SCRRIGHT (*char2++, xoff2) | \
SCRRIGHT (*char3++, xoff3) | \
SCRRIGHT (*char4++, xoff4);
-#else /* PPW == 64 */
-#define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \
- (SCRRIGHT (*char2++, xoff2) << 64 ) | \
- (SCRRIGHT (*char3++, xoff3) << 64 ) | \
- (SCRRIGHT (*char4++, xoff4) << 64 ) | \
- SCRRIGHT (*char5++, xoff5) | \
- SCRRIGHT (*char6++, xoff6) | \
- SCRRIGHT (*char7++, xoff7) | \
- SCRRIGHT (*char8++, xoff8));
-#endif /* PPW */
#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
-#if PPW == 32
#define GetBits4 c = *char1++ | \
SCRRIGHT (*char2, xoff2) | \
SCRRIGHT (*char3, xoff3) | \
SCRRIGHT (*char4, xoff4); \
char2++; char3++; char4++;
-#else /* PPW == 64 */
-#define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \
- (SCRRIGHT (*char2, xoff2) << 64 ) | \
- (SCRRIGHT (*char3, xoff3) << 64 ) | \
- (SCRRIGHT (*char4, xoff4) << 64 ) | \
- SCRRIGHT (*char5, xoff5) | \
- SCRRIGHT (*char6, xoff6) | \
- SCRRIGHT (*char7, xoff7) | \
- SCRRIGHT (*char8, xoff8)); \
- char2++; char3++; char4++; \
- char5++; char6++; char7++; char8++;
-#endif /* PPW */
#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
#endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */
@@ -232,10 +194,6 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
register PixelType c;
register int xoff1, xoff2, xoff3, xoff4;
register glyphPointer char1, char2, char3, char4;
-#if PPW == 64
- register int xoff5, xoff6, xoff7, xoff8;
- register glyphPointer char5, char6, char7, char8;
-#endif /* PPW */
#ifdef USE_LEFTBITS
register PixelType glyphMask;
@@ -262,8 +220,7 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
bbox.y1 = ypos;
bbox.y2 = ypos + h;
- switch (RECT_IN_REGION(pGC->pScreen,
- ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox))
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
{
case rgnPART:
/* this is the WRONG thing to do, but it works.
@@ -307,22 +264,10 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
xoff2 = widthGlyph;
xoff3 = xoff2 + widthGlyph;
xoff4 = xoff3 + widthGlyph;
-#if PPW == 64
- xoff5 = xoff4 + widthGlyph;
- xoff6 = xoff5 + widthGlyph;
- xoff7 = xoff6 + widthGlyph;
- xoff8 = xoff7 + widthGlyph;
-#endif /* PPW */
char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-#if PPW == 64
- char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
- char6 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
- char7 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
- char8 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-#endif /* PPW */
hTmp = h;
dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */
@@ -341,7 +286,7 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
# endif
FASTPUTBITS(OP(c), xoff1, widthGlyphs, dst);
#else
- *(dst) = (*dst) & ~startmask | OP(SCRRIGHT(c, xoff1)) & startmask;
+ *(dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
#endif
mfbScanlineInc(dst, widthDst);
}
@@ -354,10 +299,10 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
while (hTmp--)
{
GetBits4
- dst[0] = dst[0] & ~startmask |
- OP(SCRRIGHT(c,xoff1)) & startmask;
- dst[1] = dst[1] & ~endmask |
- OP(SCRLEFT(c,nfirst)) & endmask;
+ dst[0] = (dst[0] & ~startmask) |
+ (OP(SCRRIGHT(c,xoff1)) & startmask);
+ dst[1] = (dst[1] & ~endmask) |
+ (OP(SCRLEFT(c,nfirst)) & endmask);
mfbScanlineInc(dst, widthDst);
}
}
@@ -393,7 +338,7 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
FASTPUTBITS (OP(c),xoff1,widthGlyph,dst);
#else
GetBits1
- (*dst) = (*dst) & ~startmask | OP(SCRRIGHT(c, xoff1)) & startmask;
+ (*dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
#endif
mfbScanlineInc(dst, widthDst);
}
@@ -406,10 +351,10 @@ MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
while (hTmp--)
{
GetBits1
- dst[0] = dst[0] & ~startmask |
- OP(SCRRIGHT(c,xoff1)) & startmask;
- dst[1] = dst[1] & ~endmask |
- OP(SCRLEFT(c,nfirst)) & endmask;
+ dst[0] = (dst[0] & ~startmask) |
+ (OP(SCRRIGHT(c,xoff1)) & startmask);
+ dst[1] = (dst[1] & ~endmask) |
+ (OP(SCRLEFT(c,nfirst)) & endmask);
mfbScanlineInc(dst, widthDst);
}
}
diff --git a/mfb/mfbtile.c b/mfb/mfbtile.c
index f716f4487..05bc93722 100644
--- a/mfb/mfbtile.c
+++ b/mfb/mfbtile.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbtile.c,v 1.3 2003/02/18 21:30:01 tsi Exp $ */
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
@@ -219,7 +220,7 @@ mfbTileAreaPPW (pDraw, nbox, pbox, alu, ptile)
int alu;
PixmapPtr ptile;
{
- void (*f)(), mfbTileAreaPPWCopy(), mfbTileAreaPPWGeneral();
+ void (*f)();
if (alu == GXcopy)
f = mfbTileAreaPPWCopy;
diff --git a/mfb/mfbzerarc.c b/mfb/mfbzerarc.c
index 2135a7969..51dc727d9 100644
--- a/mfb/mfbzerarc.c
+++ b/mfb/mfbzerarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.7 2002/09/27 01:57:47 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -49,7 +50,7 @@ in this Software without prior written authorization from The Open Group.
* LONG2CHARS() takes care of the re-ordering as required. (DHD)
*/
#if (BITMAP_BIT_ORDER == MSBFirst)
-#define LEFTMOST ((PixelType) LONG2CHARS((1 << PLST)))
+#define LEFTMOST ((PixelType) LONG2CHARS(((MfbBits)1 << PLST)))
#else
#define LEFTMOST ((PixelType) LONG2CHARS(1))
#endif
@@ -217,9 +218,9 @@ mfbZeroPolyArcSS(pDraw, pGC, narcs, parcs)
int x2, y2;
RegionPtr cclip;
- if (!pGC->planemask & 1)
+ if (!(pGC->planemask & 1))
return;
- cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
+ cclip = pGC->pCompositeClip;
for (arc = parcs, i = narcs; --i >= 0; arc++)
{
if (miCanZeroArc(arc))
diff --git a/mi/cbrt.c b/mi/cbrt.c
index 44a017ad5..44c836e43 100644
--- a/mi/cbrt.c
+++ b/mi/cbrt.c
@@ -26,14 +26,23 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.4 2001/12/14 20:00:19 dawes Exp $ */
/* simple cbrt, in case your math library doesn't have a good one */
-double pow();
+/*
+ * Would normally include <math.h> for this, but for the sake of compiler
+ * warnings, we don't want to get duplicate declarations for cbrt().
+ */
+
+double pow(double, double);
+double cbrt(double);
double
-cbrt(x)
- double x;
+cbrt(double x)
{
- return pow(x, 1.0/3.0);
+ if (x > 0.0)
+ return pow(x, 1.0/3.0);
+ else
+ return -pow(-x, 1.0/3.0);
}
diff --git a/mi/mi.h b/mi/mi.h
index dd7dc94ed..fba57567d 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.10 2001/12/14 20:00:19 dawes Exp $ */
+
#ifndef MI_H
#define MI_H
#include "X11/X.h"
@@ -56,6 +58,8 @@ SOFTWARE.
#include "input.h"
#include "cursor.h"
+#define MiBits CARD32
+
typedef struct _miDash *miDashPtr;
#define EVEN_DASH 0
#define ODD_DASH ~0
@@ -63,18 +67,15 @@ typedef struct _miDash *miDashPtr;
/* miarc.c */
extern void miPolyArc(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* mibitblt.c */
extern RegionPtr miCopyArea(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -84,25 +85,21 @@ extern RegionPtr miCopyArea(
int /*heightSrc*/,
int /*xOut*/,
int /*yOut*/
-#endif
);
extern void miOpqStipDrawable(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
RegionPtr /*prgnSrc*/,
- unsigned long * /*pbits*/,
+ MiBits * /*pbits*/,
int /*srcx*/,
int /*w*/,
int /*h*/,
int /*dstx*/,
int /*dsty*/
-#endif
);
extern RegionPtr miCopyPlane(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -113,11 +110,9 @@ extern RegionPtr miCopyPlane(
int /*dstx*/,
int /*dsty*/,
unsigned long /*bitPlane*/
-#endif
);
extern void miGetImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
int /*sx*/,
int /*sy*/,
@@ -126,11 +121,9 @@ extern void miGetImage(
unsigned int /*format*/,
unsigned long /*planeMask*/,
char * /*pdstLine*/
-#endif
);
extern void miPutImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*depth*/,
@@ -141,48 +134,43 @@ extern void miPutImage(
int /*leftPad*/,
int /*format*/,
char * /*pImage*/
-#endif
);
/* miclipn.c */
extern void miClipNotify(
-#if NeedFunctionPrototypes
- void (* /*func*/)()
-#endif
+ void (* /*func*/)(
+ WindowPtr /* pWin */,
+ int /* dx */,
+ int /* dy */
+ )
);
/* micursor.c */
extern void miRecolorCursor(
-#if NeedFunctionPrototypes
ScreenPtr /*pScr*/,
CursorPtr /*pCurs*/,
Bool /*displayed*/
-#endif
);
/* midash.c */
extern miDashPtr miDashLine(
-#if NeedFunctionPrototypes
int /*npt*/,
DDXPointPtr /*ppt*/,
unsigned int /*nDash*/,
unsigned char * /*pDash*/,
unsigned int /*offset*/,
int * /*pnseg*/
-#endif
);
extern void miStepDash(
-#if NeedFunctionPrototypes
int /*dist*/,
int * /*pDashIndex*/,
unsigned char * /*pDash*/,
int /*numInDashList*/,
int * /*pDashOffset*/
-#endif
);
/* mieq.c */
@@ -193,35 +181,26 @@ typedef struct _DeviceRec *DevicePtr;
#endif
extern Bool mieqInit(
-#if NeedFunctionPrototypes
DevicePtr /*pKbd*/,
DevicePtr /*pPtr*/
-#endif
);
extern void mieqEnqueue(
-#if NeedFunctionPrototypes
xEventPtr /*e*/
-#endif
);
extern void mieqSwitchScreen(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
Bool /*fromDIX*/
-#endif
);
-extern int mieqProcessInputEvents(
-#if NeedFunctionPrototypes
+extern void mieqProcessInputEvents(
void
-#endif
);
/* miexpose.c */
extern RegionPtr miHandleExposures(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -232,66 +211,52 @@ extern RegionPtr miHandleExposures(
int /*dstx*/,
int /*dsty*/,
unsigned long /*plane*/
-#endif
);
extern void miSendGraphicsExpose(
-#if NeedFunctionPrototypes
ClientPtr /*client*/,
RegionPtr /*pRgn*/,
XID /*drawable*/,
int /*major*/,
int /*minor*/
-#endif
);
extern void miSendExposures(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*pRgn*/,
int /*dx*/,
int /*dy*/
-#endif
);
extern void miWindowExposures(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*prgn*/,
RegionPtr /*other_exposed*/
-#endif
);
extern void miPaintWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*prgn*/,
int /*what*/
-#endif
);
-extern int miClearDrawable(
-#if NeedFunctionPrototypes
+extern void miClearDrawable(
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/
-#endif
);
/* mifillrct.c */
extern void miPolyFillRect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nrectFill*/,
xRectangle * /*prectInit*/
-#endif
);
/* miglblt.c */
extern void miPolyGlyphBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -299,11 +264,9 @@ extern void miPolyGlyphBlt(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
extern void miImageGlyphBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -311,82 +274,68 @@ extern void miImageGlyphBlt(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* mipoly.c */
extern void miFillPolygon(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*pPts*/
-#endif
);
/* mipolycon.c */
extern Bool miFillConvexPoly(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* mipolygen.c */
extern Bool miFillGeneralPoly(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* mipolypnt.c */
extern void miPolyPoint(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
xPoint * /*pptInit*/
-#endif
);
/* mipolyrect.c */
extern void miPolyRectangle(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*nrects*/,
xRectangle * /*pRects*/
-#endif
);
/* mipolyseg.c */
extern void miPolySegment(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegs*/
-#endif
);
/* mipolytext.c */
extern int miPolyText(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -394,33 +343,27 @@ extern int miPolyText(
int /*count*/,
char * /*chars*/,
FontEncoding /*fontEncoding*/
-#endif
);
extern int miPolyText8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
-#endif
);
extern int miPolyText16(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
-#endif
);
extern int miImageText(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -428,35 +371,29 @@ extern int miImageText(
int /*count*/,
char * /*chars*/,
FontEncoding /*fontEncoding*/
-#endif
);
extern void miImageText8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
-#endif
);
extern void miImageText16(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
-#endif
);
/* mipushpxl.c */
extern void miPushPixels(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
PixmapPtr /*pBitMap*/,
DrawablePtr /*pDrawable*/,
@@ -464,7 +401,6 @@ extern void miPushPixels(
int /*dy*/,
int /*xOrg*/,
int /*yOrg*/
-#endif
);
/* miregion.c */
@@ -472,36 +408,30 @@ extern void miPushPixels(
/* see also region.h */
extern Bool miRectAlloc(
-#if NeedFunctionPrototypes
RegionPtr /*pRgn*/,
int /*n*/
-#endif
);
extern void miSetExtents(
-#if NeedFunctionPrototypes
RegionPtr /*pReg*/
-#endif
);
extern int miFindMaxBand(
-#if NeedFunctionPrototypes
RegionPtr /*prgn*/
-#endif
);
#ifdef DEBUG
extern Bool miValidRegion(
-#if NeedFunctionPrototypes
RegionPtr /*prgn*/
-#endif
);
#endif
+extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src);
+extern Bool miRegionBroken(RegionPtr pReg);
+
/* miscrinit.c */
extern Bool miModifyPixmapHeader(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/,
int /*width*/,
int /*height*/,
@@ -509,37 +439,24 @@ extern Bool miModifyPixmapHeader(
int /*bitsPerPixel*/,
int /*devKind*/,
pointer /*pPixData*/
-#endif
);
extern Bool miCloseScreen(
-#if NeedFunctionPrototypes
int /*index*/,
ScreenPtr /*pScreen*/
-#endif
);
extern Bool miCreateScreenResources(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/
-#endif
);
extern Bool miScreenDevPrivateInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int /*width*/,
pointer /*pbits*/
-#endif
);
-#ifndef _XTYPEDEF_MIBSFUNCPTR
-typedef struct _miBSFuncRec *miBSFuncPtr;
-#define _XTYPEDEF_MIBSFUNCPTR
-#endif
-
extern Bool miScreenInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -552,197 +469,167 @@ extern Bool miScreenInit(
DepthPtr /*depths*/,
VisualID /*rootVisual*/,
int /*numVisuals*/,
- VisualPtr /*visuals*/,
- miBSFuncPtr /*bsfuncs*/
-#endif
+ VisualPtr /*visuals*/
+);
+
+extern int miAllocateGCPrivateIndex(
+ void
+);
+
+extern PixmapPtr miGetScreenPixmap(
+ ScreenPtr pScreen
+);
+
+extern void miSetScreenPixmap(
+ PixmapPtr pPix
);
/* mivaltree.c */
extern int miShapedWindowIn(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
RegionPtr /*universe*/,
RegionPtr /*bounding*/,
BoxPtr /*rect*/,
int /*x*/,
int /*y*/
-#endif
);
extern int miValidateTree(
-#if NeedFunctionPrototypes
WindowPtr /*pParent*/,
WindowPtr /*pChild*/,
VTKind /*kind*/
-#endif
);
extern void miWideLine(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pPts*/
-#endif
);
extern void miWideDash(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pPts*/
-#endif
);
extern void miMiter(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void miNotMiter(
-#if NeedFunctionPrototypes
void
-#endif
);
/* miwindow.c */
extern void miClearToBackground(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/,
Bool /*generateExposures*/
-#endif
);
extern Bool miChangeSaveUnder(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
WindowPtr /*first*/
-#endif
);
extern void miPostChangeSaveUnder(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
WindowPtr /*pFirst*/
-#endif
);
extern void miMarkWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern Bool miMarkOverlappedWindows(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
WindowPtr /*pFirst*/,
WindowPtr * /*ppLayerWin*/
-#endif
);
extern void miHandleValidateExposures(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern void miMoveWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
WindowPtr /*pNextSib*/,
VTKind /*kind*/
-#endif
);
extern void miSlideAndSizeWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
unsigned int /*w*/,
unsigned int /*h*/,
WindowPtr /*pSib*/
-#endif
);
extern WindowPtr miGetLayerWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern void miSetShape(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern void miChangeBorderWidth(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
unsigned int /*width*/
-#endif
);
extern void miMarkUnrealizedWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pChild*/,
WindowPtr /*pWin*/,
Bool /*fromConfigure*/
-#endif
);
+extern void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth);
+
+/* mizerarc.c */
+
extern void miZeroPolyArc(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* mizerline.c */
extern void miZeroLine(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*mode*/,
int /*nptInit*/,
DDXPointRec * /*pptInit*/
-#endif
);
extern void miZeroDashLine(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*mode*/,
int /*nptInit*/,
DDXPointRec * /*pptInit*/
-#endif
);
extern void miPolyFillArc(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
#endif /* MI_H */
diff --git a/mi/miarc.c b/mi/miarc.c
index db569fa41..8c86200ee 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.13 2002/01/12 22:20:33 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -48,7 +49,7 @@ SOFTWARE.
/* Author: Keith Packard and Bob Scheifler */
/* Warning: this code is toxic, do not dally very long here. */
-#ifdef _XOPEN_SOURCE
+#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__)
#include <math.h>
#else
#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
@@ -67,12 +68,11 @@ SOFTWARE.
#include "mifillarc.h"
#include "Xfuncproto.h"
-static double miDsin(), miDcos(), miDasin(), miDatan2();
-double cbrt(
-#if NeedFunctionPrototypes
- double
-#endif
-);
+static double miDsin(double a);
+static double miDcos(double a);
+static double miDasin(double v);
+static double miDatan2(double dy, double dx);
+double cbrt(double);
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
@@ -101,7 +101,7 @@ ICEILTEMPDECL
#undef max
#undef min
-#if defined (__GNUC__) && defined (__STDC__) && !defined (__STRICT_ANSI__)
+#if defined (__GNUC__) && !defined (__STRICT_ANSI__)
#define USE_INLINE
#endif
@@ -119,13 +119,13 @@ inline static const int min (const int x, const int y)
#else
static int
-max (x, y)
+max (int x, int y)
{
return x>y? x:y;
}
static int
-min (x, y)
+min (int x, int y)
{
return x<y? x:y;
}
@@ -242,12 +242,27 @@ typedef struct _miPolyArc {
GCLineWidth | GCCapStyle | GCJoinStyle)
static CARD32 gcvals[6];
-static void fillSpans(), newFinalSpan();
-static void drawArc(), drawQuadrant(), drawZeroArc();
-static void miArcJoin(), miArcCap(), miRoundCap(), miFreeArcs();
-static int computeAngleFromPath();
-static miPolyArcPtr miComputeArcs ();
-static int miGetArcPts();
+static void fillSpans(DrawablePtr pDrawable, GCPtr pGC);
+static void newFinalSpan(int y, register int xmin, register int xmax);
+static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right,
+ miArcFacePtr left);
+static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw,
+ miArcFacePtr left, miArcFacePtr right);
+static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
+ miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
+ double xFtransLeft, double yFtransLeft,
+ int xOrgRight, int yOrgRight,
+ double xFtransRight, double yFtransRight);
+static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace,
+ int end, int xOrg, int yOrg, double xFtrans,
+ double yFtrans);
+static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter,
+ SppPointRec pEnd, SppPointRec pCorner,
+ SppPointRec pOtherCorner, int fLineEnd,
+ int xOrg, int yOrg, double xFtrans, double yFtrans);
+static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC);
+static miPolyArcPtr miComputeArcs(xArc *parcs, int narcs, GCPtr pGC);
+static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts);
# define CUBED_ROOT_2 1.2599210498948732038115849718451499938964
# define CUBED_ROOT_4 1.5874010519681993173435330390930175781250
@@ -257,11 +272,12 @@ static int miGetArcPts();
*/
static void
-miArcSegment(pDraw, pGC, tarc, right, left)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc tarc;
- miArcFacePtr right, left;
+miArcSegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc tarc,
+ miArcFacePtr right,
+ miArcFacePtr left)
{
int l = pGC->lineWidth;
int a0, a1, startAngle, endAngle;
@@ -397,6 +413,10 @@ typedef struct {
#define CACHESIZE 25
+static void drawQuadrant(struct arc_def *def, struct accelerators *acc,
+ int a0, int a1, int mask, miArcFacePtr right,
+ miArcFacePtr left, miArcSpanData *spdata);
+
static arcCacheRec arcCache[CACHESIZE];
static unsigned long lrustamp;
static arcCacheRec *lastCacheHit = &arcCache[0];
@@ -433,18 +453,18 @@ miFreeArcCache (data, id)
}
static void
-miComputeCircleSpans(lw, parc, spdata)
- int lw;
- xArc *parc;
- miArcSpanData *spdata;
+miComputeCircleSpans(
+ int lw,
+ xArc *parc,
+ miArcSpanData *spdata)
{
register miArcSpan *span;
int doinner;
register int x, y, e;
int xk, yk, xm, ym, dx, dy;
register int slw, inslw;
- int inx, iny, ine;
- int inxk, inyk, inxm, inym;
+ int inx = 0, iny, ine = 0;
+ int inxk = 0, inyk = 0, inxm = 0, inym = 0;
doinner = -lw;
slw = parc->width - doinner;
@@ -501,15 +521,15 @@ miComputeCircleSpans(lw, parc, spdata)
}
static void
-miComputeEllipseSpans(lw, parc, spdata)
- int lw;
- xArc *parc;
- miArcSpanData *spdata;
+miComputeEllipseSpans(
+ int lw,
+ xArc *parc,
+ miArcSpanData *spdata)
{
register miArcSpan *span;
double w, h, r, xorg;
double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
- double A, T, b, d, x, y, t, inx, outx, hepp, hepm;
+ double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm;
int flip, solution;
w = (double)parc->width / 2.0;
@@ -587,7 +607,10 @@ miComputeEllipseSpans(lw, parc, spdata)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
if (flip == 2)
inx = x - t;
else
@@ -612,7 +635,10 @@ miComputeEllipseSpans(lw, parc, spdata)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- inx = x - sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ inx = x - sqrt(rs - (t * t));
+ else
+ inx = x;
}
y = (b - d) / 2;
if (y >= 0.0)
@@ -622,7 +648,10 @@ miComputeEllipseSpans(lw, parc, spdata)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
if (flip == 1)
inx = x - t;
else
@@ -685,11 +714,11 @@ miComputeEllipseSpans(lw, parc, spdata)
}
static double
-tailX(K, def, bounds, acc)
- double K;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
+tailX(
+ double K,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc)
{
double w, h, r;
double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
@@ -769,7 +798,10 @@ tailX(K, def, bounds, acc)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
*xp++ = x - t;
}
}
@@ -791,7 +823,10 @@ tailX(K, def, bounds, acc)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- *xp++ = x - sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ *xp++ = x - sqrt(rs - (t * t));
+ else
+ *xp++ = x;
}
y = (b - d) / 2;
if (y >= 0.0 && flip == 1)
@@ -801,7 +836,10 @@ tailX(K, def, bounds, acc)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
*xp++ = x - t;
}
}
@@ -817,10 +855,10 @@ tailX(K, def, bounds, acc)
}
static miArcSpanData *
-miComputeWideEllipse(lw, parc, mustFree)
- int lw;
- register xArc *parc;
- Bool *mustFree;
+miComputeWideEllipse(
+ int lw,
+ register xArc *parc,
+ Bool *mustFree)
{
register miArcSpanData *spdata;
register arcCacheRec *cent, *lruent;
@@ -896,10 +934,10 @@ miComputeWideEllipse(lw, parc, mustFree)
}
static void
-miFillWideEllipse(pDraw, pGC, parc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *parc;
+miFillWideEllipse(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *parc)
{
DDXPointPtr points;
register DDXPointPtr pts;
@@ -1039,8 +1077,8 @@ miPolyArc(pDraw, pGC, narcs, parcs)
register int i;
xArc *parc;
int xMin, xMax, yMin, yMax;
- int pixmapWidth, pixmapHeight;
- int xOrg, yOrg;
+ int pixmapWidth = 0, pixmapHeight = 0;
+ int xOrg = 0, yOrg = 0;
int width;
Bool fTricky;
DrawablePtr pDrawTo;
@@ -1259,8 +1297,7 @@ miPolyArc(pDraw, pGC, narcs, parcs)
}
static double
-angleBetween (center, point1, point2)
- SppPointRec center, point1, point2;
+angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2)
{
double a1, a2, a;
@@ -1279,10 +1316,12 @@ angleBetween (center, point1, point2)
}
static void
-translateBounds (b, x, y, fx, fy)
-miArcFacePtr b;
-int x, y;
-double fx, fy;
+translateBounds (
+ miArcFacePtr b,
+ int x,
+ int y,
+ double fx,
+ double fy)
{
fx += x;
fy += y;
@@ -1295,16 +1334,11 @@ double fx, fy;
}
static void
-miArcJoin (pDraw, pGC, pLeft, pRight,
- xOrgLeft, yOrgLeft, xFtransLeft, yFtransLeft,
- xOrgRight, yOrgRight, xFtransRight, yFtransRight)
- DrawablePtr pDraw;
- GCPtr pGC;
- miArcFacePtr pRight, pLeft;
- int xOrgRight, yOrgRight;
- double xFtransRight, yFtransRight;
- int xOrgLeft, yOrgLeft;
- double xFtransLeft, yFtransLeft;
+miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
+ miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
+ double xFtransLeft, double yFtransLeft,
+ int xOrgRight, int yOrgRight,
+ double xFtransRight, double yFtransRight)
{
SppPointRec center, corner, otherCorner;
SppPointRec poly[5], e;
@@ -1312,7 +1346,7 @@ miArcJoin (pDraw, pGC, pLeft, pRight,
int cpt;
SppArcRec arc;
miArcFaceRec Right, Left;
- int polyLen;
+ int polyLen = 0;
int xOrg, yOrg;
double xFtrans, yFtrans;
double a;
@@ -1410,13 +1444,15 @@ miArcJoin (pDraw, pGC, pLeft, pRight,
/*ARGSUSED*/
static void
-miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans)
- DrawablePtr pDraw;
- GCPtr pGC;
- miArcFacePtr pFace;
- int end;
- int xOrg, yOrg;
- double xFtrans, yFtrans;
+miArcCap (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ miArcFacePtr pFace,
+ int end,
+ int xOrg,
+ int yOrg,
+ double xFtrans,
+ double yFtrans)
{
SppPointRec corner, otherCorner, center, endPoint, poly[5];
@@ -1461,18 +1497,21 @@ miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans)
*/
/*ARGSUSED*/
static void
-miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherCorner, fLineEnd,
- xOrg, yOrg, xFtrans, yFtrans)
- DrawablePtr pDraw;
- GCPtr pGC;
- SppPointRec pCenter, pEnd;
- SppPointRec pCorner, pOtherCorner;
- int fLineEnd, xOrg, yOrg;
- double xFtrans, yFtrans;
+miRoundCap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ SppPointRec pCenter,
+ SppPointRec pEnd,
+ SppPointRec pCorner,
+ SppPointRec pOtherCorner,
+ int fLineEnd,
+ int xOrg,
+ int yOrg,
+ double xFtrans,
+ double yFtrans)
{
int cpt;
double width;
- double miDatan2 ();
SppArcRec arc;
SppPointPtr pArcPts;
@@ -1518,8 +1557,7 @@ miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherCorner, fLineEnd,
# define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
static double
-miDcos (a)
-double a;
+miDcos (double a)
{
int i;
@@ -1536,8 +1574,7 @@ double a;
}
static double
-miDsin (a)
-double a;
+miDsin (double a)
{
int i;
@@ -1554,8 +1591,7 @@ double a;
}
static double
-miDasin (v)
-double v;
+miDasin (double v)
{
if (v == 0)
return 0.0;
@@ -1567,8 +1603,7 @@ double v;
}
static double
-miDatan2 (dy, dx)
-double dy, dx;
+miDatan2 (double dy, double dx)
{
if (dy == 0) {
if (dx >= 0)
@@ -1600,16 +1635,16 @@ double dy, dx;
* This procedure allocates the space necessary to fit the arc points.
* Sometimes it's convenient for those points to be at the end of an existing
* array. (For example, if we want to leave a spare point to make sectors
- * instead of segments.) So we pass in the Xalloc()ed chunk that contains the
+ * instead of segments.) So we pass in the xalloc()ed chunk that contains the
* array and an index saying where we should start stashing the points.
* If there isn't an array already, we just pass in a null pointer and
- * count on Xrealloc() to handle the null pointer correctly.
+ * count on xrealloc() to handle the null pointer correctly.
*/
static int
-miGetArcPts(parc, cpt, ppPts)
- SppArcPtr parc; /* points to an arc */
- int cpt; /* number of points already in arc list */
- SppPointPtr *ppPts; /* pointer to pointer to arc-list -- modified */
+miGetArcPts(
+ SppArcPtr parc, /* points to an arc */
+ int cpt, /* number of points already in arc list */
+ SppPointPtr *ppPts) /* pointer to pointer to arc-list -- modified */
{
double st, /* Start Theta, start angle */
et, /* End Theta, offset from start theta */
@@ -1701,10 +1736,12 @@ struct arcData {
# define ADD_REALLOC_STEP 20
static void
-addCap (capsp, ncapsp, sizep, end, arcIndex)
- miArcCapPtr *capsp;
- int *ncapsp, *sizep;
- int end, arcIndex;
+addCap (
+ miArcCapPtr *capsp,
+ int *ncapsp,
+ int *sizep,
+ int end,
+ int arcIndex)
{
int newsize;
miArcCapPtr cap;
@@ -1726,10 +1763,16 @@ addCap (capsp, ncapsp, sizep, end, arcIndex)
}
static void
-addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1)
- miArcJoinPtr *joinsp;
- int *njoinsp, *sizep;
- int end0, index0, phase0, end1, index1, phase1;
+addJoin (
+ miArcJoinPtr *joinsp,
+ int *njoinsp,
+ int *sizep,
+ int end0,
+ int index0,
+ int phase0,
+ int end1,
+ int index1,
+ int phase1)
{
int newsize;
miArcJoinPtr join;
@@ -1755,10 +1798,11 @@ addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1)
}
static miArcDataPtr
-addArc (arcsp, narcsp, sizep, xarc)
- miArcDataPtr *arcsp;
- int *narcsp, *sizep;
- xArc *xarc;
+addArc (
+ miArcDataPtr *arcsp,
+ int *narcsp,
+ int *sizep,
+ xArc *xarc)
{
int newsize;
miArcDataPtr arc;
@@ -1780,9 +1824,9 @@ addArc (arcsp, narcsp, sizep, xarc)
}
static void
-miFreeArcs(arcs, pGC)
- miPolyArcPtr arcs;
- GCPtr pGC;
+miFreeArcs(
+ miPolyArcPtr arcs,
+ GCPtr pGC)
{
int iphase;
@@ -1819,13 +1863,16 @@ typedef struct {
double map[DASH_MAP_SIZE];
} dashMap;
+static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map,
+ int *lenp, int backwards);
+
static void
-computeDashMap (arcp, map)
- xArc *arcp;
- dashMap *map;
+computeDashMap (
+ xArc *arcp,
+ dashMap *map)
{
int di;
- double a, x, y, prevx, prevy, dist;
+ double a, x, y, prevx = 0.0, prevy = 0.0, dist;
for (di = 0; di < DASH_MAP_SIZE; di++) {
a = dashIndexToAngle (di);
@@ -1847,15 +1894,15 @@ typedef enum {HORIZONTAL, VERTICAL, OTHER} arcTypes;
/* this routine is a bit gory */
static miPolyArcPtr
-miComputeArcs (parcs, narcs, pGC)
- xArc *parcs;
- int narcs;
- GCPtr pGC;
+miComputeArcs (
+ xArc *parcs,
+ int narcs,
+ GCPtr pGC)
{
int isDashed, isDoubleDash;
int dashOffset;
miPolyArcPtr arcs;
- int start, i, j, k, nexti, nextk;
+ int start, i, j, k = 0, nexti, nextk = 0;
int joinSize[2];
int capSize[2];
int arcSize[2];
@@ -1864,13 +1911,13 @@ miComputeArcs (parcs, narcs, pGC)
struct arcData *data;
miArcDataPtr arc;
xArc xarc;
- int iphase, prevphase, joinphase;
+ int iphase, prevphase = 0, joinphase;
int arcsJoin;
int selfJoin;
- int iDash, dashRemaining;
- int iDashStart, dashRemainingStart, iphaseStart;
- int startAngle, spanAngle, endAngle, backwards;
+ int iDash = 0, dashRemaining;
+ int iDashStart = 0, dashRemainingStart = 0, iphaseStart;
+ int startAngle, spanAngle, endAngle, backwards = 0;
int prevDashAngle, dashAngle;
dashMap map;
@@ -2242,9 +2289,9 @@ arcfail:
}
static double
-angleToLength (angle, map)
- int angle;
- dashMap *map;
+angleToLength (
+ int angle,
+ dashMap *map)
{
double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen;
int di;
@@ -2292,9 +2339,9 @@ angleToLength (angle, map)
*/
static int
-lengthToAngle (len, map)
- double len;
- dashMap *map;
+lengthToAngle (
+ double len,
+ dashMap *map)
{
double sidelen = map->map[DASH_MAP_SIZE - 1];
int angle, angleexcess;
@@ -2364,11 +2411,12 @@ lengthToAngle (len, map)
*/
static int
-computeAngleFromPath (startAngle, endAngle, map, lenp, backwards)
- int startAngle, endAngle; /* normalized absolute angles in *64 degrees */
- dashMap *map;
- int *lenp;
- int backwards;
+computeAngleFromPath (
+ int startAngle,
+ int endAngle, /* normalized absolute angles in *64 degrees */
+ dashMap *map,
+ int *lenp,
+ int backwards)
{
int a0, a1, a;
double len0;
@@ -2409,14 +2457,15 @@ computeAngleFromPath (startAngle, endAngle, map, lenp, backwards)
*/
static void
-drawZeroArc (pDraw, pGC, tarc, lw, left, right)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *tarc;
- int lw;
- miArcFacePtr right, left;
+drawZeroArc (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *tarc,
+ int lw,
+ miArcFacePtr left,
+ miArcFacePtr right)
{
- double x0, y0, x1, y1, w, h, x, y;
+ double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y;
double xmax, ymax, xmin, ymin;
int a0, a1;
double a, startAngle, endAngle;
@@ -2543,9 +2592,9 @@ drawZeroArc (pDraw, pGC, tarc, lw, left, right)
*/
static void
-tailEllipseY (def, acc)
- struct arc_def *def;
- struct accelerators *acc;
+tailEllipseY (
+ struct arc_def *def,
+ struct accelerators *acc)
{
double t;
@@ -2572,46 +2621,50 @@ tailEllipseY (def, acc)
*/
static double
-outerXfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+outerXfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-outerYfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+outerYfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerXfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+innerXfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerYfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+innerYfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerYfromY (y, def, acc)
- double y;
- struct arc_def *def;
- struct accelerators *acc;
+innerYfromY (
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
double x;
@@ -2621,9 +2674,12 @@ innerYfromY (y, def, acc)
}
static void
-computeLine (x1, y1, x2, y2, line)
- double x1, y1, x2, y2;
- struct line *line;
+computeLine (
+ double x1,
+ double y1,
+ double x2,
+ double y2,
+ struct line *line)
{
if (y1 == y2)
line->valid = 0;
@@ -2641,11 +2697,11 @@ computeLine (x1, y1, x2, y2, line)
*/
static void
-computeAcc (tarc, lw, def, acc)
- xArc *tarc;
- int lw;
- struct arc_def *def;
- struct accelerators *acc;
+computeAcc (
+ xArc *tarc,
+ int lw,
+ struct arc_def *def,
+ struct accelerators *acc)
{
def->w = ((double) tarc->width) / 2.0;
def->h = ((double) tarc->height) / 2.0;
@@ -2671,11 +2727,12 @@ computeAcc (tarc, lw, def, acc)
*/
static void
-computeBound (def, bound, acc, right, left)
- struct arc_def *def;
- struct arc_bound *bound;
- struct accelerators *acc;
- miArcFacePtr right, left;
+computeBound (
+ struct arc_def *def,
+ struct arc_bound *bound,
+ struct accelerators *acc,
+ miArcFacePtr right,
+ miArcFacePtr left)
{
double t;
double innerTaily;
@@ -2811,11 +2868,11 @@ computeBound (def, bound, acc, right, left)
*/
static double
-hookEllipseY (scan_y, bound, acc, left)
- double scan_y;
- struct arc_bound *bound;
- struct accelerators *acc;
- int left;
+hookEllipseY (
+ double scan_y,
+ struct arc_bound *bound,
+ struct accelerators *acc,
+ int left)
{
double ret;
@@ -2837,12 +2894,12 @@ hookEllipseY (scan_y, bound, acc, left)
*/
static double
-hookX (scan_y, def, bound, acc, left)
- double scan_y;
- struct arc_def *def;
- struct arc_bound *bound;
- struct accelerators *acc;
- int left;
+hookX (
+ double scan_y,
+ struct arc_def *def,
+ struct arc_bound *bound,
+ struct accelerators *acc,
+ int left)
{
double ellipse_y, x;
double maxMin;
@@ -2894,16 +2951,16 @@ hookX (scan_y, def, bound, acc, left)
*/
static void
-arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask)
- int y;
- int lx;
- int lw;
- int rx;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+arcSpan (
+ int y,
+ int lx,
+ int lw,
+ int rx,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc,
+ int mask)
{
int linx, loutx, rinx, routx;
double x, altx;
@@ -2964,15 +3021,15 @@ arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask)
}
static void
-arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask)
- int lx;
- int lw;
- int rx;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+arcSpan0 (
+ int lx,
+ int lw,
+ int rx,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc,
+ int mask)
{
double x;
@@ -2992,14 +3049,14 @@ arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask)
}
static void
-tailSpan (y, lw, rw, def, bounds, acc, mask)
- int y;
- int lw;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+tailSpan (
+ int y,
+ int lw,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc,
+ int mask)
{
double yy, xalt, x, lx, rx;
int n;
@@ -3101,7 +3158,7 @@ realAllocSpan ()
}
static void
-disposeFinalSpans ()
+disposeFinalSpans (void)
{
struct finalSpanChunk *chunk, *next;
@@ -3116,9 +3173,9 @@ disposeFinalSpans ()
}
static void
-fillSpans (pDrawable, pGC)
- DrawablePtr pDrawable;
- GCPtr pGC;
+fillSpans (
+ DrawablePtr pDrawable,
+ GCPtr pGC)
{
register struct finalSpan *span;
register DDXPointPtr xSpan;
@@ -3131,8 +3188,8 @@ fillSpans (pDrawable, pGC)
if (nspans == 0)
return;
- xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec));
- xWidth = xWidths = (int *) xalloc (nspans * sizeof (int));
+ xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec));
+ xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int));
if (xSpans && xWidths)
{
i = 0;
@@ -3151,8 +3208,10 @@ fillSpans (pDrawable, pGC)
(*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
}
disposeFinalSpans ();
- xfree (xSpans);
- xfree (xWidths);
+ if (xSpans)
+ DEALLOCATE_LOCAL (xSpans);
+ if (xWidths)
+ DEALLOCATE_LOCAL (xWidths);
finalMiny = 0;
finalMaxy = -1;
finalSize = 0;
@@ -3166,8 +3225,7 @@ fillSpans (pDrawable, pGC)
realFindSpan (y))
static struct finalSpan **
-realFindSpan (y)
- int y;
+realFindSpan (int y)
{
struct finalSpan **newSpans;
int newSize, newMiny, newMaxy;
@@ -3218,9 +3276,10 @@ realFindSpan (y)
}
static void
-newFinalSpan (y, xmin, xmax)
- int y;
- register int xmin, xmax;
+newFinalSpan (
+ int y,
+ register int xmin,
+ register int xmax)
{
register struct finalSpan *x;
register struct finalSpan **f;
@@ -3275,9 +3334,9 @@ newFinalSpan (y, xmin, xmax)
}
static void
-mirrorSppPoint (quadrant, sppPoint)
- int quadrant;
- SppPointPtr sppPoint;
+mirrorSppPoint (
+ int quadrant,
+ SppPointPtr sppPoint)
{
switch (quadrant) {
case 0:
@@ -3308,17 +3367,20 @@ mirrorSppPoint (quadrant, sppPoint)
*/
static void
-drawArc (tarc, l, a0, a1, right, left)
- xArc *tarc;
- int l, a0, a1;
- miArcFacePtr right, left; /* save end line points */
+drawArc (
+ xArc *tarc,
+ int l,
+ int a0,
+ int a1,
+ miArcFacePtr right,
+ miArcFacePtr left) /* save end line points */
{
struct arc_def def;
struct accelerators acc;
int startq, endq, curq;
- int rightq, leftq, righta, lefta;
+ int rightq, leftq = 0, righta = 0, lefta = 0;
miArcFacePtr passRight, passLeft;
- int q0, q1, mask;
+ int q0 = 0, q1 = 0, mask;
struct band {
int a0, a1;
int mask;
@@ -3547,13 +3609,15 @@ drawArc (tarc, l, a0, a1, right, left)
}
static void
-drawQuadrant (def, acc, a0, a1, mask, right, left, spdata)
- struct arc_def *def;
- struct accelerators *acc;
- int a0, a1;
- int mask;
- miArcFacePtr right, left;
- miArcSpanData *spdata;
+drawQuadrant (
+ struct arc_def *def,
+ struct accelerators *acc,
+ int a0,
+ int a1,
+ int mask,
+ miArcFacePtr right,
+ miArcFacePtr left,
+ miArcSpanData *spdata)
{
struct arc_bound bound;
double yy, x, xalt;
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 762e7effa..f0228212c 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.11 2001/12/14 20:00:20 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -268,19 +269,26 @@ miCopyArea(pSrcDrawable, pDstDrawable,
* No clever strategy here, we grab a scanline at a time, pull out the
* bits and then stuff them in a 1 bit deep map.
*/
+/*
+ * This should be replaced with something more general. mi shouldn't have to
+ * care about such things as scanline padding et alia.
+ */
static
-unsigned long *
-miGetPlane(pDraw, planeNum, sx, sy, w, h, result)
- DrawablePtr pDraw;
- int planeNum; /* number of the bitPlane */
- int sx, sy, w, h;
- unsigned long *result;
+MiBits *
+miGetPlane(
+ DrawablePtr pDraw,
+ int planeNum, /* number of the bitPlane */
+ int sx,
+ int sy,
+ int w,
+ int h,
+ MiBits *result)
{
int i, j, k, width, bitsPerPixel, widthInBytes;
- DDXPointRec pt;
- unsigned long pixel;
- unsigned long bit;
- unsigned char *pCharsOut;
+ DDXPointRec pt = {0, 0};
+ MiBits pixel;
+ MiBits bit;
+ unsigned char *pCharsOut = NULL;
#if BITMAP_SCANLINE_UNIT == 8
#define OUT_TYPE unsigned char
@@ -296,15 +304,15 @@ miGetPlane(pDraw, planeNum, sx, sy, w, h, result)
#endif
OUT_TYPE *pOut;
- int delta;
+ int delta = 0;
sx += pDraw->x;
sy += pDraw->y;
widthInBytes = BitmapBytePad(w);
if(!result)
- result = (unsigned long *)xalloc(h * widthInBytes);
+ result = (MiBits *)xalloc(h * widthInBytes);
if (!result)
- return (unsigned long *)NULL;
+ return (MiBits *)NULL;
bitsPerPixel = pDraw->bitsPerPixel;
bzero((char *)result, h * widthInBytes);
pOut = (OUT_TYPE *) result;
@@ -344,12 +352,23 @@ miGetPlane(pDraw, planeNum, sx, sy, w, h, result)
* Now get the bit and insert into a bitmap in XY format.
*/
bit = (pixel >> planeNum) & 1;
+#ifndef XFree86Server
/* XXX assuming bit order == byte order */
#if BITMAP_BIT_ORDER == LSBFirst
bit <<= k;
#else
bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k);
#endif
+#else
+ /* XXX assuming byte order == LSBFirst */
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ bit <<= k;
+ else
+ bit <<= ((screenInfo.bitmapScanlineUnit - 1) -
+ (k % screenInfo.bitmapScanlineUnit)) +
+ ((k / screenInfo.bitmapScanlineUnit) *
+ screenInfo.bitmapScanlineUnit);
+#endif
*pOut |= (OUT_TYPE) bit;
k++;
if (k == BITMAP_SCANLINE_UNIT)
@@ -380,7 +399,7 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty)
DrawablePtr pDraw;
GCPtr pGC;
RegionPtr prgnSrc;
- unsigned long *pbits;
+ MiBits *pbits;
int srcx, w, h, dstx, dsty;
{
int oldfill, i;
@@ -537,7 +556,7 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
int dstx, dsty;
unsigned long bitPlane;
{
- unsigned long *ptile;
+ MiBits *ptile;
BoxRec box;
RegionPtr prgnSrc, prgnExposed;
@@ -589,7 +608,7 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1,
box.x1, box.y1,
box.x2 - box.x1, box.y2 - box.y1,
- (unsigned long *) NULL);
+ (MiBits *) NULL);
if (ptile)
{
miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0,
@@ -630,10 +649,10 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
{
unsigned char depth;
int i, linelength, width, srcx, srcy;
- DDXPointRec pt;
+ DDXPointRec pt = {0, 0};
XID gcv[2];
PixmapPtr pPixmap = (PixmapPtr)NULL;
- GCPtr pGC;
+ GCPtr pGC = NULL;
depth = pDraw->depth;
if(format == ZPixmap)
@@ -697,11 +716,10 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
else
{
(void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h,
- (unsigned long *)pDst);
+ (MiBits *)pDst);
}
}
-
/* MIPUTIMAGE -- public entry for the PutImage request
* Here we benefit from knowing the format of the bits pointed to by pImage,
* even if we don't know how pDraw represents them.
@@ -752,7 +770,7 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
box.y2 = h;
prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1);
- miOpqStipDrawable(pDraw, pGC, prgnSrc, (unsigned long *) pImage,
+ miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage,
leftPad, w, h, x, y);
REGION_DESTROY(pGC->pScreen, prgnSrc);
break;
@@ -782,6 +800,7 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
gcv[1] = (XID)oldFg;
gcv[2] = (XID)oldBg;
DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
+ ValidateGC(pDraw, pGC);
break;
case ZPixmap:
diff --git a/mi/mibstore.c b/mi/mibstore.c
index f8a4cc891..f98aaebbf 100644
--- a/mi/mibstore.c
+++ b/mi/mibstore.c
@@ -42,6 +42,8 @@ implied warranty.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mi/mibstore.c,v 1.10 2001/12/14 20:00:20 dawes Exp $ */
+
#define NEED_EVENTS
#include "X.h"
#include "Xmd.h"
@@ -50,7 +52,6 @@ implied warranty.
#include "regionstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
-#include "extnsionst.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "fontstruct.h"
@@ -136,12 +137,12 @@ implied warranty.
(pGC)->funcs = oldFuncs; \
}
-static void miCreateBSPixmap();
-static void miDestroyBSPixmap();
-static void miTileVirtualBS();
-static void miBSAllocate(), miBSFree();
-static Bool miBSCreateGCPrivate ();
-static void miBSClearBackingRegion ();
+static void miCreateBSPixmap(WindowPtr pWin, BoxPtr pExtents);
+static void miDestroyBSPixmap(WindowPtr pWin);
+static void miTileVirtualBS(WindowPtr pWin);
+static void miBSAllocate(WindowPtr pWin), miBSFree(WindowPtr pWin);
+static Bool miBSCreateGCPrivate(GCPtr pGC);
+static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn);
#define MoreCopy0 ;
#define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++;
@@ -181,22 +182,36 @@ else \
static int miBSScreenIndex;
static unsigned long miBSGeneration = 0;
-static Bool miBSCloseScreen();
-static void miBSGetImage();
-static void miBSGetSpans();
-static Bool miBSChangeWindowAttributes();
-static Bool miBSCreateGC();
-static Bool miBSDestroyWindow();
+static Bool miBSCloseScreen(int i, ScreenPtr pScreen);
+static void miBSGetImage(DrawablePtr pDrawable, int sx, int sy,
+ int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void miBSGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart);
+static Bool miBSChangeWindowAttributes(WindowPtr pWin,
+ unsigned long mask);
+static Bool miBSCreateGC(GCPtr pGC);
+static Bool miBSDestroyWindow(WindowPtr pWin);
/*
* backing store screen functions
*/
-static void miBSSaveDoomedAreas();
-static RegionPtr miBSRestoreAreas();
-static void miBSExposeCopy();
-static RegionPtr miBSTranslateBackingStore(), miBSClearBackingStore();
-static void miBSDrawGuarantee();
+static void miBSSaveDoomedAreas(WindowPtr pWin, RegionPtr pObscured,
+ int dx, int dy);
+static RegionPtr miBSRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed);
+static void miBSExposeCopy(WindowPtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr prgnExposed,
+ int srcx, int srcy, int dstx, int dsty,
+ unsigned long plane);
+static RegionPtr miBSTranslateBackingStore(WindowPtr pWin, int windx,
+ int windy, RegionPtr oldClip,
+ int oldx, int oldy);
+static RegionPtr miBSClearBackingStore(WindowPtr pWin, int x, int y,
+ int w, int h, Bool generateExposures);
+static void miBSDrawGuarantee(WindowPtr pWin, GCPtr pGC,
+ int guarantee);
/*
* wrapper vectors for GC funcs and ops
@@ -204,9 +219,14 @@ static void miBSDrawGuarantee();
static int miBSGCIndex;
-static void miBSValidateGC (), miBSCopyGC (), miBSDestroyGC();
-static void miBSChangeGC();
-static void miBSChangeClip(), miBSDestroyClip(), miBSCopyClip();
+static void miBSValidateGC(GCPtr pGC, unsigned long stateChanges,
+ DrawablePtr pDrawable);
+static void miBSCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void miBSDestroyGC(GCPtr pGC);
+static void miBSChangeGC(GCPtr pGC, unsigned long mask);
+static void miBSChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void miBSDestroyClip(GCPtr pGC);
+static void miBSCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
static GCFuncs miBSGCFuncs = {
miBSValidateGC,
@@ -218,17 +238,59 @@ static GCFuncs miBSGCFuncs = {
miBSCopyClip,
};
-static void miBSFillSpans(), miBSSetSpans(), miBSPutImage();
-static RegionPtr miBSCopyArea(), miBSCopyPlane();
-static void miBSPolyPoint(), miBSPolylines(), miBSPolySegment();
-static void miBSPolyRectangle(),miBSPolyArc(), miBSFillPolygon();
-static void miBSPolyFillRect(), miBSPolyFillArc();
-static int miBSPolyText8(), miBSPolyText16();
-static void miBSImageText8(), miBSImageText16();
-static void miBSImageGlyphBlt(),miBSPolyGlyphBlt();
-static void miBSPushPixels();
+static void miBSFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit,
+ int fSorted);
+static void miBSSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ int fSorted);
+static void miBSPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad,
+ int format, char *pBits);
+static RegionPtr miBSCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty);
+static RegionPtr miBSCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long plane);
+static void miBSPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, xPoint *pptInit);
+static void miBSPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit);
+static void miBSPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSegs);
+static void miBSPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects);
+static void miBSPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs,
+ xArc *parcs);
+static void miBSFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts);
+static void miBSPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+static void miBSPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+static int miBSPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static int miBSPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miBSImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static void miBSImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miBSImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+static void miBSPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+static void miBSPushPixels(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDst, int w, int h,
+ int x, int y);
#ifdef NEED_LINEHELPER
-static void miBSLineHelper();
+static void miBSLineHelper(void);
#endif
static GCOps miBSGCOps = {
@@ -259,10 +321,15 @@ static GCOps miBSGCOps = {
* store enabled
*/
-static void miBSCheapValidateGC(), miBSCheapCopyGC(), miBSCheapDestroyGC();
-static void miBSCheapChangeGC ();
-static void miBSCheapChangeClip(), miBSCheapDestroyClip();
-static void miBSCheapCopyClip();
+static void miBSCheapValidateGC(GCPtr pGC, unsigned long stateChanges,
+ DrawablePtr pDrawable);
+static void miBSCheapCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void miBSCheapDestroyGC(GCPtr pGC);
+static void miBSCheapChangeGC(GCPtr pGC, unsigned long mask);
+static void miBSCheapChangeClip(GCPtr pGC, int type, pointer pvalue,
+ int nrects);
+static void miBSCheapDestroyClip(GCPtr pGC);
+static void miBSCheapCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
static GCFuncs miBSCheapGCFuncs = {
miBSCheapValidateGC,
@@ -282,13 +349,13 @@ static GCFuncs miBSCheapGCFuncs = {
/*
* called from device screen initialization proc. Gets a GCPrivateIndex
- * and wraps appropriate per-screen functions
+ * and wraps appropriate per-screen functions. pScreen->BackingStoreFuncs
+ * must be previously initialized.
*/
void
-miInitializeBackingStore (pScreen, funcs)
+miInitializeBackingStore (pScreen)
ScreenPtr pScreen;
- miBSFuncPtr funcs;
{
miBSScreenPtr pScreenPriv;
@@ -312,7 +379,6 @@ miInitializeBackingStore (pScreen, funcs)
pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- pScreenPriv->funcs = funcs;
pScreen->CloseScreen = miBSCloseScreen;
pScreen->GetImage = miBSGetImage;
@@ -368,7 +434,9 @@ miBSCloseScreen (i, pScreen)
return (*pScreen->CloseScreen) (i, pScreen);
}
-static void miBSFillVirtualBits();
+static void miBSFillVirtualBits(DrawablePtr pDrawable, GCPtr pGC,
+ RegionPtr pRgn, int x, int y, int state,
+ PixUnion pixunion, unsigned long planemask);
static void
miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
@@ -389,7 +457,7 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
{
PixmapPtr pPixmap;
miBSWindowPtr pWindowPriv;
- GCPtr pGC;
+ GCPtr pGC = NULL;
WindowPtr pWin, pSrcWin;
int xoff, yoff;
RegionRec Remaining;
@@ -847,8 +915,7 @@ miBSCreateGCPrivate (pGC)
}
static void
-miBSDestroyGCPrivate (pGC)
- GCPtr pGC;
+miBSDestroyGCPrivate (GCPtr pGC)
{
miBSGCRec *pPriv;
@@ -1030,6 +1097,11 @@ miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits)
EPILOGUE (pGC);
}
+typedef RegionPtr (* CopyAreaProcPtr)(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int);
+typedef RegionPtr (* CopyPlaneProcPtr)(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int,
+ unsigned long bitPlane);
/*-
*-----------------------------------------------------------------------
* miBSDoCopy --
@@ -1058,18 +1130,18 @@ miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits)
*-----------------------------------------------------------------------
*/
static Bool
-miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
- WindowPtr pWin; /* Window being scrolled */
- GCPtr pGC; /* GC we're called through */
- int srcx; /* X of source rectangle */
- int srcy; /* Y of source rectangle */
- int w; /* Width of source rectangle */
- int h; /* Height of source rectangle */
- int dstx; /* X of destination rectangle */
- int dsty; /* Y of destination rectangle */
- unsigned long plane; /* Plane to copy (0 for CopyArea) */
- RegionPtr (*copyProc)(); /* Procedure to call to perform the copy */
- RegionPtr *ppRgn; /* resultant Graphics Expose region */
+miBSDoCopy(
+ WindowPtr pWin, /* Window being scrolled */
+ GCPtr pGC, /* GC we're called through */
+ int srcx, /* X of source rectangle */
+ int srcy, /* Y of source rectangle */
+ int w, /* Width of source rectangle */
+ int h, /* Height of source rectangle */
+ int dstx, /* X of destination rectangle */
+ int dsty, /* Y of destination rectangle */
+ unsigned long plane, /* Plane to copy (0 for CopyArea) */
+ CopyPlaneProcPtr copyProc, /* Procedure to call to perform the copy */
+ RegionPtr *ppRgn) /* resultant Graphics Expose region */
{
RegionPtr pRgnExp; /* Exposed region */
RegionPtr pRgnObs; /* Obscured region */
@@ -1086,11 +1158,12 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
register BoxPtr pBox;
int dx, dy, nrects;
Bool graphicsExposures;
- RegionPtr (*pixCopyProc)();
+ CopyPlaneProcPtr pixCopyProc;
int numRectsExp, numRectsObs;
BoxPtr pBoxExp, pBoxObs;
SETUP_BACKING (pWin, pGC);
+ (void)oldFuncs;
/*
* Create a region of exposed boxes in pRgnExp.
@@ -1310,7 +1383,7 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
}
else
{
- pixCopyProc = pBackingGC->ops->CopyArea;
+ pixCopyProc = (CopyPlaneProcPtr)pBackingGC->ops->CopyArea;
}
for (i = 0; i < nrects; i++)
@@ -1325,7 +1398,7 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
*/
if (boxes[sequence[i]].source == pix)
{
- (void) (* copyProc) (pBackingDrawable, pWin, pGC,
+ (void) (* copyProc) (pBackingDrawable, &(pWin->drawable), pGC,
pBox->x1 - pBackingStore->x,
pBox->y1 - pBackingStore->y,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
@@ -1339,12 +1412,12 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
}
else
{
- (void) (* pixCopyProc) (pWin, pBackingDrawable, pBackingGC,
+ (void) (* pixCopyProc) (&(pWin->drawable), pBackingDrawable, pBackingGC,
pBox->x1, pBox->y1,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
pBox->x1 + dx - pBackingStore->x,
pBox->y1 + dy - pBackingStore->y, plane);
- (void) (* copyProc) (pWin, pWin, pGC,
+ (void) (* copyProc) (&(pWin->drawable), &(pWin->drawable), pGC,
pBox->x1, pBox->y1,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
pBox->x1 + dx, pBox->y1 + dy, plane);
@@ -1431,7 +1504,8 @@ miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty)
if ((pSrc != pDst) ||
(!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty,
- (unsigned long) 0, pGC->ops->CopyArea, &winExposed)))
+ (unsigned long) 0, (CopyPlaneProcPtr)pGC->ops->CopyArea,
+ &winExposed)))
{
/*
* always copy to the backing store first, miBSDoCopy
@@ -2305,8 +2379,8 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
gcvalues[1] = (pointer) background.pixmap;
gcmask = GCFillStyle|GCTile;
}
- gcvalues[2] = (pointer)(ts_x_origin - pBackingStore->x);
- gcvalues[3] = (pointer)(ts_y_origin - pBackingStore->y);
+ gcvalues[2] = (pointer)(long)(ts_x_origin - pBackingStore->x);
+ gcvalues[3] = (pointer)(long)(ts_y_origin - pBackingStore->y);
gcmask |= GCTileStipXOrigin|GCTileStipYOrigin;
DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE);
ValidateGC((DrawablePtr)pBackingStore->pBackingPixmap, pGC);
@@ -2449,12 +2523,12 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask)
}
if (pGC->patOrg.x != x)
{
- gcval[i++] = (pointer)x;
+ gcval[i++] = (pointer)(long)x;
gcmask |= GCTileStipXOrigin;
}
if (pGC->patOrg.y != y)
{
- gcval[i++] = (pointer)y;
+ gcval[i++] = (pointer)(long)y;
gcmask |= GCTileStipYOrigin;
}
}
@@ -2596,7 +2670,9 @@ miBSFree(pWin)
WindowPtr pWin;
{
miBSWindowPtr pBackingStore;
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ register ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
pBackingStore = (miBSWindowPtr)pWin->backStorage;
if (pBackingStore)
@@ -2626,10 +2702,11 @@ miBSFree(pWin)
*-----------------------------------------------------------------------
*/
static void
-miResizeBackingStore(pWin, dx, dy, saveBits)
- WindowPtr pWin;
- int dx, dy; /* bits are moving this far */
- Bool saveBits; /* bits are useful */
+miResizeBackingStore(
+ WindowPtr pWin,
+ int dx, /* bits are moving this far */
+ int dy, /* bits are moving this far */
+ Bool saveBits) /* bits are useful */
{
miBSWindowPtr pBackingStore;
PixmapPtr pBackingPixmap;
@@ -2655,7 +2732,7 @@ miResizeBackingStore(pWin, dx, dy, saveBits)
if (nw != pBackingPixmap->drawable.width ||
nh != pBackingPixmap->drawable.height)
{
- if (!saveBits)
+ if (!saveBits || !nw || !nh)
{
pNewPixmap = NullPixmap;
pBackingStore->status = StatusNoPixmap;
@@ -2786,9 +2863,6 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
*/
if (pBackingStore->status != StatusVirtual)
{
- miBSScreenPtr pScreenPriv;
-
- pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr;
if (!pBackingStore->pBackingPixmap)
miCreateBSPixmap (pWin, &oldExtents);
else
@@ -2803,12 +2877,22 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
x += pBackingStore->x;
y += pBackingStore->y;
}
- (* pScreenPriv->funcs->SaveAreas) (pBackingStore->pBackingPixmap,
- pObscured, x - dx, y - dy, pWin);
+ (* pScreen->BackingStoreFuncs.SaveAreas)
+ (pBackingStore->pBackingPixmap, pObscured,
+ x - dx, y - dy, pWin);
}
}
REGION_TRANSLATE(pScreen, pObscured, x, y);
}
+ else
+ {
+ if (REGION_BROKEN (pScreen, pObscured))
+ {
+ REGION_EMPTY( pScreen, &pBackingStore->SavedRegion);
+ miDestroyBSPixmap (pWin);
+ return;
+ }
+ }
}
/*-
@@ -2870,21 +2954,17 @@ miBSRestoreAreas(pWin, prgnExposed)
if (REGION_NOTEMPTY( pScreen, prgnRestored))
{
- miBSScreenPtr pScreenPriv;
-
REGION_SUBTRACT( pScreen, prgnSaved, prgnSaved, prgnExposed);
REGION_SUBTRACT( pScreen, prgnExposed, prgnExposed, prgnRestored);
/*
* Do the actual restoration
*/
-
- pScreenPriv = (miBSScreenPtr)
- pScreen->devPrivates[miBSScreenIndex].ptr;
- (* pScreenPriv->funcs->RestoreAreas) (pBackingPixmap,
+ (* pScreen->BackingStoreFuncs.RestoreAreas) (pBackingPixmap,
prgnRestored,
pWin->drawable.x + pBackingStore->x,
- pWin->drawable.y + pBackingStore->y, pWin);
+ pWin->drawable.y + pBackingStore->y,
+ pWin);
/*
* if the saved region is completely empty, dispose of the
* backing pixmap, otherwise, retranslate the saved
@@ -3280,7 +3360,7 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
DrawablePtr pDrawable;
{
GCPtr pBackingGC;
- miBSWindowPtr pWindowPriv;
+ miBSWindowPtr pWindowPriv = NULL;
miBSGCPtr pPriv;
WindowPtr pWin;
int lift_functions;
@@ -3456,17 +3536,13 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
if (pGC->clientClipType == CT_PIXMAP)
{
- miBSScreenPtr pScreenPriv;
-
(*pBackingGC->funcs->CopyClip)(pBackingGC, pGC);
REGION_TRANSLATE(pGC->pScreen, backingCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
vals[0] = pGC->clipOrg.x - pWindowPriv->x;
vals[1] = pGC->clipOrg.y - pWindowPriv->y;
DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0);
- pScreenPriv = (miBSScreenPtr)
- pGC->pScreen->devPrivates[miBSScreenIndex].ptr;
- (* pScreenPriv->funcs->SetClipmaskRgn)
+ (* pGC->pScreen->BackingStoreFuncs.SetClipmaskRgn)
(pBackingGC, backingCompositeClip);
REGION_DESTROY( pGC->pScreen, backingCompositeClip);
}
@@ -3641,7 +3717,7 @@ miCreateBSPixmap (pWin, pExtents)
miBSWindowPtr pBackingStore;
ScreenPtr pScreen;
PixUnion background;
- char backgroundState;
+ char backgroundState = 0;
BoxPtr extents;
Bool backSet;
@@ -3654,7 +3730,9 @@ miCreateBSPixmap (pWin, pExtents)
extents = REGION_EXTENTS( pScreen, &pBackingStore->SavedRegion);
- if (!pBackingStore->pBackingPixmap)
+ if (!pBackingStore->pBackingPixmap &&
+ extents->x2 != extents->x1 &&
+ extents->y2 != extents->y1)
{
/* the policy here could be more sophisticated */
pBackingStore->x = extents->x1;
@@ -3757,7 +3835,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
{
RegionRec tempRgn;
miBSWindowPtr pBackingStore;
- RegionPtr (*copyProc)();
+ CopyPlaneProcPtr copyProc;
GCPtr pScratchGC;
register BoxPtr pBox;
register int i;
@@ -3780,7 +3858,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
if (plane != 0) {
copyProc = pGC->ops->CopyPlane;
} else {
- copyProc = pGC->ops->CopyArea;
+ copyProc = (CopyPlaneProcPtr)pGC->ops->CopyArea;
}
dx = dstx - srcx;
@@ -3811,7 +3889,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
--i >= 0;
pBox++)
{
- (* copyProc) (pBackingStore->pBackingPixmap, pDst, pGC,
+ (* copyProc) (&(pBackingStore->pBackingPixmap->drawable), pDst, pGC,
pBox->x1 - pBackingStore->x,
pBox->y1 - pBackingStore->y,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
diff --git a/mi/mibstore.h b/mi/mibstore.h
index fe6c759e0..e8f197dbc 100644
--- a/mi/mibstore.h
+++ b/mi/mibstore.h
@@ -15,48 +15,16 @@
* "$Xorg: mibstore.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $
*/
+
+/* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.5 2001/08/06 20:51:18 dawes Exp $ */
+
#ifndef _MIBSTORE_H
#define _MIBSTORE_H
-typedef struct _miBSFuncRec {
- void (*SaveAreas)(
-#if NeedNestedPrototypes
- PixmapPtr /*pBackingPixmap*/,
- RegionPtr /*pObscured*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pWin*/
-#endif
-);
- void (*RestoreAreas)(
-#if NeedNestedPrototypes
- PixmapPtr /*pBackingPixmap*/,
- RegionPtr /*pExposed*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pWin*/
-#endif
-);
- void (*SetClipmaskRgn)(
-#if NeedNestedPrototypes
- GCPtr /*pBackingGC*/,
- RegionPtr /*pbackingCompositeClip*/
-#endif
-);
- PixmapPtr (*GetImagePixmap)(); /* unused */
- PixmapPtr (*GetSpansPixmap)(); /* unused */
-} miBSFuncRec;
-
-#ifndef _XTYPEDEF_MIBSFUNCPTR
-typedef struct _miBSFuncRec *miBSFuncPtr;
-#define _XTYPEDEF_MIBSFUNCPTR
-#endif
+#include "screenint.h"
extern void miInitializeBackingStore(
-#if NeedFunctionPrototypes
- ScreenPtr /*pScreen*/,
- miBSFuncPtr /*funcs*/
-#endif
+ ScreenPtr /*pScreen*/
);
#endif /* _MIBSTORE_H */
diff --git a/mi/mibstorest.h b/mi/mibstorest.h
index d56ee76f6..249b4d4d3 100644
--- a/mi/mibstorest.h
+++ b/mi/mibstorest.h
@@ -31,6 +31,8 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mibstorest.h,v 1.5 2001/12/14 20:00:21 dawes Exp $ */
+
#include "mibstore.h"
#include "regionstr.h"
@@ -84,8 +86,4 @@ typedef struct {
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
CreateGCProcPtr CreateGC;
DestroyWindowProcPtr DestroyWindow;
- /*
- * pointer to vector of device-specific backing store functions
- */
- miBSFuncPtr funcs;
} miBSScreenRec, *miBSScreenPtr;
diff --git a/mi/miclipn.c b/mi/miclipn.c
index 6eca416f8..95272c176 100644
--- a/mi/miclipn.c
+++ b/mi/miclipn.c
@@ -26,18 +26,21 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miclipn.c,v 1.4 2001/12/14 20:00:21 dawes Exp $ */
#include "X.h"
#include "windowstr.h"
#include "scrnintstr.h"
+#include "mi.h"
-static void (*clipNotify)() = 0;
-static void (*ClipNotifies[MAXSCREENS])();
+static void (*clipNotify)(WindowPtr,int,int) = 0;
+static void (*ClipNotifies[MAXSCREENS])(WindowPtr,int,int);
static void
-miClipNotifyWrapper(pWin, dx, dy)
- WindowPtr pWin;
- int dx, dy;
+miClipNotifyWrapper(
+ WindowPtr pWin,
+ int dx,
+ int dy )
{
if (clipNotify)
(*clipNotify)(pWin, dx, dy);
@@ -55,8 +58,12 @@ miClipNotifyWrapper(pWin, dx, dy)
static unsigned long clipGeneration = 0;
void
-miClipNotify (func)
- void (*func)();
+miClipNotify (
+ void (*func)(
+ WindowPtr /* pWin */,
+ int /* dx */,
+ int /* dy */
+ ) )
{
int i;
diff --git a/mi/micursor.c b/mi/micursor.c
index b23bcddf6..4c95d2f49 100644
--- a/mi/micursor.c
+++ b/mi/micursor.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/micursor.c,v 1.3 2001/12/14 20:00:21 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -48,6 +49,7 @@ SOFTWARE.
#include "scrnintstr.h"
#include "cursor.h"
#include "misc.h"
+#include "mi.h"
extern Bool Must_have_memory;
diff --git a/mi/midash.c b/mi/midash.c
index cc7e31b28..c3dd24355 100644
--- a/mi/midash.c
+++ b/mi/midash.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/midash.c,v 1.4 2001/12/14 20:00:21 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -49,7 +50,7 @@ SOFTWARE.
#include "mistruct.h"
#include "mifpoly.h"
-static miDashPtr CheckDashStorage();
+static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax);
/* return a list of DashRec. there will be an extra
entry at the end holding the last point of the polyline.
@@ -250,10 +251,10 @@ necessary. this interface seems unnecessarily cumbersome.
static
miDashPtr
-CheckDashStorage(ppseg, nseg, pnsegMax)
-miDashPtr *ppseg; /* base pointer */
-int nseg; /* number of segment we want to write to */
-int *pnsegMax; /* size (in segments) of list so far */
+CheckDashStorage(
+ miDashPtr *ppseg, /* base pointer */
+ int nseg, /* number of segment we want to write to */
+ int *pnsegMax) /* size (in segments) of list so far */
{
if (nseg > *pnsegMax)
{
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 4c33d8e1d..3917a7928 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -30,6 +30,7 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.9 2002/12/09 04:10:57 tsi Exp $ */
#define NEED_EVENTS
# include "X.h"
@@ -44,15 +45,16 @@ in this Software without prior written authorization from The Open Group.
# include "mipointer.h"
# include "misprite.h"
# include "gcstruct.h"
-
-extern WindowPtr *WindowTable;
+#ifdef ARGB_CURSOR
+# include "picturestr.h"
+#endif
/* per-screen private data */
static int miDCScreenIndex;
static unsigned long miDCGeneration = 0;
-static Bool miDCCloseScreen();
+static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
typedef struct {
GCPtr pSourceGC, pMaskGC;
@@ -61,22 +63,39 @@ typedef struct {
GCPtr pPixSourceGC, pPixMaskGC;
CloseScreenProcPtr CloseScreen;
PixmapPtr pSave, pTemp;
+#ifdef ARGB_CURSOR
+ PicturePtr pRootPicture;
+ PicturePtr pTempPicture;
+#endif
} miDCScreenRec, *miDCScreenPtr;
/* per-cursor per-screen private data */
typedef struct {
PixmapPtr sourceBits; /* source bits */
PixmapPtr maskBits; /* mask bits */
+#ifdef ARGB_CURSOR
+ PicturePtr pPicture;
+#endif
} miDCCursorRec, *miDCCursorPtr;
/*
* sprite/cursor method table
*/
-static Bool miDCRealizeCursor(), miDCUnrealizeCursor();
-static Bool miDCPutUpCursor(), miDCSaveUnderCursor();
-static Bool miDCRestoreUnderCursor(), miDCMoveCursor();
-static Bool miDCChangeSave();
+static Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miDCPutUpCursor(ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, unsigned long source,
+ unsigned long mask);
+static Bool miDCSaveUnderCursor(ScreenPtr pScreen, int x, int y,
+ int w, int h);
+static Bool miDCRestoreUnderCursor(ScreenPtr pScreen, int x, int y,
+ int w, int h);
+static Bool miDCMoveCursor(ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, int w, int h, int dx, int dy,
+ unsigned long source, unsigned long mask);
+static Bool miDCChangeSave(ScreenPtr pScreen, int x, int y, int w, int h,
+ int dx, int dy);
static miSpriteCursorFuncRec miDCFuncs = {
miDCRealizeCursor,
@@ -117,6 +136,10 @@ miDCInitialize (pScreen, screenFuncs)
pScreenPriv->pMoveGC =
pScreenPriv->pPixSourceGC =
pScreenPriv->pPixMaskGC = NULL;
+#ifdef ARGB_CURSOR
+ pScreenPriv->pRootPicture = NULL;
+ pScreenPriv->pTempPicture = NULL;
+#endif
pScreenPriv->pSave = pScreenPriv->pTemp = NULL;
@@ -135,9 +158,11 @@ miDCInitialize (pScreen, screenFuncs)
#define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0)
#define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE)
+#define tossPict(pict) (pict ? FreePicture (pict, 0) : 0)
static Bool
miDCCloseScreen (index, pScreen)
+ int index;
ScreenPtr pScreen;
{
miDCScreenPtr pScreenPriv;
@@ -153,6 +178,10 @@ miDCCloseScreen (index, pScreen)
tossGC (pScreenPriv->pPixMaskGC);
tossPix (pScreenPriv->pSave);
tossPix (pScreenPriv->pTemp);
+#ifdef ARGB_CURSOR
+ tossPict (pScreenPriv->pRootPicture);
+ tossPict (pScreenPriv->pTempPicture);
+#endif
xfree ((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (index, pScreen);
}
@@ -167,10 +196,50 @@ miDCRealizeCursor (pScreen, pCursor)
return TRUE;
}
+#ifdef ARGB_CURSOR
+#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
+
+static VisualPtr
+miDCGetWindowVisual (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual (pWin);
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
+ return 0;
+}
+
+static PicturePtr
+miDCMakePicture (PicturePtr *ppPicture, DrawablePtr pDraw, WindowPtr pWin)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ VisualPtr pVisual;
+ PictFormatPtr pFormat;
+ XID subwindow_mode = IncludeInferiors;
+ PicturePtr pPicture;
+ int error;
+
+ pVisual = miDCGetWindowVisual (pWin);
+ if (!pVisual)
+ return 0;
+ pFormat = PictureMatchVisual (pScreen, pDraw->depth, pVisual);
+ if (!pFormat)
+ return 0;
+ pPicture = CreatePicture (0, pDraw, pFormat,
+ CPSubwindowMode, &subwindow_mode,
+ serverClient, &error);
+ *ppPicture = pPicture;
+ return pPicture;
+}
+#endif
+
static miDCCursorPtr
-miDCRealize (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miDCRealize (
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
miDCCursorPtr pPriv;
GCPtr pGC;
@@ -179,6 +248,55 @@ miDCRealize (pScreen, pCursor)
pPriv = (miDCCursorPtr) xalloc (sizeof (miDCCursorRec));
if (!pPriv)
return (miDCCursorPtr)NULL;
+#ifdef ARGB_CURSOR
+ if (pCursor->bits->argb)
+ {
+ PixmapPtr pPixmap;
+ PictFormatPtr pFormat;
+ int error;
+
+ pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat)
+ {
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+
+ pPriv->sourceBits = 0;
+ pPriv->maskBits = 0;
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
+ pCursor->bits->height, 32);
+ if (!pPixmap)
+ {
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+ pGC = GetScratchGC (32, pScreen);
+ if (!pGC)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+ ValidateGC (&pPixmap->drawable, pGC);
+ (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32,
+ 0, 0, pCursor->bits->width,
+ pCursor->bits->height,
+ 0, ZPixmap, (char *) pCursor->bits->argb);
+ FreeScratchGC (pGC);
+ pPriv->pPicture = CreatePicture (0, &pPixmap->drawable,
+ pFormat, 0, 0, serverClient, &error);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ if (!pPriv->pPicture)
+ {
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+ pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv;
+ return pPriv;
+ }
+ pPriv->pPicture = 0;
+#endif
pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1);
if (!pPriv->sourceBits)
{
@@ -241,8 +359,14 @@ miDCUnrealizeCursor (pScreen, pCursor)
pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum];
if (pPriv && (pCursor->bits->refcnt <= 1))
{
- (*pScreen->DestroyPixmap) (pPriv->sourceBits);
- (*pScreen->DestroyPixmap) (pPriv->maskBits);
+ if (pPriv->sourceBits)
+ (*pScreen->DestroyPixmap) (pPriv->sourceBits);
+ if (pPriv->maskBits)
+ (*pScreen->DestroyPixmap) (pPriv->maskBits);
+#ifdef ARGB_CURSOR
+ if (pPriv->pPicture)
+ FreePicture (pPriv->pPicture, 0);
+#endif
xfree ((pointer) pPriv);
pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL;
}
@@ -250,13 +374,17 @@ miDCUnrealizeCursor (pScreen, pCursor)
}
static void
-miDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask)
- DrawablePtr pDrawable;
- GCPtr sourceGC, maskGC;
- int x, y;
- unsigned w, h;
- miDCCursorPtr pPriv;
- unsigned long source, mask;
+miDCPutBits (
+ DrawablePtr pDrawable,
+ miDCCursorPtr pPriv,
+ GCPtr sourceGC,
+ GCPtr maskGC,
+ int x,
+ int y,
+ unsigned w,
+ unsigned h,
+ unsigned long source,
+ unsigned long mask)
{
XID gcvals[1];
@@ -281,9 +409,9 @@ miDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask)
#define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win))
static GCPtr
-miDCMakeGC(ppGC, pWin)
- GCPtr *ppGC;
- WindowPtr pWin;
+miDCMakeGC(
+ GCPtr *ppGC,
+ WindowPtr pWin)
{
GCPtr pGC;
int status;
@@ -293,12 +421,13 @@ miDCMakeGC(ppGC, pWin)
gcvals[1] = FALSE;
pGC = CreateGC((DrawablePtr)pWin,
GCSubwindowMode|GCGraphicsExposures, gcvals, &status);
- if (pGC)
+ if (pGC && pWin->drawable.pScreen->DrawGuarantee)
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);
*ppGC = pGC;
return pGC;
}
+
static Bool
miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
ScreenPtr pScreen;
@@ -319,18 +448,36 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
}
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pWin = WindowTable[pScreen->myNum];
- if (!EnsureGC(pScreenPriv->pSourceGC, pWin))
- return FALSE;
- if (!EnsureGC(pScreenPriv->pMaskGC, pWin))
+#ifdef ARGB_CURSOR
+ if (pPriv->pPicture)
{
- FreeGC (pScreenPriv->pSourceGC, (GContext) 0);
- pScreenPriv->pSourceGC = 0;
- return FALSE;
+ if (!EnsurePicture(pScreenPriv->pRootPicture, &pWin->drawable, pWin))
+ return FALSE;
+ CompositePicture (PictOpOver,
+ pPriv->pPicture,
+ NULL,
+ pScreenPriv->pRootPicture,
+ 0, 0, 0, 0,
+ x, y,
+ pCursor->bits->width,
+ pCursor->bits->height);
+ }
+ else
+#endif
+ {
+ if (!EnsureGC(pScreenPriv->pSourceGC, pWin))
+ return FALSE;
+ if (!EnsureGC(pScreenPriv->pMaskGC, pWin))
+ {
+ FreeGC (pScreenPriv->pSourceGC, (GContext) 0);
+ pScreenPriv->pSourceGC = 0;
+ return FALSE;
+ }
+ miDCPutBits ((DrawablePtr)pWin, pPriv,
+ pScreenPriv->pSourceGC, pScreenPriv->pMaskGC,
+ x, y, pCursor->bits->width, pCursor->bits->height,
+ source, mask);
}
- miDCPutBits ((DrawablePtr)pWin, pPriv,
- pScreenPriv->pSourceGC, pScreenPriv->pMaskGC,
- x, y, pCursor->bits->width, pCursor->bits->height,
- source, mask);
return TRUE;
}
@@ -554,6 +701,13 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
{
if (pTemp)
(*pScreen->DestroyPixmap) (pTemp);
+#ifdef ARGB_CURSOR
+ if (pScreenPriv->pTempPicture)
+ {
+ FreePicture (pScreenPriv->pTempPicture, 0);
+ pScreenPriv->pTempPicture = 0;
+ }
+#endif
pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap)
(pScreen, w, h, pScreenPriv->pSave->drawable.depth);
if (!pTemp)
@@ -578,24 +732,42 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
/*
* draw the cursor in the temporary pixmap
*/
- if (!pScreenPriv->pPixSourceGC)
+#ifdef ARGB_CURSOR
+ if (pPriv->pPicture)
{
- pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status);
- if (!pScreenPriv->pPixSourceGC)
+ if (!EnsurePicture(pScreenPriv->pTempPicture, &pTemp->drawable, pWin))
return FALSE;
+ CompositePicture (PictOpOver,
+ pPriv->pPicture,
+ NULL,
+ pScreenPriv->pTempPicture,
+ 0, 0, 0, 0,
+ dx, dy,
+ pCursor->bits->width,
+ pCursor->bits->height);
}
- if (!pScreenPriv->pPixMaskGC)
+ else
+#endif
{
- pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status);
+ if (!pScreenPriv->pPixSourceGC)
+ {
+ pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
+ GCGraphicsExposures, &gcval, &status);
+ if (!pScreenPriv->pPixSourceGC)
+ return FALSE;
+ }
if (!pScreenPriv->pPixMaskGC)
- return FALSE;
+ {
+ pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
+ GCGraphicsExposures, &gcval, &status);
+ if (!pScreenPriv->pPixMaskGC)
+ return FALSE;
+ }
+ miDCPutBits ((DrawablePtr)pTemp, pPriv,
+ pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC,
+ dx, dy, pCursor->bits->width, pCursor->bits->height,
+ source, mask);
}
- miDCPutBits ((DrawablePtr)pTemp, pPriv,
- pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC,
- dx, dy, pCursor->bits->width, pCursor->bits->height,
- source, mask);
/*
* copy the temporary pixmap onto the screen
diff --git a/mi/mieq.c b/mi/mieq.c
index 02b35160c..699d4130c 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/mi/mieq.c,v 1.3 2001/12/14 20:00:22 dawes Exp $ */
/*
* mieq.c
@@ -89,7 +90,7 @@ void
mieqEnqueue (e)
xEvent *e;
{
- HWEventQueueType oldtail, newtail, prevtail;
+ HWEventQueueType oldtail, newtail;
Bool isMotion;
oldtail = miEventQueue.tail;
@@ -139,7 +140,7 @@ mieqSwitchScreen (pScreen, fromDIX)
* Call this from ProcessInputEvents()
*/
-mieqProcessInputEvents ()
+void mieqProcessInputEvents ()
{
EventRec *e;
int x, y;
@@ -147,8 +148,6 @@ mieqProcessInputEvents ()
while (miEventQueue.head != miEventQueue.tail)
{
- extern int screenIsSaved;
-
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
diff --git a/mi/miexpose.c b/mi/miexpose.c
index cacb2f983..ca896b9e0 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.9 2001/12/14 20:00:22 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -64,7 +65,12 @@ SOFTWARE.
#include "mi.h"
#include "Xmd.h"
-extern WindowPtr *WindowTable;
+#include "globals.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
/*
machine-independent graphics exposure code. any device that uses
@@ -103,7 +109,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
int dstx, dsty;
unsigned long plane;
{
- register ScreenPtr pscr = pGC->pScreen;
+ register ScreenPtr pscr;
RegionPtr prgnSrcClip; /* drawable-relative source clip */
RegionRec rgnSrcRec;
RegionPtr prgnDstClip; /* drawable-relative dest clip */
@@ -120,6 +126,9 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
BoxRec expBox;
Bool extents;
+ /* This prevents warning about pscr not being used. */
+ pGC->pScreen = pscr = pGC->pScreen;
+
/* avoid work if we can */
if (!pGC->graphicsExposures &&
(pDstDrawable->type == DRAWABLE_PIXMAP) &&
@@ -388,6 +397,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
}
}
+
void
miSendExposures(pWin, pRgn, dx, dy)
WindowPtr pWin;
@@ -414,7 +424,40 @@ miSendExposures(pWin, pRgn, dx, dy)
pe->u.expose.height = pBox->y2 - pBox->y1;
pe->u.expose.count = i;
}
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ int scrnum = pWin->drawable.pScreen->myNum;
+ int x = 0, y = 0;
+ XID realWin = 0;
+
+ if(!pWin->parent) {
+ x = panoramiXdataPtr[scrnum].x;
+ y = panoramiXdataPtr[scrnum].y;
+ pWin = WindowTable[0];
+ realWin = pWin->drawable.id;
+ } else if (scrnum) {
+ PanoramiXRes *win;
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW,
+ pWin->drawable.id, scrnum);
+ if(!win) {
+ DEALLOCATE_LOCAL(pEvent);
+ return;
+ }
+ realWin = win->info[0].id;
+ pWin = LookupIDByType(realWin, RT_WINDOW);
+ }
+ if(x || y || scrnum)
+ for (i = 0; i < numRects; i++) {
+ pEvent[i].u.expose.window = realWin;
+ pEvent[i].u.expose.x += x;
+ pEvent[i].u.expose.y += y;
+ }
+ }
+#endif
+
DeliverEvents(pWin, pEvent, numRects, NullWindow);
+
DEALLOCATE_LOCAL(pEvent);
}
@@ -540,9 +583,9 @@ static GCPtr screenContext[MAXSCREENS];
/*ARGSUSED*/
static int
-tossGC (value, id)
-pointer value;
-XID id;
+tossGC (
+ pointer value,
+ XID id)
{
GCPtr pGC = (GCPtr)value;
screenContext[pGC->pScreen->myNum] = (GCPtr)NULL;
@@ -550,6 +593,8 @@ XID id;
numGCs--;
if (!numGCs)
ResType = 0;
+
+ return 0;
}
@@ -807,6 +852,7 @@ int what;
/* MICLEARDRAWABLE -- sets the entire drawable to the background color of
* the GC. Useful when we have a scratch drawable and need to initialize
* it. */
+void
miClearDrawable(pDraw, pGC)
DrawablePtr pDraw;
GCPtr pGC;
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 5889f1c06..a93b9e3a2 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.7 2001/12/14 20:00:22 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -137,11 +138,12 @@ miFillArcDSetup(arc, info)
}
static void
-miGetArcEdge(arc, edge, k, top, left)
- register xArc *arc;
- register miSliceEdgePtr edge;
- int k;
- Bool top, left;
+miGetArcEdge(
+ register xArc *arc,
+ register miSliceEdgePtr edge,
+ int k,
+ Bool top,
+ Bool left )
{
register int xady, y;
@@ -266,13 +268,14 @@ miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp)
}
static void
-miGetPieEdge(arc, angle, edge, top, left)
- register xArc *arc;
- register int angle;
- register miSliceEdgePtr edge;
- Bool top, left;
+miGetPieEdge(
+ register xArc *arc,
+ register int angle,
+ register miSliceEdgePtr edge,
+ Bool top,
+ Bool left )
{
- register int k, signdx, signdy;
+ register int k;
int dx, dy;
miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, 0, 0);
@@ -540,10 +543,10 @@ miFillArcSliceSetup(arc, slice, pGC)
}
static void
-miFillEllipseI(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillEllipseI(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
register int x, y, e;
int yk, xk, ym, xm, dx, dy, xorg, yorg;
@@ -583,10 +586,10 @@ miFillEllipseI(pDraw, pGC, arc)
}
static void
-miFillEllipseD(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillEllipseD(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
register int x, y;
int xorg, yorg, dx, dy, slw;
@@ -648,10 +651,10 @@ miFillEllipseD(pDraw, pGC, arc)
}
static void
-miFillArcSliceI(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillArcSliceI(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
register int x, y, e;
@@ -711,10 +714,10 @@ miFillArcSliceI(pDraw, pGC, arc)
}
static void
-miFillArcSliceD(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillArcSliceD(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
register int x, y;
int dx, dy, xorg, yorg, slw;
diff --git a/mi/mifillarc.h b/mi/mifillarc.h
index 63071bbd1..ed8503f15 100644
--- a/mi/mifillarc.h
+++ b/mi/mifillarc.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.7 2001/12/14 20:00:22 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -26,6 +27,9 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mifillarc.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */
+#ifndef __MIFILLARC_H__
+#define __MIFILLARC_H__
+
#define FULLCIRCLE (360 * 64)
typedef struct _miFillArc {
@@ -175,34 +179,25 @@ typedef struct _miArcSlice {
((slw > 1) || (ine != inxk)))
extern int miFreeArcCache(
-#if NeedFunctionPrototypes
pointer /*data*/,
XID /*id*/
-#endif
);
extern struct finalSpan *realAllocSpan(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void miFillArcSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miFillArcRec * /*info*/
-#endif
);
extern void miFillArcDSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miFillArcDRec * /*info*/
-#endif
);
extern void miEllipseAngleToSlope(
-#if NeedFunctionPrototypes
int /*angle*/,
int /*width*/,
int /*height*/,
@@ -210,14 +205,12 @@ extern void miEllipseAngleToSlope(
int * /*dyp*/,
double * /*d_dxp*/,
double * /*d_dyp*/
-#endif
);
extern void miFillArcSliceSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miArcSliceRec * /*slice*/,
GCPtr /*pGC*/
-#endif
);
+#endif /* __MIFILLARC_H__ */
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index af2f9429b..be2c58dfe 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifillrct.c,v 1.3 2001/12/14 20:00:22 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,7 +52,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmap.h"
-
+#include "mi.h"
#include "misc.h"
/* mi rectangles
diff --git a/mi/mifpoly.h b/mi/mifpoly.h
index bb923e2b6..837cf7b20 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -45,6 +45,10 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mi/mifpoly.h,v 1.4 2001/12/14 20:00:22 dawes Exp $ */
+
+#ifndef __MIFPOLY_H__
+#define __MIFPOLY_H__
#define EPSILON 0.000001
#define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON)
@@ -68,8 +72,7 @@ SOFTWARE.
#define ICEIL(x) ((int)ceil(x))
#else
#ifdef __GNUC__
-static __inline int ICEIL(x)
- double x;
+static __inline int ICEIL(double x)
{
int _cTmp = x;
return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
@@ -95,7 +98,6 @@ typedef struct _SppArc {
/* mifpolycon.c */
extern void miFillSppPoly(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*count*/,
@@ -104,5 +106,6 @@ extern void miFillSppPoly(
int /*yTrans*/,
double /*xFtrans*/,
double /*yFtrans*/
-#endif
);
+
+#endif /* __MIFPOLY_H__ */
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index 0b6655186..93999ea7d 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifpolycon.c,v 1.3 2001/12/14 20:00:23 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -52,7 +53,8 @@ SOFTWARE.
#include "pixmapstr.h"
#include "mifpoly.h"
-static int GetFPolyYBounds();
+static int GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans,
+ int *by, int *ty);
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
@@ -84,9 +86,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
meet the polygon exactly.
*/
{
- double xl, xr, /* x vals of left and right edges */
- ml, /* left edge slope */
- mr, /* right edge slope */
+ double xl = 0.0, xr = 0.0, /* x vals of left and right edges */
+ ml = 0.0, /* left edge slope */
+ mr = 0.0, /* right edge slope */
dy, /* delta y */
i; /* loop counter */
int y, /* current scanline */
@@ -161,8 +163,8 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
/* add a right edge if we need to */
if ((y > ptsIn[nextright].y + yFtrans) ||
- ISEQUAL(y, ptsIn[nextright].y + yFtrans)
- && Marked[nextright] != 1)
+ (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
+ && Marked[nextright] != 1))
{
Marked[nextright]++;
right = nextright--;
@@ -246,11 +248,12 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
* smallest and largest y */
static
int
-GetFPolyYBounds(pts, n, yFtrans, by, ty)
- register SppPointPtr pts;
- int n;
- double yFtrans;
- int *by, *ty;
+GetFPolyYBounds(
+ register SppPointPtr pts,
+ int n,
+ double yFtrans,
+ int *by,
+ int *ty)
{
register SppPointPtr ptMin;
double ymin, ymax;
diff --git a/mi/migc.c b/mi/migc.c
index 808347d22..29eec9749 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -27,6 +27,7 @@ from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/migc.c,v 1.9 2001/12/14 20:00:23 dawes Exp $ */
#include "scrnintstr.h"
#include "gcstruct.h"
@@ -34,15 +35,6 @@ from The Open Group.
#include "windowstr.h"
#include "migc.h"
-int miGCPrivateIndex;
-
-void
-miRegisterGCPrivateIndex(gcindex)
- int gcindex;
-{
- miGCPrivateIndex = gcindex;
-}
-
/* ARGSUSED */
void
miChangeGC(pGC, mask)
@@ -56,13 +48,10 @@ void
miDestroyGC(pGC)
GCPtr pGC;
{
- miPrivGC *pPriv;
-
- pPriv = (miPrivGC *) (pGC->devPrivates[miGCPrivateIndex].ptr);
- if (pPriv->pRotatedPixmap)
- (*pGC->pScreen->DestroyPixmap) (pPriv->pRotatedPixmap);
- if (pPriv->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pPriv->pCompositeClip);
+ if (pGC->pRotatedPixmap)
+ (*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
+ if (pGC->freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
miDestroyGCOps(pGC->ops);
}
@@ -75,7 +64,6 @@ miCreateGCOps(prototype)
GCOpsPtr prototype;
{
GCOpsPtr ret;
- extern Bool Must_have_memory;
/* XXX */ Must_have_memory = TRUE;
ret = (GCOpsPtr) xalloc(sizeof(GCOps));
@@ -188,8 +176,10 @@ miComputeCompositeClip(pGC, pDrawable)
GCPtr pGC;
DrawablePtr pDrawable;
{
- ScreenPtr pScreen = pGC->pScreen;
- miPrivGC *devPriv = (miPrivGC *) (pGC->devPrivates[miGCPrivateIndex].ptr);
+ ScreenPtr pScreen;
+
+ /* This prevents warnings about pScreen not being used. */
+ pGC->pScreen = pScreen = pGC->pScreen;
if (pDrawable->type == DRAWABLE_WINDOW)
{
@@ -207,7 +197,7 @@ miComputeCompositeClip(pGC, pDrawable)
pregWin = &pWin->clipList;
freeTmpClip = FALSE;
}
- freeCompClip = devPriv->freeCompClip;
+ freeCompClip = pGC->freeCompClip;
/*
* if there is no client clip, we can get by with just keeping the
@@ -219,9 +209,9 @@ miComputeCompositeClip(pGC, pDrawable)
if (pGC->clientClipType == CT_NONE)
{
if (freeCompClip)
- REGION_DESTROY(pScreen, devPriv->pCompositeClip);
- devPriv->pCompositeClip = pregWin;
- devPriv->freeCompClip = freeTmpClip;
+ REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
}
else
{
@@ -240,7 +230,7 @@ miComputeCompositeClip(pGC, pDrawable)
if (freeCompClip)
{
- REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
REGION_DESTROY(pScreen, pregWin);
@@ -248,15 +238,15 @@ miComputeCompositeClip(pGC, pDrawable)
else if (freeTmpClip)
{
REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
- devPriv->pCompositeClip = pregWin;
+ pGC->pCompositeClip = pregWin;
}
else
{
- devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
+ pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
- devPriv->freeCompClip = TRUE;
+ pGC->freeCompClip = TRUE;
REGION_TRANSLATE(pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
@@ -267,29 +257,41 @@ miComputeCompositeClip(pGC, pDrawable)
BoxRec pixbounds;
/* XXX should we translate by drawable.x/y here ? */
- pixbounds.x1 = 0;
- pixbounds.y1 = 0;
- pixbounds.x2 = pDrawable->width;
- pixbounds.y2 = pDrawable->height;
+ /* If you want pixmaps in offscreen memory, yes */
+ pixbounds.x1 = pDrawable->x;
+ pixbounds.y1 = pDrawable->y;
+ pixbounds.x2 = pDrawable->x + pDrawable->width;
+ pixbounds.y2 = pDrawable->y + pDrawable->height;
- if (devPriv->freeCompClip)
+ if (pGC->freeCompClip)
{
- REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds);
+ REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
}
else
{
- devPriv->freeCompClip = TRUE;
- devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ if(pDrawable->x || pDrawable->y) {
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ } else {
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
- devPriv->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
+ }
}
} /* end of composite clip for pixmap */
} /* end miComputeCompositeClip */
diff --git a/mi/migc.h b/mi/migc.h
index 9e9974c3e..8cb5a56c9 100644
--- a/mi/migc.h
+++ b/mi/migc.h
@@ -27,87 +27,48 @@ from The Open Group.
*/
-/* This structure has to line up with the mfb and cfb gc private structures so
- * that when it is superimposed on them, the three fields that migc.c needs to
- * see will be accessed correctly. I know this is not beautiful, but it seemed
- * better than all the code duplication in cfb and mfb.
- */
-typedef struct {
- unsigned char pad1;
- unsigned char pad2;
- unsigned char pad3;
- unsigned pad4:1;
- unsigned freeCompClip:1;
- PixmapPtr pRotatedPixmap;
- RegionPtr pCompositeClip;
-} miPrivGC;
-
-extern int miGCPrivateIndex;
-
-extern void miRegisterGCPrivateIndex(
-#if NeedFunctionPrototypes
- int /*gcindex*/
-#endif
-);
+/* $XFree86: xc/programs/Xserver/mi/migc.h,v 1.8 2001/12/14 20:00:23 dawes Exp $ */
extern void miChangeGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
unsigned long /*mask*/
-#endif
);
extern void miDestroyGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/
-#endif
);
extern GCOpsPtr miCreateGCOps(
-#if NeedFunctionPrototypes
GCOpsPtr /*prototype*/
-#endif
);
extern void miDestroyGCOps(
-#if NeedFunctionPrototypes
GCOpsPtr /*ops*/
-#endif
);
extern void miDestroyClip(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/
-#endif
);
extern void miChangeClip(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
int /*type*/,
pointer /*pvalue*/,
int /*nrects*/
-#endif
);
extern void miCopyClip(
-#if NeedFunctionPrototypes
GCPtr /*pgcDst*/,
GCPtr /*pgcSrc*/
-#endif
);
extern void miCopyGC(
-#if NeedFunctionPrototypes
GCPtr /*pGCSrc*/,
unsigned long /*changes*/,
GCPtr /*pGCDst*/
-#endif
);
extern void miComputeCompositeClip(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
DrawablePtr /*pDrawable*/
-#endif
);
diff --git a/mi/miglblt.c b/mi/miglblt.c
index 4a7a8eaeb..3e7e5da1b 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miglblt.c,v 1.6 2001/12/14 20:00:23 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -58,6 +59,7 @@ SOFTWARE.
#include "scrnintstr.h"
#include "pixmap.h"
#include "servermd.h"
+#include "mi.h"
/*
machine-independent glyph blt.
@@ -81,10 +83,10 @@ void
miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
- int x, y;
+ int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
- unsigned char *pglyphBase; /* start of array of glyphs */
+ pointer pglyphBase; /* start of array of glyphs */
{
int width, height;
PixmapPtr pPixmap;
@@ -194,10 +196,10 @@ void
miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
- int x, y;
+ int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
- unsigned char *pglyphBase; /* start of array of glyphs */
+ pointer pglyphBase; /* start of array of glyphs */
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
XID gcvals[3];
@@ -237,12 +239,13 @@ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DoChangeGC(pGC, GCForeground, gcvals, 0);
ValidateGC(pDrawable, pGC);
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci,
- (char *)pglyphBase);
+ pglyphBase);
/* put all the toys away when done playing */
gcvals[0] = oldAlu;
gcvals[1] = oldFG;
gcvals[2] = oldFS;
DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0);
+ ValidateGC(pDrawable, pGC);
}
diff --git a/mi/miinitext.c b/mi/miinitext.c
index c9ea7444c..ee63aa41b 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.68 2003/01/15 02:34:14 torrey Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -47,10 +48,19 @@ SOFTWARE.
/* $Xorg: miinitext.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
#include "misc.h"
+#include "extension.h"
+#include "micmap.h"
#ifdef NOPEXEXT /* sleaze for Solaris cpp building XsunMono */
#undef PEXEXT
#endif
+
+#if defined(QNX4) /* sleaze for Watcom on QNX4 ... */
+#undef PEXEXT
+#undef XIE
+#undef GLXEXT
+#endif
+
#ifdef PANORAMIX
extern Bool noPanoramiXExtension;
#endif
@@ -59,94 +69,176 @@ extern Bool noTestExtensions;
extern Bool noXkbExtension;
#endif
+#ifndef XFree86LOADER
+#define INITARGS void
+typedef void (*InitExtension)(INITARGS);
+#else /* XFree86Loader */
+#include "loaderProcs.h"
+#endif
+
+#ifdef MITSHM
+#define _XSHM_SERVER_
+#include "shmstr.h"
+#endif
+#ifdef XTEST
+#define _XTEST_SERVER_
+#include "XTest.h"
+#endif
+#ifdef XKB
+#include "XKB.h"
+#endif
+#ifdef LBX
+#define _XLBX_SERVER_
+#include "lbxstr.h"
+#endif
+#ifdef XPRINT
+#include "Print.h"
+#endif
+#ifdef XAPPGROUP
+#define _XAG_SERVER_
+#include "Xagstr.h"
+#endif
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "securstr.h"
+#endif
+#ifdef PANORAMIX
+#include "panoramiXproto.h"
+#endif
+#ifdef XF86BIGFONT
+#include "xf86bigfstr.h"
+#endif
+#ifdef RES
+#include "XResproto.h"
+#endif
+
+/* FIXME: this whole block of externs should be from the appropriate headers */
#ifdef BEZIER
-extern void BezierExtensionInit();
+extern void BezierExtensionInit(INITARGS);
#endif
#ifdef XTESTEXT1
-extern void XTestExtension1Init();
+extern void XTestExtension1Init(INITARGS);
#endif
#ifdef SHAPE
-extern void ShapeExtensionInit();
+extern void ShapeExtensionInit(INITARGS);
#endif
#ifdef EVI
-extern void EVIExtensionInit();
+extern void EVIExtensionInit(INITARGS);
#endif
#ifdef MITSHM
-extern void ShmExtensionInit();
+extern void ShmExtensionInit(INITARGS);
#endif
#ifdef PEXEXT
-extern void PexExtensionInit();
+extern void PexExtensionInit(INITARGS);
#endif
#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit();
+extern void MultibufferExtensionInit(INITARGS);
#endif
#ifdef PANORAMIX
-extern void PanoramiXExtensionInit();
+extern void PanoramiXExtensionInit(INITARGS);
#endif
#ifdef XINPUT
-extern void XInputExtensionInit();
+extern void XInputExtensionInit(INITARGS);
#endif
#ifdef XTEST
-extern void XTestExtensionInit();
+extern void XTestExtensionInit(INITARGS);
#endif
#ifdef BIGREQS
-extern void BigReqExtensionInit();
+extern void BigReqExtensionInit(INITARGS);
#endif
#ifdef MITMISC
-extern void MITMiscExtensionInit();
+extern void MITMiscExtensionInit(INITARGS);
#endif
#ifdef XIDLE
-extern void XIdleExtensionInit();
+extern void XIdleExtensionInit(INITARGS);
#endif
#ifdef XTRAP
-extern void DEC_XTRAPInit();
+extern void DEC_XTRAPInit(INITARGS);
#endif
#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit ();
+extern void ScreenSaverExtensionInit (INITARGS);
#endif
#ifdef XV
-extern void XvExtensionInit();
+extern void XvExtensionInit(INITARGS);
+extern void XvMCExtensionInit(INITARGS);
#endif
#ifdef XIE
-extern void XieInit();
+extern void XieInit(INITARGS);
#endif
#ifdef XSYNC
-extern void SyncExtensionInit();
+extern void SyncExtensionInit(INITARGS);
#endif
#ifdef XKB
-extern void XkbExtensionInit();
+extern void XkbExtensionInit(INITARGS);
#endif
#ifdef XCMISC
-extern void XCMiscExtensionInit();
+extern void XCMiscExtensionInit(INITARGS);
#endif
#ifdef XRECORD
-extern void XRecordExtensionInit();
+extern void RecordExtensionInit(INITARGS);
#endif
#ifdef LBX
-extern void LbxExtensionInit();
+extern void LbxExtensionInit(INITARGS);
#endif
#ifdef DBE
-extern void DbeExtensionInit();
+extern void DbeExtensionInit(INITARGS);
#endif
#ifdef XAPPGROUP
-extern void XagExtensionInit();
-#endif
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit();
+extern void XagExtensionInit(INITARGS);
#endif
#ifdef XCSECURITY
-extern void SecurityExtensionInit();
+extern void SecurityExtensionInit(INITARGS);
#endif
#ifdef XPRINT
-extern void XpExtensionInit();
+extern void XpExtensionInit(INITARGS);
+#endif
+#ifdef XF86BIGFONT
+extern void XFree86BigfontExtensionInit(INITARGS);
+#endif
+#ifdef XF86VIDMODE
+extern void XFree86VidModeExtensionInit(INITARGS);
+#endif
+#ifdef XF86MISC
+extern void XFree86MiscExtensionInit(INITARGS);
+#endif
+#ifdef XFreeXDGA
+extern void XFree86DGAExtensionInit(INITARGS);
+#endif
+#ifdef GLXEXT
+#ifndef __DARWIN__
+extern void GlxExtensionInit(INITARGS);
+extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+#else
+extern void DarwinGlxExtensionInit(INITARGS);
+extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *);
+#endif
+#endif
+#ifdef XF86DRI
+extern void XFree86DRIExtensionInit(INITARGS);
#endif
#ifdef TOGCUP
-extern void XcupExtensionInit();
+extern void XcupExtensionInit(INITARGS);
#endif
#ifdef DPMSExtension
-extern void DPMSExtensionInit();
+extern void DPMSExtensionInit(INITARGS);
+#endif
+#ifdef DPSEXT
+extern void DPSExtensionInit(INITARGS);
+#endif
+#ifdef FONTCACHE
+extern void FontCacheExtensionInit(INITARGS);
+#endif
+#ifdef RENDER
+extern void RenderExtensionInit(INITARGS);
+#endif
+#ifdef RANDR
+extern void RRExtensionInit(INITARGS);
+#endif
+#ifdef RES
+extern void ResExtensionInit(INITARGS);
#endif
+#ifndef XFree86LOADER
/*ARGSUSED*/
void
@@ -155,9 +247,9 @@ InitExtensions(argc, argv)
char *argv[];
{
#ifdef PANORAMIX
-#if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
+# if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
if (!noPanoramiXExtension) PanoramiXExtensionInit();
-#endif
+# endif
#endif
#ifdef BEZIER
BezierExtensionInit();
@@ -180,7 +272,7 @@ InitExtensions(argc, argv)
#ifdef MULTIBUFFER
MultibufferExtensionInit();
#endif
-#ifdef XINPUT
+#if defined(XINPUT) && !defined(NO_HW_ONLY_EXTS)
XInputExtensionInit();
#endif
#ifdef XTEST
@@ -203,6 +295,7 @@ InitExtensions(argc, argv)
#endif
#ifdef XV
XvExtensionInit();
+ XvMCExtensionInit();
#endif
#ifdef XIE
XieInit();
@@ -210,7 +303,7 @@ InitExtensions(argc, argv)
#ifdef XSYNC
SyncExtensionInit();
#endif
-#if defined(XKB) && !defined(PRINT_ONLY_SERVER)
+#if defined(XKB) && !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
if (!noXkbExtension) XkbExtensionInit();
#endif
#ifdef XCMISC
@@ -228,9 +321,6 @@ InitExtensions(argc, argv)
#ifdef XAPPGROUP
XagExtensionInit();
#endif
-#if defined(XF86VIDMODE) && !defined(PRINT_ONLY_SERVER)
- XFree86VidModeExtensionInit();
-#endif
#ifdef XCSECURITY
SecurityExtensionInit();
#endif
@@ -240,7 +330,224 @@ InitExtensions(argc, argv)
#ifdef TOGCUP
XcupExtensionInit();
#endif
-#if defined(DPMSExtension) && !defined(PRINT_ONLY_SERVER)
+#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
DPMSExtensionInit();
#endif
+#ifdef FONTCACHE
+ FontCacheExtensionInit();
+#endif
+#ifdef XF86BIGFONT
+ XFree86BigfontExtensionInit();
+#endif
+#if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
+#if defined(XF86VIDMODE)
+ XFree86VidModeExtensionInit();
+#endif
+#if defined(XF86MISC)
+ XFree86MiscExtensionInit();
+#endif
+#if defined(XFreeXDGA)
+ XFree86DGAExtensionInit();
+#endif
+#ifdef XF86DRI
+ XFree86DRIExtensionInit();
+#endif
+#endif
+#ifdef GLXEXT
+#ifndef XPRINT /* we don't want Glx in the Xprint server */
+#ifndef __DARWIN__
+ GlxExtensionInit();
+#else
+ DarwinGlxExtensionInit();
+#endif
+#endif
+#endif
+#ifdef DPSEXT
+#ifndef XPRINT
+ DPSExtensionInit();
+#endif
+#endif
+#ifdef RENDER
+ RenderExtensionInit();
+#endif
+#ifdef RANDR
+ RRExtensionInit();
+#endif
+#ifdef RES
+ ResExtensionInit();
+#endif
}
+
+void
+InitVisualWrap()
+{
+ miResetInitVisuals();
+#ifdef GLXEXT
+#ifndef XPRINT
+#ifndef __DARWIN__
+ GlxWrapInitVisuals(&miInitVisualsProc);
+#else
+ DarwinGlxWrapInitVisuals(&miInitVisualsProc);
+#endif
+#endif
+#endif
+}
+
+#else /* XFree86LOADER */
+#if 0
+/* FIXME:The names here must come from the headers. those with ?? are
+ not included in X11R6.3 sample implementation, so there's a problem... */
+/* XXX use the correct #ifdefs for symbols not present when an extension
+ is disabled */
+ExtensionModule extension[] =
+{
+ { NULL, "BEZIER", NULL, NULL }, /* ?? */
+ { NULL, "XTEST1", &noTestExtensions, NULL }, /* ?? */
+ { NULL, "SHAPE", NULL, NULL },
+ { NULL, "MIT-SHM", NULL, NULL },
+ { NULL, "X3D-PEX", NULL, NULL },
+ { NULL, "Multi-Buffering", NULL, NULL },
+ { NULL, "XInputExtension", NULL, NULL },
+ { NULL, "XTEST", &noTestExtensions, NULL },
+ { NULL, "BIG-REQUESTS", NULL, NULL },
+ { NULL, "MIT-SUNDRY-NONSTANDARD", NULL, NULL },
+ { NULL, "XIDLE", NULL, NULL }, /* ?? */
+ { NULL, "XTRAP", &noTestExtensions, NULL }, /* ?? */
+ { NULL, "MIT-SCREEN-SAVER", NULL, NULL },
+ { NULL, "XVideo", NULL, NULL }, /* ?? */
+ { NULL, "XIE", NULL, NULL },
+ { NULL, "SYNC", NULL, NULL },
+#ifdef XKB
+ { NULL, "XKEYBOARD", &noXkbExtension, NULL },
+#else
+ { NULL, "NOXKEYBOARD", NULL, NULL },
+#endif
+ { NULL, "XC-MISC", NULL, NULL },
+ { NULL, "RECORD", &noTestExtensions, NULL },
+ { NULL, "LBX", NULL, NULL },
+ { NULL, "DOUBLE-BUFFER", NULL, NULL },
+ { NULL, "XC-APPGROUP", NULL, NULL },
+ { NULL, "SECURITY", NULL, NULL },
+ { NULL, "XpExtension", NULL, NULL },
+ { NULL, "XFree86-VidModeExtension", NULL, NULL },
+ { NULL, "XFree86-Misc", NULL, NULL },
+ { NULL, "XFree86-DGA", NULL, NULL },
+ { NULL, "DPMS", NULL, NULL },
+ { NULL, "GLX", NULL, NULL },
+ { NULL, "TOG-CUP", NULL, NULL },
+ { NULL, "Extended-Visual-Information", NULL, NULL },
+#ifdef PANORAMIX
+ { NULL, "XINERAMA", &noPanoramiXExtension, NULL },
+#else
+ { NULL, "NOXINERAMA", NULL, NULL },
+#endif
+ { NULL, "XFree86-Bigfont", NULL, NULL },
+ { NULL, "XFree86-DRI", NULL, NULL },
+ { NULL, "Adobe-DPS-Extension", NULL, NULL },
+ { NULL, "FontCache", NULL, NULL },
+ { NULL, "RENDER", NULL, NULL },
+ { NULL, "RANDR", NULL, NULL },
+ { NULL, "X-Resource", NULL, NULL },
+ { NULL, NULL, NULL, NULL }
+};
+#endif
+
+/* List of built-in (statically linked) extensions */
+static ExtensionModule staticExtensions[] = {
+#ifdef BEZIER
+ { BezierExtensionInit, "BEZIER", NULL, NULL, NULL },
+#endif
+#ifdef XTESTEXT1
+ { XTestExtension1Init, "XTEST1", &noTestExtensions, NULL, NULL },
+#endif
+#ifdef MITSHM
+ { ShmExtensionInit, SHMNAME, NULL, NULL, NULL },
+#endif
+#ifdef XINPUT
+ { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
+#endif
+#ifdef XTEST
+ { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
+#endif
+#ifdef XIDLE
+ { XIdleExtensionInit, "XIDLE", NULL, NULL, NULL },
+#endif
+#ifdef XKB
+ { XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
+#endif
+#ifdef LBX
+ { LbxExtensionInit, LBXNAME, NULL, NULL, NULL },
+#endif
+#ifdef XAPPGROUP
+ { XagExtensionInit, XAGNAME, NULL, NULL, NULL },
+#endif
+#ifdef XCSECURITY
+ { SecurityExtensionInit, SECURITY_EXTENSION_NAME, NULL, NULL, NULL },
+#endif
+#ifdef XPRINT
+ { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
+#endif
+#ifdef PANORAMIX
+ { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
+#endif
+#ifdef XF86BIGFONT
+ { XFree86BigfontExtensionInit, XF86BIGFONTNAME, NULL, NULL, NULL },
+#endif
+#ifdef RENDER
+ { RenderExtensionInit, "RENDER", NULL, NULL, NULL },
+#endif
+#ifdef RANDR
+ { RRExtensionInit, "RANDR", NULL, NULL, NULL },
+#endif
+ { NULL, NULL, NULL, NULL, NULL }
+};
+
+/*ARGSUSED*/
+void
+InitExtensions(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int i;
+ ExtensionModule *ext;
+ static Bool listInitialised = FALSE;
+
+ if (!listInitialised) {
+ /* Add built-in extensions to the list. */
+ for (i = 0; staticExtensions[i].name; i++)
+ LoadExtension(&staticExtensions[i], TRUE);
+
+ /* Sort the extensions according the init dependencies. */
+ LoaderSortExtensions();
+ listInitialised = TRUE;
+ }
+
+ for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
+ ext = &ExtensionModuleList[i];
+ if (ext->initFunc != NULL &&
+ (ext->disablePtr == NULL ||
+ (ext->disablePtr != NULL && !*ext->disablePtr))) {
+ (ext->initFunc)();
+ }
+ }
+}
+
+static void (*__miHookInitVisualsFunction)(miInitVisualsProcPtr *);
+
+void
+InitVisualWrap()
+{
+ miResetInitVisuals();
+ if (__miHookInitVisualsFunction)
+ (*__miHookInitVisualsFunction)(&miInitVisualsProc);
+}
+
+void miHookInitVisuals(void (**old)(miInitVisualsProcPtr *),
+ void (*new)(miInitVisualsProcPtr *))
+{
+ if (old)
+ *old = __miHookInitVisualsFunction;
+ __miHookInitVisualsFunction = new;
+}
+
+#endif /* XFree86LOADER */
diff --git a/mi/miline.h b/mi/miline.h
index 329dea51e..8977550b3 100644
--- a/mi/miline.h
+++ b/mi/miline.h
@@ -25,9 +25,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.7 2001/12/14 20:00:24 dawes Exp $ */
#ifndef MILINE_H
+#include "screenint.h"
+
/*
* Public definitions used for configuring basic pixelization aspects
* of the sample implementation line-drawing routines provided in
@@ -76,10 +79,8 @@ in this Software without prior written authorization from The Open Group.
*/
extern void miSetZeroLineBias(
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */,
unsigned int /* bias */
-#endif
);
/*
@@ -101,6 +102,14 @@ extern void miSetZeroLineBias(
if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
+#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
+{\
+ if (x < xmin) outcode |= OUT_LEFT;\
+ if (x > xmax) outcode |= OUT_RIGHT;\
+ if (y < ymin) outcode |= OUT_ABOVE;\
+ if (y > ymax) outcode |= OUT_BELOW;\
+}
+
#define SWAPINT(i, j) \
{ register int _t = i; i = j; j = _t; }
@@ -144,7 +153,6 @@ extern void miSetZeroLineBias(
extern int miZeroLineScreenIndex;
extern int miZeroClipLine(
-#if NeedFunctionPrototypes
int /*xmin*/,
int /*ymin*/,
int /*xmax*/,
@@ -161,7 +169,6 @@ extern int miZeroClipLine(
unsigned int /*bias*/,
int /*oc1*/,
int /*oc2*/
-#endif
);
#endif /* MILINE_H */
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 8617861cd..58d93b80b 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -28,6 +28,7 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.10 2001/12/14 20:00:24 dawes Exp $ */
# define NEED_EVENTS
# include "X.h"
@@ -42,7 +43,7 @@ in this Software without prior written authorization from The Open Group.
# include "cursorstr.h"
# include "dixstruct.h"
-static int miPointerScreenIndex;
+int miPointerScreenIndex;
static unsigned long miPointerGeneration = 0;
#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr))
@@ -54,15 +55,17 @@ static unsigned long miPointerGeneration = 0;
static miPointerRec miPointer;
-static Bool miPointerRealizeCursor (), miPointerUnrealizeCursor ();
-static Bool miPointerDisplayCursor ();
-static void miPointerConstrainCursor (), miPointerPointerNonInterestBox();
-static void miPointerCursorLimits ();
-static Bool miPointerSetCursorPosition ();
-
-static Bool miPointerCloseScreen();
-
-static void miPointerMove ();
+static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miPointerUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miPointerDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static void miPointerConstrainCursor(ScreenPtr pScreen, BoxPtr pBox);
+static void miPointerPointerNonInterestBox(ScreenPtr pScreen, BoxPtr pBox);
+static void miPointerCursorLimits(ScreenPtr pScreen, CursorPtr pCursor,
+ BoxPtr pHotBox, BoxPtr pTopLeftBox);
+static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y,
+ Bool generateEvent);
+static Bool miPointerCloseScreen(int index, ScreenPtr pScreen);
+static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time);
Bool
miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
@@ -93,6 +96,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
if (!screenFuncs->NewEventScreen)
screenFuncs->NewEventScreen = mieqSwitchScreen;
pScreenPriv->waitForUpdate = waitForUpdate;
+ pScreenPriv->showTransparent = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miPointerCloseScreen;
pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv;
@@ -170,8 +174,6 @@ miPointerDisplayCursor (pScreen, pCursor)
ScreenPtr pScreen;
CursorPtr pCursor;
{
- SetupScreen(pScreen);
-
miPointer.pCursor = pCursor;
miPointer.pScreen = pScreen;
miPointerUpdate ();
@@ -249,7 +251,8 @@ miPointerWarpCursor (pScreen, x, y)
{
miPointer.devx = x;
miPointer.devy = y;
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
miPointer.x = x;
miPointer.y = y;
@@ -305,6 +308,7 @@ miPointerUpdate ()
{
ScreenPtr pScreen;
miPointerScreenPtr pScreenPriv;
+ CursorPtr pCursor;
int x, y, devx, devy;
pScreen = miPointer.pScreen;
@@ -346,8 +350,11 @@ miPointerUpdate ()
*/
else if (miPointer.pCursor != miPointer.pSpriteCursor)
{
- (*pScreenPriv->spriteFuncs->SetCursor)
- (pScreen, miPointer.pCursor, x, y);
+ pCursor = miPointer.pCursor;
+ if (pCursor->bits->emptyMask && !pScreenPriv->showTransparent)
+ pCursor = NullCursor;
+ (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, pCursor, x, y);
+
miPointer.devx = x;
miPointer.devy = y;
miPointer.pSpriteCursor = miPointer.pCursor;
@@ -356,7 +363,8 @@ miPointerUpdate ()
{
miPointer.devx = x;
miPointer.devy = y;
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
}
@@ -373,6 +381,26 @@ miPointerDeltaCursor (dx, dy, time)
miPointerAbsoluteCursor (miPointer.x + dx, miPointer.y + dy, time);
}
+void
+miPointerSetNewScreen(int screen_no, int x, int y)
+{
+ miPointerScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+
+ pScreen = screenInfo.screens[screen_no];
+ pScreenPriv = GetScreenPrivate (pScreen);
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE);
+ NewCurrentScreen (pScreen, x, y);
+ miPointer.limits.x2 = pScreen->width;
+ miPointer.limits.y2 = pScreen->height;
+}
+
+ScreenPtr
+miPointerCurrentScreen ()
+{
+ return (miPointer.pScreen);
+}
+
/*
* miPointerAbsoluteCursor. The pointer has moved to x,y
*/
@@ -451,7 +479,8 @@ miPointerMove (pScreen, x, y, time)
{
miPointer.devx = x;
miPointer.devy = y;
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
miPointer.x = x;
miPointer.y = y;
@@ -490,9 +519,21 @@ miPointerMove (pScreen, x, y, time)
}
void
+_miRegisterPointerDevice (pScreen, pDevice)
+ ScreenPtr pScreen;
+ DeviceIntPtr pDevice;
+{
+ miPointer.pPointer = (DevicePtr)pDevice;
+}
+
+/* obsolete: for binary compatibility */
+#ifdef miRegisterPointerDevice
+#undef miRegisterPointerDevice
+void
miRegisterPointerDevice (pScreen, pDevice)
ScreenPtr pScreen;
- DevicePtr pDevice;
+ DevicePtr pDevice;
{
miPointer.pPointer = pDevice;
}
+#endif /* miRegisterPointerDevice */
diff --git a/mi/mipointer.h b/mi/mipointer.h
index a2f74b07b..0486fc5a3 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -29,94 +29,134 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.9 2001/12/14 20:00:24 dawes Exp $ */
+
+#ifndef MIPOINTER_H
+#define MIPOINTER_H
+
+#include "cursor.h"
+#include "input.h"
typedef struct _miPointerSpriteFuncRec {
- Bool (*RealizeCursor)(); /* pScreen, pCursor */
- Bool (*UnrealizeCursor)(); /* pScreen, pCursor */
- void (*SetCursor)(); /* pScreen, pCursor, x, y */
- void (*MoveCursor)(); /* pScreen, x, y */
+ Bool (*RealizeCursor)(
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */
+ );
+ Bool (*UnrealizeCursor)(
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */
+ );
+ void (*SetCursor)(
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */,
+ int /* x */,
+ int /* y */
+ );
+ void (*MoveCursor)(
+ ScreenPtr /* pScr */,
+ int /* x */,
+ int /* y */
+ );
} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
typedef struct _miPointerScreenFuncRec {
- Bool (*CursorOffScreen)(); /* ppScreen, px, py */
- void (*CrossScreen)(); /* pScreen, entering */
- void (*WarpCursor)(); /* pScreen, x, y */
- void (*EnqueueEvent)(); /* xEvent */
- void (*NewEventScreen)(); /* pScreen */
+ Bool (*CursorOffScreen)(
+ ScreenPtr* /* ppScr */,
+ int* /* px */,
+ int* /* py */
+ );
+ void (*CrossScreen)(
+ ScreenPtr /* pScr */,
+ int /* entering */
+ );
+ void (*WarpCursor)(
+ ScreenPtr /* pScr */,
+ int /* x */,
+ int /* y */
+ );
+ void (*EnqueueEvent)(
+ xEventPtr /* event */
+ );
+ void (*NewEventScreen)(
+ ScreenPtr /* pScr */,
+ Bool /* fromDIX */
+ );
} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
extern Bool miDCInitialize(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
miPointerScreenFuncPtr /*screenFuncs*/
-#endif
);
extern Bool miPointerInitialize(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
miPointerSpriteFuncPtr /*spriteFuncs*/,
miPointerScreenFuncPtr /*screenFuncs*/,
Bool /*waitForUpdate*/
-#endif
);
extern void miPointerWarpCursor(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/
-#endif
);
extern int miPointerGetMotionBufferSize(
-#if NeedFunctionPrototypes
void
-#endif
);
extern int miPointerGetMotionEvents(
-#if NeedFunctionPrototypes
DeviceIntPtr /*pPtr*/,
xTimecoord * /*coords*/,
unsigned long /*start*/,
unsigned long /*stop*/,
ScreenPtr /*pScreen*/
-#endif
);
extern void miPointerUpdate(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void miPointerDeltaCursor(
-#if NeedFunctionPrototypes
int /*dx*/,
int /*dy*/,
unsigned long /*time*/
-#endif
);
extern void miPointerAbsoluteCursor(
-#if NeedFunctionPrototypes
int /*x*/,
int /*y*/,
unsigned long /*time*/
-#endif
);
extern void miPointerPosition(
-#if NeedFunctionPrototypes
int * /*x*/,
int * /*y*/
-#endif
);
+#undef miRegisterPointerDevice
extern void miRegisterPointerDevice(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
DevicePtr /*pDevice*/
-#endif
);
+
+extern void miPointerSetNewScreen(
+ int, /*screen_no*/
+ int, /*x*/
+ int /*y*/
+);
+extern ScreenPtr miPointerCurrentScreen(
+ void
+);
+
+#define miRegisterPointerDevice(pScreen,pDevice) \
+ _miRegisterPointerDevice(pScreen,pDevice)
+
+extern void _miRegisterPointerDevice(
+ ScreenPtr /*pScreen*/,
+ DeviceIntPtr /*pDevice*/
+);
+
+extern int miPointerScreenIndex;
+
+#endif /* MIPOINTER_H */
diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index 236079166..ab5372229 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -29,9 +29,10 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipointrst.h,v 1.4 2001/12/14 20:00:25 dawes Exp $ */
-# include <mipointer.h>
-# include <input.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
#define MOTION_SIZE 256
@@ -59,4 +60,5 @@ typedef struct {
miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */
CloseScreenProcPtr CloseScreen;
Bool waitForUpdate; /* don't move cursor in SIGIO */
+ Bool showTransparent; /* show empty cursors */
} miPointerScreenRec, *miPointerScreenPtr;
diff --git a/mi/mipoly.h b/mi/mipoly.h
index d946388a6..42d973477 100644
--- a/mi/mipoly.h
+++ b/mi/mipoly.h
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipoly.h,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/*
@@ -182,47 +183,35 @@ typedef struct _ScanLineListBlock {
/* mipolyutil.c */
extern Bool miInsertEdgeInET(
-#if NeedFunctionPrototypes
EdgeTable * /*ET*/,
EdgeTableEntry * /*ETE*/,
int /*scanline*/,
ScanLineListBlock ** /*SLLBlock*/,
int * /*iSLLBlock*/
-#endif
);
extern Bool miCreateETandAET(
-#if NeedFunctionPrototypes
int /*count*/,
DDXPointPtr /*pts*/,
EdgeTable * /*ET*/,
EdgeTableEntry * /*AET*/,
EdgeTableEntry * /*pETEs*/,
ScanLineListBlock * /*pSLLBlock*/
-#endif
);
extern void miloadAET(
-#if NeedFunctionPrototypes
EdgeTableEntry * /*AET*/,
EdgeTableEntry * /*ETEs*/
-#endif
);
extern void micomputeWAET(
-#if NeedFunctionPrototypes
EdgeTableEntry * /*AET*/
-#endif
);
extern int miInsertionSort(
-#if NeedFunctionPrototypes
EdgeTableEntry * /*AET*/
-#endif
);
extern void miFreeStorage(
-#if NeedFunctionPrototypes
ScanLineListBlock * /*pSLLBlock*/
-#endif
);
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
index 9daf44543..d99ed83d7 100644
--- a/mi/mipolycon.c
+++ b/mi/mipolycon.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolycon.c,v 1.4 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -45,11 +46,13 @@ SOFTWARE.
******************************************************************/
/* $Xorg: mipolycon.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
+
#include "gcstruct.h"
#include "pixmap.h"
+#include "mi.h"
#include "miscanfill.h"
-static int getPolyYBounds();
+static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty);
/*
* convexpoly.c
@@ -73,21 +76,21 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
int count; /* number of points */
DDXPointPtr ptsIn; /* the points */
{
- register int xl, xr; /* x vals of left and right edges */
- register int dl, dr; /* decision variables */
- register int ml, m1l; /* left edge slope and slope+1 */
- int mr, m1r; /* right edge slope and slope+1 */
- int incr1l, incr2l; /* left edge error increments */
- int incr1r, incr2r; /* right edge error increments */
- int dy; /* delta y */
- int y; /* current scanline */
- int left, right; /* indices to first endpoints */
- int i; /* loop counter */
- int nextleft, nextright; /* indices to second endpoints */
+ register int xl = 0, xr = 0; /* x vals of left and right edges */
+ register int dl = 0, dr = 0; /* decision variables */
+ register int ml = 0, m1l = 0;/* left edge slope and slope+1 */
+ int mr = 0, m1r = 0; /* right edge slope and slope+1 */
+ int incr1l = 0, incr2l = 0; /* left edge error increments */
+ int incr1r = 0, incr2r = 0; /* right edge error increments */
+ int dy; /* delta y */
+ int y; /* current scanline */
+ int left, right; /* indices to first endpoints */
+ int i; /* loop counter */
+ int nextleft, nextright; /* indices to second endpoints */
DDXPointPtr ptsOut, FirstPoint; /* output buffer */
- int *width, *FirstWidth; /* output buffer */
- int imin; /* index of smallest vertex (in y) */
- int ymin; /* y-extents of polygon */
+ int *width, *FirstWidth; /* output buffer */
+ int imin; /* index of smallest vertex (in y) */
+ int ymin; /* y-extents of polygon */
int ymax;
/*
@@ -213,12 +216,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
/*
* Find the index of the point with the smallest y.
*/
-static
-int
-getPolyYBounds(pts, n, by, ty)
- DDXPointPtr pts;
- int n;
- int *by, *ty;
+static int
+getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
{
register DDXPointPtr ptMin;
int ymin, ymax;
diff --git a/mi/mipolygen.c b/mi/mipolygen.c
index b9c0248c6..bbeb05dc3 100644
--- a/mi/mipolygen.c
+++ b/mi/mipolygen.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolygen.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "miscanfill.h"
#include "mipoly.h"
#include "pixmap.h"
+#include "mi.h"
/*
*
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 933e1cc3b..ed19f5f68 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolypnt.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "windowstr.h"
+#include "mi.h"
void
miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
diff --git a/mi/mipolyrect.c b/mi/mipolyrect.c
index 935203d9a..f6d170ef9 100644
--- a/mi/mipolyrect.c
+++ b/mi/mipolyrect.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolyrect.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "miscstruct.h"
#include "gcstruct.h"
#include "pixmap.h"
+#include "mi.h"
void
miPolyRectangle(pDraw, pGC, nrects, pRects)
diff --git a/mi/mipolyseg.c b/mi/mipolyseg.c
index 2500f7abb..82f2983e3 100644
--- a/mi/mipolyseg.c
+++ b/mi/mipolyseg.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolyseg.c,v 1.3 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "miscstruct.h"
#include "gcstruct.h"
#include "pixmap.h"
+#include "mi.h"
/*****************************************************************
* miPolySegment
diff --git a/mi/mipolytext.c b/mi/mipolytext.c
index 22dc6b2a9..9084fe180 100644
--- a/mi/mipolytext.c
+++ b/mi/mipolytext.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolytext.c,v 1.3 2001/12/14 20:00:26 dawes Exp $ */
/*******************************************************************
Copyright 1987, 1998 The Open Group
@@ -61,6 +62,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "fontstruct.h"
#include "dixfontstr.h"
+#include "mi.h"
int
miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding)
diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c
index 879bd6e1d..537ac6fb4 100644
--- a/mi/mipolyutil.c
+++ b/mi/mipolyutil.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.9 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -49,9 +50,7 @@ SOFTWARE.
#include "gc.h"
#include "miscanfill.h"
#include "mipoly.h"
-
-#define MAXINT 0x7fffffff
-#define MININT -MAXINT
+#include "misc.h" /* MAXINT */
/*
* fillUtils.c
diff --git a/mi/mipushpxl.c b/mi/mipushpxl.c
index 24ee8bbe3..462d93191 100644
--- a/mi/mipushpxl.c
+++ b/mi/mipushpxl.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.12 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,6 +52,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "miscstruct.h"
#include "../mfb/maskbits.h"
+#include "mi.h"
#define NPT 128
@@ -68,6 +70,11 @@ per scanline, scanline unit = 32 bits; later, this might mean
bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
*/
+
+/*
+ * in order to have both (MSB_FIRST and LSB_FIRST) versions of this
+ * in the server, we need to rename one of them
+ */
void
miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
GCPtr pGC;
@@ -75,21 +82,38 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
DrawablePtr pDrawable;
int dx, dy, xOrg, yOrg;
{
- int h, dxDiv32, ibEnd;
- unsigned long *pwLineStart;
- register unsigned long *pw, *pwEnd;
- register unsigned long msk;
+ int h, dxDivPPW, ibEnd;
+ MiBits *pwLineStart;
+ register MiBits *pw, *pwEnd;
+ register MiBits msk;
register int ib, w;
register int ipt; /* index into above arrays */
Bool fInBox;
DDXPointRec pt[NPT], ptThisLine;
int width[NPT];
+#ifdef XFree86Server
+ PixelType startmask;
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSSAMEORDER((MiBits)(-1) << 1);
+ else
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSSAMEORDER((MiBits)(-1) >> 1);
+ else
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSDIFFORDER((MiBits)(-1) << 1);
+ else
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
+#endif
- pwLineStart = (unsigned long *)xalloc(BitmapBytePad(dx));
+ pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx));
if (!pwLineStart)
return;
ipt = 0;
- dxDiv32 = dx/32;
+ dxDivPPW = dx/PPW;
for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0;
h < dy;
@@ -103,18 +127,22 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
/* Process all words which are fully in the pixmap */
fInBox = FALSE;
- pwEnd = pwLineStart + dxDiv32;
+ pwEnd = pwLineStart + dxDivPPW;
while(pw < pwEnd)
{
w = *pw;
- msk = endtab[1];
- for(ib = 0; ib < 32; ib++)
+#ifdef XFree86Server
+ msk = startmask;
+#else
+ msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
+#endif
+ for(ib = 0; ib < PPW; ib++)
{
if(w & msk)
{
if(!fInBox)
{
- pt[ipt].x = ((pw - pwLineStart) << 5) + ib + xOrg;
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
pt[ipt].y = h + yOrg;
/* start new box */
fInBox = TRUE;
@@ -124,7 +152,7 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
{
if(fInBox)
{
- width[ipt] = ((pw - pwLineStart) << 5) +
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
ib + xOrg - pt[ipt].x;
if (++ipt >= NPT)
{
@@ -136,16 +164,34 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
fInBox = FALSE;
}
}
+#ifdef XFree86Server
+ /* This is not quite right, but it'll do for now */
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
+ else
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
+ else
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
+ else
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
msk = SCRRIGHT(msk, 1);
+#endif
}
pw++;
}
- ibEnd = dx & 0x1F;
+ ibEnd = dx & PIM;
if(ibEnd)
{
/* Process final partial word on line */
w = *pw;
- msk = endtab[1];
+#ifdef XFree86Server
+ msk = startmask;
+#else
+ msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
+#endif
for(ib = 0; ib < ibEnd; ib++)
{
if(w & msk)
@@ -153,7 +199,7 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
if(!fInBox)
{
/* start new box */
- pt[ipt].x = ((pw - pwLineStart) << 5) + ib + xOrg;
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
pt[ipt].y = h + yOrg;
fInBox = TRUE;
}
@@ -163,7 +209,7 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
if(fInBox)
{
/* end box */
- width[ipt] = ((pw - pwLineStart) << 5) +
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
ib + xOrg - pt[ipt].x;
if (++ipt >= NPT)
{
@@ -174,7 +220,21 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
fInBox = FALSE;
}
}
+#ifdef XFree86Server
+ /* This is not quite right, but it'll do for now */
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
+ else
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
+ else
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
+ else
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
msk = SCRRIGHT(msk, 1);
+#endif
}
}
/* If scanline ended with last bit set, end the box */
diff --git a/mi/miregion.c b/mi/miregion.c
index f9c25b09d..9a40e7757 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.8 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1988, 1989, 1998 The Open Group
@@ -47,11 +48,34 @@ SOFTWARE.
******************************************************************/
/* $Xorg: miregion.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
-#include <stdio.h>
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
#include "miscstruct.h"
#include "regionstr.h"
#include "Xprotostr.h"
#include "gc.h"
+#include "mi.h"
+#include "mispans.h"
#if defined (__GNUC__) && !defined (NO_INLINES)
#define INLINE __inline
@@ -59,12 +83,7 @@ SOFTWARE.
#define INLINE
#endif
-/*
- * hack until callers of these functions can deal with out-of-memory
- */
-
-extern Bool Must_have_memory;
-
+#undef assert
#ifdef DEBUG
#define assert(expr) {if (!(expr)) \
FatalError("Assertion failed file %s, line %d: expr\n", \
@@ -146,9 +165,13 @@ extern Bool Must_have_memory;
#define xallocData(n) (RegDataPtr)xalloc(REGION_SZOF(n))
#define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data)
+#define RECTALLOC_BAIL(pReg,n,bail) \
+if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
+ if (!miRectAlloc(pReg, n)) { goto bail; }
+
#define RECTALLOC(pReg,n) \
if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
- miRectAlloc(pReg, n)
+ if (!miRectAlloc(pReg, n)) { return FALSE; }
#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \
{ \
@@ -163,7 +186,8 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
{ \
if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
{ \
- miRectAlloc(pReg, 1); \
+ if (!miRectAlloc(pReg, 1)) \
+ return FALSE; \
pNextRect = REGION_TOP(pReg); \
} \
ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \
@@ -188,6 +212,9 @@ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
BoxRec miEmptyBox = {0, 0, 0, 0};
RegDataRec miEmptyData = {0, 0};
+RegDataRec miBrokenData = {0, 0};
+RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
+
#ifdef DEBUG
int
miPrintRegion(rgn)
@@ -298,9 +325,9 @@ miRegionCreate(rect, size)
{
register RegionPtr pReg;
- Must_have_memory = TRUE; /* XXX */
pReg = (RegionPtr)xalloc(sizeof(RegionRec));
- Must_have_memory = FALSE; /* XXX */
+ if (!pReg)
+ return &miBrokenRegion;
if (rect)
{
pReg->extents = *rect;
@@ -355,7 +382,8 @@ miRegionDestroy(pReg)
{
good(pReg);
xfreeData(pReg);
- xfree(pReg);
+ if (pReg != &miBrokenRegion)
+ xfree(pReg);
}
void
@@ -367,21 +395,36 @@ miRegionUninit(pReg)
}
Bool
-miRectAlloc(pRgn, n)
- register RegionPtr pRgn;
- int n;
+miRegionBreak (pReg)
+ RegionPtr pReg;
{
- Must_have_memory = TRUE; /* XXX */
+ xfreeData (pReg);
+ pReg->extents = miEmptyBox;
+ pReg->data = &miBrokenData;
+ return FALSE;
+}
+
+Bool
+miRectAlloc(
+ register RegionPtr pRgn,
+ int n)
+{
+ RegDataPtr data;
+
if (!pRgn->data)
{
n++;
pRgn->data = xallocData(n);
+ if (!pRgn->data)
+ return miRegionBreak (pRgn);
pRgn->data->numRects = 1;
*REGION_BOXPTR(pRgn) = pRgn->extents;
}
else if (!pRgn->data->size)
{
pRgn->data = xallocData(n);
+ if (!pRgn->data)
+ return miRegionBreak (pRgn);
pRgn->data->numRects = 0;
}
else
@@ -393,9 +436,11 @@ miRectAlloc(pRgn, n)
n = 250;
}
n += pRgn->data->numRects;
- pRgn->data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n));
+ data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n));
+ if (!data)
+ return miRegionBreak (pRgn);
+ pRgn->data = data;
}
- Must_have_memory = FALSE; /* XXX */
pRgn->data->size = n;
return TRUE;
}
@@ -419,9 +464,9 @@ miRegionCopy(dst, src)
if (!dst->data || (dst->data->size < src->data->numRects))
{
xfreeData(dst);
- Must_have_memory = TRUE; /* XXX */
dst->data = xallocData(src->data->numRects);
- Must_have_memory = FALSE; /* XXX */
+ if (!dst->data)
+ return miRegionBreak (dst);
dst->data->size = src->data->numRects;
}
dst->data->numRects = src->data->numRects;
@@ -454,10 +499,10 @@ miRegionCopy(dst, src)
*-----------------------------------------------------------------------
*/
INLINE static int
-miCoalesce (pReg, prevStart, curStart)
- register RegionPtr pReg; /* Region to coalesce */
- int prevStart; /* Index of start of previous band */
- int curStart; /* Index of start of current band */
+miCoalesce (
+ register RegionPtr pReg, /* Region to coalesce */
+ int prevStart, /* Index of start of previous band */
+ int curStart) /* Index of start of current band */
{
register BoxPtr pPrevBox; /* Current box in previous band */
register BoxPtr pCurBox; /* Current box in current band */
@@ -538,12 +583,12 @@ miCoalesce (pReg, prevStart, curStart)
*/
INLINE static Bool
-miAppendNonO (pReg, r, rEnd, y1, y2)
- register RegionPtr pReg;
- register BoxPtr r;
- BoxPtr rEnd;
- register int y1;
- register int y2;
+miAppendNonO (
+ register RegionPtr pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register int y1,
+ register int y2)
{
register BoxPtr pNextRect;
register int newRects;
@@ -578,7 +623,7 @@ miAppendNonO (pReg, r, rEnd, y1, y2)
#define AppendRegions(newReg, r, rEnd) \
{ \
int newRects; \
- if (newRects = rEnd - r) { \
+ if ((newRects = rEnd - r)) { \
RECTALLOC(newReg, newRects); \
memmove((char *)REGION_TOP(newReg),(char *)r, \
newRects * sizeof(BoxRec)); \
@@ -614,18 +659,29 @@ miAppendNonO (pReg, r, rEnd, y1, y2)
*
*-----------------------------------------------------------------------
*/
+
+typedef Bool (*OverlapProcPtr)(
+ RegionPtr pReg,
+ BoxPtr r1,
+ BoxPtr r1End,
+ BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap);
+
static Bool
-miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
- RegionPtr newReg; /* Place to store result */
- RegionPtr reg1; /* First region in operation */
- RegionPtr reg2; /* 2d region in operation */
- Bool (*overlapFunc)(); /* Function to call for over-
+miRegionOp(
+ RegionPtr newReg, /* Place to store result */
+ RegionPtr reg1, /* First region in operation */
+ RegionPtr reg2, /* 2d region in operation */
+ OverlapProcPtr overlapFunc, /* Function to call for over-
* lapping bands */
- Bool appendNon1; /* Append non-overlapping bands */
+ Bool appendNon1, /* Append non-overlapping bands */
/* in region 1 ? */
- Bool appendNon2; /* Append non-overlapping bands */
+ Bool appendNon2, /* Append non-overlapping bands */
/* in region 2 ? */
- Bool *pOverlap;
+ Bool *pOverlap)
{
register BoxPtr r1; /* Pointer into first region */
register BoxPtr r2; /* Pointer into 2d region */
@@ -648,6 +704,12 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
int numRects;
/*
+ * Break any region computed from a broken region
+ */
+ if (REGION_NAR (reg1) || REGION_NAR(reg2))
+ return miRegionBreak (newReg);
+
+ /*
* Initialization:
* set r1, r2, r1End and r2End appropriately, save the rectangles
* of the destination region until the end in case it's one of
@@ -680,7 +742,8 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
else if (newReg->data->size)
newReg->data->numRects = 0;
if (newSize > newReg->data->size)
- miRectAlloc(newReg, newSize);
+ if (!miRectAlloc(newReg, newSize))
+ return FALSE;
/*
* Initialize ybot.
@@ -902,15 +965,15 @@ miSetExtents (pReg)
*/
/*ARGSUSED*/
static Bool
-miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
- register RegionPtr pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- short y1;
- short y2;
- Bool *pOverlap;
+miIntersectO (
+ register RegionPtr pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap)
{
register int x1;
register int x2;
@@ -966,7 +1029,13 @@ miIntersect(newReg, reg1, reg2)
xfreeData(newReg);
newReg->extents.x2 = newReg->extents.x1;
newReg->extents.y2 = newReg->extents.y1;
- newReg->data = &miEmptyData;
+ if (REGION_NAR(reg1) || REGION_NAR(reg2))
+ {
+ newReg->data = &miBrokenData;
+ return FALSE;
+ }
+ else
+ newReg->data = &miEmptyData;
}
else if (!reg1->data && !reg2->data)
{
@@ -1039,15 +1108,15 @@ miIntersect(newReg, reg1, reg2)
*-----------------------------------------------------------------------
*/
static Bool
-miUnionO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
- register RegionPtr pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- short y1;
- short y2;
- Bool *pOverlap;
+miUnionO (
+ register RegionPtr pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap)
{
register BoxPtr pNextRect;
register int x1; /* left and right side of current union */
@@ -1125,6 +1194,8 @@ miUnion(newReg, reg1, reg2)
*/
if (REGION_NIL(reg1))
{
+ if (REGION_NAR(reg1))
+ return miRegionBreak (newReg);
if (newReg != reg2)
return miRegionCopy(newReg, reg2);
return TRUE;
@@ -1135,6 +1206,8 @@ miUnion(newReg, reg1, reg2)
*/
if (REGION_NIL(reg2))
{
+ if (REGION_NAR(reg2))
+ return miRegionBreak (newReg);
if (newReg != reg1)
return miRegionCopy(newReg, reg1);
return TRUE;
@@ -1202,6 +1275,9 @@ miRegionAppend(dstrgn, rgn)
BoxPtr new, old;
Bool prepend;
+ if (REGION_NAR(rgn))
+ return miRegionBreak (dstrgn);
+
if (!rgn->data && (dstrgn->data == &miEmptyData))
{
dstrgn->extents = rgn->extents;
@@ -1286,9 +1362,9 @@ miRegionAppend(dstrgn, rgn)
}
static void
-QuickSortRects(rects, numRects)
- register BoxRec rects[];
- register int numRects;
+QuickSortRects(
+ register BoxRec rects[],
+ register int numRects)
{
register int y1;
register int x1;
@@ -1399,6 +1475,7 @@ miRegionValidate(badreg, pOverlap)
register BoxPtr box; /* Current box in rects */
register BoxPtr riBox; /* Last box in ri[j].reg */
register RegionPtr hreg; /* ri[j_half].reg */
+ Bool ret = TRUE;
*pOverlap = FALSE;
if (!badreg->data)
@@ -1409,6 +1486,8 @@ miRegionValidate(badreg, pOverlap)
numRects = badreg->data->numRects;
if (!numRects)
{
+ if (REGION_NAR(badreg))
+ return FALSE;
good(badreg);
return TRUE;
}
@@ -1434,9 +1513,9 @@ miRegionValidate(badreg, pOverlap)
/* Set up the first region to be the first rectangle in badreg */
/* Note that step 2 code will never overflow the ri[0].reg rects array */
- Must_have_memory = TRUE; /* XXX */
ri = (RegionInfo *) xalloc(4 * sizeof(RegionInfo));
- Must_have_memory = FALSE; /* XXX */
+ if (!ri)
+ return miRegionBreak (badreg);
sizeRI = 4;
numRI = 1;
ri[0].prevBand = 0;
@@ -1472,7 +1551,7 @@ miRegionValidate(badreg, pOverlap)
}
else
{
- RECTALLOC(reg, 1);
+ RECTALLOC_BAIL(reg, 1, bail);
*REGION_TOP(reg) = *box;
reg->data->numRects++;
}
@@ -1485,7 +1564,7 @@ miRegionValidate(badreg, pOverlap)
if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1;
Coalesce(reg, rit->prevBand, rit->curBand);
rit->curBand = reg->data->numRects;
- RECTALLOC(reg, 1);
+ RECTALLOC_BAIL(reg, 1, bail);
*REGION_TOP(reg) = *box;
reg->data->numRects++;
goto NextRect;
@@ -1498,9 +1577,10 @@ miRegionValidate(badreg, pOverlap)
{
/* Oops, allocate space for new region information */
sizeRI <<= 1;
- Must_have_memory = TRUE; /* XXX */
- ri = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo));
- Must_have_memory = FALSE; /* XXX */
+ rit = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo));
+ if (!rit)
+ goto bail;
+ ri = rit;
rit = &ri[numRI];
}
numRI++;
@@ -1508,7 +1588,8 @@ miRegionValidate(badreg, pOverlap)
rit->curBand = 0;
rit->reg.extents = *box;
rit->reg.data = (RegDataPtr)NULL;
- miRectAlloc(&rit->reg, (i+numRI) / numRI); /* MUST force allocation */
+ if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
+ goto bail;
NextRect: ;
} /* for i */
@@ -1537,7 +1618,8 @@ NextRect: ;
{
reg = &ri[j].reg;
hreg = &ri[j+half].reg;
- miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap);
+ if (!miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap))
+ ret = FALSE;
if (hreg->extents.x1 < reg->extents.x1)
reg->extents.x1 = hreg->extents.x1;
if (hreg->extents.y1 < reg->extents.y1)
@@ -1553,7 +1635,12 @@ NextRect: ;
*badreg = ri[0].reg;
xfree(ri);
good(badreg);
- return TRUE;
+ return ret;
+bail:
+ for (i = 0; i < numRI; i++)
+ xfreeData(&ri[i].reg);
+ xfree (ri);
+ return miRegionBreak (badreg);
}
RegionPtr
@@ -1569,6 +1656,8 @@ miRectsToRegion(nrects, prect, ctype)
int x1, y1, x2, y2;
pRgn = miRegionCreate(NullBox, 0);
+ if (REGION_NAR (pRgn))
+ return pRgn;
if (!nrects)
return pRgn;
if (nrects == 1)
@@ -1589,10 +1678,13 @@ miRectsToRegion(nrects, prect, ctype)
}
return pRgn;
}
- Must_have_memory = TRUE; /* XXX */
pData = xallocData(nrects);
+ if (!pData)
+ {
+ miRegionBreak (pRgn);
+ return pRgn;
+ }
pBox = (BoxPtr) (pData + 1);
- Must_have_memory = FALSE; /* XXX */
for (i = nrects; --i >= 0; prect++)
{
x1 = prect->x;
@@ -1653,15 +1745,15 @@ miRectsToRegion(nrects, prect, ctype)
*/
/*ARGSUSED*/
static Bool
-miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
- register RegionPtr pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- register int y1;
- int y2;
- Bool *pOverlap;
+miSubtractO (
+ register RegionPtr pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register short y1,
+ short y2,
+ Bool *pOverlap)
{
register BoxPtr pNextRect;
register int x1;
@@ -1791,6 +1883,8 @@ miSubtract(regD, regM, regS)
if (REGION_NIL(regM) || REGION_NIL(regS) ||
!EXTENTCHECK(&regM->extents, &regS->extents))
{
+ if (REGION_NAR (regS))
+ return miRegionBreak (regD);
return miRegionCopy(regD, regM);
}
else if (regM == regS)
@@ -1854,6 +1948,8 @@ miInverse(newReg, reg1, invRect)
/* check for trivial rejects */
if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, &reg1->extents))
{
+ if (REGION_NAR(reg1))
+ return miRegionBreak (newReg);
newReg->extents = *invRect;
xfreeData(newReg);
newReg->data = (RegDataPtr)NULL;
@@ -2078,6 +2174,35 @@ miTranslateRegion(pReg, x, y)
}
}
+Bool
+miRegionDataCopy(
+ register RegionPtr dst,
+ register RegionPtr src)
+{
+ good(dst);
+ good(src);
+ if (dst->data)
+ return TRUE;
+ if (dst == src)
+ return TRUE;
+ if (!src->data || !src->data->size)
+ {
+ xfreeData(dst);
+ dst->data = (RegDataPtr)NULL;
+ return TRUE;
+ }
+ if (!dst->data || (dst->data->size < src->data->numRects))
+ {
+ xfreeData(dst);
+ dst->data = xallocData(src->data->numRects);
+ if (!dst->data)
+ return miRegionBreak (dst);
+ }
+ dst->data->size = src->data->size;
+ dst->data->numRects = src->data->numRects;
+ return TRUE;
+}
+
void
miRegionReset(pReg, pBox)
RegionPtr pReg;
@@ -2133,6 +2258,12 @@ miRegionNotEmpty(pReg)
return(!REGION_NIL(pReg));
}
+Bool
+miRegionBroken(RegionPtr pReg)
+{
+ good(pReg);
+ return (REGION_NAR(pReg));
+}
void
miRegionEmpty(pReg)
@@ -2167,10 +2298,10 @@ miRegionExtents(pReg)
so forget it.
*/
-static void QuickSortSpans(spans, widths, numSpans)
- register DDXPointRec spans[];
- register int widths[];
- register int numSpans;
+static void QuickSortSpans(
+ register DDXPointRec spans[],
+ register int widths[],
+ register int numSpans)
{
register int y;
register int i, j, m;
@@ -2272,14 +2403,14 @@ static void QuickSortSpans(spans, widths, numSpans)
*/
int
-miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwidthNew, fSorted)
- RegionPtr prgnDst;
- register DDXPointPtr ppt;
- register int *pwidth;
- int nspans;
- register DDXPointPtr pptNew;
- int *pwidthNew;
- int fSorted;
+miClipSpans(
+ RegionPtr prgnDst,
+ register DDXPointPtr ppt,
+ register int *pwidth,
+ int nspans,
+ register DDXPointPtr pptNew,
+ int *pwidthNew,
+ int fSorted)
{
register DDXPointPtr pptLast;
int *pwidthNewStart; /* the vengeance of Xerox! */
@@ -2325,7 +2456,7 @@ miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwidthNew, fSorted)
} /* end for */
}
- else if (numRects = prgnDst->data->numRects)
+ else if ((numRects = prgnDst->data->numRects))
{
/* Have to clip against many boxes */
BoxPtr pboxBandStart, pboxBandEnd;
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 1561c1844..ee199d24d 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.15 2001/12/14 20:00:26 dawes Exp $ */
#include "X.h"
#include "servermd.h"
@@ -33,9 +34,12 @@ from The Open Group.
#include "mi.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
-#include "mibstore.h"
#include "dix.h"
#include "miline.h"
+#ifdef MITSHM
+#define _XSHM_SERVER_
+#include "XShm.h"
+#endif
/* We use this structure to propogate some information from miScreenInit to
* miCreateScreenResources. miScreenInit allocates the structure, fills it
@@ -67,25 +71,64 @@ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind,
{
if (!pPixmap)
return FALSE;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = devKind;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = pPixData;
+
+ /*
+ * If all arguments are specified, reinitialize everything (including
+ * validated state).
+ */
+ if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
+ (devKind > 0) && pPixData) {
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = devKind;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = pPixData;
+ } else {
+ /*
+ * Only modify specified fields, keeping all others intact.
+ */
+
+ if (width > 0)
+ pPixmap->drawable.width = width;
+
+ if (height > 0)
+ pPixmap->drawable.height = height;
+
+ if (depth > 0)
+ pPixmap->drawable.depth = depth;
+
+ if (bitsPerPixel > 0)
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ else if ((bitsPerPixel < 0) && (depth > 0))
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
+
+ /*
+ * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for
+ * other purposes.
+ */
+ if (devKind > 0)
+ pPixmap->devKind = devKind;
+ else if ((devKind < 0) && ((width > 0) || (depth > 0)))
+ pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width,
+ pPixmap->drawable.depth);
+
+ if (pPixData)
+ pPixmap->devPrivate.ptr = pPixData;
+ }
return TRUE;
}
/*ARGSUSED*/
Bool
-miCloseScreen (index, pScreen)
- int index;
+miCloseScreen (iScreen, pScreen)
+ int iScreen;
ScreenPtr pScreen;
{
return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate));
@@ -122,7 +165,8 @@ miCreateScreenResources(pScreen)
return FALSE;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
- pScreen->height, pScreen->rootDepth, pScreen->rootDepth,
+ pScreen->height, pScreen->rootDepth,
+ BitsPerPixel(pScreen->rootDepth),
PixmapBytePad(pScrInitParms->width, pScreen->rootDepth),
pScrInitParms->pbits))
return FALSE;
@@ -158,16 +202,9 @@ miScreenDevPrivateInit(pScreen, width, pbits)
return TRUE;
}
-/*
- * If you pass in bsfuncs, then you must preinitialize the missing
- * screen procs before calling miScreenInit, so that the backing store
- * code can correctly wrap them.
- */
-
Bool
miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootDepth, numDepths, depths, rootVisual, numVisuals, visuals,
- bsfuncs)
+ rootDepth, numDepths, depths, rootVisual, numVisuals, visuals)
register ScreenPtr pScreen;
pointer pbits; /* pointer to screen bits */
int xsize, ysize; /* in pixels */
@@ -179,7 +216,6 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
VisualID rootVisual; /* root visual */
int numVisuals; /* number of visuals supported */
VisualRec *visuals; /* supported visuals */
- miBSFuncPtr bsfuncs; /* backing store functions */
{
pScreen->width = xsize;
pScreen->height = ysize;
@@ -192,11 +228,13 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
/* defColormap */
pScreen->minInstalledCmaps = 1;
pScreen->maxInstalledCmaps = 1;
- pScreen->backingStoreSupport = Always;
+ pScreen->backingStoreSupport = NotUseful;
pScreen->saveUnderSupport = NotUseful;
/* whitePixel, blackPixel */
pScreen->ModifyPixmapHeader = miModifyPixmapHeader;
pScreen->CreateScreenResources = miCreateScreenResources;
+ pScreen->GetScreenPixmap = miGetScreenPixmap;
+ pScreen->SetScreenPixmap = miSetScreenPixmap;
pScreen->numVisuals = numVisuals;
pScreen->visuals = visuals;
if (width)
@@ -208,21 +246,23 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
}
/* else CloseScreen */
/* QueryBestSize, SaveScreen, GetImage, GetSpans */
- pScreen->PointerNonInterestBox = (void (*)()) 0;
- pScreen->SourceValidate = (void (*)()) 0;
+ pScreen->PointerNonInterestBox = (PointerNonInterestBoxProcPtr) 0;
+ pScreen->SourceValidate = (SourceValidateProcPtr) 0;
/* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
/* RealizeWindow, UnrealizeWindow */
pScreen->ValidateTree = miValidateTree;
- pScreen->PostValidateTree = (void (*)()) 0;
+ pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
pScreen->WindowExposures = miWindowExposures;
/* PaintWindowBackground, PaintWindowBorder, CopyWindow */
pScreen->ClearToBackground = miClearToBackground;
- pScreen->ClipNotify = (void (*)()) 0;
+ pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
+ pScreen->RestackWindow = (RestackWindowProcPtr) 0;
/* CreatePixmap, DestroyPixmap */
/* RealizeFont, UnrealizeFont */
/* CreateGC */
/* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */
/* ListInstalledColormaps, StoreColors, ResolveColor */
+#ifdef NEED_SCREEN_REGIONS
pScreen->RegionCreate = miRegionCreate;
pScreen->RegionInit = miRegionInit;
pScreen->RegionCopy = miRegionCopy;
@@ -237,19 +277,22 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
pScreen->RectIn = miRectIn;
pScreen->PointInRegion = miPointInRegion;
pScreen->RegionNotEmpty = miRegionNotEmpty;
+ pScreen->RegionBroken = miRegionBroken;
+ pScreen->RegionBreak = miRegionBreak;
pScreen->RegionEmpty = miRegionEmpty;
pScreen->RegionExtents = miRegionExtents;
pScreen->RegionAppend = miRegionAppend;
pScreen->RegionValidate = miRegionValidate;
+#endif /* NEED_SCREEN_REGIONS */
/* BitmapToRegion */
+#ifdef NEED_SCREEN_REGIONS
pScreen->RectsToRegion = miRectsToRegion;
+#endif /* NEED_SCREEN_REGIONS */
pScreen->SendGraphicsExpose = miSendGraphicsExpose;
- pScreen->BlockHandler = (void (*)())NoopDDA;
- pScreen->WakeupHandler = (void (*)())NoopDDA;
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
pScreen->blockData = (pointer)0;
pScreen->wakeupData = (pointer)0;
- if (bsfuncs)
- miInitializeBackingStore (pScreen, bsfuncs);
pScreen->MarkWindow = miMarkWindow;
pScreen->MarkOverlappedWindows = miMarkOverlappedWindows;
pScreen->ChangeSaveUnder = miChangeSaveUnder;
@@ -258,20 +301,41 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
pScreen->ResizeWindow = miSlideAndSizeWindow;
pScreen->GetLayerWindow = miGetLayerWindow;
pScreen->HandleExposures = miHandleValidateExposures;
- pScreen->ReparentWindow = (void (*)())0;
+ pScreen->ReparentWindow = (ReparentWindowProcPtr) 0;
pScreen->ChangeBorderWidth = miChangeBorderWidth;
#ifdef SHAPE
pScreen->SetShape = miSetShape;
#endif
pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
+ pScreen->SaveDoomedAreas = 0;
+ pScreen->RestoreAreas = 0;
+ pScreen->ExposeCopy = 0;
+ pScreen->TranslateBackingStore = 0;
+ pScreen->ClearBackingStore = 0;
+ pScreen->DrawGuarantee = 0;
+
miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
return miScreenDevPrivateInit(pScreen, width, pbits);
}
+int
+miAllocateGCPrivateIndex()
+{
+ static int privateIndex = -1;
+ static unsigned long miGeneration = 0;
+
+ if (miGeneration != serverGeneration)
+ {
+ privateIndex = AllocateGCPrivateIndex();
+ miGeneration = serverGeneration;
+ }
+ return privateIndex;
+}
+
int miZeroLineScreenIndex;
-int miZeroLineGeneration;
+unsigned int miZeroLineGeneration = 0;
void
miSetZeroLineBias(pScreen, bias)
@@ -286,3 +350,18 @@ miSetZeroLineBias(pScreen, bias)
if (miZeroLineScreenIndex >= 0)
pScreen->devPrivates[miZeroLineScreenIndex].uval = bias;
}
+
+PixmapPtr
+miGetScreenPixmap(pScreen)
+ ScreenPtr pScreen;
+{
+ return (PixmapPtr)(pScreen->devPrivate);
+}
+
+void
+miSetScreenPixmap(pPix)
+ PixmapPtr pPix;
+{
+ if (pPix)
+ pPix->drawable.pScreen->devPrivate = (pointer)pPix;
+}
diff --git a/mi/mispans.c b/mi/mispans.c
index 562b843ce..81fa45da7 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.4 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1989, 1998 The Open Group
@@ -222,10 +223,10 @@ void miFreeSpanGroup(spanGroup)
if (spanGroup->group != NULL) xfree(spanGroup->group);
}
-static void QuickSortSpansX(points, widths, numSpans)
- register DDXPointRec points[];
- register int widths[];
- register int numSpans;
+static void QuickSortSpansX(
+ register DDXPointRec points[],
+ register int widths[],
+ register int numSpans )
{
register int x;
register int i, j, m;
@@ -309,10 +310,10 @@ static void QuickSortSpansX(points, widths, numSpans)
} /* QuickSortSpans */
-static int UniquifySpansX(spans, newPoints, newWidths)
- Spans *spans;
- register DDXPointRec *newPoints;
- register int *newWidths;
+static int UniquifySpansX(
+ Spans *spans,
+ register DDXPointRec *newPoints,
+ register int *newWidths )
{
register int newx1, newx2, oldpt, i, y;
register DDXPointRec *oldPoints;
@@ -418,8 +419,10 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
if (!yspans || !ysizes)
{
- xfree (yspans);
- xfree (ysizes);
+ if (yspans)
+ xfree (yspans);
+ if (ysizes)
+ xfree (ysizes);
miDisposeSpanGroup (spanGroup);
return;
}
@@ -496,10 +499,12 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
xfree (yspans[i].points);
xfree (yspans[i].widths);
}
- xfree (points);
- xfree (widths);
xfree (yspans);
xfree (ysizes);
+ if (points)
+ xfree (points);
+ if (widths)
+ xfree (widths);
return;
}
count = 0;
@@ -524,7 +529,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
xfree(points);
xfree(widths);
xfree(yspans);
- xfree(ysizes);
+ xfree(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */
}
spanGroup->count = 0;
diff --git a/mi/mispans.h b/mi/mispans.h
index 3750d2add..5ae2d014a 100644
--- a/mi/mispans.h
+++ b/mi/mispans.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mispans.h,v 1.3 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1989, 1998 The Open Group
@@ -62,60 +63,45 @@ typedef struct {
/* Initialize SpanGroup. MUST BE DONE before use. */
extern void miInitSpanGroup(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/
-#endif
);
/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
extern void miAppendSpans(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/,
SpanGroup * /*otherGroup*/,
Spans * /*spans*/
-#endif
);
/* Paint a span group, possibly with some overlap */
extern void miFillSpanGroup(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
SpanGroup * /*spanGroup*/
-#endif
);
/* Paint a span group, insuring that each pixel is painted at most once */
extern void miFillUniqueSpanGroup(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
SpanGroup * /*spanGroup*/
-#endif
);
/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
extern void miFreeSpanGroup(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/
-#endif
);
extern void miSubtractSpans(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/,
Spans * /*sub*/
-#endif
);
extern void miDisposeSpanGroup(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/
-#endif
);
extern int miClipSpans(
-#if NeedFunctionPrototypes
RegionPtr /*prgnDst*/,
DDXPointPtr /*ppt*/,
int * /*pwidth*/,
@@ -123,7 +109,6 @@ extern int miClipSpans(
DDXPointPtr /*pptNew*/,
int * /*pwidthNew*/,
int /*fSorted*/
-#endif
);
/* Rops which must use span groups */
diff --git a/mi/misprite.c b/mi/misprite.c
index 2fc6da8dd..d323f1168 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -30,6 +30,7 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.11 2002/12/09 04:10:58 tsi Exp $ */
# include "X.h"
# include "Xproto.h"
@@ -47,6 +48,9 @@ in this Software without prior written authorization from The Open Group.
# include "mispritest.h"
# include "dixfontstr.h"
# include "fontstruct.h"
+#ifdef RENDER
+# include "mipict.h"
+#endif
/*
* screen wrappers
@@ -55,23 +59,63 @@ in this Software without prior written authorization from The Open Group.
static int miSpriteScreenIndex;
static unsigned long miSpriteGeneration = 0;
-static Bool miSpriteCloseScreen();
-static void miSpriteGetImage();
-static void miSpriteGetSpans();
-static void miSpriteSourceValidate();
-static Bool miSpriteCreateGC();
-static void miSpriteBlockHandler();
-static void miSpriteInstallColormap();
-static void miSpriteStoreColors();
-
-static void miSpritePaintWindowBackground();
-static void miSpritePaintWindowBorder();
-static void miSpriteCopyWindow();
-static void miSpriteClearToBackground();
+static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
+static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
+ int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart);
+static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
+ int width, int height);
+static Bool miSpriteCreateGC(GCPtr pGC);
+static void miSpriteBlockHandler(int i, pointer blockData,
+ pointer pTimeout,
+ pointer pReadMask);
+static void miSpriteInstallColormap(ColormapPtr pMap);
+static void miSpriteStoreColors(ColormapPtr pMap, int ndef,
+ xColorItem *pdef);
+
+static void miSpritePaintWindowBackground(WindowPtr pWin,
+ RegionPtr pRegion, int what);
+static void miSpritePaintWindowBorder(WindowPtr pWin,
+ RegionPtr pRegion, int what);
+static void miSpriteCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr pRegion);
+static void miSpriteClearToBackground(WindowPtr pWin, int x, int y,
+ int w, int h,
+ Bool generateExposures);
+
+#ifdef RENDER
+static void miSpriteComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+static void miSpriteGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+#endif
-static void miSpriteSaveDoomedAreas();
-static RegionPtr miSpriteRestoreAreas();
-static void miSpriteComputeSaved();
+static void miSpriteSaveDoomedAreas(WindowPtr pWin,
+ RegionPtr pObscured, int dx,
+ int dy);
+static RegionPtr miSpriteRestoreAreas(WindowPtr pWin, RegionPtr pRgnExposed);
+static void miSpriteComputeSaved(ScreenPtr pScreen);
#define SCREEN_PROLOGUE(pScreen, field)\
((pScreen)->field = \
@@ -86,10 +130,14 @@ static void miSpriteComputeSaved();
static int miSpriteGCIndex;
-static void miSpriteValidateGC (), miSpriteCopyGC ();
-static void miSpriteDestroyGC(), miSpriteChangeGC();
-static void miSpriteChangeClip(), miSpriteDestroyClip();
-static void miSpriteCopyClip();
+static void miSpriteValidateGC(GCPtr pGC, unsigned long stateChanges,
+ DrawablePtr pDrawable);
+static void miSpriteCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void miSpriteDestroyGC(GCPtr pGC);
+static void miSpriteChangeGC(GCPtr pGC, unsigned long mask);
+static void miSpriteChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void miSpriteDestroyClip(GCPtr pGC);
+static void miSpriteCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
static GCFuncs miSpriteGCFuncs = {
miSpriteValidateGC,
@@ -121,19 +169,62 @@ static GCFuncs miSpriteGCFuncs = {
* GC op wrappers
*/
-static void miSpriteFillSpans(), miSpriteSetSpans();
-static void miSpritePutImage();
-static RegionPtr miSpriteCopyArea(), miSpriteCopyPlane();
-static void miSpritePolyPoint(), miSpritePolylines();
-static void miSpritePolySegment(), miSpritePolyRectangle();
-static void miSpritePolyArc(), miSpriteFillPolygon();
-static void miSpritePolyFillRect(), miSpritePolyFillArc();
-static int miSpritePolyText8(), miSpritePolyText16();
-static void miSpriteImageText8(), miSpriteImageText16();
-static void miSpriteImageGlyphBlt(), miSpritePolyGlyphBlt();
-static void miSpritePushPixels();
+static void miSpriteFillSpans(DrawablePtr pDrawable, GCPtr pGC,
+ int nInit, DDXPointPtr pptInit,
+ int *pwidthInit, int fSorted);
+static void miSpriteSetSpans(DrawablePtr pDrawable, GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth,
+ int nspans, int fSorted);
+static void miSpritePutImage(DrawablePtr pDrawable, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits);
+static RegionPtr miSpriteCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w,
+ int h, int dstx, int dsty);
+static RegionPtr miSpriteCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w,
+ int h, int dstx, int dsty,
+ unsigned long plane);
+static void miSpritePolyPoint(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, xPoint *pptInit);
+static void miSpritePolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit);
+static void miSpritePolySegment(DrawablePtr pDrawable, GCPtr pGC,
+ int nseg, xSegment *pSegs);
+static void miSpritePolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects);
+static void miSpritePolyArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+static void miSpriteFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts);
+static void miSpritePolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+static void miSpritePolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+static int miSpritePolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static int miSpritePolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miSpriteImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static void miSpriteImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miSpriteImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+static void miSpritePolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+static void miSpritePushPixels(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDst, int w, int h,
+ int x, int y);
#ifdef NEED_LINEHELPER
-static void miSpriteLineHelper();
+static void miSpriteLineHelper(void);
#endif
static GCOps miSpriteGCOps = {
@@ -174,7 +265,7 @@ static GCOps miSpriteGCOps = {
(pScreenPriv->isUp && \
(pScreenPriv->pCacheWin == pWin ? \
pScreenPriv->isInCacheWin : ( \
- ((int) (pScreenPriv->pCacheWin = (pWin))) , \
+ (pScreenPriv->pCacheWin = (pWin)), \
(pScreenPriv->isInCacheWin = \
(pWin)->drawable.x < pScreenPriv->saved.x2 && \
pScreenPriv->saved.x1 < (pWin)->drawable.x + \
@@ -200,8 +291,11 @@ static GCOps miSpriteGCOps = {
* pointer-sprite method table
*/
-static Bool miSpriteRealizeCursor (), miSpriteUnrealizeCursor ();
-static void miSpriteSetCursor (), miSpriteMoveCursor ();
+static Bool miSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static void miSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y);
+static void miSpriteMoveCursor(ScreenPtr pScreen, int x, int y);
miPointerSpriteFuncRec miSpritePointerFuncs = {
miSpriteRealizeCursor,
@@ -214,7 +308,8 @@ miPointerSpriteFuncRec miSpritePointerFuncs = {
* other misc functions
*/
-static void miSpriteRemoveCursor (), miSpriteRestoreCursor();
+static void miSpriteRemoveCursor(ScreenPtr pScreen);
+static void miSpriteRestoreCursor(ScreenPtr pScreen);
/*
* miSpriteInitialize -- called from device-dependent screen
@@ -230,6 +325,9 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
{
miSpriteScreenPtr pPriv;
VisualPtr pVisual;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
if (miSpriteGeneration != serverGeneration)
{
@@ -270,7 +368,14 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pPriv->SaveDoomedAreas = pScreen->SaveDoomedAreas;
pPriv->RestoreAreas = pScreen->RestoreAreas;
-
+#ifdef RENDER
+ if (ps)
+ {
+ pPriv->Composite = ps->Composite;
+ pPriv->Glyphs = ps->Glyphs;
+ }
+#endif
+
pPriv->pCursor = NULL;
pPriv->x = 0;
pPriv->y = 0;
@@ -305,6 +410,13 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pScreen->SaveDoomedAreas = miSpriteSaveDoomedAreas;
pScreen->RestoreAreas = miSpriteRestoreAreas;
+#ifdef RENDER
+ if (ps)
+ {
+ ps->Composite = miSpriteComposite;
+ ps->Glyphs = miSpriteGlyphs;
+ }
+#endif
return TRUE;
}
@@ -320,9 +432,13 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
static Bool
miSpriteCloseScreen (i, pScreen)
+ int i;
ScreenPtr pScreen;
{
miSpriteScreenPtr pScreenPriv;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
@@ -342,7 +458,13 @@ miSpriteCloseScreen (i, pScreen)
pScreen->SaveDoomedAreas = pScreenPriv->SaveDoomedAreas;
pScreen->RestoreAreas = pScreenPriv->RestoreAreas;
-
+#ifdef RENDER
+ if (ps)
+ {
+ ps->Composite = pScreenPriv->Composite;
+ ps->Glyphs = pScreenPriv->Glyphs;
+ }
+#endif
xfree ((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (i, pScreen);
@@ -473,7 +595,7 @@ static void
miSpriteBlockHandler (i, blockData, pTimeout, pReadmask)
int i;
pointer blockData;
- OSTimePtr pTimeout;
+ pointer pTimeout;
pointer pReadmask;
{
ScreenPtr pScreen = screenInfo.screens[i];
@@ -543,7 +665,7 @@ miSpriteStoreColors (pMap, ndef, pdef)
{
/* Direct color - match on any of the subfields */
-#define MaskMatch(a,b,mask) ((a) & (pVisual->mask) == (b) & (pVisual->mask))
+#define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask)))
#define UpdateDAC(plane,dac,mask) {\
if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\
@@ -592,8 +714,7 @@ miSpriteStoreColors (pMap, ndef, pdef)
}
static void
-miSpriteFindColors (pScreen)
- ScreenPtr pScreen;
+miSpriteFindColors (ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
pScreen->devPrivates[miSpriteScreenIndex].ptr;
@@ -798,8 +919,8 @@ miSpriteCopyWindow (pWin, ptOldOrg, pRegion)
static void
miSpriteClearToBackground (pWin, x, y, w, h, generateExposures)
WindowPtr pWin;
- short x,y;
- unsigned short w,h;
+ int x,y;
+ int w,h;
Bool generateExposures;
{
ScreenPtr pScreen;
@@ -836,7 +957,7 @@ miSpriteClearToBackground (pWin, x, y, w, h, generateExposures)
static void
miSpriteValidateGC (pGC, changes, pDrawable)
GCPtr pGC;
- Mask changes;
+ unsigned long changes;
DrawablePtr pDrawable;
{
GC_FUNC_PROLOGUE (pGC);
@@ -1017,6 +1138,7 @@ miSpritePutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits)
int y;
int w;
int h;
+ int leftPad;
int format;
char *pBits;
{
@@ -1517,15 +1639,16 @@ miSpritePolyFillArc(pDrawable, pGC, narcs, parcs)
*/
static Bool
-miSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox)
- DrawablePtr pDraw;
- FontPtr font;
- int x, y;
- unsigned int n;
- CharInfoPtr *charinfo;
- Bool imageblt;
- unsigned int w;
- BoxPtr cursorBox;
+miSpriteTextOverlap (
+ DrawablePtr pDraw,
+ FontPtr font,
+ int x,
+ int y,
+ unsigned int n,
+ CharInfoPtr *charinfo,
+ Bool imageblt,
+ unsigned int w,
+ BoxPtr cursorBox)
{
ExtentInfoRec extents;
@@ -1599,23 +1722,22 @@ miSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox)
#define TT_IMAGE16 3
static int
-miSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox)
- DrawablePtr pDraw;
- GCPtr pGC;
+miSpriteText (
+ DrawablePtr pDraw,
+ GCPtr pGC,
int x,
- y;
- unsigned long count;
- char *chars;
- FontEncoding fontEncoding;
- Bool textType;
- BoxPtr cursorBox;
+ int y,
+ unsigned long count,
+ char *chars,
+ FontEncoding fontEncoding,
+ Bool textType,
+ BoxPtr cursorBox)
{
CharInfoPtr *charinfo;
register CharInfoPtr *info;
unsigned long i;
unsigned int n;
int w;
- void (*drawFunc)();
Bool imageblt;
@@ -1646,27 +1768,33 @@ miSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox)
switch (textType)
{
case TT_POLY8:
- drawFunc = (void (*)())pGC->ops->PolyText8;
+ (*pGC->ops->PolyText8)(pDraw, pGC, x, y, (int)count, chars);
break;
case TT_IMAGE8:
- drawFunc = pGC->ops->ImageText8;
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, (int)count, chars);
break;
case TT_POLY16:
- drawFunc = (void (*)())pGC->ops->PolyText16;
+ (*pGC->ops->PolyText16)(pDraw, pGC, x, y, (int)count,
+ (unsigned short *)chars);
break;
case TT_IMAGE16:
- drawFunc = pGC->ops->ImageText16;
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, (int)count,
+ (unsigned short *)chars);
break;
}
- (*drawFunc) (pDraw, pGC, x, y, (int) count, chars);
#else /* don't AVOID_GLYPHBLT */
/*
* On the other hand, if the device does use GlyphBlt ultimately to do text, we
* don't want to slow it down by invoking the text functions and having them call
* GetGlyphs all over again, so we go directly to the GlyphBlt functions here.
*/
- drawFunc = imageblt ? pGC->ops->ImageGlyphBlt : pGC->ops->PolyGlyphBlt;
- (*drawFunc) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
+ if (imageblt) {
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ } else {
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ }
#endif /* AVOID_GLYPHBLT */
}
DEALLOCATE_LOCAL(charinfo);
@@ -1848,6 +1976,133 @@ miSpriteLineHelper()
}
#endif
+#ifdef RENDER
+
+# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+
+static void
+miSpritePictureOverlap (PicturePtr pPict,
+ INT16 x,
+ INT16 y,
+ CARD16 w,
+ CARD16 h)
+{
+ if (pPict->pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pWin = (WindowPtr) (pPict->pDrawable);
+ miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
+ pPict->pDrawable->pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ if (GC_CHECK(pWin))
+ {
+ if (pPict->repeat)
+ {
+ x = mod(x,pWin->drawable.width);
+ y = mod(y,pWin->drawable.height);
+ }
+ if (ORG_OVERLAP (&pScreenPriv->saved, pWin->drawable.x, pWin->drawable.y,
+ x, y, w, h))
+ miSpriteRemoveCursor (pWin->drawable.pScreen);
+ }
+ }
+}
+
+#define PICTURE_PROLOGUE(ps, pScreenPriv, field) \
+ ps->field = pScreenPriv->field
+
+#define PICTURE_EPILOGUE(ps, field, wrap) \
+ ps->field = wrap
+
+static void
+miSpriteComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ miSpriteScreenPtr pScreenPriv;
+
+ pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ PICTURE_PROLOGUE(ps, pScreenPriv, Composite);
+ miSpritePictureOverlap (pSrc, xSrc, ySrc, width, height);
+ if (pMask)
+ miSpritePictureOverlap (pMask, xMask, yMask, width, height);
+ miSpritePictureOverlap (pDst, xDst, yDst, width, height);
+
+ (*ps->Composite) (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
+
+ PICTURE_EPILOGUE(ps, Composite, miSpriteComposite);
+}
+
+static void
+miSpriteGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ miSpriteScreenPtr pScreenPriv;
+
+ pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ PICTURE_PROLOGUE(ps, pScreenPriv, Glyphs);
+ if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pSrcWin = (WindowPtr) (pSrc->pDrawable);
+
+ if (GC_CHECK(pSrcWin))
+ miSpriteRemoveCursor (pScreen);
+ }
+ if (pDst->pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pDstWin = (WindowPtr) (pDst->pDrawable);
+
+ if (GC_CHECK(pDstWin))
+ {
+ BoxRec extents;
+
+ miGlyphExtents (nlist, list, glyphs, &extents);
+ if (BOX_OVERLAP(&pScreenPriv->saved,
+ extents.x1 + pDstWin->drawable.x,
+ extents.y1 + pDstWin->drawable.y,
+ extents.x2 + pDstWin->drawable.x,
+ extents.y2 + pDstWin->drawable.y))
+ {
+ miSpriteRemoveCursor (pScreen);
+ }
+ }
+ }
+
+ (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+
+ PICTURE_EPILOGUE (ps, Glyphs, miSpriteGlyphs);
+}
+#endif
+
/*
* miPointer interface routines
*/
@@ -1882,18 +2137,12 @@ static void
miSpriteSetCursor (pScreen, pCursor, x, y)
ScreenPtr pScreen;
CursorPtr pCursor;
+ int x;
+ int y;
{
miSpriteScreenPtr pScreenPriv;
pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
- pScreenPriv->shouldBeUp = TRUE;
- if (pScreenPriv->x == x &&
- pScreenPriv->y == y &&
- pScreenPriv->pCursor == pCursor &&
- !pScreenPriv->checkPixels)
- {
- return;
- }
if (!pCursor)
{
pScreenPriv->shouldBeUp = FALSE;
@@ -1902,6 +2151,14 @@ miSpriteSetCursor (pScreen, pCursor, x, y)
pScreenPriv->pCursor = 0;
return;
}
+ pScreenPriv->shouldBeUp = TRUE;
+ if (pScreenPriv->x == x &&
+ pScreenPriv->y == y &&
+ pScreenPriv->pCursor == pCursor &&
+ !pScreenPriv->checkPixels)
+ {
+ return;
+ }
pScreenPriv->x = x;
pScreenPriv->y = y;
pScreenPriv->pCacheWin = NullWindow;
diff --git a/mi/misprite.h b/mi/misprite.h
index be2f03e04..a7e19f7cb 100644
--- a/mi/misprite.h
+++ b/mi/misprite.h
@@ -32,50 +32,40 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/misprite.h,v 1.3 2001/12/14 20:00:27 dawes Exp $ */
typedef struct {
Bool (*RealizeCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/
-#endif
);
Bool (*UnrealizeCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/
-#endif
);
Bool (*PutUpCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/,
int /*x*/,
int /*y*/,
unsigned long /*source*/,
unsigned long /*mask*/
-#endif
);
Bool (*SaveUnderCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/
-#endif
);
Bool (*RestoreUnderCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/
-#endif
);
Bool (*MoveCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/,
int /*x*/,
@@ -86,10 +76,8 @@ typedef struct {
int /*dy*/,
unsigned long /*source*/,
unsigned long /*mask*/
-#endif
);
Bool (*ChangeSave)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
@@ -97,15 +85,12 @@ typedef struct {
int /*h*/,
int /*dx*/,
int /*dy*/
-#endif
);
} miSpriteCursorFuncRec, *miSpriteCursorFuncPtr;
extern Bool miSpriteInitialize(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
miSpriteCursorFuncPtr /*cursorFuncs*/,
miPointerScreenFuncPtr /*screenFuncs*/
-#endif
);
diff --git a/mi/mispritest.h b/mi/mispritest.h
index 1b873ecbd..eddc16c2d 100644
--- a/mi/mispritest.h
+++ b/mi/mispritest.h
@@ -30,8 +30,12 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mispritest.h,v 1.5 2001/12/14 20:00:27 dawes Exp $ */
# include "misprite.h"
+#ifdef RENDER
+# include "picturestr.h"
+#endif
/*
* per screen information
@@ -52,6 +56,10 @@ typedef struct {
ClearToBackgroundProcPtr ClearToBackground;
SaveDoomedAreasProcPtr SaveDoomedAreas;
RestoreAreasProcPtr RestoreAreas;
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+#endif
CursorPtr pCursor;
int x;
diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index 26819ee45..eb1e01e60 100644
--- a/mi/mivaltree.c
+++ b/mi/mivaltree.c
@@ -51,6 +51,30 @@ in this Software without prior written authorization from The Open Group.
*
******************************************************************/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/mi/mivaltree.c,v 1.9 2001/12/14 20:00:27 dawes Exp $ */
+
/*
* Aug '86: Susan Angebranndt -- original code
* July '87: Adam de Boor -- substantially modified and commented
@@ -60,7 +84,6 @@ in this Software without prior written authorization from The Open Group.
* Bob Scheifler -- avoid miComputeClips for unmapped windows,
* valdata changes
*/
-
#include "X.h"
#include "scrnintstr.h"
#include "validate.h"
@@ -69,10 +92,13 @@ in this Software without prior written authorization from The Open Group.
#include "regionstr.h"
#include "mivalidate.h"
+#include "globals.h"
+
#ifdef SHAPE
/*
* Compute the visibility of a shaped window
*/
+int
miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
ScreenPtr pScreen;
RegionPtr universe, bounding;
@@ -137,7 +163,8 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
HasBorder(w) && \
(w)->backgroundState == ParentRelative)
-/*-
+
+/*
*-----------------------------------------------------------------------
* miComputeClips --
* Recompute the clipList, borderClip, exposed and borderExposed
@@ -153,14 +180,13 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
*
*-----------------------------------------------------------------------
*/
-
static void
-miComputeClips (pParent, pScreen, universe, kind, exposed)
- register WindowPtr pParent;
- register ScreenPtr pScreen;
- register RegionPtr universe;
- VTKind kind;
- RegionPtr exposed; /* for intermediate calculations */
+miComputeClips (
+ register WindowPtr pParent,
+ register ScreenPtr pScreen,
+ register RegionPtr universe,
+ VTKind kind,
+ RegionPtr exposed ) /* for intermediate calculations */
{
int dx,
dy;
@@ -172,7 +198,6 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
Bool overlap;
RegionPtr borderVisible;
Bool resized;
-
/*
* Figure out the new visibility of this window.
* The extent of the universe should be the same as the extent of
@@ -181,7 +206,6 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
* completely). If the window is completely obscured, none of the
* universe will cover the rectangle.
*/
-
borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
@@ -311,6 +335,10 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy);
}
break;
+ case VTBroken:
+ REGION_EMPTY (pScreen, &pParent->borderClip);
+ REGION_EMPTY (pScreen, &pParent->clipList);
+ break;
}
borderVisible = pParent->valdata->before.borderVisible;
@@ -476,8 +504,8 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
}
static void
-miTreeObscured(pParent)
- register WindowPtr pParent;
+miTreeObscured(
+ register WindowPtr pParent )
{
register WindowPtr pChild;
register int oldVis;
@@ -505,7 +533,7 @@ miTreeObscured(pParent)
}
}
-/*-
+/*
*-----------------------------------------------------------------------
* miValidateTree --
* Recomputes the clip list for pParent and all its inferiors.
@@ -572,39 +600,65 @@ miValidateTree (pParent, pChild, kind)
*/
REGION_INIT(pScreen, &totalClip, NullBox, 0);
viewvals = 0;
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
+ if (REGION_BROKEN (pScreen, &pParent->clipList) &&
+ !REGION_BROKEN (pScreen, &pParent->borderClip))
{
+ kind = VTBroken;
+ /*
+ * When rebuilding clip lists after out of memory,
+ * assume everything is busted.
+ */
forward = TRUE;
+ REGION_COPY (pScreen, &totalClip, &pParent->borderClip);
+ REGION_INTERSECT (pScreen, &totalClip, &totalClip, &pParent->winSize);
+
+ for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
+ {
+ if (pWin->viewable)
+ REGION_SUBTRACT (pScreen, &totalClip, &totalClip, &pWin->borderSize);
+ }
for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable)
+ viewvals++;
+
+ REGION_EMPTY (pScreen, &pParent->clipList);
+ }
+ else
+ {
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x)))
{
- if (pWin->valdata)
+ forward = TRUE;
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
{
- REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
- if (pWin->viewable)
- viewvals++;
+ if (pWin->valdata)
+ {
+ REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
}
}
- }
- else
- {
- forward = FALSE;
- pWin = pParent->lastChild;
- while (1)
+ else
{
- if (pWin->valdata)
+ forward = FALSE;
+ pWin = pParent->lastChild;
+ while (1)
{
- REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
- if (pWin->viewable)
- viewvals++;
+ if (pWin->valdata)
+ {
+ REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
}
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
}
+ REGION_VALIDATE( pScreen, &totalClip, &overlap);
}
- REGION_VALIDATE( pScreen, &totalClip, &overlap);
/*
* Now go through the children of the root and figure their new
diff --git a/mi/miwideline.c b/mi/miwideline.c
index b78435705..4eb365aca 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.12 2001/12/14 20:00:28 dawes Exp $ */
/* Author: Keith Packard, MIT X Consortium */
@@ -53,7 +54,12 @@ from The Open Group.
ICEILTEMPDECL
#endif
-static void miLineArc();
+static void miLineArc(DrawablePtr pDraw, register GCPtr pGC,
+ unsigned long pixel, SpanDataPtr spanData,
+ register LineFacePtr leftFace,
+ register LineFacePtr rightFace,
+ double xorg, double yorg, Bool isInt);
+
/*
* spans-based polygon filler
@@ -71,23 +77,23 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
PolyEdgePtr left, right;
int left_count, right_count;
{
- register int left_x, left_e;
- int left_stepx;
- int left_signdx;
- int left_dy, left_dx;
+ register int left_x = 0, left_e = 0;
+ int left_stepx = 0;
+ int left_signdx = 0;
+ int left_dy = 0, left_dx = 0;
- register int right_x, right_e;
- int right_stepx;
- int right_signdx;
- int right_dy, right_dx;
+ register int right_x = 0, right_e = 0;
+ int right_stepx = 0;
+ int right_signdx = 0;
+ int right_dy = 0, right_dx = 0;
- int height;
- int left_height, right_height;
+ int height = 0;
+ int left_height = 0, right_height = 0;
register DDXPointPtr ppt;
- DDXPointPtr pptInit;
+ DDXPointPtr pptInit = NULL;
register int *pwidth;
- int *pwidthInit;
+ int *pwidthInit = NULL;
XID oldPixel;
int xorg;
Spans spanRec;
@@ -184,12 +190,15 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
}
static void
-miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- int x, y, w, h;
+miFillRectPolyHelper (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x,
+ int y,
+ int w,
+ int h)
{
register DDXPointPtr ppt;
register int *pwidth;
@@ -325,7 +334,7 @@ miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright,
int slopeoff;
register int s;
register int nright, nleft;
- int y, lasty, bottomy, topy;
+ int y, lasty = 0, bottomy, topy = 0;
/* find the top of the polygon */
maxy = miny = vertices[0].y;
@@ -418,12 +427,13 @@ miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright,
}
static void
-miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- int x, y;
+miLineOnePoint (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x,
+ int y)
{
DDXPointRec pt;
int wid;
@@ -452,15 +462,16 @@ miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y)
}
static void
-miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register LineFacePtr pLeft, pRight;
+miLineJoin (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ register LineFacePtr pLeft,
+ register LineFacePtr pRight)
{
- double mx, my;
- double denom;
+ double mx = 0, my = 0;
+ double denom = 0.0;
PolyVertexRec vertices[4];
PolySlopeRec slopes[4];
int edgecount;
@@ -472,8 +483,10 @@ miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
int lw = pGC->lineWidth;
if (lw == 1 && !spanData) {
- /* Lines going in the same direction have no join */
- if (pLeft->dx >= 0 == pRight->dx <= 0)
+ /* See if one of the lines will draw the joining pixel */
+ if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0))
+ return;
+ if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0))
return;
if (joinStyle != JoinRound) {
denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
@@ -599,12 +612,13 @@ miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
}
static int
-miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
- DrawablePtr pDraw;
- GCPtr pGC;
- int xorg, yorg;
- DDXPointPtr points;
- int *widths;
+miLineArcI (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xorg,
+ int yorg,
+ DDXPointPtr points,
+ int *widths)
{
register DDXPointPtr tpts, bpts;
register int *twids, *bwids;
@@ -685,16 +699,19 @@ miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
}
static int
-miLineArcD (pDraw, pGC, xorg, yorg, points, widths,
- edge1, edgey1, edgeleft1, edge2, edgey2, edgeleft2)
- DrawablePtr pDraw;
- GCPtr pGC;
- double xorg, yorg;
- DDXPointPtr points;
- int *widths;
- PolyEdgePtr edge1, edge2;
- int edgey1, edgey2;
- Bool edgeleft1, edgeleft2;
+miLineArcD (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ double xorg,
+ double yorg,
+ DDXPointPtr points,
+ int *widths,
+ PolyEdgePtr edge1,
+ int edgey1,
+ Bool edgeleft1,
+ PolyEdgePtr edge2,
+ int edgey2,
+ Bool edgeleft2)
{
register DDXPointPtr pts;
register int *wids;
@@ -873,7 +890,7 @@ miRoundJoinFace (face, edge, leftEdge)
ya = 0.0;
xa = 0.0;
}
- if (dy < 0 || dy == 0 && dx > 0)
+ if (dy < 0 || (dy == 0 && dx > 0))
{
dx = -dx;
dy = -dy;
@@ -946,7 +963,7 @@ miRoundCapClip (face, isInt, edge, leftEdge)
if (!isInt)
k = face->k;
left = 1;
- if (dy < 0 || dy == 0 && dx > 0)
+ if (dy < 0 || (dy == 0 && dx > 0))
{
dx = -dx;
dy = -dy;
@@ -977,18 +994,20 @@ miRoundCapClip (face, isInt, edge, leftEdge)
}
static void
-miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
- DrawablePtr pDraw;
- register GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register LineFacePtr leftFace, rightFace;
- double xorg, yorg;
- Bool isInt;
+miLineArc (
+ DrawablePtr pDraw,
+ register GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ register LineFacePtr leftFace,
+ register LineFacePtr rightFace,
+ double xorg,
+ double yorg,
+ Bool isInt)
{
DDXPointPtr points;
int *widths;
- int xorgi, yorgi;
+ int xorgi = 0, yorgi = 0;
XID oldPixel;
Spans spanRec;
int n;
@@ -1010,8 +1029,8 @@ miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
edgeleft1 = FALSE;
edgeleft2 = FALSE;
if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) &&
- (pGC->capStyle == CapRound && pGC->joinStyle != JoinRound ||
- pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))
+ ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
+ (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)))
{
if (isInt)
{
@@ -1101,7 +1120,7 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
double xorg, yorg;
Bool isInt;
{
- int xorgi, yorgi;
+ int xorgi = 0, yorgi = 0;
int lw;
PolyEdgeRec lefts[2], rights[2];
int lefty, righty, topy, bottomy;
@@ -1138,7 +1157,7 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
rights[0].height = lw;
rights[0].x = xorgi;
if (!isLeft)
- rights[0].x += (lw + 1 >> 1);
+ rights[0].x += ((lw + 1) >> 1);
rights[0].stepx = 0;
rights[0].signdx = 1;
rights[0].e = -lw;
@@ -1257,19 +1276,23 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
}
static void
-miWideSegment (pDrawable, pGC, pixel, spanData,
- x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register int x1, y1, x2, y2;
- Bool projectLeft, projectRight;
- register LineFacePtr leftFace, rightFace;
+miWideSegment (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ register int x1,
+ register int y1,
+ register int x2,
+ register int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ register LineFacePtr leftFace,
+ register LineFacePtr rightFace)
{
double l, L, r;
double xa, ya;
- double projectXoff, projectYoff;
+ double projectXoff = 0.0, projectYoff = 0.0;
double k;
double maxy;
int x, y;
@@ -1284,7 +1307,7 @@ miWideSegment (pDrawable, pGC, pixel, spanData,
int lw = pGC->lineWidth;
/* draw top-to-bottom always */
- if (y2 < y1 || y2 == y1 && x2 < x1)
+ if (y2 < y1 || (y2 == y1 && x2 < x1))
{
x = x1;
x1 = x2;
@@ -1333,7 +1356,7 @@ miWideSegment (pDrawable, pGC, pixel, spanData,
y = y1 - (lw >> 1);
dx = x2 - x;
if (projectRight)
- dx += (lw + 1 >> 1);
+ dx += ((lw + 1) >> 1);
dy = lw;
miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
x, y, dx, dy);
@@ -1352,7 +1375,7 @@ miWideSegment (pDrawable, pGC, pixel, spanData,
x = x1 - (lw >> 1);
dy = y2 - y;
if (projectRight)
- dy += (lw + 1 >> 1);
+ dy += ((lw + 1) >> 1);
dx = lw;
miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
x, y, dx, dy);
@@ -1480,7 +1503,7 @@ miSetupSpanData (pGC, spanData, npt)
SpanDataPtr spanData;
int npt;
{
- if (npt < 3 && pGC->capStyle != CapRound || miSpansEasyRop(pGC->alu))
+ if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu))
return (SpanDataPtr) NULL;
if (pGC->lineStyle == LineDoubleDash)
miInitSpanGroup (&spanData->bgGroup);
@@ -1659,15 +1682,20 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
#define V_LEFT 3
static void
-miWideDashSegment (pDrawable, pGC, spanData, pDashOffset, pDashIndex,
- x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- int *pDashOffset, *pDashIndex;
- SpanDataPtr spanData;
- int x1, y1, x2, y2;
- Bool projectLeft, projectRight;
- LineFacePtr leftFace, rightFace;
+miWideDashSegment (
+ DrawablePtr pDrawable,
+ register GCPtr pGC,
+ SpanDataPtr spanData,
+ int *pDashOffset,
+ int *pDashIndex,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace)
{
int dashIndex, dashRemain;
unsigned char *pDash;
@@ -1687,9 +1715,9 @@ miWideDashSegment (pDrawable, pGC, spanData, pDashOffset, pDashIndex,
double r;
double rdx, rdy;
double dashDx, dashDy;
- double saveK;
+ double saveK = 0.0;
Bool first = TRUE;
- double lcenterx, lcentery, rcenterx, rcentery;
+ double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0;
unsigned long fgPixel, bgPixel;
dx = x2 - x1;
@@ -2030,14 +2058,17 @@ miWideDash (pDrawable, pGC, mode, npt, pPts)
SpanDataPtr spanData;
Bool somethingDrawn = FALSE;
Bool selfJoin;
- Bool endIsFg, startIsFg, firstIsFg = FALSE, prevIsFg;
+ Bool endIsFg = FALSE, startIsFg = FALSE;
+ Bool firstIsFg = FALSE, prevIsFg = FALSE;
+#ifndef XFree86Server
/* XXX backward compatibility */
if (pGC->lineWidth == 0)
{
miZeroDashLine (pDrawable, pGC, mode, npt, pPts);
return;
}
+#endif
if (pGC->lineStyle == LineDoubleDash &&
(pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled))
{
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 71d2c369c..f32a1e8fe 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -26,10 +26,12 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.12 2001/12/14 20:00:28 dawes Exp $ */
/* Author: Keith Packard, MIT X Consortium */
#include "mispans.h"
+#include "mifpoly.h" /* for ICEIL */
/*
* interface data to span-merging polygon filler
@@ -153,24 +155,7 @@ typedef struct _LineFace {
} \
}
-#ifdef NOINLINEICEIL
-#define ICEIL(x) ((int)ceil(x))
-#else
-#ifdef __GNUC__
-static __inline int ICEIL(x)
- double x;
-{
- int _cTmp = x;
- return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
-}
-#else
-#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1)
-#define ICEILTEMPDECL static int _cTmp;
-#endif
-#endif
-
extern void miFillPolyHelper(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
unsigned long /*pixel*/,
@@ -181,18 +166,14 @@ extern void miFillPolyHelper(
PolyEdgePtr /*right*/,
int /*left_count*/,
int /*right_count*/
-#endif
);
extern int miRoundJoinFace(
-#if NeedFunctionPrototypes
LineFacePtr /*face*/,
PolyEdgePtr /*edge*/,
Bool * /*leftEdge*/
-#endif
);
extern void miRoundJoinClip(
-#if NeedFunctionPrototypes
LineFacePtr /*pLeft*/,
LineFacePtr /*pRight*/,
PolyEdgePtr /*edge1*/,
@@ -201,20 +182,16 @@ extern void miRoundJoinClip(
int * /*y2*/,
Bool * /*left1*/,
Bool * /*left2*/
-#endif
);
extern int miRoundCapClip(
-#if NeedFunctionPrototypes
LineFacePtr /*face*/,
Bool /*isInt*/,
PolyEdgePtr /*edge*/,
Bool * /*leftEdge*/
-#endif
);
extern void miLineProjectingCap(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
unsigned long /*pixel*/,
@@ -224,21 +201,24 @@ extern void miLineProjectingCap(
double /*xorg*/,
double /*yorg*/,
Bool /*isInt*/
-#endif
);
extern SpanDataPtr miSetupSpanData(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
SpanDataPtr /*spanData*/,
int /*npt*/
-#endif
);
extern void miCleanupSpanData(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
SpanDataPtr /*spanData*/
-#endif
);
+
+extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
+ int xi, int yi, int left, PolyEdgePtr edge);
+extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
+ int count, int xi, int yi, PolyEdgePtr left,
+ PolyEdgePtr right, int *pnleft, int *pnright,
+ int *h);
+
diff --git a/mi/miwindow.c b/mi/miwindow.c
index f9428074c..fbced41c6 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.7 2001/12/14 20:00:28 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -156,10 +157,10 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
*-----------------------------------------------------------------------
*/
static Bool
-miCheckSubSaveUnder(pParent, pFirst, pRegion)
- register WindowPtr pParent; /* Parent to check */
- WindowPtr pFirst; /* first reconfigured window */
- RegionPtr pRegion; /* Initial area obscured by saveUnder */
+miCheckSubSaveUnder(
+ register WindowPtr pParent, /* Parent to check */
+ WindowPtr pFirst, /* first reconfigured window */
+ RegionPtr pRegion) /* Initial area obscured by saveUnder */
{
register WindowPtr pChild; /* Current child */
register ScreenPtr pScreen; /* Screen to use */
@@ -362,8 +363,10 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
register BoxPtr box;
register WindowPtr pChild, pLast;
Bool anyMarked = FALSE;
- void (* MarkWindow)() = pWin->drawable.pScreen->MarkWindow;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow;
+ ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
/* single layered systems are easy */
if (ppLayerWin) *ppLayerWin = pWin;
@@ -379,6 +382,10 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
{
if (pChild->viewable)
{
+ if (REGION_BROKEN (pScreen, &pChild->winSize))
+ SetWinSize (pChild);
+ if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ SetBorderSize (pChild);
(* MarkWindow)(pChild);
if (pChild->firstChild)
{
@@ -401,15 +408,21 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
pLast = pChild->parent->lastChild;
while (1)
{
- if (pChild->viewable && RECT_IN_REGION(pScreen, &pChild->borderSize,
- box))
+ if (pChild->viewable)
{
- (* MarkWindow)(pChild);
- anyMarked = TRUE;
- if (pChild->firstChild)
+ if (REGION_BROKEN (pScreen, &pChild->winSize))
+ SetWinSize (pChild);
+ if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ SetBorderSize (pChild);
+ if (RECT_IN_REGION(pScreen, &pChild->borderSize, box))
{
- pChild = pChild->firstChild;
- continue;
+ (* MarkWindow)(pChild);
+ anyMarked = TRUE;
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
}
}
while (!pChild->nextSib && (pChild != pLast))
@@ -436,8 +449,10 @@ miHandleValidateExposures(pWin)
{
register WindowPtr pChild;
register ValidatePtr val;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- void (* WindowExposures)();
+ ScreenPtr pScreen;
+ WindowExposuresProcPtr WindowExposures;
+
+ pScreen = pWin->drawable.pScreen;
pChild = pWin;
WindowExposures = pChild->drawable.pScreen->WindowExposures;
@@ -478,9 +493,9 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
WindowPtr pParent;
Bool WasViewable = (Bool)(pWin->viewable);
short bw;
- RegionPtr oldRegion;
+ RegionPtr oldRegion = NULL;
DDXPointRec oldpt;
- Bool anyMarked;
+ Bool anyMarked = FALSE;
register ScreenPtr pScreen;
WindowPtr windowToValidate;
#ifdef DO_SAVE_UNDERS
@@ -558,9 +573,9 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
*/
static int
-miRecomputeExposures (pWin, value)
- register WindowPtr pWin;
- pointer value; /* must conform to VisitWindowProcPtr */
+miRecomputeExposures (
+ register WindowPtr pWin,
+ pointer value) /* must conform to VisitWindowProcPtr */
{
register ScreenPtr pScreen;
RegionPtr pValid = (RegionPtr)value;
@@ -601,8 +616,8 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
int bw = wBorderWidth (pWin);
short dw, dh;
DDXPointRec oldpt;
- RegionPtr oldRegion;
- Bool anyMarked;
+ RegionPtr oldRegion = NULL;
+ Bool anyMarked = FALSE;
register ScreenPtr pScreen;
WindowPtr pFirstChange;
register WindowPtr pChild;
@@ -610,9 +625,9 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
register unsigned g;
int nx, ny; /* destination x,y */
int newx, newy; /* new inner window position */
- RegionPtr pRegion;
+ RegionPtr pRegion = NULL;
RegionPtr destClip; /* portions of destination already written */
- RegionPtr oldWinClip; /* old clip list for window */
+ RegionPtr oldWinClip = NULL; /* old clip list for window */
RegionPtr borderVisible = NullRegion; /* visible area of the border */
RegionPtr bsExposed = NullRegion; /* backing store exposures */
Bool shrunk = FALSE; /* shrunk in an inner dimension */
@@ -962,9 +977,8 @@ miSetShape(pWin)
{
Bool WasViewable = (Bool)(pWin->viewable);
register ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool anyMarked;
- WindowPtr pParent = pWin->parent;
- RegionPtr pOldClip, bsExposed;
+ Bool anyMarked = FALSE;
+ RegionPtr pOldClip = NULL, bsExposed;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@@ -1064,7 +1078,7 @@ miChangeBorderWidth(pWin, width)
{
WindowPtr pParent;
int oldwidth;
- Bool anyMarked;
+ Bool anyMarked = FALSE;
register ScreenPtr pScreen;
Bool WasViewable = (Bool)(pWin->viewable);
Bool HadBorder;
@@ -1142,3 +1156,21 @@ miMarkUnrealizedWindow(pChild, pWin, fromConfigure)
REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip);
}
}
+
+void
+miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
+{
+ ScreenPtr pScreen;
+ WindowPtr pChild;
+
+ pScreen = pWin->drawable.pScreen;
+
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ if (pChild->drawable.depth == depth)
+ REGION_UNION(pScreen, pReg, pReg, &pChild->borderClip);
+
+ if (pChild->firstChild)
+ miSegregateChildren(pChild, pReg, depth);
+ }
+}
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index def8d8c51..971e2cb03 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mizerarc.c,v 1.6 2001/12/14 20:00:28 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -502,12 +503,14 @@ miZeroArcPts(arc, pts)
}
static void
-miZeroArcDashPts(pGC, arc, dinfo, points, maxPts, evenPts, oddPts)
- GCPtr pGC;
- xArc *arc;
- DashInfo *dinfo;
- int maxPts;
- register DDXPointPtr points, *evenPts, *oddPts;
+miZeroArcDashPts(
+ GCPtr pGC,
+ xArc *arc,
+ DashInfo *dinfo,
+ register DDXPointPtr points,
+ int maxPts,
+ register DDXPointPtr *evenPts,
+ register DDXPointPtr *oddPts )
{
miZeroArcRec info;
register int x, y, a, b, d, mask;
@@ -710,14 +713,14 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
xArc *parcs;
{
int maxPts = 0;
- register int n, maxw;
+ register int n, maxw = 0;
register xArc *arc;
register int i;
DDXPointPtr points, pts, oddPts;
register DDXPointPtr pt;
int numPts;
Bool dospans;
- int *widths;
+ int *widths = NULL;
XID fgPixel = pGC->fgPixel;
DashInfo dinfo;
@@ -738,7 +741,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
if (!maxPts)
return;
numPts = maxPts << 2;
- dospans = (pGC->lineStyle != LineSolid) || (pGC->fillStyle != FillSolid);
+ dospans = (pGC->fillStyle != FillSolid);
if (dospans)
{
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts);
diff --git a/mi/mizerarc.h b/mi/mizerarc.h
index 68c8ce3de..4a52efa29 100644
--- a/mi/mizerarc.h
+++ b/mi/mizerarc.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mizerarc.h,v 1.3 2001/12/14 20:00:28 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -121,17 +122,13 @@ typedef struct {
/* mizerarc.c */
extern Bool miZeroArcSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miZeroArcRec * /*info*/,
Bool /*ok360*/
-#endif
);
extern DDXPointPtr miZeroArcPts(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
DDXPointPtr /*pts*/
-#endif
);
diff --git a/mi/mizerline.c b/mi/mizerline.c
index 2279cb822..d1fbf631e 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.7 2001/12/14 20:00:29 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -55,591 +56,6 @@ SOFTWARE.
#include "mi.h"
#include "miline.h"
-/*
-
-The bresenham error equation used in the mi/mfb/cfb line routines is:
-
- e = error
- dx = difference in raw X coordinates
- dy = difference in raw Y coordinates
- M = # of steps in X direction
- N = # of steps in Y direction
- B = 0 to prefer diagonal steps in a given octant,
- 1 to prefer axial steps in a given octant
-
- For X major lines:
- e = 2Mdy - 2Ndx - dx - B
- -2dx <= e < 0
-
- For Y major lines:
- e = 2Ndx - 2Mdy - dy - B
- -2dy <= e < 0
-
-At the start of the line, we have taken 0 X steps and 0 Y steps,
-so M = 0 and N = 0:
-
- X major e = 2Mdy - 2Ndx - dx - B
- = -dx - B
-
- Y major e = 2Ndx - 2Mdy - dy - B
- = -dy - B
-
-At the end of the line, we have taken dx X steps and dy Y steps,
-so M = dx and N = dy:
-
- X major e = 2Mdy - 2Ndx - dx - B
- = 2dxdy - 2dydx - dx - B
- = -dx - B
- Y major e = 2Ndx - 2Mdy - dy - B
- = 2dydx - 2dxdy - dy - B
- = -dy - B
-
-Thus, the error term is the same at the start and end of the line.
-
-Let us consider clipping an X coordinate. There are 4 cases which
-represent the two independent cases of clipping the start vs. the
-end of the line and an X major vs. a Y major line. In any of these
-cases, we know the number of X steps (M) and we wish to find the
-number of Y steps (N). Thus, we will solve our error term equation.
-If we are clipping the start of the line, we will find the smallest
-N that satisfies our error term inequality. If we are clipping the
-end of the line, we will find the largest number of Y steps that
-satisfies the inequality. In that case, since we are representing
-the Y steps as (dy - N), we will actually want to solve for the
-smallest N in that equation.
-
-Case 1: X major, starting X coordinate moved by M steps
-
- -2dx <= 2Mdy - 2Ndx - dx - B < 0
- 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B
- 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx
- N <= (2Mdy + dx - B) / 2dx
-
-Since we are trying to find the smallest N that satisfies these
-equations, we should use the > inequality to find the smallest:
-
- N = floor((2Mdy - dx - B) / 2dx) + 1
- = floor((2Mdy - dx - B + 2dx) / 2dx)
- = floor((2Mdy + dx - B) / 2dx)
-
-Case 1b: X major, ending X coordinate moved to M steps
-
-Same derivations as Case 1, but we want the largest N that satisfies
-the equations, so we use the <= inequality:
-
- N = floor((2Mdy + dx - B) / 2dx)
-
-Case 2: X major, ending X coordinate moved by M steps
-
- -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0
- -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0
- -2dx <= 2Ndx - 2Mdy - dx - B < 0
- 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B
- 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx
- N >= (2Mdy - dx + B) / 2dx
-
-Since we are trying to find the highest number of Y steps that
-satisfies these equations, we need to find the smallest N, so
-we should use the >= inequality to find the smallest:
-
- N = ceiling((2Mdy - dx + B) / 2dx)
- = floor((2Mdy - dx + B + 2dx - 1) / 2dx)
- = floor((2Mdy + dx + B - 1) / 2dx)
-
-Case 2b: X major, starting X coordinate moved to M steps from end
-
-Same derivations as Case 2, but we want the smallest number of Y
-steps, so we want the highest N, so we use the < inequality:
-
- N = ceiling((2Mdy + dx + B) / 2dx) - 1
- = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1
- = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx)
- = floor((2Mdy + dx + B - 1) / 2dx)
-
-Case 3: Y major, starting X coordinate moved by M steps
-
- -2dy <= 2Ndx - 2Mdy - dy - B < 0
- 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B
- 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx
- N >= (2Mdy - dy + B) / 2dx
-
-Since we are trying to find the smallest N that satisfies these
-equations, we should use the >= inequality to find the smallest:
-
- N = ceiling((2Mdy - dy + B) / 2dx)
- = floor((2Mdy - dy + B + 2dx - 1) / 2dx)
- = floor((2Mdy - dy + B - 1) / 2dx) + 1
-
-Case 3b: Y major, ending X coordinate moved to M steps
-
-Same derivations as Case 3, but we want the largest N that satisfies
-the equations, so we use the < inequality:
-
- N = ceiling((2Mdy + dy + B) / 2dx) - 1
- = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1
- = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx)
- = floor((2Mdy + dy + B - 1) / 2dx)
-
-Case 4: Y major, ending X coordinate moved by M steps
-
- -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0
- -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0
- -2dy <= 2Mdy - 2Ndx - dy - B < 0
- 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B
- 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx
- N <= (2Mdy + dy - B) / 2dx
-
-Since we are trying to find the highest number of Y steps that
-satisfies these equations, we need to find the smallest N, so
-we should use the > inequality to find the smallest:
-
- N = floor((2Mdy - dy - B) / 2dx) + 1
-
-Case 4b: Y major, starting X coordinate moved to M steps from end
-
-Same analysis as Case 4, but we want the smallest number of Y steps
-which means the largest N, so we use the <= inequality:
-
- N = floor((2Mdy + dy - B) / 2dx)
-
-Now let's try the Y coordinates, we have the same 4 cases.
-
-Case 5: X major, starting Y coordinate moved by N steps
-
- -2dx <= 2Mdy - 2Ndx - dx - B < 0
- 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B
- 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy
- M >= (2Ndx - dx + B) / 2dy
-
-Since we are trying to find the smallest M, we use the >= inequality:
-
- M = ceiling((2Ndx - dx + B) / 2dy)
- = floor((2Ndx - dx + B + 2dy - 1) / 2dy)
- = floor((2Ndx - dx + B - 1) / 2dy) + 1
-
-Case 5b: X major, ending Y coordinate moved to N steps
-
-Same derivations as Case 5, but we want the largest M that satisfies
-the equations, so we use the < inequality:
-
- M = ceiling((2Ndx + dx + B) / 2dy) - 1
- = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1
- = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy)
- = floor((2Ndx + dx + B - 1) / 2dy)
-
-Case 6: X major, ending Y coordinate moved by N steps
-
- -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0
- -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0
- -2dx <= 2Ndx - 2Mdy - dx - B < 0
- 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B
- 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy
- M <= (2Ndx + dx - B) / 2dy
-
-Largest # of X steps means smallest M, so use the > inequality:
-
- M = floor((2Ndx - dx - B) / 2dy) + 1
-
-Case 6b: X major, starting Y coordinate moved to N steps from end
-
-Same derivations as Case 6, but we want the smallest # of X steps
-which means the largest M, so use the <= inequality:
-
- M = floor((2Ndx + dx - B) / 2dy)
-
-Case 7: Y major, starting Y coordinate moved by N steps
-
- -2dy <= 2Ndx - 2Mdy - dy - B < 0
- 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B
- 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy
- M <= (2Ndx + dy - B) / 2dy
-
-To find the smallest M, use the > inequality:
-
- M = floor((2Ndx - dy - B) / 2dy) + 1
- = floor((2Ndx - dy - B + 2dy) / 2dy)
- = floor((2Ndx + dy - B) / 2dy)
-
-Case 7b: Y major, ending Y coordinate moved to N steps
-
-Same derivations as Case 7, but we want the largest M that satisfies
-the equations, so use the <= inequality:
-
- M = floor((2Ndx + dy - B) / 2dy)
-
-Case 8: Y major, ending Y coordinate moved by N steps
-
- -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0
- -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0
- -2dy <= 2Mdy - 2Ndx - dy - B < 0
- 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B
- 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy
- M >= (2Ndx - dy + B) / 2dy
-
-To find the highest X steps, find the smallest M, use the >= inequality:
-
- M = ceiling((2Ndx - dy + B) / 2dy)
- = floor((2Ndx - dy + B + 2dy - 1) / 2dy)
- = floor((2Ndx + dy + B - 1) / 2dy)
-
-Case 8b: Y major, starting Y coordinate moved to N steps from the end
-
-Same derivations as Case 8, but we want to find the smallest # of X
-steps which means the largest M, so we use the < inequality:
-
- M = ceiling((2Ndx + dy + B) / 2dy) - 1
- = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1
- = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy)
- = floor((2Ndx + dy + B - 1) / 2dy)
-
-So, our equations are:
-
- 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx)
- 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx)
- 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx)
- 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx)
-
- 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1
- 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx)
- 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1
- 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx)
-
- 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1
- 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy)
- 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1
- 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy)
-
- 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy)
- 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy)
- 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy)
- 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy)
-
-We have the following constraints on all of the above terms:
-
- 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine
- 0 <= dx/dy <= 2^16 - 1
- 0 <= B <= 1
-
-The floor in all of the above equations can be accomplished with a
-simple C divide operation provided that both numerator and denominator
-are positive.
-
-Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0
-and moving a Y coordinate implies dy != 0, we know that the denominators
-are all > 0.
-
-For all lines, (-B) and (B-1) are both either 0 or -1, depending on the
-bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1
-or > 0 to prove that the numerators are positive (or zero).
-
-For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the
-constraints, the first four equations all have numerators >= 0.
-
-For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy
-So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy
-or (2Mdy + dy) > 0. So all of their numerators are >= 0.
-
-For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx)
->= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0.
-
-For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators
-are > 0.
-
-To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This
-is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1)
- <= 2^16 * (2^16 - 1) + (2^16 - 1)
- <= 2^32 - 2^16 + 2^16 - 1
- <= 2^32 - 1
-Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of
-the numerator is therefore (2^32 - 1), which does not overflow an unsigned
-32 bit variable.
-
-*/
-
-#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
-{\
- if (x < xmin) outcode |= OUT_LEFT;\
- if (x > xmax) outcode |= OUT_RIGHT;\
- if (y < ymin) outcode |= OUT_ABOVE;\
- if (y > ymax) outcode |= OUT_BELOW;\
-}
-
-/* Bit codes for the terms of the 16 clipping equations defined below. */
-
-#define T_2NDX (1 << 0)
-#define T_2MDY (0) /* implicit term */
-#define T_DXNOTY (1 << 1)
-#define T_DYNOTX (0) /* implicit term */
-#define T_SUBDXORY (1 << 2)
-#define T_ADDDX (T_DXNOTY) /* composite term */
-#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */
-#define T_ADDDY (T_DYNOTX) /* composite term */
-#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */
-#define T_BIASSUBONE (1 << 3)
-#define T_SUBBIAS (0) /* implicit term */
-#define T_DIV2DX (1 << 4)
-#define T_DIV2DY (0) /* implicit term */
-#define T_ADDONE (1 << 5)
-
-/* Bit masks defining the 16 equations used in miZeroClipLine. */
-
-#define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX)
-#define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX)
-#define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX)
-#define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX)
-
-#define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE)
-#define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX)
-#define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE)
-#define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX)
-
-#define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE)
-#define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY)
-#define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE)
-#define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY)
-
-#define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY)
-#define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY)
-#define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY)
-#define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY)
-
-/* miZeroClipLine
- *
- * returns: 1 for partially clipped line
- * -1 for completely clipped line
- *
- */
-int
-miZeroClipLine(xmin, ymin, xmax, ymax,
- new_x1, new_y1, new_x2, new_y2,
- adx, ady,
- pt1_clipped, pt2_clipped, octant, bias, oc1, oc2)
- int xmin, ymin, xmax, ymax;
- int *new_x1, *new_y1, *new_x2, *new_y2;
- int *pt1_clipped, *pt2_clipped;
- unsigned int adx, ady;
- int octant;
- unsigned int bias;
- int oc1, oc2;
-{
- int swapped = 0;
- int clipDone = 0;
- CARD32 utmp;
- int clip1, clip2;
- int x1, y1, x2, y2;
- int x1_orig, y1_orig, x2_orig, y2_orig;
- int xmajor;
- int negslope, anchorval;
- unsigned int eqn;
-
- x1 = x1_orig = *new_x1;
- y1 = y1_orig = *new_y1;
- x2 = x2_orig = *new_x2;
- y2 = y2_orig = *new_y2;
-
- clip1 = 0;
- clip2 = 0;
-
- xmajor = IsXMajorOctant(octant);
- bias = ((bias >> octant) & 1);
-
- while (1)
- {
- if ((oc1 & oc2) != 0) /* trivial reject */
- {
- clipDone = -1;
- clip1 = oc1;
- clip2 = oc2;
- break;
- }
- else if ((oc1 | oc2) == 0) /* trivial accept */
- {
- clipDone = 1;
- if (swapped)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT(clip1, clip2);
- }
- break;
- }
- else /* have to clip */
- {
- /* only clip one point at a time */
- if (oc1 == 0)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig);
- SWAPINT(oc1, oc2);
- SWAPINT(clip1, clip2);
- swapped = !swapped;
- }
-
- clip1 |= oc1;
- if (oc1 & OUT_LEFT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = xmin - x1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = x2_orig - xmin;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmin;
- }
- else if (oc1 & OUT_ABOVE)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = ymin - y1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = y2_orig - ymin;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymin;
- }
- else if (oc1 & OUT_RIGHT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = x1_orig - xmax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * to the right of a clip rectangle.
- */
- utmp = xmax - x2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmax;
- }
- else if (oc1 & OUT_BELOW)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = y1_orig - ymax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * below the bottom of a clip rectangle.
- */
- utmp = ymax - y2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymax;
- }
-
- if (swapped)
- negslope = !negslope;
-
- utmp <<= 1; /* utmp = 2N or 2M */
- if (eqn & T_2NDX)
- utmp = (utmp * adx);
- else /* (eqn & T_2MDY) */
- utmp = (utmp * ady);
- if (eqn & T_DXNOTY)
- if (eqn & T_SUBDXORY)
- utmp -= adx;
- else
- utmp += adx;
- else /* (eqn & T_DYNOTX) */
- if (eqn & T_SUBDXORY)
- utmp -= ady;
- else
- utmp += ady;
- if (eqn & T_BIASSUBONE)
- utmp += bias - 1;
- else /* (eqn & T_SUBBIAS) */
- utmp -= bias;
- if (eqn & T_DIV2DX)
- utmp /= (adx << 1);
- else /* (eqn & T_DIV2DY) */
- utmp /= (ady << 1);
- if (eqn & T_ADDONE)
- utmp++;
-
- if (negslope)
- utmp = -utmp;
-
- if (eqn & T_2NDX) /* We are calculating X steps */
- x1 = anchorval + utmp;
- else /* else, Y steps */
- y1 = anchorval + utmp;
-
- oc1 = 0;
- MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax);
- }
- }
-
- *new_x1 = x1;
- *new_y1 = y1;
- *new_x2 = x2;
- *new_y2 = y2;
-
- *pt1_clipped = clip1;
- *pt2_clipped = clip2;
-
- return clipDone;
-}
-
-
/* Draw lineSolid, fillStyle-independent zero width lines.
*
* Must keep X and Y coordinates in "ints" at least until after they're
@@ -687,13 +103,13 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
int npt; /* number of points */
DDXPointPtr pptInit;
{
- int Nspans, current_y;
+ int Nspans, current_y = 0;
DDXPointPtr ppt;
DDXPointPtr pspanInit, spans;
int *pwidthInit, *widths, list_len;
int xleft, ytop, xright, ybottom;
int new_x1, new_y1, new_x2, new_y2;
- int x, y, x1, y1, x2, y2, xstart, ystart;
+ int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart;
int oc1, oc2;
int result;
int pt1_clipped, pt2_clipped = 0;
diff --git a/os/WaitFor.c b/os/WaitFor.c
index fbc05399c..76fa67327 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.38 2002/05/31 18:46:05 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -59,48 +60,42 @@ SOFTWARE.
#include <X11/Xwinsock.h>
#endif
#include "Xos.h" /* for strings, fcntl, time */
-
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
#include <stdio.h>
#include "X.h"
#include "misc.h"
-#include <X11/Xpoll.h>
+#ifdef __UNIXOS2__
+#define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t)
+#endif
#include "osdep.h"
+#include <X11/Xpoll.h>
#include "dixstruct.h"
#include "opaque.h"
-
#ifdef DPMSExtension
-#include "dpms.h"
-extern void DPMSSet();
-extern void DPMSGet();
-extern CARD32 DPMSStandbyTime;
-extern CARD32 DPMSSuspendTime;
-extern CARD32 DPMSOffTime;
-extern BOOL DPMSEnabled;
-extern CARD16 DPMSPowerLevel;
+#include "dpmsproc.h"
#endif
-extern fd_set AllSockets;
-extern fd_set AllClients;
-extern fd_set LastSelectMask;
-extern fd_set WellKnownConnections;
-extern fd_set EnabledDevices;
-extern fd_set ClientsWithInput;
-extern fd_set ClientsWriteBlocked;
-extern fd_set OutputPending;
-
-extern int ConnectionTranslation[];
-
-extern Bool NewOutputPending;
-extern Bool AnyClientsWriteBlocked;
+/* modifications by raphael */
+int
+mffs(fd_mask mask)
+{
+ int i;
-extern WorkQueuePtr workQueue;
+ if (!mask) return 0;
+ i = 1;
+ while (!(mask & 1))
+ {
+ i++;
+ mask >>= 1;
+ }
+ return i;
+}
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include "dpms.h"
+#endif
#ifdef XTESTEXT1
/*
@@ -116,7 +111,7 @@ struct _OsTimerRec {
pointer arg;
};
-static void DoTimer();
+static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
static OsTimerPtr timers;
/*****************
@@ -144,9 +139,9 @@ WaitForSomething(pClientsReady)
{
int i;
struct timeval waittime, *wt;
- INT32 timeout;
+ INT32 timeout = 0;
#ifdef DPMSExtension
- INT32 standbyTimeout, suspendTimeout, offTimeout;
+ INT32 standbyTimeout = 0, suspendTimeout = 0, offTimeout = 0;
#endif
fd_set clientsReadable;
fd_set clientsWritable;
@@ -154,7 +149,10 @@ WaitForSomething(pClientsReady)
int selecterr;
int nready;
fd_set devicesReadable;
- CARD32 now;
+ CARD32 now = 0;
+#ifdef SMART_SCHEDULE
+ Bool someReady = FALSE;
+#endif
FD_ZERO(&clientsReadable);
@@ -165,12 +163,32 @@ WaitForSomething(pClientsReady)
/* deal with any blocked jobs */
if (workQueue)
ProcessWorkQueue();
-
if (XFD_ANYSET (&ClientsWithInput))
{
- XFD_COPYSET (&ClientsWithInput, &clientsReadable);
- break;
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable)
+ {
+ someReady = TRUE;
+ waittime.tv_sec = 0;
+ waittime.tv_usec = 0;
+ wt = &waittime;
+ }
+ else
+#endif
+ {
+ XFD_COPYSET (&ClientsWithInput, &clientsReadable);
+ break;
+ }
}
+#ifdef SMART_SCHEDULE
+ if (someReady)
+ {
+ XFD_COPYSET(&AllSockets, &LastSelectMask);
+ XFD_UNSET(&LastSelectMask, &ClientsWithInput);
+ }
+ else
+ {
+#endif
#ifdef DPMSExtension
if (ScreenSaverTime > 0 || DPMSEnabled || timers)
#else
@@ -180,7 +198,7 @@ WaitForSomething(pClientsReady)
wt = NULL;
if (timers)
{
- while (timers && timers->expires <= now)
+ while (timers && (int) (timers->expires - now) <= 0)
DoTimer(timers, now, &timers);
if (timers)
{
@@ -193,8 +211,8 @@ WaitForSomething(pClientsReady)
}
if (ScreenSaverTime > 0
#ifdef DPMSExtension
- || (DPMSEnabled &&
- (DPMSStandbyTime > 0 || DPMSSuspendTime > 0 || DPMSOffTime > 0))
+ || (DPMSEnabled &&
+ (DPMSStandbyTime > 0 || DPMSSuspendTime > 0 || DPMSOffTime > 0))
#endif
) {
#ifdef DPMSExtension
@@ -214,11 +232,12 @@ WaitForSomething(pClientsReady)
(now - lastDeviceEventTime.milliseconds));
#endif /* DPMSExtension */
- if (timeout <= 0
+ if (
+ timeout <= 0
#ifdef DPMSExtension
&& ScreenSaverTime > 0
#endif /* DPMSExtension */
- ) {
+ ) {
INT32 timeSinceSave;
timeSinceSave = -timeout;
@@ -250,15 +269,18 @@ WaitForSomething(pClientsReady)
#ifdef DPMSExtension
if (DPMSEnabled)
{
- if (standbyTimeout > 0 && timeout > standbyTimeout)
+ if (standbyTimeout > 0
+ && (timeout <= 0 || timeout > standbyTimeout))
timeout = standbyTimeout;
- if (suspendTimeout > 0 && timeout > suspendTimeout)
+ if (suspendTimeout > 0
+ && (timeout <= 0 || timeout > suspendTimeout))
timeout = suspendTimeout;
- if (offTimeout > 0 && timeout > offTimeout)
+ if (offTimeout > 0
+ && (timeout <= 0 || timeout > offTimeout))
timeout = offTimeout;
}
#endif
- if (timeout > 0 && (!wt || timeout < (timers->expires - now)))
+ if (timeout > 0 && (!wt || timeout < (int) (timers->expires - now)))
{
waittime.tv_sec = timeout / MILLI_PER_SECOND;
waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
@@ -301,6 +323,10 @@ WaitForSomething(pClientsReady)
#endif
}
XFD_COPYSET(&AllSockets, &LastSelectMask);
+#ifdef SMART_SCHEDULE
+ }
+ SmartScheduleIdle = TRUE;
+#endif
BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
if (NewOutputPending)
FlushAllOutput();
@@ -317,10 +343,12 @@ WaitForSomething(pClientsReady)
else if (AnyClientsWriteBlocked)
{
XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable);
- i = Select (MAXSOCKS, &LastSelectMask, &clientsWritable, NULL, wt);
+ i = Select (MaxClients, &LastSelectMask, &clientsWritable, NULL, wt);
+ }
+ else
+ {
+ i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt);
}
- else
- i = Select (MAXSOCKS, &LastSelectMask, NULL, NULL, wt);
selecterr = errno;
WakeupHandler(i, (pointer)&LastSelectMask);
#ifdef XTESTEXT1
@@ -328,13 +356,21 @@ WaitForSomething(pClientsReady)
i = XTestProcessInputAction (i, &waittime);
}
#endif /* XTESTEXT1 */
+#ifdef SMART_SCHEDULE
+ if (i >= 0)
+ {
+ SmartScheduleIdle = FALSE;
+ SmartScheduleIdleCount = 0;
+ if (SmartScheduleTimerStopped)
+ (void) SmartScheduleStartTimer ();
+ }
+#endif
if (i <= 0) /* An error or timeout occurred */
{
-
if (dispatchException)
return 0;
- FD_ZERO(&clientsWritable);
if (i < 0)
+ {
if (selecterr == EBADF) /* Some client disconnected */
{
CheckConnections ();
@@ -351,10 +387,22 @@ WaitForSomething(pClientsReady)
ErrorF("WaitForSomething(): select: errno=%d\n",
selecterr);
}
+ }
+#ifdef SMART_SCHEDULE
+ else if (someReady)
+ {
+ /*
+ * If no-one else is home, bail quickly
+ */
+ XFD_COPYSET(&ClientsWithInput, &LastSelectMask);
+ XFD_COPYSET(&ClientsWithInput, &clientsReadable);
+ break;
+ }
+#endif
if (timers)
{
now = GetTimeInMillis();
- while (timers && timers->expires <= now)
+ while (timers && (int) (timers->expires - now) <= 0)
DoTimer(timers, now, &timers);
}
if (*checkForInput[0] != *checkForInput[1])
@@ -362,9 +410,11 @@ WaitForSomething(pClientsReady)
}
else
{
-#ifdef WIN32
fd_set tmp_set;
-#endif
+#ifdef SMART_SCHEDULE
+ if (someReady)
+ XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask);
+#endif
if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable))
{
NewOutputPending = TRUE;
@@ -376,12 +426,8 @@ WaitForSomething(pClientsReady)
XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices);
XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients);
-#ifndef WIN32
- if (LastSelectMask.fds_bits[0] & WellKnownConnections.fds_bits[0])
-#else
XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections);
if (XFD_ANYSET(&tmp_set))
-#endif
QueueWorkProc(EstablishNewConnections, NULL,
(pointer)&LastSelectMask);
#ifdef DPMSExtension
@@ -399,16 +445,17 @@ WaitForSomething(pClientsReady)
#ifndef WIN32
for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
{
- int highest_priority;
+ int highest_priority = 0;
while (clientsReadable.fds_bits[i])
{
int client_priority, client_index;
curclient = ffs (clientsReadable.fds_bits[i]) - 1;
- client_index = ConnectionTranslation[curclient + (i << 5)];
+ client_index = /* raphael: modified */
+ ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
#else
- int highest_priority;
+ int highest_priority = 0;
fd_set savedClientsReadable;
XFD_COPYSET(&clientsReadable, &savedClientsReadable);
for (i = 0; i < XFD_SETCOUNT(&savedClientsReadable); i++)
@@ -450,7 +497,7 @@ WaitForSomething(pClientsReady)
pClientsReady[nready++] = client_index;
}
#ifndef WIN32
- clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
+ clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient);
}
#else
FD_CLR(curclient, &clientsReadable);
@@ -476,11 +523,9 @@ ANYSET(src)
}
#endif
+
static void
-DoTimer(timer, now, prev)
- register OsTimerPtr timer;
- CARD32 now;
- OsTimerPtr *prev;
+DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
{
CARD32 newTime;
@@ -536,7 +581,7 @@ TimerSet(timer, flags, millis, func, arg)
return timer;
}
for (prev = &timers;
- *prev && millis > (*prev)->expires;
+ *prev && (int) ((*prev)->expires - millis) <= 0;
prev = &(*prev)->next)
;
timer->next = *prev;
@@ -549,7 +594,6 @@ TimerForce(timer)
register OsTimerPtr timer;
{
register OsTimerPtr *prev;
- register CARD32 newTime;
for (prev = &timers; *prev; prev = &(*prev)->next)
{
@@ -596,7 +640,7 @@ TimerCheck()
{
register CARD32 now = GetTimeInMillis();
- while (timers && timers->expires <= now)
+ while (timers && (int) (timers->expires - now) <= 0)
DoTimer(timers, now, &timers);
}
@@ -605,7 +649,7 @@ TimerInit()
{
OsTimerPtr timer;
- while (timer = timers)
+ while ((timer = timers))
{
timers = timer->next;
xfree(timer);
diff --git a/os/access.c b/os/access.c
index abca79e9d..f12c5c081 100644
--- a/os/access.c
+++ b/os/access.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/os/access.c,v 3.42 2002/07/07 20:11:52 herrb Exp $ */
#ifdef WIN32
#include <X11/Xwinsock.h>
@@ -53,60 +54,111 @@ SOFTWARE.
#include <stdio.h>
#include <X11/Xtrans.h>
#include <X11/Xauth.h>
-#include "X.h"
-#include "Xproto.h"
+#include <X.h>
+#include <Xproto.h>
#include "misc.h"
#include "site.h"
#include <errno.h>
-
+#include <sys/types.h>
#ifndef WIN32
-#ifdef ESIX
-#include <lan/socket.h>
-#else
+#ifndef Lynx
#include <sys/socket.h>
+#else
+#include <socket.h>
#endif
#include <sys/ioctl.h>
#include <ctype.h>
-#if defined(TCPCONN) || defined(STREAMSCONN) || defined(ISC)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(ISC) || defined(SCO)
#include <netinet/in.h>
-#endif /* TCPCONN || STREAMSCONN || ISC */
+#endif /* TCPCONN || STREAMSCONN || ISC || SCO */
#ifdef DNETCONN
#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>
#endif
-#ifdef hpux
+
+#if defined(DGUX)
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <ctype.h>
+#include <sys/utsname.h>
+#include <sys/stream.h>
+#include <sys/stropts.h>
+#include <sys/param.h>
+#include <sys/sockio.h>
+#endif
+
+
+#if defined(hpux) || defined(QNX4)
# include <sys/utsname.h>
# ifdef HAS_IFREQ
# include <net/if.h>
# endif
#else
-#if defined(SVR4) || (defined(SYSV) && defined(i386))
+#if defined(SVR4) || (defined(SYSV) && defined(i386)) || defined(__GNU__)
# include <sys/utsname.h>
#endif
#if defined(SYSV) && defined(i386)
# include <sys/stream.h>
+# ifdef ISC
+# include <sys/stropts.h>
+# include <sys/sioctl.h>
+# endif /* ISC */
#endif
-#ifdef ESIX
-# include <lan/if.h>
-#else
+#ifdef __GNU__
+#undef SIOCGIFCONF
+#include <netdb.h>
+#else /*!__GNU__*/
# include <net/if.h>
-#endif
+#endif /*__GNU__ */
#endif /* hpux */
#ifdef SVR4
+#ifndef SCO
#include <sys/sockio.h>
#endif
+#include <sys/stropts.h>
+#endif
-#ifdef ESIX
-#include <lan/netdb.h>
-#else
#include <netdb.h>
+
+#ifdef CSRG_BASED
+#include <sys/param.h>
+#if (BSD >= 199103)
+#define VARIABLE_IFREQ
+#endif
+#endif
+
+#ifdef BSD44SOCKETS
+#ifndef VARIABLE_IFREQ
+#define VARIABLE_IFREQ
+#endif
+#endif
+
+#ifdef HAS_GETIFADDRS
+#include <ifaddrs.h>
#endif
#endif /* WIN32 */
+#ifndef PATH_MAX
+#ifndef Lynx
+#include <sys/param.h>
+#else
+#include <param.h>
+#endif
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif
+
#define X_INCLUDE_NETDB_H
#include <X11/Xos_r.h>
@@ -127,29 +179,17 @@ Bool defeatAccessControl = FALSE;
(length) == (host)->len &&\
!acmp (address, (host)->addr, length))
-static int ConvertAddr(
-#if NeedFunctionPrototypes
- struct sockaddr */*saddr*/,
- int */*len*/,
- pointer */*addr*/
-#endif
-);
+static int ConvertAddr(struct sockaddr */*saddr*/,
+ int */*len*/,
+ pointer */*addr*/);
-static int CheckAddr(
-#if NeedFunctionPrototypes
- int /*family*/,
- pointer /*pAddr*/,
- unsigned /*length*/
-#endif
-);
+static int CheckAddr(int /*family*/,
+ pointer /*pAddr*/,
+ unsigned /*length*/);
-static Bool NewHost(
-#if NeedFunctionPrototypes
- int /*family*/,
- pointer /*addr*/,
- int /*len*/
-#endif
-);
+static Bool NewHost(int /*family*/,
+ pointer /*addr*/,
+ int /*len*/);
typedef struct _host {
short family;
@@ -175,7 +215,7 @@ static int UsingXdmcp = FALSE;
*/
void
-EnableLocalHost ()
+EnableLocalHost (void)
{
if (!UsingXdmcp)
{
@@ -188,7 +228,7 @@ EnableLocalHost ()
* called when authorization is enabled to keep us secure
*/
void
-DisableLocalHost ()
+DisableLocalHost (void)
{
HOST *self;
@@ -203,13 +243,66 @@ DisableLocalHost ()
*/
void
-AccessUsingXdmcp ()
+AccessUsingXdmcp (void)
{
UsingXdmcp = TRUE;
LocalHostEnabled = FALSE;
}
+#if ((defined(SVR4) && !defined(DGUX) && !defined(SCO325) && !defined(sun) && !defined(NCR)) || defined(ISC)) && defined(SIOCGIFCONF)
+
+/* Deal with different SIOCGIFCONF ioctl semantics on these OSs */
+
+static int
+ifioctl (int fd, int cmd, char *arg)
+{
+ struct strioctl ioc;
+ int ret;
+
+ bzero((char *) &ioc, sizeof(ioc));
+ ioc.ic_cmd = cmd;
+ ioc.ic_timout = 0;
+ if (cmd == SIOCGIFCONF)
+ {
+ ioc.ic_len = ((struct ifconf *) arg)->ifc_len;
+ ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf;
+#ifdef ISC
+ /* SIOCGIFCONF is somewhat brain damaged on ISC. The argument
+ * buffer must contain the ifconf structure as header. Ifc_req
+ * is also not a pointer but a one element array of ifreq
+ * structures. On return this array is extended by enough
+ * ifreq fields to hold all interfaces. The return buffer length
+ * is placed in the buffer header.
+ */
+ ((struct ifconf *) ioc.ic_dp)->ifc_len =
+ ioc.ic_len - sizeof(struct ifconf);
+#endif
+ }
+ else
+ {
+ ioc.ic_len = sizeof(struct ifreq);
+ ioc.ic_dp = arg;
+ }
+ ret = ioctl(fd, I_STR, (char *) &ioc);
+ if (ret >= 0 && cmd == SIOCGIFCONF)
+#ifdef SVR4
+ ((struct ifconf *) arg)->ifc_len = ioc.ic_len;
+#endif
+#ifdef ISC
+ {
+ ((struct ifconf *) arg)->ifc_len =
+ ((struct ifconf *)ioc.ic_dp)->ifc_len;
+ ((struct ifconf *) arg)->ifc_buf =
+ (caddr_t)((struct ifconf *)ioc.ic_dp)->ifc_req;
+ }
+#endif
+ return(ret);
+}
+#else /* Case DGUX, sun, SCO325 NCR and others */
+#define ifioctl ioctl
+#endif /* ((SVR4 && !DGUX !sun !SCO325 !NCR) || ISC) && SIOCGIFCONF */
+
/*
* DefineSelf (fd):
*
@@ -231,8 +324,7 @@ AccessUsingXdmcp ()
#include <netinet/in_var.h>
void
-DefineSelf (fd)
- int fd;
+DefineSelf (int fd)
{
/*
* The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the
@@ -249,7 +341,7 @@ DefineSelf (fd)
int family, len;
if ((fd = open ("/dev/ip", O_RDWR, 0 )) < 0)
- Error ("Getting interface configuration");
+ Error ("Getting interface configuration (1)");
/* Indicate that we want to start at the begining */
ifnet.ib_next = (struct ipb *) 1;
@@ -264,7 +356,7 @@ DefineSelf (fd)
if (ioctl (fd, (int) I_STR, (char *) &str) < 0)
{
close (fd);
- Error ("Getting interface configuration");
+ Error ("Getting interface configuration (2)");
}
ifaddr.ia_next = (struct in_ifaddr *) ifnet.if_addrlist;
@@ -276,7 +368,7 @@ DefineSelf (fd)
if (ioctl (fd, (int) I_STR, (char *) &str) < 0)
{
close (fd);
- Error ("Getting interface configuration");
+ Error ("Getting interface configuration (3)");
}
len = sizeof(struct sockaddr_in);
@@ -354,12 +446,11 @@ DefineSelf (fd)
#else /* WINTCP */
-#if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ))
+#if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ)) || defined(QNX4)
void
-DefineSelf (fd)
- int fd;
+DefineSelf (int fd)
{
-#if !defined(TCPCONN) && !defined(UNIXCONN)
+#if !defined(TCPCONN) && !defined(STREAMSCONN) && !defined(UNIXCONN) && !defined(MNX_TCPCONN)
return;
#else
register int n;
@@ -368,12 +459,7 @@ DefineSelf (fd)
int family;
register HOST *host;
-#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
- || defined(WIN32)
- char name[100];
-#else
struct utsname name;
-#endif
register struct hostent *hp;
union {
@@ -383,23 +469,26 @@ DefineSelf (fd)
struct sockaddr_in *inetaddr;
struct sockaddr_in broad_addr;
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
+#endif
-#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
- || defined(WIN32)
- if (gethostname (name, sizeof name) < 0)
- hp = NULL;
- else
- hp = _XGethostbyname(name, hparams);
-#else
/* Why not use gethostname()? Well, at least on my system, I've had to
* make an ugly kernel patch to get a name longer than 8 characters, and
* uname() lets me access to the whole string (it smashes release, you
* see), whereas gethostname() kindly truncates it for me.
*/
+#ifndef QNX4
uname(&name);
- hp = _XGethostbyname(name.nodename, hparams);
+#else
+ /* QNX4's uname returns node number in name.nodename, not the hostname
+ have to overwrite it */
+ char hname[1024];
+ gethostname(hname, 1024);
+ name.nodename = hname;
#endif
+
+ hp = _XGethostbyname(name.nodename, hparams);
if (hp != NULL)
{
saddr.sa.sa_family = hp->h_addrtype;
@@ -463,22 +552,44 @@ DefineSelf (fd)
selfhosts = host;
}
}
-#endif /* !TCPCONN && !UNIXCONN */
+#endif /* !TCPCONN && !STREAMSCONN && !UNIXCONN && !MNX_TCPCONN */
}
#else
+
+#ifdef VARIABLE_IFREQ
+#define ifr_size(p) (sizeof (struct ifreq) + \
+ (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \
+ p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0))
+#define ifraddr_size(a) (a.sa_len)
+#else
+#ifdef QNX4
+#define ifr_size(p) (p->ifr_addr.sa_len + IFNAMSIZ)
+#define ifraddr_size(a) (a.sa_len)
+#else
+#define ifr_size(p) (sizeof (struct ifreq))
+#define ifraddr_size(a) (sizeof (a))
+#endif
+#endif
+
+#ifdef DEF_SELF_DEBUG
+#include <arpa/inet.h>
+#endif
+
void
-DefineSelf (fd)
- int fd;
+DefineSelf (int fd)
{
- char buf[2048];
+#ifndef HAS_GETIFADDRS
+ char buf[2048], *cp, *cplim;
struct ifconf ifc;
- register int n;
+ register struct ifreq *ifr;
+#else
+ struct ifaddrs * ifap, *ifr;
+#endif
int len;
unsigned char * addr;
int family;
register HOST *host;
- register struct ifreq *ifr;
#ifdef DNETCONN
struct dn_naddr *dnaddr = getnodeadd();
@@ -508,23 +619,25 @@ DefineSelf (fd)
}
}
}
-#endif
+#endif /* DNETCONN */
+#ifndef HAS_GETIFADDRS
ifc.ifc_len = sizeof (buf);
ifc.ifc_buf = buf;
- if (ioctl (fd, (int) SIOCGIFCONF, (pointer) &ifc) < 0)
- Error ("Getting interface configuration");
- for (ifr = ifc.ifc_req
-#ifdef BSD44SOCKETS
- ; (char *)ifr < ifc.ifc_buf + ifc.ifc_len;
- ifr = (struct ifreq *)((char *)ifr + sizeof (struct ifreq) +
- (ifr->ifr_addr.sa_len > sizeof (ifr->ifr_addr) ?
- ifr->ifr_addr.sa_len - sizeof (ifr->ifr_addr) : 0))
+ if (ifioctl (fd, SIOCGIFCONF, (pointer) &ifc) < 0)
+ Error ("Getting interface configuration (4)");
+
+#ifdef ISC
+#define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf
#else
- , n = ifc.ifc_len / sizeof (struct ifreq); --n >= 0; ifr++
-#endif
- )
+#define IFC_IFC_REQ ifc.ifc_req
+#endif /* ISC */
+
+ cplim = (char *) IFC_IFC_REQ + ifc.ifc_len;
+
+ for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr))
{
- len = sizeof(ifr->ifr_addr);
+ ifr = (struct ifreq *) cp;
+ len = ifraddr_size (ifr->ifr_addr);
#ifdef DNETCONN
/*
* DECnet was handled up above.
@@ -535,6 +648,11 @@ DefineSelf (fd)
family = ConvertAddr (&ifr->ifr_addr, &len, (pointer *)&addr);
if (family == -1 || family == FamilyLocal)
continue;
+#ifdef DEF_SELF_DEBUG
+ if (family == FamilyInternet)
+ ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n",
+ ifr->ifr_name, addr[0], addr[1], addr[2], addr[3]);
+#endif /* DEF_SELF_DEBUG */
for (host = selfhosts;
host && !addrEqual (family, addr, len, host);
host = host->next)
@@ -578,13 +696,13 @@ DefineSelf (fd)
struct ifreq broad_req;
broad_req = *ifr;
- if (ioctl (fd, SIOCGIFFLAGS, (char *) &broad_req) != -1 &&
+ if (ifioctl (fd, SIOCGIFFLAGS, (char *) &broad_req) != -1 &&
(broad_req.ifr_flags & IFF_BROADCAST) &&
(broad_req.ifr_flags & IFF_UP)
)
{
broad_req = *ifr;
- if (ioctl (fd, SIOCGIFBRDADDR, &broad_req) != -1)
+ if (ifioctl (fd, SIOCGIFBRDADDR, &broad_req) != -1)
broad_addr = broad_req.ifr_addr;
else
continue;
@@ -592,11 +710,84 @@ DefineSelf (fd)
else
continue;
}
-#endif
+#endif /* SIOCGIFBRDADDR */
+#ifdef DEF_SELF_DEBUG
+ ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n",
+ ifr->ifr_name,
+ inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr));
+#endif /* DEF_SELF_DEBUG */
XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr);
}
-#endif
+#endif /* XDMCP */
+ }
+#else /* HAS_GETIFADDRS */
+ if (getifaddrs(&ifap) < 0) {
+ ErrorF("Warning: getifaddrs returns %s\n", strerror(errno));
+ return;
}
+ for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) {
+#ifdef DNETCONN
+ if (ifr->ifa_addr.sa_family == AF_DECnet)
+ continue;
+#endif /* DNETCONN */
+ family = ConvertAddr(ifr->ifa_addr, &len, (pointer *)&addr);
+ if (family == -1 || family == FamilyLocal)
+ continue;
+#ifdef DEF_SELF_DEBUG
+ if (family == FamilyInternet)
+ ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n",
+ ifr->ifa_name, addr[0], addr[1], addr[2], addr[3]);
+#endif /* DEF_SELF_DEBUG */
+ for (host = selfhosts;
+ host != NULL && !addrEqual(family, addr, len, host);
+ host = host->next)
+ ;
+ if (host != NULL)
+ continue;
+ MakeHost(host, len);
+ if (host != NULL) {
+ host->family = family;
+ host->len = len;
+ acopy(addr, host->addr, len);
+ host->next = selfhosts;
+ selfhosts = host;
+ }
+#ifdef XDMCP
+ {
+ struct sockaddr broad_addr;
+ /*
+ * If this isn't an Internet Address, don't register it.
+ */
+ if (family != FamilyInternet)
+ continue;
+ /*
+ * ignore 'localhost' entries as they're not usefule
+ * on the other end of the wire
+ */
+ if (len == 4 &&
+ addr[0] == 127 && addr[1] == 0 &&
+ addr[2] == 0 && addr[2] == 1)
+ continue;
+ XdmcpRegisterConnection(family, (char *)addr, len);
+ if ((ifr->ifa_flags & IFF_BROADCAST) &&
+ (ifr->ifa_flags & IFF_UP))
+ broad_addr = *ifr->ifa_broadaddr;
+ else
+ continue;
+#ifdef DEF_SELF_DEBUG
+ ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n",
+ ifr->ifa_name,
+ inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr));
+#endif /* DEF_SELF_DEBUG */
+ XdmcpRegisterBroadcastAddress((struct sockaddr_in *)
+ &broad_addr);
+ }
+#endif /* XDMCP */
+
+ } /* for */
+ freeifaddrs(ifap);
+#endif /* HAS_GETIFADDRS */
+
/*
* add something of FamilyLocalHost
*/
@@ -621,9 +812,7 @@ DefineSelf (fd)
#ifdef XDMCP
void
-AugmentSelf(from, len)
- pointer from;
- int len;
+AugmentSelf(pointer from, int len)
{
int family;
pointer addr;
@@ -649,7 +838,7 @@ AugmentSelf(from, len)
#endif
void
-AddLocalHosts ()
+AddLocalHosts (void)
{
HOST *self;
@@ -657,25 +846,21 @@ AddLocalHosts ()
(void) NewHost (self->family, self->addr, self->len);
}
-static char* etcx_hosts = NULL;
-
/* Reset access control list to initial hosts */
void
-ResetHosts (display)
- char *display;
+ResetHosts (char *display)
{
register HOST *host;
char lhostname[120], ohostname[120];
char *hostname = ohostname;
+ char fname[PATH_MAX + 1];
int fnamelen;
- char* etcstr = "/etc/X";
- char* dothoststr = ".hosts";
FILE *fd;
char *ptr;
int i, hostlen;
union {
struct sockaddr sa;
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
struct sockaddr_in in;
#endif /* TCPCONN || STREAMSCONN */
#ifdef DNETCONN
@@ -690,42 +875,41 @@ ResetHosts (display)
krb5_principal princ;
krb5_data kbuf;
#endif
- int family;
+ int family = 0;
pointer addr;
int len;
register struct hostent *hp;
AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL;
LocalHostEnabled = FALSE;
- while (host = validhosts)
+ while ((host = validhosts) != 0)
{
validhosts = host->next;
FreeHost (host);
}
- if (etcx_hosts == NULL) {
- fnamelen = strlen (display);
- fnamelen += strlen (etcstr);
- fnamelen += strlen (dothoststr);
- etcx_hosts = (char*) xalloc (fnamelen + 1); /* A memory leak? No! */
- /* eventually could use snprintf, when more systems have it */
- sprintf (etcx_hosts, "%s%s%s", etcstr, display, dothoststr);
-#ifndef WIN32
-#ifdef PATH_MAX
- if (fnamelen > PATH_MAX) {
- /* punish stupid hackers */
- strcpy (etcx_hosts, "/dev/zero");
- }
-#endif
-#endif
- }
- if (fd = fopen (etcx_hosts, "r"))
+#define ETC_HOST_PREFIX "/etc/X"
+#define ETC_HOST_SUFFIX ".hosts"
+ fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) +
+ strlen(display) + 1;
+ if (fnamelen > sizeof(fname))
+ FatalError("Display name `%s' is too long\n", display);
+ sprintf(fname, ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display);
+#ifdef __UNIXOS2__
+ strcpy(fname, (char*)__XOS2RedirRoot(fname));
+#endif /* __UNIXOS2__ */
+
+ if ((fd = fopen (fname, "r")) != 0)
{
while (fgets (ohostname, sizeof (ohostname), fd))
{
if (*ohostname == '#')
continue;
- if (ptr = strchr(ohostname, '\n'))
+ if ((ptr = strchr(ohostname, '\n')) != 0)
+ *ptr = 0;
+#ifdef __UNIXOS2__
+ if ((ptr = strchr(ohostname, '\r')) != 0)
*ptr = 0;
+#endif
hostlen = strlen(ohostname) + 1;
for (i = 0; i < hostlen; i++)
lhostname[i] = tolower(ohostname[i]);
@@ -735,7 +919,7 @@ ResetHosts (display)
family = FamilyLocalHost;
NewHost(family, "", 0);
}
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
else if (!strncmp("inet:", lhostname, 5))
{
family = FamilyInternet;
@@ -807,14 +991,16 @@ ResetHosts (display)
}
else
#endif /* SECURE_RPC */
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
{
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
+#endif
/* host name */
- if (family == FamilyInternet &&
- (hp = _XGethostbyname(hostname, hparams)) ||
- (hp = _XGethostbyname(hostname, hparams)))
+ if ((family == FamilyInternet &&
+ ((hp = _XGethostbyname(hostname, hparams)) != 0)) ||
+ ((hp = _XGethostbyname(hostname, hparams)) != 0))
{
saddr.sa.sa_family = hp->h_addrtype;
len = sizeof(saddr.sa);
@@ -840,8 +1026,7 @@ ResetHosts (display)
}
/* Is client on the local host */
-Bool LocalClient(client)
- ClientPtr client;
+Bool LocalClient(ClientPtr client)
{
int alen, family, notused;
Xtransaddr *from = NULL;
@@ -886,9 +1071,57 @@ Bool LocalClient(client)
return FALSE;
}
+/*
+ * Return the uid and gid of a connected local client
+ * or the uid/gid for nobody those ids cannot be determinded
+ *
+ * Used by XShm to test access rights to shared memory segments
+ */
+int
+LocalClientCred(ClientPtr client, int *pUid, int *pGid)
+{
+ int fd;
+ XtransConnInfo ci;
+#ifdef HAS_GETPEEREID
+ uid_t uid;
+ gid_t gid;
+#elif defined(SO_PEERCRED)
+ struct ucred peercred;
+ socklen_t so_len = sizeof(peercred);
+#endif
+
+ if (client == NULL)
+ return -1;
+ ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+ /* We can only determine peer credentials for Unix domain sockets */
+ if (!_XSERVTransIsLocal(ci)) {
+ return -1;
+ }
+ fd = _XSERVTransGetConnectionNumber(ci);
+#ifdef HAS_GETPEEREID
+ if (getpeereid(fd, &uid, &gid) == -1)
+ return -1;
+ if (pUid != NULL)
+ *pUid = uid;
+ if (pGid != NULL)
+ *pGid = gid;
+ return 0;
+#elif defined(SO_PEERCRED)
+ if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1)
+ return -1;
+ if (pUid != NULL)
+ *pUid = peercred.uid;
+ if (pGid != NULL)
+ *pGid = peercred.gid;
+ return 0;
+#else
+ /* No system call available to get the credentials of the peer */
+ return -1;
+#endif
+}
+
static Bool
-AuthorizedClient(client)
- ClientPtr client;
+AuthorizedClient(ClientPtr client)
{
if (!client || defeatAccessControl)
return TRUE;
@@ -899,11 +1132,10 @@ AuthorizedClient(client)
* called from the dispatcher */
int
-AddHost (client, family, length, pAddr)
- ClientPtr client;
- int family;
- unsigned length; /* of bytes in pAddr */
- pointer pAddr;
+AddHost (ClientPtr client,
+ int family,
+ unsigned length, /* of bytes in pAddr */
+ pointer pAddr)
{
int len;
@@ -945,10 +1177,12 @@ AddHost (client, family, length, pAddr)
}
Bool
-ForEachHostInFamily (family, func, closure)
- int family;
- Bool (*func)();
- pointer closure;
+ForEachHostInFamily (int family,
+ Bool (*func)(
+ unsigned char * /* addr */,
+ short /* len */,
+ pointer /* closure */),
+ pointer closure)
{
HOST *host;
@@ -961,10 +1195,9 @@ ForEachHostInFamily (family, func, closure)
/* Add a host to the access control list. This is the internal interface
* called when starting or resetting the server */
static Bool
-NewHost (family, addr, len)
- int family;
- pointer addr;
- int len;
+NewHost (int family,
+ pointer addr,
+ int len)
{
register HOST *host;
@@ -987,11 +1220,11 @@ NewHost (family, addr, len)
/* Remove a host from the access control list */
int
-RemoveHost (client, family, length, pAddr)
- ClientPtr client;
- int family;
- unsigned length; /* of bytes in pAddr */
- pointer pAddr;
+RemoveHost (
+ ClientPtr client,
+ int family,
+ unsigned length, /* of bytes in pAddr */
+ pointer pAddr)
{
int len;
register HOST *host, **prev;
@@ -1041,11 +1274,11 @@ RemoveHost (client, family, length, pAddr)
/* Get all hosts in the access control list */
int
-GetHosts (data, pnHosts, pLen, pEnabled)
- pointer *data;
- int *pnHosts;
- int *pLen;
- BOOL *pEnabled;
+GetHosts (
+ pointer *data,
+ int *pnHosts,
+ int *pLen,
+ BOOL *pEnabled)
{
int len;
register int n = 0;
@@ -1087,16 +1320,16 @@ GetHosts (data, pnHosts, pLen, pEnabled)
/*ARGSUSED*/
static int
-CheckAddr (family, pAddr, length)
- int family;
- pointer pAddr;
- unsigned length;
+CheckAddr (
+ int family,
+ pointer pAddr,
+ unsigned length)
{
int len;
switch (family)
{
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) || defined(MNX_TCPCONN)
case FamilyInternet:
if (length == sizeof (struct in_addr))
len = length;
@@ -1128,9 +1361,10 @@ CheckAddr (family, pAddr, length)
/* Check if a host is not in the access control list.
* Returns 1 if host is invalid, 0 if we've found it. */
-InvalidHost (saddr, len)
- register struct sockaddr *saddr;
- int len;
+int
+InvalidHost (
+ register struct sockaddr *saddr,
+ int len)
{
int family;
pointer addr;
@@ -1171,21 +1405,21 @@ InvalidHost (saddr, len)
}
static int
-ConvertAddr (saddr, len, addr)
- register struct sockaddr *saddr;
- int *len;
- pointer *addr;
+ConvertAddr (
+ register struct sockaddr *saddr,
+ int *len,
+ pointer *addr)
{
if (*len == 0)
return (FamilyLocal);
switch (saddr->sa_family)
{
case AF_UNSPEC:
-#if defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
case AF_UNIX:
#endif
return FamilyLocal;
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
case AF_INET:
*len = sizeof (struct in_addr);
*addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr);
@@ -1213,9 +1447,9 @@ ConvertAddr (saddr, len, addr)
}
int
-ChangeAccessControl(client, fEnabled)
- ClientPtr client;
- int fEnabled;
+ChangeAccessControl(
+ ClientPtr client,
+ int fEnabled)
{
if (!AuthorizedClient(client))
return BadAccess;
@@ -1225,8 +1459,7 @@ ChangeAccessControl(client, fEnabled)
/* returns FALSE if xhost + in effect, else TRUE */
int
-GetAccessControl()
+GetAccessControl(void)
{
return AccessEnabled;
}
-
diff --git a/os/auth.c b/os/auth.c
index 7b914bb28..b596aed44 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.12 2002/12/09 02:56:03 dawes Exp $ */
/*
* authorization hooks for the server
@@ -35,9 +36,10 @@ from The Open Group.
#ifdef K5AUTH
# include <krb5/krb5.h>
#endif
-# include "X.h"
-# include "Xauth.h"
+# include <X11/X.h>
+# include <X11/Xauth.h>
# include "misc.h"
+# include "osdep.h"
# include "dixstruct.h"
# include <sys/types.h>
# include <sys/stat.h>
@@ -52,50 +54,17 @@ from The Open Group.
struct protocol {
unsigned short name_length;
char *name;
- int (*Add)(); /* new authorization data */
- XID (*Check)(); /* verify client authorization data */
- int (*Reset)(); /* delete all authorization data entries */
- XID (*ToID)(); /* convert cookie to ID */
- int (*FromID)(); /* convert ID to cookie */
- int (*Remove)(); /* remove a specific cookie */
+ AuthAddCFunc Add; /* new authorization data */
+ AuthCheckFunc Check; /* verify client authorization data */
+ AuthRstCFunc Reset; /* delete all authorization data entries */
+ AuthToIDFunc ToID; /* convert cookie to ID */
+ AuthFromIDFunc FromID; /* convert ID to cookie */
+ AuthRemCFunc Remove; /* remove a specific cookie */
#ifdef XCSECURITY
- XID (*Generate)();
+ AuthGenCFunc Generate;
#endif
};
-extern int MitAddCookie ();
-extern XID MitCheckCookie ();
-extern int MitResetCookie ();
-extern XID MitToID ();
-extern int MitFromID (), MitRemoveCookie ();
-extern XID MitGenerateCookie();
-
-#ifdef HASXDMAUTH
-extern int XdmAddCookie ();
-extern XID XdmCheckCookie ();
-extern int XdmResetCookie ();
-extern XID XdmToID ();
-extern int XdmFromID (), XdmRemoveCookie ();
-#endif
-
-#ifdef SECURE_RPC
-extern int SecureRPCAdd();
-extern XID SecureRPCCheck();
-extern int SecureRPCReset();
-extern XID SecureRPCToID();
-extern int SecureRPCFromID(), SecureRPCRemove();
-#endif
-
-#ifdef K5AUTH
-extern int K5Add();
-extern XID K5Check();
-extern int K5Reset();
-extern XID K5ToID();
-extern int K5FromID(), K5Remove();
-#endif
-
-extern XID AuthSecurityCheck();
-
static struct protocol protocols[] = {
{ (unsigned short) 18, "MIT-MAGIC-COOKIE-1",
MitAddCookie, MitCheckCookie, MitResetCookie,
@@ -154,27 +123,39 @@ static char *authorization_file = (char *)NULL;
static Bool ShouldLoadAuth = TRUE;
void
-InitAuthorization (file_name)
-char *file_name;
+InitAuthorization (char *file_name)
{
authorization_file = file_name;
}
int
-LoadAuthorization ()
+LoadAuthorization (void)
{
FILE *f;
Xauth *auth;
int i;
int count = 0;
+#if !defined(WIN32) && !defined(__UNIXOS2__)
+ char *buf;
+#endif
ShouldLoadAuth = FALSE;
if (!authorization_file)
return 0;
+#if !defined(WIN32) && !defined(__UNIXOS2__)
+ buf = xalloc (strlen(authorization_file) + 5);
+ if (!buf)
+ return -1;
+ sprintf (buf, "cat %s", authorization_file);
+ f = Popen (buf, "r");
+ xfree (buf);
+#else
f = fopen (authorization_file, "r");
+#endif
if (!f)
- return 0;
- while (auth = XauReadAuth (f)) {
+ return -1;
+
+ while ((auth = XauReadAuth (f)) != 0) {
for (i = 0; i < NUM_AUTHORIZATION; i++) {
if (protocols[i].name_length == auth->name_length &&
memcmp (protocols[i].name, auth->name, (int) auth->name_length) == 0 &&
@@ -187,7 +168,13 @@ LoadAuthorization ()
}
XauDisposeAuth (auth);
}
+
+#if !defined(WIN32) && !defined(__UNIXOS2__)
+ if (Pclose (f) != 0)
+ return -1;
+#else
fclose (f);
+#endif
return count;
}
@@ -197,7 +184,7 @@ LoadAuthorization ()
* schemes supported by the display
*/
void
-RegisterAuthorizations ()
+RegisterAuthorizations (void)
{
int i;
@@ -208,17 +195,18 @@ RegisterAuthorizations ()
#endif
XID
-CheckAuthorization (name_length, name, data_length, data, client, reason)
- unsigned int name_length;
- char *name;
- unsigned int data_length;
- char *data;
- ClientPtr client;
- char **reason; /* failure message. NULL for default msg */
+CheckAuthorization (
+ unsigned int name_length,
+ char *name,
+ unsigned int data_length,
+ char *data,
+ ClientPtr client,
+ char **reason) /* failure message. NULL for default msg */
{
int i;
struct stat buf;
static time_t lastmod = 0;
+ static Bool loaded = FALSE;
if (!authorization_file || stat(authorization_file, &buf))
{
@@ -234,24 +222,45 @@ CheckAuthorization (name_length, name, data_length, data, client, reason)
}
if (ShouldLoadAuth)
{
- if (LoadAuthorization())
+ int loadauth = LoadAuthorization();
+
+ /*
+ * If the authorization file has at least one entry for this server,
+ * disable local host access. (loadauth > 0)
+ *
+ * If there are zero entries (either initially or when the
+ * authorization file is later reloaded), or if a valid
+ * authorization file was never loaded, enable local host access.
+ * (loadauth == 0 || !loaded)
+ *
+ * If the authorization file was loaded initially (with valid
+ * entries for this server), and reloading it later fails, don't
+ * change anything. (loadauth == -1 && loaded)
+ */
+
+ if (loadauth > 0)
+ {
DisableLocalHost(); /* got at least one */
- else
+ loaded = TRUE;
+ }
+ else if (loadauth == 0 || !loaded)
EnableLocalHost ();
}
- if (name_length)
+ if (name_length) {
for (i = 0; i < NUM_AUTHORIZATION; i++) {
if (protocols[i].name_length == name_length &&
memcmp (protocols[i].name, name, (int) name_length) == 0)
{
return (*protocols[i].Check) (data_length, data, client, reason);
}
+ *reason = "Protocol not supported by server\n";
}
+ } else *reason = "No protocol specified\n";
return (XID) ~0L;
}
void
-ResetAuthorization ()
+ResetAuthorization (void)
{
int i;
@@ -262,11 +271,11 @@ ResetAuthorization ()
}
XID
-AuthorizationToID (name_length, name, data_length, data)
-unsigned short name_length;
-char *name;
-unsigned short data_length;
-char *data;
+AuthorizationToID (
+ unsigned short name_length,
+ char *name,
+ unsigned short data_length,
+ char *data)
{
int i;
@@ -282,12 +291,12 @@ char *data;
}
int
-AuthorizationFromID (id, name_lenp, namep, data_lenp, datap)
-XID id;
-unsigned short *name_lenp;
-char **namep;
-unsigned short *data_lenp;
-char **datap;
+AuthorizationFromID (
+ XID id,
+ unsigned short *name_lenp,
+ char **namep,
+ unsigned short *data_lenp,
+ char **datap)
{
int i;
@@ -303,11 +312,11 @@ char **datap;
}
int
-RemoveAuthorization (name_length, name, data_length, data)
-unsigned short name_length;
-char *name;
-unsigned short data_length;
-char *data;
+RemoveAuthorization (
+ unsigned short name_length,
+ char *name,
+ unsigned short data_length,
+ char *data)
{
int i;
@@ -323,11 +332,7 @@ char *data;
}
int
-AddAuthorization (name_length, name, data_length, data)
-unsigned int name_length;
-char *name;
-unsigned int data_length;
-char *data;
+AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *data)
{
int i;
@@ -345,14 +350,13 @@ char *data;
#ifdef XCSECURITY
XID
-GenerateAuthorization(name_length, name, data_length, data,
- data_length_return, data_return)
-unsigned int name_length;
-char *name;
-unsigned int data_length;
-char *data;
-unsigned int *data_length_return;
-char **data_return;
+GenerateAuthorization(
+ unsigned name_length,
+ char *name,
+ unsigned data_length,
+ char *data,
+ unsigned *data_length_return,
+ char **data_return)
{
int i;
@@ -375,23 +379,20 @@ char **data_return;
static unsigned long int next = 1;
static int
-xdm_rand()
+xdm_rand(void)
{
next = next * 1103515245 + 12345;
return (unsigned int)(next/65536) % 32768;
}
static void
-xdm_srand(seed)
- unsigned int seed;
+xdm_srand(unsigned int seed)
{
next = seed;
}
void
-GenerateRandomData (len, buf)
-int len;
-char *buf;
+GenerateRandomData (int len, char *buf)
{
static int seed;
int value;
diff --git a/os/connection.c b/os/connection.c
index 7c4b9fef3..46cfd4dfb 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.56 2002/05/31 18:46:05 dawes Exp $ */
/*****************************************************************
* Stuff to create connections --- OS dependent
*
@@ -69,43 +70,78 @@ SOFTWARE.
#include "Xproto.h"
#include <X11/Xtrans.h>
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
#include <signal.h>
#include <stdio.h>
#ifndef WIN32
+#if defined(Lynx)
+#include <socket.h>
+#else
#include <sys/socket.h>
+#endif
#ifdef hpux
#include <sys/utsname.h>
#include <sys/ioctl.h>
#endif
+#if defined(DGUX)
+#include <sys/ioctl.h>
+#include <sys/utsname.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <sys/param.h>
+#include <unistd.h>
+#endif
+
+
#ifdef AIXV3
#include <sys/ioctl.h>
#endif
+#ifdef __UNIXOS2__
+#define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t)
+extern __const__ int _nfiles;
+#endif
+
#if defined(TCPCONN) || defined(STREAMSCONN)
# include <netinet/in.h>
-# ifndef hpux
+# include <arpa/inet.h>
+# if !defined(hpux)
# ifdef apollo
# ifndef NO_TCP_H
# include <netinet/tcp.h>
# endif
# else
-# include <netinet/tcp.h>
+# ifdef CSRG_BASED
+# include <sys/param.h>
+# endif
+# ifndef __UNIXOS2__
+# include <netinet/tcp.h>
+# endif
# endif
# endif
#endif
+#ifdef AMTCPCONN
+#include <server/ip/types.h>
+#include <server/ip/gen/in.h>
+#include <server/ip/gen/inet.h>
+#endif
+
+#if !defined(__UNIXOS2__)
+#ifndef Lynx
#include <sys/uio.h>
+#else
+#include <uio.h>
+#endif
+#endif
#endif /* WIN32 */
#include "misc.h" /* for typedef of pointer */
-#include <X11/Xpoll.h>
#include "osdep.h"
+#include <X11/Xpoll.h>
#include "opaque.h"
#include "dixstruct.h"
#ifdef XAPPGROUP
@@ -116,6 +152,8 @@ extern int errno;
#include "extensions/security.h"
#endif
#ifdef LBX
+#include "colormapst.h"
+#include "propertyst.h"
#include "lbxserve.h"
#endif
@@ -129,7 +167,6 @@ extern int errno;
#include <netdnet/dn.h>
#endif /* DNETCONN */
-extern char *display; /* The display number */
int lastfdesc; /* maximum file descriptor */
fd_set WellKnownConnections; /* Listener mask */
@@ -140,16 +177,13 @@ fd_set LastSelectMask; /* mask returned from last select call */
fd_set ClientsWithInput; /* clients with FULL requests in buffer */
fd_set ClientsWriteBlocked; /* clients who cannot receive output */
fd_set OutputPending; /* clients with reply/event data ready to go */
-#ifndef _SC_OPEN_MAX
-int MaxClients = MAXSOCKS; /* use MAXSOCKS if sysconf(_SC_OPEN_MAX) is not supported */
-#else
int MaxClients = 0;
-#endif
Bool NewOutputPending; /* not yet attempted to write some new output */
Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
Bool PartialNetwork; /* continue even if unable to bind all addrs */
+char *protNoListen; /* don't listen on this protocol */
static Pid_t ParentProcess;
static Bool debug_conns = FALSE;
@@ -161,9 +195,8 @@ static fd_set SavedAllSockets;
static fd_set SavedClientsWithInput;
int GrabInProgress = 0;
-#ifndef WIN32
-int ConnectionTranslation[MAXSOCKS];
-#else
+int *ConnectionTranslation = NULL;
+#if defined(WIN32)
/* SPAM ALERT !!!
* On NT fds are not between 0 and MAXSOCKS, they are unrelated, and there is
* not even a known maximum value, so use something quite arbitrary for now.
@@ -171,15 +204,12 @@ int ConnectionTranslation[MAXSOCKS];
* as a direct index should really be implemented for NT.
*/
#define MAXFD 500
-int ConnectionTranslation[MAXFD];
#endif
XtransConnInfo *ListenTransConns = NULL;
int *ListenTransFds = NULL;
int ListenTransCount;
-extern int auditTrailLevel;
-
static void ErrorConnMax(
#if NeedFunctionPrototypes
XtransConnInfo /* trans_conn */
@@ -201,7 +231,6 @@ void CloseDownFileDescriptor(
#ifdef LBX
extern int LbxFlushClient();
-extern void LbxCloseClient();
#endif /* LBX */
static XtransConnInfo
@@ -219,10 +248,64 @@ lookup_trans_conn (fd)
return (NULL);
}
-#ifdef XDMCP
-void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), XdmcpCloseDisplay();
+/* Set MaxClients and lastfdesc, and allocate ConnectionTranslation */
+
+void
+InitConnectionLimits()
+{
+ lastfdesc = -1;
+
+#ifndef __CYGWIN__
+
+#ifndef __UNIXOS2__
+
+#if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX)
+ lastfdesc = sysconf(_SC_OPEN_MAX) - 1;
+#endif
+
+#ifdef HAS_GETDTABLESIZE
+ if (lastfdesc < 0)
+ lastfdesc = getdtablesize() - 1;
#endif
+#ifdef _NFILE
+ if (lastfdesc < 0)
+ lastfdesc = _NFILE - 1;
+#endif
+
+#else /* __UNIXOS2__ */
+ lastfdesc = _nfiles - 1;
+#endif
+
+#endif /* __CYGWIN__ */
+
+ /* This is the fallback */
+ if (lastfdesc < 0)
+ lastfdesc = MAXSOCKS;
+
+ if (lastfdesc > MAXSELECT)
+ lastfdesc = MAXSELECT;
+
+ if (lastfdesc > MAXCLIENTS)
+ {
+ lastfdesc = MAXCLIENTS;
+ if (debug_conns)
+ ErrorF( "REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
+ }
+ MaxClients = lastfdesc;
+
+#ifdef DEBUG
+ ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients);
+#endif
+
+#if !defined(WIN32)
+ ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
+#else
+ ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(MAXFD));
+#endif
+}
+
+
/*****************
* CreateWellKnownSockets
* At initialization, create the sockets to listen on for new clients.
@@ -231,7 +314,7 @@ void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), XdmcpCloseDisplay();
void
CreateWellKnownSockets()
{
- int request, i;
+ int i;
int partial;
char port[20];
@@ -240,33 +323,22 @@ CreateWellKnownSockets()
FD_ZERO(&LastSelectMask);
FD_ZERO(&ClientsWithInput);
-#ifndef WIN32
- for (i=0; i<MAXSOCKS; i++) ConnectionTranslation[i] = 0;
+#if !defined(WIN32)
+ for (i=0; i<MaxClients; i++) ConnectionTranslation[i] = 0;
#else
for (i=0; i<MAXFD; i++) ConnectionTranslation[i] = 0;
#endif
-#ifdef XNO_SYSCONF /* should only be on FreeBSD 1.x and NetBSD 0.x */
-#undef _SC_OPEN_MAX
-#endif
-#ifdef _SC_OPEN_MAX
- lastfdesc = sysconf(_SC_OPEN_MAX) - 1;
-#else
-#ifdef hpux
- lastfdesc = _NFILE - 1;
-#else
- lastfdesc = getdtablesize() - 1;
-#endif
-#endif
-
- if (lastfdesc > MAXSOCKS)
- {
- lastfdesc = MAXSOCKS;
- }
FD_ZERO (&WellKnownConnections);
sprintf (port, "%d", atoi (display));
+ if (protNoListen)
+ if (_XSERVTransNoListen(protNoListen))
+ {
+ FatalError ("Failed to disable listen for %s", protNoListen);
+ }
+
if ((_XSERVTransMakeAllCOTSServerListeners (port, &partial,
&ListenTransCount, &ListenTransConns) >= 0) &&
(ListenTransCount >= 1))
@@ -277,7 +349,7 @@ CreateWellKnownSockets()
}
else
{
- ListenTransFds = (int *) malloc (ListenTransCount * sizeof (int));
+ ListenTransFds = (int *) xalloc (ListenTransCount * sizeof (int));
for (i = 0; i < ListenTransCount; i++)
{
@@ -296,7 +368,7 @@ CreateWellKnownSockets()
if (!XFD_ANYSET (&WellKnownConnections))
FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running");
-#ifndef WIN32
+#if !defined(WIN32)
OsSignal (SIGPIPE, SIG_IGN);
OsSignal (SIGHUP, AutoResetServer);
#endif
@@ -319,12 +391,12 @@ CreateWellKnownSockets()
* in the second case, the signal will be quite
* useful
*/
-#ifndef WIN32
+#if !defined(WIN32)
if (OsSignal (SIGUSR1, SIG_IGN) == SIG_IGN)
RunFromSmartParent = TRUE;
ParentProcess = getppid ();
if (RunFromSmartParent) {
- if (ParentProcess > 0) {
+ if (ParentProcess > 1) {
kill (ParentProcess, SIGUSR1);
}
}
@@ -380,9 +452,9 @@ ResetWellKnownSockets ()
/*
* See above in CreateWellKnownSockets about SIGUSR1
*/
-#ifndef WIN32
+#if !defined(WIN32)
if (RunFromSmartParent) {
- if (ParentProcess > 0) {
+ if (ParentProcess > 1) {
kill (ParentProcess, SIGUSR1);
}
}
@@ -395,6 +467,15 @@ ResetWellKnownSockets ()
#endif
}
+void
+CloseWellKnownConnections()
+{
+ int i;
+
+ for (i = 0; i < ListenTransCount; i++)
+ _XSERVTransClose (ListenTransConns[i]);
+}
+
static void
AuthAudit (client, letin, saddr, len, proto_n, auth_proto, auth_id)
ClientPtr client;
@@ -418,16 +499,16 @@ AuthAudit (client, letin, saddr, len, proto_n, auth_proto, auth_id)
switch (saddr->sa_family)
{
case AF_UNSPEC:
-#if defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
case AF_UNIX:
#endif
strcpy(out, "local host");
break;
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
case AF_INET:
sprintf(out, "IP %s port %d",
inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr),
- ((struct sockaddr_in *) saddr)->sin_port);
+ ntohs(((struct sockaddr_in *) saddr)->sin_port));
break;
#endif
#ifdef DNETCONN
@@ -436,6 +517,16 @@ AuthAudit (client, letin, saddr, len, proto_n, auth_proto, auth_id)
dnet_ntoa(&((struct sockaddr_dn *) saddr)->sdn_add));
break;
#endif
+#ifdef AMRPCCONN
+ case FamilyAmoeba:
+ sprintf(addr, "AM %s", saddr);
+ break;
+#endif
+#if defined(AMTCPCONN) && !(defined(TCPCONN) || defined(STREAMSCONN))
+ case AF_INET:
+ sprintf(addr, "AMIP %s", inet_ntoa(*((ipaddr_t *) saddr)));
+ break;
+#endif
default:
strcpy(out, "unknown address");
}
@@ -491,7 +582,7 @@ ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string)
char *reason = NULL;
XtransConnInfo trans_conn;
int restore_trans_conn = 0;
- ClientPtr lbxpc;
+ ClientPtr lbxpc = NULL;
priv = (OsCommPtr)client->osPrivate;
trans_conn = priv->trans_conn;
@@ -538,24 +629,7 @@ ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string)
string_n, auth_string, client, &reason);
#ifdef LBX
- if (restore_trans_conn) {
- /*
- * Restore client's trans_conn state
- */
- priv = (OsCommPtr)client->osPrivate;
- priv->trans_conn = NULL;
-
- trans_conn = NULL;
- }
-
-#endif
-
-#ifdef LBX
- if (!trans_conn) {
- /*
- * Use the proxy's trans_conn
- */
- trans_conn = ((OsCommPtr)lbxpc->osPrivate)->trans_conn;
+ if (! priv->trans_conn) {
if (auth_id == (XID) ~0L && !GetAccessControl())
auth_id = ((OsCommPtr)lbxpc->osPrivate)->auth_id;
#ifdef XCSECURITY
@@ -576,9 +650,16 @@ ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string)
_XSERVTransGetPeerAddr (trans_conn,
&family, &fromlen, &from) != -1)
{
+#ifdef AMRPCCONN
+ /* Amoeba RPC connections are already checked by the capability. */
+ if (family == FamilyAmoeba) {
+ auth_id = (XID) 0;
+ }
+ else
+#endif
if (
#ifdef LBX
- !priv->trans_conn ||
+ !trans_conn ||
#endif
InvalidHost ((struct sockaddr *) from, fromlen))
AuthAudit(client, FALSE, (struct sockaddr *) from,
@@ -592,14 +673,23 @@ ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string)
proto_n, auth_proto, auth_id);
}
- free ((char *) from);
+ xfree ((char *) from);
}
- if (auth_id == (XID) ~0L)
+ if (auth_id == (XID) ~0L) {
+#ifdef LBX
+ /*
+ * Restore client's trans_conn state
+ */
+ if (restore_trans_conn) {
+ priv->trans_conn = NULL;
+ }
+#endif
if (reason)
return reason;
else
return "Client is not authorized to connect to Server";
+ }
}
else if (auditTrailLevel > 1)
{
@@ -609,7 +699,7 @@ ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string)
AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
proto_n, auth_proto, auth_id);
- free ((char *) from);
+ xfree ((char *) from);
}
}
priv->auth_id = auth_id;
@@ -629,6 +719,11 @@ ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string)
* true purpose of the selfhosts list is to see who may change the
* access control list.
*/
+#ifdef LBX
+ if (restore_trans_conn) {
+ priv->trans_conn = NULL;
+ }
+#endif
return((char *)NULL);
}
@@ -697,6 +792,12 @@ AllocNewConnection (trans_conn, fd, conn_time)
FD_SET(fd, &AllSockets);
}
}
+
+#ifdef DEBUG
+ ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n",
+ client->index, fd);
+#endif
+
return client;
}
@@ -751,11 +852,7 @@ EstablishNewConnections(clientUnused, closure)
ClientPtr clientUnused;
pointer closure;
{
-#ifndef WIN32
- fd_mask readyconnections; /* mask of listeners that are ready */
-#else
fd_set readyconnections; /* set of listeners that are ready */
-#endif
int curconn; /* fd of listener that's ready */
register int newconn; /* fd of new client */
CARD32 connect_time;
@@ -765,40 +862,37 @@ EstablishNewConnections(clientUnused, closure)
fd_set tmask;
XFD_ANDSET (&tmask, (fd_set*)closure, &WellKnownConnections);
-#ifndef WIN32
- readyconnections = tmask.fds_bits[0];
- if (!readyconnections)
- return TRUE;
-#else
XFD_COPYSET(&tmask, &readyconnections);
if (!XFD_ANYSET(&readyconnections))
return TRUE;
-#endif
connect_time = GetTimeInMillis();
/* kill off stragglers */
for (i=1; i<currentMaxClients; i++)
{
- if (client = clients[i])
+ if ((client = clients[i]))
{
oc = (OsCommPtr)(client->osPrivate);
- if (oc && (oc->conn_time != 0) &&
- (connect_time - oc->conn_time) >= TimeOutValue ||
- client->noClientException != Success && !client->clientGone)
+ if ((oc && (oc->conn_time != 0) &&
+ (connect_time - oc->conn_time) >= TimeOutValue) ||
+ (client->noClientException != Success && !client->clientGone))
CloseDownClient(client);
}
}
#ifndef WIN32
- while (readyconnections)
+ for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++)
+ {
+ while (readyconnections.fds_bits[i])
#else
- for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
+ for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
#endif
- {
+ {
XtransConnInfo trans_conn, new_trans_conn;
int status;
#ifndef WIN32
- curconn = ffs (readyconnections) - 1;
- readyconnections &= ~(1 << curconn);
+ curconn = ffs (readyconnections.fds_bits[i]) - 1;
+ readyconnections.fds_bits[i] &= ~((fd_mask)1 << curconn);
+ curconn += (i * (sizeof(fd_mask)*8));
#else
curconn = XFD_FD(&readyconnections, i);
#endif
@@ -831,7 +925,10 @@ EstablishNewConnections(clientUnused, closure)
ErrorConnMax(new_trans_conn);
_XSERVTransClose(new_trans_conn);
}
+ }
+#ifndef WIN32
}
+#endif
return TRUE;
}
@@ -912,11 +1009,11 @@ CloseDownFileDescriptor(oc)
_XSERVTransDisconnect(oc->trans_conn);
_XSERVTransClose(oc->trans_conn);
}
-#ifdef LBX
- ConnectionTranslation[connection] = 0;
-#else
+#ifndef LBX
FreeOsBuffers(oc);
+ xfree(oc);
#endif
+ ConnectionTranslation[connection] = 0;
FD_CLR(connection, &AllSockets);
FD_CLR(connection, &AllClients);
FD_CLR(connection, &ClientsWithInput);
@@ -931,13 +1028,10 @@ CloseDownFileDescriptor(oc)
if (!XFD_ANYSET(&ClientsWriteBlocked))
AnyClientsWriteBlocked = FALSE;
FD_CLR(connection, &OutputPending);
-#ifndef LBX
- xfree(oc);
-#endif
}
/*****************
- * CheckConections
+ * CheckConnections
* Some connection has died, go find which one and shut it down
* The file descriptor has been closed, but is still in AllClients.
* If would truly be wonderful if select() would put the bogus
@@ -970,13 +1064,13 @@ CheckConnections()
while (mask)
{
curoff = ffs (mask) - 1;
- curclient = curoff + (i << 5);
+ curclient = curoff + (i * (sizeof(fd_mask)*8));
FD_ZERO(&tmask);
FD_SET(curclient, &tmask);
r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
if (r < 0)
CloseDownClient(clients[ConnectionTranslation[curclient]]);
- mask &= ~(1 << curoff);
+ mask &= ~((fd_mask)1 << curoff);
}
}
#else
@@ -1022,20 +1116,24 @@ CloseDownConnection(client)
AuditF("client %d disconnected\n", client->index);
}
-
+void
AddEnabledDevice(fd)
int fd;
{
FD_SET(fd, &EnabledDevices);
FD_SET(fd, &AllSockets);
+ if (GrabInProgress)
+ FD_SET(fd, &SavedAllSockets);
}
-
+void
RemoveEnabledDevice(fd)
int fd;
{
FD_CLR(fd, &EnabledDevices);
FD_CLR(fd, &AllSockets);
+ if (GrabInProgress)
+ FD_CLR(fd, &SavedAllSockets);
}
/*****************
@@ -1048,6 +1146,7 @@ RemoveEnabledDevice(fd)
* This routine is "undone" by ListenToAllClients()
*****************/
+void
OnlyListenToOneClient(client)
ClientPtr client;
{
@@ -1080,6 +1179,7 @@ OnlyListenToOneClient(client)
* Undoes OnlyListentToOneClient()
****************/
+void
ListenToAllClients()
{
if (GrabInProgress)
@@ -1097,6 +1197,7 @@ ListenToAllClients()
* Must have cooresponding call to AttendClient.
****************/
+void
IgnoreClient (client)
ClientPtr client;
{
@@ -1141,6 +1242,7 @@ IgnoreClient (client)
* Adds one client back into the input masks.
****************/
+void
AttendClient (client)
ClientPtr client;
{
@@ -1174,6 +1276,7 @@ AttendClient (client)
/* make client impervious to grabs; assume only executing client calls this */
+void
MakeClientGrabImpervious(client)
ClientPtr client;
{
@@ -1193,6 +1296,7 @@ MakeClientGrabImpervious(client)
/* make client pervious to grabs; assume only executing client calls this */
+void
MakeClientGrabPervious(client)
ClientPtr client;
{
diff --git a/os/io.c b/os/io.c
index 96bfd6885..e97c5dab7 100644
--- a/os/io.c
+++ b/os/io.c
@@ -43,6 +43,7 @@ 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.
+
******************************************************************/
/* $Xorg: io.c,v 1.6 2001/02/09 02:05:23 xorgcvs Exp $ */
/*****************************************************************
@@ -52,30 +53,37 @@ SOFTWARE.
* InsertFakeRequest, ResetCurrentRequest
*
*****************************************************************/
+/* $XFree86: xc/programs/Xserver/os/io.c,v 3.34 2002/05/31 18:46:05 dawes Exp $ */
+#if 0
+#define DEBUG_COMMUNICATION
+#endif
#ifdef WIN32
#include <X11/Xwinsock.h>
#endif
#include <stdio.h>
#include <X11/Xtrans.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
#include "Xmd.h"
#include <errno.h>
-#ifndef WIN32
+#if !defined(__UNIXOS2__) && !defined(WIN32)
+#ifndef Lynx
#include <sys/uio.h>
+#else
+#include <uio.h>
+#endif
#endif
#include "X.h"
#define NEED_REPLIES
#include "Xproto.h"
#include "os.h"
-#include "Xpoll.h"
#include "osdep.h"
+#include "Xpoll.h"
#include "opaque.h"
#include "dixstruct.h"
#include "misc.h"
#ifdef LBX
+#include "colormapst.h"
+#include "propertyst.h"
#include "lbxserve.h"
#endif
@@ -85,6 +93,7 @@ CallbackListPtr FlushCallback;
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
+#ifndef __UNIXOS2__
#if defined(EAGAIN) && defined(EWOULDBLOCK)
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
#else
@@ -94,13 +103,9 @@ CallbackListPtr FlushCallback;
#define ETEST(err) (err == EWOULDBLOCK)
#endif
#endif
-
-extern fd_set ClientsWithInput, IgnoredClientsWithInput, AllClients;
-extern fd_set ClientsWriteBlocked;
-extern fd_set OutputPending;
-extern int ConnectionTranslation[];
-extern Bool NewOutputPending;
-extern Bool AnyClientsWriteBlocked;
+#else /* __UNIXOS2__ Writing to full pipes may return ENOSPC */
+#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK || err == ENOSPC)
+#endif
Bool CriticalOutputPending;
int timesThisConnection = 0;
@@ -251,7 +256,7 @@ ReadRequestFromClient(client)
if (!oci)
{
- if (oci = FreeInputs)
+ if ((oci = FreeInputs))
{
FreeInputs = oci->next;
}
@@ -371,8 +376,23 @@ ReadRequestFromClient(client)
{
if ((result < 0) && ETEST(errno))
{
- YieldControlNoInput();
- return 0;
+#if defined(SVR4) && defined(i386) && !defined(sun)
+#if defined(LBX) && 0
+ /*
+ * For LBX connections, we can get a valid EWOULDBLOCK
+ * There is probably a better way of distinguishing LBX
+ * connections, but this works. (DHD)
+ */
+ extern int LbxRead();
+ if (oc->Read == LbxRead)
+#else
+ if (0)
+#endif
+#endif
+ {
+ YieldControlNoInput();
+ return 0;
+ }
}
YieldControlDeath();
return -1;
@@ -451,14 +471,29 @@ ReadRequestFromClient(client)
)
FD_SET(fd, &ClientsWithInput);
else
- YieldControlNoInput();
+ {
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable)
+ FD_CLR(fd, &ClientsWithInput);
+ else
+#endif
+ YieldControlNoInput();
+ }
}
else
{
if (!gotnow)
AvailableInput = oc;
- YieldControlNoInput();
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable)
+ FD_CLR(fd, &ClientsWithInput);
+ else
+#endif
+ YieldControlNoInput();
}
+#ifdef SMART_SCHEDULE
+ if (SmartScheduleDisable)
+#endif
if (++timesThisConnection >= MAX_TIMES_PER)
YieldControl();
#ifdef BIGREQS
@@ -472,6 +507,13 @@ ReadRequestFromClient(client)
}
#endif
client->requestBuffer = (pointer)oci->bufptr;
+#ifdef DEBUG_COMMUNICATION
+ {
+ xReq *req = client->requestBuffer;
+ ErrorF("REQUEST: ClientIDX: %i, type: 0x%x data: 0x%x len: %i\n",
+ client->index,req->reqType,req->data,req->length);
+ }
+#endif
return needed;
}
@@ -513,7 +555,7 @@ InsertFakeRequest(client, data, count)
}
if (!oci)
{
- if (oci = FreeInputs)
+ if ((oci = FreeInputs))
FreeInputs = oci->next;
else if (!(oci = AllocateInputBuffer()))
return FALSE;
@@ -558,6 +600,7 @@ InsertFakeRequest(client, data, count)
*
**********************/
+void
ResetCurrentRequest(client)
ClientPtr client;
{
@@ -567,7 +610,6 @@ ResetCurrentRequest(client)
register xReq *request;
int gotnow, needed;
#ifdef LBX
- Bool part;
LbxClientPtr lbxClient = LbxClient(client);
if (lbxClient) {
@@ -769,11 +811,12 @@ static int padlength[4] = {0, 3, 2, 1};
void
FlushAllOutput()
{
- register int index, base, mask;
+ register int index, base;
+ register fd_mask mask; /* raphael */
OsCommPtr oc;
register ClientPtr client;
Bool newoutput = NewOutputPending;
-#ifdef WIN32
+#if defined(WIN32)
fd_set newOutputPending;
#endif
@@ -800,7 +843,7 @@ FlushAllOutput()
{
index = ffs(mask) - 1;
mask &= ~lowbit(mask);
- if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
+ if ((index = ConnectionTranslation[(base * (sizeof(fd_mask)*8)) + index]) == 0)
continue;
client = clients[index];
if (client->clientGone)
@@ -879,13 +922,54 @@ WriteToClient (who, count, buf)
OsCommPtr oc = (OsCommPtr)who->osPrivate;
register ConnectionOutputPtr oco = oc->output;
int padBytes;
-
+#ifdef DEBUG_COMMUNICATION
+ Bool multicount = FALSE;
+#endif
if (!count)
return(0);
+#ifdef DEBUG_COMMUNICATION
+ {
+ char info[128];
+ xError *err;
+ xGenericReply *rep;
+ xEvent *ev;
+
+ if (!who->replyBytesRemaining) {
+ switch(buf[0]) {
+ case X_Reply:
+ rep = (xGenericReply*)buf;
+ if (rep->sequenceNumber == who->sequence) {
+ snprintf(info,127,"Xreply: type: 0x%x data: 0x%x "
+ "len: %i seq#: 0x%x", rep->type, rep->data1,
+ rep->length, rep->sequenceNumber);
+ multicount = TRUE;
+ }
+ break;
+ case X_Error:
+ err = (xError*)buf;
+ snprintf(info,127,"Xerror: Code: 0x%x resID: 0x%x maj: 0x%x "
+ "min: %x", err->errorCode,err->resourceID,
+ err->minorCode,err->majorCode);
+ break;
+ default:
+ if ((buf[0] & 0x7f) == KeymapNotify)
+ snprintf(info,127,"KeymapNotifyEvent: %i",buf[0]);
+ else {
+ ev = (xEvent*)buf;
+ snprintf(info,127,"XEvent: type: 0x%x detail: 0x%x "
+ "seq#: 0x%x", ev->u.u.type, ev->u.u.detail,
+ ev->u.u.sequenceNumber);
+ }
+ }
+ ErrorF("REPLY: ClientIDX: %i %s\n",who->index, info);
+ } else
+ multicount = TRUE;
+ }
+#endif
if (!oco)
{
- if (oco = FreeOutputs)
+ if ((oco = FreeOutputs))
{
FreeOutputs = oco->next;
}
@@ -933,14 +1017,25 @@ WriteToClient (who, count, buf)
replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft;
CallCallbacks((&ReplyCallback), (pointer)&replyinfo);
}
- }
-
+ }
+#ifdef DEBUG_COMMUNICATION
+ else if (multicount) {
+ if (who->replyBytesRemaining) {
+ who->replyBytesRemaining -= (count + padBytes);
+ } else {
+ CARD32 replylen;
+ replylen = ((xGenericReply *)buf)->length;
+ who->replyBytesRemaining =
+ (replylen * 4) + SIZEOF(xReply) - count - padBytes;
+ }
+ }
+#endif
if (oco->count + count + padBytes > oco->size)
{
FD_CLR(oc->fd, &OutputPending);
if(!XFD_ANYSET(&OutputPending)) {
- CriticalOutputPending = FALSE;
- NewOutputPending = FALSE;
+ CriticalOutputPending = FALSE;
+ NewOutputPending = FALSE;
}
return FlushClient(who, oc, buf, count);
}
@@ -1007,7 +1102,7 @@ FlushClient(who, oc, extraBuf, extraCount)
long remain = todo; /* amount to try this time, <= notWritten */
int i = 0;
long len;
-
+
/* You could be very general here and have "in" and "out" iovecs
* and write a loop without using a macro, but what the heck. This
* translates to:
@@ -1203,7 +1298,7 @@ FreeOsBuffers(oc)
if (AvailableInput == oc)
AvailableInput = (OsCommPtr)NULL;
- if (oci = oc->input)
+ if ((oci = oc->input))
{
if (FreeInputs)
{
@@ -1219,7 +1314,7 @@ FreeOsBuffers(oc)
oci->lenLastReq = 0;
}
}
- if (oco = oc->output)
+ if ((oco = oc->output))
{
if (FreeOutputs)
{
@@ -1234,7 +1329,7 @@ FreeOsBuffers(oc)
}
}
#ifdef LBX
- if (oci = oc->largereq) {
+ if ((oci = oc->largereq)) {
xfree(oci->buffer);
xfree(oci);
}
@@ -1247,13 +1342,13 @@ ResetOsBuffers()
register ConnectionInputPtr oci;
register ConnectionOutputPtr oco;
- while (oci = FreeInputs)
+ while ((oci = FreeInputs))
{
FreeInputs = oci->next;
xfree(oci->buffer);
xfree(oci);
}
- while (oco = FreeOutputs)
+ while ((oco = FreeOutputs))
{
FreeOutputs = oco->next;
xfree(oco->buf);
diff --git a/os/k5auth.c b/os/k5auth.c
index c6a2e3cc9..8c59fe8ab 100644
--- a/os/k5auth.c
+++ b/os/k5auth.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.5 2001/12/14 20:00:34 dawes Exp $ */
/*
* Kerberos V5 authentication scheme
@@ -303,7 +304,7 @@ int k5_stage1(client)
return(SendConnSetup(client, "Krb5 stage1: getpeername failed"));
}
if (cli_net_addr.sa_family == AF_UNSPEC
-#if defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
|| cli_net_addr.sa_family == AF_UNIX
#endif
) /* assume local host */
diff --git a/os/lbxio.c b/os/lbxio.c
index c72ac2c05..2991681de 100644
--- a/os/lbxio.c
+++ b/os/lbxio.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.17 2002/05/31 18:46:06 dawes Exp $ */
/*
Copyright 1996, 1998 The Open Group
@@ -50,13 +51,16 @@ SOFTWARE.
#include <stdio.h>
#include <X11/Xtrans.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
#include "Xmd.h"
#include <errno.h>
+#ifndef Lynx
#include <sys/param.h>
+#ifndef __UNIXOS2__
#include <sys/uio.h>
+#endif
+#else
+#include <uio.h>
+#endif
#include "X.h"
#include "Xproto.h"
#include "os.h"
@@ -65,6 +69,8 @@ extern int errno;
#include "opaque.h"
#include "dixstruct.h"
#include "misc.h"
+#include "colormapst.h"
+#include "propertyst.h"
#include "lbxserve.h"
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
@@ -80,19 +86,6 @@ extern int errno;
#endif
#endif
-extern fd_set ClientsWithInput, IgnoredClientsWithInput;
-extern fd_set AllClients, AllSockets;
-extern fd_set ClientsWriteBlocked;
-extern fd_set OutputPending;
-extern int ConnectionTranslation[];
-extern Bool NewOutputPending;
-extern Bool AnyClientsWriteBlocked;
-extern Bool CriticalOutputPending;
-extern int timesThisConnection;
-extern ConnectionInputPtr FreeInputs;
-extern ConnectionOutputPtr FreeOutputs;
-extern OsCommPtr AvailableInput;
-
#define get_req_len(req,cli) ((cli)->swapped ? \
lswaps((req)->length) : (req)->length)
@@ -166,7 +159,7 @@ AppendFakeRequest (client, data, count)
if (!oci)
{
- if (oci = FreeInputs)
+ if ((oci = FreeInputs))
FreeInputs = oci->next;
else if (!(oci = AllocateInputBuffer()))
return FALSE;
@@ -288,7 +281,7 @@ LbxAppendOutput(proxy, client, oco)
int n;
if (!noco || (noco->size - noco->count) < sz_xLbxSwitchEvent) {
- if (noco = FreeOutputs)
+ if ((noco = FreeOutputs))
FreeOutputs = noco->next;
else
noco = AllocateOutputBuffer();
@@ -334,7 +327,7 @@ LbxClientOutput(client, oc, extraBuf, extraCount, nocompress)
ConnectionOutputPtr oco;
int len;
- if (oco = oc->output) {
+ if ((oco = oc->output)) {
oc->output = NULL;
if (!LbxAppendOutput(oc->proxy, client, oco))
return -1;
@@ -387,7 +380,7 @@ LbxForceOutput(proxy)
if (!lbxClient)
continue;
coc = (OsCommPtr)lbxClient->client->osPrivate;
- if (oco = coc->output) {
+ if ((oco = coc->output)) {
coc->output = NULL;
LbxAppendOutput(proxy, lbxClient->client, oco);
}
@@ -404,7 +397,7 @@ LbxFlushClient(who, oc, extraBuf, extraCount)
LbxProxyPtr proxy;
ConnectionOutputPtr oco;
int n;
- XtransConnInfo trans_conn;
+ XtransConnInfo trans_conn = NULL;
if (extraBuf)
return LbxClientOutput(who, oc, extraBuf, extraCount, FALSE);
@@ -414,7 +407,7 @@ LbxFlushClient(who, oc, extraBuf, extraCount)
LbxForceOutput(proxy);
if (!proxy->compHandle)
trans_conn = ((OsCommPtr)LbxProxyClient(proxy)->osPrivate)->trans_conn;
- while (oco = proxy->ofirst) {
+ while ((oco = proxy->ofirst)) {
/* XXX bundle up into writev someday */
if (proxy->compHandle) {
if (oco->nocompress)
@@ -474,12 +467,13 @@ UncompressedWriteToClient (who, count, buf)
return LbxClientOutput(who, (OsCommPtr)who->osPrivate, buf, count, TRUE);
}
+void
LbxFreeOsBuffers(proxy)
LbxProxyPtr proxy;
{
ConnectionOutputPtr oco;
- while (oco = proxy->ofirst) {
+ while ((oco = proxy->ofirst)) {
proxy->ofirst = oco->next;
xfree(oco->buf);
xfree(oco);
@@ -495,7 +489,7 @@ AllocateLargeReqBuffer(client, size)
register ConnectionInputPtr oci;
if (!(oci = oc->largereq)) {
- if (oci = FreeInputs)
+ if ((oci = FreeInputs))
FreeInputs = oci->next;
else {
oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput));
diff --git a/os/mitauth.c b/os/mitauth.c
index 274ab5829..bddbdf1d6 100644
--- a/os/mitauth.c
+++ b/os/mitauth.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.5 2001/12/14 20:00:34 dawes Exp $ */
/*
* MIT-MAGIC-COOKIE-1 authorization scheme
@@ -34,6 +35,7 @@ from The Open Group.
#include "X.h"
#include "os.h"
+#include "osdep.h"
#include "dixstruct.h"
static struct auth {
@@ -44,10 +46,10 @@ static struct auth {
} *mit_auth;
int
-MitAddCookie (data_length, data, id)
-unsigned short data_length;
-char *data;
-XID id;
+MitAddCookie (
+ unsigned short data_length,
+ char *data,
+ XID id)
{
struct auth *new;
@@ -68,11 +70,11 @@ XID id;
}
XID
-MitCheckCookie (data_length, data, client, reason)
- unsigned short data_length;
- char *data;
- ClientPtr client;
- char **reason;
+MitCheckCookie (
+ unsigned short data_length,
+ char *data,
+ ClientPtr client,
+ char **reason)
{
struct auth *auth;
@@ -86,7 +88,7 @@ MitCheckCookie (data_length, data, client, reason)
}
int
-MitResetCookie ()
+MitResetCookie (void)
{
struct auth *auth, *next;
@@ -100,9 +102,9 @@ MitResetCookie ()
}
XID
-MitToID (data_length, data)
-unsigned short data_length;
-char *data;
+MitToID (
+ unsigned short data_length,
+ char *data)
{
struct auth *auth;
@@ -115,10 +117,10 @@ char *data;
}
int
-MitFromID (id, data_lenp, datap)
-XID id;
-unsigned short *data_lenp;
-char **datap;
+MitFromID (
+ XID id,
+ unsigned short *data_lenp,
+ char **datap)
{
struct auth *auth;
@@ -133,9 +135,9 @@ char **datap;
}
int
-MitRemoveCookie (data_length, data)
-unsigned short data_length;
-char *data;
+MitRemoveCookie (
+ unsigned short data_length,
+ char *data)
{
struct auth *auth, *prev;
@@ -161,12 +163,12 @@ char *data;
static char cookie[16]; /* 128 bits */
XID
-MitGenerateCookie (data_length, data, id, data_length_return, data_return)
- unsigned int data_length;
- char *data;
- XID id;
- unsigned int *data_length_return;
- char **data_return;
+MitGenerateCookie (
+ unsigned data_length,
+ char *data,
+ XID id,
+ unsigned *data_length_return,
+ char **data_return)
{
int i = 0;
int status;
diff --git a/os/oscolor.c b/os/oscolor.c
index f5fd61bc5..62676f84b 100644
--- a/os/oscolor.c
+++ b/os/oscolor.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.8 2002/05/31 18:46:06 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -107,11 +108,11 @@ OsLookupColor(screen, name, len, pred, pgreen, pblue)
if(!rgb_dbm)
return(0);
- /* we use Xalloc here so that we can compile with cc without alloca
+ /* we use xalloc here so that we can compile with cc without alloca
* when otherwise using gcc */
if (len < sizeof(buf))
lowername = buf;
- else if (!(lowername = (char *)Xalloc(len + 1)))
+ else if (!(lowername = (char *)xalloc(len + 1)))
return(0);
CopyISOLatin1Lowered ((unsigned char *) lowername, (unsigned char *) name,
(int)len);
@@ -125,7 +126,7 @@ OsLookupColor(screen, name, len, pred, pgreen, pblue)
#endif
if (len >= sizeof(buf))
- Xfree(lowername);
+ xfree(lowername);
if(dbent.dptr)
{
@@ -175,7 +176,7 @@ lookup(name, len, create)
Bool create;
{
unsigned int h = 0, g;
- dbEntryPtr entry, *prev;
+ dbEntryPtr entry, *prev = NULL;
char *str = name;
if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL;
@@ -189,7 +190,7 @@ lookup(name, len, create)
}
h %= HASHSIZE;
- if ( entry = hashTab[h] )
+ if ( (entry = hashTab[h]) )
{
for( ; entry; prev = (dbEntryPtr*)entry, entry = entry->link )
if (! strcmp(name, entry->name) ) break;
@@ -197,7 +198,7 @@ lookup(name, len, create)
else
prev = &(hashTab[h]);
- if (!entry && create && (entry = (dbEntryPtr)Xalloc(sizeof(dbEntry) +len)))
+ if (!entry && create && (entry = (dbEntryPtr)xalloc(sizeof(dbEntry) +len)))
{
*prev = entry;
entry->link = NULL;
@@ -224,10 +225,16 @@ OsInitColors()
if (!was_here)
{
+#ifndef __UNIXOS2__
path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5);
strcpy(path, rgbPath);
strcat(path, ".txt");
-
+#else
+ char *tmp = (char*)__XOS2RedirRoot(rgbPath);
+ path = (char*)ALLOCATE_LOCAL(strlen(tmp) +5);
+ strcpy(path, tmp);
+ strcat(path, ".txt");
+#endif
if (!(rgb = fopen(path, "r")))
{
ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
@@ -238,13 +245,17 @@ OsInitColors()
while(fgets(line, sizeof(line), rgb))
{
lineno++;
+#ifndef __UNIXOS2__
if (sscanf(line,"%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4)
+#else
+ if (sscanf(line,"%d %d %d %[^\n\r]\n", &red, &green, &blue, name) == 4)
+#endif
{
if (red >= 0 && red <= 0xff &&
green >= 0 && green <= 0xff &&
blue >= 0 && blue <= 0xff)
{
- if (entry = lookup(name, strlen(name), TRUE))
+ if ((entry = lookup(name, strlen(name), TRUE)))
{
entry->red = (red * 65535) / 255;
entry->green = (green * 65535) / 255;
@@ -252,8 +263,7 @@ OsInitColors()
}
}
else
- ErrorF("Value for \"%s\" out of range: %s:%d\n",
- name, path, lineno);
+ ErrorF("Value out of range: %s:%d\n", path, lineno);
}
else if (*line && *line != '#' && *line != '!')
ErrorF("Syntax Error: %s:%d\n", path, lineno);
@@ -280,7 +290,7 @@ OsLookupColor(screen, name, len, pred, pgreen, pblue)
{
dbEntryPtr entry;
- if (entry = lookup(name, len, FALSE))
+ if ((entry = lookup(name, len, FALSE)))
{
*pred = entry->red;
*pgreen = entry->green;
diff --git a/os/osdep.h b/os/osdep.h
index c7c730740..a1fe2bfed 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.17 2002/05/31 18:46:06 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -46,10 +47,17 @@ SOFTWARE.
******************************************************************/
/* $Xorg: osdep.h,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */
+#ifndef _OSDEP_H_
+#define _OSDEP_H_ 1
+
#define BOTIMEOUT 200 /* in milliseconds */
#define BUFSIZE 4096
#define BUFWATERMARK 8192
+#ifndef MAXBUFSIZE
#define MAXBUFSIZE (1 << 22)
+#endif
+
+#include <X11/Xdmcp.h>
#ifndef sgi /* SGI defines OPEN_MAX in a useless way */
#ifndef X_NOT_POSIX
@@ -69,6 +77,9 @@ SOFTWARE.
#endif /* X_NOT_POSIX */
#endif
+#ifdef __QNX__
+#define NOFILES_MAX 256
+#endif
#ifndef OPEN_MAX
#ifdef SVR4
#define OPEN_MAX 256
@@ -78,11 +89,22 @@ SOFTWARE.
#if defined(NOFILE) && !defined(NOFILES_MAX)
#define OPEN_MAX NOFILE
#else
+#ifndef __UNIXOS2__
#define OPEN_MAX NOFILES_MAX
+#else
+#define OPEN_MAX 256
#endif
#endif
#endif
#endif
+#endif
+
+#include <X11/Xpoll.h>
+
+/*
+ * MAXSOCKS is used only for initialising MaxClients when no other method
+ * like sysconf(_SC_OPEN_MAX) is not supported.
+ */
#if OPEN_MAX <= 256
#define MAXSOCKS (OPEN_MAX - 1)
@@ -90,10 +112,19 @@ SOFTWARE.
#define MAXSOCKS 256
#endif
-#ifndef NULL
-#define NULL 0
+/* MAXSELECT is the number of fds that select() can handle */
+#define MAXSELECT (sizeof(fd_set) * NBBY)
+
+#if !defined(hpux) && !defined(SVR4) && !defined(SYSV)
+#define HAS_GETDTABLESIZE
#endif
+#include <stddef.h>
+
+typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
+typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
+typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data);
+
typedef struct _connectionInput {
struct _connectionInput *next;
char *buffer; /* contains current client input */
@@ -127,6 +158,36 @@ typedef struct _k5_state {
typedef struct _LbxProxy *OsProxyPtr;
#endif
+struct _osComm;
+
+#define AuthInitArgs void
+typedef void (*AuthInitFunc) (AuthInitArgs);
+
+#define AuthAddCArgs unsigned short data_length, char *data, XID id
+typedef int (*AuthAddCFunc) (AuthAddCArgs);
+
+#define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason
+typedef XID (*AuthCheckFunc) (AuthCheckArgs);
+
+#define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap
+typedef int (*AuthFromIDFunc) (AuthFromIDArgs);
+
+#define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return
+typedef XID (*AuthGenCFunc) (AuthGenCArgs);
+
+#define AuthRemCArgs unsigned short data_length, char *data
+typedef int (*AuthRemCFunc) (AuthRemCArgs);
+
+#define AuthRstCArgs void
+typedef int (*AuthRstCFunc) (AuthRstCArgs);
+
+#define AuthToIDArgs unsigned short data_length, char *data
+typedef XID (*AuthToIDFunc) (AuthToIDArgs);
+
+typedef void (*OsCloseFunc)(ClientPtr);
+
+typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount);
+
typedef struct _osComm {
int fd;
ConnectionInputPtr input;
@@ -140,8 +201,8 @@ typedef struct _osComm {
#ifdef LBX
OsProxyPtr proxy;
ConnectionInputPtr largereq;
- void (*Close) ();
- int (*Flush) ();
+ OsCloseFunc Close;
+ OsFlushFunc Flush;
#endif
} OsCommRec, *OsCommPtr;
@@ -149,38 +210,130 @@ typedef struct _osComm {
#define FlushClient(who, oc, extraBuf, extraCount) \
(*(oc)->Flush)(who, oc, extraBuf, extraCount)
extern int StandardFlushClient(
-#if NeedFunctionPrototypes
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
int /*extraCount*/
-#endif
);
#else
extern int FlushClient(
-#if NeedFunctionPrototypes
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
int /*extraCount*/
-#endif
);
#endif
extern void FreeOsBuffers(
-#if NeedFunctionPrototypes
OsCommPtr /*oc*/
-#endif
);
-extern ConnectionInputPtr AllocateInputBuffer(
-#if NeedFunctionPrototypes
- void
+#include "dix.h"
+
+extern ConnectionInputPtr AllocateInputBuffer(void);
+
+extern ConnectionOutputPtr AllocateOutputBuffer(void);
+
+extern fd_set AllSockets;
+extern fd_set AllClients;
+extern fd_set LastSelectMask;
+extern fd_set WellKnownConnections;
+extern fd_set EnabledDevices;
+extern fd_set ClientsWithInput;
+extern fd_set ClientsWriteBlocked;
+extern fd_set OutputPending;
+extern fd_set IgnoredClientsWithInput;
+
+extern int *ConnectionTranslation;
+
+extern Bool NewOutputPending;
+extern Bool AnyClientsWriteBlocked;
+extern Bool CriticalOutputPending;
+
+extern int timesThisConnection;
+extern ConnectionInputPtr FreeInputs;
+extern ConnectionOutputPtr FreeOutputs;
+extern OsCommPtr AvailableInput;
+
+extern WorkQueuePtr workQueue;
+
+/* added by raphael */
+#define ffs mffs
+extern int mffs(fd_mask);
+
+/* in auth.c */
+extern void GenerateRandomData (int len, char *buf);
+
+/* in mitauth.c */
+extern XID MitCheckCookie (AuthCheckArgs);
+extern XID MitGenerateCookie (AuthGenCArgs);
+extern XID MitToID (AuthToIDArgs);
+extern int MitAddCookie (AuthAddCArgs);
+extern int MitFromID (AuthFromIDArgs);
+extern int MitRemoveCookie (AuthRemCArgs);
+extern int MitResetCookie (AuthRstCArgs);
+
+/* in xdmauth.c */
+#ifdef HASXDMAUTH
+extern XID XdmCheckCookie (AuthCheckArgs);
+extern XID XdmToID (AuthToIDArgs);
+extern int XdmAddCookie (AuthAddCArgs);
+extern int XdmFromID (AuthFromIDArgs);
+extern int XdmRemoveCookie (AuthRemCArgs);
+extern int XdmResetCookie (AuthRstCArgs);
#endif
-);
-extern ConnectionOutputPtr AllocateOutputBuffer(
-#if NeedFunctionPrototypes
- void
+/* in rpcauth.c */
+#ifdef SECURE_RPC
+extern void SecureRPCInit (AuthInitArgs);
+extern XID SecureRPCCheck (AuthCheckArgs);
+extern XID SecureRPCToID (AuthToIDArgs);
+extern int SecureRPCAdd (AuthAddCArgs);
+extern int SecureRPCFromID (AuthFromIDArgs);
+extern int SecureRPCRemove (AuthRemCArgs);
+extern int SecureRPCReset (AuthRstCArgs);
#endif
-);
+
+/* in k5auth.c */
+#ifdef K5AUTH
+extern XID K5Check (AuthCheckArgs);
+extern XID K5ToID (AuthToIDArgs);
+extern int K5Add (AuthAddCArgs);
+extern int K5FromID (AuthFromIDArgs);
+extern int K5Remove (AuthRemCArgs);
+extern int K5Reset (AuthRstCArgs);
+#endif
+
+/* in secauth.c */
+extern XID AuthSecurityCheck (AuthCheckArgs);
+
+/* in xdmcp.c */
+extern void XdmcpUseMsg (void);
+extern int XdmcpOptions(int argc, char **argv, int i);
+extern void XdmcpSetAuthentication (ARRAY8Ptr name);
+extern void XdmcpRegisterConnection (
+ int type,
+ char *address,
+ int addrlen);
+extern void XdmcpRegisterAuthorizations (void);
+extern void XdmcpRegisterAuthorization (char *name, int namelen);
+extern void XdmcpRegisterDisplayClass (char *name, int length);
+extern void XdmcpInit (void);
+extern void XdmcpReset (void);
+extern void XdmcpOpenDisplay(int sock);
+extern void XdmcpCloseDisplay(int sock);
+extern void XdmcpRegisterAuthentication (
+ char *name,
+ int namelen,
+ char *data,
+ int datalen,
+ ValidatorFunc Validator,
+ GeneratorFunc Generator,
+ AddAuthorFunc AddAuth);
+extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type);
+extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data);
+
+struct sockaddr_in;
+extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr);
+
+#endif /* _OSDEP_H_ */
diff --git a/os/osinit.c b/os/osinit.c
index f240ea42c..9d9fcda4e 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.27 2002/06/17 08:04:18 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -52,6 +53,10 @@ SOFTWARE.
#include "osdep.h"
#include "Xos.h"
+#ifdef SMART_SCHEDULE
+#include "dixstruct.h"
+#endif
+
#ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
@@ -60,10 +65,12 @@ SOFTWARE.
#endif
#endif
-#ifndef WIN32
-#ifndef SYSV
-#include <sys/resource.h>
+#if defined(Lynx) || defined(SCO) || defined(SCO325)
+#include <sys/wait.h>
#endif
+
+#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4)
+#include <sys/resource.h>
#endif
#ifndef ADMPATH
@@ -83,6 +90,10 @@ int limitNoFile = -1;
Bool OsDelayInitColors = FALSE;
+#ifdef XFree86LOADER
+extern void xf86WrapperInit(void);
+#endif
+
void
OsInit()
{
@@ -96,8 +107,13 @@ OsInit()
#endif
if (!been_here) {
+#ifdef XFree86LOADER
+ xf86WrapperInit();
+#endif
+#if !defined(SCO) && !defined(__CYGWIN__)
fclose(stdin);
fclose(stdout);
+#endif
/*
* If a write of zero bytes to stderr returns non-zero, i.e. -1,
* then writing to stderr failed, and we'll write somewhere else
@@ -122,7 +138,7 @@ OsInit()
dup2 (fileno (err), 2);
fclose (err);
}
-#if defined(SYSV) || defined(SVR4) || defined(WIN32)
+#if defined(SYSV) || defined(SVR4) || defined(__UNIXOS2__) || defined(WIN32) || defined(__CYGWIN__)
{
static char buf[BUFSIZ];
setvbuf (stderr, buf, _IOLBF, BUFSIZ);
@@ -183,18 +199,36 @@ OsInit()
rlim.rlim_cur = limitNoFile;
else
rlim.rlim_cur = rlim.rlim_max;
+#if 0
if (rlim.rlim_cur > MAXSOCKS)
rlim.rlim_cur = MAXSOCKS;
+#endif
(void)setrlimit(RLIMIT_NOFILE, &rlim);
}
}
#endif
+#ifdef SERVER_LOCK
+ LockServer();
+#endif
been_here = TRUE;
}
TimerInit();
#ifdef DDXOSINIT
OsVendorInit();
#endif
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable)
+ if (!SmartScheduleInit ())
+ SmartScheduleDisable = TRUE;
+#endif
OsInitAllocator();
if (!OsDelayInitColors) OsInitColors();
}
+
+void
+OsCleanup()
+{
+#ifdef SERVER_LOCK
+ UnlockServer();
+#endif
+}
diff --git a/os/rpcauth.c b/os/rpcauth.c
index 15111921f..7ee53b52d 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.7 2001/12/14 20:00:35 dawes Exp $ */
/*
* SUN-DES-1 authentication mechanism
@@ -43,6 +44,16 @@ from The Open Group.
#include <rpc/rpc.h>
+#ifdef sun
+/* <rpc/auth.h> only includes this if _KERNEL is #defined... */
+extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
+#endif
+
+#if defined(DGUX)
+#include <time.h>
+#include <rpc/auth_des.h>
+#endif /* DGUX */
+
#ifdef ultrix
#include <time.h>
#include <rpc/auth_des.h>
@@ -104,7 +115,7 @@ int len;
return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name);
bad2:
- Xfree(r.rq_clntcred);
+ xfree(r.rq_clntcred);
bad1:
return ((char *)0); /* ((struct authdes_cred *) NULL); */
}
@@ -112,10 +123,11 @@ bad1:
static XID rpc_id = (XID) ~0L;
static Bool
-CheckNetName (addr, len, closure)
- unsigned char *addr;
- int len;
- pointer closure;
+CheckNetName (
+ unsigned char *addr,
+ short len,
+ pointer closure
+)
{
return (len == strlen ((char *) closure) &&
strncmp ((char *) addr, (char *) closure, len) == 0);
@@ -140,21 +152,18 @@ SecureRPCCheck (data_length, data, client, reason)
sprintf(rpc_error, "Unable to authenticate secure RPC client (why=%d)", why);
*reason = rpc_error;
} else {
- if (ForEachHostInFamily (FamilyNetname, CheckNetName,
- (pointer) fullname))
+ if (ForEachHostInFamily (FamilyNetname, CheckNetName, fullname))
return rpc_id;
- else {
- sprintf(rpc_error, "Principal \"%s\" is not authorized to connect",
+ sprintf(rpc_error, "Principal \"%s\" is not authorized to connect",
fullname);
- *reason = rpc_error;
- }
+ *reason = rpc_error;
}
}
return (XID) ~0L;
}
-
-SecureRPCInit ()
+void
+SecureRPCInit (void)
{
if (rpc_id == ~0L)
AddAuthorization (9, "SUN-DES-1", 0, (char *) 0);
@@ -169,12 +178,14 @@ XID id;
if (data_length)
AddHost ((pointer) 0, FamilyNetname, data_length, data);
rpc_id = id;
+ return 1;
}
int
-SecureRPCReset ()
+SecureRPCReset (void)
{
rpc_id = (XID) ~0L;
+ return 1;
}
XID
@@ -185,6 +196,7 @@ SecureRPCToID (data_length, data)
return rpc_id;
}
+int
SecureRPCFromID (id, data_lenp, datap)
XID id;
unsigned short *data_lenp;
@@ -193,6 +205,7 @@ SecureRPCFromID (id, data_lenp, datap)
return 0;
}
+int
SecureRPCRemove (data_length, data)
unsigned short data_length;
char *data;
diff --git a/os/secauth.c b/os/secauth.c
index a73f4e718..4f90fe9a9 100644
--- a/os/secauth.c
+++ b/os/secauth.c
@@ -1,6 +1,6 @@
-/* $Xorg: secauth.c,v 1.5 2001/02/15 02:06:01 coskrey Exp $ */
+/* $Xorg: secauth.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */
/*
-Copyright 1996, 1998, 2001 The Open Group
+Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -24,11 +24,13 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/os/secauth.c,v 1.11 2001/12/14 20:00:35 dawes Exp $ */
#include "X.h"
#include "os.h"
#include "osdep.h"
#include "dixstruct.h"
+#include "swaprep.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
@@ -39,11 +41,11 @@ static char InvalidPolicyReason[] = "invalid policy specification";
static char PolicyViolationReason[] = "policy violation";
static Bool
-AuthCheckSitePolicy(data_lengthP, dataP, client, reason)
- unsigned short *data_lengthP;
- char **dataP;
- ClientPtr client;
- char **reason;
+AuthCheckSitePolicy(
+ unsigned short *data_lengthP,
+ char **dataP,
+ ClientPtr client,
+ char **reason)
{
CARD8 *policy = *(CARD8 **)dataP;
int length;
@@ -65,7 +67,7 @@ AuthCheckSitePolicy(data_lengthP, dataP, client, reason)
sitePolicies = SecurityGetSitePolicyStrings(&nSitePolicies);
- while (nPolicies > 0) {
+ while (nPolicies) {
int strLen, sitePolicy;
if (length == 0) {
@@ -110,15 +112,13 @@ AuthCheckSitePolicy(data_lengthP, dataP, client, reason)
}
XID
-AuthSecurityCheck (data_length, data, client, reason)
- unsigned short data_length;
- char *data;
- ClientPtr client;
- char **reason;
+AuthSecurityCheck (
+ unsigned short data_length,
+ char *data,
+ ClientPtr client,
+ char **reason)
{
#ifdef XCSECURITY
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
- register ConnectionInputPtr oci = oc->input;
xConnSetupPrefix csp;
xReq freq;
diff --git a/os/utils.c b/os/utils.c
index 2c3d0ba63..4bbe9eb8c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -49,8 +49,14 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.
*/
+/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.85 2002/12/24 17:43:00 tsi Exp $ */
-#ifdef WIN32
+#ifdef __CYGWIN__
+#include <stdlib.h>
+#include <signal.h>
+#endif
+
+#if defined(WIN32) && !defined(__CYGWIN__)
#include <X11/Xwinsock.h>
#endif
#include "Xos.h"
@@ -58,7 +64,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "X.h"
#include "input.h"
-#include "opaque.h"
+#include "dixfont.h"
+#include "osdep.h"
#ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
#include <signal.h>
@@ -72,74 +79,69 @@ OR PERFORMANCE OF THIS SOFTWARE.
#undef _POSIX_SOURCE
#endif
#endif
-#ifndef WIN32
-#ifndef SYSV
+#include <sys/wait.h>
+#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4)
#include <sys/resource.h>
#endif
-#endif
#include <time.h>
#include <sys/stat.h>
#include <ctype.h> /* for isspace */
-#if NeedVarargsPrototypes
#include <stdarg.h>
+
+#if defined(DGUX)
+#include <sys/resource.h>
+#include <netdb.h>
#endif
+
+#include <stdlib.h> /* for malloc() */
+
#if defined(TCPCONN) || defined(STREAMSCONN)
# ifndef WIN32
# include <netdb.h>
# endif
#endif
-#define X_INCLUDE_NETDB_H
-#include <X11/Xos_r.h>
-
-extern char *display;
+#include "opaque.h"
-extern CARD32 defaultScreenSaverTime; /* for parsing command line */
-extern CARD32 defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultBackingStore;
-extern Bool disableBackingStore;
-extern Bool disableSaveUnders;
-extern Bool PartialNetwork;
-#ifndef NOLOGOHACK
-extern int logoScreenSaver;
-#endif
-#ifdef RLIMIT_DATA
-extern int limitDataSpace;
+#ifdef SMART_SCHEDULE
+#include "dixstruct.h"
#endif
-#ifdef RLIMIT_STACK
-extern int limitStackSpace;
+
+#ifdef XKB
+#include "XKBsrv.h"
#endif
-#ifdef RLIMIT_NOFILE
-extern int limitNoFile;
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
#endif
-extern int defaultColorVisualClass;
-extern Bool permitOldBugs;
-extern int monitorResolution;
-extern Bool defeatAccessControl;
-#ifdef DPMSExtension
-extern BOOL DPMSEnabledSwitch;
-extern BOOL DPMSDisabledSwitch;
+#ifdef RENDER
+#include "picture.h"
#endif
+#define X_INCLUDE_NETDB_H
+#include <X11/Xos_r.h>
+
+#include <errno.h>
+
Bool CoreDump;
Bool noTestExtensions;
-Bool noPanoramiXExtension = TRUE;
#ifdef PANORAMIX
+Bool noPanoramiXExtension = TRUE;
Bool PanoramiXVisibilityNotifySent = FALSE;
Bool PanoramiXMapped = FALSE;
Bool PanoramiXWindowExposureSent = FALSE;
Bool PanoramiXOneExposeRequest = FALSE;
#endif
+#ifdef DDXOSVERRORF
+void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
+#endif
+
int auditTrailLevel = 1;
-void ddxUseMsg();
-#if NeedVarargsPrototypes
-void VErrorF(char*, va_list);
-#endif
+Bool Must_have_memory = FALSE;
#ifdef AIXV3
int SyncOn = 0;
@@ -155,15 +157,13 @@ extern int SelectWaitTime;
#ifdef MEMBUG
#define MEM_FAIL_SCALE 100000
long Memory_fail = 0;
-
+#include <stdlib.h> /* for random() */
#endif
#ifdef sgi
int userdefinedfontpath = 0;
#endif /* sgi */
-Bool Must_have_memory = FALSE;
-
char *dev_tty_from_init = NULL; /* since we need to parse it anyway */
OsSigHandlerPtr
@@ -185,6 +185,206 @@ OsSignal(sig, handler)
return oact.sa_handler;
#endif
}
+
+#ifdef SERVER_LOCK
+/*
+ * Explicit support for a server lock file like the ones used for UUCP.
+ * For architectures with virtual terminals that can run more than one
+ * server at a time. This keeps the servers from stomping on each other
+ * if the user forgets to give them different display numbers.
+ */
+#ifndef __UNIXOS2__
+#define LOCK_DIR "/tmp"
+#endif
+#define LOCK_TMP_PREFIX "/.tX"
+#define LOCK_PREFIX "/.X"
+#define LOCK_SUFFIX "-lock"
+
+#if defined(DGUX)
+#include <limits.h>
+#include <sys/param.h>
+#endif
+
+#ifdef __UNIXOS2__
+#define link rename
+#endif
+
+#ifndef PATH_MAX
+#ifndef Lynx
+#include <sys/param.h>
+#else
+#include <param.h>
+#endif
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif
+
+static Bool StillLocking = FALSE;
+static char LockFile[PATH_MAX];
+static Bool nolock = FALSE;
+
+/*
+ * LockServer --
+ * Check if the server lock file exists. If so, check if the PID
+ * contained inside is valid. If so, then die. Otherwise, create
+ * the lock file containing the PID.
+ */
+void
+LockServer()
+{
+ char tmp[PATH_MAX], pid_str[12];
+ int lfd, i, haslock, l_pid, t;
+ char *tmppath = NULL;
+ int len;
+
+ if (nolock) return;
+ /*
+ * Path names
+ */
+#ifndef __UNIXOS2__
+ tmppath = LOCK_DIR;
+#else
+ /* OS/2 uses TMP directory, must also prepare for 8.3 names */
+ tmppath = getenv("TMP");
+ if (!tmppath)
+ FatalError("No TMP dir found\n");
+#endif
+
+ len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
+ strlen(LOCK_TMP_PREFIX);
+ len += strlen(tmppath) + strlen(display) + strlen(LOCK_SUFFIX) + 1;
+ if (len > sizeof(LockFile))
+ FatalError("Display name `%s' is too long\n");
+ (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, display);
+ (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, display);
+
+ /*
+ * Create a temporary file containing our PID. Attempt three times
+ * to create the file.
+ */
+ StillLocking = TRUE;
+ i = 0;
+ do {
+ i++;
+ lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (lfd < 0)
+ sleep(2);
+ else
+ break;
+ } while (i < 3);
+ if (lfd < 0) {
+ unlink(tmp);
+ i = 0;
+ do {
+ i++;
+ lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (lfd < 0)
+ sleep(2);
+ else
+ break;
+ } while (i < 3);
+ }
+ if (lfd < 0)
+ FatalError("Could not create lock file in %s\n", tmp);
+ (void) sprintf(pid_str, "%10ld\n", (long)getpid());
+ (void) write(lfd, pid_str, 11);
+#ifndef __UNIXOS2__
+#ifndef USE_CHMOD
+ (void) fchmod(lfd, 0444);
+#else
+ (void) chmod(tmp, 0444);
+#endif
+#endif
+ (void) close(lfd);
+
+ /*
+ * OK. Now the tmp file exists. Try three times to move it in place
+ * for the lock.
+ */
+ i = 0;
+ haslock = 0;
+ while ((!haslock) && (i++ < 3)) {
+ haslock = (link(tmp,LockFile) == 0);
+ if (haslock) {
+ /*
+ * We're done.
+ */
+ break;
+ }
+ else {
+ /*
+ * Read the pid from the existing file
+ */
+ lfd = open(LockFile, O_RDONLY);
+ if (lfd < 0) {
+ unlink(tmp);
+ FatalError("Can't read lock file %s\n", LockFile);
+ }
+ pid_str[0] = '\0';
+ if (read(lfd, pid_str, 11) != 11) {
+ /*
+ * Bogus lock file.
+ */
+ unlink(LockFile);
+ close(lfd);
+ continue;
+ }
+ pid_str[11] = '\0';
+ sscanf(pid_str, "%d", &l_pid);
+ close(lfd);
+
+ /*
+ * Now try to kill the PID to see if it exists.
+ */
+ errno = 0;
+ t = kill(l_pid, 0);
+ if ((t< 0) && (errno == ESRCH)) {
+ /*
+ * Stale lock file.
+ */
+ unlink(LockFile);
+ continue;
+ }
+ else if (((t < 0) && (errno == EPERM)) || (t == 0)) {
+ /*
+ * Process is still active.
+ */
+ unlink(tmp);
+ FatalError("Server is already active for display %s\n%s %s\n%s\n",
+ display, "\tIf this server is no longer running, remove",
+ LockFile, "\tand start again.");
+ }
+ }
+ }
+ unlink(tmp);
+ if (!haslock)
+ FatalError("Could not create server lock file: %s\n", LockFile);
+ StillLocking = FALSE;
+}
+
+/*
+ * UnlockServer --
+ * Remove the server lock file.
+ */
+void
+UnlockServer()
+{
+ if (nolock) return;
+
+ if (!StillLocking){
+
+#ifdef __UNIXOS2__
+ (void) chmod(LockFile,S_IREAD|S_IWRITE);
+#endif /* __UNIXOS2__ */
+ (void) unlink(LockFile);
+ }
+}
+#endif /* SERVER_LOCK */
/* Force connections to close on SIGHUP from init */
@@ -193,6 +393,8 @@ SIGVAL
AutoResetServer (sig)
int sig;
{
+ int olderrno = errno;
+
dispatchException |= DE_RESET;
isItTimeToYield = TRUE;
#ifdef GPROF
@@ -202,6 +404,7 @@ AutoResetServer (sig)
#if defined(SYSV) && defined(X_NOT_POSIX)
OsSignal (SIGHUP, AutoResetServer);
#endif
+ errno = olderrno;
}
/* Force connections to close and then exit on SIGTERM, SIGINT */
@@ -211,20 +414,25 @@ SIGVAL
GiveUp(sig)
int sig;
{
+ int olderrno = errno;
+
dispatchException |= DE_TERMINATE;
isItTimeToYield = TRUE;
#if defined(SYSV) && defined(X_NOT_POSIX)
if (sig)
OsSignal(sig, SIG_IGN);
#endif
+ errno = olderrno;
}
+#ifdef __GNUC__
+static void AbortServer() __attribute__((noreturn));
+#endif
static void
AbortServer()
{
- extern void AbortDDX();
-
+ OsCleanup();
AbortDDX();
fflush(stderr);
if (CoreDump)
@@ -250,6 +458,7 @@ GetTimeInMillis()
}
#endif
+void
AdjustWaitForDelay (waitTime, newdelay)
pointer waitTime;
unsigned long newdelay;
@@ -287,6 +496,8 @@ void UseMsg()
ErrorF("-audit int set audit trail level\n");
ErrorF("-auth file select authorization file\n");
ErrorF("bc enable bug compatibility\n");
+ ErrorF("-br create root window with black background\n");
+ ErrorF("+bs enable any backing store support\n");
ErrorF("-bs disable any backing store support\n");
ErrorF("-c turns off key-click\n");
ErrorF("c # key-click volume (0-100)\n");
@@ -317,14 +528,22 @@ void UseMsg()
#ifdef RLIMIT_STACK
ErrorF("-ls int limit stack space to N Kb\n");
#endif
+#ifdef SERVER_LOCK
+ ErrorF("-nolock disable the locking mechanism\n");
+#endif
#ifndef NOLOGOHACK
ErrorF("-logo enable logo in screen saver\n");
ErrorF("nologo disable logo in screen saver\n");
#endif
+ ErrorF("-nolisten string don't listen on protocol\n");
ErrorF("-p # screen-saver pattern duration (minutes)\n");
ErrorF("-pn accept failure to listen on all ports\n");
+ ErrorF("-nopn reject failure to listen on all ports\n");
ErrorF("-r turns off auto-repeat\n");
ErrorF("r turns on auto-repeat \n");
+#ifdef RENDER
+ ErrorF("-render [default|mono|gray|color] set render color alloc policy\n");
+#endif
ErrorF("-s # screen-saver timeout (minutes)\n");
#ifdef XCSECURITY
ErrorF("-sp file security policy file\n");
@@ -338,11 +557,11 @@ void UseMsg()
ErrorF("v video blanking for screen-saver\n");
ErrorF("-v screen-saver without video blanking\n");
ErrorF("-wm WhenMapped default backing-store\n");
+ ErrorF("-x string loads named extension at init time \n");
#ifdef PANORAMIX
ErrorF("+xinerama Enable XINERAMA extension\n");
ErrorF("-xinerama Disable XINERAMA extension\n");
#endif
- ErrorF("-x string loads named extension at init time \n");
#ifdef XDMCP
XdmcpUseMsg();
#endif
@@ -353,6 +572,24 @@ void UseMsg()
ddxUseMsg();
}
+/* This function performs a rudimentary sanity check
+ * on the display name passed in on the command-line,
+ * since this string is used to generate filenames.
+ * It is especially important that the display name
+ * not contain a "/" and not start with a "-".
+ * --kvajk
+ */
+int VerifyDisplayName( d )
+char *d;
+{
+ if ( d == (char *)0 ) return( 0 ); /* null */
+ if ( *d == '\0' ) return( 0 ); /* empty */
+ if ( *d == '-' ) return( 0 ); /* could be confused for an option */
+ if ( *d == '.' ) return( 0 ); /* must not equal "." or ".." */
+ if ( strchr(d, '/') != (char *)0 ) return( 0 ); /* very important!!! */
+ return( 1 );
+}
+
/*
* This function parses the command line. Handles device-independent fields
* and allows ddx to handle additional fields. It is not allowed to modify
@@ -368,10 +605,14 @@ char *argv[];
defaultKeyboardControl.autoRepeat = TRUE;
+#ifdef PART_NET
+ PartialNetwork = TRUE;
+#endif
+
for ( i = 1; i < argc; i++ )
{
/* call ddx first, so it can peek/override if it wants */
- if(skip = ddxProcessArgument(argc, argv, i))
+ if((skip = ddxProcessArgument(argc, argv, i)))
{
i += (skip - 1);
}
@@ -380,6 +621,11 @@ char *argv[];
/* initialize display */
display = argv[i];
display++;
+ if( ! VerifyDisplayName( display ) ) {
+ ErrorF("Bad display name: %s\n", display);
+ UseMsg();
+ exit(1);
+ }
}
else if ( strcmp( argv[i], "-a") == 0)
{
@@ -417,6 +663,10 @@ char *argv[];
}
else if ( strcmp( argv[i], "bc") == 0)
permitOldBugs = TRUE;
+ else if ( strcmp( argv[i], "-br") == 0)
+ blackRoot = TRUE;
+ else if ( strcmp( argv[i], "+bs") == 0)
+ enableBackingStore = TRUE;
else if ( strcmp( argv[i], "-bs") == 0)
disableBackingStore = TRUE;
else if ( strcmp( argv[i], "c") == 0)
@@ -544,6 +794,17 @@ char *argv[];
UseMsg();
}
#endif
+#ifdef SERVER_LOCK
+ else if ( strcmp ( argv[i], "-nolock") == 0)
+ {
+#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__)
+ if (getuid() != 0)
+ ErrorF("Warning: the -nolock option can only be used by root\n");
+ else
+#endif
+ nolock = TRUE;
+ }
+#endif
#ifndef NOLOGOHACK
else if ( strcmp( argv[i], "-logo") == 0)
{
@@ -554,6 +815,19 @@ char *argv[];
logoScreenSaver = 0;
}
#endif
+ else if ( strcmp( argv[i], "-nolisten") == 0)
+ {
+ if(++i < argc)
+ protNoListen = argv[i];
+ else
+ UseMsg();
+ }
+ else if ( strcmp( argv[i], "-noreset") == 0)
+ {
+ extern char dispatchExceptionAtReset;
+
+ dispatchExceptionAtReset = 0;
+ }
else if ( strcmp( argv[i], "-p") == 0)
{
if(++i < argc)
@@ -564,6 +838,8 @@ char *argv[];
}
else if ( strcmp( argv[i], "-pn") == 0)
PartialNetwork = TRUE;
+ else if ( strcmp( argv[i], "-nopn") == 0)
+ PartialNetwork = FALSE;
else if ( strcmp( argv[i], "r") == 0)
defaultKeyboardControl.autoRepeat = TRUE;
else if ( strcmp( argv[i], "-r") == 0)
@@ -587,9 +863,9 @@ char *argv[];
}
else if ( strcmp( argv[i], "-terminate") == 0)
{
- extern Bool terminateAtReset;
+ extern char dispatchExceptionAtReset;
- terminateAtReset = TRUE;
+ dispatchExceptionAtReset = DE_TERMINATE;
}
else if ( strcmp( argv[i], "-to") == 0)
{
@@ -665,8 +941,50 @@ char *argv[];
SyncOn++;
}
#endif
+#ifdef SMART_SCHEDULE
+ else if ( strcmp( argv[i], "-dumbSched") == 0)
+ {
+ SmartScheduleDisable = TRUE;
+ }
+ else if ( strcmp( argv[i], "-schedInterval") == 0)
+ {
+ if (++i < argc)
+ {
+ SmartScheduleInterval = atoi(argv[i]);
+ SmartScheduleSlice = SmartScheduleInterval;
+ }
+ else
+ UseMsg();
+ }
+ else if ( strcmp( argv[i], "-schedMax") == 0)
+ {
+ if (++i < argc)
+ {
+ SmartScheduleMaxSlice = atoi(argv[i]);
+ }
+ else
+ UseMsg();
+ }
+#endif
+#ifdef RENDER
+ else if ( strcmp( argv[i], "-render" ) == 0)
+ {
+ if (++i < argc)
+ {
+ int policy = PictureParseCmapPolicy (argv[i]);
+
+ if (policy != PictureCmapPolicyInvalid)
+ PictureCmapPolicy = policy;
+ else
+ UseMsg ();
+ }
+ else
+ UseMsg ();
+ }
+#endif
else
{
+ ErrorF("Unrecognized option: %s\n", argv[i]);
UseMsg();
exit (1);
}
@@ -771,6 +1089,12 @@ ExpandCommandLine(pargc, pargv)
char ***pargv;
{
int i;
+
+#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__)
+ if (getuid() != geteuid())
+ return;
+#endif
+
for (i = 1; i < *pargc; i++)
{
if ( (0 == strcmp((*pargv)[i], "-config")) && (i < (*pargc - 1)) )
@@ -803,7 +1127,9 @@ pointer client;
char hname[1024], *hnameptr;
struct hostent *host;
int len;
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
+#endif
gethostname(hname, 1024);
host = _XGethostbyname(hname, hparams);
@@ -843,15 +1169,17 @@ pointer client;
* expectations of malloc, but this makes lint happier.
*/
-unsigned long *
+#ifndef INTERNAL_MALLOC
+
+void *
Xalloc (amount)
unsigned long amount;
{
- char *malloc();
register pointer ptr;
- if ((long)amount <= 0)
+ if ((long)amount <= 0) {
return (unsigned long *)NULL;
+ }
/* aligned extra on long word boundary */
amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
#ifdef MEMBUG
@@ -859,8 +1187,9 @@ Xalloc (amount)
((random() % MEM_FAIL_SCALE) < Memory_fail))
return (unsigned long *)NULL;
#endif
- if (ptr = (pointer)malloc(amount))
+ if ((ptr = (pointer)malloc(amount))) {
return (unsigned long *)ptr;
+ }
if (Must_have_memory)
FatalError("Out of memory");
return (unsigned long *)NULL;
@@ -871,11 +1200,10 @@ Xalloc (amount)
* "no failure" realloc, alternate interface to Xalloc w/o Must_have_memory
*****************/
-unsigned long *
+void *
XNFalloc (amount)
unsigned long amount;
{
- char *malloc();
register pointer ptr;
if ((long)amount <= 0)
@@ -896,7 +1224,7 @@ XNFalloc (amount)
* Xcalloc
*****************/
-unsigned long *
+void *
Xcalloc (amount)
unsigned long amount;
{
@@ -909,17 +1237,32 @@ Xcalloc (amount)
}
/*****************
+ * XNFcalloc
+ *****************/
+
+void *
+XNFcalloc (amount)
+ unsigned long amount;
+{
+ unsigned long *ret;
+
+ ret = Xalloc (amount);
+ if (ret)
+ bzero ((char *) ret, (int) amount);
+ else if ((long)amount > 0)
+ FatalError("Out of memory");
+ return ret;
+}
+
+/*****************
* Xrealloc
*****************/
-unsigned long *
+void *
Xrealloc (ptr, amount)
register pointer ptr;
unsigned long amount;
{
- char *malloc();
- char *realloc();
-
#ifdef MEMBUG
if (!Must_have_memory && Memory_fail &&
((random() % MEM_FAIL_SCALE) < Memory_fail))
@@ -948,14 +1291,15 @@ Xrealloc (ptr, amount)
* "no failure" realloc, alternate interface to Xrealloc w/o Must_have_memory
*****************/
-unsigned long *
+void *
XNFrealloc (ptr, amount)
register pointer ptr;
unsigned long amount;
{
if (( ptr = (pointer)Xrealloc( ptr, amount ) ) == NULL)
{
- FatalError( "Out of memory" );
+ if ((long)amount > 0)
+ FatalError( "Out of memory" );
}
return ((unsigned long *)ptr);
}
@@ -973,6 +1317,7 @@ Xfree(ptr)
free((char *)ptr);
}
+void
OsInitAllocator ()
{
#ifdef MEMBUG
@@ -985,24 +1330,51 @@ OsInitAllocator ()
been_here = 1;
#endif
}
+#endif /* !INTERNAL_MALLOC */
+
+
+char *
+Xstrdup(const char *s)
+{
+ char *sd;
+
+ if (s == NULL)
+ return NULL;
+
+ sd = (char *)Xalloc(strlen(s) + 1);
+ if (sd != NULL)
+ strcpy(sd, s);
+ return sd;
+}
+
+
+char *
+XNFstrdup(const char *s)
+{
+ char *sd;
+
+ if (s == NULL)
+ return NULL;
+
+ sd = (char *)XNFalloc(strlen(s) + 1);
+ strcpy(sd, s);
+ return sd;
+}
+
void
AuditPrefix(f)
- char *f;
+ const char *f;
{
-#ifdef X_NOT_STDC_ENV
- long tm;
-#else
time_t tm;
-#endif
char *autime, *s;
if (*f != ' ')
{
time(&tm);
autime = ctime(&tm);
- if (s = strchr(autime, '\n'))
+ if ((s = strchr(autime, '\n')))
*s = '\0';
- if (s = strrchr(argvGlobal[0], '/'))
+ if ((s = strrchr(argvGlobal[0], '/')))
s++;
else
s = argvGlobal[0];
@@ -1010,96 +1382,669 @@ AuditPrefix(f)
}
}
-/*VARARGS1*/
void
-AuditF(
-#if NeedVarargsPrototypes
- char * f, ...)
-#else
- f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
- char *f;
- char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
-#endif
+AuditF(const char * f, ...)
{
-#if NeedVarargsPrototypes
va_list args;
-#endif
AuditPrefix(f);
-#if NeedVarargsPrototypes
va_start(args, f);
VErrorF(f, args);
va_end(args);
-#else
- ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-#endif
}
-/*VARARGS1*/
void
-FatalError(
-#if NeedVarargsPrototypes
- char *f, ...)
-#else
-f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
- char *f;
- char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
-#endif
+FatalError(const char *f, ...)
{
-#if NeedVarargsPrototypes
va_list args;
-#endif
- ErrorF("\nFatal server error:\n");
-#if NeedVarargsPrototypes
+ static Bool beenhere = FALSE;
+
+ if (beenhere)
+ ErrorF("\nFatalError re-entered, aborting\n");
+ else
+ ErrorF("\nFatal server error:\n");
+
va_start(args, f);
VErrorF(f, args);
va_end(args);
-#else
- ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-#endif
ErrorF("\n");
- AbortServer();
+#ifdef DDXOSFATALERROR
+ if (!beenhere)
+ OsVendorFatalError();
+#endif
+#ifdef ABORTONFATALERROR
+ abort();
+#endif
+ if (!beenhere) {
+ beenhere = TRUE;
+ AbortServer();
+ } else
+ abort();
/*NOTREACHED*/
}
-#if NeedVarargsPrototypes
void
VErrorF(f, args)
- char *f;
+ const char *f;
va_list args;
{
#ifdef AIXV3
if (SyncOn)
sync();
#else
+#ifdef DDXOSVERRORF
+ if (OsVendorVErrorFProc)
+ OsVendorVErrorFProc(f, args);
+ else
+ vfprintf(stderr, f, args);
+#else
vfprintf(stderr, f, args);
+#endif
#endif /* AIXV3 */
}
-#endif
-/*VARARGS1*/
void
-ErrorF(
-#if NeedVarargsPrototypes
- char * f, ...)
-#else
- f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
- char *f;
- char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+VFatalError(const char *msg, va_list args)
+{
+ VErrorF(msg, args);
+ ErrorF("\n");
+#ifdef DDXOSFATALERROR
+ OsVendorFatalError();
#endif
+ AbortServer();
+ /*NOTREACHED*/
+}
+
+void
+ErrorF(const char * f, ...)
{
-#if NeedVarargsPrototypes
va_list args;
va_start(args, f);
VErrorF(f, args);
va_end(args);
+}
+
+#ifdef SMART_SCHEDULE
+
+unsigned long SmartScheduleIdleCount;
+Bool SmartScheduleIdle;
+Bool SmartScheduleTimerStopped;
+
+#ifdef SIGVTALRM
+#define SMART_SCHEDULE_POSSIBLE
+#endif
+
+#ifdef SMART_SCHEDULE_POSSIBLE
+#define SMART_SCHEDULE_SIGNAL SIGALRM
+#define SMART_SCHEDULE_TIMER ITIMER_REAL
+#endif
+
+void
+SmartScheduleStopTimer (void)
+{
+#ifdef SMART_SCHEDULE_POSSIBLE
+ struct itimerval timer;
+
+ timer.it_interval.tv_sec = 0;
+ timer.it_interval.tv_usec = 0;
+ timer.it_value.tv_sec = 0;
+ timer.it_value.tv_usec = 0;
+ (void) setitimer (ITIMER_REAL, &timer, 0);
+ SmartScheduleTimerStopped = TRUE;
+#endif
+}
+
+Bool
+SmartScheduleStartTimer (void)
+{
+#ifdef SMART_SCHEDULE_POSSIBLE
+ struct itimerval timer;
+
+ SmartScheduleTimerStopped = FALSE;
+ timer.it_interval.tv_sec = 0;
+ timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
+ timer.it_value.tv_sec = 0;
+ timer.it_value.tv_usec = SmartScheduleInterval * 1000;
+ return setitimer (ITIMER_REAL, &timer, 0) >= 0;
+#endif
+ return FALSE;
+}
+
+#ifdef SMART_SCHEDULE_POSSIBLE
+void
+SmartScheduleTimer (int sig)
+{
+ int olderrno = errno;
+
+ SmartScheduleTime += SmartScheduleInterval;
+ if (SmartScheduleIdle)
+ {
+ SmartScheduleStopTimer ();
+ }
+ errno = olderrno;
+}
+#endif
+
+Bool
+SmartScheduleInit (void)
+{
+#ifdef SMART_SCHEDULE_POSSIBLE
+ struct sigaction act;
+
+ if (SmartScheduleDisable)
+ return TRUE;
+
+ bzero ((char *) &act, sizeof(struct sigaction));
+
+ /* Set up the timer signal function */
+ act.sa_handler = SmartScheduleTimer;
+ sigemptyset (&act.sa_mask);
+ sigaddset (&act.sa_mask, SMART_SCHEDULE_SIGNAL);
+ if (sigaction (SMART_SCHEDULE_SIGNAL, &act, 0) < 0)
+ {
+ perror ("sigaction for smart scheduler");
+ return FALSE;
+ }
+ /* Set up the virtual timer */
+ if (!SmartScheduleStartTimer ())
+ {
+ perror ("scheduling timer");
+ return FALSE;
+ }
+ /* stop the timer and wait for WaitForSomething to start it */
+ SmartScheduleStopTimer ();
+ return TRUE;
#else
-#ifdef AIXV3
- if (SyncOn)
- sync();
-#else /* not AIXV3 */
- fprintf( stderr, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-#endif /* AIXV3 */
+ return FALSE;
+#endif
+}
+#endif
+
+#ifdef SIG_BLOCK
+static sigset_t PreviousSignalMask;
+static int BlockedSignalCount;
+#endif
+
+void
+OsBlockSignals (void)
+{
+#ifdef SIG_BLOCK
+ if (BlockedSignalCount++ == 0)
+ {
+ sigset_t set;
+
+ sigemptyset (&set);
+#ifdef SIGALRM
+ sigaddset (&set, SIGALRM);
+#endif
+#ifdef SIGVTALRM
+ sigaddset (&set, SIGVTALRM);
+#endif
+#ifdef SIGWINCH
+ sigaddset (&set, SIGWINCH);
+#endif
+#ifdef SIGIO
+ sigaddset (&set, SIGIO);
+#endif
+#ifdef SIGTSTP
+ sigaddset (&set, SIGTSTP);
+#endif
+#ifdef SIGTTIN
+ sigaddset (&set, SIGTTIN);
+#endif
+#ifdef SIGTTOU
+ sigaddset (&set, SIGTTOU);
+#endif
+ sigprocmask (SIG_BLOCK, &set, &PreviousSignalMask);
+ }
+#endif
+}
+
+void
+OsReleaseSignals (void)
+{
+#ifdef SIG_BLOCK
+ if (--BlockedSignalCount == 0)
+ {
+ sigprocmask (SIG_SETMASK, &PreviousSignalMask, 0);
+ }
+#endif
+}
+
+#if !defined(WIN32) && !defined(__UNIXOS2__)
+/*
+ * "safer" versions of system(3), popen(3) and pclose(3) which give up
+ * all privs before running a command.
+ *
+ * This is based on the code in FreeBSD 2.2 libc.
+ *
+ * XXX It'd be good to redirect stderr so that it ends up in the log file
+ * as well. As it is now, xkbcomp messages don't end up in the log file.
+ */
+
+int
+System(command)
+ char *command;
+{
+ int pid, p;
+#ifdef SIGCHLD
+ void (*csig)(int);
+#endif
+ int status;
+
+ if (!command)
+ return(1);
+
+#ifdef SIGCHLD
+ csig = signal(SIGCHLD, SIG_DFL);
+#endif
+
+#ifdef DEBUG
+ ErrorF("System: `%s'\n", command);
+#endif
+
+ switch (pid = fork()) {
+ case -1: /* error */
+ p = -1;
+ case 0: /* child */
+ setgid(getgid());
+ setuid(getuid());
+ execl("/bin/sh", "sh", "-c", command, (char *)NULL);
+ _exit(127);
+ default: /* parent */
+ do {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && errno == EINTR);
+
+ }
+
+#ifdef SIGCHLD
+ signal(SIGCHLD, csig);
+#endif
+
+ return p == -1 ? -1 : status;
+}
+
+static struct pid {
+ struct pid *next;
+ FILE *fp;
+ int pid;
+} *pidlist;
+
+pointer
+Popen(command, type)
+ char *command;
+ char *type;
+{
+ struct pid *cur;
+ FILE *iop;
+ int pdes[2], pid;
+
+ if (command == NULL || type == NULL)
+ return NULL;
+
+ if ((*type != 'r' && *type != 'w') || type[1])
+ return NULL;
+
+ if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL)
+ return NULL;
+
+ if (pipe(pdes) < 0) {
+ xfree(cur);
+ return NULL;
+ }
+
+ switch (pid = fork()) {
+ case -1: /* error */
+ close(pdes[0]);
+ close(pdes[1]);
+ xfree(cur);
+ return NULL;
+ case 0: /* child */
+ setgid(getgid());
+ setuid(getuid());
+ if (*type == 'r') {
+ if (pdes[1] != 1) {
+ /* stdout */
+ dup2(pdes[1], 1);
+ close(pdes[1]);
+ }
+ close(pdes[0]);
+ } else {
+ if (pdes[0] != 0) {
+ /* stdin */
+ dup2(pdes[0], 0);
+ close(pdes[0]);
+ }
+ close(pdes[1]);
+ }
+ execl("/bin/sh", "sh", "-c", command, (char *)NULL);
+ _exit(127);
+ }
+
+ /* Avoid EINTR during stdio calls */
+ OsBlockSignals ();
+
+ /* parent */
+ if (*type == 'r') {
+ iop = fdopen(pdes[0], type);
+ close(pdes[1]);
+ } else {
+ iop = fdopen(pdes[1], type);
+ close(pdes[0]);
+ }
+
+ cur->fp = iop;
+ cur->pid = pid;
+ cur->next = pidlist;
+ pidlist = cur;
+
+#ifdef DEBUG
+ ErrorF("Popen: `%s', fp = %p\n", command, iop);
+#endif
+
+ return iop;
+}
+
+int
+Pclose(iop)
+ pointer iop;
+{
+ struct pid *cur, *last;
+ int pstat;
+ int pid;
+
+#ifdef DEBUG
+ ErrorF("Pclose: fp = %p\n", iop);
+#endif
+
+ fclose(iop);
+
+ for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next)
+ if (cur->fp == iop)
+ break;
+ if (cur == NULL)
+ return -1;
+
+ do {
+ pid = waitpid(cur->pid, &pstat, 0);
+ } while (pid == -1 && errno == EINTR);
+
+ if (last == NULL)
+ pidlist = cur->next;
+ else
+ last->next = cur->next;
+ xfree(cur);
+
+ /* allow EINTR again */
+ OsReleaseSignals ();
+
+ return pid == -1 ? -1 : pstat;
+}
+#endif /* !WIN32 && !__UNIXOS2__ */
+
+
+/*
+ * CheckUserParameters: check for long command line arguments and long
+ * environment variables. By default, these checks are only done when
+ * the server's euid != ruid. In 3.3.x, these checks were done in an
+ * external wrapper utility.
+ */
+
+/* Consider LD* variables insecure? */
+#ifndef REMOVE_ENV_LD
+#define REMOVE_ENV_LD 1
+#endif
+
+/* Remove long environment variables? */
+#ifndef REMOVE_LONG_ENV
+#define REMOVE_LONG_ENV 1
+#endif
+
+/*
+ * Disallow stdout or stderr as pipes? It's possible to block the X server
+ * when piping stdout+stderr to a pipe.
+ *
+ * Don't enable this because it looks like it's going to cause problems.
+ */
+#ifndef NO_OUTPUT_PIPES
+#define NO_OUTPUT_PIPES 0
+#endif
+
+
+/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
+#ifndef CHECK_EUID
+#define CHECK_EUID 1
+#endif
+
+/*
+ * Maybe the locale can be faked to make isprint(3) report that everything
+ * is printable? Avoid it by default.
+ */
+#ifndef USE_ISPRINT
+#define USE_ISPRINT 0
+#endif
+
+#define MAX_ARG_LENGTH 128
+#define MAX_ENV_LENGTH 256
+#define MAX_ENV_PATH_LENGTH 2048 /* Limit for *PATH and TERMCAP */
+
+#if USE_ISPRINT
+#include <ctype.h>
+#define checkPrintable(c) isprint(c)
+#else
+#define checkPrintable(c) (((c) & 0x7f) >= 0x20 && ((c) & 0x7f) != 0x7f)
+#endif
+
+enum BadCode {
+ NotBad = 0,
+ UnsafeArg,
+ ArgTooLong,
+ UnprintableArg,
+ EnvTooLong,
+ OutputIsPipe,
+ InternalError
+};
+
+#define ARGMSG \
+ "\nIf the arguments used are valid, and have been rejected incorrectly\n" \
+ "please send details of the arguments and why they are valid to\n" \
+ "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \
+ "the \"super user\" (root).\n"
+
+#define ENVMSG \
+ "\nIf the environment is valid, and have been rejected incorrectly\n" \
+ "please send details of the environment and why it is valid to\n" \
+ "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \
+ "the \"super user\" (root).\n"
+
+void
+CheckUserParameters(int argc, char **argv, char **envp)
+{
+ enum BadCode bad = NotBad;
+ int i = 0, j;
+ char *a, *e = NULL;
+#if defined(__QNX__) && !defined(__QNXNTO__)
+ char cmd_name[64];
+#endif
+
+#if CHECK_EUID
+ if (geteuid() == 0 && getuid() != geteuid())
+#endif
+ {
+ /* Check each argv[] */
+ for (i = 1; i < argc; i++) {
+ if (strlen(argv[i]) > MAX_ARG_LENGTH) {
+ bad = ArgTooLong;
+ break;
+ }
+ a = argv[i];
+ while (*a) {
+ if (checkPrintable(*a) == 0) {
+ bad = UnprintableArg;
+ break;
+ }
+ a++;
+ }
+ if (bad)
+ break;
+ }
+ if (!bad) {
+ /* Check each envp[] */
+ for (i = 0; envp[i]; i++) {
+
+ /* Check for bad environment variables and values */
+#if REMOVE_ENV_LD
+ while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
+#ifdef ENVDEBUG
+ ErrorF("CheckUserParameters: removing %s from the "
+ "environment\n", strtok(envp[i], "="));
+#endif
+ for (j = i; envp[j]; j++) {
+ envp[j] = envp[j+1];
+ }
+ }
+#endif
+ if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
+#if REMOVE_LONG_ENV
+#ifdef ENVDEBUG
+ ErrorF("CheckUserParameters: removing %s from the "
+ "environment\n", strtok(envp[i], "="));
+#endif
+ for (j = i; envp[j]; j++) {
+ envp[j] = envp[j+1];
+ }
+ i--;
+#else
+ char *eq;
+ int len;
+
+ eq = strchr(envp[i], '=');
+ if (!eq)
+ continue;
+ len = eq - envp[i];
+ e = malloc(len + 1);
+ if (!e) {
+ bad = InternalError;
+ break;
+ }
+ strncpy(e, envp[i], len);
+ e[len] = 0;
+ if (len >= 4 &&
+ (strcmp(e + len - 4, "PATH") == 0 ||
+ strcmp(e, "TERMCAP") == 0)) {
+ if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
+ bad = EnvTooLong;
+ break;
+ } else {
+ free(e);
+ }
+ } else {
+ bad = EnvTooLong;
+ break;
+ }
+#endif
+ }
+ }
+ }
+#if NO_OUTPUT_PIPES
+ if (!bad) {
+ struct stat buf;
+
+ if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode))
+ bad = OutputIsPipe;
+ if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode))
+ bad = OutputIsPipe;
+ }
+#endif
+ }
+ switch (bad) {
+ case NotBad:
+ return;
+ case UnsafeArg:
+ ErrorF("Command line argument number %d is unsafe\n", i);
+ ErrorF(ARGMSG);
+ break;
+ case ArgTooLong:
+ ErrorF("Command line argument number %d is too long\n", i);
+ ErrorF(ARGMSG);
+ break;
+ case UnprintableArg:
+ ErrorF("Command line argument number %d contains unprintable"
+ " characters\n", i);
+ ErrorF(ARGMSG);
+ break;
+ case EnvTooLong:
+ ErrorF("Environment variable `%s' is too long\n", e);
+ ErrorF(ENVMSG);
+ break;
+ case OutputIsPipe:
+ ErrorF("Stdout and/or stderr is a pipe\n");
+ break;
+ case InternalError:
+ ErrorF("Internal Error\n");
+ break;
+ default:
+ ErrorF("Unknown error\n");
+ ErrorF(ARGMSG);
+ ErrorF(ENVMSG);
+ break;
+ }
+ FatalError("X server aborted because of unsafe environment\n");
+}
+
+/*
+ * CheckUserAuthorization: check if the user is allowed to start the
+ * X server. This usually means some sort of PAM checking, and it is
+ * usually only done for setuid servers (uid != euid).
+ */
+
+#ifdef USE_PAM
+#include <security/pam_appl.h>
+#include <security/pam_misc.h>
+#include <pwd.h>
+#endif /* USE_PAM */
+
+void
+CheckUserAuthorization()
+{
+#ifdef USE_PAM
+ static struct pam_conv conv = {
+ misc_conv,
+ NULL
+ };
+
+ pam_handle_t *pamh = NULL;
+ struct passwd *pw;
+ int retval;
+
+ if (getuid() != geteuid()) {
+ pw = getpwuid(getuid());
+ if (pw == NULL)
+ FatalError("getpwuid() failed for uid %d\n", getuid());
+
+ retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
+ if (retval != PAM_SUCCESS)
+ FatalError("pam_start() failed.\n"
+ "\tMissing or mangled PAM config file or module?\n");
+
+ retval = pam_authenticate(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ FatalError("PAM authentication failed, cannot start X server.\n"
+ "\tPerhaps you do not have console ownership?\n");
+ }
+
+ retval = pam_acct_mgmt(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ FatalError("PAM authentication failed, cannot start X server.\n"
+ "\tPerhaps you do not have console ownership?\n");
+ }
+
+ /* this is not a session, so do not do session management */
+ pam_end(pamh, PAM_SUCCESS);
+ }
#endif
}
diff --git a/os/xdmauth.c b/os/xdmauth.c
index d6abd6a14..eb1385408 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/os/xdmauth.c,v 1.7 2002/11/05 05:50:34 keithp Exp $ */
/*
* XDM-AUTHENTICATION-1 (XDMCP authentication) and
@@ -348,6 +349,7 @@ XID id;
switch (data_length)
{
case 16: /* auth from files is 16 bytes long */
+#ifdef XDMCP
if (authFromXDMCP)
{
/* R5 xdm sent bogus authorization data in the accept packet,
@@ -357,15 +359,18 @@ XID id;
key_bits[0] = '\0';
}
else
+#endif
{
rho_bits = (unsigned char *) data;
key_bits = (unsigned char *) (data + 8);
}
break;
+#ifdef XDMCP
case 8: /* auth from XDMCP is 8 bytes long */
rho_bits = rho.data;
key_bits = (unsigned char *) data;
break;
+#endif
default:
return 0;
}
@@ -415,7 +420,7 @@ XdmCheckCookie (cookie_length, cookie, xclient, reason)
}
int
-XdmResetCookie ()
+XdmResetCookie (void)
{
XdmAuthorizationPtr auth, next_auth;
XdmClientAuthPtr client, next_client;
@@ -493,10 +498,12 @@ char *data;
rho_bits = (XdmAuthKeyPtr) data;
key_bits = (XdmAuthKeyPtr) (data + 8);
break;
+#ifdef XDMCP
case 8:
rho_bits = &rho;
key_bits = (XdmAuthKeyPtr) data;
break;
+#endif
default:
return 0;
}
diff --git a/os/xdmcp.c b/os/xdmcp.c
index 6d683b66d..b6a5db35f 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -13,6 +13,7 @@
* without express or implied warranty.
*
*/
+/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.21 2002/03/11 16:22:28 keithp Exp $ */
#ifdef WIN32
/* avoid conflicting definitions */
@@ -27,13 +28,20 @@
#undef RT_FONT
#undef RT_CURSOR
#endif
+
#include "Xos.h"
-#ifndef WIN32
+
+#if !defined(WIN32)
+#ifndef Lynx
#include <sys/param.h>
#include <sys/socket.h>
+#else
+#include <socket.h>
+#endif
#include <netinet/in.h>
#include <netdb.h>
#endif
+
#include <stdio.h>
#include "X.h"
#include "Xmd.h"
@@ -44,6 +52,11 @@
#include "dixstruct.h"
#include "opaque.h"
+#if defined(DGUX)
+#include <net/net_ioctl.h>
+#include <sys/ioctl.h>
+#endif
+
#ifdef STREAMSCONN
#include <tiuser.h>
#include <netconfig.h>
@@ -52,14 +65,11 @@
#ifdef XDMCP
#undef REQUEST
-#include "Xdmcp.h"
+#include <X11/Xdmcp.h>
#define X_INCLUDE_NETDB_H
#include <X11/Xos_r.h>
-extern char *display;
-extern fd_set EnabledDevices;
-extern fd_set AllClients;
extern char *defaultDisplayClass;
static int xdmcpSocket, sessionSocket;
@@ -80,6 +90,19 @@ static char *xdmAuthCookie;
static XdmcpBuffer buffer;
static struct sockaddr_in ManagerAddress;
+static struct sockaddr_in FromAddress;
+
+static void XdmcpAddHost(
+ struct sockaddr_in *from,
+ int fromlen,
+ ARRAY8Ptr AuthenticationName,
+ ARRAY8Ptr hostname,
+ ARRAY8Ptr status);
+
+static void XdmcpSelectHost(
+ struct sockaddr_in *host_sockaddr,
+ int host_len,
+ ARRAY8Ptr AuthenticationName);
static void get_xdmcp_sock(
#if NeedFunctionPrototypes
@@ -149,20 +172,20 @@ static void recv_alive_msg(
#endif
);
-static XdmcpFatal(
+static void XdmcpFatal(
#if NeedFunctionPrototypes
char */*type*/,
ARRAY8Ptr /*status*/
#endif
);
-static XdmcpWarning(
+static void XdmcpWarning(
#if NeedFunctionPrototypes
char */*str*/
#endif
);
-static get_manager_by_name(
+static void get_manager_by_name(
#if NeedFunctionPrototypes
int /*argc*/,
char **/*argv*/,
@@ -170,19 +193,21 @@ static get_manager_by_name(
#endif
);
+static void get_fromaddr_by_name(int /*argc*/, char **/*argv*/, int /*i*/);
+
static void receive_packet(
#if NeedFunctionPrototypes
void
#endif
);
-static send_packet(
+static void send_packet(
#if NeedFunctionPrototypes
void
#endif
);
-extern int XdmcpDeadSession(
+extern void XdmcpDeadSession(
#if NeedFunctionPrototypes
char */*reason*/
#endif
@@ -194,7 +219,7 @@ static void timeout(
#endif
);
-static restart(
+static void restart(
#if NeedFunctionPrototypes
void
#endif
@@ -223,15 +248,19 @@ void XdmcpRegisterManufacturerDisplayID(
#endif
);
+
static short xdm_udp_port = XDM_UDP_PORT;
static Bool OneSession = FALSE;
+static const char *xdm_from = NULL;
-XdmcpUseMsg ()
+void
+XdmcpUseMsg (void)
{
ErrorF("-query host-name contact named host for XDMCP\n");
ErrorF("-broadcast broadcast for XDMCP\n");
ErrorF("-indirect host-name contact named host for indirect XDMCP\n");
ErrorF("-port port-num UDP port number to send messages to\n");
+ ErrorF("-from local-address specify the local address to connect from\n");
ErrorF("-once Terminate server after one session\n");
ErrorF("-class display-class specify display class to send in manage\n");
#ifdef HASXDMAUTH
@@ -241,9 +270,7 @@ XdmcpUseMsg ()
}
int
-XdmcpOptions(argc, argv, i)
- int argc, i;
- char **argv;
+XdmcpOptions(int argc, char **argv, int i)
{
if (strcmp(argv[i], "-query") == 0) {
get_manager_by_name(argc, argv, ++i);
@@ -263,28 +290,44 @@ XdmcpOptions(argc, argv, i)
return (i + 1);
}
if (strcmp(argv[i], "-port") == 0) {
- ++i;
+ if (++i == argc) {
+ ErrorF("Xserver: missing port number in command line\n");
+ exit(1);
+ }
xdm_udp_port = atoi(argv[i]);
return (i + 1);
}
+ if (strcmp(argv[i], "-from") == 0) {
+ get_fromaddr_by_name(argc, argv, ++i);
+ return (i + 1);
+ }
if (strcmp(argv[i], "-once") == 0) {
OneSession = TRUE;
return (i + 1);
}
if (strcmp(argv[i], "-class") == 0) {
- ++i;
+ if (++i == argc) {
+ ErrorF("Xserver: missing class name in command line\n");
+ exit(1);
+ }
defaultDisplayClass = argv[i];
return (i + 1);
}
#ifdef HASXDMAUTH
if (strcmp(argv[i], "-cookie") == 0) {
- ++i;
+ if (++i == argc) {
+ ErrorF("Xserver: missing cookie data in command line\n");
+ exit(1);
+ }
xdmAuthCookie = argv[i];
return (i + 1);
}
#endif
if (strcmp(argv[i], "-displayID") == 0) {
- ++i;
+ if (++i == argc) {
+ ErrorF("Xserver: missing displayID in command line\n");
+ exit(1);
+ }
XdmcpRegisterManufacturerDisplayID (argv[i], strlen (argv[i]));
return (i + 1);
}
@@ -309,8 +352,7 @@ static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST];
static int NumBroadcastAddresses;
void
-XdmcpRegisterBroadcastAddress (addr)
- struct sockaddr_in *addr;
+XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr)
{
struct sockaddr_in *bcast;
if (NumBroadcastAddresses >= MAX_BROADCAST)
@@ -333,22 +375,22 @@ XdmcpRegisterBroadcastAddress (addr)
static ARRAYofARRAY8 AuthenticationNames, AuthenticationDatas;
typedef struct _AuthenticationFuncs {
- Bool (*Validator)();
- Bool (*Generator)();
- Bool (*AddAuth)();
+ ValidatorFunc Validator;
+ GeneratorFunc Generator;
+ AddAuthorFunc AddAuth;
} AuthenticationFuncsRec, *AuthenticationFuncsPtr;
static AuthenticationFuncsPtr AuthenticationFuncsList;
void
-XdmcpRegisterAuthentication (name, namelen, data, datalen, Validator, Generator, AddAuth)
- char *name;
- int namelen;
- char *data;
- int datalen;
- Bool (*Validator)();
- Bool (*Generator)();
- Bool (*AddAuth)();
+XdmcpRegisterAuthentication (
+ char *name,
+ int namelen,
+ char *data,
+ int datalen,
+ ValidatorFunc Validator,
+ GeneratorFunc Generator,
+ AddAuthorFunc AddAuth)
{
int i;
ARRAY8 AuthenticationName, AuthenticationData;
@@ -399,8 +441,7 @@ ARRAY8Ptr AuthenticationData = &noAuthenticationData;
AuthenticationFuncsPtr AuthenticationFuncs;
void
-XdmcpSetAuthentication (name)
- ARRAY8Ptr name;
+XdmcpSetAuthentication (ARRAY8Ptr name)
{
int i;
@@ -423,10 +464,10 @@ static ARRAYofARRAY8 ConnectionAddresses;
static long xdmcpGeneration;
void
-XdmcpRegisterConnection (type, address, addrlen)
- int type;
- char *address;
- int addrlen;
+XdmcpRegisterConnection (
+ int type,
+ char *address,
+ int addrlen)
{
int i;
CARD8 *newAddress;
@@ -437,6 +478,13 @@ XdmcpRegisterConnection (type, address, addrlen)
XdmcpDisposeARRAYofARRAY8 (&ConnectionAddresses);
xdmcpGeneration = serverGeneration;
}
+ if (addrlen == sizeof(struct in_addr) && xdm_from != NULL)
+ {
+ /* Only register the requested address */
+ if (memcmp(address, &FromAddress.sin_addr, addrlen) != 0) {
+ return;
+ }
+ }
newAddress = (CARD8 *) xalloc (addrlen * sizeof (CARD8));
if (!newAddress)
return;
@@ -466,16 +514,14 @@ XdmcpRegisterConnection (type, address, addrlen)
static ARRAYofARRAY8 AuthorizationNames;
void
-XdmcpRegisterAuthorizations ()
+XdmcpRegisterAuthorizations (void)
{
XdmcpDisposeARRAYofARRAY8 (&AuthorizationNames);
RegisterAuthorizations ();
}
void
-XdmcpRegisterAuthorization (name, namelen)
- char *name;
- int namelen;
+XdmcpRegisterAuthorization (char *name, int namelen)
{
ARRAY8 authName;
int i;
@@ -501,9 +547,7 @@ XdmcpRegisterAuthorization (name, namelen)
ARRAY8 DisplayClass;
void
-XdmcpRegisterDisplayClass (name, length)
- char *name;
- int length;
+XdmcpRegisterDisplayClass (char *name, int length)
{
int i;
@@ -521,9 +565,7 @@ XdmcpRegisterDisplayClass (name, length)
ARRAY8 ManufacturerDisplayID;
void
-XdmcpRegisterManufacturerDisplayID (name, length)
- char *name;
- int length;
+XdmcpRegisterManufacturerDisplayID (char *name, int length)
{
int i;
@@ -540,7 +582,7 @@ XdmcpRegisterManufacturerDisplayID (name, length)
*/
void
-XdmcpInit()
+XdmcpInit(void)
{
state = XDM_INIT_STATE;
#ifdef HASXDMAUTH
@@ -562,7 +604,7 @@ XdmcpInit()
}
void
-XdmcpReset ()
+XdmcpReset (void)
{
state = XDM_INIT_STATE;
if (state != XDM_OFF)
@@ -581,8 +623,7 @@ XdmcpReset ()
*/
void
-XdmcpOpenDisplay(sock)
- int sock;
+XdmcpOpenDisplay(int sock)
{
if (state != XDM_AWAIT_MANAGE_RESPONSE)
return;
@@ -591,8 +632,7 @@ XdmcpOpenDisplay(sock)
}
void
-XdmcpCloseDisplay(sock)
- int sock;
+XdmcpCloseDisplay(int sock)
{
if ((state != XDM_RUN_SESSION && state != XDM_AWAIT_ALIVE_RESPONSE)
|| sessionSocket != sock)
@@ -614,40 +654,23 @@ XdmcpCloseDisplay(sock)
/*ARGSUSED*/
static void
-XdmcpBlockHandler(data, wt, pReadmask)
- pointer data; /* unused */
- struct timeval **wt;
- pointer pReadmask;
+XdmcpBlockHandler(
+ pointer data, /* unused */
+ struct timeval **wt,
+ pointer pReadmask)
{
fd_set *LastSelectMask = (fd_set*)pReadmask;
- CARD32 millisToGo, wtMillis;
- static struct timeval waittime;
+ CARD32 millisToGo;
if (state == XDM_OFF)
return;
FD_SET(xdmcpSocket, LastSelectMask);
if (timeOutTime == 0)
return;
- millisToGo = GetTimeInMillis();
- if (millisToGo < timeOutTime)
- millisToGo = timeOutTime - millisToGo;
- else
+ millisToGo = timeOutTime - GetTimeInMillis();
+ if ((int) millisToGo < 0)
millisToGo = 0;
- if (*wt == NULL)
- {
- waittime.tv_sec = (millisToGo) / 1000;
- waittime.tv_usec = 1000 * (millisToGo % 1000);
- *wt = &waittime;
- }
- else
- {
- wtMillis = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000;
- if (millisToGo < wtMillis)
- {
- (*wt)->tv_sec = (millisToGo) / 1000;
- (*wt)->tv_usec = 1000 * (millisToGo % 1000);
- }
- }
+ AdjustWaitForDelay (wt, millisToGo);
}
/*
@@ -658,10 +681,10 @@ XdmcpBlockHandler(data, wt, pReadmask)
/*ARGSUSED*/
static void
-XdmcpWakeupHandler(data, i, pReadmask)
- pointer data; /* unused */
- int i;
- pointer pReadmask;
+XdmcpWakeupHandler(
+ pointer data, /* unused */
+ int i,
+ pointer pReadmask)
{
fd_set* LastSelectMask = (fd_set*)pReadmask;
fd_set devicesReadable;
@@ -686,7 +709,7 @@ XdmcpWakeupHandler(data, i, pReadmask)
if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
}
- else if (timeOutTime && GetTimeInMillis() >= timeOutTime)
+ else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0)
{
if (state == XDM_RUN_SESSION)
{
@@ -703,10 +726,11 @@ XdmcpWakeupHandler(data, i, pReadmask)
* user's host menu when the user selects a host
*/
-XdmcpSelectHost(host_sockaddr, host_len, AuthenticationName)
- struct sockaddr_in *host_sockaddr;
- int host_len;
- ARRAY8Ptr AuthenticationName;
+static void
+XdmcpSelectHost(
+ struct sockaddr_in *host_sockaddr,
+ int host_len,
+ ARRAY8Ptr AuthenticationName)
{
state = XDM_START_CONNECTION;
memmove(&req_sockaddr, host_sockaddr, host_len);
@@ -722,9 +746,13 @@ XdmcpSelectHost(host_sockaddr, host_len, AuthenticationName)
*/
/*ARGSUSED*/
-XdmcpAddHost(from, fromlen, AuthenticationName, hostname, status)
- struct sockaddr_in *from;
- ARRAY8Ptr AuthenticationName, hostname, status;
+static void
+XdmcpAddHost(
+ struct sockaddr_in *from,
+ int fromlen,
+ ARRAY8Ptr AuthenticationName,
+ ARRAY8Ptr hostname,
+ ARRAY8Ptr status)
{
XdmcpSelectHost(from, fromlen, AuthenticationName);
}
@@ -737,14 +765,14 @@ XdmcpAddHost(from, fromlen, AuthenticationName, hostname, status)
ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" };
static void
-receive_packet()
+receive_packet(void)
{
struct sockaddr_in from;
int fromlen = sizeof(struct sockaddr_in);
XdmcpHeader header;
/* read message off socket */
- if (!XdmcpFill (xdmcpSocket, &buffer, (struct sockaddr *) &from, &fromlen))
+ if (!XdmcpFill (xdmcpSocket, &buffer, (XdmcpNetaddr) &from, &fromlen))
return;
/* reset retransmission backoff */
@@ -785,8 +813,8 @@ receive_packet()
* send the appropriate message given the current state
*/
-static
-send_packet()
+static void
+send_packet(void)
{
int rtx;
switch (state) {
@@ -804,6 +832,8 @@ send_packet()
case XDM_KEEPALIVE:
send_keepalive_msg();
break;
+ default:
+ break;
}
rtx = (XDM_MIN_RTX << timeOutRtx);
if (rtx > XDM_MAX_RTX)
@@ -816,8 +846,8 @@ send_packet()
* timeouts, or Keepalive failure.
*/
-XdmcpDeadSession (reason)
- char *reason;
+void
+XdmcpDeadSession (char *reason)
{
ErrorF ("XDM: %s, declaring session dead\n", reason);
state = XDM_INIT_STATE;
@@ -833,7 +863,7 @@ XdmcpDeadSession (reason)
*/
static void
-timeout()
+timeout(void)
{
timeOutRtx++;
if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT )
@@ -869,31 +899,37 @@ timeout()
case XDM_AWAIT_ALIVE_RESPONSE:
state = XDM_KEEPALIVE;
break;
+ default:
+ break;
}
send_packet();
}
-static
-restart()
+static void
+restart(void)
{
state = XDM_INIT_STATE;
timeOutRtx = 0;
send_packet();
}
-XdmcpCheckAuthentication (Name, Data, packet_type)
- ARRAY8Ptr Name, Data;
- int packet_type;
+int
+XdmcpCheckAuthentication (
+ ARRAY8Ptr Name,
+ ARRAY8Ptr Data,
+ int packet_type)
{
return (XdmcpARRAY8Equal (Name, AuthenticationName) &&
(AuthenticationName->length == 0 ||
(*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type)));
}
-XdmcpAddAuthorization (name, data)
- ARRAY8Ptr name, data;
+int
+XdmcpAddAuthorization (
+ ARRAY8Ptr name,
+ ARRAY8Ptr data)
{
- Bool (*AddAuth)(), AddAuthorization();
+ AddAuthorFunc AddAuth;
if (AuthenticationFuncs && AuthenticationFuncs->AddAuth)
AddAuth = AuthenticationFuncs->AddAuth;
@@ -911,10 +947,8 @@ XdmcpAddAuthorization (name, data)
*/
static void
-get_xdmcp_sock()
+get_xdmcp_sock(void)
{
- int soopts = 1;
-
#ifdef STREAMSCONN
struct netconfig *nconf;
@@ -952,6 +986,8 @@ get_xdmcp_sock()
freenetconfigent(nconf);
#else
+ int soopts = 1;
+
if ((xdmcpSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
XdmcpWarning("UDP socket creation failed");
#ifdef SO_BROADCAST
@@ -959,11 +995,18 @@ get_xdmcp_sock()
sizeof(soopts)) < 0)
XdmcpWarning("UDP set broadcast socket-option failed");
#endif /* SO_BROADCAST */
+ if (xdmcpSocket >= 0 && xdm_from != NULL) {
+ if (bind(xdmcpSocket, (struct sockaddr *)&FromAddress,
+ sizeof(FromAddress)) < 0) {
+ ErrorF("Xserver: failed to bind to -from address: %s\n", xdm_from);
+ exit(1);
+ }
+ }
#endif /* STREAMSCONN */
}
static void
-send_query_msg()
+send_query_msg(void)
{
XdmcpHeader header;
Bool broadcast = FALSE;
@@ -984,6 +1027,8 @@ send_query_msg()
header.opcode = (CARD16) INDIRECT_QUERY;
state = XDM_COLLECT_INDIRECT_QUERY;
break;
+ default:
+ break;
}
header.length = 1;
for (i = 0; i < AuthenticationNames.length; i++)
@@ -996,21 +1041,21 @@ send_query_msg()
int i;
for (i = 0; i < NumBroadcastAddresses; i++)
- XdmcpFlush (xdmcpSocket, &buffer, &BroadcastAddresses[i],
+ XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &BroadcastAddresses[i],
sizeof (struct sockaddr_in));
}
else
{
- XdmcpFlush (xdmcpSocket, &buffer, &ManagerAddress,
+ XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &ManagerAddress,
sizeof (ManagerAddress));
}
}
static void
-recv_willing_msg(from, fromlen, length)
- struct sockaddr_in *from;
- int fromlen;
- unsigned length;
+recv_willing_msg(
+ struct sockaddr_in *from,
+ int fromlen,
+ unsigned length)
{
ARRAY8 authenticationName;
ARRAY8 hostname;
@@ -1035,6 +1080,8 @@ recv_willing_msg(from, fromlen, length)
case XDM_COLLECT_INDIRECT_QUERY:
XdmcpAddHost(from, fromlen, &authenticationName, &hostname, &status);
break;
+ default:
+ break;
}
}
}
@@ -1044,7 +1091,7 @@ recv_willing_msg(from, fromlen, length)
}
static void
-send_request_msg()
+send_request_msg(void)
{
XdmcpHeader header;
int length;
@@ -1089,13 +1136,12 @@ send_request_msg()
XdmcpDisposeARRAY8 (&authenticationData);
XdmcpWriteARRAYofARRAY8 (&buffer, &AuthorizationNames);
XdmcpWriteARRAY8 (&buffer, &ManufacturerDisplayID);
- if (XdmcpFlush (xdmcpSocket, &buffer, &req_sockaddr, req_socklen))
+ if (XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen))
state = XDM_AWAIT_REQUEST_RESPONSE;
}
static void
-recv_accept_msg(length)
- unsigned length;
+recv_accept_msg(unsigned length)
{
CARD32 AcceptSessionID;
ARRAY8 AcceptAuthenticationName, AcceptAuthenticationData;
@@ -1145,8 +1191,7 @@ recv_accept_msg(length)
}
static void
-recv_decline_msg(length)
- unsigned length;
+recv_decline_msg(unsigned length)
{
ARRAY8 status, DeclineAuthenticationName, DeclineAuthenticationData;
@@ -1172,7 +1217,7 @@ recv_decline_msg(length)
}
static void
-send_manage_msg()
+send_manage_msg(void)
{
XdmcpHeader header;
@@ -1186,12 +1231,11 @@ send_manage_msg()
XdmcpWriteCARD16 (&buffer, DisplayNumber);
XdmcpWriteARRAY8 (&buffer, &DisplayClass);
state = XDM_AWAIT_MANAGE_RESPONSE;
- XdmcpFlush (xdmcpSocket, &buffer, &req_sockaddr, req_socklen);
+ XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
}
static void
-recv_refuse_msg(length)
- unsigned length;
+recv_refuse_msg(unsigned length)
{
CARD32 RefusedSessionID;
@@ -1210,8 +1254,7 @@ recv_refuse_msg(length)
}
static void
-recv_failed_msg(length)
- unsigned length;
+recv_failed_msg(unsigned length)
{
CARD32 FailedSessionID;
ARRAY8 status;
@@ -1232,7 +1275,7 @@ recv_failed_msg(length)
}
static void
-send_keepalive_msg()
+send_keepalive_msg(void)
{
XdmcpHeader header;
@@ -1245,16 +1288,14 @@ send_keepalive_msg()
XdmcpWriteCARD32 (&buffer, SessionID);
state = XDM_AWAIT_ALIVE_RESPONSE;
- XdmcpFlush (xdmcpSocket, &buffer, &req_sockaddr, req_socklen);
+ XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
}
static void
-recv_alive_msg (length)
- unsigned length;
+recv_alive_msg (unsigned length)
{
CARD8 SessionRunning;
CARD32 AliveSessionID;
- int dormancy;
if (state != XDM_AWAIT_ALIVE_RESPONSE)
return;
@@ -1283,33 +1324,31 @@ recv_alive_msg (length)
}
}
-static
-XdmcpFatal (type, status)
- char *type;
- ARRAY8Ptr status;
+static void
+XdmcpFatal (
+ char *type,
+ ARRAY8Ptr status)
{
- extern void AbortDDX();
-
- ErrorF ("XDMCP fatal error: %s %*.*s\n", type,
+ FatalError ("XDMCP fatal error: %s %*.*s\n", type,
status->length, status->length, status->data);
- AbortDDX ();
- exit (1);
}
-static
-XdmcpWarning(str)
- char *str;
+static void
+XdmcpWarning(char *str)
{
ErrorF("XDMCP warning: %s\n", str);
}
-static
-get_manager_by_name(argc, argv, i)
- int argc, i;
- char **argv;
+static void
+get_manager_by_name(
+ int argc,
+ char **argv,
+ int i)
{
struct hostent *hep;
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
+#endif
if (i == argc)
{
@@ -1336,6 +1375,46 @@ get_manager_by_name(argc, argv, i)
exit (1);
}
}
+
+static void
+get_fromaddr_by_name(
+ int argc,
+ char **argv,
+ int i)
+{
+ struct hostent *hep;
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
+ _Xgethostbynameparams hparams;
+#endif
+
+ if (i == argc)
+ {
+ ErrorF("Xserver: missing -from host name in command line\n");
+ exit(1);
+ }
+ if (!(hep = _XGethostbyname(argv[i], hparams)))
+ {
+ ErrorF("Xserver: unknown host: %s\n", argv[i]);
+ exit(1);
+ }
+ if (hep->h_length == sizeof (struct in_addr))
+ {
+ memset(&FromAddress, 0, sizeof(FromAddress));
+ memmove(&FromAddress.sin_addr, hep->h_addr, hep->h_length);
+#ifdef BSD44SOCKETS
+ FromAddress.sin_len = sizeof(FromAddress);
+#endif
+ FromAddress.sin_family = AF_INET;
+ FromAddress.sin_port = 0;
+ }
+ else
+ {
+ ErrorF ("Xserver: -from host on strange network %s\n", argv[i]);
+ exit (1);
+ }
+ xdm_from = argv[i];
+}
+
#else
static int xdmcp_non_empty; /* avoid complaint by ranlib */
#endif /* XDMCP */
diff --git a/record/record.c b/record/record.c
index bcc019f27..2baba3694 100644
--- a/record/record.c
+++ b/record/record.c
@@ -32,16 +32,29 @@ This work benefited from earlier work done by Martha Zimet of NCD
and Jim Haggerty of Metheus.
*/
+/* $XFree86: xc/programs/Xserver/record/record.c,v 1.10 2002/09/17 01:15:14 dawes Exp $ */
-#include <stdio.h>
-#include <assert.h>
#define NEED_EVENTS
#include "dixstruct.h"
#include "extnsionst.h"
#define _XRECORD_SERVER_
-#include "X11/extensions/recordstr.h"
+#include "recordstr.h"
#include "set.h"
+#ifndef XFree86LOADER
+#include <stdio.h>
+#include <assert.h>
+#else
+#include "xf86_ansic.h"
+#endif
+
+#ifdef PANORAMIX
+#include "globals.h"
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#include "cursor.h"
+#endif
+
static RESTYPE RTContext; /* internal resource type for Record contexts */
static int RecordErrorBase; /* first Record error number */
@@ -286,7 +299,7 @@ RecordAProtocolElement(pContext, pClient, category, data, datalen, futurelen)
int numElemHeaders = 0;
Bool recordingClientSwapped = pContext->pRecordingClient->swapped;
int n;
- CARD32 serverTime;
+ CARD32 serverTime = 0;
Bool gotServerTime = FALSE;
int replylen;
@@ -864,11 +877,31 @@ RecordADeviceEvent(pcbl, nulldata, calldata)
{
xEvent swappedEvent;
xEvent *pEvToRecord = pev;
+#ifdef PANORAMIX
+ xEvent shiftedEvent;
+
+ if (!noPanoramiXExtension &&
+ (pev->u.u.type == MotionNotify ||
+ pev->u.u.type == ButtonPress ||
+ pev->u.u.type == ButtonRelease ||
+ pev->u.u.type == KeyPress ||
+ pev->u.u.type == KeyRelease)) {
+ int scr = XineramaGetCursorScreen();
+ memcpy(&shiftedEvent, pev, sizeof(xEvent));
+ shiftedEvent.u.keyButtonPointer.rootX +=
+ panoramiXdataPtr[scr].x -
+ panoramiXdataPtr[0].x;
+ shiftedEvent.u.keyButtonPointer.rootY +=
+ panoramiXdataPtr[scr].y -
+ panoramiXdataPtr[0].y;
+ pEvToRecord = &shiftedEvent;
+ }
+#endif /* PANORAMIX */
if (pContext->pRecordingClient->swapped)
{
- (*EventSwapVector[pev->u.u.type & 0177])
- (pev, &swappedEvent);
+ (*EventSwapVector[pEvToRecord->u.u.type & 0177])
+ (pEvToRecord, &swappedEvent);
pEvToRecord = &swappedEvent;
}
@@ -979,8 +1012,8 @@ RecordInstallHooks(pRCAP, oneclient)
(pointer)pClientPriv;
pClient->requestVector = pClientPriv->recordVector;
}
- while (pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet,
- pIter, &interval))
+ while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet,
+ pIter, &interval)))
{
unsigned int j;
for (j = interval.first; j <= interval.last; j++)
@@ -1078,9 +1111,9 @@ RecordUninstallHooks(pRCAP, oneclient)
RecordSetInterval interval;
otherRCAPwantsProcVector = TRUE;
- while (pIter = RecordIterateSet(
+ while ((pIter = RecordIterateSet(
pOtherRCAP->pRequestMajorOpSet,
- pIter, &interval))
+ pIter, &interval)))
{
unsigned int j;
for (j = interval.first; j <= interval.last; j++)
@@ -1241,7 +1274,7 @@ RecordDeleteClientFromContext(pContext, clientspec)
RecordClientsAndProtocolPtr pRCAP;
int position;
- if (pRCAP = RecordFindClientOnContext(pContext, clientspec, &position))
+ if ((pRCAP = RecordFindClientOnContext(pContext, clientspec, &position)))
RecordDeleteClientFromRCAP(pRCAP, position);
} /* RecordDeleteClientFromContext */
@@ -1696,8 +1729,8 @@ RecordRegisterClients(pContext, client, stuff)
int maxSets;
int nExtReqSets = 0;
int nExtRepSets = 0;
- int extReqSetsOffset;
- int extRepSetsOffset;
+ int extReqSetsOffset = 0;
+ int extRepSetsOffset = 0;
SetInfoPtr pExtReqSets, pExtRepSets;
int clientListOffset;
XID *pCanonClients;
@@ -1964,7 +1997,7 @@ static int
ProcRecordQueryVersion(client)
ClientPtr client;
{
- REQUEST(xRecordQueryVersionReq);
+ /* REQUEST(xRecordQueryVersionReq); */
xRecordQueryVersionReply rep;
int n;
@@ -2186,7 +2219,7 @@ RecordConvertSetToRanges(pSet, pri, byteoffset, card8, imax, pStartIndex)
return Success;
nRanges = pStartIndex ? *pStartIndex : 0;
- while (pIter = RecordIterateSet(pSet, pIter, &interval))
+ while ((pIter = RecordIterateSet(pSet, pIter, &interval)))
{
if (interval.first > imax) break;
if (interval.last > imax) interval.last = imax;
@@ -2602,7 +2635,7 @@ RecordDeleteContext(value, id)
* As a result, the RCAPs will be freed.
*/
- while (pRCAP = pContext->pListOfRCAP)
+ while ((pRCAP = pContext->pListOfRCAP))
{
int numClients = pRCAP->numClients;
/* when the last client is deleted, the RCAP will go away. */
@@ -2926,8 +2959,8 @@ RecordAClientStateChange(pcbl, nulldata, calldata)
RecordClientsAndProtocolPtr pRCAP;
RecordContextPtr pContext = ppAllContexts[i];
- if (pRCAP = RecordFindClientOnContext(pContext,
- XRecordFutureClients, NULL))
+ if ((pRCAP = RecordFindClientOnContext(pContext,
+ XRecordFutureClients, NULL)))
{
RecordAddClientToRCAP(pRCAP, pClient->clientAsMask);
if (pContext->pRecordingClient && pRCAP->clientStarted)
@@ -2946,8 +2979,8 @@ RecordAClientStateChange(pcbl, nulldata, calldata)
if (pContext->pRecordingClient == pClient)
RecordDisableContext(pContext);
- if (pRCAP = RecordFindClientOnContext(pContext,
- pClient->clientAsMask, &pos))
+ if ((pRCAP = RecordFindClientOnContext(pContext,
+ pClient->clientAsMask, &pos)))
{
if (pContext->pRecordingClient && pRCAP->clientDied)
RecordAProtocolElement(pContext, pClient,
@@ -2957,6 +2990,8 @@ RecordAClientStateChange(pcbl, nulldata, calldata)
}
break;
+ default:
+ break;
} /* end switch on client state */
} /* RecordAClientStateChange */
@@ -3019,3 +3054,4 @@ RecordExtensionInit()
RecordErrorBase = extentry->errorBase;
} /* RecordExtensionInit */
+
diff --git a/record/set.c b/record/set.c
index dbaac4f54..c17e7cfab 100644
--- a/record/set.c
+++ b/record/set.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/record/set.c,v 1.7 2001/12/14 20:00:37 dawes Exp $ */
/*
@@ -88,6 +89,11 @@ void *Xcalloc(size)
#include "set.h"
+#ifdef XFree86LOADER
+#include "xf86_libc.h"
+#include "xf86_ansic.h"
+#endif
+
static int
maxMemberInInterval(pIntervals, nIntervals)
RecordSetInterval *pIntervals;
@@ -197,7 +203,7 @@ BitVectorIterateSet(pSet, pIter, pInterval)
RecordSetIteratePtr pIter;
RecordSetInterval *pInterval;
{
- int iterbit = (int)pIter;
+ int iterbit = (int)(long)pIter;
int b;
b = BitVectorFindBit(pSet, iterbit, TRUE);
@@ -206,7 +212,7 @@ BitVectorIterateSet(pSet, pIter, pInterval)
b = BitVectorFindBit(pSet, b, FALSE);
pInterval->last = (b < 0) ? ((BitVectorSetPtr)pSet)->maxMember : b - 1;
- return (RecordSetIteratePtr)(pInterval->last + 1);
+ return (RecordSetIteratePtr)(long)(pInterval->last + 1);
}
RecordSetOperations BitVectorSetOperations = {
@@ -515,7 +521,7 @@ RecordCreateSet(pIntervals, nIntervals, pMem, memsize)
&pCreateSet);
if (pMem)
{
- if ( ((int)pMem & (alignment-1) ) || memsize < size)
+ if ( ((long)pMem & (alignment-1) ) || memsize < size)
return NULL;
}
return (*pCreateSet)(pIntervals, nIntervals, pMem, size);
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index 82e98f4bc..c6fd855fe 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBAlloc.c,v 3.5 2001/01/17 19:41:48 dawes Exp $ */
#ifndef XKB_IN_SERVER
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index c89e1197c..44a74c6a8 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBGAlloc.c,v 3.4 2001/01/17 19:41:48 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index ba2a70761..29cdc3c80 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBMAlloc.c,v 3.11 2001/01/17 19:41:48 dawes Exp $ */
#ifndef XKB_IN_SERVER
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 45c00692a..f3de9295e 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBMisc.c,v 3.5 2001/10/28 03:32:33 tsi Exp $ */
#ifndef XKB_IN_SERVER
@@ -54,12 +55,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec))
static XkbKTMapEntryRec map2Level[]= {
- { True, ShiftMask, 1, ShiftMask, 0 }
+ { True, ShiftMask, {1, ShiftMask, 0} }
};
static XkbKTMapEntryRec mapAlpha[]= {
- { True, ShiftMask, 1, ShiftMask, 0 },
- { True, LockMask, 0, LockMask, 0 }
+ { True, ShiftMask, { 1, ShiftMask, 0 } },
+ { True, LockMask, { 0, LockMask, 0 } }
};
static XkbModsRec preAlpha[]= {
@@ -69,8 +70,8 @@ static XkbModsRec preAlpha[]= {
#define NL_VMOD_MASK 0
static XkbKTMapEntryRec mapKeypad[]= {
- { True, ShiftMask, 1, ShiftMask, 0 },
- { False, 0, 1, 0, NL_VMOD_MASK }
+ { True, ShiftMask, { 1, ShiftMask, 0 } },
+ { False, 0, { 1, 0, NL_VMOD_MASK } }
};
static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
@@ -564,7 +565,7 @@ unsigned changed,tmp;
if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
CARD8 old;
old= xkb->ctrls->per_key_repeat[key/8];
-#if RETURN_SHOULD_REPEAT
+#ifdef RETURN_SHOULD_REPEAT
if (*XkbKeySymsPtr(xkb,key) != XK_Return)
#endif
xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
@@ -968,7 +969,7 @@ XkbApplyVirtualModChanges(xkb,changed,changes)
#endif
{
register int i;
-unsigned checkState;
+unsigned int checkState = 0;
if ((!xkb) || (!xkb->map) || (changed==0))
return False;
@@ -1035,8 +1036,7 @@ unsigned checkState;
}
}
if (xkb->map && xkb->server) {
- int highChange,lowChange;
- lowChange= -1;
+ int highChange = 0, lowChange = -1;
for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
if (XkbKeyHasActions(xkb,i)) {
register XkbAction *pAct;
diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c
index 3f3ae57a0..74352161c 100644
--- a/xkb/ddxBeep.c
+++ b/xkb/ddxBeep.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxBeep.c,v 3.9 2002/12/05 21:59:00 paulo Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -59,7 +60,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define HIGH_PITCH 2000
#define CLICK_PITCH 1500
-static unsigned long atomGeneration= -1;
+static unsigned long atomGeneration= 0;
static Atom featureOn;
static Atom featureOff;
static Atom featureChange;
@@ -138,6 +139,10 @@ _XkbDDXBeepInitAtoms()
(strcmp(keyboard,"LK443") == 0))
doesPitch = 0;
}
+#else
+#if defined(sun)
+ doesPitch = 0;
+#endif
#endif
return;
}
@@ -317,7 +322,10 @@ Atom name;
next = SHORT_DELAY;
break;
}
- if (duration>0) {
+ if (timer == NULL && duration>0) {
+ CARD32 starttime = GetTimeInMillis();
+ CARD32 elapsedtime;
+
ctrl->bell_duration= duration;
ctrl->bell_pitch= pitch;
if (xkbInfo->beepCount==0) {
@@ -330,6 +338,23 @@ Atom name;
ctrl->bell_duration= oldDuration;
ctrl->bell_pitch= oldPitch;
xkbInfo->beepCount++;
+
+ /* Some DDX schedule the beep and return immediately, others don't
+ return until the beep is completed. We measure the time and if
+ it's less than the beep duration, make sure not to schedule the
+ next beep until after the current one finishes. */
+
+ elapsedtime = GetTimeInMillis();
+ if (elapsedtime > starttime) { /* watch out for millisecond counter
+ overflow! */
+ elapsedtime -= starttime;
+ } else {
+ elapsedtime = 0;
+ }
+ if (elapsedtime < duration) {
+ next += duration - elapsedtime;
+ }
+
}
return next;
}
diff --git a/xkb/ddxConfig.c b/xkb/ddxConfig.c
index f3635902f..58fc138bd 100644
--- a/xkb/ddxConfig.c
+++ b/xkb/ddxConfig.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxConfig.c,v 3.8 2002/12/20 20:18:35 paulo Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -106,7 +107,6 @@ char buf[PATH_MAX];
char * dName;
FILE * file;
XkbConfigRtrnPtr rtrn;
-extern char * display;
#if defined(MetroLink)
if (dev && dev->name)
@@ -142,6 +142,9 @@ extern char * display;
sprintf(buf,"X%s-config%s%s",display,(dName[0]?".":""),dName);
}
#endif
+#ifdef __UNIXOS2__
+ strcpy(buf,(char*)__XOS2RedirRoot(buf));
+#endif
#ifdef DEBUG
ErrorF("Looking for keyboard configuration in %s...",buf);
#endif
@@ -190,24 +193,29 @@ extern char * display;
XkbSetRulesUsed(defs);
if (rtrn->keycodes!=NULL) {
+ if (names->keycodes) _XkbFree(names->keycodes);
names->keycodes= rtrn->keycodes;
rtrn->keycodes= NULL;
}
if (rtrn->geometry!=NULL) {
+ if (names->geometry) _XkbFree(names->geometry);
names->geometry= rtrn->geometry;
rtrn->geometry= NULL;
}
if (rtrn->symbols!=NULL) {
if (rtrn->phys_symbols==NULL)
rtrn->phys_symbols= _XkbDupString(names->symbols);
+ if (names->symbols) _XkbFree(names->symbols);
names->symbols= rtrn->symbols;
rtrn->symbols= NULL;
}
if (rtrn->types!=NULL) {
+ if (names->types) _XkbFree(names->types);
names->types= rtrn->types;
rtrn->types= NULL;
}
if (rtrn->compat!=NULL) {
+ if (names->compat) _XkbFree(names->compat);
names->compat= rtrn->compat;
rtrn->compat= NULL;
}
diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c
index da599fbf2..4dfb03df2 100644
--- a/xkb/ddxCtrls.c
+++ b/xkb/ddxCtrls.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxCtrls.c,v 1.3 2001/01/17 22:37:14 dawes Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -104,7 +105,8 @@ XkbDDXChangeControls(dev,old,new)
XkbControlsPtr new;
#endif
{
-unsigned changed;
+unsigned changed, i;
+unsigned char *rep_old, *rep_new, *rep_fb;
changed= new->enabled_ctrls^old->enabled_ctrls;
#ifdef NOTDEF
@@ -124,6 +126,16 @@ unsigned changed;
}
}
#endif
+ for (rep_old = old->per_key_repeat,
+ rep_new = new->per_key_repeat,
+ rep_fb = dev->kbdfeed->ctrl.autoRepeats,
+ i = 0; i < XkbPerKeyBitArraySize; i++) {
+ if (rep_old[i] != rep_new[i]) {
+ rep_fb[i] = rep_new[i];
+ changed &= XkbPerKeyRepeatMask;
+ }
+ }
+
if (changed&XkbPerKeyRepeatMask) {
if (dev->kbdfeed->CtrlProc)
(*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index 7d641358f..47a757823 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxDevBtn.c,v 3.3 2001/08/23 21:49:51 tsi Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -37,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XI.h"
#include "XIproto.h"
-extern int DeviceButtonPress,DeviceButtonRelease,DeviceValuator;
+extern int DeviceValuator;
void
#if NeedFunctionPrototypes
diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c
index 04a8c80e9..c92f2f1da 100644
--- a/xkb/ddxFakeMtn.c
+++ b/xkb/ddxFakeMtn.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxFakeMtn.c,v 1.4 2001/01/17 22:37:14 dawes Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -36,12 +37,28 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBsrv.h"
#include "XI.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+#include "mipointer.h"
+#include "mipointrst.h"
+
extern WindowPtr GetSpriteWindow(
#if NeedFunctionPrototypes
void
#endif
);
+extern void NewCurrentScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* newScreen */,
+ int /* x */,
+ int /* y */
+#endif
+);
+
void
#if NeedFunctionPrototypes
XkbDDXFakePointerMotion(unsigned flags,int x,int y)
@@ -52,25 +69,70 @@ XkbDDXFakePointerMotion(flags,x,y)
int y;
#endif
{
-ScreenPtr pScreen;
int oldX,oldY;
+ScreenPtr pScreen, oldScreen;
- pScreen= GetSpriteWindow()->drawable.pScreen;
- GetSpritePosition(&oldX,&oldY);
- if (flags&XkbSA_MoveAbsoluteX)
- oldX= x;
- else oldX+= x;
- if (flags&XkbSA_MoveAbsoluteY)
- oldY= y;
- else oldY+= y;
+ GetSpritePosition(&oldX, &oldY);
+ pScreen = oldScreen = GetSpriteWindow()->drawable.pScreen;
- if (oldX<0) oldX= 0;
- else if (oldX>=pScreen->width) oldX= pScreen->width-1;
- if (oldY<0) oldY= 0;
- else if (oldY>=pScreen->height) oldY= pScreen->height-1;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ BoxRec box;
+ int i;
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ oldX, oldY, &box)) {
+ FOR_NSCREENS(i) {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
+ oldX, oldY, &box)) {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+ oldScreen = pScreen;
+
+ if (flags&XkbSA_MoveAbsoluteX)
+ oldX= x;
+ else oldX+= x;
+ if (flags&XkbSA_MoveAbsoluteY)
+ oldY= y;
+ else oldY+= y;
+
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ oldX, oldY, &box)) {
+ FOR_NSCREENS(i) {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
+ oldX, oldY, &box)) {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+ oldX -= panoramiXdataPtr[pScreen->myNum].x;
+ oldY -= panoramiXdataPtr[pScreen->myNum].y;
+ }
+ else
+#endif
+ {
+ if (flags&XkbSA_MoveAbsoluteX)
+ oldX= x;
+ else oldX+= x;
+ if (flags&XkbSA_MoveAbsoluteY)
+ oldY= y;
+ else oldY+= y;
+
+#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr))
+ (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen)
+ (&pScreen, &oldX, &oldY);
+ }
+
+ if (pScreen != oldScreen)
+ NewCurrentScreen(pScreen, oldX, oldY);
if (pScreen->SetCursorPosition)
(*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE);
- return;
}
-
diff --git a/xkb/ddxKillSrv.c b/xkb/ddxKillSrv.c
index 50fc9b24c..3c57f8786 100644
--- a/xkb/ddxKillSrv.c
+++ b/xkb/ddxKillSrv.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxKillSrv.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -36,6 +37,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBsrv.h"
#include "XI.h"
+#ifdef XF86DDXACTIONS
+#include "xf86.h"
+#endif
+
int
#if NeedFunctionPrototypes
XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act)
@@ -46,6 +51,10 @@ XkbDDXTerminateServer(dev,key,act)
XkbAction *act;
#endif
{
+#ifdef XF86DDXACTIONS
+ xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
+#else
GiveUp(1);
+#endif
return 0;
}
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 9f1ad4406..8337022a3 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxList.c,v 3.7 2001/10/28 03:34:19 tsi Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -173,13 +174,13 @@ char tmpname[32];
+(xkbDebugFlags>9?2:1)+strlen(file)+31 > PATH_MAX)
return BadImplementation;
#ifndef WIN32
- sprintf(buf,"%s/xkbcomp -R%s/%s -w %d -l -vlfhpR '%s'",
- XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],
+ sprintf(buf,"%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s'",
+ XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long)
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
file);
#else
- sprintf(buf,"%s/xkbcomp -R%s/%s -w %d -l -vlfhpR '%s' %s",
- XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],
+ sprintf(buf,"%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s' %s",
+ XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long)
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
file, tmpname);
#endif
@@ -198,13 +199,13 @@ char tmpname[32];
+(xkbDebugFlags>9?2:1)+strlen(file)+29 > PATH_MAX)
return BadImplementation;
#ifndef WIN32
- sprintf(buf,"xkbcomp -R%s -w %d -l -vlfhpR '%s'",
- componentDirs[what],
+ sprintf(buf,"xkbcomp -R%s -w %ld -l -vlfhpR '%s'",
+ componentDirs[what],(long)
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
file);
#else
- sprintf(buf,"xkbcomp -R%s -w %d -l -vlfhpR '%s' %s",
- componentDirs[what],
+ sprintf(buf,"xkbcomp -R%s -w %ld -l -vlfhpR '%s' %s",
+ componentDirs[what],(long)
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
file, tmpname);
#endif
@@ -213,10 +214,10 @@ char tmpname[32];
status= Success;
if (!haveDir)
#ifndef WIN32
- in= popen(buf,"r");
+ in= Popen(buf,"r");
#else
{
- if (system(buf) < 0)
+ if (System(buf) < 0)
ErrorF("Could not invoke keymap compiler\n");
else
in= fopen(tmpname, "r");
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 31b88a83f..82129d401 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.30 2002/05/31 18:46:06 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -40,7 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBsrv.h"
#include "XI.h"
-#if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__)
+#if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__) || defined(__GNU__)
#include <paths.h>
#endif
@@ -74,8 +75,9 @@ OutputDirectory (outdir)
char* outdir;
{
#ifndef WIN32
- if (getuid() == 0 || geteuid() == 0) {
- /* if server running as root it'll be able to write */
+ if (getuid() == 0) {
+ /* if server running as root it *may* be able to write */
+ /* FIXME: check whether directory is writable at all */
(void) strcpy (outdir, XKM_OUTPUT_DIR);
} else
#endif
@@ -124,25 +126,41 @@ char cmd[PATH_MAX],file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
else outFile= _XkbDupString(file);
XkbEnsureSafeMapName(outFile);
OutputDirectory(xkm_output_dir);
+
if (XkbBaseDirectory!=NULL) {
+#ifdef __UNIXOS2__
+ char *tmpbase = (char*)__XOS2RedirRoot(XkbBaseDirectory);
+ int i;
+ if (strlen(tmpbase)*2+(xkbDebugFlags>9?2:1)
+#else
if (strlen(XkbBaseDirectory)*2+(xkbDebugFlags>9?2:1)
+#endif
+(map?strlen(map)+3:0)+strlen(PRE_ERROR_MSG)
+strlen(ERROR_PREFIX)+strlen(POST_ERROR_MSG1)
+strlen(file)+strlen(xkm_output_dir)
+strlen(outFile)+53 > PATH_MAX)
{
-#ifdef DEBUG
ErrorF("compiler command for keymap (%s) exceeds max length\n",
names->keymap);
-#endif
return False;
}
+#ifndef __UNIXOS2__
sprintf(cmd,"%s/xkbcomp -w %d -R%s -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm",
XkbBaseDirectory,
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
XkbBaseDirectory,(map?"-m ":""),(map?map:""),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile);
+#else
+ for (i=0; i<strlen(tmpbase); i++) if (tmpbase[i]=='/') tmpbase[i]='\\';
+ sprintf(cmd,"%s\\xkbcomp -w %d -R%s -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm",
+ tmpbase,
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
+ tmpbase,(map?"-m ":""),(map?map:""),
+ PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
+ xkm_output_dir,outFile);
+ ErrorF("Command line for XKB is %s\n",cmd);
+#endif
}
else {
if ((xkbDebugFlags>9?2:1)+(map?strlen(map)+3:0)+strlen(PRE_ERROR_MSG)
@@ -150,14 +168,12 @@ char cmd[PATH_MAX],file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
+strlen(file)+strlen(xkm_output_dir)
+strlen(outFile)+49 > PATH_MAX)
{
-#ifdef DEBUG
ErrorF("compiler command for keymap (%s) exceeds max length\n",
names->keymap);
-#endif
return False;
}
sprintf(cmd,"xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm",
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
(map?"-m ":""),(map?map:""),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile);
@@ -168,20 +184,20 @@ char cmd[PATH_MAX],file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
ErrorF(" \"cmd\"\n");
}
#endif
- if (system(cmd)==0) {
+ if (System(cmd)==0) {
if (nameRtrn) {
strncpy(nameRtrn,outFile,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
}
if (outFile!=NULL)
- Xfree(outFile);
+ _XkbFree(outFile);
return True;
}
#ifdef DEBUG
ErrorF("Error compiling keymap (%s)\n",names->keymap);
#endif
if (outFile!=NULL)
- Xfree(outFile);
+ _XkbFree(outFile);
return False;
}
@@ -208,11 +224,18 @@ char buf[PATH_MAX],keymap[PATH_MAX],xkm_output_dir[PATH_MAX];
#ifdef WIN32
char tmpname[32];
#endif
+#ifdef __UNIXOS2__
+char *tmpbase;
+int i;
+#endif
if ((names->keymap==NULL)||(names->keymap[0]=='\0')) {
- extern char *display;
sprintf(keymap,"server-%s",display);
}
else {
+ if (strlen(names->keymap) > PATH_MAX - 1) {
+ ErrorF("name of keymap (%s) exceeds max length\n", names->keymap);
+ return False;
+ }
strcpy(keymap,names->keymap);
}
@@ -222,31 +245,43 @@ char tmpname[32];
strcpy(tmpname, "\\temp\\xkb_XXXXXX");
(void) mktemp(tmpname);
#endif
+#ifdef __UNIXOS2__
+ tmpbase = (char*)__XOS2RedirRoot(XkbBaseDirectory);
+#endif
if (XkbBaseDirectory!=NULL) {
if (strlen(XkbBaseDirectory)*2+(xkbDebugFlags>9?2:1)
+strlen(PRE_ERROR_MSG)+strlen(ERROR_PREFIX)
+strlen(POST_ERROR_MSG1)+strlen(xkm_output_dir)
+strlen(keymap)+48 > PATH_MAX)
{
-#ifdef DEBUG
ErrorF("compiler command for keymap (%s) exceeds max length\n",
names->keymap);
-#endif
return False;
}
#ifndef WIN32
+#ifndef __UNIXOS2__
sprintf(buf,
"%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
XkbBaseDirectory,
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
XkbBaseDirectory,
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
xkm_output_dir,keymap);
#else
+ for (i=0; i<strlen(tmpbase); i++) if (tmpbase[i]=='/') tmpbase[i]='\\';
+ sprintf(buf,
+ "%s\\xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+ tmpbase,
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
+ tmpbase,
+ PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
+ xkm_output_dir,keymap);
+#endif
+#else
sprintf(buf,
"%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\" < %s",
XkbBaseDirectory,
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
XkbBaseDirectory,
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
xkm_output_dir,keymap,tmpname);
@@ -257,28 +292,26 @@ char tmpname[32];
+strlen(ERROR_PREFIX)+strlen(POST_ERROR_MSG1)
+strlen(xkm_output_dir)+strlen(keymap)+44 > PATH_MAX)
{
-#ifdef DEBUG
ErrorF("compiler command for keymap (%s) exceeds max length\n",
names->keymap);
-#endif
return False;
}
#ifndef WIN32
sprintf(buf,
"xkbcomp -w %d -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
xkm_output_dir,keymap);
#else
sprintf(buf,
"xkbcomp -w %d -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\" < %s",
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+ ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
xkm_output_dir,keymap,tmpname);
#endif
}
#ifndef WIN32
- out= popen(buf,"w");
+ out= Popen(buf,"w");
#else
out= fopen(tmpname, "w");
#endif
@@ -291,13 +324,13 @@ char tmpname[32];
#endif
XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need);
#ifndef WIN32
- if (pclose(out)==0)
+ if (Pclose(out)==0)
#else
if (fclose(out)==0)
#endif
{
#ifdef WIN32
- if (system(buf) < 0)
+ if (System(buf) < 0)
ErrorF("Could not invoke keymap compiler\n");
else {
#endif
@@ -305,6 +338,30 @@ char tmpname[32];
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
}
+#if defined(Lynx) && defined(__i386__) && defined(NEED_POPEN_WORKAROUND)
+ /* somehow popen/pclose is broken on LynxOS AT 2.3.0/2.4.0!
+ * the problem usually shows up with XF86Setup
+ * this hack waits at max 5 seconds after pclose() returns
+ * for the output of the xkbcomp output file.
+ * I didn't manage to get a patch in time for the 3.2 release
+ */
+ {
+ int i;
+ char name[PATH_MAX];
+ if (XkbBaseDirectory!=NULL)
+ sprintf(name,"%s/%s%s.xkm", XkbBaseDirectory
+ ,xkm_output_dir, keymap);
+ else
+ sprintf(name,"%s%s.xkm", xkm_output_dir, keymap);
+ for (i = 0; i < 10; i++) {
+ if (access(name, 0) == 0) break;
+ usleep(500000);
+ }
+#ifdef DEBUG
+ if (i) ErrorF(">>>> Waited %d times for %s\n", i, name);
+#endif
+ }
+#endif
return True;
#ifdef WIN32
}
@@ -493,3 +550,5 @@ XkbRF_RulesPtr rules;
XkbRF_Free(rules,True);
return complete;
}
+
+
diff --git a/xkb/ddxVT.c b/xkb/ddxVT.c
index e1978d88b..58de4b207 100644
--- a/xkb/ddxVT.c
+++ b/xkb/ddxVT.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxVT.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -36,6 +37,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBsrv.h"
#include "XI.h"
+#ifdef XF86DDXACTIONS
+#include "xf86.h"
+#endif
+
int
#if NeedFunctionPrototypes
XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act)
@@ -46,5 +51,21 @@ XkbDDXSwitchScreen(dev,key,act)
XkbAction *act;
#endif
{
+#ifdef XF86DDXACTIONS
+ {
+ int scrnnum = XkbSAScreen(&act->screen);
+
+ if (act->screen.flags & XkbSA_SwitchApplication) {
+ if (act->screen.flags & XkbSA_SwitchAbsolute)
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN,(void *) &scrnnum);
+ else {
+ if (scrnnum < 0)
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_PREV,NULL);
+ else
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT,NULL);
+ }
+ }
+ }
+#endif
return 1;
}
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 559dc9c7f..8c5ce1a42 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -24,13 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/maprules.c,v 3.17 2002/11/26 01:43:25 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
-
#define X_INCLUDE_STRING_H
#define XOS_USE_NO_LOCKING
@@ -69,11 +67,13 @@
#endif
#ifdef DEBUG
-#define PR_DEBUG(s) fprintf(stderr,s)
-#define PR_DEBUG1(s,a) fprintf(stderr,s,a)
+#define PR_DEBUG(s) fprintf(stderr,s)
+#define PR_DEBUG1(s,a) fprintf(stderr,s,a)
+#define PR_DEBUG2(s,a,b) fprintf(stderr,s,a,b)
#else
#define PR_DEBUG(s)
#define PR_DEBUG1(s,a)
+#define PR_DEBUG2(s,a,b)
#endif
/***====================================================================***/
@@ -254,8 +254,12 @@ static char * cname[MAX_WORDS] = {
};
typedef struct _RemapSpec {
+ int number;
int num_remap;
- int remap[MAX_WORDS];
+ struct {
+ int word;
+ int index;
+ } remap[MAX_WORDS];
} RemapSpec;
typedef struct _FileSpec {
@@ -263,8 +267,49 @@ typedef struct _FileSpec {
struct _FileSpec * pending;
} FileSpec;
+typedef struct {
+ char * model;
+ char * layout[XkbNumKbdGroups+1];
+ char * variant[XkbNumKbdGroups+1];
+ char * options;
+} XkbRF_MultiDefsRec, *XkbRF_MultiDefsPtr;
+
+#define NDX_BUFF_SIZE 4
+
/***====================================================================***/
+static char*
+#if NeedFunctionPrototypes
+get_index(char *str, int *ndx)
+#else
+get_index(str, ndx)
+ char *str;
+ int *ndx;
+#endif
+{
+ char ndx_buf[NDX_BUFF_SIZE];
+ char *end;
+
+ if (*str != '[') {
+ *ndx = 0;
+ return str;
+ }
+ str++;
+ end = strchr(str, ']');
+ if (end == NULL) {
+ *ndx = -1;
+ return str - 1;
+ }
+ if ( (end - str) >= NDX_BUFF_SIZE) {
+ *ndx = -1;
+ return end + 1;
+ }
+ strncpy(ndx_buf, str, end - str);
+ ndx_buf[end - str] = '\0';
+ *ndx = atoi(ndx_buf);
+ return end + 1;
+}
+
static void
#if NeedFunctionPrototypes
SetUpRemap(InputLine *line,RemapSpec *remap)
@@ -275,16 +320,20 @@ SetUpRemap(line,remap)
#endif
{
char * tok,*str;
-unsigned present;
+unsigned present, l_ndx_present, v_ndx_present;
register int i;
+int len, ndx;
+_Xstrtokparams strtok_buf;
#ifdef DEBUG
Bool found;
#endif
-_Xstrtokparams strtok_buf;
- present= 0;
+
+ l_ndx_present = v_ndx_present = present= 0;
str= &line->line[1];
+ len = remap->number;
bzero((char *)remap,sizeof(RemapSpec));
+ remap->number = len;
while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) {
#ifdef DEBUG
found= False;
@@ -293,17 +342,40 @@ _Xstrtokparams strtok_buf;
if (strcmp(tok,"=")==0)
continue;
for (i=0;i<MAX_WORDS;i++) {
- if (strcmp(cname[i],tok)==0) {
+ len = strlen(cname[i]);
+ if (strncmp(cname[i],tok,len)==0) {
+ if(strlen(tok) > len) {
+ char *end = get_index(tok+len, &ndx);
+ if ((i != LAYOUT && i != VARIANT) ||
+ *end != '\0' || ndx == -1)
+ break;
+ if (ndx < 1 || ndx > XkbNumKbdGroups) {
+ PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx);
+ PR_DEBUG1("Index must be in range 1..%d\n",
+ XkbNumKbdGroups);
+ break;
+ }
+ } else {
+ ndx = 0;
+ }
#ifdef DEBUG
found= True;
#endif
if (present&(1<<i)) {
- PR_DEBUG1("Component \"%s\" listed twice\n",tok);
- PR_DEBUG("Second definition ignored\n");
- break;
+ if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
+ (i == VARIANT && v_ndx_present&(1<<ndx)) ) {
+ PR_DEBUG1("Component \"%s\" listed twice\n",tok);
+ PR_DEBUG("Second definition ignored\n");
+ break;
+ }
}
- present|= (1<<i);
- remap->remap[remap->num_remap++]= i;
+ present |= (1<<i);
+ if (i == LAYOUT)
+ l_ndx_present |= 1 << ndx;
+ if (i == VARIANT)
+ v_ndx_present |= 1 << ndx;
+ remap->remap[remap->num_remap].word= i;
+ remap->remap[remap->num_remap++].index= ndx;
break;
}
}
@@ -316,8 +388,8 @@ _Xstrtokparams strtok_buf;
if ((present&PART_MASK)==0) {
#ifdef DEBUG
unsigned mask= PART_MASK;
- fprintf(stderr,"Mapping needs at one of ");
- for (i=0;(i<MAX_WORDS)&mask;i++) {
+ fprintf(stderr,"Mapping needs at least one of ");
+ for (i=0; (i<MAX_WORDS); i++) {
if ((1L<<i)&mask) {
mask&= ~(1L<<i);
if (mask) fprintf(stderr,"\"%s,\" ",cname[i]);
@@ -349,6 +421,7 @@ _Xstrtokparams strtok_buf;
remap->num_remap= 0;
return;
}
+ remap->number++;
return;
}
@@ -386,23 +459,52 @@ static Bool
#if NeedFunctionPrototypes
CheckLine( InputLine * line,
RemapSpec * remap,
- XkbRF_RulePtr rule)
+ XkbRF_RulePtr rule,
+ XkbRF_GroupPtr group)
#else
-CheckLine(line,remap,rule)
+CheckLine(line,remap,rule,group)
InputLine * line;
RemapSpec * remap;
XkbRF_RulePtr rule;
+ XkbRF_GroupsPtr group;
#endif
{
char * str,*tok;
-register int nread;
+register int nread, i;
FileSpec tmp;
_Xstrtokparams strtok_buf;
+Bool append = False;
if (line->line[0]=='!') {
- SetUpRemap(line,remap);
- return False;
+ if (line->line[1] == '$' ||
+ (line->line[1] == ' ' && line->line[2] == '$')) {
+ char *gname = strchr(line->line, '$');
+ char *words = strchr(gname, ' ');
+ if(!words)
+ return False;
+ *words++ = '\0';
+ for (; *words; words++) {
+ if (*words != '=' && *words != ' ')
+ break;
+ }
+ if (*words == '\0')
+ return False;
+ group->name = _XkbDupString(gname);
+ group->words = _XkbDupString(words);
+ for (i = 1, words = group->words; *words; words++) {
+ if ( *words == ' ') {
+ *words++ = '\0';
+ i++;
+ }
+ }
+ group->number = i;
+ return True;
+ } else {
+ SetUpRemap(line,remap);
+ return False;
+ }
}
+
if (remap->num_remap==0) {
PR_DEBUG("Must have a mapping before first line of data\n");
PR_DEBUG("Illegal line of data ignored\n");
@@ -421,23 +523,24 @@ _Xstrtokparams strtok_buf;
PR_DEBUG1("Extra word \"%s\" ignored\n",tok);
continue;
}
- tmp.name[remap->remap[nread]]= tok;
+ tmp.name[remap->remap[nread].word]= tok;
+ if (*tok == '+' || *tok == '|')
+ append = True;
}
if (nread<remap->num_remap) {
- PR_DEBUG("Too few words on a line\n");
+ PR_DEBUG1("Too few words on a line: %s\n", line->line);
PR_DEBUG("line ignored\n");
return False;
}
- if ((tmp.name[MODEL]!=NULL)&&(strcmp(tmp.name[MODEL],"*")==0))
- tmp.name[MODEL]= NULL;
- if ((tmp.name[LAYOUT]!=NULL)&&(strcmp(tmp.name[LAYOUT],"*")==0))
- tmp.name[LAYOUT]= NULL;
- if ((tmp.name[VARIANT]!=NULL)&&(strcmp(tmp.name[VARIANT],"*")==0))
- tmp.name[VARIANT]= NULL;
rule->flags= 0;
+ rule->number = remap->number;
if (tmp.name[OPTION])
- rule->flags|= XkbRF_Delayed|XkbRF_Append;
+ rule->flags|= XkbRF_Option;
+ else if (append)
+ rule->flags|= XkbRF_Append;
+ else
+ rule->flags|= XkbRF_Normal;
rule->model= _XkbDupString(tmp.name[MODEL]);
rule->layout= _XkbDupString(tmp.name[LAYOUT]);
rule->variant= _XkbDupString(tmp.name[VARIANT]);
@@ -449,6 +552,16 @@ _Xstrtokparams strtok_buf;
rule->compat= _XkbDupString(tmp.name[COMPAT]);
rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
rule->keymap= _XkbDupString(tmp.name[KEYMAP]);
+
+ rule->layout_num = rule->variant_num = 0;
+ for (i = 0; i < nread; i++) {
+ if (remap->remap[i].index) {
+ if (remap->remap[i].word == LAYOUT)
+ rule->layout_num = remap->remap[i].index;
+ if (remap->remap[i].word == VARIANT)
+ rule->variant_num = remap->remap[i].index;
+ }
+ }
return True;
}
@@ -465,14 +578,127 @@ int len;
if ((!str1)||(!str2))
return str1;
- len= strlen(str1)+strlen(str2)+1;
+ len= strlen(str1)+strlen(str2)+1;
str1= _XkbTypedRealloc(str1,len,char);
if (str1)
strcat(str1,str2);
return str1;
}
-Bool
+static void
+#if NeedFunctionPrototypes
+squeeze_spaces(char *p1)
+#else
+squeeze_spaces(p1)
+ char *p1;
+#endif
+{
+ char *p2;
+ for (p2 = p1; *p2; p2++) {
+ *p1 = *p2;
+ if (*p1 != ' ') p1++;
+ }
+ *p1 = '\0';
+}
+
+static Bool
+#if NeedFunctionPrototypes
+MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
+#else
+MakeMultiDefs(mdefs, defs)
+ XkbRF_MultiDefsPtr mdefs
+ XkbRF_VarDefsPtr defs;
+#endif
+{
+
+ bzero((char *)mdefs,sizeof(XkbRF_MultiDefsRec));
+ mdefs->model = defs->model;
+ mdefs->options = _XkbDupString(defs->options);
+ if (mdefs->options) squeeze_spaces(mdefs->options);
+
+ if (defs->layout) {
+ if (!strchr(defs->layout, ',')) {
+ mdefs->layout[0] = defs->layout;
+ } else {
+ char *p;
+ int i;
+ mdefs->layout[1] = _XkbDupString(defs->layout);
+ if (mdefs->layout[1] == NULL)
+ return False;
+ squeeze_spaces(mdefs->layout[1]);
+ p = mdefs->layout[1];
+ for (i = 2; i <= XkbNumKbdGroups; i++) {
+ if ((p = strchr(p, ','))) {
+ *p++ = '\0';
+ mdefs->layout[i] = p;
+ } else {
+ break;
+ }
+ }
+ if (p && (p = strchr(p, ',')))
+ *p = '\0';
+ }
+ }
+
+ if (defs->variant) {
+ if (!strchr(defs->variant, ',')) {
+ mdefs->variant[0] = defs->variant;
+ } else {
+ char *p;
+ int i;
+ mdefs->variant[1] = _XkbDupString(defs->variant);
+ if (mdefs->variant[1] == NULL)
+ return False;
+ squeeze_spaces(mdefs->variant[1]);
+ p = mdefs->variant[1];
+ for (i = 2; i <= XkbNumKbdGroups; i++) {
+ if ((p = strchr(p, ','))) {
+ *p++ = '\0';
+ mdefs->variant[i] = p;
+ } else {
+ break;
+ }
+ }
+ if (p && (p = strchr(p, ',')))
+ *p = '\0';
+ }
+ }
+ return True;
+}
+
+static void
+#if NeedFunctionPrototypes
+FreeMultiDefs(XkbRF_MultiDefsPtr defs)
+#else
+FreeMultiDefs(defs)
+ XkbRF_MultiDefsPtr defs;
+#endif
+{
+ if (defs->options) _XkbFree(defs->options);
+ if (defs->layout[1]) _XkbFree(defs->layout[1]);
+ if (defs->variant[1]) _XkbFree(defs->variant[1]);
+}
+
+static void
+#if NeedFunctionPrototypes
+Apply(char *src, char **dst)
+#else
+Apply(src, dst)
+ char *src;
+ char *dst;
+#endif
+{
+ if (src) {
+ if (*src == '+' || *src == '!') {
+ *dst= _Concat(*dst, src);
+ } else {
+ if (*dst == NULL)
+ *dst= _XkbDupString(src);
+ }
+ }
+}
+
+static void
#if NeedFunctionPrototypes
XkbRF_ApplyRule( XkbRF_RulePtr rule,
XkbComponentNamesPtr names)
@@ -483,86 +709,129 @@ XkbRF_ApplyRule(rule,names)
#endif
{
rule->flags&= ~XkbRF_PendingMatch; /* clear the flag because it's applied */
- if ((rule->flags&XkbRF_Append)==0) {
- if ((names->keycodes==NULL)&&(rule->keycodes!=NULL))
- names->keycodes= _XkbDupString(rule->keycodes);
-
- if ((names->symbols==NULL)&&(rule->symbols!=NULL))
- names->symbols= _XkbDupString(rule->symbols);
-
- if ((names->types==NULL)&&(rule->types!=NULL))
- names->types= _XkbDupString(rule->types);
- if ((names->compat==NULL)&&(rule->compat!=NULL))
- names->compat= _XkbDupString(rule->compat);
-
- if ((names->geometry==NULL)&&(rule->geometry!=NULL))
- names->geometry= _XkbDupString(rule->geometry);
-
- if ((names->keymap==NULL)&&(rule->keymap!=NULL))
- names->keymap= _XkbDupString(rule->keymap);
- }
- else {
- if (rule->keycodes)
- names->keycodes= _Concat(names->keycodes,rule->keycodes);
- if (rule->symbols)
- names->symbols= _Concat(names->symbols,rule->symbols);
- if (rule->types)
- names->types= _Concat(names->types,rule->types);
- if (rule->compat)
- names->compat= _Concat(names->compat,rule->compat);
- if (rule->geometry)
- names->geometry= _Concat(names->geometry,rule->geometry);
- if (rule->keymap)
- names->keymap= _Concat(names->keymap,rule->keymap);
- }
- return (names->keycodes && names->symbols && names->types &&
- names->compat && names->geometry ) || names->keymap;
+ Apply(rule->keycodes, &names->keycodes);
+ Apply(rule->symbols, &names->symbols);
+ Apply(rule->types, &names->types);
+ Apply(rule->compat, &names->compat);
+ Apply(rule->geometry, &names->geometry);
+ Apply(rule->keymap, &names->keymap);
}
-#define CHECK_MATCH(r,d) ((((r)[0]=='?')&&((r)[1]=='\0'))||(strcmp(r,d)==0))
+static Bool
+#if NeedFunctionPrototypes
+CheckGroup( XkbRF_RulesPtr rules,
+ char * group_name,
+ char * name)
+#else
+XkbRF_CheckApplyRule(rules,group,name)
+ XkbRF_RulesPtr rules;
+ char * group_name;
+ char * name;
+#endif
+{
+ int i;
+ char *p;
+ XkbRF_GroupPtr group;
+
+ for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) {
+ if (! strcmp(group->name, group_name)) {
+ break;
+ }
+ }
+ if (i == rules->num_groups)
+ return False;
+ for (i = 0, p = group->words; i < group->number; i++, p += strlen(p)+1) {
+ if (! strcmp(p, name)) {
+ return True;
+ }
+ }
+ return False;
+}
-Bool
+static int
#if NeedFunctionPrototypes
XkbRF_CheckApplyRule( XkbRF_RulePtr rule,
- XkbRF_VarDefsPtr defs,
- XkbComponentNamesPtr names)
+ XkbRF_MultiDefsPtr mdefs,
+ XkbComponentNamesPtr names,
+ XkbRF_RulesPtr rules)
#else
-XkbRF_CheckApplyRule(rule,defs,names)
+XkbRF_CheckApplyRule(rule,mdefs,names)
XkbRF_RulePtr rule;
- XkbRF_VarDefsPtr defs;
+ XkbRF_MultiDefsPtr mdefs;
XkbComponentNamesPtr names;
+ XkbRF_RulesPtr rules;
#endif
{
- if (rule->model!=NULL) {
- if ((!defs->model)||(!CHECK_MATCH(rule->model,defs->model)))
- return False;
+ Bool pending = False;
+
+ if (rule->model != NULL) {
+ if(mdefs->model == NULL)
+ return 0;
+ if (strcmp(rule->model, "*") == 0) {
+ pending = True;
+ } else {
+ if (rule->model[0] == '$') {
+ if (!CheckGroup(rules, rule->model, mdefs->model))
+ return 0;
+ } else {
+ if (strcmp(rule->model, mdefs->model) != 0)
+ return 0;
+ }
+ }
}
- if (rule->layout!=NULL) {
- if ((!defs->layout)||(!CHECK_MATCH(rule->layout,defs->layout)))
- return False;
+ if (rule->option != NULL) {
+ if (mdefs->options == NULL)
+ return 0;
+ if ((!MatchOneOf(rule->option,mdefs->options)))
+ return 0;
}
- if (rule->variant!=NULL) {
- if ((!defs->variant)||(!CHECK_MATCH(rule->variant,defs->variant)))
- return False;
+
+ if (rule->layout != NULL) {
+ if(mdefs->layout[rule->layout_num] == NULL ||
+ *mdefs->layout[rule->layout_num] == '\0')
+ return 0;
+ if (strcmp(rule->layout, "*") == 0) {
+ pending = True;
+ } else {
+ if (rule->layout[0] == '$') {
+ if (!CheckGroup(rules, rule->layout,
+ mdefs->layout[rule->layout_num]))
+ return 0;
+ } else {
+ if (strcmp(rule->layout, mdefs->layout[rule->layout_num]) != 0)
+ return 0;
+ }
+ }
}
- if (rule->option!=NULL) {
- if ((!defs->options)||(!MatchOneOf(rule->option,defs->options)))
- return False;
+ if (rule->variant != NULL) {
+ if (mdefs->variant[rule->variant_num] == NULL ||
+ *mdefs->variant[rule->variant_num] == '\0')
+ return 0;
+ if (strcmp(rule->variant, "*") == 0) {
+ pending = True;
+ } else {
+ if (rule->variant[0] == '$') {
+ if (!CheckGroup(rules, rule->variant,
+ mdefs->variant[rule->variant_num]))
+ return 0;
+ } else {
+ if (strcmp(rule->variant,
+ mdefs->variant[rule->variant_num]) != 0)
+ return 0;
+ }
+ }
}
-
- if ((!rule->option)&&
- ((!rule->model)||(!rule->layout)||(!rule->variant))) {
- /* partial map -- partial maps are applied in the order they */
- /* appear, but all partial maps come before any options. */
- rule->flags|= XkbRF_PendingMatch;
- return False;
+ if (pending) {
+ rule->flags|= XkbRF_PendingMatch;
+ return rule->number;
}
/* exact match, apply it now */
- return XkbRF_ApplyRule(rule,names);
+ XkbRF_ApplyRule(rule,names);
+ return rule->number;
}
-void
+static void
#if NeedFunctionPrototypes
XkbRF_ClearPartialMatches(XkbRF_RulesPtr rules)
#else
@@ -578,7 +847,7 @@ XkbRF_RulePtr rule;
}
}
-Bool
+static void
#if NeedFunctionPrototypes
XkbRF_ApplyPartialMatches(XkbRF_RulesPtr rules,XkbComponentNamesPtr names)
#else
@@ -589,78 +858,57 @@ XkbRF_ApplyPartialMatches(rules,names)
{
int i;
XkbRF_RulePtr rule;
-Bool complete;
- complete= False;
- for (rule=rules->rules,i=0;(i<rules->num_rules)&&(!complete);i++,rule++) {
+ for (rule = rules->rules, i = 0; i < rules->num_rules; i++, rule++) {
if ((rule->flags&XkbRF_PendingMatch)==0)
continue;
- complete= XkbRF_ApplyRule(rule,names);
- }
- return complete;
-}
-
-void
-#if NeedFunctionPrototypes
-XkbRF_CheckApplyDelayedRules( XkbRF_RulesPtr rules,
- XkbRF_VarDefsPtr defs,
- XkbComponentNamesPtr names)
-#else
-XkbRF_CheckApplyDelayedRules(rules,defs,names)
- XkbRF_RulesPtr rules;
- XkbRF_VarDefsPtr defs;
- XkbComponentNamesPtr names;
-#endif
-{
-int i;
-XkbRF_RulePtr rule;
-
- for (rule=rules->rules,i=0;(i<rules->num_rules);i++,rule++) {
- if ((rule->flags&XkbRF_Delayed)==0)
- continue;
- XkbRF_CheckApplyRule(rule,defs,names);
+ XkbRF_ApplyRule(rule,names);
}
- return;
}
-Bool
+static void
#if NeedFunctionPrototypes
XkbRF_CheckApplyRules( XkbRF_RulesPtr rules,
- XkbRF_VarDefsPtr defs,
- XkbComponentNamesPtr names)
+ XkbRF_MultiDefsPtr mdefs,
+ XkbComponentNamesPtr names,
+ int flags)
#else
-XkbRF_CheckApplyRules(rules,defs,names)
+XkbRF_CheckApplyRules(rules, mdefs, names, flags)
XkbRF_RulesPtr rules;
- XkbRF_VarDefsPtr defs;
+ XkbRF_MultiDefsPtr mdefs;
XkbComponentNamesPtr names;
+ int flags;
#endif
{
int i;
XkbRF_RulePtr rule;
-Bool complete;
+int skip;
- complete= False;
- for (rule=rules->rules,i=0;(i<rules->num_rules)&&(!complete);i++,rule++) {
- if ((rule->flags&XkbRF_Delayed)!=0)
+ for (rule = rules->rules, i=0; i < rules->num_rules; rule++, i++) {
+ if ((rule->flags & flags) != flags)
continue;
- complete= XkbRF_CheckApplyRule(rule,defs,names);
+ skip = XkbRF_CheckApplyRule(rule, mdefs, names, rules);
+ if (skip && !(flags & XkbRF_Option)) {
+ for ( ;(i < rules->num_rules) && (rule->number == skip);
+ rule++, i++);
+ rule--; i--;
+ }
}
- return complete;
}
/***====================================================================***/
-char *
+static char *
#if NeedFunctionPrototypes
-XkbRF_SubstituteVars(char *name,XkbRF_VarDefsPtr defs)
+XkbRF_SubstituteVars(char *name, XkbRF_MultiDefsPtr mdefs)
#else
-XkbRF_SubstituteVars(name,defs)
+XkbRF_SubstituteVars(name, mdefs)
char * name;
- XkbRF_VarDefsPtr defs;
+ XkbRF_MultiDefsPtr mdefs;
#endif
{
-char *str,*outstr,*orig;
-int len;
+char *str, *outstr, *orig, *var;
+int len, ndx;
orig= name;
str= index(name,'%');
@@ -678,17 +926,22 @@ int len;
extra_len= 2;
str++;
}
-
- if ((str[1]=='l')&&defs->layout)
- len+= strlen(defs->layout)+extra_len;
- else if ((str[1]=='m')&&defs->model)
- len+= strlen(defs->model)+extra_len;
- else if ((str[1]=='v')&&defs->variant)
- len+= strlen(defs->variant)+extra_len;
- if ((pfx=='(')&&(str[2]==')')) {
+ var = str + 1;
+ str = get_index(var + 1, &ndx);
+ if (ndx == -1) {
+ str = index(str,'%');
+ continue;
+ }
+ if ((*var=='l') && mdefs->layout[ndx] && *mdefs->layout[ndx])
+ len+= strlen(mdefs->layout[ndx])+extra_len;
+ else if ((*var=='m')&&mdefs->model)
+ len+= strlen(mdefs->model)+extra_len;
+ else if ((*var=='v') && mdefs->variant[ndx] && *mdefs->variant[ndx])
+ len+= strlen(mdefs->variant[ndx])+extra_len;
+ if ((pfx=='(')&&(*str==')')) {
str++;
}
- str= index(&str[1],'%');
+ str= index(&str[0],'%');
}
name= (char *)_XkbAlloc(len+1);
str= orig;
@@ -708,26 +961,30 @@ int len;
}
else pfx= '\0';
- if ((str[0]=='l')&&(defs->layout)) {
+ var = str;
+ str = get_index(var + 1, &ndx);
+ if (ndx == -1) {
+ continue;
+ }
+ if ((*var=='l') && mdefs->layout[ndx] && *mdefs->layout[ndx]) {
if (pfx) *outstr++= pfx;
- strcpy(outstr,defs->layout);
- outstr+= strlen(defs->layout);
+ strcpy(outstr,mdefs->layout[ndx]);
+ outstr+= strlen(mdefs->layout[ndx]);
if (sfx) *outstr++= sfx;
}
- else if ((str[0]=='m')&&(defs->model)) {
+ else if ((*var=='m')&&(mdefs->model)) {
if (pfx) *outstr++= pfx;
- strcpy(outstr,defs->model);
- outstr+= strlen(defs->model);
+ strcpy(outstr,mdefs->model);
+ outstr+= strlen(mdefs->model);
if (sfx) *outstr++= sfx;
}
- else if ((str[0]=='v')&&(defs->variant)) {
+ else if ((*var=='v') && mdefs->variant[ndx] && *mdefs->variant[ndx]) {
if (pfx) *outstr++= pfx;
- strcpy(outstr,defs->variant);
- outstr+= strlen(defs->variant);
+ strcpy(outstr,mdefs->variant[ndx]);
+ outstr+= strlen(mdefs->variant[ndx]);
if (sfx) *outstr++= sfx;
}
- str++;
- if ((pfx=='(')&&(str[0]==')'))
+ if ((pfx=='(')&&(*str==')'))
str++;
}
else {
@@ -754,26 +1011,32 @@ XkbRF_GetComponents(rules,defs,names)
XkbComponentNamesPtr names;
#endif
{
-Bool complete;
+ XkbRF_MultiDefsRec mdefs;
+
+ MakeMultiDefs(&mdefs, defs);
bzero((char *)names,sizeof(XkbComponentNamesRec));
XkbRF_ClearPartialMatches(rules);
- complete= XkbRF_CheckApplyRules(rules,defs,names);
- if (!complete)
- complete= XkbRF_ApplyPartialMatches(rules,names);
- XkbRF_CheckApplyDelayedRules(rules,defs,names);
+ XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Normal);
+ XkbRF_ApplyPartialMatches(rules, names);
+ XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Append);
+ XkbRF_ApplyPartialMatches(rules, names);
+ XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Option);
+
if (names->keycodes)
- names->keycodes= XkbRF_SubstituteVars(names->keycodes,defs);
+ names->keycodes= XkbRF_SubstituteVars(names->keycodes, &mdefs);
if (names->symbols)
- names->symbols= XkbRF_SubstituteVars(names->symbols,defs);
+ names->symbols= XkbRF_SubstituteVars(names->symbols, &mdefs);
if (names->types)
- names->types= XkbRF_SubstituteVars(names->types,defs);
+ names->types= XkbRF_SubstituteVars(names->types, &mdefs);
if (names->compat)
- names->compat= XkbRF_SubstituteVars(names->compat,defs);
+ names->compat= XkbRF_SubstituteVars(names->compat, &mdefs);
if (names->geometry)
- names->geometry= XkbRF_SubstituteVars(names->geometry,defs);
+ names->geometry= XkbRF_SubstituteVars(names->geometry, &mdefs);
if (names->keymap)
- names->keymap= XkbRF_SubstituteVars(names->keymap,defs);
+ names->keymap= XkbRF_SubstituteVars(names->keymap, &mdefs);
+
+ FreeMultiDefs(&mdefs);
return (names->keycodes && names->symbols && names->types &&
names->compat && names->geometry ) || names->keymap;
}
@@ -807,6 +1070,33 @@ XkbRF_AddRule(rules)
return &rules->rules[rules->num_rules++];
}
+XkbRF_GroupPtr
+#if NeedFunctionPrototypes
+XkbRF_AddGroup(XkbRF_RulesPtr rules)
+#else
+XkbRF_AddGroup(rules)
+ XkbRF_RulesPtr rules;
+#endif
+{
+ if (rules->sz_groups<1) {
+ rules->sz_groups= 16;
+ rules->num_groups= 0;
+ rules->groups= _XkbTypedCalloc(rules->sz_groups,XkbRF_GroupRec);
+ }
+ else if (rules->num_groups >= rules->sz_groups) {
+ rules->sz_groups *= 2;
+ rules->groups= _XkbTypedRealloc(rules->groups,rules->sz_groups,
+ XkbRF_GroupRec);
+ }
+ if (!rules->groups) {
+ rules->sz_groups= rules->num_groups= 0;
+ return NULL;
+ }
+
+ bzero((char *)&rules->groups[rules->num_groups],sizeof(XkbRF_GroupRec));
+ return &rules->groups[rules->num_groups++];
+}
+
Bool
#if NeedFunctionPrototypes
XkbRF_LoadRules(FILE *file, XkbRF_RulesPtr rules)
@@ -819,16 +1109,25 @@ XkbRF_LoadRules(file,rules)
InputLine line;
RemapSpec remap;
XkbRF_RuleRec trule,*rule;
+XkbRF_GroupRec tgroup,*group;
if (!(rules && file))
return False;
bzero((char *)&remap,sizeof(RemapSpec));
+ bzero((char *)&tgroup,sizeof(XkbRF_GroupRec));
InitInputLine(&line);
while (GetInputLine(file,&line,True)) {
- if (CheckLine(&line,&remap,&trule)) {
- if ((rule= XkbRF_AddRule(rules))!=NULL) {
- *rule= trule;
- bzero((char *)&trule,sizeof(XkbRF_RuleRec));
+ if (CheckLine(&line,&remap,&trule,&tgroup)) {
+ if (tgroup.number) {
+ if ((group= XkbRF_AddGroup(rules))!=NULL) {
+ *group= tgroup;
+ bzero((char *)&tgroup,sizeof(XkbRF_GroupRec));
+ }
+ } else {
+ if ((rule= XkbRF_AddRule(rules))!=NULL) {
+ *rule= trule;
+ bzero((char *)&trule,sizeof(XkbRF_RuleRec));
+ }
}
}
line.num_line= 0;
@@ -976,7 +1275,7 @@ XkbRF_LoadDescriptions(file,rules)
InputLine line;
XkbRF_VarDescRec tmp;
char *tok;
-int len,headingtype,extra_ndx;
+int len,headingtype,extra_ndx = 0;
bzero((char *)&tmp, sizeof(XkbRF_VarDescRec));
headingtype = HEAD_NONE;
@@ -1200,6 +1499,7 @@ XkbRF_Free(rules,freeRules)
{
int i;
XkbRF_RulePtr rule;
+XkbRF_GroupPtr group;
if (!rules)
return;
@@ -1233,6 +1533,16 @@ XkbRF_RulePtr rule;
rules->num_rules= rules->sz_rules= 0;
rules->rules= NULL;
}
+
+ if (rules->groups) {
+ for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
+ if (group->name) _XkbFree(group->name);
+ if (group->words) _XkbFree(group->words);
+ }
+ _XkbFree(rules->groups);
+ rules->num_groups= 0;
+ rules->groups= NULL;
+ }
if (freeRules)
_XkbFree(rules);
return;
@@ -1246,7 +1556,7 @@ XkbRF_GetNamesProp(Display *dpy,char **rf_rtrn,XkbRF_VarDefsPtr vd_rtrn)
#else
XkbRF_GetNamesProp(dpy,rf_rtrn,vd_rtrn)
Display * dpy;
- char ** rf_rtrn;
+ char ** rf_rtrn;
XkbRF_VarDefsPtr vd_rtrn;
#endif
{
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 6f75e8146..5c3e41d48 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.18 2002/12/20 20:18:35 paulo Exp $ */
#include <stdio.h>
#include "X.h"
@@ -231,7 +232,7 @@ ProcXkbSelectEvents(client)
client->mapNotifyMask&= ~stuff->affectMap;
client->mapNotifyMask|= (stuff->affectMap&stuff->map);
}
- if (stuff->affectWhich&(~XkbMapNotifyMask)==0)
+ if ((stuff->affectWhich&(~XkbMapNotifyMask))==0)
return client->noClientException;
masks = XkbFindClientResource((DevicePtr)dev,client);
@@ -1946,7 +1947,7 @@ register XkbServerMapPtr server = xkb->server;
register unsigned i;
unsigned first,last;
- if ((req->present&XkbKeyBehaviorsMask==0)||(req->nKeyBehaviors<1)) {
+ if (((req->present&XkbKeyBehaviorsMask)==0)||(req->nKeyBehaviors<1)) {
req->present&= ~XkbKeyBehaviorsMask;
req->nKeyBehaviors= 0;
return 1;
@@ -2396,21 +2397,21 @@ unsigned first,last;
server->behaviors[wire->key].type= wire->type;
server->behaviors[wire->key].data= wire->data;
if ((wire->type==XkbKB_RadioGroup)&&(((int)wire->data)>maxRG))
- maxRG= wire->data;
+ maxRG= wire->data + 1;
}
wire++;
}
if (maxRG>(int)xkbi->nRadioGroups) {
- int sz = (maxRG+1)*sizeof(XkbRadioGroupRec);
+ int sz = maxRG*sizeof(XkbRadioGroupRec);
if (xkbi->radioGroups)
- xkbi->radioGroups=(XkbRadioGroupPtr)Xrealloc(xkbi->radioGroups,sz);
- else xkbi->radioGroups= (XkbRadioGroupPtr)Xcalloc(sz);
+ xkbi->radioGroups=(XkbRadioGroupPtr)_XkbRealloc(xkbi->radioGroups,sz);
+ else xkbi->radioGroups= (XkbRadioGroupPtr)_XkbCalloc(1, sz);
if (xkbi->radioGroups) {
if (xkbi->nRadioGroups)
bzero(&xkbi->radioGroups[xkbi->nRadioGroups],
(maxRG-xkbi->nRadioGroups)*sizeof(XkbRadioGroupRec));
- xkbi->nRadioGroups= maxRG+1;
+ xkbi->nRadioGroups= maxRG;
}
else xkbi->nRadioGroups= 0;
/* should compute members here */
@@ -3323,9 +3324,9 @@ ProcXkbGetNamedIndicator(client)
{
DeviceIntPtr dev;
xkbGetNamedIndicatorReply rep;
- register int i;
+ register int i = 0;
XkbSrvLedInfoPtr sli;
- XkbIndicatorMapPtr map;
+ XkbIndicatorMapPtr map = NULL;
Bool supported;
REQUEST(xkbGetNamedIndicatorReq);
@@ -3436,7 +3437,7 @@ ProcXkbSetNamedIndicator(client)
DeviceIntPtr dev,kbd;
XkbIndicatorMapPtr map;
XkbSrvLedInfoPtr sli;
- register int led;
+ register int led = 0;
unsigned extDevReason;
unsigned statec,namec,mapc;
XkbEventCauseRec cause;
@@ -4224,7 +4225,7 @@ ProcXkbSetNames(client)
names->phys_symbols= *tmp++;
if (stuff->which&XkbTypesNameMask)
names->types= *tmp++;
- if (stuff->which&XkbCompatNameMask)
+ if (stuff->which&XkbCompatNameMask)
names->compat= *tmp++;
if ((stuff->which&XkbKeyTypeNamesMask)&&(stuff->nTypes>0)) {
register unsigned i;
@@ -4310,7 +4311,7 @@ ProcXkbSetNames(client)
tmp+= stuff->nRadioGroups;
}
else if (names->radio_groups) {
- Xfree(names->radio_groups);
+ _XkbFree(names->radio_groups);
names->radio_groups= NULL;
names->num_rg= 0;
}
@@ -5597,7 +5598,7 @@ ProcXkbPerClientFlags(client)
/* all latin-1 alphanumerics, plus parens, minus, underscore, slash */
/* and wildcards */
static unsigned char componentSpecLegal[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x87,
0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
@@ -5605,7 +5606,7 @@ static unsigned char componentSpecLegal[] = {
/* same as above but accepts percent, plus and bar too */
static unsigned char componentExprLegal[] = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x83,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x87,
0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
@@ -5631,7 +5632,7 @@ unsigned char *wire,*str,*tmp,*legal;
wire= *pWire;
len= (*(unsigned char *)wire++);
if (len>0) {
- str= (unsigned char *)Xcalloc(len+1);
+ str= (unsigned char *)_XkbCalloc(1, len+1);
if (str) {
tmp= str;
for (i=0;i<len;i++) {
@@ -5642,7 +5643,7 @@ unsigned char *wire,*str,*tmp,*legal;
if (tmp!=str)
*tmp++= '\0';
else {
- Xfree(str);
+ _XkbFree(str);
str= NULL;
}
}
@@ -6018,10 +6019,6 @@ ProcXkbGetKbdByName(client)
dev->key->xkbInfo->desc= xkb;
finfo.xkb= old_xkb; /* so it'll get freed automatically */
- if (dev->kbdfeed && dev->kbdfeed->xkb_sli) {
- XkbFreeSrvLedInfo(dev->kbdfeed->xkb_sli);
- dev->kbdfeed->xkb_sli= NULL;
- }
*xkb->ctrls= *old_xkb->ctrls;
for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
nG= XkbKeyNumGroups(xkb,i);
@@ -6038,6 +6035,20 @@ ProcXkbGetKbdByName(client)
memcpy(dev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
XkbUpdateCoreDescription(dev,True);
+ if (dev->kbdfeed && dev->kbdfeed->xkb_sli) {
+ XkbSrvLedInfoPtr old_sli;
+ XkbSrvLedInfoPtr sli;
+ old_sli = dev->kbdfeed->xkb_sli;
+ dev->kbdfeed->xkb_sli = NULL;
+ sli = XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,0);
+ if (sli) {
+ sli->explicitState = old_sli->explicitState;
+ sli->effectiveState = old_sli->effectiveState;
+ }
+ dev->kbdfeed->xkb_sli = sli;
+ XkbFreeSrvLedInfo(old_sli);
+ }
+
nkn.deviceID= nkn.oldDeviceID= dev->id;
nkn.minKeyCode= finfo.xkb->min_key_code;
nkn.maxKeyCode= finfo.xkb->max_key_code;
@@ -6054,12 +6065,12 @@ ProcXkbGetKbdByName(client)
XkbFreeKeyboard(finfo.xkb,XkbAllComponentsMask,True);
finfo.xkb= NULL;
}
- if (names.keymap) { Xfree(names.keymap); names.keymap= NULL; }
- if (names.keycodes) { Xfree(names.keycodes); names.keycodes= NULL; }
- if (names.types) { Xfree(names.types); names.types= NULL; }
- if (names.compat) { Xfree(names.compat); names.compat= NULL; }
- if (names.symbols) { Xfree(names.symbols); names.symbols= NULL; }
- if (names.geometry) { Xfree(names.geometry); names.geometry= NULL; }
+ if (names.keymap) { _XkbFree(names.keymap); names.keymap= NULL; }
+ if (names.keycodes) { _XkbFree(names.keycodes); names.keycodes= NULL; }
+ if (names.types) { _XkbFree(names.types); names.types= NULL; }
+ if (names.compat) { _XkbFree(names.compat); names.compat= NULL; }
+ if (names.symbols) { _XkbFree(names.symbols); names.symbols= NULL; }
+ if (names.geometry) { _XkbFree(names.geometry); names.geometry= NULL; }
return client->noClientException;
}
@@ -6914,9 +6925,9 @@ XkbExtensionInit()
{
ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
+ if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
ProcXkbDispatch, SProcXkbDispatch,
- XkbResetProc, StandardMinorOpcode)) {
+ XkbResetProc, StandardMinorOpcode))) {
XkbReqCode = (unsigned char)extEntry->base;
XkbEventBase = (unsigned char)extEntry->eventBase;
XkbErrorBase = (unsigned char)extEntry->errorBase;
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 7596d068b..b83f8b626 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -24,16 +24,20 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbAccessX.c,v 1.9 2001/08/23 14:33:25 alanh Exp $ */
#include <stdio.h>
#include <math.h>
+#ifdef __QNX__
+#include <limits.h>
+#endif
#define NEED_EVENTS 1
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include "inputstr.h"
#include "XKBsrv.h"
-#ifndef WIN32
+#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
@@ -139,9 +143,6 @@ AccessXKeyboardEvent(keybd,type,keyCode,isRepeat)
#endif
{
xEvent xE;
-#ifdef XINPUT
-extern int DeviceKeyPress;
-#endif
xE.u.u.type = type;
xE.u.u.detail = keyCode;
@@ -582,12 +583,11 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
*/
if (ctrls->enabled_ctrls & XkbSlowKeysMask) {
xkbAccessXNotify ev;
- /* If key was already pressed, ignore subsequent press events
- * from the server's autorepeat
+ /* If key was already pressed, ignore subsequent press events
+ * from the server's autorepeat
*/
if(xkbi->slowKey == key)
- return TRUE;
-
+ return TRUE;
ev.detail= XkbAXN_SKPress;
ev.keycode= key;
ev.slowKeysDelay= ctrls->slow_keys_delay;
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index fd8910841..7f3c47ebc 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.11 2003/02/13 15:36:48 dawes Exp $ */
#include <stdio.h>
#include <math.h>
@@ -137,7 +138,7 @@ XkbAction * pActs;
static XkbAction fake;
xkb= xkbi->desc;
- if (!XkbKeyHasActions(xkb,key)) {
+ if (!XkbKeyHasActions(xkb,key) || !XkbKeycodeInRange(xkb,key)) {
fake.type = XkbSA_NoAction;
return fake;
}
@@ -244,7 +245,6 @@ _XkbFilterSetState(xkbi,filter,keycode,pAction)
XkbAction * pAction;
#endif
{
-
if (filter->keycode==0) { /* initial press */
filter->keycode = keycode;
filter->active = 1;
@@ -620,14 +620,12 @@ Bool accel;
AccessXCancelRepeatKey(xkbi,keycode);
xkbi->mouseKeysAccel= accel&&
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
- if (xkbi->mouseKeysAccel) {
- xkbi->mouseKeysFlags= pAction->ptr.flags;
- xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
- xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
- xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
+ xkbi->mouseKeysFlags= pAction->ptr.flags;
+ xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
+ xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
+ xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
xkbi->desc->ctrls->mk_delay,
_XkbPtrAccelExpire,(pointer)xkbi);
- }
}
else if (filter->keycode==keycode) {
filter->active = 0;
@@ -844,7 +842,7 @@ XkbEventCauseRec cause;
filter->keycode= 0;
filter->active= 0;
}
- return 0;
+ return 1;
}
static int
@@ -923,12 +921,12 @@ _XkbFilterRedirectKey(xkbi,filter,keycode,pAction)
{
unsigned realMods;
xEvent ev;
-int x,y,kc;
+int x,y;
XkbStateRec old;
-unsigned mods,mask,oldCoreState,oldCorePrevState;
+unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0;
if ((filter->keycode!=0)&&(filter->keycode!=keycode))
- return 0;
+ return 1;
GetSpritePosition(&x,&y);
ev.u.keyButtonPointer.time = GetTimeInMillis();
@@ -982,8 +980,6 @@ unsigned mods,mask,oldCoreState,oldCorePrevState;
xkbi->device->key->prev_state= oldCorePrevState;
xkbi->state= old;
}
-
- return 0;
}
else if (filter->keycode==keycode) {
@@ -1018,10 +1014,72 @@ unsigned mods,mask,oldCoreState,oldCorePrevState;
filter->keycode= 0;
filter->active= 0;
- return 0;
}
- return 0;
+ return 1;
+}
+
+static int
+#if NeedFunctionPrototypes
+_XkbFilterSwitchScreen( XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter,
+ unsigned keycode,
+ XkbAction * pAction)
+#else
+_XkbFilterSwitchScreen(xkbi,filter,keycode,pAction)
+ XkbSrvInfoPtr xkbi;
+ XkbFilterPtr filter;
+ unsigned keycode;
+ XkbAction * pAction;
+#endif
+{
+ if (filter->keycode==0) { /* initial press */
+ DeviceIntPtr dev = xkbi->device;
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterSwitchScreen;
+ AccessXCancelRepeatKey(xkbi, keycode);
+ XkbDDXSwitchScreen(dev,keycode,pAction);
+ return 0;
+ }
+ else if (filter->keycode==keycode) {
+ filter->active= 0;
+ return 0;
+ }
+ return 1;
+}
+
+#ifdef XFree86Server
+static int
+#if NeedFunctionPrototypes
+_XkbFilterXF86Private( XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter,
+ unsigned keycode,
+ XkbAction * pAction)
+#else
+_XkbFilterXF86Private(xkbi,filter,keycode,pAction)
+ XkbSrvInfoPtr xkbi;
+ XkbFilterPtr filter;
+ unsigned keycode;
+ XkbAction * pAction;
+#endif
+{
+ if (filter->keycode==0) { /* initial press */
+ DeviceIntPtr dev = xkbi->device;
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterXF86Private;
+ XkbDDXPrivate(dev,keycode,pAction);
+ return 0;
+ }
+ else if (filter->keycode==keycode) {
+ filter->active= 0;
+ return 0;
+ }
+ return 1;
}
+#endif
#ifdef XINPUT
@@ -1251,7 +1309,8 @@ Bool xiEvent;
sendEvent= XkbDDXTerminateServer(dev,key,&act);
break;
case XkbSA_SwitchScreen:
- sendEvent= XkbDDXSwitchScreen(dev,key,&act);
+ filter = _XkbNextFreeFilter();
+ sendEvent=_XkbFilterSwitchScreen(xkbi,filter,key,&act);
break;
case XkbSA_SetControls:
case XkbSA_LockControls:
@@ -1273,6 +1332,12 @@ Bool xiEvent;
sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act);
break;
#endif
+#ifdef XFree86Server
+ case XkbSA_XFree86Private:
+ filter = _XkbNextFreeFilter();
+ sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act);
+ break;
+#endif
}
}
}
@@ -1307,7 +1372,7 @@ Bool xiEvent;
}
if (sendEvent) {
-#if XINPUT
+#ifdef XINPUT
if (xiEvent)
ProcessOtherEvent(xE,dev,count);
else
@@ -1320,6 +1385,9 @@ Bool xiEvent;
}
else CoreProcessPointerEvent(xE,dev,count);
}
+ else if (keyEvent)
+ FixKeyState(xE,dev);
+
xkbi->prev_state= oldState;
XkbComputeDerivedState(xkbi);
keyc->prev_state= keyc->state;
diff --git a/xkb/xkbDflts.h b/xkb/xkbDflts.h
index a79202065..417478ef4 100644
--- a/xkb/xkbDflts.h
+++ b/xkb/xkbDflts.h
@@ -1,4 +1,5 @@
/* $Xorg: xkbDflts.h,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */
+/* $XFree86: xc/programs/Xserver/xkb/xkbDflts.h,v 1.2 2001/10/28 03:34:20 tsi Exp $ */
/* This file generated automatically by xkbcomp */
/* DO NOT EDIT */
#ifndef DEFAULT_H
@@ -176,279 +177,279 @@ static XkbSymInterpretRec dfltSI[69]= {
{ XK_ISO_Level2_Latch, 0x0000,
XkbSI_LevelOneOnly|XkbSI_Exactly, ShiftMask,
255,
- { XkbSA_LatchMods, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LatchMods, { 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Eisu_Shift, 0x0000,
XkbSI_Exactly, LockMask,
255,
- { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Eisu_toggle, 0x0000,
XkbSI_Exactly, LockMask,
255,
- { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Kana_Shift, 0x0000,
XkbSI_Exactly, LockMask,
255,
- { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Kana_Lock, 0x0000,
XkbSI_Exactly, LockMask,
255,
- { XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Shift_Lock, 0x0000,
XkbSI_AnyOf, ShiftMask|LockMask,
255,
- { XkbSA_LockMods, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockMods, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Num_Lock, 0x0000,
XkbSI_AnyOf, 0xff,
0,
- { XkbSA_LockMods, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_LockMods, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_Alt_L, 0x0000,
XkbSI_AnyOf, 0xff,
1,
- { XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Alt_R, 0x0000,
XkbSI_AnyOf, 0xff,
1,
- { XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Scroll_Lock, 0x0000,
XkbSI_AnyOf, 0xff,
4,
- { XkbSA_LockMods, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockMods, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_Lock, 0x0000,
XkbSI_AnyOf, 0xff,
255,
- { XkbSA_ISOLock, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_ISOLock, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_Level3_Shift, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff,
2,
- { XkbSA_SetMods, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } },
+ { XkbSA_SetMods, { 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } },
{ XK_ISO_Level3_Latch, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff,
2,
- { XkbSA_LatchMods, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } },
+ { XkbSA_LatchMods, { 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } },
{ XK_Mode_switch, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
3,
- { XkbSA_SetGroup, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetGroup, { 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_1, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_KP_End, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_KP_2, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_KP_Down, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_KP_3, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_KP_Next, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } },
{ XK_KP_4, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Left, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_6, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Right, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_7, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } },
{ XK_KP_Home, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } },
{ XK_KP_8, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } },
{ XK_KP_Up, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } },
{ XK_KP_9, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } },
{ XK_KP_Prior, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_MovePtr, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } },
+ { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } } },
{ XK_KP_5, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Begin, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_F1, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Divide, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_F2, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Multiply, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_F3, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Subtract, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Separator, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Add, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_0, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Insert, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Decimal, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_KP_Delete, 0x0001,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Button_Dflt, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Button1, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Button2, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Button3, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_DblClick_Dflt, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_DblClick1, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_DblClick2, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_DblClick3, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_PtrBtn, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_PtrBtn, { 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Drag_Dflt, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Drag1, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Drag2, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_Drag3, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockPtrBtn, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_EnableKeys, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } },
+ { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } } },
{ XK_Pointer_Accelerate, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } },
+ { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } } },
{ XK_Pointer_DfltBtnNext, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_Pointer_DfltBtnPrev, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_SetPtrDflt, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_SetPtrDflt, { 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_AccessX_Enable, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } },
+ { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } },
{ XK_Terminate_Server, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_Terminate, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_Terminate, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_Group_Latch, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
3,
- { XkbSA_LatchGroup, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LatchGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_Next_Group, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
3,
- { XkbSA_LockGroup, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockGroup, { 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_Prev_Group, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
3,
- { XkbSA_LockGroup, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockGroup, { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_First_Group, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockGroup, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockGroup, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ XK_ISO_Last_Group, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
- { XkbSA_LockGroup, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
{ NoSymbol, 0x0000,
XkbSI_Exactly, LockMask,
255,
- { XkbSA_LockMods, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } },
+ { XkbSA_LockMods, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
{ NoSymbol, 0x0000,
XkbSI_AnyOf, 0xff,
255,
- { XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+ { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }
};
#define num_dfltSI (sizeof(dfltSI)/sizeof(XkbSymInterpretRec))
@@ -466,38 +467,38 @@ static XkbCompatMapRec compatMap= {
static XkbIndicatorRec indicators= {
0x0,
{
- { 0x80, 0, 0x00, XkbIM_UseEffective, LockMask, LockMask, 0, 0 },
- { 0x80, 0, 0x00, XkbIM_UseEffective, 0, 0, vmod_NumLockMask, 0 },
- { 0x80, 0, 0x00, XkbIM_UseLocked, ShiftMask, ShiftMask, 0, 0 },
- { 0x80, 0, 0x00, 0, 0, 0, 0, XkbMouseKeysMask },
- { 0x80, 0, 0x00, XkbIM_UseLocked, 0, 0, vmod_ScrollLockMask, 0 },
- { 0x80, XkbIM_UseEffective, 0xfe, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
- { 0x00, 0, 0x00, 0, 0, 0, 0, 0 }
+ { 0x80, 0, 0x00, XkbIM_UseEffective, { LockMask, LockMask, 0 }, 0 },
+ { 0x80, 0, 0x00, XkbIM_UseEffective, { 0, 0, vmod_NumLockMask }, 0 },
+ { 0x80, 0, 0x00, XkbIM_UseLocked, { ShiftMask, ShiftMask, 0 }, 0 },
+ { 0x80, 0, 0x00, 0, { 0, 0, 0 }, XkbMouseKeysMask },
+ { 0x80, 0, 0x00, XkbIM_UseLocked, { 0, 0, vmod_ScrollLockMask }, 0 },
+ { 0x80, XkbIM_UseEffective, 0xfe, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
+ { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }
}
};
static void
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 5a0f1d54b..291674fcf 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.10 2001/10/28 03:34:20 tsi Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -35,8 +36,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "windowstr.h"
#include "XKBsrv.h"
-extern int (*InitialVector[3])();
-
/***====================================================================***/
void
@@ -51,7 +50,6 @@ XkbSendNewKeyboardNotify(kbd,pNKN)
register int i;
Time time;
CARD16 changed;
-XkbChangesRec changes;
pNKN->type = XkbEventCode + XkbEventBase;
pNKN->xkbType = XkbNewKeyboardNotify;
@@ -181,7 +179,7 @@ XkbSendMapNotify(kbd,pMN)
{
int i;
XkbSrvInfoPtr xkbi;
-unsigned time,initialized;
+unsigned time = 0,initialized;
CARD16 changed;
xkbi = kbd->key->xkbInfo;
@@ -260,6 +258,10 @@ CARD32 changedControls;
changedControls|= XkbMouseKeysAccelMask;
if (old->ax_options!=new->ax_options)
changedControls|= XkbAccessXKeysMask;
+ if ((old->ax_options^new->ax_options) & XkbAX_SKOptionsMask)
+ changedControls|= XkbStickyKeysMask;
+ if ((old->ax_options^new->ax_options) & XkbAX_FBOptionsMask)
+ changedControls|= XkbAccessXFeedbackMask;
if ((old->ax_timeout!=new->ax_timeout)||
(old->axt_ctrls_mask!=new->axt_ctrls_mask)||
(old->axt_ctrls_values!=new->axt_ctrls_values)||
@@ -308,10 +310,10 @@ XkbSendControlsNotify(kbd,pCN)
#endif
{
int initialized;
-CARD32 changedControls,enabledControls,enabledChanges;
+CARD32 changedControls, enabledControls, enabledChanges = 0;
XkbSrvInfoPtr xkbi;
XkbInterestPtr interest;
-Time time;
+Time time = 0;
interest = kbd->xkb_interest;
if (!interest)
@@ -367,7 +369,7 @@ XkbSendIndicatorNotify(kbd,xkbType,pEv)
{
int initialized;
XkbInterestPtr interest;
-Time time;
+Time time = 0;
CARD32 state,changed;
interest = kbd->xkb_interest;
@@ -441,8 +443,8 @@ XkbSrvInfoPtr xkbi;
XkbInterestPtr interest;
CARD8 id;
CARD16 pitch,duration;
-Time time;
-XID winID;
+Time time = 0;
+XID winID = 0;
xkbi = kbd->key->xkbInfo;
@@ -519,7 +521,7 @@ XkbSendAccessXNotify(kbd,pEv)
{
int initialized;
XkbInterestPtr interest;
-Time time;
+Time time = 0;
CARD16 sk_delay,db_delay;
interest = kbd->xkb_interest;
@@ -570,7 +572,7 @@ XkbSendNamesNotify(kbd,pEv)
{
int initialized;
XkbInterestPtr interest;
-Time time;
+Time time = 0;
CARD16 changed,changedVirtualMods;
CARD32 changedIndicators;
@@ -625,8 +627,8 @@ XkbSendCompatMapNotify(kbd,pEv)
{
int initialized;
XkbInterestPtr interest;
-Time time;
-CARD16 firstSI,nSI,nTotalSI;
+Time time = 0;
+CARD16 firstSI = 0, nSI = 0, nTotalSI = 0;
interest = kbd->xkb_interest;
if (!interest)
@@ -680,7 +682,7 @@ XkbSendActionMessage(kbd,pEv)
int initialized;
XkbSrvInfoPtr xkbi;
XkbInterestPtr interest;
-Time time;
+Time time = 0;
xkbi = kbd->key->xkbInfo;
interest = kbd->xkb_interest;
@@ -731,9 +733,9 @@ XkbSendExtensionDeviceNotify(dev,client,pEv)
{
int initialized;
XkbInterestPtr interest;
-Time time;
-CARD32 defined,state;
-CARD16 reason,supported;
+Time time = 0;
+CARD32 defined, state;
+CARD16 reason, supported = 0;
interest = dev->xkb_interest;
if (!interest)
@@ -894,7 +896,7 @@ XkbFilterEvents(pClient,nEvents,xE)
xEvent *xE;
#endif
{
-int i;
+int i, button_mask;
DeviceIntPtr pXDev = (DeviceIntPtr)LookupKeyboardDevice();
XkbSrvInfoPtr xkbi;
@@ -920,7 +922,7 @@ XkbSrvInfoPtr xkbi;
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
return False;
}
- if ((pXDev->grab != NullGrab) &&
+ if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab &&
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
register unsigned state,flags;
@@ -945,6 +947,19 @@ XkbSrvInfoPtr xkbi;
state= xkbi->state.compat_lookup_mods;
xE[0].u.keyButtonPointer.state= state;
}
+ button_mask = 1 << xE[0].u.u.detail;
+ if (xE[0].u.u.type == ButtonPress &&
+ ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
+ (xkbi->lockedPtrButtons & button_mask) == button_mask) {
+#ifdef DEBUG
+ /* If the MouseKeys is pressed, and the "real" mouse is also pressed
+ * when the mouse is released, the server does not behave properly.
+ * Faking a release of the button here solves the problem.
+ */
+ ErrorF("Faking release of button %d\n", xE[0].u.u.detail);
+#endif
+ XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
+ }
}
else {
register CARD8 type;
@@ -979,6 +994,15 @@ XkbSrvInfoPtr xkbi;
xE->u.enterLeave.state&= 0x1F00;
xE->u.enterLeave.state|= xkbi->state.compat_grab_mods;
}
+ button_mask = 1 << xE[i].u.u.detail;
+ if (type == ButtonPress &&
+ ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
+ (xkbi->lockedPtrButtons & button_mask) == button_mask) {
+#ifdef DEBUG
+ ErrorF("Faking release of button %d\n", xE[i].u.u.detail);
+#endif
+ XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
+ }
}
}
return True;
@@ -1074,7 +1098,7 @@ Bool found;
dev->xkb_interest = interest->next;
autoCtrls= interest->autoCtrls;
autoValues= interest->autoCtrlValues;
- xfree(interest);
+ _XkbFree(interest);
found= True;
}
while ((!found)&&(interest->next)) {
@@ -1083,7 +1107,7 @@ Bool found;
interest->next = victim->next;
autoCtrls= victim->autoCtrls;
autoValues= victim->autoCtrlValues;
- xfree(victim);
+ _XkbFree(victim);
found= True;
}
interest = interest->next;
@@ -1113,7 +1137,7 @@ DeviceIntPtr dev = (DeviceIntPtr)inDev;
XkbInterestPtr interest;
Bool found;
unsigned long autoCtrls,autoValues;
-ClientPtr client;
+ClientPtr client = NULL;
found= False;
autoCtrls= autoValues= 0;
@@ -1124,7 +1148,7 @@ ClientPtr client;
autoCtrls= interest->autoCtrls;
autoValues= interest->autoCtrlValues;
client= interest->client;
- xfree(interest);
+ _XkbFree(interest);
found= True;
}
while ((!found)&&(interest->next)) {
@@ -1134,7 +1158,7 @@ ClientPtr client;
autoCtrls= victim->autoCtrls;
autoValues= victim->autoCtrlValues;
client= victim->client;
- xfree(victim);
+ _XkbFree(victim);
found= True;
}
interest = interest->next;
@@ -1149,6 +1173,3 @@ ClientPtr client;
}
return found;
}
-
-
-
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 3ca52ebc5..5074b8bfb 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -1,6 +1,3 @@
-/*
- * @(#)$RCSfile$ $Revision$ (DEC) $Date$
- */
/* $Xorg: xkbInit.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
@@ -27,10 +24,12 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.26.2.1 2003/03/17 23:53:14 paulo Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <unistd.h>
#include <math.h>
#define NEED_EVENTS 1
#include <X11/X.h>
@@ -39,6 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xatom.h>
#include "misc.h"
#include "inputstr.h"
+#include "opaque.h"
#include "property.h"
#define XKBSRV_NEED_FILE_FUNCS
#include "XKBsrv.h"
@@ -56,7 +56,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PHYS_LEDS 0x7f
#define LED_COMPOSE 8
#else
-#if defined(ultrix) || defined(__osf__) || defined(__alpha)
+#if defined(ultrix) || defined(__osf__) || defined(__alpha) || defined(__alpha__)
#define LED_COMPOSE 2
#define LED_CAPS 3
#define LED_SCROLL 4
@@ -169,7 +169,6 @@ XkbWriteRulesProp(client, closure)
#endif
{
int len,out;
-extern WindowPtr * WindowTable;
Atom name;
char * pval;
@@ -305,6 +304,9 @@ XkbSetRulesDflts(rulesFile,model,layout,variant,options)
#include "xkbDflts.h"
+/* A dummy to keep the compiler quiet */
+pointer xkbBogus = &indicators;
+
static Bool
#if NeedFunctionPrototypes
XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
@@ -441,7 +443,7 @@ Atom unknown;
}
#ifdef DEBUG_RADIO_GROUPS
if (names->num_rg<1) {
- names->radio_groups= (Atom *)Xcalloc(RG_COUNT*sizeof(Atom));
+ names->radio_groups= (Atom *)_XkbCalloc(RG_COUNT, sizeof(Atom));
if (names->radio_groups) {
names->num_rg = RG_COUNT;
names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS");
@@ -483,6 +485,13 @@ XkbSrvLedInfoPtr sli;
map->maps[LED_NUM-1].mods.mask= 0;
map->maps[LED_NUM-1].mods.real_mods= 0;
map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
+
+/* Metro Link */
+ map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
+ map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
+/* Metro Link */
}
sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
if (sli)
@@ -652,6 +661,10 @@ XkbEventCauseRec cause;
return;
}
+#if MAP_LENGTH > XkbMaxKeyCount
+#undef XkbMaxKeyCount
+#define XkbMaxKeyCount MAP_LENGTH
+#endif
Bool
#if NeedFunctionPrototypes
@@ -675,7 +688,7 @@ XkbFileInfo finfo;
KeySymsRec tmpSyms,*pSyms;
CARD8 tmpMods[XkbMaxLegalKeyCode+1],*pMods;
char name[PATH_MAX],*rules;
-Bool ok;
+Bool ok=False;
XPointer config;
XkbComponentNamesRec cfgNames;
XkbRF_VarDefsRec defs;
@@ -689,29 +702,94 @@ XkbRF_VarDefsRec defs;
rules= XkbGetRulesDflts(&defs);
config= XkbDDXPreloadConfig(&rules,&defs,&cfgNames,dev);
+ /*
+ * The strings are duplicated because it is not guaranteed that
+ * they are allocated, or that they are allocated for every server
+ * generation. Eventually they will be freed at the end of this
+ * function.
+ */
+ if (names->keymap) names->keymap = _XkbDupString(names->keymap);
+ if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes);
+ if (names->types) names->types = _XkbDupString(names->types);
+ if (names->compat) names->compat = _XkbDupString(names->compat);
+ if (names->geometry) names->geometry = _XkbDupString(names->geometry);
+ if (names->symbols) names->symbols = _XkbDupString(names->symbols);
+
if (defs.model && defs.layout && rules) {
XkbComponentNamesRec rNames;
bzero(&rNames,sizeof(XkbComponentNamesRec));
if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) {
- if (rNames.keymap) names->keymap= rNames.keymap;
- if (rNames.keycodes) names->keycodes= rNames.keycodes;
- if (rNames.types) names->types= rNames.types;
- if (rNames.compat) names->compat= rNames.compat;
- if (rNames.symbols) names->symbols= rNames.symbols;
- if (rNames.geometry) names->geometry= rNames.geometry;
+ if (rNames.keymap) {
+ if (!names->keymap)
+ names->keymap = rNames.keymap;
+ else _XkbFree(rNames.keymap);
+ }
+ if (rNames.keycodes) {
+ if (!names->keycodes)
+ names->keycodes = rNames.keycodes;
+ else
+ _XkbFree(rNames.keycodes);
+ }
+ if (rNames.types) {
+ if (!names->types)
+ names->types = rNames.types;
+ else _XkbFree(rNames.types);
+ }
+ if (rNames.compat) {
+ if (!names->compat)
+ names->compat = rNames.compat;
+ else _XkbFree(rNames.compat);
+ }
+ if (rNames.symbols) {
+ if (!names->symbols)
+ names->symbols = rNames.symbols;
+ else _XkbFree(rNames.symbols);
+ }
+ if (rNames.geometry) {
+ if (!names->geometry)
+ names->geometry = rNames.geometry;
+ else _XkbFree(rNames.geometry);
+ }
XkbSetRulesUsed(&defs);
}
}
- if (cfgNames.keymap) names->keymap= cfgNames.keymap;
- if (cfgNames.keycodes) names->keycodes= cfgNames.keycodes;
- if (cfgNames.types) names->types= cfgNames.types;
- if (cfgNames.compat) names->compat= cfgNames.compat;
- if (cfgNames.symbols) names->symbols= cfgNames.symbols;
- if (cfgNames.geometry) names->geometry= cfgNames.geometry;
+ if (cfgNames.keymap){
+ if (names->keymap) _XkbFree(names->keymap);
+ names->keymap= cfgNames.keymap;
+ }
+ if (cfgNames.keycodes){
+ if (names->keycodes) _XkbFree(names->keycodes);
+ names->keycodes= cfgNames.keycodes;
+ }
+ if (cfgNames.types) {
+ if (names->types) _XkbFree(names->types);
+ names->types= cfgNames.types;
+ }
+ if (cfgNames.compat) {
+ if (names->compat) _XkbFree(names->compat);
+ names->compat= cfgNames.compat;
+ }
+ if (cfgNames.symbols){
+ if (names->symbols) _XkbFree(names->symbols);
+ names->symbols= cfgNames.symbols;
+ }
+ if (cfgNames.geometry) {
+ if (names->geometry) _XkbFree(names->geometry);
+ names->geometry= cfgNames.geometry;
+ }
- if ((XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
- &finfo,name,PATH_MAX))&&
- (finfo.xkb!=NULL)) {
+ if (names->keymap) {
+ XkbComponentNamesRec tmpNames;
+ bzero(&tmpNames,sizeof(XkbComponentNamesRec));
+ tmpNames.keymap = names->keymap;
+ ok = (Bool) XkbDDXLoadKeymapByNames(dev,&tmpNames,XkmAllIndicesMask,0,
+ &finfo,name,PATH_MAX);
+ }
+ if (!(ok && (finfo.xkb!=NULL)))
+ ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
+ &finfo,name,PATH_MAX);
+
+ if (ok && (finfo.xkb!=NULL)) {
XkbDescPtr xkb;
int minKC,maxKC;
@@ -758,6 +836,20 @@ XkbRF_VarDefsRec defs;
_XkbFree(pSyms->map);
pSyms->map= NULL;
}
+
+ if (names->keymap) _XkbFree(names->keymap);
+ names->keymap = NULL;
+ if (names->keycodes) _XkbFree(names->keycodes);
+ names->keycodes = NULL;
+ if (names->types) _XkbFree(names->types);
+ names->types = NULL;
+ if (names->compat) _XkbFree(names->compat);
+ names->compat = NULL;
+ if (names->geometry) _XkbFree(names->geometry);
+ names->geometry = NULL;
+ if (names->symbols) _XkbFree(names->symbols);
+ names->symbols = NULL;
+
return ok;
}
@@ -836,7 +928,7 @@ XkbFreeInfo(xkbi)
#endif
{
if (xkbi->radioGroups) {
- Xfree(xkbi->radioGroups);
+ _XkbFree(xkbi->radioGroups);
xkbi->radioGroups= NULL;
}
if (xkbi->mouseKeyTimer) {
@@ -868,7 +960,7 @@ XkbFreeInfo(xkbi)
XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,True);
xkbi->desc= NULL;
}
- Xfree(xkbi);
+ _XkbFree(xkbi);
return;
}
@@ -900,10 +992,37 @@ XkbProcessArguments(argc,argv,i)
noXkbExtension= False;
return 1;
}
+ else if (strncmp(argv[i], "-xkbdir", 7) == 0) {
+ if(++i < argc) {
+#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__)
+ if (getuid() != geteuid()) {
+ ErrorF("-xkbdir is not available for setuid X servers\n");
+ return -1;
+ } else
+#endif
+ {
+ if (strlen(argv[i]) < PATH_MAX) {
+ XkbBaseDirectory= argv[i];
+ return 2;
+ } else {
+ ErrorF("-xkbdir pathname too long\n");
+ return -1;
+ }
+ }
+ }
+ else {
+ return -1;
+ }
+ }
else if (strncmp(argv[i], "-xkbmap", 7) == 0) {
if(++i < argc) {
- XkbInitialMap= argv[i];
- return 2;
+ if (strlen(argv[i]) < PATH_MAX) {
+ XkbInitialMap= argv[i];
+ return 2;
+ } else {
+ ErrorF("-xkbmap pathname too long\n");
+ return -1;
+ }
}
else {
return -1;
@@ -911,8 +1030,13 @@ XkbProcessArguments(argc,argv,i)
}
else if (strncmp(argv[i], "-xkbdb", 7) == 0) {
if(++i < argc) {
- XkbDB= argv[i];
- return 2;
+ if (strlen(argv[i]) < PATH_MAX) {
+ XkbDB= argv[i];
+ return 2;
+ } else {
+ ErrorF("-xkbdb pathname too long\n");
+ return -1;
+ }
}
else {
return -1;
@@ -988,7 +1112,6 @@ XkbUseMsg()
ErrorF("-ar1 set XKB autorepeat delay\n");
ErrorF("-ar2 set XKB autorepeat interval\n");
ErrorF("-noloadxkb don't load XKB keymap description\n");
- ErrorF("-xkbcomp default keymap compiler\n");
ErrorF("-xkbdb file that contains default XKB keymaps\n");
ErrorF("-xkbmap XKB keyboard description to load on startup\n");
}
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index d3be89af7..33cf7bd9e 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -1,4 +1,4 @@
-/* $Xorg: xkbLEDs.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */
+/* $Xorg: xkbLEDs.c,v 1.4 2001/05/10 19:54:01 steve Exp $ */
/************************************************************
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbLEDs.c,v 3.6 2001/11/23 19:21:36 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -37,8 +38,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XI.h"
#include "XKBsrv.h"
-extern InputInfo inputInfo;
-
/***====================================================================***/
/*
@@ -240,11 +239,10 @@ unsigned side_affected;
XkbUpdateLedAutoState(dev,sli,side_affected,&ed,&changes,cause);
affect|= side_affected;
}
- XkbSendNotification(dev,&changes,cause);
- if (ed.reason)
- XkbSendExtensionDeviceNotify(dev,cause->client,&ed);
if (changes.state_changes || changes.ctrls.enabled_ctrls_changes)
XkbUpdateAllDeviceIndicators(NULL,cause);
+
+ XkbFlushLedEvents(dev,dev,sli,&ed,&changes,cause);
return;
}
@@ -701,6 +699,14 @@ XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause)
XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState);
XkbSendNotification(kbd,changes,cause);
bzero((char *)changes,sizeof(XkbChangesRec));
+
+ if (XkbAX_NeedFeedback(kbd->key->xkbInfo->desc->ctrls, XkbAX_IndicatorFBMask)) {
+ if (sli->effectiveState)
+ /* it appears that the which parameter is not used */
+ XkbDDXAccessXBeep(dev, _BEEP_LED_ON, XkbAccessXFeedbackMask);
+ else
+ XkbDDXAccessXBeep(dev, _BEEP_LED_OFF, XkbAccessXFeedbackMask);
+ }
}
if (ed && (ed->reason)) {
if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask))
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index 907cc3ab5..84af5f2f8 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbPrKeyEv.c,v 3.8 2001/01/17 22:37:15 dawes Exp $ */
#include <stdio.h>
#include <math.h>
@@ -53,6 +54,7 @@ KeyClassPtr keyc = keybd->key;
XkbSrvInfoPtr xkbi;
int key;
XkbBehavior behavior;
+unsigned ndx;
xkbi= keyc->xkbInfo;
key= xE->u.u.detail;
@@ -106,34 +108,33 @@ XkbBehavior behavior;
}
break;
case XkbKB_RadioGroup:
- if ( xE->u.u.type == KeyRelease )
- return;
- else {
- unsigned ndx= (behavior.data&(~XkbKB_RGAllowNone));
- if ( ndx<xkbi->nRadioGroups ) {
- XkbRadioGroupPtr rg;
-
- rg = &xkbi->radioGroups[ndx];
- if ( rg->currentDown == xE->u.u.detail ) {
- if (behavior.data&XkbKB_RGAllowNone) {
- xE->u.u.type = KeyRelease;
- XkbHandleActions(keybd,keybd,xE,count);
- rg->currentDown= 0;
- }
- return;
- }
- if ( rg->currentDown!=0 ) {
- int key = xE->u.u.detail;
- xE->u.u.type= KeyRelease;
- xE->u.u.detail= rg->currentDown;
+ ndx= (behavior.data&(~XkbKB_RGAllowNone));
+ if ( ndx<xkbi->nRadioGroups ) {
+ XkbRadioGroupPtr rg;
+
+ if ( xE->u.u.type == KeyRelease )
+ return;
+
+ rg = &xkbi->radioGroups[ndx];
+ if ( rg->currentDown == xE->u.u.detail ) {
+ if (behavior.data&XkbKB_RGAllowNone) {
+ xE->u.u.type = KeyRelease;
XkbHandleActions(keybd,keybd,xE,count);
- xE->u.u.type= KeyPress;
- xE->u.u.detail= key;
- }
- rg->currentDown= key;
+ rg->currentDown= 0;
+ }
+ return;
}
- else ErrorF("InternalError! Illegal radio group %d\n",ndx);
+ if ( rg->currentDown!=0 ) {
+ int key = xE->u.u.detail;
+ xE->u.u.type= KeyRelease;
+ xE->u.u.detail= rg->currentDown;
+ XkbHandleActions(keybd,keybd,xE,count);
+ xE->u.u.type= KeyPress;
+ xE->u.u.detail= key;
+ }
+ rg->currentDown= key;
}
+ else ErrorF("InternalError! Illegal radio group %d\n",ndx);
break;
case XkbKB_Overlay1: case XkbKB_Overlay2:
{
@@ -154,7 +155,11 @@ XkbBehavior behavior;
break;
default:
ErrorF("unknown key behavior 0x%04x\n",behavior.type);
+#if defined(MetroLink)
+ return;
+#else
break;
+#endif
}
}
XkbHandleActions(keybd,keybd,xE,count);
diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c
index c9df88f7f..6a5bee3b9 100644
--- a/xkb/xkbSwap.c
+++ b/xkb/xkbSwap.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbSwap.c,v 3.2 2001/08/23 14:33:26 alanh Exp $ */
#include "stdio.h"
#include "X.h"
@@ -111,7 +112,7 @@ register int n;
swaps(&stuff->selectAll,n);
swaps(&stuff->affectMap,n);
swaps(&stuff->map,n);
- if (stuff->affectWhich&(~XkbMapNotifyMask)!=0) {
+ if ((stuff->affectWhich&(~XkbMapNotifyMask))!=0) {
union {
BOOL *b;
CARD8 *c8;
@@ -158,8 +159,8 @@ register int n;
swaps(&from.c16[1],n);
}
else if (size==4) {
- swapl(from.c32[0],n);
- swapl(from.c32[1],n);
+ swapl(&from.c32[0],n);
+ swapl(&from.c32[1],n);
}
else {
size= 2;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 05a817ba3..7d81d0169 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbUtils.c,v 3.13 2001/08/23 14:33:26 alanh Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -362,7 +363,7 @@ register unsigned key;
XkbApplyCompatMapToKey(xkb,key,changes);
}
- if (changes->map.changed&XkbVirtualModMapMask|XkbModifierMapMask) {
+ if (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask)) {
unsigned char newVMods[XkbNumVirtualMods];
register unsigned bit,i;
unsigned present;
@@ -550,15 +551,15 @@ CARD8 keysPerMod[XkbNumModifiers];
if (maxKeysPerMod>0) {
tmp= maxKeysPerMod*XkbNumModifiers;
if (keyc->modifierKeyMap==NULL)
- keyc->modifierKeyMap= (KeyCode *)Xcalloc(tmp);
+ keyc->modifierKeyMap= (KeyCode *)_XkbCalloc(1, tmp);
else if (keyc->maxKeysPerModifier<maxKeysPerMod)
- keyc->modifierKeyMap= (KeyCode *)Xrealloc(keyc->modifierKeyMap,tmp);
+ keyc->modifierKeyMap= (KeyCode *)_XkbRealloc(keyc->modifierKeyMap,tmp);
if (keyc->modifierKeyMap==NULL)
FatalError("Couldn't allocate modifierKeyMap in UpdateCore\n");
bzero(keyc->modifierKeyMap,tmp);
}
else if ((keyc->maxKeysPerModifier>0)&&(keyc->modifierKeyMap!=NULL)) {
- Xfree(keyc->modifierKeyMap);
+ _XkbFree(keyc->modifierKeyMap);
keyc->modifierKeyMap= NULL;
}
keyc->maxKeysPerModifier= maxKeysPerMod;
@@ -854,22 +855,22 @@ XkbComputeDerivedState(xkbi)
{
XkbStatePtr state= &xkbi->state;
XkbControlsPtr ctrls= xkbi->desc->ctrls;
-unsigned grp;
+char grp;
state->mods= (state->base_mods|state->latched_mods);
state->mods|= state->locked_mods;
state->lookup_mods= state->mods&(~ctrls->internal.mask);
state->grab_mods= state->lookup_mods&(~ctrls->ignore_lock.mask);
state->grab_mods|=
- (state->base_mods|state->latched_mods&ctrls->ignore_lock.mask);
+ ((state->base_mods|state->latched_mods)&ctrls->ignore_lock.mask);
grp= state->locked_group;
- if (grp>=ctrls->num_groups)
+ if ((grp>=ctrls->num_groups) || (grp<0))
state->locked_group= XkbAdjustGroup(grp,ctrls);
grp= state->locked_group+state->base_group+state->latched_group;
- if (grp>=ctrls->num_groups)
+ if ((grp>=ctrls->num_groups) || (grp<0))
state->group= XkbAdjustGroup(grp,ctrls);
else state->group= grp;
XkbComputeCompatState(xkbi);
@@ -1137,5 +1138,3 @@ XkbConvertCase(sym, lower, upper)
break;
}
}
-
-
diff --git a/xkb/xkbconfig.c b/xkb/xkbconfig.c
index d2e67945e..c94b06feb 100644
--- a/xkb/xkbconfig.c
+++ b/xkb/xkbconfig.c
@@ -24,12 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkbconfig.c,v 3.7 2001/11/30 12:11:51 eich Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include <X11/Xfuncs.h>
@@ -274,6 +273,7 @@ int ch;
#define _XkbCF_InternalMods 35
#define _XkbCF_GroupsWrap 36
+#define _XkbCF_InitialFeedback 37
static Bool
#if NeedFunctionPrototypes
@@ -343,6 +343,10 @@ AddAXTimeoutOptByName(rtrn,name,opts_rtrn)
*opts_rtrn= XkbAX_IndicatorFBMask;
else if (_XkbStrCaseCmp(name,"stickykeys")==0)
*opts_rtrn= XkbAX_StickyKeysFBMask;
+ else if (_XkbStrCaseCmp(name,"twokeys")==0)
+ *opts_rtrn= XkbAX_TwoKeysMask;
+ else if (_XkbStrCaseCmp(name,"latchtolock")==0)
+ *opts_rtrn= XkbAX_LatchToLockMask;
else if (_XkbStrCaseCmp(name,"slowkeysrelease")==0)
*opts_rtrn= XkbAX_SKReleaseFBMask;
else if (_XkbStrCaseCmp(name,"slowkeysreject")==0)
@@ -524,9 +528,9 @@ int tok;
XkbCFScanResultRec val;
char ** str;
int merge;
-unsigned long * ctrls;
-unsigned short * opts;
-int * pival;
+unsigned long * ctrls, ctrls_mask;
+unsigned short * opts, opts_mask;
+int * pival, sign;
int onoff;
XkbConfigUnboundModPtr last;
unsigned what;
@@ -611,7 +615,6 @@ unsigned what;
break;
case _XkbCF_InitialCtrls:
rtrn->defined|= XkbCF_InitialCtrls;
- opts= NULL;
ctrls= NULL;
if (tok==XkbCF_PlusEquals)
ctrls= &rtrn->initial_ctrls;
@@ -636,9 +639,10 @@ unsigned what;
rtrn->error= XkbCF_ExpectedControl;
return False;
}
- if (!AddCtrlByName(rtrn,val.str,ctrls)) {
+ if (!AddCtrlByName(rtrn,val.str,&ctrls_mask)) {
return False;
}
+ *ctrls |= ctrls_mask;
tok= XkbCFScan(file,&val,rtrn);
if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) {
if (tok!=XkbCF_Plus) {
@@ -651,18 +655,6 @@ unsigned what;
break;
case _XkbCF_AccessXTimeoutCtrlsOn:
case _XkbCF_AccessXTimeoutCtrlsOff:
- case _XkbCF_AccessXTimeoutOptsOff:
- case _XkbCF_AccessXTimeoutOptsOn:
- if (field->field_id==_XkbCF_AccessXTimeoutOptsOff)
- field->field_id= _XkbCF_AccessXTimeoutCtrlsOff;
- else if (field->field_id==_XkbCF_AccessXTimeoutCtrlsOn)
- field->field_id= _XkbCF_AccessXTimeoutCtrlsOn;
-
- if (field->field_id==_XkbCF_AccessXTimeoutCtrlsOff)
- rtrn->defined|= XkbCF_AccessXTimeoutCtrlsOff;
- else if (field->field_id==_XkbCF_AccessXTimeoutCtrlsOn)
- rtrn->defined|= XkbCF_AccessXTimeoutCtrlsOn;
-
opts= NULL;
if (tok==XkbCF_MinusEquals) {
ctrls= &rtrn->axt_ctrls_ignore;
@@ -697,9 +689,10 @@ unsigned what;
rtrn->error= XkbCF_ExpectedControl;
return False;
}
- if (!AddCtrlByName(rtrn,val.str,ctrls)) {
- if (!AddAXTimeoutOptByName(rtrn,val.str,opts))
+ if (!AddCtrlByName(rtrn,val.str,&ctrls_mask)) {
+ if (!AddAXTimeoutOptByName(rtrn,val.str,&opts_mask))
return False;
+ *opts |= opts_mask;
if (field->field_id==_XkbCF_AccessXTimeoutCtrlsOff) {
rtrn->defined|= XkbCF_AccessXTimeoutOptsOff;
if (rtrn->replace_axt_ctrls_off)
@@ -711,6 +704,94 @@ unsigned what;
rtrn->replace_axt_opts_on= True;
}
}
+ else
+ *ctrls |= ctrls_mask;
+ tok= XkbCFScan(file,&val,rtrn);
+ if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) {
+ if (tok!=XkbCF_Plus) {
+ rtrn->error= XkbCF_ExpectedOperator;
+ return False;
+ }
+ tok= XkbCFScan(file,&val,rtrn);
+ }
+ }
+ break;
+ case _XkbCF_InitialFeedback:
+ rtrn->defined|= XkbCF_InitialOpts;
+ opts= NULL;
+ if (tok==XkbCF_PlusEquals)
+ opts= &rtrn->initial_opts;
+ else if (tok==XkbCF_MinusEquals)
+ opts= &rtrn->initial_opts_clear;
+ else if (tok==XkbCF_Equals) {
+ opts= &rtrn->initial_opts;
+ rtrn->replace_initial_opts= True;
+ *opts= 0;
+ }
+ else {
+ rtrn->error= XkbCF_MissingEquals;
+ goto BAILOUT;
+ }
+ tok= XkbCFScan(file,&val,rtrn);
+ if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) {
+ rtrn->error= XkbCF_ExpectedAXOption;
+ return False;
+ }
+ while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) {
+ if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) {
+ rtrn->error= XkbCF_ExpectedAXOption;
+ return False;
+ }
+ if (!AddAXTimeoutOptByName(rtrn,val.str,&opts_mask)) {
+ return False;
+ }
+ *opts |= opts_mask;
+ tok= XkbCFScan(file,&val,rtrn);
+ if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) {
+ if (tok!=XkbCF_Plus) {
+ rtrn->error= XkbCF_ExpectedOperator;
+ return False;
+ }
+ tok= XkbCFScan(file,&val,rtrn);
+ }
+ }
+ break;
+ case _XkbCF_AccessXTimeoutOptsOff:
+ case _XkbCF_AccessXTimeoutOptsOn:
+ opts= NULL;
+ if (tok==XkbCF_MinusEquals)
+ opts= &rtrn->axt_opts_ignore;
+ else if ((tok==XkbCF_PlusEquals)||(tok==XkbCF_Equals)) {
+ if (field->field_id==_XkbCF_AccessXTimeoutOptsOff) {
+ opts= &rtrn->axt_opts_off;
+ if (tok==XkbCF_Equals)
+ rtrn->replace_axt_opts_off= True;
+ }
+ else {
+ opts= &rtrn->axt_opts_on;
+ if (tok==XkbCF_Equals)
+ rtrn->replace_axt_opts_on= True;
+ }
+ *opts = 0;
+ }
+ else {
+ rtrn->error= XkbCF_MissingEquals;
+ goto BAILOUT;
+ }
+ tok= XkbCFScan(file,&val,rtrn);
+ if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) {
+ rtrn->error= XkbCF_ExpectedControl;
+ return False;
+ }
+ while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) {
+ if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) {
+ rtrn->error= XkbCF_ExpectedControl;
+ return False;
+ }
+ if (!AddAXTimeoutOptByName(rtrn,val.str,&opts_mask))
+ return False;
+ *opts |= opts_mask;
+
tok= XkbCFScan(file,&val,rtrn);
if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) {
if (tok!=XkbCF_Plus) {
@@ -772,6 +853,13 @@ unsigned what;
goto BAILOUT;
}
tok= XkbCFScan(file,&val,rtrn);
+ if (tok == XkbCF_Minus && field->field_id == _XkbCF_MouseKeysCurve) {
+ /* This can be a negative value */
+ tok = XkbCFScan(file,&val,rtrn);
+ sign = -1;
+ }
+ else
+ sign = 1;
if (tok!=XkbCF_Integer) {
Bool ok= False;
if ((onoff)&&(tok==XkbCF_Ident)&&(val.str!=NULL)) {
@@ -789,8 +877,9 @@ unsigned what;
goto BAILOUT;
}
}
- *pival= val.ival;
- rtrn->defined|= XkbCF_AccessXTimeout;
+ *pival= val.ival * sign;
+ if (field->field_id == _XkbCF_AccessXTimeout)
+ rtrn->defined|=XkbCF_AccessXTimeout;
tok= XkbCFScan(file,&val,rtrn);
if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) {
rtrn->error= XkbCF_ExpectedEOS;
@@ -986,7 +1075,7 @@ unsigned int mask;
ctrls->mk_max_speed= rtrn->mk_max_speed;
if (rtrn->mk_curve>0)
ctrls->mk_curve= rtrn->mk_curve;
- if (rtrn->defined&XkbCF_AccessXTimeout)
+ if (rtrn->defined&XkbCF_AccessXTimeout && rtrn->ax_timeout > 0)
ctrls->ax_timeout= rtrn->ax_timeout;
/* any value set to both off and on is reset to ignore */
@@ -1120,13 +1209,18 @@ static XkbConfigFieldRec _XkbCFDfltFields[] = {
{ "axtctrlson", _XkbCF_AccessXTimeoutCtrlsOn },
{ "accessxtimeoutctrlsoff",_XkbCF_AccessXTimeoutCtrlsOff },
{ "axtctrlsoff",_XkbCF_AccessXTimeoutCtrlsOff },
+ { "accessxtimeoutfeedbackon", _XkbCF_AccessXTimeoutOptsOn },
+ { "axtfeedbackon", _XkbCF_AccessXTimeoutOptsOn },
+ { "accessxtimeoutfeedbackoff", _XkbCF_AccessXTimeoutOptsOff },
+ { "axtfeedbackoff", _XkbCF_AccessXTimeoutOptsOff },
{ "ignorelockmods",_XkbCF_IgnoreLockMods },
{ "ignorelockmodifiers",_XkbCF_IgnoreLockMods },
{ "ignoregrouplock",_XkbCF_IgnoreGroupLock },
{ "internalmods",_XkbCF_InternalMods },
{ "internalmodifiers",_XkbCF_InternalMods },
{ "outofrangegroups",_XkbCF_GroupsWrap },
- { "groups", _XkbCF_GroupsWrap }
+ { "groups", _XkbCF_GroupsWrap },
+ { "feedback", _XkbCF_InitialFeedback },
};
#define _XkbCFNumDfltFields (sizeof(_XkbCFDfltFields)/sizeof(XkbConfigFieldRec))
@@ -1344,6 +1438,7 @@ BAILOUT:
return False;
}
+/*ARGSUSED*/
void
#if NeedFunctionPrototypes
XkbCFReportError(FILE *file,char *name,int error,int line)
@@ -1387,8 +1482,14 @@ char * msg;
default:
msg= "unknown error on line %d"; break;
}
+#ifndef XKB_IN_SERVER
fprintf(file,msg,line);
if (name) fprintf(file," of %s\n",name);
else fprintf(file,"\n");
+#else
+ ErrorF(msg,line);
+ if (name) ErrorF(" of %s\n",name);
+ else ErrorF("\n");
+#endif
return;
}
diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c
index 41df420b8..d12467ff7 100644
--- a/xkb/xkberrs.c
+++ b/xkb/xkberrs.c
@@ -24,15 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkberrs.c,v 3.5 2002/11/08 13:35:43 alanh Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
-#include <X11/Xlib.h>
-#include <X11/XKBlib.h>
-#include <X11/extensions/XKBfile.h>
char * _XkbErrMessages[] = {
"success", /* _XkbSuccess */
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index d07a704c3..8246390be 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -24,14 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkbmisc.c,v 1.4 2002/12/20 20:18:35 paulo Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
-
-#define XK_CYRILLIC
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
@@ -70,19 +67,78 @@ _XkbKSCheckCase(ks)
#endif
{
unsigned set,rtrn;
-unsigned char ch;
- set= (ks & (~0xff));
- ch= (char)(ks&0xff);
+ set= (ks & (~0xff)) >> 8;
rtrn= 0;
switch (set) {
case 0: /* latin 1 */
- if (((ch>=XK_A)&&(ch<=XK_Z))||
- ((ch>=XK_Agrave)&&(ch<=XK_THORN)&&(ch!=XK_multiply))) {
+ if (((ks>=XK_A)&&(ks<=XK_Z))||
+ ((ks>=XK_Agrave)&&(ks<=XK_THORN)&&(ks!=XK_multiply))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_a)&&(ks<=XK_z))||
+ ((ks>=XK_agrave)&&(ks<=XK_ydiaeresis))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 1: /* latin 2 */
+ if (((ks>=XK_Aogonek)&&(ks<=XK_Zabovedot)&&(ks!=XK_breve))||
+ ((ks>=XK_Racute)&&(ks<=XK_Tcedilla))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_aogonek)&&(ks<=XK_zabovedot)&&(ks!=XK_caron))||
+ ((ks>=XK_racute)&&(ks<=XK_tcedilla))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 2: /* latin 3 */
+ if (((ks>=XK_Hstroke)&&(ks<=XK_Jcircumflex))||
+ ((ks>=XK_Cabovedot)&&(ks<=XK_Scircumflex))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_hstroke)&&(ks<=XK_jcircumflex))||
+ ((ks>=XK_cabovedot)&&(ks<=XK_scircumflex))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 3: /* latin 4 */
+ if (((ks>=XK_Rcedilla)&&(ks<=XK_Tslash))||
+ (ks==XK_ENG)||
+ ((ks>=XK_Amacron)&&(ks<=XK_Umacron))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if (((ks>=XK_rcedilla)&&(ks<=XK_tslash))||
+ (ks==XK_eng)||
+ ((ks>=XK_amacron)&&(ks<=XK_umacron))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 18: /* latin 8 */
+ if ((ks==XK_Babovedot)||
+ ((ks>=XK_Dabovedot)&&(ks<=XK_Wacute))||
+ ((ks>=XK_Ygrave)&&(ks<=XK_Fabovedot))||
+ (ks==XK_Mabovedot)||
+ (ks==XK_Pabovedot)||
+ (ks==XK_Sabovedot)||
+ (ks==XK_Wdiaeresis)||
+ ((ks>=XK_Wcircumflex)&&(ks<=XK_Ycircumflex))) {
+ rtrn|= _XkbKSUpper;
+ }
+ if ((ks==XK_babovedot)||
+ (ks==XK_dabovedot)||
+ (ks==XK_fabovedot)||
+ (ks==XK_mabovedot)||
+ ((ks>=XK_wgrave)&&(ks<=XK_wacute))||
+ (ks==XK_ygrave)||
+ ((ks>=XK_wdiaeresis)&&(ks<=XK_ycircumflex))) {
+ rtrn|= _XkbKSLower;
+ }
+ break;
+ case 19: /* latin 9 */
+ if ((ks==XK_OE)||(ks==XK_Ydiaeresis)) {
rtrn|= _XkbKSUpper;
}
- if (((ch>=XK_a)&&(ch<=XK_z))||
- ((ch>=XK_agrave)&&(ch<=XK_ydiaeresis))) {
+ if (ks==XK_oe) {
rtrn|= _XkbKSLower;
}
break;
diff --git a/xkb/xkbout.c b/xkb/xkbout.c
index 845325358..fd7603b03 100644
--- a/xkb/xkbout.c
+++ b/xkb/xkbout.c
@@ -24,12 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkbout.c,v 3.9 2001/10/28 03:32:47 tsi Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include <X11/Xfuncs.h>
#ifndef XKB_IN_SERVER
@@ -849,7 +848,7 @@ WriteXKBSection(file,dpy,s,geom)
{
register int i;
XkbRowPtr row;
-int dfltKeyColor;
+int dfltKeyColor = 0;
fprintf(file," section \"%s\" {\n",
XkbAtomText(dpy,s->name,XkbXKBFile));
@@ -1100,6 +1099,7 @@ XkbDescPtr xkb;
xkb= result->xkb;
fprintf(file,"xkb_layout {\n");
ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv);
+ ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv);
ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv);
if (xkb->geom)
ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv);
@@ -1157,7 +1157,7 @@ XkbWriteXKBFile(out,result,showImplicit,addOn,priv)
void * priv;
#endif
{
-Bool ok;
+Bool ok = False;
Bool (*func)(
#if NeedFunctionPrototypes
FILE * /* file */,
@@ -1167,7 +1167,7 @@ Bool (*func)(
XkbFileAddOnFunc /* addOn */,
void * /* priv */
#endif
-);
+) = NULL;
switch (result->type) {
case XkmSemanticsFile:
@@ -1205,12 +1205,8 @@ Bool (*func)(
_XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0);
ok= False;
}
- else {
+ else if (func) {
ok= (*func)(out,result,True,showImplicit,addOn,priv);
}
- if (!ok) {
- return False;
- }
- return True;
+ return ok;
}
-
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 18c07a18a..d233af0b4 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -24,12 +24,11 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkbtext.c,v 3.11 2002/12/21 18:49:02 paulo Exp $ */
#include <stdio.h>
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include <X11/Xos.h>
@@ -403,7 +402,7 @@ static char buf[32],*rtrn;
if (sym==NoSymbol)
strcpy(rtrn=buf,"NoSymbol");
else if ((rtrn=XKeysymToString(sym))==NULL)
- sprintf(rtrn=buf,"0x%x",sym);
+ sprintf(rtrn=buf, "0x%lx", (long)sym);
else if (format==XkbCFile) {
sprintf(buf,"XK_%s",rtrn);
rtrn= buf;
@@ -412,7 +411,7 @@ static char buf[32],*rtrn;
#else /* def XKB_IN_SERVER */
if (sym==NoSymbol)
strcpy(rtrn=buf,"NoSymbol");
- else sprintf(rtrn=buf,"0x%x",sym);
+ else sprintf(rtrn=buf, "0x%lx", (long)sym);
return rtrn;
#endif /* XKB_IN_SERVER */
}
@@ -589,7 +588,7 @@ int len,plen,slen;
if ((detail&XkbAllNewKeyboardEventsMask)==0) {
- char * tmp;
+ char *tmp = "";
if (format==XkbCFile) tmp= "0";
else if (format==XkbMessage) tmp= "none";
buf= tbGetBuffer(strlen(tmp)+1);
@@ -874,7 +873,7 @@ char *rtrn;
}
return rtrn;
}
- sprintf(buf,"0x%x",type);
+ sprintf(buf,"Private");
return buf;
}
@@ -1500,7 +1499,7 @@ int sz;
if (format==XkbCFile) {
sprintf(buf,
- "{ %20s, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x }",
+ "{ %20s, { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x } }",
XkbActionTypeText(action->type,XkbCFile),
action->any.data[0],action->any.data[1],action->any.data[2],
action->any.data[3],action->any.data[4],action->any.data[5],
@@ -1543,7 +1542,7 @@ char buf[256],*tmp;
permanent=((behavior->type&XkbKB_Permanent)!=0);
if (type==XkbKB_Lock) {
- sprintf(buf,"lock= %s,",(permanent?"Permanent":"True"));
+ sprintf(buf,"lock= %s",(permanent?"Permanent":"True"));
}
else if (type==XkbKB_RadioGroup) {
int g;
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index 7a4a2b429..af6cc3eba 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/xkbfile/xkmread.c,v 1.6 2002/02/13 22:09:42 herrb Exp $ */
#include <stdio.h>
@@ -32,9 +33,7 @@
#ifndef XKB_IN_SERVER
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include <X11/Xlib.h>
#include <X11/keysym.h>
@@ -172,7 +171,7 @@ XkmGetCARD32(file,pNRead)
int * pNRead;
#endif
{
-unsigned long val;
+CARD32 val;
if ((fread(&val,4,1,file)==1)&&(pNRead))
(*pNRead)+= 4;
@@ -797,13 +796,13 @@ XkbDescPtr xkb;
xkb->server->explicit[i]|= XkbExplicitAutoRepeatMask;
}
xkb->map->modmap[i]= wireMap.modifier_map;
- if (wireMap.num_groups>0) {
+ if (XkbNumGroups(wireMap.num_groups)>0) {
KeySym *sym;
int nSyms;
- if (wireMap.num_groups>xkb->ctrls->num_groups)
+ if (XkbNumGroups(wireMap.num_groups)>xkb->ctrls->num_groups)
xkb->ctrls->num_groups= wireMap.num_groups;
- nSyms= wireMap.num_groups*wireMap.width;
+ nSyms= XkbNumGroups(wireMap.num_groups)*wireMap.width;
sym= XkbResizeKeySyms(xkb,i,nSyms);
if (!sym)
return -1;
@@ -820,7 +819,7 @@ XkbDescPtr xkb;
xkb->server->explicit[i]|= XkbExplicitInterpretMask;
}
}
- for (g=0;g<wireMap.num_groups;g++) {
+ for (g=0;g<XkbNumGroups(wireMap.num_groups);g++) {
if (((xkb->server->explicit[i]&(1<<g))==0)||(type[g]==NULL)) {
KeySym *tmpSyms;
tmpSyms= XkbKeySymsPtr(xkb,i)+(wireMap.width*g);