summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86')
-rw-r--r--xc/programs/Xserver/hw/xfree86/CHANGELOG205
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile6
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h11
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h19
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c142
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Config.cpp13
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/compiler.h80
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Config.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Configure.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Events.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Helper.c50
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Init.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Mode.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Module.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86fbman.c57
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DRI117
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp8
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.fonts26
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml59
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml2
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml6
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent12
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml31
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre4
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile49
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h71
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c227
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c1170
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h88
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h44
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c43
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c42
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c50
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c76
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c34
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h51
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c62
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c16
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c18
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c55
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h11
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c33
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm352
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c77
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c211
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c61
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c24
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c113
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c17
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c211
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES38
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h21
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c96
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c159
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h10
-rwxr-xr-xxc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c250
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/CALLMAP22
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile60
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README74
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt126
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h207
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp187
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h307
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c932
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c99
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c301
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c2996
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c375
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c104
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c205
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c1822
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h81
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c55
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h57
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c40
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c48
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c126
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c48
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h1
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c140
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c53
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c62
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/dummylib/Imakefile9
-rw-r--r--xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def7
-rw-r--r--xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h10
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/citron/citron.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c154
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/generic.c34
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/helper_exec.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/helper_mem.c25
-rw-r--r--xc/programs/Xserver/hw/xfree86/int10/xf86int10.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/coffloader.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/dixsym.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/elfloader.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loader.c23
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loader.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h10
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/loadmod.c21
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/xf86sym.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c11
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile12
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c47
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c22
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c103
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c12
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h7
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Monitor.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Screen.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/Video.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/read.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/write.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaa.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86Version.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86config/Cards90
184 files changed, 12489 insertions, 1537 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG
index ce5a91c17..9a99365a8 100644
--- a/xc/programs/Xserver/hw/xfree86/CHANGELOG
+++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG
@@ -1,3 +1,204 @@
+XFree86 4.0.1g (29 November 2000)
+1023. Fix small bug in lcGeneric.c (#4301, Ivan Pascal).
+1022. Rewrite Xft library for Render extension/core text and font management
+ Change xterm to use new interface (Keith Packard).
+1021. s3virge driver updates, including Xv fixes for the ViRGE DX, disable
+ GX2 color expansion until it's stable, GX2 Xv code (not enabled or
+ working yet) (#4299, Kevin Brosius).
+1020. Siliconmotion driver (#4298, Frido Garritsen, Silicon Motion, Inc.).
+1019. Fix Estonian_Estonia.1257 entry in locale.alias (#4297, 4300,
+ Nerijus Baliunas).
+1018. New Lithuanian XKB map (#4296, Nerijus Baliunas).
+1017. Fix a problem with the "xtt" font module introduced with recent
+ changes to the "freetype" module (#4295, ISHIKAWA Mutsumi).
+1016. Fix the return value for the "indirect" converter in Xlib (#4294,
+ Bruno Haible).
+1015. ANSI C cleanup of Xlib locale core code (#4293, Bruno Haible).
+1014. Optimize the i18n support for parsing resource files for the unibyte
+ locales, and clean up pre-ANSI-C-isms and warnings (#4292, Bruno Haible).
+1013. Enhance the CompoundText <-> UTF-8 converter so that it understands
+ the BIG5 encoding scheme used by Emacs (#4291, Bruno Haible).
+1012. Fix documentation and implementation of _XlcCompareISOLatin1 and
+ _XlcNCompareISOLatin1 (#4290, Bruno Haible).
+1011. Add new Unicode-based APIs for internationalized text for Xlib (#4289,
+ Bruno Haible).
+1010. Fix a minor Mesa lighting bug (#4288, Brian Paul).
+1009. Fix the glide driver's resolution of symbols from the glide library
+ (#4281, Pontus Lidman).
+1008. Fix X server stalling forever with local font servers on Linux 2.4
+ kernels (#4280, Branden Robinson).
+1007. Improve temp file handling in the Xaw library (#4279, Branden Robinson).
+1006. Add support for Rage 128 RG (#4277, Michael Mattice).
+1005. Modify XimGetCharCode() to use conversion from keysym to UCS and then
+ from UCS to the appropriate charset specified in the locale description
+ (#4276, Ivan Pascal).
+1004. Allow Unicode fonts to be used as UTF-8 locale native fonts (#4275,
+ Ivan Pascal).
+1003. Fix abnt2/br XKB config (#4274, Paulo Cesar Pereira de Andrade).
+1002. Let the Darwin X server build on pure Darwin as well as Mac OS X systems
+ (#4273, Torrey T. Lyons).
+1001. Patch to allow xdm to build on Darwin (#4273, Torrey T. Lyons).
+1000. Fix parser not dup'ing a string (#4272, Paulo Cesar Pereira de Andrade).
+ 999. Improve direct fifo writes for the glint/permedia3 pixmapwrite hook
+ when using FIFO disconnect (#4271, Sven Luther).
+ 998. Fix a sprite problem with the "xwin" server (#4269, Suhaib M. Siddiqi).
+ 997. Fix a confusing local typedef for "wchar_t' in xc/lib/X11/lcUTF8.c
+ (#4268, Bruno Haible).
+ 996. Allow ProjectVar to override "/var" when set (based on #4266,
+ Bruno Haible).
+ 995. Rework Trident Blade/CyberBlade acceleration (Alan Hourihane).
+ 994. Make the CyberBlade/e4 (aka 9540) work (Alan Hourihane).
+ 993. Updates to Big5 encodings for the TrueType font backends (#4265,
+ Jacky Bryant).
+ 992. Fixes for Thai (th_TH) locale support in Xlib (#4264,
+ Theppitak Karoonboonyanan)
+ 991. Fix a segv in Xnest caused by overflowing the pixmap formats array
+ (based on #4262, Matthieu Herrb).
+ 990. Fix an xdm problem that prevents the chooser from working (#4261,
+ Matthieu Herrb).
+ 989. Update the Cards file (#4260, Paulo Cesar Pereira de Andrade).
+ 988. Update Macedonian xkb symbols, and add mk_MK.utf8 to locale.alias
+ (#4258, 4259, Damjan Georgievski).
+ 987. Safe tempfile handline for imake's probing of glibc version (based on
+ #4257, Colin Phipps).
+ 986. Fix typo in dvorak xkb symbols file, plus white space cleanup (#4256,
+ Branden Robinson).
+ 985. Fix typo in server startup message (#4255, Branden Robinson).
+ 984. Make XOpenDisplay() bail out if the server claims that its vendor
+ string is > 256 in length (#4254).
+ 983. Add some useful default key bindings for the xdm login widget (#4252,
+ Branden Robinson).
+ 982. Change the default xdm Xaccess file to not allow any connections
+ (#4252, Branden Robinson).
+ 981. Set the default glyph caching mode to "CACHE_16_BIT_GLYPHS"
+ (#4251, Branden Robinson).
+ 980. Make the X server use the XAUTHORITY environment variable (if set)
+ when the -authfile command line flag isn't given (#4250,
+ Branden Robinson).
+ 979. Add Debian-specific settings to linux.cf (#4249, Branden Robinson).
+ 978. Rename Trident Cyber9540 to CyberBlade/e4 and make appropriate
+ changes in driver (Alan Hourihane).
+ 977. Fix Trident Cyber series to only detect SDRAM (Alan Hourihane).
+ 976. Make xf86SoundKbdBell() available to modules (for citron driver)
+ (Marc La France, #4270, Frederic Lepied).
+ 975. Fix glide driver's check for glide library presence (Marc La France).
+ 974. Add missing symbol references in r128 and s3virge drivers
+ (Marc La France).
+ 973. Fix int10 debugging and reading in all segments between 0x0C0000 and
+ 0x0F0000 (Marc La France).
+ 972. Fix typo in imake.c (Marc La France).
+ 971. Turn off SGRAM optimization for Trident Blade chips, causes some
+ problems. (Alan Hourihane).
+ 970. Ignore various ".stab.*" sections for Solaris (Marc La France).
+ 969. Fix ENXIO errors on Linux BIOS retrievals by removing restriction on
+ several OSes that xf86ReadBIOS()'s Base be page-aligned (Marc La France).
+ 968. Disable change 873. It causes device/monitor mismatches
+ (Marc La France).
+ 967. Change linux/int10 to intercept signals generated by the vm86() syscall
+ rather than killing the server (Marc La France).
+ 966. Reinstate DG/UX mmap() bug work-around in int10 (Marc La France).
+ 965. Rage128 and Radeon fix for -configure (Marc La France).
+ 964. Fix int10 woes with retrieving PCI BIOSes (Marc La France).
+ 963. Allow modules to intercept signals that would otherwise kill the server
+ (Marc La France).
+ 962. Fix static Xvfb server build (Marc La France).
+ 961. Some warning fixes (Marc La France).
+ 960. Rage128 and Radeon #include changes to reduce recompilations
+ (Marc La France).
+ 959. Modify item no. 949 - only reset clipping for Cyber9382, Cyber9385 and
+ ProVidia9682 (Alan Hourihane).
+ 958. Added messages about modes rejected on lookup (Egbert Eich).
+ 957. Attempt to fix DDC1 support on Neomagic (Egbert Eich).
+ 956. Added Block/UnblockSIGIO() to DDC1 readout code (Egbert Eich).
+ 955. Enabled virtual depth for a second head on a G400 multihead
+ (this needs to be looked at) (Egbert Eich).
+ 954. Added code to check if the PictureScreen structure was initialized
+ before referencing it (Egbert Eich).
+ 953. Modified xf86UDelay() to use Block/UnblockSIGIO and usleep()
+ instead of gettimeofday() (Egbert Eich).
+ 952. Modified xf86MatchPciInstances() to allow for chipset overrides
+ even when called with no separate vendorID (Egbert Eich).
+ 951. Changed Xvfb to use fb instead of cfb (Egbert Eich).
+ 950. Moved a misplaced xfree() in the generic driver. Now more than
+ one chipset can use this driver in a multihead setup (Egbert Eich).
+ 949. Did some fixes for the Trident driver ie. fixed a LCD modeline,
+ reset clipping register on all non 3D chips (Egbert Eich).
+ 948. Added missing parts for AXP support to lnx_video.c (Egbert Eich).
+ 947. Added bsr/bsf to x86emu (Jeff Wiedemeier).
+
+XFree86 4.0.1f (16 November 2000)
+ 946. Add a dumpkeymap utility for Darwin (#4248, Eric Sunshine).
+ 945. Fix a Darwin build problem with mkcfm, and get xdm closer to building
+ (#4247, Torrey T. Lyons).
+ 944. DDX for the Xdarwin server (#4246, Torrey T. Lyons).
+ 943. Enable xdm/PAM support by default for FreeBSD versions with PAM.
+ 942. Fix a problem where the X server thinks it has acquired a VT at startup
+ before it has really been released. This is due to the ioctl()
+ returning prematurely because of a pending signal (Jeff Hartmann).
+ 941. Fix a problem with the PAM support in xdm that prevents
+ pam_start_session() from ever being called (Takanori Saneto).
+ 940. Enable PAM support for xdm on FreeBSD (#A.202, Jean-Marc Zucconi, and
+ Takanori Saneto).
+ 939. Fix xf86cfg build problem when BuildXinerama is set to NO (#A.200,
+ Jean-Marc Zucconi).
+ 938. gccmakedep has a typo which affects handling the -o and -O options
+ (A.192, Ivan Zakharyaschev).
+ 937. Specify the units for the dpms and rate commands in the xset man
+ page (#A.191, John Heidemann).
+ 936. Let makedepend ignore "//" style comments on all platforms, not
+ just Win32, and fix a bug in that code that was causing the line
+ after such comments to also be ignored (#A.189, Guenther Grau).
+ 935. Update GNU/Hurd support (#A.188, Marcus Brinkmann).
+ 934. Initial port of the ark driver to 4.x (#4242, Ani Joshi).
+ 933. Wacom input driver update, including support for 38400 link speed
+ and fix wrong advertisement of min/max values (#4241, Frederic Lepied).
+ 932. Fix some parser problems, including:
+ - parser does not write Modes section and UseModes keyword
+ - the vscan value wasn't being used
+ - make the XF86ConfModesPtr structure accessible from the
+ XF86ConfMonitorPtr structure
+ - allow xf86Parser.h to be included from in a C++ program
+ (#4238, 4243-4245, Paulo Cesar Pereira de Andrade).
+ 931. Fix the name of the Serbian xkb symbols file (rename from yu to sr)
+ (#4237, Ivan Pascal).
+ 930. Fix mkcfm bug (#4236, Juliusz Chroboczek).
+ 929. Glint/permedia3 updates (#4235, 4238, Sven Luther).
+ 928. Fix an SVR4 loader build problem introduced in 4.0.1d (#4234,
+ Takaaki Nomura).
+ 927. Fix a bug in fontenc that would cause a memory leak whenever an
+ encoding would be declared in encodings.dir but not in the encoding
+ file itself (#4233, Juliusz Chroboczek).
+ 926. Make the freetype backend use the fontenc matrix encoding support,
+ remove support for the defunct XAnti extension, and bump the version
+ of the freetype backend to 1.1.8 (#4233, Juliusz Chroboczek).
+ 925. Add proper support for matrix encodings in fontenc (including the
+ new FIRSTINDEX keyword in encoding files), and bump the version of
+ the font module ABI to 0.2 (#4233, Juliusz Chroboczek).
+ 924. Fix a problem the vesa driver (#4232, Paulo Cesar Pereira de Andrade).
+ 923. Fix problems building the C&T driver with DEBUG defined (#4231,
+ Taketoshi Sano).
+ 922. Remove lt_LT.ISO8859-1 entry from compose.dir (#4230, Nerijus Baliunas).
+ 921. s3virge driver updates, including:
+ - Stabilize GX2 support, reenable silken mouse
+ - Enable MX fixes
+ - Add support for the render extension
+ - Enable BLT_BUG for ViRGE and VX chipsets
+ (#4229, Kevin Brosius).
+ 920. Don't initialize DRI when noaccel is specified in the tdfx driver
+ (Alan Hourihane).
+ 919. Make module ABI compatibility mismatches fatal by default, and
+ add a command line option for making them non-fatal (David Dawes).
+ 918. Changed SiS driver to use fb instead of cfb (Alan Hourihane).
+ 917. Fix r128 and radeon driver source code formatting that was munged
+ during ATI merge (Kevin Martin).
+ 916. Update Markus Kuhn's UCS fonts, and add his scripts for extracting
+ subsets of them to the build process (David Dawes).
+ 915. Fix visual setting in ATI r128/radeon driver (Jeff Wiedemeier).
+ 914. Alpha fix for xf86cfg (Alan Hourihane).
+ 913. Resync DRI code/drivers with the DRI CVS (VA Linux).
+ 912. Fix tdfx driver to register resources and remove some redundant code
+ (Alan Hourihane).
+
XFree86 4.0.1e (6 November 2000)
911. Fix the ksc5601.1987-0 encoding file (#4226, 4228, Pablo Saratxaga).
910. Update xdm/sessreg to write ":0" type entried in utmp on OpenBSD
@@ -100,7 +301,7 @@ XFree86 4.0.1e (6 November 2000)
852. Make BIOS accesses in the Rage128 and Radeon drivers independent of
endianess and alignment (Marc La France).
851. Fix the claiming of XF86Config device sections by drivers, and change
- MatchDevices() to only return unclaimed sections (Marc La France).
+ xf86MatchDevices() to only return unclaimed sections (Marc La France).
850. Fixed build problem in s3virge when XvExtension is not set (Stuart
Anderson)
849. Add a message at the top of the server/log output for pre-release
@@ -11497,4 +11698,4 @@ XFree86 3.0a (28 April 1994)
XFree86 3.0 (26 April 1994)
-$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1381 2000/11/06 19:24:02 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1420 2000/11/29 18:12:27 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile b/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile
index a4e03d54e..38510148b 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile
@@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/14 1996/10/27 11:03:56 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.36 2000/08/10 17:40:33 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.37 2000/11/28 20:59:16 dawes Exp $
#if (defined(SVR3Architecture) || defined(SVR4Architecture) || defined(SCOArchitecture)) && !defined(DguxArchitecture)
# define OSModule OS_SYSV
@@ -91,12 +91,12 @@ SVGA_SRC = Tseng.c WD.c ChipsTech.c Video7.c Genoa.c Trident.c Oak.c \
Cirrus.c Ahead.c ATI.c S3.c AL.c Yamaha.c NCR.c MX.c \
RealTek.c Primus.c Compaq.c HMC.c UMC.c Weitek.c SiS.c \
ARK.c Alliance.c Matrox.c SigmaDesigns.c Intergraphics.c \
- Epson.c Rendition.c
+ Epson.c Rendition.c SiliconMotion.c
SVGA_OBJ = Tseng.o WD.o ChipsTech.o Video7.o Genoa.o Trident.o Oak.o \
Cirrus.o Ahead.o ATI.o S3.o AL.o Yamaha.o NCR.o MX.o \
RealTek.o Primus.o Compaq.o HMC.o UMC.o Weitek.o SiS.o \
ARK.o Alliance.o Matrox.o SigmaDesigns.o Intergraphics.o \
- Epson.o Rendition.o
+ Epson.o Rendition.o SiliconMotion.o
COPROC_SRC = 8514.c ATIMach.c I128.c GLINT.c
COPROC_OBJ = 8514.o ATIMach.o I128.o GLINT.o
SRCS = Main.c $(SVGA_SRC) $(COPROC_SRC) $(BASE_SRC) Print.c Utils.c $(OS_SRC)
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c
index 8a0f051f1..5cfbe1a07 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c
@@ -28,7 +28,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c,v 3.29 2000/10/12 12:00:28 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c,v 3.30 2000/11/28 20:59:16 dawes Exp $ */
#include "Probe.h"
#include "PatchLevel.h"
@@ -82,6 +82,7 @@ static Chip_Descriptor *SVGA_Descriptors[] = {
&Alliance_Descriptor,
&SigmaDesigns_Descriptor,
&Intergraphics_Descriptor,
+ &SiliconMotion_Descriptor,
&CT_Descriptor, /* I think this is screwing people up, so put it last */
NULL
};
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h
index 696debfda..359a8d12f 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h,v 3.35 2000/02/12 20:45:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h,v 3.36 2000/11/28 20:59:16 dawes Exp $ */
/*
* PCI Probe
*
@@ -224,6 +224,7 @@ extern struct pci_config_reg *pci_devp[];
#define PCI_VENDOR_ARK 0xEDD8
#define PCI_VENDOR_3DLABS 0x3D3D
#define PCI_VENDOR_INTERGRAPHICS 0x10EA
+#define PCI_VENDOR_SMI 0x126F
/* Matrox */
#define PCI_CHIP_MGA2085PX 0x0518
@@ -385,6 +386,14 @@ extern struct pci_config_reg *pci_devp[];
#define PCI_CHIP_INTERG_1680 0x1680
#define PCI_CHIP_INTERG_1682 0x1682
+/* Silicon Motion */
+#define PCI_CHIP_SMI_910 0x0910
+#define PCI_CHIP_SMI_810 0x0810
+#define PCI_CHIP_SMI_820 0x0820
+#define PCI_CHIP_SMI_710 0x0710
+#define PCI_CHIP_SMI_712 0x0712
+#define PCI_CHIP_SMI_720 0x0720
+
/* Increase this as required */
#define MAX_DEV_PER_VENDOR 18
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h
index 5372f5240..bed187b8a 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h
@@ -26,10 +26,10 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h,v 3.26 2000/03/08 19:23:25 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h,v 3.27 2000/11/28 20:59:16 dawes Exp $ */
#define VERSION 2
-#define PATCHLEV 22
-#define RELDATE "2000 March 6"
+#define PATCHLEV 23
+#define RELDATE "2000 November 28"
#define PRINT_VERSION printf("\n%s Version %d.%d (%s)\n", \
MyName,VERSION,PATCHLEV,RELDATE)
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c
index 1b0231705..9323f3651 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c
@@ -26,7 +26,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c,v 3.70 2000/02/12 20:45:14 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c,v 3.71 2000/11/28 20:59:16 dawes Exp $ */
#include "Probe.h"
@@ -237,6 +237,13 @@ static CONST char *SVGA_Names[NUM_VENDORS+1][CHPS_PER_VENDOR] =
"Intergraphics IGA-1680",
"Intergraphics IGA-1682" },
/* Epson */ { "Epson SPC8110" },
+/* Silicon Motion */ { "Silicon Motion (chipset unknown)"
+ "Silicon Motion SM910 Lynx",
+ "Silicon Motion SM810 LynxE",
+ "Silicon Motion SM820 Lynx3D",
+ "Silicon Motion SM710 LynxEM",
+ "Silicon Motion SM712 LynxEM+",
+ "Silicon Motion SM720 Lynx3DM" },
};
static CONST char *Herc_Names[] =
@@ -325,6 +332,8 @@ struct RamDac_Name RamDac_Names[] =
"Matrox G200 built-in DAC w/clock" },
{ "SiS",
"SiS built-in DAC w/clock" },
+ { "SMI",
+ "Silicon Motion built-in DAC w/clock" },
};
static CONST char *CoProc_Names[NUM_CP_TYPES][CHPS_PER_CPTYPE] =
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h
index 4bcc6722c..0d8e43e73 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h
@@ -26,7 +26,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h,v 3.74 2000/08/23 22:10:10 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h,v 3.76 2000/11/28 20:59:16 dawes Exp $ */
/*
* Includes
@@ -44,7 +44,7 @@
#include <stdlib.h>
#endif /* MACH386 */
#include <ctype.h>
-#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__QNX__) || defined(__QNXNTO__)
+#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__QNX__) || defined(__QNXNTO__) || defined(__GNU__)
#if defined(__ia64__) || defined(ia64)
#include <sys/io.h>
#include <asm/io.h>
@@ -199,6 +199,7 @@ Bool Probe_ARK __STDCARGS((int *));
Bool Probe_SigmaDesigns __STDCARGS((int *));
Bool Probe_Intergraphics __STDCARGS((int *));
Bool Probe_Epson __STDCARGS((int *));
+Bool Probe_SiliconMotion __STDCARGS((int *));
/* CoProc */
Bool Probe_8514 __STDCARGS((int *));
Bool Probe_ATIMach __STDCARGS((int *));
@@ -259,6 +260,7 @@ extern Chip_Descriptor Yamaha_Descriptor;
extern Chip_Descriptor ARK_Descriptor;
extern Chip_Descriptor SigmaDesigns_Descriptor;
extern Chip_Descriptor Intergraphics_Descriptor;
+extern Chip_Descriptor SiliconMotion_Descriptor;
extern Chip_Descriptor IBM8514_Descriptor;
extern Chip_Descriptor ATIMach_Descriptor;
@@ -358,8 +360,9 @@ extern Chip_Descriptor GLINT_Descriptor;
#define DAC_MGAG100 55 /* Matrox G100 integrated DAC */
#define DAC_MGAG200 56 /* Matrox G200 integrated DAC */
#define DAC_SIS 57 /* SiS integrated DAC */
+#define DAC_SMI 58 /* Silicon Motion integrated DAC */
-#define DAC_MAX DAC_SIS /* UPDATE THIS! */
+#define DAC_MAX DAC_SMI /* UPDATE THIS! */
#define DAC_6_8_PROGRAM 0x40 /* RAMDAC programmable for 6/8-bit tables */
#define DAC_8BIT 0x80 /* RAMDAC with 8-bit wide lookup tables */
@@ -429,8 +432,9 @@ extern struct RamDac_Name RamDac_Names[];
#define V_SD 27
#define V_IG 28
#define V_EPSON 29
+#define V_SMI 30
-#define NUM_VENDORS 29
+#define NUM_VENDORS 30
#define CHPS_PER_VENDOR 64
#define CHIP_AHEAD_UNK SVGA_TYPE(V_AHEAD,0) /* Ahead unknown */
@@ -718,6 +722,13 @@ extern struct RamDac_Name RamDac_Names[];
#define CHIP_IG_1680 SVGA_TYPE(V_IG,1) /* Intergraphics IGA-1680 */
#define CHIP_IG_1682 SVGA_TYPE(V_IG,2) /* Intergraphics IGA-1682 */
#define CHIP_EPSON_8110 SVGA_TYPE(V_EPSON,0) /* Epson SPC8110 */
+#define CHIP_SMI_UNK SVGA_TYPE(V_SMI,0) /* SMI unknwon */
+#define CHIP_SMI_910 SVGA_TYPE(V_SMI,1) /* SMI 910 */
+#define CHIP_SMI_810 SVGA_TYPE(V_SMI,2) /* SMI 810 */
+#define CHIP_SMI_820 SVGA_TYPE(V_SMI,3) /* SMI 820 */
+#define CHIP_SMI_710 SVGA_TYPE(V_SMI,4) /* SMI 710 */
+#define CHIP_SMI_712 SVGA_TYPE(V_SMI,5) /* SMI 712 */
+#define CHIP_SMI_720 SVGA_TYPE(V_SMI,6) /* SMI 720 */
/*
* Graphics Coprocessors
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c
index 97f4cb25a..ed2e834f3 100644
--- a/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c
@@ -30,7 +30,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c,v 3.36 2000/02/12 20:45:15 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c,v 3.37 2000/11/28 20:59:16 dawes Exp $ */
#include "Probe.h"
@@ -1209,6 +1209,11 @@ int *RamDac;
if ((Chipset >= CHIP_SIS86C201) && (Chipset <= CHIP_SIS540))
*RamDac = DAC_SIS;
}
+ else if (SVGA_VENDOR(Chipset) == V_SMI)
+ {
+ if ((Chipset >= CHIP_SMI_910) && (Chipset <= CHIP_SMI_720))
+ *RamDac = DAC_SMI;
+ }
/*
* Save current state.
*/
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c
new file mode 100644
index 000000000..6048530a1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c
@@ -0,0 +1,142 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SiliconMotion.c,v 1.1 2000/11/28 20:59:16 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ * (c) Copyright 2000 by Silicon Motion <frido@siliconmotion.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION 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 David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_SiliconMotion __STDCARGS((int));
+
+Chip_Descriptor SiliconMotion_Descriptor = {
+ "Silicon Motion",
+ Probe_SiliconMotion,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_SiliconMotion,
+};
+
+Bool Probe_SiliconMotion(Chipset)
+int *Chipset;
+{
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL)
+ {
+ if (pcrp->_vendor == PCI_VENDOR_SMI && pcrp->_status_command & 7)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_SMI_910:
+ *Chipset = CHIP_SMI_910;
+ PCIProbed = TRUE;
+ break;
+
+ case PCI_CHIP_SMI_810:
+ *Chipset = CHIP_SMI_810;
+ PCIProbed = TRUE;
+ break;
+
+ case PCI_CHIP_SMI_820:
+ *Chipset = CHIP_SMI_820;
+ PCIProbed = TRUE;
+ break;
+
+ case PCI_CHIP_SMI_710:
+ *Chipset = CHIP_SMI_710;
+ PCIProbed = TRUE;
+ break;
+
+ case PCI_CHIP_SMI_712:
+ *Chipset = CHIP_SMI_712;
+ PCIProbed = TRUE;
+ break;
+
+ case PCI_CHIP_SMI_720:
+ *Chipset = CHIP_SMI_720;
+ PCIProbed = TRUE;
+ break;
+ }
+
+ if (PCIProbed)
+ {
+ return(TRUE);
+ }
+ }
+ i++;
+ }
+ }
+
+ return(FALSE);
+}
+
+static int MemProbe_SiliconMotion(Chipset)
+int Chipset;
+{
+ Byte config;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ config = rdinx(SEQ_IDX, 0x71);
+ switch (Chipset)
+ {
+ case CHIP_SMI_910:
+ case CHIP_SMI_810:
+ case CHIP_SMI_710:
+ case CHIP_SMI_712:
+ {
+ int memsize[] = { 1, 2, 4, 0 };
+ Mem = memsize[config >> 6] * 1024;
+ break;
+ }
+
+ case CHIP_SMI_820:
+ {
+ int memsize[] = { 0, 2, 4, 6 };
+ Mem = memsize[config >> 6] * 1024 + 512;
+ break;
+ }
+
+ case CHIP_SMI_720:
+ {
+ int memsize[] = { 16, 2, 4, 8 };
+ Mem = memsize[config >> 6] * 1024;
+ break;
+ }
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Config.cpp b/xc/programs/Xserver/hw/xfree86/XF86Config.cpp
index 47f084a5c..00de224b0 100644
--- a/xc/programs/Xserver/hw/xfree86/XF86Config.cpp
+++ b/xc/programs/Xserver/hw/xfree86/XF86Config.cpp
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.cpp,v 1.11 2000/10/24 18:07:49 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.cpp,v 1.12 2000/11/28 20:59:14 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH XF86Config __filemansuffix__ "Version 4.0.1" "XFree86"
@@ -1558,20 +1558,31 @@ cyrix(__drivermansuffix__),
fbdev(__drivermansuffix__),
glide(__drivermansuffix__),
glint(__drivermansuffix__),
+i128(__drivermansuffix__),
i740(__drivermansuffix__),
i810(__drivermansuffix__),
+imstt(__drivermansuffix__),
mga(__drivermansuffix__),
neomagic(__drivermansuffix__),
nv(__drivermansuffix__),
r128(__drivermansuffix__),
rendition(__drivermansuffix__),
s3virge(__drivermansuffix__),
+siliconmotion(__drivermansuffix__),
sis(__drivermansuffix__),
+sunbw2(__drivermansuffix__),
+suncg14(__drivermansuffix__),
+suncg3(__drivermansuffix__),
+suncg6(__drivermansuffix__),
+sunffb(__drivermansuffix__),
+sunleo(__drivermansuffix__),
+suntcx(__drivermansuffix__),
tdfx(__drivermansuffix__),
tga(__drivermansuffix__),
trident(__drivermansuffix__),
tseng(__drivermansuffix__),
v4l(__drivermansuffix__),
+vesa(__drivermansuffix__),
vga(__drivermansuffix__),
.br
README
diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h
index 2d3b1465e..43bd2c47d 100644
--- a/xc/programs/Xserver/hw/xfree86/common/compiler.h
+++ b/xc/programs/Xserver/hw/xfree86/common/compiler.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.73 2000/11/06 19:24:05 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.74 2000/11/21 23:10:32 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -1502,8 +1502,10 @@ testinx(unsigned short port, unsigned char ind)
#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
# if defined (JENSEN_SUPPORT)
#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
-#define MMIO_OUT32(base, offset, val) (*xf86WriteMmio32)(val, base, offset)
-#define MMIO_ONB32(base, offset, val) (*xf86WriteMmioNB32)(val, base, offset)
+#define MMIO_OUT32(base, offset, val) \
+ (*xf86WriteMmio32)((CARD32)(val), base, offset)
+#define MMIO_ONB32(base, offset, val) \
+ (*xf86WriteMmioNB32)((CARD32)(val), base, offset)
# else
#define MMIO_IN32(base, offset) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
@@ -1515,10 +1517,14 @@ testinx(unsigned short port, unsigned char ind)
#define MMIO_ONB32(base, offset, val) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
# endif
-#define MMIO_OUT8(base, offset, val) (*xf86WriteMmio8)(val, base, offset)
-#define MMIO_OUT16(base, offset, val) (*xf86WriteMmio16)(val, base, offset)
-#define MMIO_ONB8(base, offset, val) (*xf86WriteMmioNB8)(val, base, offset)
-#define MMIO_ONB16(base, offset, val) (*xf86WriteMmioNB16)(val, base, offset)
+#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)
#elif defined(__powerpc__)
/*
* we provide byteswapping and no byteswapping functions here
@@ -1526,22 +1532,32 @@ testinx(unsigned short port, unsigned char ind)
* 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, val)
-# define MMIO_ONB8(base, offset, val) xf86WriteMmioNB8(base, offset, val)
+# 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, val)
-# define MMIO_OUT32(base, offset, val) xf86WriteMmio32Be(base, offset, val)
-# define MMIO_ONB16(base, offset, val) xf86WriteMmioNB16Be(base, offset, val)
-# define MMIO_ONB32(base, offset, val) xf86WriteMmioNB32Be(base, offset, val)
+# 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, val)
-# define MMIO_OUT32(base, offset, val) xf86WriteMmio32Le(base, offset, val)
-# define MMIO_ONB16(base, offset, val) xf86WriteMmioNB16Le(base, offset, val)
-# define MMIO_ONB32(base, offset, val) xf86WriteMmioNB32Le(base, offset, val)
+# 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
#elif defined(__sparc__)
/*
@@ -1552,22 +1568,32 @@ testinx(unsigned short port, unsigned char ind)
* of drivers?).
*/
# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) xf86WriteMmio8(base, offset, val)
-# define MMIO_ONB8(base, offset, val) xf86WriteMmio8NB(base, offset, val)
+# 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, val)
-# define MMIO_OUT32(base, offset, val) xf86WriteMmio32Be(base, offset, val)
-# define MMIO_ONB16(base, offset, val) xf86WriteMmio16BeNB(base, offset, val)
-# define MMIO_ONB32(base, offset, val) xf86WriteMmio32BeNB(base, offset, val)
+# 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, val)
-# define MMIO_OUT32(base, offset, val) xf86WriteMmio32Le(base, offset, val)
-# define MMIO_ONB16(base, offset, val) xf86WriteMmio16LeNB(base, offset, val)
-# define MMIO_ONB32(base, offset, val) xf86WriteMmio32LeNB(base, offset, val)
+# 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
#else /* !__alpha__ && !__powerpc__ && !__sparc__ */
#define MMIO_IN8(base, offset) \
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h
index 17f49691d..50920f256 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.143 2000/10/30 23:02:10 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.144 2000/11/18 19:37:08 tsi Exp $ */
/*
* Copyright (c) 1997 by The XFree86 Project, Inc.
@@ -177,6 +177,7 @@ pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
int xf86RemoveInputHandler(pointer handler);
void xf86DisableInputHandler(pointer handler);
void xf86EnableInputHandler(pointer handler);
+void xf86InterceptSignals(int *signo);
/* xf86Helper.c */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
index 49e5b540a..2556136e6 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.234 2000/11/06 19:24:06 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.235 2000/11/14 18:20:36 dawes Exp $ */
/*
@@ -41,7 +41,7 @@ extern DeviceAssocRec mouse_assoc;
#if (defined(i386) || defined(__i386__)) && \
(defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \
- (defined(SVR4) && !defined(sun)))
+ (defined(SVR4) && !defined(sun)) || defined(__GNU__))
#define SUPPORT_PC98
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c
index b7c196f5e..ae6e3dd66 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.43 2000/11/03 18:46:06 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.44 2000/11/18 19:37:09 tsi Exp $ */
/*
* Copyright 2000 by Alan Hourihane, Sychdyn, North Wales.
*
@@ -161,7 +161,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
i = nDevToConfig++;
DevToConfig =
xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
-#if 1
+#if 0 /* Doesn't work when a driver detects more than one adapter */
if (i > 0 && isPrimary) {
memmove(DevToConfig + 1,DevToConfig,
(nDevToConfig - 1) * sizeof(DevToConfigRec));
@@ -698,9 +698,9 @@ DoConfigure()
xf86config->conf_modules = configureModuleSection();
xf86config->conf_flags = configureFlagsSection();
xf86config->conf_videoadaptor_lst = configureVideoAdaptorSection();
- xf86config->conf_modes_lst = configureModesSection();
+/* xf86config->conf_modes_lst = configureModesSection(); */
xf86config->conf_vendor_lst = configureVendorSection();
-/* xf86config->conf_dri = configureDRISection();*/
+/* xf86config->conf_dri = configureDRISection(); */
xf86config->conf_input_lst = configureInputSection();
xf86config->conf_layout_lst = configureLayoutSection();
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
index 459fb28c9..a4915aaf0 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.100 2000/11/06 19:24:06 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.101 2000/11/18 19:37:09 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -1062,13 +1062,29 @@ xf86RemoveEnabledDevice(InputInfoPtr pInfo)
}
}
+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(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
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c
index 789eedbac..d6c1e4549 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.100 2000/11/03 18:46:06 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.103 2000/11/18 19:37:09 tsi Exp $ */
/*
* Copyright (c) 1997-1998 by The XFree86 Project, Inc.
@@ -31,7 +31,8 @@
#include "xf86Bus.h"
/* For xf86GetClocks */
-#if defined(CSRG_BASED) || defined(MACH386)
+#if defined(CSRG_BASED) || defined(MACH386) || defined(__GNU__)
+#define HAS_SETPRIORITY
#include <sys/resource.h>
#endif
@@ -1556,23 +1557,29 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
*foundEntities = NULL;
if (vendorID == 0) {
- for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
+ for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
+ Bool foundVendor = FALSE;
for (id = PCIchipsets; id->PCIid != -1; id++) {
- if ( (((id->PCIid & 0xFFFF0000) >> 16) == (*ppPci)->vendor) &&
- ((id->PCIid & 0x0000FFFF) == (*ppPci)->chipType)){
- ++allocatedInstances;
- instances = xnfrealloc(instances,
- allocatedInstances * sizeof(struct Inst));
- instances[allocatedInstances - 1].pci = *ppPci;
- instances[allocatedInstances - 1].dev = NULL;
- instances[allocatedInstances - 1].claimed = FALSE;
- instances[allocatedInstances - 1].foundHW = TRUE;
- instances[allocatedInstances - 1].chip = id->numChipset;
- instances[allocatedInstances - 1].screen = 0;
- numFound++;
- }
+ if ( (((id->PCIid & 0xFFFF0000) >> 16) == (*ppPci)->vendor)) {
+ if (!foundVendor) {
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].pci = *ppPci;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ instances[allocatedInstances - 1].foundHW = FALSE;
+ instances[allocatedInstances - 1].screen = 0;
+ foundVendor = TRUE;
+ }
+ if ((id->PCIid & 0x0000FFFF) == (*ppPci)->chipType) {
+ instances[allocatedInstances - 1].foundHW = TRUE;
+ instances[allocatedInstances - 1].chip = id->numChipset;
+ numFound++;
+ }
+ }
}
- }
+ }
} else if (vendorID == PCI_VENDOR_GENERIC) {
for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
for (id = PCIchipsets; id->PCIid != -1; id++) {
@@ -1616,6 +1623,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
}
}
}
+
/*
* This may be debatable, but if no PCI devices with a matching vendor
* type is found, return zero now. It is probably not desirable to
@@ -2085,7 +2093,7 @@ xf86SetPriority(Bool up)
static int saved_nice;
if (up) {
-#if defined(CSRG_BASED) || defined(MACH386)
+#ifdef HAS_SETPRIORITY
saved_nice = getpriority(PRIO_PROCESS, 0);
setpriority(PRIO_PROCESS, 0, -20);
#endif
@@ -2094,7 +2102,7 @@ xf86SetPriority(Bool up)
nice(-20 - saved_nice);
#endif
} else {
-#if defined(CSRG_BASED) || defined(MACH386)
+#ifdef HAS_SETPRIORITY
setpriority(PRIO_PROCESS, 0, saved_nice);
#endif
#if defined(SYSV) || defined(SVR4) || defined(linux)
@@ -2503,6 +2511,7 @@ xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
{
IsaChipsets *i_id;
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return pScrn;
if (!(pEnt->location.type == BUS_ISA)) {
xfree(pEnt);
@@ -2539,6 +2548,7 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
{
PciChipsets *p_id;
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return pScrn;
if (!(pEnt->location.type == BUS_PCI)) {
xfree(pEnt);
@@ -2586,6 +2596,7 @@ xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
{
IsaChipsets *i_id;
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return FALSE;
if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) {
xfree(pEnt);
@@ -2615,6 +2626,7 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
{
PciChipsets *p_id;
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return FALSE;
if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) {
xfree(pEnt);
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c
index 19b9c198c..68af62445 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.170 2000/11/03 18:46:07 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.172 2000/11/27 05:06:46 dawes Exp $ */
/*
* Copyright 1991-1999 by The XFree86 Project, Inc.
@@ -1123,7 +1123,7 @@ OsVendorFatalError()
"the full server output, not just the last messages.\n");
if (xf86LogFile)
ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile);
- ErrorF("Please reports problems to %s.\n",BUILDERADDR);
+ ErrorF("Please report problems to %s.\n",BUILDERADDR);
ErrorF("\n");
}
@@ -1249,6 +1249,13 @@ ddxProcessArgument(int argc, char **argv, int i)
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"))
{
@@ -1531,7 +1538,8 @@ 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("-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();
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
index 95980c117..59f1fb7b5 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.34 2000/10/11 22:52:52 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.35 2000/11/16 19:44:54 eich Exp $ */
/*
* Copyright (c) 1997,1998 by The XFree86 Project, Inc.
@@ -269,7 +269,7 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
modep->PrivFlags = cp->PrivFlags;
} else {
if(!scrp->progClock) {
- modep->Clock = p->Clock;
+ modep->Clock = p->Clock;
modep->ClockIndex = p->ClockIndex;
modep->SynthClock = p->SynthClock;
} else {
@@ -382,7 +382,6 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
/* Scan the mode pool for matching names */
for (p = scrp->modePool; p != NULL; p = p->next) {
if (strcmp(p->name, modep->name) == 0) {
-
/*
* Requested mode is a built-in mode. Don't let the user
* override it.
@@ -1400,7 +1399,9 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
lookupNext:
status = xf86LookupMode(scrp, p, clockRanges, strategy);
-
+ if (status != MODE_OK) xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "mode \"%s\" deleted (%s)\n", p->name,
+ xf86ModeStatusToString(status));
if (status == MODE_ERROR) {
ErrorF("xf86ValidateModes: "
"unexpected result from xf86LookupMode()\n");
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
index 9fd7f5c86..41c86c6bb 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.26 2000/08/23 22:10:11 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.27 2000/11/14 16:54:49 dawes Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -65,7 +65,7 @@ typedef enum {
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 3)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 1)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 1)
-#define ABI_FONT_VERSION SET_ABI_VERSION(0, 1)
+#define ABI_FONT_VERSION SET_ABI_VERSION(0, 2)
#define MODINFOSTRING1 0xef23fdc5
#define MODINFOSTRING2 0x10dc023a
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
index 4fddde903..e933a3017 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.76 2000/11/02 22:15:46 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.79 2000/11/29 09:16:17 alanh Exp $ */
/*
* PCI Probe
*
@@ -239,6 +239,7 @@
#define PCI_CHIP_RADEON_QG 0x5147
#define PCI_CHIP_RAGE128RE 0x5245
#define PCI_CHIP_RAGE128RF 0x5246
+#define PCI_CHIP_RAGE128RG 0x5247
#define PCI_CHIP_RAGE128RK 0x524B
#define PCI_CHIP_RAGE128RL 0x524C
#define PCI_CHIP_MACH64VT 0x5654
@@ -255,6 +256,7 @@
#define PCI_CHIP_VAS96011 0x0702
/* Avance Logic */
+#define PCI_CHIP_ALG2064 0x2064
#define PCI_CHIP_ALG2301 0x2301
/* NS */
@@ -1202,7 +1204,7 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_QUADRO2MXR, "GeForce2 MXR",0},
{PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS",0},
{PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0},
- {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 ultra",0},
+ {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0},
{PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0},
{0x0000, NULL,0}}},
#ifdef VENDOR_INCLUDE_NONVIDEO
@@ -1366,6 +1368,7 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_PERMEDIA3, "GLINT Permedia 3",0},
{0x0000, NULL,0}}},
{PCI_VENDOR_AVANCE_2, {
+ {PCI_CHIP_ALG2064, "ALG2064",0},
{0x0000, NULL,0}}},
{PCI_VENDOR_S3, {
{PCI_CHIP_PLATO, "PLATO/PX",0},
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
index ba6303095..bd3287834 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.31 1999/12/27 00:39:43 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.32 2000/11/29 15:51:20 dawes Exp $ */
#ifndef _xf86Xinput_h
#define _xf86Xinput_h
@@ -167,8 +167,6 @@ int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
void xf86XinputFinalizeInit(DeviceIntPtr dev);
Bool xf86CheckButton(int button, int down);
void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
-void xf86AddLocalDevice(LocalDevicePtr device, pointer options);
-Bool xf86RemoveLocalDevice(LocalDevicePtr device);
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);
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c
index 61a8c13b9..b7674503c 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.18 2000/10/25 06:14:24 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.19 2000/11/24 23:18:29 mvojkovi Exp $ */
#include "misc.h"
#include "xf86.h"
@@ -11,31 +11,6 @@
static int xf86FBMangerIndex = -1;
static unsigned long xf86ManagerGeneration = 0;
-typedef struct _FBLink {
- FBArea area;
- struct _FBLink *next;
-} FBLink, *FBLinkPtr;
-
-typedef struct _FBLinearLink {
- FBLinear linear;
- FBAreaPtr area;
- struct _FBLinearLink *next;
-} FBLinearLink, *FBLinearLinkPtr;
-
-
-typedef struct {
- ScreenPtr pScreen;
- RegionPtr InitialBoxes;
- RegionPtr FreeBoxes;
- FBLinkPtr UsedAreas;
- int NumUsedAreas;
- FBLinearLinkPtr LinearAreas;
- CloseScreenProcPtr CloseScreen;
- int NumCallbacks;
- FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
- DevUnion *devPrivates;
-} FBManager, *FBManagerPtr;
-
Bool xf86RegisterOffscreenManager(
ScreenPtr pScreen,
FBManagerFuncsPtr funcs
@@ -208,6 +183,9 @@ xf86QueryLargestOffscreenArea(
){
FBManagerFuncsPtr funcs;
+ *w = 0;
+ *h = 0;
+
if(xf86FBMangerIndex < 0)
return FALSE;
if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
@@ -226,6 +204,8 @@ xf86QueryLargestOffscreenLinear(
){
FBManagerFuncsPtr funcs;
+ *size = 0;
+
if(xf86FBMangerIndex < 0)
return FALSE;
if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
@@ -258,6 +238,31 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
static unsigned long xf86FBGeneration = 0;
static int xf86FBScreenIndex = -1;
+typedef struct _FBLink {
+ FBArea area;
+ struct _FBLink *next;
+} FBLink, *FBLinkPtr;
+
+typedef struct _FBLinearLink {
+ FBLinear linear;
+ FBAreaPtr area;
+ struct _FBLinearLink *next;
+} FBLinearLink, *FBLinearLinkPtr;
+
+
+typedef struct {
+ ScreenPtr pScreen;
+ RegionPtr InitialBoxes;
+ RegionPtr FreeBoxes;
+ FBLinkPtr UsedAreas;
+ int NumUsedAreas;
+ FBLinearLinkPtr LinearAreas;
+ CloseScreenProcPtr CloseScreen;
+ int NumCallbacks;
+ FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
+ DevUnion *devPrivates;
+} FBManager, *FBManagerPtr;
+
static void
SendCallFreeBoxCallbacks(FBManagerPtr offman)
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
index 9b44afe8f..45c0b5f26 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.24 2000/10/26 11:47:45 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.25 2000/11/18 19:37:10 tsi Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -1358,7 +1358,6 @@ getValidBIOSBase(PCITAG tag, int num)
resPtr tmp, avoid;
resRange range;
int n = 0;
- int maxnum = 5;
CARD32 biosSize, alignment;
if (!xf86PciVideoInfo) return 0;
@@ -1419,17 +1418,12 @@ getValidBIOSBase(PCITAG tag, int num)
return pvp->biosBase;
}
}
- if (num >= 0 && num <= 5 && pvp->memBase[num])
- maxnum = num;
- else {
- num = 0;
- }
- for (; num <= maxnum; num++) {
+ if (num >= 0 && num <= 5 &&
+ pvp->memBase[num] && (pvp->size[num] >= biosSize)) {
/* then try suggested memBase */
/* keep bios size ! */
P_M_RANGE(range,TAG(pvp),pvp->memBase[num],biosSize,ResExcMemBlock);
- if ( pvp->size[num] >= biosSize && xf86IsSubsetOf(range,m)
- && ! ChkConflict(&range,avoid,SETUP)) {
+ if (xf86IsSubsetOf(range,m) && !ChkConflict(&range,avoid,SETUP)) {
xf86FreeResList(avoid);
xf86FreeResList(m);
return pvp->memBase[num];
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c b/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c
index 187a938e1..816a3cb56 100644
--- a/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c
+++ b/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.18 2000/11/03 18:46:08 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.19 2000/11/16 19:44:55 eich Exp $ */
/* xf86DDC.c
*
@@ -130,6 +130,7 @@ xf86DoEDID_DDC1(
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
unsigned char *EDID_block = NULL;
xf86MonPtr tmp = NULL;
+ int sigio;
/* Default DDC and DDC1 to enabled. */
Bool noddc = FALSE, noddc1 = FALSE;
OptionInfoRec options[nDDCOptions];
@@ -142,8 +143,10 @@ xf86DoEDID_DDC1(
if (noddc || noddc1)
return NULL;
-
+
+ sigio = xf86BlockSIGIO();
EDID_block = EDIDRead_DDC1(pScrn,DDC1SetSpeed,DDC1Read);
+ xf86UnblockSIGIO(sigio);
if (EDID_block){
tmp = xf86InterpretEDID(scrnIndex,EDID_block);
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI
index 3873a53a1..78b231d90 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.DRI
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI
@@ -2,7 +2,7 @@
VA Linux Systems, Inc. Professional Services - Graphics.
- 22 August 2000
+ 24 October 2000
1. Preamble
@@ -47,15 +47,57 @@ can be found at http://dri.sourceforge.net/DRIcompile.html
Edits, corrections and updates to this document may be mailed to brianp@val-
inux.com.
-3. Supported Hardware
+3. Supported Architectures & Hardware
-3D acceleration is currently only available for systems with Intel-compatible
-CPUs. Support for Alpha, and perhaps other CPUs, should be available in the
-future.
+ "
+
+3.1 Architectures
+
+ "
+
+The Architectures currently supported by the DRI have grown from the initial
+Intel i386 based machines to now include, the Alpha Processor and the Sun
+SPARC machines.
+
+The build environment for both of these new architectures have a pre-build
+environment that will correctly build the DRI drivers and Mesa meaning no
+extra configuration is necessary to build the DRI for these architectures.
+
+3.1.1 Alpha Features
+
+ "
+
+On newer Alpha processors, it should be noted that a significant performance
+increase can be seen with the addition of the -mcpu= command that should be
+passed to GCC upon compilation. Dependent of the architecture of the proces-
+sor, for example -mcpu=ev6 will build specifically for the EV6 based AXP's,
+giving both byte and word alignment access to the DRI/Mesa drivers.
+
+Use this as an example of compiling with this extra speed. In your host.def
+file that should reside in the xc/config directory, add the line.
+
+#define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6
+
+Additional speed improvements to 3D rendering can be achieved by installing
+Compaq's Math Libraries (CPML) which can be obtained from the following URL.
+
+http://www.support.compaq.com/alpha-tools/software/index.html
+
+Once installed, you can set this option in your host.def to build against the
+CPML libraries.
+
+#define UseCompaqMathLibrary YES
+
+3.2 Graphics Hardware
+
+ "
XFree86 4.0 (or later versions) includes 3D acceleration for the following
graphics hardware:
+NOTE: This is a complete list of graphics hardware supported. It may not be
+supported on your platform.
+
o 3dfx:
o Voodoo5 5500
@@ -512,6 +554,14 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
10.1.3 Troubleshooting
+ o If you try to run an OpenGL application and see an error message similar
+ to
+
+ gd error (glide): gd error (glide): grSstSelect: non-existent SSTgd error (glide): grSstSelect: non-existent SSTS
+
+ it means that you have the wrong version of the Glide library for your
+ hardware.
+
o 3D acceleration for Voodoo3 is only supported in the 16 bit/pixel screen
mode. Use xdpyinfo to verify that all your visuals are depth 16. Edit
your XF86Config file if needed.
@@ -533,6 +583,38 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
the Performer Town demo, may become sluggish when falling back to soft-
ware rendering to render in that mode.
+ o The Voodoo3/Banshee driver reverts to software rendering under the fol-
+ lowing conditions:
+
+ o Setting GL_LIGHT_MODEL_COLOR_CONTROL to GL_SEPARATE_SPECULAR_COLOR.
+
+ o Enabling line stippline or polygon stippling.
+
+ o Enabling point smoothing or polygon smoothing.
+
+ o Enabling line smoothing when line width is not 1.0. That is,
+ antialiased lines are done in hardware only when the line width is
+ 1.0.
+
+ o Using 1-D or 3-D texture maps.
+
+ o Using the GL_BLEND texture environment.
+
+ o Using stencil operations.
+
+ o Using the accumulation buffer.
+
+ o Using glBlendEquation(GL_LOGIC_OP).
+
+ o Using glDrawBuffer(GL_FRONT_AND_BACK).
+
+ o Using glPolygonMode(face, GL_POINT) or glPolygonMode(face,
+ GL_LINE).
+
+ o Using point size attenuation (i.e. GL_DISTANCE_ATTENUATION_EXT).
+
+ o Using glColorMask(r, g, b, a) when r!=g or g!=b.
+
10.1.5 Known Problems
o The Glide library cannot be used directly; it's only meant to be used
@@ -590,7 +672,7 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in
32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered.
-When running in 32bpp mode only a 16-bit Z (depth) buffer is offered and
+When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and
stencil is implemented in software.
A software-based accumulation buffer is available in both 16 and 32bpp modes.
@@ -611,13 +693,30 @@ A software-based accumulation buffer is available in both 16 and 32bpp modes.
variable indicates the maximum number of swap buffer commands can be
buffered. Zero allows maximum frame rate.
+ o Rendering with 16-bit per texel textures is faster than using 32-bit per
+ texel textures. The internalFormat parameter to glTexImage2D can be
+ used to control texel size.
+
+ o The Voodoo5 driver reverts to software rendering under the same condi-
+ tions Voodoo3 with three exceptions. First, stencil operations are
+ implemented in hardware when the screen is configured for 32 bits/pixel.
+ Second, the GL_BLEND texture env mode is fully supported in hardware.
+ Third, glColorMask is fully supported in hardware when the screen is
+ configured for 32 bits/pixel.
+
10.2.5 Known Problems
o The Glide library cannot be used directly; it's only meant to be used
via the tdfx DRI driver.
o 24bpp screen modes are supported by the hardware but not by the current
- driver.
+ driver. 32bpp is fully supported.
+
+ o As of October, 2000 the second VSA-100 chip on the Voodoo5 is not yet
+ operational. Therefore, the board isn't being used to its full capac-
+ ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode
+ for full-screen applications and games, potentially doubling the sys-
+ tem's fill rate.
10.3 Intel i810
@@ -928,7 +1027,7 @@ forge.net/resources/resources.html
o In the future there may be IHV and Linux vendor support resources for
the DRI.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.8 2000/09/24 13:51:26 alanh Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.12 2000/11/16 18:36:25 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.8 2000/11/06 22:07:05 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.10 2000/11/16 18:37:34 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp
index b577262a7..8a0a8ea33 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp
@@ -2,7 +2,7 @@
VA Linux Systems, Inc. Professional Services - Graphics.
- 8 August 2000
+ 29 October 2000
1. Preamble
@@ -403,7 +403,7 @@ Issue the following commands:
cd /usr/X11R6/bin
mv Xwrapper Xwrapper.old
rm X
- ln -s /usr/X11R6-4.0.1/lib/X11/XFree86 X
+ ln -s /usr/X11R6-DRI/bin/XFree86 X
This will cause the new X server to be used instead of the original one.
@@ -486,7 +486,7 @@ At this point your X server should be up and running with hardware-acceler-
ated direct rendering. Please read the DRI User Guide for information about
trouble shooting and how to use the DRI-enabled X server for 3D applications.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.6 2000/09/24 13:51:26 alanh Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.7 2000/11/08 05:03:03 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.3 2000/11/06 22:07:05 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.4 2000/11/16 15:50:04 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.fonts b/xc/programs/Xserver/hw/xfree86/doc/README.fonts
index b7a4bf3f5..af43461d4 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/README.fonts
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.fonts
@@ -390,9 +390,25 @@ encoding, high bit clear), it should be
SIZE 0x75 0x80
-Codes outside the region defined by the size line are supposed to be unde-
-fined. Encodings default to linear encoding with a size of 256 (0x100).
-This means that you must declare the size of all 16 bit encodings.
+In the case of a matrix encoding, a `FIRSTINDEX' may be included to specify
+the minimum glyph index in an encoding. The keyword `FIRSTINDEX' is followed
+by two integers, the minimum row number followed by the minimum column num-
+ber:
+
+ FIRSTINDEX 0x20 0x20
+
+In the case of a linear encoding, a `FIRSTINDEX' line should usually not be
+included. If for some reason however it is desired that it should be
+included, it should be followed by a single integer.
+
+Note that in some font backends inclusion of a `FIRSTINDEX' line has the side
+effect of disabling default glyph generation, and this keyword should there-
+fore be avoided unless absolutely necessary.
+
+Codes outside the region defined by the `SIZE' and `FIRSTINDEX' lines are
+supposed to be undefined. Encodings default to linear encoding with a size
+of 256 (0x100). This means that you must declare the size of all 16 bit
+encodings.
What follows is one or more mapping sections. A mapping section starts with
a `STARTMAPPING' line stating the target of the mapping. The target may be
@@ -769,7 +785,7 @@ used for horizontal text (e.g. the CMap `KSC-EUC-H' will be used, but not
`KSC-EUC-V'). This limitation is due to the fact that the core X11 protocol
only provides support for horizontal writing.
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.7 2000/03/06 22:59:25 dawes Exp $
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.8 2000/11/14 16:54:49 dawes Exp $
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.10 2000/06/17 17:44:22 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.11 2000/11/16 15:50:04 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
index f4dd63b09..4a533cc4a 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
@@ -15,7 +15,7 @@
<date>20 November 2000
<ident>
- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.8 2000/09/24 13:51:26 alanh Exp $
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.12 2000/11/16 18:36:25 dawes Exp $
</ident>
<toc>
@@ -74,16 +74,53 @@
Edits, corrections and updates to this document may be mailed
to brianp@valinux.com.
+ <sect>Supported Architectures & Hardware
+ <p>
+ <sect1>Architectures
+ <p>
+ The Architectures currently supported by the DRI have grown
+ from the initial Intel i386 based machines to now include,
+ the Alpha Processor and the Sun SPARC machines.
- <sect>Supported Hardware
-<p>
- 3D acceleration is currently only available for systems with
- Intel-compatible CPUs.
- Support for Alpha, and perhaps other CPUs, should be available in the
- future.
- <p>
- XFree86 4.0 (or later versions) includes 3D acceleration for the
- following graphics hardware:
+ The build environment for both of these new architectures
+ have a pre-build environment that will correctly build the
+ DRI drivers and Mesa meaning no extra configuration is necessary
+ to build the DRI for these architectures.
+
+ <sect2>Alpha Features
+ <p>
+ On newer Alpha processors, it should be noted that a
+ significant performance increase can be seen with the
+ addition of the -mcpu= command that should be passed to
+ GCC upon compilation. Dependent of the architecture of the
+ processor, for example -mcpu=ev6 will build specifically
+ for the EV6 based AXP's, giving both byte and word alignment
+ access to the DRI/Mesa drivers.
+
+ Use this as an example of compiling with this extra speed.
+ In your host.def file that should reside in the xc/config
+ directory, add the line.
+
+ #define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6
+
+ Additional speed improvements to 3D rendering can be achieved
+ by installing Compaq's Math Libraries (CPML) which can be
+ obtained from the following URL.
+
+ http://www.support.compaq.com/alpha-tools/software/index.html
+
+ Once installed, you can set this option in your host.def
+ to build against the CPML libraries.
+
+ #define UseCompaqMathLibrary YES
+
+ <sect1> Graphics Hardware
+ <p>
+ XFree86 4.0 (or later versions) includes 3D acceleration for the
+ following graphics hardware:
+
+ NOTE: This is a complete list of graphics hardware supported. It
+ may not be supported on your platform.
<itemize>
<item>3dfx:
@@ -766,7 +803,7 @@
The Voodoo5 supports 3D rendering in 16 and 32 bpp modes.
When running in 32bpp mode an 8-bit stencil buffer and 24-bit
Z (depth) buffer are offered.
- When running in 32bpp mode only a 16-bit Z (depth) buffer is
+ When running in 16bpp mode only a 16-bit Z (depth) buffer is
offered and stencil is implemented in software.
<p>
A software-based accumulation buffer is available in both
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
index a6ce69277..d8974f398 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
@@ -15,7 +15,7 @@
<date>29 October 2000
<ident>
- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.6 2000/09/24 13:51:26 alanh Exp $
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.7 2000/11/08 05:03:03 dawes Exp $
</ident>
<toc>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml
index 74985a30c..644004d37 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml
@@ -9,7 +9,7 @@
<date>11 August 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.18 2000/08/11 21:12:49 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.19 2000/11/28 20:59:17 dawes Exp $
</ident>
<abstract>
@@ -543,8 +543,8 @@ dependencies/limitations, other architectures known to work on
(accelerated) for those ViRGE chips, as well as the Trio3D and
Trio3D/2X is provided by the XF86_SVGA server with the s3v
driver. Support (accelerated) for the Savage3D, Savage3D/MV,
- Savage4, Savage2000, Savage/MX-MV, Savage/MX, Savage/IX-MV and
- Savage/IX is provided by the XF86_SVGA server with the s3_savage
+ Savage4, Savage2000, is provided by the XF86_SVGA server with
+ the s3_savage
driver (CHECK: is this support Linux-only?).
<tag>&relvers;:</tag>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent b/xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent
index ffe0e624a..878e483ec 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent
@@ -1,17 +1,17 @@
-<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.13 2000/06/30 16:54:28 dawes Exp $ -->
+<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.14 2000/11/28 20:59:17 dawes Exp $ -->
<!-- shared entity definitions for the XFree86 documentation -->
<!-- XFree86 version string -->
-<!ENTITY relvers CDATA "4.0.1">
-<!ENTITY prevrelvers CDATA "4.0">
-<!ENTITY srcvers CDATA "401">
-<!ENTITY prevsrcvers CDATA "400">
+<!ENTITY relvers CDATA "4.0.2">
+<!ENTITY prevrelvers CDATA "4.0.1">
+<!ENTITY srcvers CDATA "402">
+<!ENTITY prevsrcvers CDATA "401">
<!-- Version of the most recent 3.3.x release -->
<!ENTITY legacyvers CDATA "3.3.6">
<!-- SuperProbe version strings -->
-<!ENTITY spvers CDATA "2.22">
+<!ENTITY spvers CDATA "2.23">
<!ENTITY legacyspvers CDATA "2.21">
<!-- These should be set according to which snapshot/release this is -->
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml
index 119cd0838..f4cfe4f77 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml
@@ -9,7 +9,7 @@
<date>5 March 2000</date>
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.7 2000/03/06 22:59:25 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.8 2000/11/14 16:54:49 dawes Exp $
</ident>
<toc>
@@ -354,9 +354,9 @@ example,
<p>mulearabic-2 encodings/mulearabic-2.enc
</tscreen>
-Note that the name of an encoding must be specified in the encoding
-file's STARTENCODING or ALIAS line. It is not enough to create an
-`<tt/encodings.dir/' entry.
+Note that the name of an encoding <it/must/ be specified in the
+encoding file's STARTENCODING or ALIAS line. It is not enough to
+create an `<tt/encodings.dir/' entry.
If your platform supports it (it probably does), encoding files may be
compressed or gzipped.
@@ -405,10 +405,25 @@ should be
<tscreen>
SIZE 0x75 0x80
</tscreen>
-Codes outside the region defined by the size line are supposed to be
-undefined. Encodings default to linear encoding with a size of 256
-(0x100). This means that you must declare the size of all 16 bit
-encodings.
+In the case of a matrix encoding, a `<tt/FIRSTINDEX/' may be included
+to specify the minimum glyph index in an encoding. The keyword
+`<tt/FIRSTINDEX/' is followed by two integers, the minimum row number
+followed by the minimum column number:
+<tscreen>
+FIRSTINDEX 0x20 0x20
+</tscreen>
+In the case of a linear encoding, a `<tt/FIRSTINDEX/' line should
+usually not be included. If for some reason however it is desired
+that it should be included, it should be followed by a single integer.
+
+Note that in some font backends inclusion of a `<tt/FIRSTINDEX/' line
+has the side effect of disabling default glyph generation, and this
+keyword should therefore be avoided unless absolutely necessary.
+
+Codes outside the region defined by the `<tt/SIZE/' and
+`<tt/FIRSTINDEX/' lines are supposed to be undefined. Encodings
+default to linear encoding with a size of 256 (0x100). This means
+that you must declare the size of all 16 bit encodings.
What follows is one or more mapping sections. A mapping section
starts with a `<tt/STARTMAPPING/' line stating the target of the mapping.
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre b/xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre
index fd174e9f0..fc3fb96e4 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre
@@ -8,10 +8,10 @@
<!-- Title information -->
<title>Documentation for XFree86&trade; version &relvers;
<author>The XFree86 Project, Inc
-<date>30 June 2000
+<date>December 2000
<!--
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre,v 1.8 2000/06/30 22:09:37 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/index.pre,v 1.9 2000/11/28 20:59:17 dawes Exp $
-->
<p>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml
index 1687a31be..be41aa45a 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml
@@ -8,14 +8,14 @@
<date>10 Jul 1999
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.2 1999/07/10 12:17:25 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.3 2000/11/28 20:59:17 dawes Exp $
</ident>
<toc>
<sect> Supported hardware
<p>
-The s3virge driver in XFree86 &relvers; supports the S3 ViRGE, ViRGE DX, GX, MX, MX+, and VX chipsets. A majority of testing is done on ViRGE DX chips, making them the most stable to date. This release has improved support for 24 bit color depths and resolves all the known issues with Netscape and other applications supporting 24 bit color.
+The s3virge driver in XFree86 &relvers; supports the S3 ViRGE, ViRGE DX, GX, MX, MX+, and VX chipsets. A majority of testing is done on ViRGE DX chips, making them the most stable to date. This release has improved support for ViRGE GX2 stability, XVideo support for ViRGE DX (tested) and ViRGE (untested) in depth 16 and 24, conversion to fb framebuffer rendering, and support for the new Render extension (untested).
This driver is moderately stable, however please use caution with any new install. Please report any problems to
<email>XFree86@Xfree86.org</email>
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/Imakefile
index e2d18d1ef..0e68e1e9f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.19 2000/11/02 21:29:29 tsi Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.20 2000/11/28 20:59:17 dawes Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -15,7 +15,7 @@ OBJS = apm/?*_drv.o ati/?*_drv.o chips/?*_drv.o cirrus/?*_drv.o \
i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \
nv/?*_drv.o rendition/?*_drv.o s3virge/?*_drv.o sis/?*_drv.o \
tdfx/?*_drv.o tga/?*_drv.o trident/?*_drv.o tseng/?*_drv.o \
- vesa/?*_drv.o vga/?*_drv.o
+ vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c
index d0956d30c..7f346ba18 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.44 2000/06/30 18:34:18 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.45 2000/11/22 04:32:12 tsi Exp $ */
#include "apm.h"
@@ -172,6 +172,12 @@ static const char *ramdacSymbols[] = {
NULL
};
+static const char *vbeSymbols[] = {
+ "VBEInit",
+ "vbeDoEDID",
+ NULL
+};
+
static const char *ddcSymbols[] = {
"xf86PrintEDID",
"xf86DoEDID_DDC1",
@@ -235,7 +241,7 @@ apmSetup(pointer module, pointer opts, int *errmaj, int *errmain)
xf86AddDriver(&APM, module, 0);
LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols,
- /*xf8_32bppSymbols,*/ ramdacSymbols,
+ /*xf8_32bppSymbols,*/ ramdacSymbols, vbeSymbols,
ddcSymbols, i2cSymbols, shadowSymbols, NULL);
return (pointer)1;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile
new file mode 100644
index 000000000..ba5216709
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile
@@ -0,0 +1,49 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile,v 1.5 2000/11/15 23:13:08 dawes Exp $
+/*
+ *
+ * Copyright 2000 Ani Joshi <ajoshi@unixbox.com>
+ *
+ */
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS = ark_driver.c ark_accel.c
+
+OBJS = ark_driver.o ark_accel.o
+
+#if defined(XF86DriverSDK)
+INCLUDES = -I. -I../../include
+#else
+INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
+ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \
+ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \
+ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \
+ -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \
+ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \
+ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \
+ -I$(XF86SRC)/fbdevhw -I$(XF86SRC)/ddc \
+ -I$(XF86SRC)/i2c \
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \
+ -I$(EXTINCSRC) -I$(SERVERSRC)/render
+#endif
+
+#if MakeHasPosixVariableSubstitutions
+SubdirLibraryRule($(OBJS))
+#endif
+
+NormalAsmObjectRule()
+
+ModuleObjectRule()
+ObjectModuleTarget(ark, $(OBJS))
+
+InstallObjectModule(ark,$(MODULEDIR),drivers)
+
+DependTarget()
+
+InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/ark)
+InstallDriverSDKNonExecFile(ark.h,$(DRIVERSDKDIR)/drivers/ark)
+InstallDriverSDKNonExecFile(ark_reg.h,$(DRIVERSDKDIR)/drivers/ark)
+InstallDriverSDKNonExecFile(ark_driver.c,$(DRIVERSDKDIR)/drivers/ark)
+InstallDriverSDKNonExecFile(ark_accel.c,$(DRIVERSDKDIR)/drivers/ark)
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h
new file mode 100644
index 000000000..6a95f8039
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h
@@ -0,0 +1,71 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h,v 1.1 2000/11/14 17:28:12 dawes Exp $ */
+/*
+ * ark
+ */
+
+#ifndef _ARK_H
+#define _ARK_H
+
+#include "xf86.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "xaa.h"
+#include "xf86_ansic.h"
+#include "vgaHW.h"
+
+typedef struct _ARKRegRec {
+ unsigned char sr10, sr11, sr12, sr13, sr14,
+ sr15, sr16, sr17, sr18, sr20,
+ sr21, sr22, sr23, sr24, sr25,
+ sr26, sr27, sr28, sr29, sr2a,
+ sr2b;
+ unsigned char sr1c, sr1d;
+ unsigned char cr40, cr41, cr42, cr44, cr46;
+ unsigned char dac_command;
+ unsigned char stg_17xx[3];
+ unsigned char gendac[6];
+} ARKRegRec, *ARKRegPtr;
+
+
+typedef struct _ARKRec {
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+ EntityInfoPtr pEnt;
+ CARD32 IOAddress;
+ CARD32 FBAddress;
+ unsigned char * FBBase;
+ unsigned char * MMIOBase;
+ unsigned long videoRam;
+ OptionInfoPtr Options;
+ unsigned int Flags;
+ Bool NoAccel;
+ CARD32 Bus;
+ XAAInfoRecPtr pXAA;
+ int Chipset, ChipRev;
+ int clock_mult;
+ int dac_width;
+ int multiplex_threshold;
+ int ramdac;
+ ARKRegRec SavedRegs; /* original mode */
+ ARKRegRec ModeRegs; /* current mode */
+ Bool (*CloseScreen)(int, ScreenPtr);
+} ARKRec, *ARKPtr;
+
+
+#define ARKPTR(p) ((ARKPtr)((p)->driverPrivate))
+
+
+#define DRIVER_NAME "ark"
+#define DRIVER_VERSION "0.5.0"
+#define VERSION_MAJOR 0
+#define VERSION_MINOR 5
+#define PATCHLEVEL 0
+#define ARK_VERSION ((VERSION_MAJOR << 24) | \
+ (VERSION_MINOR << 16) | \
+ PATCHLEVEL)
+
+#define ZOOMDAC 0x404
+#define ATT490 0x101
+
+
+#endif /* _ARK_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c
new file mode 100644
index 000000000..c2cefce63
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c
@@ -0,0 +1,227 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c,v 1.4 2000/11/15 23:13:09 dawes Exp $ */
+/*
+ * Copyright 2000 Ani Joshi <ajoshi@unixbox.com>
+ *
+ * XFree86 4.x driver for ARK Logic chipset
+ *
+ * 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 Ani Joshi not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Ani Joshi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as-is" without express or implied warranty.
+ *
+ * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANI JOSHI 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.
+ *
+ *
+ * Based on the 3.3.x driver by:
+ * Harm Hanemaayer <H.Hanemaayer@inter.nl.net>
+ *
+ */
+
+
+#include "Xarch.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xaa.h"
+#include "xf86PciInfo.h"
+#include "compiler.h"
+
+#include "ark.h"
+#include "ark_reg.h"
+
+
+int curx, cury, cmd_flags;
+
+
+static void ARKSync(ScrnInfoPtr pScrn)
+{
+ for (;;) {
+ if (!(inb(0x3cb) & 0x40))
+ break;
+ }
+}
+
+
+static void ARKSetupForSolidFill(ScrnInfoPtr pScrn, int color,
+ int rop, unsigned int planemask)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+
+ OUTREG16(FG_COLOR, color);
+ /* ARK color mix matches X raster-ops */
+ OUTREG16(COLOR_MIX_SEL, (rop | (rop << 8)));
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ if ((planemask & 0xff) == 0xff)
+ cmd_flags = DISABLE_PLANEMASK;
+ else {
+ OUTREG16(WRITE_PLANEMASK, planemask);
+ cmd_flags = 0;
+ }
+ break;
+ case 16:
+ if ((planemask & 0xffff) == 0xffff)
+ cmd_flags = DISABLE_PLANEMASK;
+ else {
+ OUTREG16(WRITE_PLANEMASK, planemask);
+ cmd_flags = 0;
+ }
+ break;
+ case 32:
+ OUTREG16(FG_COLOR_HI, color >> 16);
+ if ((planemask & 0xffffff) == 0xffffff)
+ cmd_flags = DISABLE_PLANEMASK;
+ else {
+ OUTREG16(WRITE_PLANEMASK, planemask);
+ cmd_flags = 0;
+ }
+ break;
+ }
+
+ curx = cury = -1;
+}
+
+
+static void ARKSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x,
+ int y, int w, int h)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+ int dst_addr;
+
+ OUTREG(WIDTH, ((h - 1) << 16) | (w - 1));
+ if (x != curx || y != cury) {
+ dst_addr = y * pScrn->displayWidth + x;
+ OUTREG(DST_ADDR, dst_addr);
+ curx = x;
+ cury = y;
+ }
+ OUTREG16(COMMAND, SELECT_BG_COLOR | SELECT_FG_COLOR |
+ STENCIL_ONES | DISABLE_CLIPPING | BITBLT |
+ cmd_flags);
+ cury += h;
+}
+
+
+
+static void ARKSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
+ int ydir, int rop, unsigned int planemask,
+ int trans_color)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+
+ cmd_flags = 0;
+ if (trans_color != -1) {
+ if (pScrn->bitsPerPixel <= 16)
+ OUTREG16(TRANS_COLOR, trans_color);
+ else {
+ OUTREG16(TRANS_COLOR, trans_color & 0xffff);
+ OUTREG16(TRANS_COLOR_HI, trans_color >> 16);
+ }
+ cmd_flags = STENCIL_GENERATED;
+ OUTREG16(COLOR_MIX_SEL, rop | 0x0500);
+ } else {
+ OUTREG16(COLOR_MIX_SEL, rop | (rop << 8));
+ }
+
+ if (ydir < 0)
+ cmd_flags |= UP;
+ if (xdir < 0)
+ cmd_flags |= LEFT;
+
+ /* yes, quite ugly */
+ if ((pScrn->bitsPerPixel == 8 && (planemask & 0xff) == 0xff) ||
+ (pScrn->bitsPerPixel == 16 && (planemask & 0xffff) == 0xffff) ||
+ (pScrn->bitsPerPixel == 32 && (planemask & 0xffffff) == 0xffffff))
+ cmd_flags |= DISABLE_PLANEMASK;
+ else
+ OUTREG16(WRITE_PLANEMASK, planemask);
+
+}
+
+
+
+static void ARKSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2,
+ int w, int h)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+ int src_addr, dst_addr;
+
+ if (cmd_flags & UP) {
+ src_addr = (y1 + h - 1) * pScrn->displayWidth;
+ dst_addr = (y2 + h - 1) * pScrn->displayWidth;
+ } else {
+ src_addr = y1 * pScrn->displayWidth;
+ dst_addr = y2 * pScrn->displayWidth;
+ }
+ if (cmd_flags & LEFT) {
+ src_addr += x1 + w - 1;
+ dst_addr += x2 + w - 1;
+ } else {
+ src_addr += x1;
+ dst_addr += x2;
+ }
+
+ OUTREG(SRC_ADDR, src_addr);
+ OUTREG(DST_ADDR, dst_addr);
+ OUTREG(WIDTH, ((h - 1) << 16) | (w - 1));
+ OUTREG16(COMMAND, BG_BITMAP | FG_BITMAP | DISABLE_CLIPPING |
+ BITBLT | cmd_flags);
+}
+
+
+
+Bool ARKAccelInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ARKPtr pARK = ARKPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ XAAInfoRecPtr pXAA;
+
+ if (!(pXAA = XAACreateInfoRec()))
+ return FALSE;
+
+ pXAA->Flags = LINEAR_FRAMEBUFFER;
+
+ pXAA->Sync = ARKSync;
+ pXAA->SetupForSolidFill = ARKSetupForSolidFill;
+ pXAA->SubsequentSolidFillRect = ARKSubsequentSolidFillRect;
+ pXAA->ScreenToScreenCopyFlags = 0;
+ pXAA->SetupForScreenToScreenCopy = ARKSetupForScreenToScreenCopy;
+ pXAA->SubsequentScreenToScreenCopy = ARKSubsequentScreenToScreenCopy;
+
+ OUTREG16(COLOR_MIX_SEL, 0x0303);
+ if (pARK->Chipset == PCI_CHIP_1000PV) {
+ OUTREG16(WRITE_PLANEMASK, 0xffff);
+ OUTREG16(TRANS_COLOR_MSK, 0xffff);
+ } else {
+ OUTREG16(TRANS_COLOR, 0xffff);
+ OUTREG16(TRANS_COLOR, 0xffffffff >> 16);
+ }
+ if (pARK->Chipset == PCI_CHIP_1000PV && pScrn->bitsPerPixel == 32) {
+ OUTREG16(STENCIL_PITCH, pScrn->displayWidth * 2);
+ OUTREG16(SRC_PITCH, pScrn->displayWidth * 2);
+ OUTREG16(DST_PITCH, pScrn->displayWidth * 2);
+ } else {
+ OUTREG16(STENCIL_PITCH, pScrn->displayWidth);
+ OUTREG16(SRC_PITCH, pScrn->displayWidth);
+ OUTREG16(DST_PITCH, pScrn->displayWidth);
+ }
+
+ OUTREG16(BITMAP_CONFIG, LINEAR_STENCIL_ADDR | LINEAR_SRC_ADDR |
+ LINEAR_DST_ADDR);
+
+ return XAAInit(pScreen, pXAA);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c
new file mode 100644
index 000000000..b7e765b5c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c
@@ -0,0 +1,1170 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.8 2000/11/15 23:13:09 dawes Exp $ */
+/*
+ * Copyright 2000 Ani Joshi <ajoshi@unixbox.com>
+ *
+ * XFree86 4.x driver for ARK Logic chipset
+ *
+ * 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 Ani Joshi not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Ani Joshi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as-is" without express or implied warranty.
+ *
+ * ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANI JOSHI 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.
+ *
+ *
+ * Based on the 3.3.x driver by:
+ * Harm Hanemaayer <H.Hanemaayer@inter.nl.net>
+ *
+ */
+
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "xf86Version.h"
+#include "xf86Resources.h"
+#include "xf86fbman.h"
+#include "xf86cmap.h"
+#include "compiler.h"
+#include "xaa.h"
+#include "mipointer.h"
+#include "micmap.h"
+#include "mibstore.h"
+
+#include "ark.h"
+
+
+/*
+ * prototypes
+ */
+static OptionInfoPtr ARKAvailableOptions(int chipid, int busid);
+static void ARKIdentify(int flags);
+static Bool ARKProbe(DriverPtr drv, int flags);
+static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags);
+static Bool ARKEnterVT(int scrnIndex, int flags);
+static void ARKLeaveVT(int scrnIndex, int flags);
+static void ARKSave(ScrnInfoPtr pScrn);
+static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
+ char **argv);
+static Bool ARKMapMem(ScrnInfoPtr pScrn);
+static void ARKUnmapMem(ScrnInfoPtr pScrn);
+static Bool ARKModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static void ARKAdjustFrame(int scrnIndex, int x, int y, int flags);
+Bool ARKSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+Bool ARKCloseScreen(int scrnIndex, ScreenPtr pScreen);
+Bool ARKSaveScreen(ScreenPtr pScreen, int mode);
+static void ARKFreeScreen(int scrnIndex, int flags);
+static void ARKLoadPalette(ScrnInfoPtr pScrn, int numColors,
+ int *indicies, LOCO *colors,
+ VisualPtr pVisual);
+static void ARKWriteMode(ScrnInfoPtr pScrn, vgaRegPtr pVga, ARKRegPtr new);
+
+/* helpers */
+static unsigned char get_daccomm();
+static unsigned char set_daccom(unsigned char comm);
+
+
+DriverRec ARK =
+{
+ ARK_VERSION,
+ DRIVER_NAME,
+ ARKIdentify,
+ ARKProbe,
+ ARKAvailableOptions,
+ NULL,
+ 0
+};
+
+/* supported chipsets */
+static SymTabRec ARKChipsets[] = {
+ { PCI_CHIP_1000PV, "ark1000pv" },
+ { PCI_CHIP_2000PV, "ark2000pv" },
+ { PCI_CHIP_2000MT, "ark2000mt" },
+ { -1, NULL }
+};
+
+static PciChipsets ARKPciChipsets[] = {
+ { PCI_CHIP_1000PV, PCI_CHIP_1000PV, RES_SHARED_VGA },
+ { PCI_CHIP_2000PV, PCI_CHIP_2000PV, RES_SHARED_VGA },
+ { PCI_CHIP_2000MT, PCI_CHIP_2000MT, RES_SHARED_VGA },
+ { -1, -1, RES_UNDEFINED }
+};
+
+typedef enum {
+ OPTION_NOACCEL
+} ARKOpts;
+
+static OptionInfoRec ARKOptions[] = {
+ { OPTION_NOACCEL, "noaccel", OPTV_BOOLEAN, {0}, FALSE }
+};
+
+static const char *fbSymbols[] = {
+ "fbScreenInit",
+ NULL
+};
+
+static const char *vgaHWSymbols[] = {
+ "vgaHWGetHWRec",
+ "vgaHWFreeHWRec",
+ "vgaHWGetIOBase",
+ "vgaHWSave",
+ "vgaHWProtect",
+ "vgaHWRestore",
+ "vgaHWMapMem",
+ "vgaHWUnmapMem",
+ "vgaHWSaveScreen",
+ "vgaHWLock",
+ NULL
+};
+
+static const char *xaaSymbols[] = {
+ "XAACreateInfoRec",
+ "XAADestroyInfoRec",
+ "XAAInit",
+ "XAAScreenIndex",
+ NULL
+};
+
+#ifdef XFree86LOADER
+
+MODULESETUPPROTO(ARKSetup);
+
+static XF86ModuleVersionInfo ARKVersRec = {
+ "ark",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0, 0, 0, 0}
+};
+
+XF86ModuleData arkModuleData = { &ARKVersRec, ARKSetup, NULL };
+
+pointer ARKSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ xf86AddDriver(&ARK, module, 0);
+ LoaderRefSymLists(fbSymbols, vgaHWSymbols, xaaSymbols, NULL);
+ return (pointer) 1;
+ } else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+}
+
+#endif /* XFree86LOADER */
+
+
+static Bool ARKGetRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate)
+ return TRUE;
+
+ pScrn->driverPrivate = xnfcalloc(sizeof(ARKRec), 1);
+
+ return TRUE;
+}
+
+static void ARKFreeRec(ScrnInfoPtr pScrn)
+{
+ if (!pScrn->driverPrivate)
+ return;
+
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+}
+
+static OptionInfoPtr ARKAvailableOptions(int chipid, int busid)
+{
+ return ARKOptions;
+}
+
+static void ARKIdentify(int flags)
+{
+ xf86PrintChipsets("ark", "driver (version " DRIVER_VERSION " for ARK Logic chipset",
+ ARKChipsets);
+}
+
+static Bool ARKProbe(DriverPtr drv, int flags)
+{
+ int i;
+ GDevPtr *devSections = NULL;
+ int *usedChips;
+ int numDevSections;
+ int numUsed;
+ Bool foundScreen = FALSE;
+
+ /* sanity check */
+ if ((numDevSections = xf86MatchDevice("ark", &devSections)) <= 0)
+ return FALSE;
+
+ /* do ISA later */
+ numUsed = xf86MatchPciInstances("ark", PCI_VENDOR_ARK,
+ ARKChipsets, ARKPciChipsets,
+ devSections, numDevSections, drv,
+ &usedChips);
+
+ if (devSections)
+ xfree(devSections);
+
+ if (numUsed <= 0)
+ return FALSE;
+
+ if (flags & PROBE_DETECT)
+ foundScreen = TRUE;
+ else for (i=0; i<numUsed; i++) {
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
+
+ pScrn->driverVersion = VERSION_MAJOR;
+ pScrn->driverName = DRIVER_NAME;
+ pScrn->name = "ark";
+ pScrn->Probe = ARKProbe;
+ pScrn->PreInit = ARKPreInit;
+ pScrn->ScreenInit = ARKScreenInit;
+ pScrn->SwitchMode = ARKSwitchMode;
+ pScrn->AdjustFrame = ARKAdjustFrame;
+ pScrn->EnterVT = ARKEnterVT;
+ pScrn->LeaveVT = ARKLeaveVT;
+ pScrn->FreeScreen = ARKFreeScreen;
+ foundScreen = TRUE;
+ xf86ConfigActivePciEntity(pScrn, usedChips[i], ARKPciChipsets,
+ NULL, NULL, NULL, NULL, NULL);
+ }
+
+ xfree(usedChips);
+
+ return foundScreen;
+}
+
+
+static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags)
+{
+ EntityInfoPtr pEnt;
+ ARKPtr pARK;
+ vgaHWPtr hwp;
+ MessageType from = X_DEFAULT;
+ int i;
+ ClockRangePtr clockRanges;
+ char *mod = NULL;
+ const char *reqSym = NULL;
+ rgb zeros = {0, 0, 0};
+ Gamma gzeros = {0.0, 0.0, 0.0};
+ unsigned char tmp;
+
+ if (flags & PROBE_DETECT)
+ return FALSE;
+
+ if (!xf86LoadSubModule(pScrn, "vgahw"))
+ return FALSE;
+
+ xf86LoaderReqSymLists(vgaHWSymbols, NULL);
+
+ if (!vgaHWGetHWRec(pScrn))
+ return FALSE;
+
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb))
+ return FALSE;
+ else {
+ switch (pScrn->depth) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ /* OK */
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given depth (%d) is not supported by this driver\n",
+ pScrn->depth);
+ return FALSE;
+ }
+ }
+
+ xf86PrintDepthBpp(pScrn);
+
+ if (pScrn->depth > 8) {
+ if (!xf86SetWeight(pScrn, zeros, zeros))
+ return FALSE;
+ }
+
+ if (pScrn->depth == 8)
+ pScrn->rgbBits = 8;
+
+ if (!xf86SetDefaultVisual(pScrn, -1))
+ return FALSE;
+
+ pScrn->progClock = TRUE;
+
+ if (!ARKGetRec(pScrn))
+ return FALSE;
+
+ pARK = ARKPTR(pScrn);
+
+ xf86CollectOptions(pScrn, NULL);
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ARKOptions);
+
+ if (xf86ReturnOptValBool(ARKOptions, OPTION_NOACCEL, FALSE)) {
+ pARK->NoAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - acceleration disabled\n");
+ } else
+ pARK->NoAccel = FALSE;
+
+ if (pScrn->numEntities > 1) {
+ ARKFreeRec(pScrn);
+ return FALSE;
+ }
+
+ pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (pEnt->resources) {
+ xfree(pEnt);
+ ARKFreeRec(pScrn);
+ return FALSE;
+ }
+
+ pARK->PciInfo = xf86GetPciInfoForEntity(pEnt->index);
+ xf86RegisterResources(pEnt->index, NULL, ResNone);
+ xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr);
+ xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr);
+
+ if (pEnt->device->chipset && *pEnt->device->chipset) {
+ pScrn->chipset = pEnt->device->chipset;
+ pARK->Chipset = xf86StringToToken(ARKChipsets, pScrn->chipset);
+ } else if (pEnt->device->chipID >= 0) {
+ pARK->Chipset = pEnt->device->chipID;
+ pScrn->chipset = (char *)xf86TokenToString(ARKChipsets,
+ pARK->Chipset);
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n",
+ pARK->Chipset);
+ } else {
+ pARK->Chipset = pARK->PciInfo->chipType;
+ pScrn->chipset = (char *)xf86TokenToString(ARKChipsets,
+ pARK->Chipset);
+ }
+
+ if (pEnt->device->chipRev >= 0) {
+ pARK->ChipRev = pEnt->device->chipRev;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
+ pARK->ChipRev);
+ } else
+ pARK->ChipRev = pARK->PciInfo->chipRev;
+
+ xfree(pEnt);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Chipset: \"%s\"\n", pScrn->chipset);
+
+ pARK->PciTag = pciTag(pARK->PciInfo->bus, pARK->PciInfo->device,
+ pARK->PciInfo->func);
+
+ /* unlock CRTC[0-7] */
+ outb(hwp->IOBase + 4, 0x11);
+ tmp = inb(hwp->IOBase + 5);
+ outb(hwp->IOBase + 5, tmp & 0x7f);
+ modinx(0x3c4, 0x1d, 0x01, 0x01);
+
+ /* use membase's later on ??? */
+ pARK->FBAddress = (rdinx(0x3c4, 0x13) << 16) +
+ (rdinx(0x3c4, 0x14) << 24);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%x\n",
+ pARK->FBAddress);
+
+ if (!xf86SetGamma(pScrn, gzeros))
+ return FALSE;
+
+ if (!pScrn->videoRam) {
+ unsigned char sr10;
+
+ sr10 = rdinx(0x3c4, 0x10);
+ if (pARK->Chipset == PCI_CHIP_1000PV) {
+ if ((sr10 & 0x40) == 0)
+ pScrn->videoRam = 1024;
+ else
+ pScrn->videoRam = 2048;
+ }
+ if (pARK->Chipset == PCI_CHIP_2000PV ||
+ pARK->Chipset == PCI_CHIP_2000MT) {
+ if ((sr10 & 0xc0) == 0)
+ pScrn->videoRam = 1024;
+ else if ((sr10 & 0xc0) == 0x40)
+ pScrn->videoRam = 2048;
+ else
+ pScrn->videoRam = 4096;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %d bytes video ram\n",
+ pScrn->videoRam);
+
+ /* try to detect the RAMDAC */
+ {
+ int man_id, dev_id;
+
+ inb(0x3c6); /* skip command register */
+ man_id = inb(0x3c6); /* manufacturer id */
+ dev_id = inb(0x3c6); /* device id */
+ if (man_id == 0x84 && dev_id == 0x98) {
+ pARK->ramdac = ZOOMDAC;
+ pARK->dac_width = 16;
+ pARK->multiplex_threshold = 40000;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected ZOOMDAC\n");
+ }
+ }
+
+ /* hack for this Bali32 */
+ pARK->ramdac = ATT490;
+ pARK->dac_width = 8;
+
+ pARK->clock_mult = 1;
+ if (pARK->dac_width == 16) {
+ if (pScrn->bitsPerPixel == 32)
+ pARK->clock_mult = 2;
+ }
+
+ pScrn->numClocks = 1;
+ pScrn->clock[0] = 80000; /* safe */
+
+ clockRanges = xnfcalloc(sizeof(ClockRange), 1);
+ clockRanges->next = NULL;
+ clockRanges->minClock = 20000;
+ clockRanges->maxClock = 80000;
+ clockRanges->clockIndex = -1;
+ clockRanges->interlaceAllowed = FALSE; /* ? */
+ clockRanges->doubleScanAllowed = FALSE; /* ? */
+
+ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ pScrn->display->modes, clockRanges,
+ NULL, 256, 2048, pScrn->bitsPerPixel,
+ 128, 2048, pScrn->virtualX,
+ pScrn->display->virtualY, pARK->videoRam * 1024,
+ LOOKUP_BEST_REFRESH);
+ if (i == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "no valid modes left\n");
+ ARKFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86PruneDriverModes(pScrn);
+
+ if (i == 0 || pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "no valid modes found\n");
+ ARKFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86SetCrtcForModes(pScrn, 0);
+ pScrn->currentMode = pScrn->modes;
+ xf86PrintModes(pScrn);
+ xf86SetDpi(pScrn, 0, 0);
+
+ xf86LoadSubModule(pScrn, "fb");
+ xf86LoaderReqSymbols("fbScreenInit", NULL);
+
+ if (!pARK->NoAccel) {
+ xf86LoadSubModule(pScrn, "xaa");
+ xf86LoaderReqSymLists(xaaSymbols, NULL);
+ }
+
+ return TRUE;
+}
+}
+
+static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
+ char **argv)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ARKPtr pARK = ARKPTR(pScrn);
+ BoxRec MemBox;
+ int i;
+
+ pScrn->fbOffset = 0;
+
+ if (!ARKMapMem(pScrn)) {
+ ARKFreeRec(pScrn);
+ return FALSE;
+ }
+
+ ARKSave(pScrn);
+
+/* vgaHWBlankScreen(pScrn, TRUE); */
+
+ if (!ARKModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+
+ ARKSaveScreen(pScreen, SCREEN_SAVER_ON);
+
+ pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ miClearVisualTypes();
+ if (pScrn->bitsPerPixel > 8) {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ } else {
+ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ }
+
+ if (!fbScreenInit(pScreen, pARK->FBBase, pScrn->virtualX,
+ pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth, pScrn->bitsPerPixel))
+ return FALSE;
+
+ xf86SetBlackWhitePixels(pScreen);
+
+ if (pScrn->bitsPerPixel > 8) {
+ VisualPtr pVis;
+
+ pVis = pScreen->visuals + pScreen->numVisuals;
+ while (--pVis >= pScreen->visuals) {
+ if ((pVis->class | DynamicClass) == DirectColor) {
+ pVis->offsetRed = pScrn->offset.red;
+ pVis->offsetGreen = pScrn->offset.green;
+ pVis->offsetBlue = pScrn->offset.blue;
+ pVis->redMask = pScrn->mask.red;
+ pVis->greenMask = pScrn->mask.green;
+ pVis->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+
+ miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+
+ if (!pARK->NoAccel) {
+ if (ARKAccelInit(pScreen)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR, "Acceleration initialization failed\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ }
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ }
+
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+
+ if (!xf86HandleColormaps(pScreen, 256, 8, ARKLoadPalette, NULL,
+ CMAP_RELOAD_ON_MODE_SWITCH))
+ return FALSE;
+
+/* vgaHWBlankScreen(pScrn, TRUE); */
+
+ pScreen->SaveScreen = ARKSaveScreen;
+ pARK->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = ARKCloseScreen;
+
+ return TRUE;
+}
+
+
+
+static void ARKSave(ScrnInfoPtr pScrn)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+ ARKRegPtr save = &pARK->SavedRegs;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int vgaIOBase = hwp->IOBase;
+
+ vgaHWUnlock(hwp);
+ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL);
+ vgaHWLock(hwp);
+
+ /* set read and write aperture index to 0 */
+ wrinx(0x3c4, 0x15, 0x00);
+ wrinx(0x3c4, 0x16, 0x00);
+ outb(0x3c8, 0); /* reset DAC register access mode */
+
+ save->sr10 = rdinx(0x3c4, 0x10);
+ save->sr11 = rdinx(0x3c4, 0x11);
+ save->sr12 = rdinx(0x3c4, 0x12);
+ save->sr13 = rdinx(0x3c4, 0x13);
+ save->sr14 = rdinx(0x3c4, 0x14);
+ save->sr15 = rdinx(0x3c4, 0x15);
+ save->sr16 = rdinx(0x3c4, 0x16);
+ save->sr17 = rdinx(0x3c4, 0x17);
+ save->sr18 = rdinx(0x3c4, 0x18);
+
+#if 0
+ save->sr1d = rdinx(0x3c4, 0x1d);
+ save->sr1c = rdinx(0x3c4, 0x1c);
+
+ save->sr20 = rdinx(0x3c4, 0x20);
+ save->sr21 = rdinx(0x3c4, 0x21);
+ save->sr22 = rdinx(0x3c4, 0x22);
+ save->sr23 = rdinx(0x3c4, 0x23);
+ save->sr24 = rdinx(0x3c4, 0x24);
+ save->sr25 = rdinx(0x3c4, 0x25);
+ save->sr26 = rdinx(0x3c4, 0x26);
+ save->sr27 = rdinx(0x3c4, 0x27);
+ save->sr29 = rdinx(0x3c4, 0x29);
+ save->sr2a = rdinx(0x3c4, 0x2a);
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT)) {
+ save->sr28 = rdinx(0x3c4, 0x28);
+ save->sr2b = rdinx(0x3c4, 0x2b);
+ }
+#endif
+
+ save->cr40 = rdinx(vgaIOBase + 4, 0x40);
+ save->cr41 = rdinx(vgaIOBase + 4, 0x41);
+ save->cr42 = rdinx(vgaIOBase + 4, 0x42);
+ save->cr44 = rdinx(vgaIOBase + 4, 0x44);
+
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT))
+ save->cr46 = rdinx(vgaIOBase + 4, 0x46);
+
+ /* save RAMDAC regs here, based on type */
+ save->dac_command = get_daccomm();
+}
+
+
+
+static Bool ARKModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+ ARKRegPtr new = &pARK->ModeRegs;
+ int multiplexing, dac16, modepitch;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr pVga = &hwp->ModeReg;
+ int vgaIOBase = hwp->IOBase;
+ unsigned char tmp;
+ int offset;
+
+ multiplexing = 0;
+
+ if ((pScrn->bitsPerPixel == 8) && (pARK->dac_width == 16) &&
+ (mode->Clock > pARK->multiplex_threshold))
+ multiplexing = 1;
+
+ if (pARK->clock_mult == 2) {
+ if (!mode->CrtcHAdjusted) {
+ mode->CrtcHDisplay <<= 1;
+ mode->CrtcHSyncStart <<= 1;
+ mode->CrtcHSyncEnd <<= 1;
+ mode->CrtcHTotal <<= 1;
+ mode->CrtcHSkew <<= 1;
+ mode->CrtcHAdjusted = TRUE;
+ }
+ }
+
+ if (multiplexing) {
+ if (!mode->CrtcHAdjusted) {
+ mode->CrtcHDisplay >>= 1;
+ mode->CrtcHSyncStart >>= 1;
+ mode->CrtcHSyncEnd >>= 1;
+ mode->CrtcHTotal >>= 1;
+ mode->CrtcHSkew >>= 1;
+ mode->CrtcHAdjusted = TRUE;
+ }
+ }
+
+ if (!vgaHWInit(pScrn, mode))
+ return FALSE;
+
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT)) {
+ new->cr46 = rdinx(vgaIOBase + 4, 0x46) & ~0x04;
+ dac16 = 0;
+ if (pScrn->bitsPerPixel > 8)
+ dac16 = 1;
+ if (dac16)
+ new->cr46 |= 0x04;
+ }
+
+ offset = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3;
+ pVga->CRTC[0x13] = offset;
+ pVga->Attribute[0x11] = 0x00;
+ new->cr41 = (offset & 0x100) >> 5;
+
+ pVga->MiscOutReg |= 0x0c;
+
+ new->sr11 = rdinx(0x3c4, 0x11) & ~0x0f;
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ new->sr11 |= 0x06;
+ break;
+ case 16:
+ new->sr11 |= 0x0a;
+ break;
+ case 24:
+ new->sr11 |= 0x06;
+ break;
+ case 32:
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT))
+ new->sr11 |= 0x0e;
+ else
+ new->sr11 |= 0x0a;
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unsupported screen depth %d\n",
+ pScrn->bitsPerPixel);
+ return FALSE;
+ }
+
+ switch (pScrn->displayWidth) {
+ case 640:
+ modepitch = 0;
+ break;
+ case 800:
+ modepitch = 1;
+ break;
+ case 1024:
+ modepitch = 2;
+ break;
+ case 1280:
+ modepitch = 4;
+ break;
+ case 1600:
+ modepitch = 5;
+ break;
+ case 2048:
+ modepitch = 6;
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unsupported screen width %d\n",
+ pScrn->displayWidth);
+ return FALSE;
+ }
+
+ new->sr17 &= ~0xc7;
+ new->sr17 |= modepitch;
+
+ new->sr10 = rdinx(0x3c4, 0x10) & ~0x1f;
+ new->sr10 |= 0x1f;
+
+ new->sr13 = pARK->FBAddress >> 16;
+ new->sr14 = pARK->FBAddress >> 24;
+
+ new->sr12 = rdinx(0x3c4, 0x12) & ~0x03;
+ switch (pScrn->videoRam) {
+ case 1024:
+ new->sr12 |= 0x01;
+ break;
+ case 2048:
+ new->sr12 |= 0x02;
+ break;
+ case 4096:
+ new->sr12 |= 0x03;
+ break;
+ default:
+ new->sr12 |= 0x01;
+ break;
+ }
+
+ new->sr15 = new->sr16 = 0;
+
+ tmp = 0;
+ if ((mode->CrtcVTotal - 2) & 0x400)
+ tmp |= 0x80;
+ if ((mode->CrtcVDisplay - 1) & 0x400)
+ tmp |= 0x40;
+ if (mode->CrtcVSyncStart & 0x400)
+ tmp |= 0x10;
+ new->cr40 = tmp;
+
+ tmp = new->cr41; /* initialized earlier */
+ if ((mode->CrtcHTotal / 8 - 5) & 0x100)
+ tmp |= 0x80;
+ if ((mode->CrtcHDisplay / 8 - 1) & 0x100)
+ tmp |= 0x40;
+ if ((mode->CrtcHSyncStart / 8 - 1) & 0x100)
+ tmp |= 0x20;
+ if ((mode->CrtcHSyncStart / 8) & 0x100)
+ tmp |= 0x10;
+ new->cr41 |= tmp;
+
+ new->cr44 = rdinx(vgaIOBase + 4, 0x44) & ~0x34;
+ new->cr44 &= ~0x01;
+ new->cr42 = 0;
+
+ /* check interlace here later */
+
+ /* set display FIFO threshold */
+ {
+ int threshold;
+ unsigned char tmp;
+ int bandwidthused, percentused;
+
+ /* mostly guesses here as I would need to know more about
+ * and from the ramdac...
+ */
+ bandwidthused = (mode->Clock / pARK->clock_mult) *
+ (pScrn->bitsPerPixel / 8);
+ /* 120000 is another guess */
+ percentused = (bandwidthused * 100) / 120000;
+ tmp = rdinx(0x3c4, 0x18);
+ if (pARK->Chipset == PCI_CHIP_1000PV) {
+ threshold = 4;
+ tmp |= 0x08; /* enable full FIFO (8 deep) */
+ tmp &= ~0x07;
+ tmp |= threshold;
+ }
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT)) {
+ threshold = 12;
+ if (percentused >= 45)
+ threshold = 8;
+ if (percentused >= 70)
+ threshold = 4;
+ tmp &= 0x40;
+ tmp |= 0x10;
+ tmp |= (threshold & 0x0e) >> 1;
+ if (threshold & 0x01)
+ tmp |= 0x80;
+ if (threshold & 0x10)
+ tmp |= 0x20;
+ }
+ new->sr18 = tmp;
+ }
+
+ /* setup the RAMDAC regs */
+ if (pARK->ramdac == ZOOMDAC) {
+ new->dac_command = 0x04;
+ if ((pScrn->bitsPerPixel == 8) && multiplexing)
+ new->dac_command = 0x24;
+ if ((pScrn->bitsPerPixel == 16) && (pARK->dac_width == 16))
+ /* assuming green weight is not 5 */
+ new->dac_command = 0x34;
+ if ((pScrn->bitsPerPixel == 16) && (pARK->dac_width == 8))
+ new->dac_command = 0x64;
+ if ((pScrn->bitsPerPixel == 24) && (pARK->dac_width == 16))
+ new->dac_command = 0xb4; /* packed */
+ if ((pScrn->bitsPerPixel == 32) && (pARK->dac_width == 16))
+ new->dac_command = 0x54;
+ } else if (pARK->ramdac == ATT490) {
+ new->dac_command = 0x00;
+ if (pScrn->bitsPerPixel == 16)
+ /* assuming green weight is 6 */
+ new->dac_command = 0xc0;
+ if (pScrn->bitsPerPixel == 24)
+ new->dac_command = 0xe0;
+ }
+
+ /* hrmm... */
+ new->dac_command |= 0x02;
+
+#if 0
+ /* hw cursor regs */
+ new->sr20 = rdinx(0x3c4, 0x20);
+ new->sr21 = rdinx(0x3c4, 0x21);
+ new->sr22 = rdinx(0x3c4, 0x22);
+ new->sr23 = rdinx(0x3c4, 0x23);
+ new->sr24 = rdinx(0x3c4, 0x24);
+ new->sr25 = rdinx(0x3c4, 0x25);
+ new->sr26 = rdinx(0x3c4, 0x26);
+ new->sr27 = rdinx(0x3c4, 0x27);
+ new->sr29 = rdinx(0x3c4, 0x29);
+ new->sr2a = rdinx(0x3c4, 0x2a);
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT)) {
+ new->sr28 = rdinx(0x3c4, 0x28);
+ new->sr2b = rdinx(0x3c4, 0x3b);
+ }
+#endif
+
+
+ ARKWriteMode(pScrn, pVga, new);
+
+ return TRUE;
+}
+
+
+static void ARKAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ARKPtr pARK = ARKPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int vgaIOBase = hwp->IOBase;
+ int base;
+
+ base = ((y * pScrn->displayWidth + x) *
+ (pScrn->bitsPerPixel / 8));
+
+ if (((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT)) &&
+ (pScrn->videoRam >= 2048))
+ base >>= 3;
+ else
+ base >>= 2;
+ if (pScrn->bitsPerPixel == 24)
+ base -= base % 3;
+
+ outw(vgaIOBase + 4, (base & 0x00ff00) | 0x0c);
+ outw(vgaIOBase + 4, ((base & 0x00ff) << 8) | 0x0d);
+
+ modinx(vgaIOBase + 4, 0x40, 0x07, (base & 0x070000) >> 16);
+}
+
+
+
+static void ARKWriteMode(ScrnInfoPtr pScrn, vgaRegPtr pVga, ARKRegPtr new)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int vgaIOBase = hwp->IOBase;
+
+ vgaHWProtect(pScrn, TRUE);
+
+ /* set read and write aperture index to 0 */
+ wrinx(0x3c4, 0x15, 0x00);
+ wrinx(0x3c4, 0x16, 0x00);
+
+ /* write the extended registers first so that textmode font
+ * restoration can suceed
+ */
+ wrinx(0x3c4, 0x10, new->sr10);
+ modinx(0x3c4, 0x11, 0x3f, new->sr11);
+ wrinx(0x3c4, 0x12, new->sr12);
+ wrinx(0x3c4, 0x13, new->sr13);
+ wrinx(0x3c4, 0x14, new->sr14);
+ wrinx(0x3c4, 0x15, new->sr15);
+ wrinx(0x3c4, 0x16, new->sr16);
+ wrinx(0x3c4, 0x17, new->sr17);
+
+#if 0
+ wrinx(0x3c4, 0x1c, new->sr1c);
+ wrinx(0x3c4, 0x1d, new->sr1d);
+
+ /* hw cursor regs */
+ wrinx(0x3c4, 0x20, new->sr20);
+ wrinx(0x3c4, 0x21, new->sr21);
+ wrinx(0x3c4, 0x22, new->sr22);
+ wrinx(0x3c4, 0x23, new->sr23);
+ wrinx(0x3c4, 0x24, new->sr24);
+ wrinx(0x3c4, 0x25, new->sr25);
+ wrinx(0x3c4, 0x26, new->sr26);
+ wrinx(0x3c4, 0x27, new->sr27);
+ wrinx(0x3c4, 0x29, new->sr29);
+ wrinx(0x3c4, 0x2a, new->sr2a);
+#endif
+
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT)) {
+ wrinx(0x3c4, 0x28, new->sr28);
+ wrinx(0x3c4, 0x2B, new->sr2b);
+ }
+
+ wrinx(vgaIOBase + 4, 0x40, new->cr40);
+ wrinx(vgaIOBase + 4, 0x41, new->cr41);
+ wrinx(vgaIOBase + 4, 0x42, new->cr42);
+ wrinx(vgaIOBase + 4, 0x44, new->cr44);
+
+ if ((pARK->Chipset == PCI_CHIP_2000PV) ||
+ (pARK->Chipset == PCI_CHIP_2000MT))
+ wrinx(vgaIOBase + 4, 0x46, new->cr46);
+
+ /* RAMDAC regs */
+ if (pARK->ramdac == ZOOMDAC) {
+ set_daccom(new->dac_command);
+ }
+
+ if (xf86IsPrimaryPci(pARK->PciInfo))
+ vgaHWRestore(pScrn, pVga, VGA_SR_ALL);
+ else
+ vgaHWRestore(pScrn, pVga, VGA_SR_MODE);
+
+ inb(0x3c8);
+ outb(0x3c6, 0xff);
+
+ vgaHWProtect(pScrn, FALSE);
+
+}
+
+
+static Bool ARKEnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ if (!ARKModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+
+ ARKAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ return TRUE;
+}
+
+
+
+static void ARKLeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ARKPtr pARK = ARKPTR(pScrn);
+ ARKRegPtr old = &pARK->SavedRegs;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ ARKWriteMode(pScrn, &hwp->ModeReg, old);
+
+ vgaHWUnlock(hwp);
+ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS);
+ vgaHWLock(hwp);
+
+ return;
+}
+
+
+static Bool ARKMapMem(ScrnInfoPtr pScrn)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ /* extended to cover MMIO space at 0xB8000 */
+ hwp->MapSize = 0x20000;
+
+ pARK->MMIOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO,
+ 0xb8000, 0x8000);
+
+ pARK->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+ pARK->PciTag, pARK->FBAddress,
+ pScrn->videoRam * 1024);
+ if (!pARK->FBBase) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Cound not map framebuffer\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static void ARKUnmapMem(ScrnInfoPtr pScrn)
+{
+ ARKPtr pARK = ARKPTR(pScrn);
+
+ vgaHWUnmapMem(pScrn);
+
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pARK->FBBase,
+ pScrn->videoRam * 1024);
+
+ return;
+}
+
+
+Bool ARKCloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ARKPtr pARK = ARKPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ if (pScrn->vtSema) {
+ vgaHWUnlock(hwp);
+ ARKWriteMode(pScrn, &hwp->SavedReg, &pARK->SavedRegs);
+ vgaHWLock(hwp);
+ ARKUnmapMem(pScrn);
+ }
+
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = pARK->CloseScreen;
+
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+}
+
+
+Bool ARKSaveScreen(ScreenPtr pScreen, int mode)
+{
+ return vgaHWSaveScreen(pScreen, mode);
+}
+
+
+Bool ARKSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ return ARKModeInit(xf86Screens[scrnIndex], mode);
+}
+
+
+static void ARKLoadPalette(ScrnInfoPtr pScrn, int numColors,
+ int *indicies, LOCO *colors,
+ VisualPtr pVisual)
+{
+ int i, index;
+
+ for (i=0; i<numColors; i++) {
+ index = indicies[i];
+ outb(0x3c8, index);
+ outb(0x3c9, colors[index].red);
+ outb(0x3c9, colors[index].green);
+ outb(0x3c9, colors[index].blue);
+ }
+}
+
+
+static void ARKFreeScreen(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ vgaHWFreeHWRec(pScrn);
+
+ ARKFreeRec(pScrn);
+}
+
+
+static unsigned char get_daccomm()
+{
+ unsigned char tmp;
+
+ outb(0x3c8, 0);
+ inb(0x3c6);
+ inb(0x3c6);
+ inb(0x3c6);
+ inb(0x3c6);
+ tmp = inb(0x3c6);
+ outb(0x3c8, 0);
+
+ return tmp;
+}
+
+
+static unsigned char set_daccom(unsigned char comm)
+{
+#if 0
+ outb(0x3c8, 0);
+#else
+ inb(0x3c8);
+#endif
+ inb(0x3c6);
+ inb(0x3c6);
+ inb(0x3c6);
+ inb(0x3c6);
+ outb(0x3c6, comm);
+#if 0
+ outb(0x3c8, 0);
+#else
+ inb(0x3c8);
+#endif
+
+ return inb(0x3c6);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h
new file mode 100644
index 000000000..43bb7838f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h
@@ -0,0 +1,88 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_reg.h,v 1.1 2000/11/14 17:28:13 dawes Exp $ */
+
+#ifndef _ARK_REG_H
+#define _ARK_REG_H
+
+/* and let there be no 'u' in color */
+#define BG_COLOR 0x00
+#define FG_COLOR 0x02
+#define BG_COLOR_HI 0x04
+#define FG_COLOR_HI 0x06
+#define TRANS_COLOR 0x08
+#define TRANS_COLOR_MSK 0x0a
+#define TRANS_COLOR_HI 0x0c
+#define TRANS_COLOR_MSK_HI 0x0e
+#define COLOR_MIX_SEL 0x18
+#define WRITE_PLANEMASK 0x1a
+#define ERROR_TERM 0x50
+#define AXIAL_ERROR_INC 0x54
+#define STENCIL_PITCH 0x60
+#define SRC_PITCH 0x62
+#define DST_PITCH 0x64
+#define STENCIL_ADDR 0x68
+#define STENCIL_X 0x68
+#define STENCIL_Y 0x6a
+#define SRC_ADDR 0x6c
+#define SRC_X 0x6c
+#define SRC_Y 0x6e
+#define DST_ADDR 0x70
+#define DST_X 0x70
+#define DST_Y 0x72
+#define WIDTH 0x74
+#define HEIGHT 0x76
+#define BITMAP_CONFIG 0x7c
+#define COMMAND 0x7e
+
+
+/* constants for COMMAND register */
+
+#define DRAWSTEP 0x0000
+#define LINEDRAW 0x1000
+#define BITBLT 0x2000
+#define TEXTBITBLT 0x3000
+#define USE_PLANEMASK 0x0000
+#define DISABLE_PLANEMASK 0x0800
+#define PATTERN_8X8 0x0400
+#define SELECT_BG_COLOR 0x0000
+#define BG_BITMAP 0x0200
+#define SELECT_FG_COLOR 0x0000
+#define FG_BITMAP 0x0100
+#define STENCIL_ONES 0x0000
+#define STENCIL_GENERATED 0x0040
+#define STENCIL_BITMAP 0x0080
+#define LINE_DRAWALL 0x0000
+#define LINE_SKIP_FIRST 0x0010
+#define LINE_SKIP_LAST 0x0020
+#define ENABLE_CLIPPING 0x0000
+#define DISABLE_CLIPPING 0x0008
+#undef DOWN
+#define DOWN 0x0000
+#undef UP
+#define UP 0x0002
+#define RIGHT 0x0000
+#define LEFT 0x0004
+#define DX_GREATER_THAN_DY 0x0000
+#define DY_GREATER_THAN_DX 0x0001
+
+
+/* constants for bitmap config register */
+
+#define SWAP_NIBLES 0x2000
+#define SWAP_BITS 0x1000
+#define SYSTEM_STENCIL 0x0200
+#define LINEAR_STENCIL_ADDR 0x0100
+#define SYSTEM_SRC 0x0020
+#define LINEAR_SRC_ADDR 0x0010
+#define SYSTEM_DST 0x0002
+#define LINEAR_DST_ADDR 0x0001
+
+
+/* IO macros */
+
+#define OUTREG16(offset, value) \
+ *(unsigned short *)(pARK->MMIOBase + offset) = value
+#define OUTREG(offset, value) \
+ *(unsigned int *)(pARK->MMIOBase + offset) = value
+
+
+#endif /* _ARK_REG_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h
index 7c5c5ed43..41624f25c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.1 2000/11/02 16:55:29 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.3 2000/11/18 19:37:10 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -38,48 +38,24 @@
#ifndef _R128_H_
#define _R128_H_
- /* Xv support */
-#include "xf86xv.h"
-#include "Xv.h"
-
- /* vgahw module (for VC save/restore only) */
-#include "vgaHW.h"
+#include "xf86str.h"
-#include "fbdevhw.h"
+ /* PCI support */
+#include "xf86Pci.h"
/* XAA and Cursor Support */
#include "xaa.h"
-#include "xaalocal.h"
#include "xf86Cursor.h"
-
- /* PCI support */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* VESA support */
-#include "vbe.h"
+ /* Xv support */
+#include "xf86xv.h"
/* DRI support */
#ifdef XF86DRI
-#include "GL/glxint.h"
-#include "GL/glxtokens.h"
-#include "xf86drm.h"
-#include "xf86drmR128.h"
-#include "sarea.h"
#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
#include "r128_dripriv.h"
-#include "r128_sarea.h"
-#endif
-
-#ifdef RENDER
-#include "picturestr.h"
+#include "dri.h"
+#include "GL/glxint.h"
#endif
#define R128_DEBUG 0 /* Turn off debugging output */
@@ -380,7 +356,7 @@ extern void R128WaitForIdle(ScrnInfoPtr pScrn);
extern void R128EngineReset(ScrnInfoPtr pScrn);
extern void R128EngineFlush(ScrnInfoPtr pScrn);
-extern int R128INPLL(ScrnInfoPtr pScrn, int addr);
+extern unsigned R128INPLL(ScrnInfoPtr pScrn, int addr);
extern void R128WaitForVerticalSync(ScrnInfoPtr pScrn);
extern Bool R128AccelInit(ScreenPtr pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
index a62a7a8ef..a42e97ab5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.1 2000/11/02 16:55:30 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.3 2000/11/18 19:37:10 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -80,23 +80,20 @@
#define R128_IMAGEWRITE 0 /* Disable ImageWrites - faster in software */
#define R128_TRAPEZOIDS 0 /* Trapezoids don't work */
- /* X and server generic header files */
-#include "Xarch.h"
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86fbman.h"
+ /* Driver data structures */
+#include "r128.h"
+#include "r128_reg.h"
+#ifdef XF86DRI
+#define _XF86DRI_SERVER_
+#include "r128_dri.h"
+#include "xf86drmR128.h"
+#endif
/* Line support */
#include "miline.h"
- /* XAA and cursor support */
-#include "xaa.h"
-#include "xf86Cursor.h"
-
- /* Driver data structures */
-#include "r128.h"
-#include "r128_reg.h"
+ /* X and server generic header files */
+#include "xf86.h"
static struct {
int rop;
@@ -568,8 +565,8 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
/* Subsequent XAA screen-to-screen copy. */
static void R128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
- int x1, int y1,
- int x2, int y2,
+ int xa, int ya,
+ int xb, int yb,
int w, int h)
{
R128InfoPtr info = R128PTR(pScrn);
@@ -579,12 +576,12 @@ static void R128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
R128CCE_TO_MMIO(pScrn, info);
#endif
- if (info->xdir < 0) x1 += w - 1, x2 += w - 1;
- if (info->ydir < 0) y1 += h - 1, y2 += h - 1;
+ if (info->xdir < 0) xa += w - 1, xb += w - 1;
+ if (info->ydir < 0) ya += h - 1, yb += h - 1;
R128WaitForFifo(pScrn, 3);
- OUTREG(R128_SRC_Y_X, (y1 << 16) | x1);
- OUTREG(R128_DST_Y_X, (y2 << 16) | x2);
+ OUTREG(R128_SRC_Y_X, (ya << 16) | xa);
+ OUTREG(R128_DST_Y_X, (yb << 16) | xb);
OUTREG(R128_DST_HEIGHT_WIDTH, (h << 16) | w);
}
@@ -1079,7 +1076,7 @@ void R128EngineInit(ScrnInfoPtr pScrn)
#ifdef XF86DRI
/* FIXME: When direct rendering is enabled, we should use the CCE to
draw 2D commands */
-static void R128CCEAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
+static void R128CCEAccelInit(XAAInfoRecPtr a)
{
a->Flags = 0;
@@ -1189,7 +1186,7 @@ Bool R128AccelInit(ScreenPtr pScreen)
#ifdef XF86DRI
/* FIXME: When direct rendering is enabled, we should use the CCE to
draw 2D commands */
- if (info->CCE2D) R128CCEAccelInit(pScrn, a);
+ if (info->CCE2D) R128CCEAccelInit(a);
else
#endif
R128MMIOAccelInit(pScrn, a);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c
index 7bd580fb0..e7bbd37ec 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.1 2000/11/02 16:55:31 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.3 2000/11/18 19:37:10 tsi Exp $ */
/*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
* VA Linux Systems Inc., Fremont, California.
*
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -44,43 +44,13 @@
*
*/
- /* X and server generic header files */
-#include "Xarch.h"
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86fbman.h"
-
- /* XAA and Cursor Support */
-#include "xaa.h"
-#include "xf86Cursor.h"
-
-#include "xf86xv.h"
-
- /* PCI support */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* DRI support */
-#ifdef XF86DRI
-#include "GL/glxint.h"
-#include "xf86drm.h"
-#include "sarea.h"
-#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
-#include "r128_dripriv.h"
-#include "r128_sarea.h"
-#endif
-
/* Driver data structures */
#include "r128.h"
#include "r128_reg.h"
+ /* X and server generic header files */
+#include "xf86.h"
+
#if X_BYTE_ORDER == X_BIG_ENDIAN
#define P_SWAP32( a , b ) \
((char *)a)[0] = ((char *)b)[3]; \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c
index 9bfc7daeb..d18cb18b6 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c
@@ -1,19 +1,17 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.1 2000/11/02 16:55:32 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.4 2000/11/21 23:10:33 tsi Exp $ */
/*
* Authors:
* Ove Kåven <ovek@transgaming.com>,
* borrowing some code from the Chips and MGA drivers.
*/
- /* X and server generic header files */
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86_ansic.h"
-
/* Driver data structures */
#include "r128.h"
#include "r128_probe.h"
+ /* X and server generic header files */
+#include "xf86.h"
+
/* DGA support */
#include "dgaproc.h"
@@ -294,7 +292,7 @@ R128_FillRect (
R128InfoPtr info = R128PTR(pScrn);
if(info->accel) {
- (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
+ (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0));
(*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h);
SET_SYNC_FLAG(info->accel);
}
@@ -314,7 +312,7 @@ R128_BlitRect(
int ydir = (srcy < dsty) ? -1 : 1;
(*info->accel->SetupForScreenToScreenCopy)(
- pScrn, xdir, ydir, GXcopy, ~0, -1);
+ pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1);
(*info->accel->SubsequentScreenToScreenCopy)(
pScrn, srcx, srcy, dstx, dsty, w, h);
SET_SYNC_FLAG(info->accel);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
index 9aafcccb7..0436f2795 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.2 2000/11/03 01:15:49 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.5 2000/11/21 23:10:33 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -37,36 +37,24 @@
*
*/
-
- /* X and server generic header files */
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86Resources.h"
-#include "xf86RAC.h"
-#include "xf86cmap.h"
-#include "xf86fbman.h"
-
- /* Backing store, software cursor, and
- colormap initialization */
-#include "mibstore.h"
-#include "mipointer.h"
-#include "micmap.h"
-
- /* CFB support */
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb16.h"
-#include "cfb24.h"
-#include "cfb32.h"
-#include "cfb24_32.h"
-
/* Driver data structures */
#include "r128.h"
+#include "r128_dri.h"
#include "r128_reg.h"
+#include "r128_sarea.h"
#include "r128_version.h"
+ /* X and server generic header files */
+#include "xf86.h"
+#include "windowstr.h"
+
+ /* GLX/DRI/DRM definitions */
+#define _XF86DRI_SERVER_
+#include "GL/glxtokens.h"
+#include "sarea.h"
+#include "xf86drmR128.h"
+
+
/* Initialize the visual configs that are supported by the hardware.
These are combined with the visual configs that the indirect
rendering core supports, and the intersection is exported to the
@@ -119,7 +107,7 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen)
for (stencil = 0; stencil <= R128_USE_STENCIL; stencil++) {
pR128ConfigPtrs[i] = &pR128Configs[i];
- pConfigs[i].vid = -1;
+ pConfigs[i].vid = (VisualID)(-1);
pConfigs[i].class = -1;
pConfigs[i].rgba = TRUE;
pConfigs[i].redSize = 5;
@@ -195,7 +183,7 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen)
for (stencil = 0; stencil <= R128_USE_STENCIL; stencil++) {
pR128ConfigPtrs[i] = &pR128Configs[i];
- pConfigs[i].vid = -1;
+ pConfigs[i].vid = (VisualID)(-1);
pConfigs[i].class = -1;
pConfigs[i].rgba = TRUE;
pConfigs[i].redSize = 8;
@@ -357,7 +345,7 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
pboxSave = pbox = REGION_RECTS(prgn);
nboxSave = nbox = REGION_NUM_RECTS(prgn);
- (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, -1);
+ (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, (CARD32)(-1));
for (; nbox; nbox--, pbox++) {
(*info->accel->SubsequentSolidFillRect)(pScrn,
pbox->x1 + info->fbX,
@@ -374,7 +362,7 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
pbox = pboxSave;
nbox = nboxSave;
- (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, -1);
+ (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, (CARD32)(-1));
for (; nbox; nbox--, pbox++)
(*info->accel->SubsequentSolidFillRect)(pScrn,
pbox->x1 + info->depthX,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h
index f0ae02c7e..97a561eae 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.1 2000/11/02 16:55:33 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -39,8 +39,7 @@
#ifndef _R128_DRI_
#define _R128_DRI_
-#include <xf86drm.h>
-#include <xf86drmR128.h>
+#include "xf86drm.h"
/* DRI Driver defaults */
#define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h
index 7c2ff59c7..7f8498799 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h,v 1.1 2000/11/02 16:55:34 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
/*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
* VA Linux Systems Inc., Fremont, California.
*
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -38,6 +38,8 @@
#ifndef _R128_DRIPRIV_H_
#define _R128_DRIPRIV_H_
+#include "GL/glxint.h"
+
#define R128_MAX_DRAWABLES 256
extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
index 15eb26662..28809312a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.2 2000/11/08 23:13:10 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.6 2000/11/28 17:25:12 dawes Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -59,25 +59,23 @@
*/
- /* X and server generic header files */
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86Resources.h"
-#include "xf86RAC.h"
-#include "xf86cmap.h"
-#include "xf86fbman.h"
-#include "xf86int10.h"
- /* Backing store, software cursor, and
- colormap initialization */
-#include "mibstore.h"
-#include "mipointer.h"
-#include "micmap.h"
+ /* Driver data structures */
+#include "r128.h"
+#include "r128_probe.h"
+#include "r128_reg.h"
+#include "r128_version.h"
+
+#ifdef XF86DRI
+#define _XF86DRI_SERVER_
+#include "r128_dri.h"
+#include "r128_sarea.h"
+#endif
#define USE_FB /* not until overlays */
#ifdef USE_FB
#include "fb.h"
#else
+
/* CFB support */
#define PSZ 8
#include "cfb.h"
@@ -87,17 +85,26 @@
#include "cfb32.h"
#include "cfb24_32.h"
#endif
- /* Driver data structures */
-#include "r128.h"
-#include "r128_probe.h"
-#include "r128_reg.h"
-#include "r128_version.h"
+
+ /* colormap initialization */
+#include "micmap.h"
+
+ /* X and server generic header files */
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86PciInfo.h"
+#include "xf86RAC.h"
+#include "xf86cmap.h"
+#include "vbe.h"
+
+ /* fbdevhw & vgahw */
+#include "fbdevhw.h"
+#include "vgaHW.h"
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-
/* Forward definitions for driver functions */
static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool R128SaveScreen(ScreenPtr pScreen, int mode);
@@ -261,15 +268,29 @@ static const char *ramdacSymbols[] = {
static const char *drmSymbols[] = {
"drmAddBufs",
"drmAddMap",
+ "drmAgpAcquire",
+ "drmAgpAlloc",
+ "drmAgpBind",
+ "drmAgpDeviceId",
+ "drmAgpEnable",
+ "drmAgpFree",
+ "drmAgpGetMode",
+ "drmAgpRelease",
+ "drmAgpUnbind",
+ "drmAgpVendorId",
"drmAvailable",
"drmCtlAddCommand",
"drmCtlInstHandler",
+ "drmFreeVersion",
"drmGetInterruptFromBusID",
+ "drmGetVersion",
+ "drmMap",
"drmMapBufs",
"drmMarkBufs",
+ "drmR128CleanupCCE",
+ "drmR128InitCCE",
+ "drmUnmap",
"drmUnmapBufs",
- "drmFreeVersion",
- "drmGetVersion",
NULL
};
@@ -402,7 +423,7 @@ static Bool R128UnmapMem(ScrnInfoPtr pScrn)
}
/* Read PLL information */
-int R128INPLL(ScrnInfoPtr pScrn, int addr)
+unsigned R128INPLL(ScrnInfoPtr pScrn, int addr)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
@@ -826,6 +847,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
case PCI_CHIP_RAGE128ML: info->HasPanelRegs = TRUE; break;
case PCI_CHIP_RAGE128RE:
case PCI_CHIP_RAGE128RF:
+ case PCI_CHIP_RAGE128RG:
case PCI_CHIP_RAGE128RK:
case PCI_CHIP_RAGE128RL:
case PCI_CHIP_RAGE128PF:
@@ -856,7 +878,8 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
case PCI_CHIP_RAGE128MF:
case PCI_CHIP_RAGE128ML:
case PCI_CHIP_RAGE128RE:
- case PCI_CHIP_RAGE128RF: offset = 0; break; /* 128-bit SDR SGRAM 1:1 */
+ case PCI_CHIP_RAGE128RF:
+ case PCI_CHIP_RAGE128RG: offset = 0; break; /* 128-bit SDR SGRAM 1:1 */
case PCI_CHIP_RAGE128RK:
case PCI_CHIP_RAGE128RL:
default: offset = 1; break; /* 64-bit SDR SGRAM 1:1 */
@@ -931,6 +954,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
case PCI_CHIP_RAGE128MF:
case PCI_CHIP_RAGE128ML:
case PCI_CHIP_RAGE128RF:
+ case PCI_CHIP_RAGE128RG:
case PCI_CHIP_RAGE128RL:
case PCI_CHIP_RAGE128PF:
default: info->IsPCI = FALSE; break;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
index b7d680df4..053835976 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.1 2000/11/02 16:55:37 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.4 2000/11/28 17:25:13 dawes Exp $ */
/*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
* VA Linux Systems Inc., Fremont, California.
*
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -51,6 +51,7 @@
SymTabRec R128Chipsets[] = {
{ PCI_CHIP_RAGE128RE, "ATI Rage 128 RE (PCI)" },
{ PCI_CHIP_RAGE128RF, "ATI Rage 128 RF (AGP)" },
+ { PCI_CHIP_RAGE128RG, "ATI Rage 128 RG (AGP)" },
{ PCI_CHIP_RAGE128RK, "ATI Rage 128 RK (PCI)" },
{ PCI_CHIP_RAGE128RL, "ATI Rage 128 RL (AGP)" },
{ PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro PF (AGP)" },
@@ -64,6 +65,7 @@ SymTabRec R128Chipsets[] = {
PciChipsets R128PciChipsets[] = {
{ PCI_CHIP_RAGE128RE, PCI_CHIP_RAGE128RE, RES_SHARED_VGA },
{ PCI_CHIP_RAGE128RF, PCI_CHIP_RAGE128RF, RES_SHARED_VGA },
+ { PCI_CHIP_RAGE128RG, PCI_CHIP_RAGE128RG, RES_SHARED_VGA },
{ PCI_CHIP_RAGE128RK, PCI_CHIP_RAGE128RK, RES_SHARED_VGA },
{ PCI_CHIP_RAGE128RL, PCI_CHIP_RAGE128RL, RES_SHARED_VGA },
{ PCI_CHIP_RAGE128PF, PCI_CHIP_RAGE128PF, RES_SHARED_VGA },
@@ -107,7 +109,7 @@ R128Probe(DriverPtr drv, int flags)
int numUsed;
int numDevSections, nATIGDev, nR128GDev;
int *usedChips;
- GDevPtr *devSections, *ATIGDevs, *R128GDevs;
+ GDevPtr *devSections, *ATIGDevs = NULL, *R128GDevs = NULL;
EntityInfoPtr pEnt;
Bool foundScreen = FALSE;
int i;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h
index b7fafe8d1..4d5ea691e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h,v 1.1 2000/11/02 16:55:37 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h
index d39826354..e8bfb6f4e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.1 2000/11/02 16:55:37 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -47,7 +47,9 @@
#ifndef _R128_REG_H_
#define _R128_REG_H_
-#include <compiler.h>
+
+#include "xf86_ansic.h"
+#include "compiler.h"
/* Memory mapped register access macros */
#define INREG8(addr) MMIO_IN8(R128MMIO, addr)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h
index ea4b8a569..fab53ad08 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.1 2000/11/02 16:55:38 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
@@ -21,7 +21,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@@ -38,6 +38,8 @@
#ifndef _R128_SAREA_H_
#define _R128_SAREA_H_
+#include "Xmd.h"
+
/* WARNING: If you change any of these defines, make sure to change the
* defines in the kernel file (r128_drm.h)
*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
index cb1c68c05..84f48ba86 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.1 2000/11/02 16:55:39 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.4 2000/11/21 23:10:34 tsi Exp $ */
/*
* Copyright 2000 Stuart R. Anderson and Metro Link, Inc.
*
@@ -17,7 +17,7 @@
*
* THE SOFTWARE IS PROVIDED "AS 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
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@@ -41,33 +41,14 @@
* My apologies to Vladimir as there is more good work in his code that
* should be brought forward.
*/
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86Resources.h"
-#include "xf86_ansic.h"
-#include "compiler.h"
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-#include "xf86fbman.h"
-#include "regionstr.h"
-
-#include "xf86xv.h"
-#include "xf86Cursor.h"
-#include "Xv.h"
-#include "xaalocal.h"
-#include "dixstruct.h"
-#include "fourcc.h"
-#ifdef XF86DRI
-#include "r128_dri.h"
-#endif
#include "r128.h"
#include "r128_reg.h"
-/*
- * For Debug
-#define OUTREG(addr, val) { xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"OUTREG(%s,%x)\n",#addr,val) ;MMIO_OUT32(R128MMIO, addr, val);}
-*/
+#include "xf86.h"
+
+#include "Xv.h"
+#include "fourcc.h"
#define OFF_DELAY 250 /* milliseconds */
#define FREE_DELAY 15000
@@ -727,7 +708,8 @@ R128PutImage(
if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
/* draw these */
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
+ (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey,
+ GXcopy, (CARD32)(~0),
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
index b37f12d16..a90f09a6f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.1 2000/11/02 16:55:40 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.4 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -31,57 +31,32 @@
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Rickard E. Faith <faith@valinux.com>
+ * Alan Hourihane <ahourihane@valinux.com>
*
*/
#ifndef _RADEON_H_
#define _RADEON_H_
- /* Xv support */
-#include "xf86xv.h"
-#include "Xv.h"
-
- /* vgahw module (for VC save/restore only) */
-#include "vgaHW.h"
+#include "xf86str.h"
-#include "fbdevhw.h"
+ /* PCI support */
+#include "xf86Pci.h"
/* XAA and Cursor Support */
#include "xaa.h"
-#include "xaalocal.h"
#include "xf86Cursor.h"
-
- /* PCI support */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* VESA support */
-#include "vbe.h"
+ /* Xv support */
+#include "xf86xv.h"
/* DRI support */
+#undef XF86DRI /* Not yet */
#ifdef XF86DRI
-#include "GL/glxint.h"
-#include "xf86drm.h"
-#include "sarea.h"
#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
#include "r128_dripriv.h"
-#include "r128_sarea.h"
-#endif
-
-#ifdef RENDER
-#include "picturestr.h"
-#endif
-
-/* NOTE: Turn off DRI until it is working */
-#ifdef XF86DRI
-#undef XF86DRI
+#include "dri.h"
+#include "GL/glxint.h"
#endif
#define RADEON_DEBUG 0 /* Turn off debugging output */
@@ -382,7 +357,7 @@ extern void RADEONWaitForIdle(ScrnInfoPtr pScrn);
extern void RADEONEngineReset(ScrnInfoPtr pScrn);
extern void RADEONEngineFlush(ScrnInfoPtr pScrn);
-extern int RADEONINPLL(ScrnInfoPtr pScrn, int addr);
+extern unsigned RADEONINPLL(ScrnInfoPtr pScrn, int addr);
extern void RADEONWaitForVerticalSync(ScrnInfoPtr pScrn);
extern Bool RADEONAccelInit(ScreenPtr pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
index d920ba56c..0f7b79724 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.2 2000/11/03 09:52:54 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.4 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -72,19 +72,19 @@
#define RADEON_IMAGEWRITE 0 /* Turned off by default - slower in accel */
- /* X and server generic header files */
-#include "Xarch.h"
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86fbman.h"
+ /* Driver data structures */
+#include "radeon.h"
+#include "radeon_reg.h"
+#ifdef XF86DRI
+#define _XF86DRI_SERVER_
+#include "r128_dri.h"
+#endif
/* Line support */
#include "miline.h"
- /* Driver data structures */
-#include "radeon.h"
-#include "radeon_reg.h"
+ /* X and server generic header files */
+#include "xf86.h"
static struct {
int rop;
@@ -288,22 +288,22 @@ static void RADEONSetupForSolidLine(ScrnInfoPtr pScrn,
Mark Vojkovich's linetest program, posted 2Jun99 to devel@xfree86.org.]
*/
static void RADEONSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
- int x1, int y1, int x2, int y2,
+ int xa, int ya, int xb, int yb,
int flags)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
int direction = 0;
- if (x1 < x2) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT;
- if (y1 < y2) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM;
+ if (xa < xb) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT;
+ if (ya < yb) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM;
RADEONWaitForFifo(pScrn, 4);
- OUTREG(RADEON_DST_Y_X, (y1 << 16) | x1);
+ OUTREG(RADEON_DST_Y_X, (ya << 16) | xa);
if (!(flags & OMIT_LAST))
OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction);
- OUTREG(RADEON_DST_LINE_START, (y1 << 16) | x1);
- OUTREG(RADEON_DST_LINE_END, (y2 << 16) | x2);
+ OUTREG(RADEON_DST_LINE_START, (ya << 16) | xa);
+ OUTREG(RADEON_DST_LINE_END, (yb << 16) | xb);
}
/* Subsequent XAA solid horizontal and vertical lines */
@@ -362,8 +362,8 @@ static void RADEONSetupForDashedLine(ScrnInfoPtr pScrn,
/* Subsequent XAA dashed line. */
static void RADEONSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
- int x1, int y1,
- int x2, int y2,
+ int xa, int ya,
+ int xb, int yb,
int flags,
int phase)
{
@@ -371,16 +371,16 @@ static void RADEONSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
unsigned char *RADEONMMIO = info->MMIO;
int direction = 0;
- if (x1 < x2) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT;
- if (y1 < y2) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM;
+ if (xa < xb) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT;
+ if (ya < yb) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM;
RADEONWaitForFifo(pScrn, 5);
if (!(flags & OMIT_LAST))
OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction);
- OUTREG(RADEON_DST_Y_X, (y1 << 16) | x1);
+ OUTREG(RADEON_DST_Y_X, (ya << 16) | xa);
OUTREG(RADEON_BRUSH_Y_X, (phase << 16) | phase);
- OUTREG(RADEON_DST_LINE_START, (y1 << 16) | x1);
- OUTREG(RADEON_DST_LINE_END, (y2 << 16) | x2);
+ OUTREG(RADEON_DST_LINE_START, (ya << 16) | xa);
+ OUTREG(RADEON_DST_LINE_END, (yb << 16) | xb);
}
/* Setup for XAA screen-to-screen copy.
@@ -426,19 +426,19 @@ static void RADEONSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
/* Subsequent XAA screen-to-screen copy. */
static void RADEONSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
- int x1, int y1,
- int x2, int y2,
+ int xa, int ya,
+ int xb, int yb,
int w, int h)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- if (info->xdir < 0) x1 += w - 1, x2 += w - 1;
- if (info->ydir < 0) y1 += h - 1, y2 += h - 1;
+ if (info->xdir < 0) xa += w - 1, xb += w - 1;
+ if (info->ydir < 0) ya += h - 1, yb += h - 1;
RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_SRC_Y_X, (y1 << 16) | x1);
- OUTREG(RADEON_DST_Y_X, (y2 << 16) | x2);
+ OUTREG(RADEON_SRC_Y_X, (ya << 16) | xa);
+ OUTREG(RADEON_DST_Y_X, (yb << 16) | xb);
OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c
index ceb7b36da..0847b46f8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.1 2000/11/02 16:55:41 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.3 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -44,17 +44,13 @@
*
*/
- /* X and server generic header files */
-#include "Xarch.h"
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86fbman.h"
-
/* Driver data structures */
#include "radeon.h"
#include "radeon_reg.h"
+ /* X and server generic header files */
+#include "xf86.h"
+
#if X_BYTE_ORDER == X_BIG_ENDIAN
#define P_SWAP32( a , b ) \
((char *)a)[0] = ((char *)b)[3]; \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c
index dc064947f..742c557ba 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.2 2000/11/03 09:52:55 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.5 2000/11/21 23:10:35 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -39,15 +39,13 @@
*
*/
- /* X and server generic header files */
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86_ansic.h"
-
/* Driver data structures */
#include "radeon.h"
#include "radeon_probe.h"
+ /* X and server generic header files */
+#include "xf86.h"
+
/* DGA support */
#include "dgaproc.h"
@@ -306,7 +304,7 @@ static void RADEON_FillRect(ScrnInfoPtr pScrn,
RADEONInfoPtr info = RADEONPTR(pScrn);
if (info->accel) {
- (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
+ (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0));
(*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h);
SET_SYNC_FLAG(info->accel);
}
@@ -323,7 +321,7 @@ static void RADEON_BlitRect(ScrnInfoPtr pScrn,
int ydir = (srcy < dsty) ? -1 : 1;
(*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir,
- GXcopy, ~0, -1);
+ GXcopy, (CARD32)(~0), -1);
(*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy,
dstx, dsty, w, h);
SET_SYNC_FLAG(info->accel);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
index c4e1a66db..c9297bbf9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.4 2000/11/08 23:21:27 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.7 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -31,6 +31,7 @@
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Rickard E. Faith <faith@valinux.com>
+ * Alan Hourihane <ahourihane@valinux.com>
*
* Credits:
*
@@ -57,25 +58,23 @@
* Modified by Marc Aurele La France (tsi@xfree86.org) for ATI driver merge.
*/
- /* X and server generic header files */
-#include "xf86.h"
-#include "xf86_ansic.h"
-#include "xf86_OSproc.h"
-#include "xf86Resources.h"
-#include "xf86RAC.h"
-#include "xf86cmap.h"
-#include "xf86fbman.h"
-#include "xf86int10.h"
- /* Backing store, software cursor, and
- colormap initialization */
-#include "mibstore.h"
-#include "mipointer.h"
-#include "micmap.h"
+ /* Driver data structures */
+#include "radeon.h"
+#include "radeon_probe.h"
+#include "radeon_reg.h"
+#include "radeon_version.h"
+
+#ifdef XF86DRI
+#define _XF86DRI_SERVER_
+#include "r128_dri.h"
+#include "r128_sarea.h"
+#endif
#define USE_FB /* not until overlays */
#ifdef USE_FB
#include "fb.h"
#else
+
/* CFB support */
#define PSZ 8
#include "cfb.h"
@@ -86,17 +85,25 @@
#include "cfb24_32.h"
#endif
- /* Driver data structures */
-#include "radeon.h"
-#include "radeon_probe.h"
-#include "radeon_reg.h"
-#include "radeon_version.h"
+ /* colormap initialization */
+#include "micmap.h"
+
+ /* X and server generic header files */
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86PciInfo.h"
+#include "xf86RAC.h"
+#include "xf86cmap.h"
+#include "vbe.h"
+
+ /* fbdevhw * vgaHW definitions */
+#include "fbdevhw.h"
+#include "vgaHW.h"
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-
/* Forward definitions for driver functions */
static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode);
@@ -404,7 +411,7 @@ static Bool RADEONUnmapMem(ScrnInfoPtr pScrn)
}
/* Read PLL information */
-int RADEONINPLL(ScrnInfoPtr pScrn, int addr)
+unsigned RADEONINPLL(ScrnInfoPtr pScrn, int addr)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c
index 50cf084f1..25b639d33 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.1 2000/11/02 16:55:43 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.2 2000/11/18 19:37:12 tsi Exp $ */
/*
* Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
*
@@ -23,7 +23,6 @@
#ifdef XFree86LOADER
-#include "ati.h"
#include "ativersion.h"
#include "radeon_version.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
index d6e1205d2..64d00ade2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.1 2000/11/02 16:55:44 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.3 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -96,7 +96,7 @@ RADEONProbe(DriverPtr drv, int flags)
int numUsed;
int numDevSections, nATIGDev, nRadeonGDev;
int *usedChips;
- GDevPtr *devSections, *ATIGDevs, *RadeonGDevs;
+ GDevPtr *devSections, *ATIGDevs = NULL, *RadeonGDevs = NULL;
EntityInfoPtr pEnt;
Bool foundScreen = FALSE;
int i;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h
index faf79cd67..3ed541e7a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.1 2000/11/02 16:55:45 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.3 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
index 170cb3332..07a75ebdf 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
@@ -1,6 +1,6 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.1 2000/11/02 16:55:46 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.4 2000/11/18 19:37:12 tsi Exp $ */
/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
@@ -20,7 +20,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@@ -31,6 +31,7 @@
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Rickard E. Faith <faith@valinux.com>
+ * Alan Hourihane <ahourihane@valinux.com>
*
* References:
*
@@ -51,7 +52,9 @@
#ifndef _RADEON_REG_H_
#define _RADEON_REG_H_
-#include <compiler.h>
+
+#include "xf86_ansic.h"
+#include "compiler.h"
/* Memory mapped register access macros */
#define INREG8(addr) MMIO_IN8(RADEONMMIO, addr)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c
index 9a3f4fe23..f0d6337d5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.1 2000/11/02 16:55:47 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.5 2000/11/21 23:10:35 tsi Exp $ */
/*
* Copyright 2000 Stuart R. Anderson and Metro Link, Inc.
*
@@ -17,7 +17,7 @@
*
* THE SOFTWARE IS PROVIDED "AS 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
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@@ -42,34 +42,18 @@
* should be brought forward.
*
* RADEON ALERT !
+ * Alan Hourihane <ahourihane@valinux.com>
* This is an extremely quick port to the Radeon, it hasn't been tested
* thoroughly, although it appears to work.
*/
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86Resources.h"
-#include "xf86_ansic.h"
-#include "compiler.h"
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-#include "xf86fbman.h"
-#include "regionstr.h"
-
-#include "xf86xv.h"
-#include "xf86Cursor.h"
-#include "Xv.h"
-#include "xaalocal.h"
-#include "dixstruct.h"
-#include "fourcc.h"
-
#include "radeon.h"
#include "radeon_reg.h"
-/*
- * For Debug
-#define OUTREG(addr, val) { xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"OUTREG(%s,%x)\n",#addr,val) ;MMIO_OUT32(RADEONMMIO, addr, val);}
-*/
+#include "xf86.h"
+
+#include "Xv.h"
+#include "fourcc.h"
#define OFF_DELAY 250 /* milliseconds */
#define FREE_DELAY 15000
@@ -729,7 +713,8 @@ RADEONPutImage(
if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
/* draw these */
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
+ (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey,
+ GXcopy, (CARD32)(~0),
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c
index d22accc44..4239ec65d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.99 2000/11/03 22:05:46 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.100 2000/11/14 16:54:51 dawes Exp $ */
/*
* Copyright 1993 by Jon Block <block@frc.com>
@@ -801,7 +801,6 @@ static
OptionInfoPtr
CHIPSAvailableOptions(int chipid, int busid)
{
- int vendor = ((chipid & 0xffff0000) >> 16);
int chip = chipid & 0x0000ffff;
if (busid == BUS_ISA) {
@@ -6185,16 +6184,16 @@ chipsRestoreExtendedRegs(ScrnInfoPtr pScrn, CHIPSRegPtr Regs)
/* debug - dump out all the extended registers... */
if (IS_HiQV(cPtr)) {
for (i = 0; i < 0xFF; i++) {
- ErrorF("XR%X - %X : %X\n", i, ChipsReg->XR[i],
+ ErrorF("XR%X - %X : %X\n", i, Regs->XR[i],
cPtr->readXR(cPtr, i));
}
for (i = 0; i < 0x80; i++) {
- ErrorF("FR%X - %X : %X\n", i, ChipsReg->FR[i],
+ ErrorF("FR%X - %X : %X\n", i, Regs->FR[i],
cPtr->readFR(cPtr, i));
}
} else {
for (i = 0; i < 0x80; i++) {
- ErrorF("XR%X - %X : %X\n", i, ChipsReg->XR[i],
+ ErrorF("XR%X - %X : %X\n", i, Regs->XR[i],
cPtr->readXR(cPtr, i));
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c
index 22a2e395e..07b025013 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c
@@ -45,7 +45,7 @@
* Support static loading.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.16 2000/09/19 12:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.18 2000/11/28 17:25:13 dawes Exp $ */
#include "xaa.h"
#include "xf86Cursor.h"
@@ -1015,7 +1015,7 @@ GLIDERestore(ScrnInfoPtr pScrn, Bool Closing)
#define GLIDE_FIND_FUNC(x) \
- p##x = (p##x##_t)xf86LoaderCheckSymbol(#x); \
+ p##x = (p##x##_t)LoaderSymbol(#x); \
if (!p##x) \
{ \
xf86Msg(X_ERROR, "Could not find " #x "() in libglide2x.so.\n"); \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
index 3d5835856..5ae579bf2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.3 2000/10/17 09:07:03 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.5 2000/11/28 16:10:39 dawes Exp $ */
STATUS as of Mon, 16 Oct 2000 21:24:51 +0200
@@ -7,7 +7,8 @@ Working :
1280x1024 only as my monitor don't support higher modes.
* HW cursor.
* ShadowFb works.
- * Full 2D Accels. (Need testing and tuning on big endian systems.)
+ * Full 2D Accels.
+ - It should be endian clean, need testing on a big endian box though.
- Sync.
- Pixmap cache.
- Offscreen pixmaps.
@@ -18,12 +19,21 @@ Working :
- 8x8 Mono Pattern Fills.
- Color Expansion Fills.
- Images Writes.
+ - Bitmap Writes using direct FIFO writes with or without FIFO Disconnect.
+ - Pixmap Writes using direct FIFO writes with or without FIFO Disconnect.
* Appian J2000 second head initialization.
* Dual head : The console fonts will get trashed, but dual head works.
+ * DRI :
+ - Gamma, if available, get's claimed with the UseGamma option.
Not Working :
- * 2D Accel hooks not implemented :
+ * 2D Accel :
- Solid & Dashed Lines are not possible on glint hardware.
- 8x8 Color Pattern Fill is almost never used.
+ - Clipping needs cleaning up.
+ * 2D Accel hooks for the Rendering extension ?
+ - Render extension initialization.
+ - CPUToScreenTexture.
+ - CPUToScreenAlphaTexture.
* Video Overlay.
* DRI.
@@ -33,12 +43,19 @@ Known Problem :
the vga graphics index & port (GraphicsIndexReg : 0x63ce, GraphicsPort :
0x3cf). I had to use IO acces for both these two, because if not, console
fonts would get trashed even in mono headed mode.
+ [FIX] Well, if you really need the console and are running linux, just use
+ vesafb, it will be a bit slower, but the fonts will no more become
+ corrupt. Maybe i will even try writting a specific fbdev for the pm3,
+ which will be much faster and have more functionality.
* R-B inversion. Sometimes, all of a sudden, it seems as the RGB order
gets changed. going to console and back solves this.
* [TRIGGERED IN ENLIGTHENMENT ONLY] When moving a window around a lot
quicly, the video outputs dies. I have to switch to a console and back
to have it restored. Is it possible that the accel engine gets
- overloaded or something such ?
+ overloaded or something such ? Don't think so, it happens even when
+ PCIRetry is used too ...
+ * Sometimes there are blue transparent garbage in the form of small
+ horizontal bands, few pixels high, and more pixels width, maybe 64pixels ?
Video Overlay [NOTHING DONE YET] :
@@ -55,3 +72,30 @@ DRI/3D Accels [NOTHING DONE YET] :
pm3 drm kernel driver as well as a pm3 OpenGL driver. Could be useful for
boards without gamma chips though.
+ * Claiming the Gamma (in the one head only approach) :
+ - The first possibility is the use of the UseGamma Option in the driver
+ section. The UseGamma option then tries to claim a gamma chip, if
+ available, on the same device. This enable the use of the gamma on
+ either head, in a two head setup.
+ - The second possibility is the automatic claiming of a gamma chip if
+ available. This works ok in single headed mode, but in dual head setup,
+ only the first head will be accelerated.
+ * Using the Gamma :
+ - A first try of using the Gamma (for 2D only) gave me a system freeze.
+ This is probably due to bad initialization since i only set the IOBase
+ to the Gamma registers, and did nothing more to initialize the Gamma.
+ I need more info on initialization of the Gamma chip, especially on how
+ to tell it which Permedia3 to use.
+ - A Second try, after initializing MultiGLINTAperture and MultiGLINT1 did
+ end in the same way.
+ - Once that is done, i need to write a pm3_dri.c file, inspired on the
+ glint_dri.c file, which does the dri setup, and the 2d/3d state saving.
+ * Changes to the 2D driver when using the Gamma :
+ - Well, there could be some changes, but in particular, the Gamma has only
+ a 32 entries deep Input FIFO, and not a 120 entries deep one like
+ permedia3.
+ - Another idea, is to use Gamma bypass when doing 2D accels. This way, we
+ don't have to worry about the Gamma smaller input Fifo. But we need to
+ sync the gamma also when doing syncs. Not sure where the right place for
+ this is though. Maybe when switching between 2D and 3D ?
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
index 41adfd348..d7467a00d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.36 2000/10/17 09:07:04 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.37 2000/11/14 17:32:59 dawes Exp $ */
/*
* Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk>
*
@@ -146,6 +146,11 @@ typedef struct {
int PM3_Render2D;
int PM3_AreaStippleMode;
int PM3_VideoControl;
+ Bool PM3_UseGamma;
+ pciVideoPtr PM3_GammaPciInfo;
+ PCITAG PM3_GammaPciTag;
+ CARD32 PM3_GammaIOAddress;
+ unsigned char * PM3_GammaIOBase;
#ifdef XF86DRI
Bool directRenderingEnabled;
DRIInfoPtr pDRIInfo;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
index 8744c7c91..827aaad3d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
@@ -28,7 +28,7 @@
* this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen,
* Siemens Nixdorf Informationssysteme and Appian Graphics.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.98 2000/10/17 09:07:04 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.99 2000/11/14 17:32:59 dawes Exp $ */
#include "fb.h"
#include "cfb8_32.h"
@@ -179,10 +179,12 @@ typedef enum {
OPTION_OVERLAY,
OPTION_SHADOW_FB,
OPTION_FBDEV,
- OPTION_NOWRITEBITMAP
+ OPTION_NOWRITEBITMAP,
+ OPTION_PM3_USE_GAMMA
} GLINTOpts;
static OptionInfoRec GLINTOptions[] = {
+ { OPTION_PM3_USE_GAMMA, "UseGamma", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE },
@@ -1205,6 +1207,57 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);
+ /* SVEN : Claim a Gamma chip if available. */
+ if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) {
+ int eIndex = -1;
+ from = X_DEFAULT;
+ pGlint->PM3_UseGamma = FALSE;
+ if (xf86ReturnOptValBool(GLINTOptions, OPTION_PM3_USE_GAMMA, FALSE)) {
+ from = X_CONFIG;
+ pGlint->PM3_UseGamma = TRUE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "%s to use Gamma with Permedia 3.\n",
+ (pGlint->PM3_UseGamma ? "Trying" : "Not trying"));
+ if (pGlint->PM3_UseGamma) {
+ pciVideoPtr *checkusedPci;
+ checkusedPci = xf86GetPciVideoInfo();
+ while (*checkusedPci != NULL) {
+ /* Is there a free gamma on the same device ? */
+ if (((*checkusedPci)->chipType == PCI_CHIP_GAMMA) &&
+ (((*checkusedPci)->bus == pGlint->PciInfo->bus)) &&
+ (((*checkusedPci)->device == pGlint->PciInfo->device)))
+ if ((eIndex = xf86ClaimPciSlot((*checkusedPci)->bus,
+ (*checkusedPci)->device,
+ (*checkusedPci)->func,
+ pScrn->drv, -1,
+ NULL, FALSE)) != -1) break;
+ }
+ checkusedPci++;
+ }
+ if (eIndex == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "No free Gamma chip was found.\n");
+ pGlint->PM3_UseGamma = FALSE;
+ } else {
+ unsigned int r;
+ /* Add the Gamma to the screen info structure. */
+ xf86AddEntityToScreen(pScrn,eIndex);
+ pGlint->PM3_GammaPciInfo =
+ xf86GetPciInfoForEntity(eIndex);
+ pGlint->PM3_GammaPciTag = pciTag(
+ pGlint->PM3_GammaPciInfo->bus,
+ pGlint->PM3_GammaPciInfo->device,
+ pGlint->PM3_GammaPciInfo->func);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Gamma Claimed at BusID PCI:%d:%d:%d.\n",
+ pGlint->PM3_GammaPciInfo->bus,
+ pGlint->PM3_GammaPciInfo->device,
+ pGlint->PM3_GammaPciInfo->func);
+ /* Let's dump the Gamma registers, at least some of them ... */
+ pGlint->PM3_GammaIOAddress =
+ pGlint->PM3_GammaPciInfo->memBase[0] & 0xFFFFC000;
+ }
+ }
if ((pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2) ||
(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) ||
(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) ||
@@ -1261,6 +1314,11 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags)
*/
pGlint->IOAddress = pGlint->pEnt->device->IOBase;
from = X_CONFIG;
+#if 0 /* This freezes the box, why ? */
+ } else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) &&
+ pGlint->PM3_UseGamma) {
+ pGlint->IOAddress = pGlint->PM3_GammaPciInfo->memBase[0] & 0xFFFFC000;
+#endif
} else {
pGlint->IOAddress = pGlint->PciInfo->memBase[0] & 0xFFFFC000;
}
@@ -2036,6 +2094,7 @@ GLINTUnmapMem(ScrnInfoPtr pScrn)
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, pGlint->FbMapSize);
pGlint->FbBase = NULL;
+ TRACE_EXIT("GLINTUnmapMem");
return TRUE;
}
@@ -2308,7 +2367,6 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Timing problem with PM3 & PM2V chips dont like being blasted */
/* This solves the dual head problem but trahses the console font. */
-
if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) {
/* Graphics Index VGA register don't work in mmio mode
* for the Permedia3 chip, it thrashes the console font.
@@ -2743,9 +2801,6 @@ GLINTEnterVT(int scrnIndex, int flags)
Permedia2VideoEnterVT(pScrn);
}
- if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3)
- pGlint->PM3_VideoControl = GLINT_READ_REG(PMVideoControl);
-
if (!pGlint->NoAccel) {
switch (pGlint->Chipset) {
case PCI_VENDOR_TI_CHIP_PERMEDIA2:
@@ -2797,12 +2852,6 @@ GLINTLeaveVT(int scrnIndex, int flags)
GLINTRestore(pScrn);
if (pGlint->VGAcore)
vgaHWLock(VGAHWPTR(pScrn));
-
- if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3)
- GLINT_SLOW_WRITE_REG(0, PMVideoControl);
- /* Don't know why the follwong is wrong, should be ok ?
- GLINT_SLOW_WRITE_REG(pGlint->PM3_VideoControl, PMVideoControl);
- */
if (xf86IsPc98())
outb(0xfac, 0x00);
@@ -2839,9 +2888,9 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pScrn->vtSema) {
if(pGlint->CursorInfoRec)
- pGlint->CursorInfoRec->HideCursor(pScrn);
+ pGlint->CursorInfoRec->HideCursor(pScrn);
if (pGlint->FBDev)
- fbdevHWRestore(pScrn);
+ fbdevHWRestore(pScrn);
else {
GLINTRestore(pScrn);
if (pGlint->VGAcore)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
index db94756b2..45f605dd5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
@@ -26,7 +26,7 @@
*
* Permedia 3 accelerated options.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.5 2000/10/26 17:57:56 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.7 2000/11/28 16:10:39 dawes Exp $ */
#include "Xarch.h"
#include "xf86.h"
@@ -47,6 +47,7 @@
#include "xaalocal.h" /* For replacements */
#define DEBUG 0
+#define USE_DIRECT_FIFO_WRITES 1
#if DEBUG
# define TRACE_ENTER(str) ErrorF("pm3_accel: " str " %d\n",pScrn->scrnIndex)
@@ -89,22 +90,21 @@ static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,unsigned int planemask);
static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int skipleft);
+/* Direct Fifo Bitmap Writes */
+static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop,unsigned int planemask);
/* Images Writes */
static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop,
unsigned int planemask, int trans_color,
int bpp, int depth);
static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int skipleft);
-
-#define MAX_FIFO_ENTRIES 256
-
-/* Mirror stipple pattern horizontally */
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-# define STIPPLE_SWAP 1<<18
-#else
-# define STIPPLE_SWAP 0
-#endif
-
+/* Direct Fifo Pixmap Writes */
+static void Permedia3WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
void
Permedia3InitializeEngine(ScrnInfoPtr pScrn)
@@ -240,28 +240,26 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn)
PM3FBSourceReadMode_ReadEnable,
PM3FBSourceReadMode);
TRACE("Permedia3InitializeEngine : SourceRead");
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- pGlint->RasterizerSwap = 1;
-#else
- pGlint->RasterizerSwap = 0;
-#endif
switch (pScrn->bitsPerPixel) {
case 8:
GLINT_SLOW_WRITE_REG(0x2, PixelSize);
#if X_BYTE_ORDER == X_BIG_ENDIAN
- pGlint->RasterizerSwap |= 3<<15; /* Swap host data */
+ pGlint->RasterizerSwap = 3<<15; /* Swap host data */
#endif
break;
case 16:
GLINT_SLOW_WRITE_REG(0x1, PixelSize);
#if X_BYTE_ORDER == X_BIG_ENDIAN
- pGlint->RasterizerSwap |= 2<<15; /* Swap host data */
+ pGlint->RasterizerSwap = 2<<15; /* Swap host data */
#endif
break;
case 32:
GLINT_SLOW_WRITE_REG(0x0, PixelSize);
break;
}
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ GLINT_SLOW_WRITE_REG(1 | pGlint->RasterizerSwap, RasterizerMode);
+#endif
TRACE("Permedia3InitializeEngine : PixelSize");
Permedia3Sync(pScrn);
@@ -409,9 +407,17 @@ Permedia3AccelInit(ScreenPtr pScreen)
infoPtr->SubsequentMono8x8PatternFillRect =
Permedia3SubsequentMono8x8PatternFillRect;
+#if USE_DIRECT_FIFO_WRITES
+ /* Direct Fifo Bitmap Writes */
+ infoPtr->WriteBitmapFlags = 0;
+ infoPtr->WriteBitmap = Permedia3WriteBitmap;
+#endif
+
/* Color Expand Fills */
infoPtr->CPUToScreenColorExpandFillFlags =
+ /*
SYNC_AFTER_COLOR_EXPAND |
+ */
LEFT_EDGE_CLIPPING |
BIT_ORDER_IN_BYTE_LSBFIRST |
CPU_TRANSFER_BASE_FIXED |
@@ -423,21 +429,31 @@ Permedia3AccelInit(ScreenPtr pScreen)
infoPtr->SubsequentCPUToScreenColorExpandFill =
Permedia3SubsequentCPUToScreenColorExpandFill;
+#if USE_DIRECT_FIFO_WRITES
+ /* Direct Fifo Images Writes */
+ infoPtr->WritePixmapFlags = 0;
+ infoPtr->WritePixmap = Permedia3WritePixmap;
+#else
/* Images Writes */
infoPtr->ImageWriteFlags =
NO_GXCOPY |
+ /*
SYNC_AFTER_IMAGE_WRITE |
+ */
LEFT_EDGE_CLIPPING |
+ LEFT_EDGE_CLIPPING_NEGATIVE_X |
BIT_ORDER_IN_BYTE_LSBFIRST |
CPU_TRANSFER_BASE_FIXED |
CPU_TRANSFER_PAD_DWORD;
infoPtr->ImageWriteBase = pGlint->IOBase + PM3FBSourceData;
- infoPtr->ImageWriteRange = 8;
+ infoPtr->ImageWriteRange = 4;
infoPtr->SetupForImageWrite =
Permedia3SetupForImageWrite;
infoPtr->SubsequentImageWriteRect =
Permedia3SubsequentImageWriteRect;
-
+#endif
+
+ /* Available Framebuffer Area for XAA. */
AvailFBArea.x1 = 0;
AvailFBArea.y1 = 0;
AvailFBArea.x2 = pScrn->displayWidth;
@@ -634,6 +650,10 @@ Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable;
*/
pGlint->PM3_AreaStippleMode = 1;
+/* Mirror stipple pattern horizontally */
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ pGlint->PM3_AreaStippleMode |= (1<<18);
+#endif
pGlint->PM3_AreaStippleMode |= (2<<1);
pGlint->PM3_AreaStippleMode |= (2<<4);
if (bg != -1) {
@@ -729,6 +749,7 @@ static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
TRACE_EXIT("Permedia3SubsequentCPUToScreenColorExpandFill");
}
+
/* Images Writes */
static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop,
unsigned int planemask, int trans_color, int bpp, int depth)
@@ -770,3 +791,153 @@ static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn,
TRACE_EXIT("Permedia3SubsequentImageWrite");
}
+
+/* Defines for Direct Fifo access */
+
+#define WriteRange 120
+#define PciRetryWriteRange 1023
+#define WriteBase_Fixed ((CARD32 *)(pGlint->IOBase + PM3FBSourceData))
+#define WriteBase ((CARD32 *)(pGlint->IOBase + OutputFIFO + 4))
+
+/* Direct Fifo Bitmap Writes */
+
+static void
+Permedia3WriteBitmap(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, int skipleft,
+ int fg, int bg, int rop,
+ unsigned int planemask
+)
+{
+ int dwords;
+ int ApertureRange;
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ TRACE_ENTER("Permedia3WriteBitmap");
+
+ w += skipleft;
+ x -= skipleft;
+ dwords = (w + 31) >>5;
+ if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange;
+ else ApertureRange = WriteRange;
+
+ /* width of the stuff to copy in 32 bit words */
+ Permedia3SetupForCPUToScreenColorExpandFill(pScrn, fg, bg, rop, planemask);
+ Permedia3SubsequentCPUToScreenColorExpandFill(pScrn, x, y, w, h, skipleft);
+
+ if (dwords > ApertureRange) {
+ while(h--) {
+ XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ } else {
+ /* the src is exatcly as wide as the target rectangle. We copy all
+ * of it, so no need to separate stuff by scanline */
+ if(srcwidth == (dwords << 5)) {
+ /* decrement contains the number of lines that can be
+ * put in the fifo */
+ int decrement = ApertureRange/dwords;
+
+ while(h > decrement) {
+ GLINT_WAIT(dwords * decrement);
+ GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0xd,
+ OutputFIFO);
+ XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement);
+ src += (srcwidth * decrement);
+ h -= decrement;
+ }
+ if(h) {
+ GLINT_WAIT(dwords * h);
+ GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0xd, OutputFIFO);
+ XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h);
+ }
+ } else {
+ while(h--) {
+ GLINT_WAIT(dwords);
+ GLINT_WRITE_REG(((dwords-1) << 16) | 0xd, OutputFIFO);
+ XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ }
+ }
+ TRACE_EXIT("Permedia3WriteBitmap");
+}
+/* Direct Fifo Images Writes */
+
+static void
+Permedia3WritePixmap(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int trans,
+ int bpp, int depth
+)
+{
+ int dwords;
+ int skipleft = (long)src & 0x03L;
+ int Bpp = bpp >> 3;
+ int ApertureRange;
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ TRACE_ENTER("Permedia3WritePixmap");
+
+ if (skipleft) {
+ /* Skipleft is either
+ * - 0, 1, 2 or 3 in 8 bpp
+ * - 0 or 1 in 16 bpp
+ * - 0 in 32 bpp
+ */
+ skipleft /= Bpp;
+
+ x -= skipleft;
+ w += skipleft;
+
+ src = (unsigned char*)((long)src & ~0x03L);
+ }
+ Permedia3SetupForImageWrite(pScrn, rop, planemask, trans, bpp, depth);
+ Permedia3SubsequentImageWriteRect(pScrn, x, y, w, h, skipleft);
+
+ /* width of the stuff to copy in 32 bit words */
+ dwords = ((w * Bpp) + 3) >> 2;
+ if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange;
+ else ApertureRange = WriteRange;
+
+ if (dwords > ApertureRange) {
+ while(h--) {
+ XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ } else {
+ /* the src is exatcly as wide as the target rectangle. We copy all
+ * of it, so no need to separate stuff by scanline */
+ if(srcwidth == (dwords << 2)) {
+ /* decrement contains the number of lines that can be
+ * put in the fifo */
+ int decrement = ApertureRange/dwords;
+
+ while(h > decrement) {
+ GLINT_WAIT(dwords * decrement);
+ GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0x155,
+ OutputFIFO);
+ XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement);
+ src += (srcwidth * decrement);
+ h -= decrement;
+ }
+ if(h) {
+ GLINT_WAIT(dwords * h);
+ GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0x155, OutputFIFO);
+ XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h);
+ }
+ } else {
+ while(h--) {
+ GLINT_WAIT(dwords);
+ GLINT_WRITE_REG(((dwords-1) << 16) | 0x155, OutputFIFO);
+ XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ }
+ }
+ TRACE_EXIT("Permedia3WritePixmap");
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c
index 10f2a7c13..fa65fcdc3 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.9 2000/10/27 22:30:29 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.13 2000/11/06 02:56:03 robin Exp $ */
/* All drivers should typically include these */
@@ -41,6 +41,9 @@
/* Drivers that need to access the PCI config space directly need this */
#include "xf86Pci.h"
+/* vgaHW module is only used to save/restore fonts by this driver */
+#include "vgaHW.h"
+
/* All drivers initialising the SW cursor need this */
#include "mipointer.h"
@@ -171,6 +174,18 @@ XF86ModuleData i128ModuleData = { &i128VersRec, i128Setup, NULL };
* LoaderRefSymLists() function in the module specific Setup() function.
*/
+static const char *vgahwSymbols[] = {
+ "vgaHWFreeHWRec",
+ "vgaHWGetHWRec",
+ "vgaHWGetIOBase",
+ "vgaHWLock",
+ "vgaHWProtect",
+ "vgaHWRestore",
+ "vgaHWSave",
+ "vgaHWUnlock",
+ NULL
+};
+
static const char *fbSymbols[] = {
"fbScreenInit",
NULL
@@ -267,6 +282,7 @@ i128Setup(pointer module, pointer opts, int *errmaj, int *errmin)
i2cSymbols,
vbeSymbols,
int10Symbols,
+ vgahwSymbols,
NULL);
/*
@@ -545,6 +561,20 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
pI128->Primary = xf86IsPrimaryPci(pI128->PciInfo);
+ /* The vgahw module should be allocated here when needed */
+ if (!xf86LoadSubModule(pScrn, "vgahw"))
+ return FALSE;
+
+ xf86LoaderReqSymLists(vgahwSymbols, NULL);
+
+ /*
+ * Allocate a vgaHWRec
+ */
+ if (!vgaHWGetHWRec(pScrn))
+ return FALSE;
+
+ vgaHWGetIOBase(VGAHWPTR(pScrn));
+
/* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
@@ -793,8 +823,7 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
if (!pI128->Primary)
I128SoftReset(pScrn);
- if ((pI128->Chipset == PCI_CHIP_I128_T2R) ||
- (pI128->Chipset == PCI_CHIP_I128_T2R4)) {
+ if (pI128->Chipset != PCI_CHIP_I128) {
pI128->ddc1Read = NULL /*I128DDC1Read*/;
pI128->i2cInit = I128I2CInit;
}
@@ -1074,8 +1103,8 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
linePitches, minPitch, maxPitch,
pitchAlignment * pI128->bitsPerPixel,
128, 2048,
- pScrn->virtualX,
- pScrn->virtualY,
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
pI128->MemorySize,
LOOKUP_BEST_REFRESH);
@@ -1324,9 +1353,7 @@ I128MapMem(ScrnInfoPtr pScrn)
static Bool
I128UnmapMem(ScrnInfoPtr pScrn)
{
- I128Ptr pI128;
-
- pI128 = I128PTR(pScrn);
+ I128Ptr pI128 = I128PTR(pScrn);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Unmapping memory\n");
@@ -1358,6 +1385,12 @@ I128UnmapMem(ScrnInfoPtr pScrn)
static void
I128Save(ScrnInfoPtr pScrn)
{
+ I128Ptr pI128 = I128PTR(pScrn);
+ vgaHWPtr vgaHWP = VGAHWPTR(pScrn);
+
+ if (pI128->Primary)
+ vgaHWSave(pScrn, &vgaHWP->SavedReg, VGA_SR_ALL);
+
I128SaveState(pScrn);
}
@@ -1367,7 +1400,16 @@ I128Save(ScrnInfoPtr pScrn)
static void
I128Restore(ScrnInfoPtr pScrn)
{
+ I128Ptr pI128 = I128PTR(pScrn);
+ vgaHWPtr vgaHWP = VGAHWPTR(pScrn);
+
I128RestoreState(pScrn);
+
+ if (pI128->Primary) {
+ vgaHWProtect(pScrn, TRUE);
+ vgaHWRestore(pScrn, &vgaHWP->SavedReg, VGA_SR_ALL);
+ vgaHWProtect(pScrn, FALSE);
+ }
}
/* Usually mandatory */
@@ -1678,6 +1720,9 @@ I128FreeScreen(int scrnIndex, int flags)
* This only gets called when a screen is being deleted. It does not
* get called routinely at the end of a server generation.
*/
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+
I128FreeRec(xf86Screens[scrnIndex]);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c
index 27ad796cc..46b4abafd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c,v 1.4 2000/10/24 02:00:06 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128accel.c,v 1.6 2000/11/01 23:33:06 robin Exp $ */
/*
* Copyright 1997-2000 by Robin Cutshaw <robin@XFree86.Org>
@@ -104,7 +104,7 @@ I128BitBlit(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h)
#if 0
if (pI128->Debug)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BB %d,%d %d,%d %d,%d\n", x1, y1, x2, y2, w, h);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BB %d,%d %d,%d %d,%d 0x%x/0x%x\n", x1, y1, x2, y2, w, h, pI128->cmd);
#endif
ENG_PIPELINE_READY();
@@ -428,7 +428,7 @@ I128AccelInit(ScreenPtr pScreen)
infoPtr->Sync = I128EngineDone;
/* screen to screen copy */
- infoPtr->ScreenToScreenCopyFlags = 0;
+ infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
if (pI128->Chipset == PCI_CHIP_I128_T2R)
infoPtr->ScreenToScreenCopyFlags |= ONLY_LEFT_TO_RIGHT_BITBLT;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c
index f8c8a804e..125e66f5f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c,v 1.4 2000/10/25 00:09:17 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128init.c,v 1.5 2000/11/03 00:50:53 robin Exp $ */
/*
* Copyright 1995-2000 by Robin Cutshaw <robin@XFree86.Org>
* Copyright 1998 by Number Nine Visual Technology, Inc.
@@ -39,8 +39,6 @@
void I128SavePalette(I128Ptr pI128);
void I128RestorePalette(I128Ptr pI128);
-#define VGA_SAVE_COUNT 4096*1024
-
void
I128SaveState(ScrnInfoPtr pScrn)
@@ -59,6 +57,7 @@ I128SaveState(ScrnInfoPtr pScrn)
}
/* iobase is filled in during the device probe (as well as config 1&2)*/
+
if ((pI128->io.id&0x7) > 0) {
iR->vga_ctl = inl(iR->iobase + 0x30);
}
@@ -299,15 +298,10 @@ I128RestoreState(ScrnInfoPtr pScrn)
}
/* iobase is filled in during the device probe (as well as config 1&2)*/
+
if (((pI128->io.id&0x7) > 0) ||
(pI128->Chipset == PCI_CHIP_I128_T2R) ||
(pI128->Chipset == PCI_CHIP_I128_T2R4)) {
- int i;
- unsigned char *vidmem = (unsigned char *)pI128->mem.mw0_ad;
-
- if (pI128->Primary)
- for (i=0; i<VGA_SAVE_COUNT; i++)
- vidmem[i] = pI128->vgamem[i];
outl(iR->iobase + 0x30, iR->vga_ctl);
}
@@ -508,18 +502,6 @@ I128Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
usleep(5000);
outl(iR->iobase + 0x24, 0xA1089030);
}
-
- if (!pI128->FontsSaved && pI128->Primary) {
- int i;
- unsigned char *vidmem =
- (unsigned char *)pI128->mem.mw0_ad;
-
- pI128->vgamem = xnfalloc(VGA_SAVE_COUNT);
- for (i=0; i<VGA_SAVE_COUNT; i++)
- pI128->vgamem[i] = vidmem[i];
- pI128->FontsSaved = TRUE;
- }
-
}
ret = pI128->ProgramDAC(pScrn, mode);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
index 7997567c5..7f0d32958 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.34 2000/09/26 15:57:11 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.35 2000/11/13 23:06:08 dawes Exp $ */
/*
* Authors:
@@ -1951,7 +1951,7 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen)
static void
I810FreeScreen(int scrnIndex, int flags) {
I810FreeRec(xf86Screens[scrnIndex]);
- if (vgaHWFreeHWRec)
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
vgaHWFreeHWRec(xf86Screens[scrnIndex]);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
index 3826b94a8..429010ca6 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.65 2000/10/24 22:45:06 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.67 2000/11/08 05:03:04 dawes Exp $ */
/*
* MGA Millennium (MGA2064W) functions
*
@@ -82,7 +82,7 @@ typedef struct {
typedef struct {
unsigned char brightness;
unsigned char contrast;
- FBAreaPtr area;
+ FBLinearPtr linear;
RegionRec clip;
CARD32 colorKey;
CARD32 videoStatus;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
index 9a41dc848..ce3d45611 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.10 2000/11/02 19:10:51 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.12 2000/11/13 23:31:39 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
index 1e2302ffa..83f21d7fa 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
@@ -43,7 +43,7 @@
* Fixed 32bpp hires 8MB horizontal line glitch at middle right
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.178 2000/11/03 18:46:10 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.181 2000/11/16 19:44:55 eich Exp $ */
/*
* This is a first cut at a non-accelerated version to work with the
@@ -2230,7 +2230,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
reqSym = "fbScreenInit";
- xf86LoaderReqSymbols("fbScreenInit", NULL);
#ifdef RENDER
xf86LoaderReqSymbols("fbPictureInit", NULL);
#endif
@@ -2872,6 +2871,8 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits,
TrueColor))
return FALSE;
+ if (!miSetPixmapDepths ())
+ return FALSE;
} else {
if (!xf86SetDefaultVisual(pScrn, -1))
return FALSE;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h
index f6660771a..ba0d8fabc 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h
@@ -2,7 +2,7 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.13 2000/11/01 21:55:09 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.14 2000/11/08 05:03:04 dawes Exp $ */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
index c6b5a59c4..3899ef258 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.19 2000/11/02 19:10:53 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.20 2000/11/08 00:51:10 mvojkovi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -451,9 +451,9 @@ MGAStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
if(exit) {
if(pPriv->videoStatus & CLIENT_VIDEO_ON)
OUTREG(MGAREG_BESCTL, 0);
- if(pPriv->area) {
- xf86FreeOffscreenArea(pPriv->area);
- pPriv->area = NULL;
+ if(pPriv->linear) {
+ xf86FreeOffscreenLinear(pPriv->linear);
+ pPriv->linear = NULL;
}
pPriv->videoStatus = 0;
} else {
@@ -613,45 +613,45 @@ MGACopyMungedData(
}
-static FBAreaPtr
+static FBLinearPtr
MGAAllocateMemory(
ScrnInfoPtr pScrn,
- FBAreaPtr area,
- int numlines
+ FBLinearPtr linear,
+ int size
){
ScreenPtr pScreen;
- FBAreaPtr new_area;
+ FBLinearPtr new_linear;
- if(area) {
- if((area->box.y2 - area->box.y1) >= numlines)
- return area;
+ if(linear) {
+ if(linear->size >= size)
+ return linear;
- if(xf86ResizeOffscreenArea(area, pScrn->displayWidth, numlines))
- return area;
+ if(xf86ResizeOffscreenLinear(linear, size))
+ return linear;
- xf86FreeOffscreenArea(area);
+ xf86FreeOffscreenLinear(linear);
}
pScreen = screenInfo.screens[pScrn->scrnIndex];
- new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth,
- numlines, 0, NULL, NULL, NULL);
+ new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16,
+ NULL, NULL, NULL);
- if(!new_area) {
- int max_w, max_h;
+ if(!new_linear) {
+ int max_size;
- xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0,
- FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME);
+ xf86QueryLargestOffscreenLinear(pScreen, &max_size, 16,
+ PRIORITY_EXTREME);
- if((max_w < pScrn->displayWidth) || (max_h < numlines))
+ if(max_size < size)
return NULL;
xf86PurgeUnlockedOffscreenAreas(pScreen);
- new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth,
- numlines, 0, NULL, NULL, NULL);
+ new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16,
+ NULL, NULL, NULL);
}
- return new_area;
+ return new_linear;
}
static void
@@ -820,9 +820,9 @@ MGAPutImage(
MGAPortPrivPtr pPriv = pMga->portPrivate;
INT32 x1, x2, y1, y2;
unsigned char *dst_start;
- int pitch, new_h, offset, offset2, offset3;
+ int pitch, new_size, offset, offset2, offset3;
int srcPitch, srcPitch2, dstPitch;
- int top, left, npixels, nlines;
+ int top, left, npixels, nlines, bpp;
BoxRec dstBox;
CARD32 tmp;
@@ -847,11 +847,12 @@ MGAPutImage(
dstBox.y2 -= pScrn->frameY0;
}
- pitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3;
+ bpp = pScrn->bitsPerPixel >> 3;
+ pitch = bpp * pScrn->displayWidth;
dstPitch = ((width << 1) + 15) & ~15;
- new_h = ((dstPitch * height) + pitch - 1) / pitch;
-
+ new_size = ((dstPitch * height) + bpp - 1) / bpp;
+
switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
@@ -867,26 +868,25 @@ MGAPutImage(
break;
}
- if(!(pPriv->area = MGAAllocateMemory(pScrn, pPriv->area, new_h)))
+ if(!(pPriv->linear = MGAAllocateMemory(pScrn, pPriv->linear, new_size)))
return BadAlloc;
/* copy data */
- top = y1 >> 16;
- left = (x1 >> 16) & ~1;
- npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
- left <<= 1;
+ top = y1 >> 16;
+ left = (x1 >> 16) & ~1;
+ npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
+ left <<= 1;
- offset = pPriv->area->box.y1 * pitch;
- dst_start = pMga->FbStart + offset + left + (top * dstPitch);
+ offset = pPriv->linear->offset * bpp;
+ dst_start = pMga->FbStart + offset + left + (top * dstPitch);
- if(pMga->TexturedVideo && pMga->AccelInfoRec->NeedToSync &&
+ if(pMga->TexturedVideo && pMga->AccelInfoRec->NeedToSync &&
((long)data != pPriv->lastPort))
- {
+ {
MGAStormSync(pScrn);
- pMga->AccelInfoRec->NeedToSync = FALSE;
- }
+ }
- switch(id) {
+ switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
top &= ~1;
@@ -1005,9 +1005,9 @@ MGAVideoTimerCallback(ScrnInfoPtr pScrn, Time time)
}
} else { /* FREE_TIMER */
if(pPriv->freeTime < time) {
- if(pPriv->area) {
- xf86FreeOffscreenArea(pPriv->area);
- pPriv->area = NULL;
+ if(pPriv->linear) {
+ xf86FreeOffscreenLinear(pPriv->linear);
+ pPriv->linear = NULL;
}
pPriv->videoStatus = 0;
pMga->VideoTimerCallback = NULL;
@@ -1021,7 +1021,7 @@ MGAVideoTimerCallback(ScrnInfoPtr pScrn, Time time)
/****************** Offscreen stuff ***************/
typedef struct {
- FBAreaPtr area;
+ FBLinearPtr linear;
Bool isOn;
} OffscreenPrivRec, * OffscreenPrivPtr;
@@ -1033,8 +1033,8 @@ MGAAllocateSurface(
unsigned short h,
XF86SurfacePtr surface
){
- FBAreaPtr area;
- int pitch, fbpitch, numlines;
+ FBLinearPtr linear;
+ int pitch, fbpitch, size, bpp;
OffscreenPrivPtr pPriv;
if((w > 1024) || (h > 1024))
@@ -1042,38 +1042,39 @@ MGAAllocateSurface(
w = (w + 1) & ~1;
pitch = ((w << 1) + 15) & ~15;
- fbpitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3;
- numlines = ((pitch * h) + fbpitch - 1) / fbpitch;
+ bpp = pScrn->bitsPerPixel >> 3;
+ fbpitch = bpp * pScrn->displayWidth;
+ size = ((pitch * h) + bpp - 1) / bpp;
- if(!(area = MGAAllocateMemory(pScrn, NULL, numlines)))
+ if(!(linear = MGAAllocateMemory(pScrn, NULL, size)))
return BadAlloc;
surface->width = w;
surface->height = h;
if(!(surface->pitches = xalloc(sizeof(int)))) {
- xf86FreeOffscreenArea(area);
+ xf86FreeOffscreenLinear(linear);
return BadAlloc;
}
if(!(surface->offsets = xalloc(sizeof(int)))) {
xfree(surface->pitches);
- xf86FreeOffscreenArea(area);
+ xf86FreeOffscreenLinear(linear);
return BadAlloc;
}
if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
xfree(surface->pitches);
xfree(surface->offsets);
- xf86FreeOffscreenArea(area);
+ xf86FreeOffscreenLinear(linear);
return BadAlloc;
}
- pPriv->area = area;
+ pPriv->linear = linear;
pPriv->isOn = FALSE;
surface->pScrn = pScrn;
surface->id = id;
surface->pitches[0] = pitch;
- surface->offsets[0] = area->box.y1 * fbpitch;
+ surface->offsets[0] = linear->offset * bpp;
surface->devPrivate.ptr = (pointer)pPriv;
return Success;
@@ -1103,7 +1104,7 @@ MGAFreeSurface(
if(pPriv->isOn)
MGAStopSurface(surface);
- xf86FreeOffscreenArea(pPriv->area);
+ xf86FreeOffscreenLinear(pPriv->linear);
xfree(surface->pitches);
xfree(surface->offsets);
xfree(surface->devPrivate.ptr);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c
index 3b93b220c..116236d48 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c
@@ -22,7 +22,7 @@ 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/xfree86/drivers/neomagic/neo_driver.c,v 1.39 2000/11/03 18:46:11 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.40 2000/11/16 19:44:59 eich Exp $ */
/*
* The original Precision Insight driver for
@@ -845,11 +845,11 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
if (xf86LoadSubModule(pScrn, "ddc")) {
xf86LoaderReqSymLists(ddcSymbols, NULL);
-#if 1
+#if 1 /* for DDC1 testing */
if (!neoDoDDCVBE(pScrn))
if (!neoDoDDC2(pScrn))
- neoDoDDC1(pScrn);
#endif
+ neoDoDDC1(pScrn);
}
if (!xf86SetDepthBpp(pScrn, 8, 8, 8, bppSupport ))
@@ -2647,18 +2647,11 @@ static unsigned int
neo_ddc1Read(ScrnInfoPtr pScrn)
{
register vgaHWPtr hwp = VGAHWPTR(pScrn);
-#if 0
- register unsigned int ST01reg = ((NEOPtr)pScrn->driverPrivate)->vgaIOBase
- + 0x0A;
-#endif
register unsigned int tmp;
-#if 0
- while(inb(ST01reg)&0x8){};
- while(!(inb(ST01reg)&0x8)) {};
-#endif
+ /* This needs to be investigated: we may have to swap this around */
+ while (!(hwp->readST01(hwp)&0x8)) {};
while (hwp->readST01(hwp)&0x8) {};
- while (!hwp->readST01(hwp)&0x8) {};
tmp = (VGArGR(0xA1) & 0x08);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
index 844dcb1fe..19b4a8126 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c
@@ -24,7 +24,7 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
<jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.49 2000/11/03 18:46:12 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.50 2000/11/16 19:44:59 eich Exp $ */
#include "nv_include.h"
@@ -668,6 +668,81 @@ NVValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
return (MODE_OK);
}
+static xf86MonPtr
+nvDoDDC2(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ xf86MonPtr MonInfo = NULL;
+
+ if (!pNv->i2cInit) return NULL;
+
+ /* - DDC can use I2C bus */
+ /* Load I2C if we have the code to use it */
+ if ( xf86LoadSubModule(pScrn, "i2c") ) {
+ xf86LoaderReqSymLists(i2cSymbols,NULL);
+ if (pNv->i2cInit(pScrn)) {
+ DEBUG(ErrorF("I2C initialized on %p\n",pNv->I2C));
+ if ((MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex,pNv->I2C))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n",
+ MonInfo);
+ xf86PrintEDID( MonInfo );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor "
+ "info\n\n");
+ xf86SetDDCproperties(pScrn,MonInfo);
+ }
+ }
+ }
+ return MonInfo;
+}
+
+static xf86MonPtr
+nvDoDDC1(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ xf86MonPtr MonInfo = NULL;
+
+ if (!pNv->ddc1Read || !pNv->DDC1SetSpeed) return NULL;
+ if (!pNv->Primary
+ && (pNv->DDC1SetSpeed == vgaHWddc1SetSpeed)) return NULL;
+
+ if ((MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, pNv->DDC1SetSpeed,
+ pNv->ddc1Read ))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n",
+ MonInfo);
+ xf86PrintEDID( MonInfo );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n");
+ xf86SetDDCproperties(pScrn,MonInfo);
+ }
+ return MonInfo;
+}
+
+static xf86MonPtr
+nvDoDDCVBE(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ xf86MonPtr MonInfo = NULL;
+ vbeInfoPtr pVbe;
+
+ if (xf86LoadSubModule(pScrn, "vbe")) {
+ xf86LoaderReqSymLists(vbeSymbols,NULL);
+ pVbe = VBEInit(pNv->pInt,pNv->pEnt->index);
+ if (pVbe) {
+ if ((MonInfo = vbeDoEDID(pVbe,NULL))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n",
+ MonInfo);
+ xf86PrintEDID( MonInfo );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n");
+ xf86SetDDCproperties(pScrn,MonInfo);
+ }
+ vbeFree(pVbe);
+ } else
+ xf86FreeInt10(pNv->pInt);
+ pNv->pInt = NULL;
+ }
+ return MonInfo;
+}
+
+
/* Internally used */
static xf86MonPtr
NVdoDDC(ScrnInfoPtr pScrn)
@@ -676,51 +751,18 @@ NVdoDDC(ScrnInfoPtr pScrn)
NVPtr pNv;
NVRamdacPtr NVdac;
xf86MonPtr MonInfo = NULL;
-#if 0
- vbeInfoPtr pVbe;
-#endif
+
hwp = VGAHWPTR(pScrn);
pNv = NVPTR(pScrn);
NVdac = &pNv->Dac;
/* Load DDC if we have the code to use it */
- /* This gives us DDC1 */
- if (xf86LoadSubModule(pScrn, "ddc")) {
- xf86LoaderReqSymLists(ddcSymbols, NULL);
- } else {
- /* ddc module not found, we can do without it */
- pNv->ddc1Read = NULL;
-
- /* Without DDC, we have no use for the I2C bus */
- pNv->i2cInit = NULL;
- return NULL;
- }
-#if 0 /* for some reason vbe messes up modes */
- if (xf86LoadSubModule(pScrn, "vbe")) {
- xf86LoaderReqSymLists(vbeSymbols,NULL);
- pVbe = VBEInit(pNv->pInt,pNv->pEnt->index);
- if (pVbe) {
- MonInfo = xf86PrintEDID(vbeDoEDID(pVbe,NULL));
- vbeFree(pVbe);
- if (MonInfo) {
- xf86SetDDCproperties(pScrn,MonInfo);
- return MonInfo;
- }
- }
- }
-#endif
- if (pNv->pInt)
- xf86FreeInt10(pNv->pInt);
- pNv->pInt = NULL;
- if (!pNv->Primary) {
- /* XXX Need to write an NV mode ddc1SetSpeed */
- if (pNv->DDC1SetSpeed == vgaHWddc1SetSpeed) {
- pNv->DDC1SetSpeed = NULL;
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
- "DDC1 disabled - chip not in VGA mode\n");
- }
- }
+ if (!xf86LoadSubModule(pScrn, "ddc")) return NULL;
+
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
+
+ /* if ((MonInfo = nvDoDDCVBE(pScrn))) return MonInfo; */
/* Save the current state */
NVSave(pScrn);
@@ -729,48 +771,10 @@ NVdoDDC(ScrnInfoPtr pScrn)
vgaHWUnlock(hwp);
pNv->riva.LockUnlock(&pNv->riva, 0);
- /* It is now safe to talk to the card */
-#if NVuseI2C
- /* - DDC can use I2C bus */
- /* Load I2C if we have the code to use it */
- if (pNv->i2cInit) {
- if ( xf86LoadSubModule(pScrn, "i2c") ) {
- xf86LoaderReqSymLists(i2cSymbols,NULL);
- } else {
- /* i2c module not found, we can do without it */
- pNv->i2cInit = NULL;
- pNv->I2C = NULL;
- }
- }
-
- /* Initialize I2C bus - used by DDC if available */
- if (pNv->i2cInit) {
- pNv->i2cInit(pScrn);
-#if 0
- ErrorF("I2C initialized on %p\n",pNv->I2C);
-#endif
- }
- /* Read and output monitor info using DDC2 over I2C bus */
- if (pNv->I2C) {
- MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex,pNv->I2C);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", MonInfo);
-
- xf86PrintEDID(MonInfo);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n\n");
- }
- if (!MonInfo)
-#endif /* NVuseI2C */
- /* Read and output monitor info using DDC1 */
- if (pNv->ddc1Read && pNv->DDC1SetSpeed) {
-#if 0
- MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, pNv->DDC1SetSpeed,
- pNv->ddc1Read );
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n",
- MonInfo);
- xf86PrintEDID( MonInfo );
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n");
+ if ((MonInfo = nvDoDDC2(pScrn))) return MonInfo;
+#if 0 /* disable for now - causes problems on AXP */
+ if ((MonInfo = nvDoDDC1(pScrn))) return MonInfo;
#endif
- }
/* Restore previous state */
NVRestore(pScrn);
@@ -779,6 +783,17 @@ NVdoDDC(ScrnInfoPtr pScrn)
return MonInfo;
}
+static void
+nvProbeDDC(ScrnInfoPtr pScrn, int index)
+{
+ vbeInfoPtr pVbe;
+
+ if (xf86LoadSubModule(pScrn, "vbe")) {
+ pVbe = VBEInit(NULL,index);
+ ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
+ }
+}
+
/* Mandatory */
Bool
NVPreInit(ScrnInfoPtr pScrn, int flags)
@@ -792,7 +807,11 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
const char *reqSym = NULL;
const char *s;
- if (flags & PROBE_DETECT) return FALSE;
+ if (flags & PROBE_DETECT) {
+ nvProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index );
+ return TRUE;
+ }
+
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVPreInit\n"));
/*
@@ -1611,18 +1630,22 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Setup the visuals we support. */
- if (pScrn->bitsPerPixel > 8) {
- if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits,
- pScrn->defaultVisual))
- return FALSE;
- } else {
- if (!miSetVisualTypes(pScrn->depth,
- miGetDefaultVisualMask(pScrn->depth),
- pScrn->rgbBits, pScrn->defaultVisual))
- return FALSE;
- if (!miSetPixmapDepths ())
- return FALSE;
- }
+#ifndef NV_USE_FB
+ if (pScrn->bitsPerPixel > 8) {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits,
+ pScrn->defaultVisual))
+ return FALSE;
+ } else
+#endif
+ {
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ }
+#ifdef NV_USE_FB
+ if (!miSetPixmapDepths ()) return FALSE;
+#endif
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Visuals set up\n"));
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES
index 74695ba1c..4f7ba5efe 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES
@@ -1,7 +1,7 @@
S3 ViRGE 4.0 devel notes
rev:
-21 Oct 2000 KJB
+27 Nov 2000 KJB
Function Implemented
@@ -23,6 +23,40 @@ S3VRestore X
Status
------
+11/27/00 KJB
+Ver 1.5.0
+Clean up, bump version for 4.0.2 submission.
+CR3A, bit 0x40 (reserved) cleared for MX/GX2. Update man page.
+
+11/24/00 KJB
+Disable CPU to screen color expansion on GX2, causes lockups on GX2 with
+'locate html' in an xterm. Add WaitCmd code to prevent accelerator and
+reg command path activity at the same time on GX2.
+XVideo fixes, left side clipping fixed for video windows extending off left
+side of screen. Add horizontal filtering modes for 1-2x and >3x scaling.
+
+11/7/00 KJB
+Ver 1.4.0
+Enable MX fixes, testing with accel BLT_BUG set is worse on GX2, so left
+it out. BLT_BUG wasn't being enabled on ViRGE & VX because of case usage,
+enabled now. Re-enable silken mouse for GX2. Add Render/fbPicture support.
+Fix a few compiler warnings.
+
+11/5/00 KJB
+Continued work on GX2, much stabler now, but I think there is a lockup case
+left if you enable pci_burst and pci_retry with accel. I still see screen
+flashes with vertical bars once in a while, and the log reports a GEReset.
+Added fbPicture (render) support, untested. XV code for GX2 is added,
+but not working yet.
+
+10/29/00 KJB
+Much work on GX2, now SWCursor locks up but HWCursor is stable, go figure.
+Loading Netscape a couple times with the mail window was enough to lock it
+up twice in a row. Server was locked but not a box (PCI) lock. Also,
+vertical barring still occurred a couple times, so HW cursor wasn't causing
+that. Try blt_bug flag again for lock up case. And attach to debug server
+and bt... Sleep now...
+
10/21/00 KJB
Ver 1.3.0
Depth 16 Xv support added. Testing on ViRGE DX. 1280x1024x24 is noisy, so
@@ -225,4 +259,4 @@ the new config. management stuff may help here.
-$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.16 2000/10/23 12:10:15 alanh Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.18 2000/11/28 20:59:17 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h
index ddd93555a..2267c744e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.24 2000/11/02 16:29:12 anderson Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.26 2000/11/28 20:59:17 dawes Exp $ */
/*
Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
@@ -75,6 +75,7 @@ in this Software without prior written authorization from the XFree86 Project.
/* Drivers using the XAA interface ... */
#include "xaa.h"
+#include "xaalocal.h"
#include "xf86cmap.h"
#include "xf86i2c.h"
@@ -139,8 +140,9 @@ typedef struct {
unsigned char CR40, CR41, CR42, CR43, CR45;
unsigned char CR51, CR53, CR54, CR55, CR58, CR5D, CR5E;
unsigned char CR63, CR65, CR66, CR67, CR68, CR69, CR6D; /* Video attrib. */
- unsigned char CR85, CR86;
- unsigned char CR90, CR91;
+ unsigned char CR7B, CR7D;
+ unsigned char CR85, CR86, CR87;
+ unsigned char CR90, CR91, CR92, CR93;
unsigned char ColorStack[8]; /* S3 hw cursor color stack CR4A/CR4B */
unsigned int STREAMS[22]; /* Streams regs */
unsigned int MMPR0, MMPR1, MMPR2, MMPR3; /* MIU regs */
@@ -168,7 +170,7 @@ typedef struct {
/* S3VRec */
/*************************/
-typedef struct {
+typedef struct tagS3VRec {
/* accel additions */
CARD32 AccelFlags;
CARD32 AccelCmd;
@@ -247,9 +249,14 @@ typedef struct {
/* Limit the number of errors */
/* printed using a counter */
int GEResetCnt;
+ /* Accel WaitFifo function */
+ void (*pWaitFifo)(struct tagS3VRec *, int);
+ /* Accel WaitCmd function */
+ void (*pWaitCmd)(struct tagS3VRec *);
+
/*************************/
/* ViRGE options -start- */
-
+ /*************************/
/* Enable PCI burst mode for reads? */
Bool pci_burst;
/* Diasable PCI retries */
@@ -389,6 +396,10 @@ extern void S3VCommonCalcClock(long freq, int min_m, int min_n1, int max_n1,
extern Bool S3VAccelInit(ScreenPtr pScreen);
extern Bool S3VAccelInit32(ScreenPtr pScreen);
void S3VAccelSync(ScrnInfoPtr);
+void S3VWaitFifoGX2(S3VPtr ps3v, int slots );
+void S3VWaitFifoMain(S3VPtr ps3v, int slots );
+void S3VWaitCmdGX2(S3VPtr ps3v);
+void S3VWaitDummy(S3VPtr ps3v);
/* s3v_hwcurs.c */
extern Bool S3VHWCursorInit(ScreenPtr pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c
index 39d718f45..0fbd2d61b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c,v 1.19 2000/10/23 12:10:15 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c,v 1.21 2000/11/28 20:59:17 dawes Exp $ */
/*
Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
@@ -63,11 +63,15 @@ static void S3VSubsequentImageWriteRect(ScrnInfoPtr, int, int, int, int, int);
static void S3VSubsequentSolidHorVertLine(ScrnInfoPtr, int, int, int, int);
static void S3VSubsequentSolidHorVertLinePlaneMask(ScrnInfoPtr, int, int,
int, int);
+#if 0
static void S3VSubsequentSolidBresenhamLine(ScrnInfoPtr, int, int, int,
int, int, int, int);
static void S3VPolylinesThinSolidWrapper(DrawablePtr, GCPtr, int, int,
DDXPointPtr);
static void S3VPolySegmentThinSolidWrapper(DrawablePtr, GCPtr, int, xSegment*);
+#endif
+static void S3VNopAllCmdSets(ScrnInfoPtr pScrn);
+
Bool
S3VAccelInit(ScreenPtr pScreen)
@@ -80,15 +84,16 @@ S3VAccelInit(ScreenPtr pScreen)
ps3v->AccelInfoRec = infoPtr = XAACreateInfoRec();
if(!infoPtr) return FALSE;
-
- switch(ps3v->Chipset) {
- case S3_ViRGE:
- case S3_ViRGE_VX:
+ switch(ps3v->Chipset)
+ {
+ case S3_ViRGE:
+ case S3_ViRGE_VX:
ps3v->AccelFlags = BLT_BUG;
- default:
+ break;
+ default:
ps3v->AccelFlags = 0;
break;
- }
+ }
ps3v->AccelFlags |= MONO_TRANS_BUG; /* which aren't broken ? */
@@ -124,24 +129,34 @@ S3VAccelInit(ScreenPtr pScreen)
#ifndef __alpha__
- /* CPU to screen color expansion */
- infoPtr->CPUToScreenColorExpandFillFlags = ROP_NEEDS_SOURCE |
+
+ /* disable color expand on GX2 until we trace down */
+ /* lockups. locate 'html' in an xterm is a good */
+ /* test case for an AGP GX2. */
+ if (!S3_ViRGE_GX2_SERIES(ps3v->Chipset))
+ {
+
+
+ /* CPU to screen color expansion */
+ infoPtr->CPUToScreenColorExpandFillFlags = ROP_NEEDS_SOURCE |
CPU_TRANSFER_PAD_DWORD |
SCANLINE_PAD_DWORD |
BIT_ORDER_IN_BYTE_MSBFIRST |
LEFT_EDGE_CLIPPING;
- if(ps3v->AccelFlags & MONO_TRANS_BUG)
- infoPtr->CPUToScreenColorExpandFillFlags |= NO_TRANSPARENCY;
+ if(ps3v->AccelFlags & MONO_TRANS_BUG)
+ infoPtr->CPUToScreenColorExpandFillFlags |= NO_TRANSPARENCY;
- infoPtr->ColorExpandRange = 0x8000;
- infoPtr->ColorExpandBase = ps3v->MapBaseDense;
- infoPtr->SetupForCPUToScreenColorExpandFill =
+ infoPtr->ColorExpandRange = 0x8000;
+ infoPtr->ColorExpandBase = ps3v->MapBaseDense;
+ infoPtr->SetupForCPUToScreenColorExpandFill =
S3VSetupForCPUToScreenColorExpand;
- infoPtr->SubsequentCPUToScreenColorExpandFill =
+ infoPtr->SubsequentCPUToScreenColorExpandFill =
S3VSubsequentCPUToScreenColorExpand;
-
+ } /* if(!GX2...) */
+
+
/* Image Writes */
infoPtr->ImageWriteFlags = ROP_NEEDS_SOURCE |
NO_TRANSPARENCY |
@@ -572,6 +587,7 @@ S3VSubsequentSolidFillRect(
WAITFIFO(2);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
}
@@ -591,6 +607,7 @@ S3VSubsequentSolidFillRectPlaneMask(
WAITFIFO(2);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
S3VWriteMask((CARD32*)ps3v->MapBaseDense, dwords);
}
@@ -653,6 +670,7 @@ S3VSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
WAITFIFO(3);
OUTREG(RWIDTH_HEIGHT, (w << 16) | h);
OUTREG(RSRC_XY, (x1 << 16) | y1);
+ WAITCMD();
OUTREG(RDEST_XY, (x2 << 16) | y2);
}
@@ -713,6 +731,7 @@ S3VSubsequentMono8x8PatternFillRect(
WAITFIFO(2);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
}
@@ -732,6 +751,7 @@ S3VSubsequentMono8x8PatternFillRectPlaneMask(
WAITFIFO(2);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
S3VWriteMask((CARD32*)ps3v->MapBaseDense, dwords);
@@ -791,6 +811,7 @@ S3VSubsequentCPUToScreenColorExpand(
WAITFIFO(3);
OUTREG(CLIP_L_R, ((x + skipleft) << 16) | 0xffff);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
}
@@ -841,6 +862,7 @@ S3VSubsequentImageWriteRect(
WAITFIFO(3);
OUTREG(CLIP_L_R, ((x + skipleft) << 16) | 0xffff);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
}
@@ -849,6 +871,9 @@ S3VSubsequentImageWriteRect(
| Lines |
\***********/
+
+#if 0 /* Some line funcs are disabled at the moment */
+
static void
S3VPolylinesThinSolidWrapper(
DrawablePtr pDraw,
@@ -884,6 +909,8 @@ S3VPolySegmentThinSolidWrapper(
XAAPolySegment(pDraw, pGC, nseg, pSeg);
}
+#endif
+
static void
S3VSubsequentSolidHorVertLine(
ScrnInfoPtr pScrn,
@@ -903,6 +930,7 @@ S3VSubsequentSolidHorVertLine(
WAITFIFO(2);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
}
@@ -925,19 +953,21 @@ S3VSubsequentSolidHorVertLinePlaneMask(
WAITFIFO(2);
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
+ WAITCMD();
OUTREG(RDEST_XY, (x << 16) | y);
S3VWriteMask((CARD32*)ps3v->MapBaseDense, dwords);
}
+#if 0 /* Line funcs are disabled at the moment */
+
static void (*LineFuncs[3])() = {
cfbBresS,
cfb16BresS,
cfb24BresS
};
-
static void
S3VSubsequentSolidBresenhamLine(
ScrnInfoPtr pScrn,
@@ -1011,6 +1041,38 @@ fbBres (DrawablePtr pDrawable,
} /*if(fb)*/
}
+#endif
+void
+S3VWaitFifoGX2(S3VPtr ps3v, int slots )
+{
+ if(ps3v->NoPCIRetry)
+ while(((INREG(SUBSYS_STAT_REG) >> 9) & 0x60) < slots){}
+}
+
+
+
+void
+S3VWaitFifoMain(S3VPtr ps3v, int slots )
+{
+ if(ps3v->NoPCIRetry)
+ while(((INREG(SUBSYS_STAT_REG) >> 8) & 0x1f) < slots){}
+}
+
+
+void
+S3VWaitCmdGX2(S3VPtr ps3v)
+{
+ while(((INREG(ADV_FUNC_CNTR) >> 6) & 0x1f) != 16){}
+}
+
+
+void
+S3VWaitDummy(S3VPtr ps3v)
+{
+ /* do nothing */
+}
+
+/*EOF*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
index 6752f9633..abeae8197 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.64 2000/11/03 18:46:13 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.68 2000/11/28 20:59:17 dawes Exp $ */
/*
Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
@@ -116,9 +116,9 @@ static int pix24bpp = 0;
#define S3VIRGE_NAME "S3VIRGE"
#define S3VIRGE_DRIVER_NAME "s3virge"
-#define S3VIRGE_VERSION_NAME "1.3.0"
+#define S3VIRGE_VERSION_NAME "1.5.0"
#define S3VIRGE_VERSION_MAJOR 1
-#define S3VIRGE_VERSION_MINOR 3
+#define S3VIRGE_VERSION_MINOR 5
#define S3VIRGE_PATCHLEVEL 0
#define S3VIRGE_DRIVER_VERSION ((S3VIRGE_VERSION_MAJOR << 24) | \
(S3VIRGE_VERSION_MINOR << 16) | \
@@ -319,6 +319,9 @@ static const char *vbeSymbols[] = {
static const char *fbSymbols[] = {
"fbScreenInit",
"fbBres",
+#ifdef RENDER
+ "fbPictureInit",
+#endif
NULL
};
@@ -336,8 +339,10 @@ static const char *cfbSymbols[] = {
"cfb24ScreenInit",
"cfb24_32ScreenInit",
"cfb32ScreenInit",
+ "cfBresS",
"cfb16BresS",
"cfb24BresS",
+ "cfb32BresS",
NULL
};
@@ -1510,7 +1515,27 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86LoaderReqSymLists(shadowSymbols, NULL);
}
-
+
+ /* Setup WAITFIFO() for accel and ModeInit() */
+ /* Needs to be done prior to first ModeInit call */
+ /* and any accel activity. */
+ switch(ps3v->Chipset)
+ {
+ /* GX2_SERIES chips, GX2 & TRIO_3D_2X */
+ case S3_ViRGE_GX2:
+ case S3_TRIO_3D_2X:
+ ps3v->pWaitFifo = S3VWaitFifoGX2;
+ ps3v->pWaitCmd = S3VWaitCmdGX2;
+ break;
+ case S3_ViRGE:
+ case S3_ViRGE_VX:
+ default:
+ ps3v->pWaitFifo = S3VWaitFifoMain;
+ /* Do nothing... */
+ ps3v->pWaitCmd = S3VWaitDummy;
+ break;
+ }
+
return TRUE;
}
@@ -1537,14 +1562,6 @@ S3VEnterVT(int scrnIndex, int flags)
#ifdef unmap_always
S3VMapMem(pScrn);
#endif
- #if 0
- /* todo - KJB - cep */
- /* New pointer mapping means we need to call */
- /* cfb...Init again and anything else required */
- /* to notify the upper layers of the change. */
- if( !S3VInternalScreenInit(scrnIndex, pScreen) )
- return FALSE;
- #endif
S3VSave(pScrn);
return S3VModeInit(pScrn, pScrn->currentMode);
}
@@ -1687,7 +1704,7 @@ S3VSave (ScrnInfoPtr pScrn)
VGAOUT8(vgaCRIndex, 0x33);
save->CR33 = VGAIN8(vgaCRReg);
if (S3_TRIO_3D_2X_SERIES(ps3v->Chipset) || S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ )
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) )
{
VGAOUT8(vgaCRIndex, 0x85);
save->CR85 = VGAIN8(vgaCRReg);
@@ -1696,6 +1713,19 @@ S3VSave (ScrnInfoPtr pScrn)
VGAOUT8(vgaCRIndex, 0x86);
save->CR86 = VGAIN8(vgaCRReg);
}
+ if (S3_ViRGE_GX2_SERIES(ps3v->Chipset) ||
+ S3_ViRGE_MX_SERIES(ps3v->Chipset) ) {
+ VGAOUT8(vgaCRIndex, 0x7B);
+ save->CR7B = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x7D);
+ save->CR7D = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x87);
+ save->CR87 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x92);
+ save->CR92 = VGAIN8(vgaCRReg);
+ VGAOUT8(vgaCRIndex, 0x93);
+ save->CR93 = VGAIN8(vgaCRReg);
+ }
if (ps3v->Chipset == S3_ViRGE_DXGX || S3_ViRGE_GX2_SERIES(ps3v->Chipset) ||
S3_ViRGE_MX_SERIES(ps3v->Chipset)) {
VGAOUT8(vgaCRIndex, 0x90);
@@ -1773,7 +1803,7 @@ S3VSave (ScrnInfoPtr pScrn)
/* Now save Memory Interface Unit registers */
if( S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ )
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) )
{
/* No MMPR regs on MX & GX2 */
}
@@ -1910,9 +1940,6 @@ S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore)
VGAOUT8(vgaCRIndex, 0x55);
VGAOUT8(vgaCRReg, restore->CR55);
- /* cep kjb
- sleep( 7 );*/
-
/* Extended mode timings registers */
VGAOUT8(vgaCRIndex, 0x53);
VGAOUT8(vgaCRReg, restore->CR53);
@@ -1931,9 +1958,6 @@ S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore)
VGAOUT8(vgaCRIndex, 0x6d);
VGAOUT8(vgaCRReg, restore->CR6D);
- /* cep kjb
- sleep( 7 );*/
-
/* Restore the desired video mode with CR67 */
VGAOUT8(vgaCRIndex, 0x67);
@@ -1974,7 +1998,7 @@ S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore)
VGAOUT8(vgaCRIndex, 0x33);
VGAOUT8(vgaCRReg, restore->CR33);
if (S3_TRIO_3D_2X_SERIES(ps3v->Chipset) || S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ )
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) )
{
VGAOUT8(vgaCRIndex, 0x85);
VGAOUT8(vgaCRReg, restore->CR85);
@@ -1983,6 +2007,18 @@ S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore)
VGAOUT8(vgaCRIndex, 0x86);
VGAOUT8(vgaCRReg, restore->CR86);
}
+ if (ps3v->Chipset == S3_ViRGE_GX2) {
+ VGAOUT8(vgaCRIndex, 0x7B);
+ VGAOUT8(vgaCRReg, restore->CR7B);
+ VGAOUT8(vgaCRIndex, 0x7D);
+ VGAOUT8(vgaCRReg, restore->CR7D);
+ VGAOUT8(vgaCRIndex, 0x87);
+ VGAOUT8(vgaCRReg, restore->CR87);
+ VGAOUT8(vgaCRIndex, 0x92);
+ VGAOUT8(vgaCRReg, restore->CR92);
+ VGAOUT8(vgaCRIndex, 0x93);
+ VGAOUT8(vgaCRReg, restore->CR93);
+ }
if (ps3v->Chipset == S3_ViRGE_DXGX || S3_ViRGE_GX2_SERIES(ps3v->Chipset) ||
S3_ViRGE_MX_SERIES(ps3v->Chipset)) {
VGAOUT8(vgaCRIndex, 0x90);
@@ -2090,7 +2126,7 @@ S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore)
VerticalRetraceWait();
if (S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ )
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) )
{
VGAOUT8(vgaCRIndex, 0x85);
/* primary stream threshold */
@@ -2101,7 +2137,7 @@ S3VWriteMode (ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, S3VRegPtr restore)
OUTREG(FIFO_CONTROL_REG, restore->MMPR0);
}
if( !( S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ ))
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) ))
{
WaitIdle(); /* Don't ask... */
OUTREG(MIU_CONTROL_REG, restore->MMPR1);
@@ -2443,14 +2479,7 @@ S3VScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
- /* Problem with accel appears to crash GX2 on mouse moves */
- /* re-enable this when fixed. */
- if( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
- {}
- else
- {
- xf86SetSilkenMouse(pScreen);
- }
+ xf86SetSilkenMouse(pScreen);
/* hardware cursor needs to wrap this layer */
S3VDGAInit(pScreen);
@@ -2600,6 +2629,10 @@ S3VInternalScreenInit( int scrnIndex, ScreenPtr pScreen)
ret = FALSE;
break;
}
+#ifdef RENDER
+ if (ret)
+ fbPictureInit (pScreen, 0, 0);
+#endif
}
else
{
@@ -2721,10 +2754,10 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
VGAOUT8(vgaCRIndex, 0x3a);
tmp = VGAIN8(vgaCRReg);
if( S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ )
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) )
{
if(ps3v->pci_burst)
- new->CR3A = (tmp & 0x78) | 0x10; /* ENH 256, PCI burst */
+ new->CR3A = (tmp & 0x38) | 0x10; /* ENH 256, PCI burst */
else
new->CR3A = tmp | 0x90; /* ENH 256, no PCI burst! */
}
@@ -2754,8 +2787,17 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
new->CR63 = 0x09;
}
else {
- new->CR66 = 0x89;
- new->CR63 = 0;
+ new->CR66 = 0x89;
+ /* Set display fifo */
+ if( S3_ViRGE_GX2_SERIES(ps3v->Chipset) ||
+ S3_ViRGE_MX_SERIES(ps3v->Chipset) )
+ {
+ new->CR63 = 0x08;
+ }
+ else
+ {
+ new->CR63 = 0;
+ }
}
/* Now set linear addr. registers */
@@ -2909,19 +2951,19 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if (pScrn->bitsPerPixel == 8)
new->CR67 = 0x00;
else if (pScrn->bitsPerPixel == 16) {
+ /* XV support needs STREAMS in depth 16 */
+ ps3v->NeedSTREAMS = TRUE;
+ S3VInitSTREAMS(pScrn, new->STREAMS, mode);
if (pScrn->weight.green == 5)
- new->CR67 = 0x30; /* 15bpp */
+ new->CR67 = 0x30 | 0x4; /* 15bpp */
else
- new->CR67 = 0x50; /* 16bpp */
+ new->CR67 = 0x50 | 0x4; /* 16bpp */
}
- else if ((pScrn->bitsPerPixel == 24) /* || (pScrn->bitsPerPixel == 32) */ ) {
- new->CR67 = 0x74; /* 24bpp, STREAMS */
+ else if ((pScrn->bitsPerPixel == 24) ) {
+ new->CR67 = 0x74; /* 24bpp, STREAMS */
/* Flag STREAMS proc. required */
ps3v->NeedSTREAMS = TRUE;
S3VInitSTREAMS(pScrn, new->STREAMS, mode);
- /* MXTESTME - remove the next 2 lines completely */
- if( S3_ViRGE_MX_SERIES(ps3v->Chipset) )
- new->MMPR0 = 0xc098; /* Adjust FIFO slots */
}
else if (pScrn->bitsPerPixel == 32) {
new->CR67 = 0xd0; /* 32bpp */
@@ -3040,8 +3082,8 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
else if (pScrn->bitsPerPixel == 16) {
new->CR67 = 0x50 | 0x0c;
- /* Flag STREAMS proc. required */
- /* cep */
+ /* Flag STREAMS proc. required */
+ /* XV support needs STREAMS in depth 16 */
ps3v->NeedSTREAMS = TRUE;
S3VInitSTREAMS(pScrn, new->STREAMS, mode);
/*new->MMPR0 = 0xc000; / Adjust FIFO slots */
@@ -3054,7 +3096,6 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
S3VInitSTREAMS(pScrn, new->STREAMS, mode);
/*new->MMPR0 = 0xc000; / Adjust FIFO slots */
new->MMPR0 = 0x107c02; /* Adjust FIFO slots, overlay */
- /* kjb cep */
}
else if (pScrn->bitsPerPixel == 32) {
new->CR67 = 0xd0 | 0x0c;
@@ -3091,9 +3132,16 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
new->CR42 = 0x00;
}
- /* Set display fifo */
- new->CR34 = 0x10;
-
+ if(S3_ViRGE_GX2_SERIES(ps3v->Chipset) ||
+ S3_ViRGE_MX_SERIES(ps3v->Chipset) )
+ {
+ new->CR34 = 0;
+ }
+ else
+ {
+ /* Set display fifo */
+ new->CR34 = 0x10;
+ }
/* Now we adjust registers for extended mode timings */
/* This is taken without change from the accel/s3_virge code */
@@ -3138,11 +3186,20 @@ S3VModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
new->CR33 = 0x20;
if (S3_TRIO_3D_2X_SERIES(ps3v->Chipset) || S3_ViRGE_GX2_SERIES(ps3v->Chipset)
- /* MXTESTME || S3_ViRGE_MX_SERIES(ps3v->Chipset) */ )
+ /* MXTESTME */ || S3_ViRGE_MX_SERIES(ps3v->Chipset) )
{
- new->CR85 = 0x1f; /* avoid sreen flickering */
+ new->CR85 = 0x12; /* avoid sreen flickering */
/* by increasing FIFO filling, larger # fills FIFO from memory earlier */
/* on GX2 this affects all depths, not just those running STREAMS. */
+ /* new, secondary stream settings. */
+ new->CR87 = 0x10;
+ /* gx2 - set up in XV init code */
+ new->CR92 = 0x00;
+ new->CR93 = 0x00;
+ /* gx2 primary mclk timeout, def=0xb */
+ new->CR7B = 0xb;
+ /* gx2 secondary mclk timeout, def=0xb */
+ new->CR7D = 0xb;
}
if (ps3v->Chipset == S3_ViRGE_DXGX || S3_TRIO_3D_SERIES(ps3v->Chipset)) {
new->CR86 = 0x80; /* disable DAC power saving to avoid bright left edge */
@@ -3318,6 +3375,8 @@ S3VSaveScreen(ScreenPtr pScreen, int mode)
static void
S3VInitSTREAMS(ScrnInfoPtr pScrn, unsigned int *streams, DisplayModePtr mode)
{
+ PVERB5(" S3VInitSTREAMS\n");
+
switch (pScrn->bitsPerPixel)
{
case 16:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h
index a6ca27eda..c8d1ef8c8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h,v 1.9 2000/03/31 20:13:33 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h,v 1.11 2000/11/28 20:59:18 dawes Exp $ */
/*
Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
@@ -33,6 +33,7 @@ in this Software without prior written authorization from the XFree86 Project.
/* miscellaneous registers */
#define SUBSYS_STAT_REG 0x8504
+#define ADV_FUNC_CNTR 0x850c
/* memory port controller registers */
#define FIFO_CONTROL_REG 0x8200
@@ -95,9 +96,10 @@ in this Software without prior written authorization from the XFree86 Project.
#define MAXLOOP 0x0fffff /* timeout value for engine waits, 0.5 secs */
-
-#define WAITFIFO(n) if(ps3v->NoPCIRetry) \
- while(((INREG(SUBSYS_STAT_REG) >> 8) & 0x1f) < n){}
+/* Switchable per chipset, must be initialized prior to a mode */
+/* switch! */
+#define WAITFIFO(n) ((*ps3v->pWaitFifo)(ps3v,n))
+#define WAITCMD() ((*ps3v->pWaitCmd)(ps3v))
#define WAITIDLE()\
do { int loop=0; mem_barrier(); \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c
index 8fd912834..87c0076e1 100755
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.1 2000/10/23 14:54:45 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.2 2000/11/28 20:59:18 dawes Exp $ */
/*
Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved.
@@ -107,6 +107,7 @@ void S3VInitVideo(ScreenPtr pScreen)
)
&&
((ps3v->Chipset == S3_ViRGE_DXGX) ||
+ /* S3_ViRGE_GX2_SERIES(ps3v->Chipset) || */
(ps3v->Chipset == S3_ViRGE)
)
&& !ps3v->NoAccel
@@ -301,7 +302,15 @@ S3VQueryBestSize(
pointer data
){
*p_w = drw_w;
- *p_h = drw_h;
+ *p_h = drw_h;
+
+#if 0
+ /* Only support scaling up, no down scaling. */
+ /* This doesn't seem to work (at least for XMovie) */
+ /* and the DESIGN doc says this is illegal anyway... */
+ if( drw_w < vid_w ) *p_w = vid_w;
+ if( drw_h < vid_h ) *p_h = vid_h;
+#endif
}
@@ -361,11 +370,11 @@ S3VCopyMungedData(
static void
S3VResetVideoOverlay(ScrnInfoPtr pScrn)
{
+ /* empty for ViRGE at the moment... */
+#if 0
S3VPtr ps3v = S3VPTR(pScrn);
S3VPortPrivPtr pPriv = ps3v->portPrivate;
- /* empty for ViRGE at the moment... */
-#if 0
MGAPtr pMga = MGAPTR(pScrn);
MGAPortPrivPtr pPriv = pMga->portPrivate;
@@ -421,21 +430,12 @@ S3VAllocAdaptor(ScrnInfoPtr pScrn)
xvColorKey = MAKE_ATOM("XV_COLORKEY");
#endif
- pPriv->colorKey = /*pMga->videoKey;*/
- /*cep*/
+ pPriv->colorKey =
(1 << pScrn->offset.red) |
(1 << pScrn->offset.green) |
(((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
#if 0
- pScrn->mask.red | pScrn->mask.green | pScrn->mask.blue;
- (1 << (pScrn->offset.red+4)) |
- (1 << (pScrn->offset.green+5)) |
- (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
-#endif
-
-
-#if 0
pPriv->brightness = 0;
pPriv->contrast = 128;
#endif
@@ -630,6 +630,13 @@ S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
S3VPtr ps3v = S3VPTR(pScrn);
S3VPortPrivPtr pPriv = ps3v->portPrivate;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ /* S3VPtr ps3v = S3VPTR(pScrn);*/
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+ vgaIOBase = hwp->IOBase;
+ vgaCRIndex = vgaIOBase + 4;
+ vgaCRReg = vgaIOBase + 5;
+
#if 0
MGAPtr pMga = MGAPTR(pScrn);
MGAPortPrivPtr pPriv = pMga->portPrivate;
@@ -642,10 +649,31 @@ S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
if(exit) {
if(pPriv->videoStatus & CLIENT_VIDEO_ON)
{
+#if 0
/*OUTREG(MGAREG_BESCTL, 0);*/
/*OUTREG(SSTREAM_CONTROL_REG, 0x02000000);*/
- /* Primary over secondary */
- OUTREG(BLEND_CONTROL_REG, 0x01000000);
+
+ OUTREG(SSTREAM_CONTROL_REG, 0);
+ /*OUTREG(SSTREAM_STRIDE_REG, 0 );*/
+
+ /*OUTREG(K1_VSCALE_REG, 0 );
+ OUTREG(K2_VSCALE_REG, 0 );
+ */
+ OUTREG(DDA_VERT_REG, 0 );
+
+ /*OUTREG(SSTREAM_START_REG, ((dstBox->x1 +1) << 16) | (dstBox->y1 +1));
+ OUTREG(SSTREAM_WINDOW_SIZE_REG, 0);
+ */
+#endif
+ if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
+ {
+ OUTREG(SSTREAM_CONTROL_REG, 0);
+ }
+ else
+ {
+ /* Primary over secondary */
+ OUTREG(BLEND_CONTROL_REG, 0x01000000);
+ }
}
if(pPriv->area) {
@@ -724,11 +752,7 @@ S3VDisplayVideoOverlay(
/* dst width and height */
short drw_w, short drw_h
){
-#if 0
- MGAPtr pMga = MGAPTR(pScrn);
-#endif
int tmp;
- int flag;
#if 0
CHECK_DMA_QUIESCENT(pMga, pScrn);
@@ -736,6 +760,13 @@ S3VDisplayVideoOverlay(
S3VPtr ps3v = S3VPTR(pScrn);
S3VPortPrivPtr pPriv = ps3v->portPrivate;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ /* S3VPtr ps3v = S3VPTR(pScrn);*/
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+ vgaIOBase = hwp->IOBase;
+ vgaCRIndex = vgaIOBase + 4;
+ vgaCRReg = vgaIOBase + 5;
+
#if 0
/* got 64 scanlines to do it in */
tmp = INREG(MGAREG_VCOUNT) + 64;
@@ -746,7 +777,11 @@ S3VDisplayVideoOverlay(
/* Reference at http://www.webartz.com/fourcc/ */
/* Looks like ViRGE only supports YUY2 and Y211?, */
/* listed as YUV-16 (4.2.2) and YUV (2.1.1) in manual. */
-
+
+#if 0
+ /* Only supporting modes we listed for the time being, */
+ /* No, switching required... #if 0'd this out */
+
switch(id) {
case FOURCC_UYVY:
/*
@@ -781,108 +816,131 @@ S3VDisplayVideoOverlay(
/*OUTREG(SSTREAM_CONTROL_REG, 0x02000000); / YUV-16 */
/* works for xvtest and suzi */
/* OUTREG(SSTREAM_CONTROL_REG, 0x01000000); * YCbCr-16 * no scaling */
+
/* calc horizontal scale factor */
- /*tmp = drw_w / src_w;*/
+ tmp = drw_w / src_w;
if (drw_w == src_w) tmp = 0;
- else tmp =2;
- /*tmp &= 3;*/
+ else if (tmp>=4) tmp =3;
+ else if (tmp>=2) tmp =2;
+ else tmp =1;
+
/* YCbCr-16 */
- if( drw_w == src_w ) flag = 1; else flag = 0;
OUTREG(SSTREAM_CONTROL_REG,
tmp << 28 | 0x01000000 |
((((src_w-1)<<1)-(drw_w-1)) & 0xfff)
);
break;
}
+#endif
+
+ /* calc horizontal scale factor */
+ if (drw_w == src_w)
+ tmp = 0;
+ else
+ tmp =2;
+ /* YCbCr-16 */
+ if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
+ {
+ OUTREG(SSTREAM_CONTROL_REG,
+ tmp << 28 | 0x05000000 | 0x800000 |
+ ((((src_w-1)<<1)-(drw_w-1)) & 0xfff)
+ );
+ }
+ else
+ {
+ OUTREG(SSTREAM_CONTROL_REG,
+ tmp << 28 | 0x01000000 |
+ ((((src_w-1)<<1)-(drw_w-1)) & 0xfff)
+ );
+ }
OUTREG(SSTREAM_STRETCH_REG,
((src_w - 1) & 0x7ff) | (((src_w-drw_w) & 0x7ff) << 16)
);
-#if 0
- /* Opaque overlay secondary stream */
- OUTREG(BLEND_CONTROL_REG, 0x00000000);
-#else
+
/* Color key on primary */
- OUTREG(BLEND_CONTROL_REG, 0x05000000);
-#endif
+ if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
+ {
+ /*OUTREG(BLEND_CONTROL_REG, 0x00000000)*/
+ ;
+ }
+ else
+ {
+ OUTREG(BLEND_CONTROL_REG, 0x05000000);
+ }
OUTREG(SSTREAM_FBADDR0_REG, offset & 0x3fffff );
- OUTREG(SSTREAM_STRIDE_REG, (pitch /*>> 1*/) & 0xfff );
+ OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff );
OUTREG(K1_VSCALE_REG, src_h-1 );
OUTREG(K2_VSCALE_REG, (src_h - drw_h) & 0x7ff );
- OUTREG(DDA_VERT_REG, (((~drw_h)-1)) & 0xfff );
+
+ if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
+ {
+ /* enable vert interp. & bandwidth saving - gx2 */
+ OUTREG(DDA_VERT_REG, (((~drw_h)-1) & 0xfff ) |
+ /* bw & vert interp */
+ 0xc000
+ /* no bw save 0x8000*/
+ );
+ }
+ else
+ {
+ OUTREG(DDA_VERT_REG, (((~drw_h)-1)) & 0xfff );
+ }
OUTREG(SSTREAM_START_REG, ((dstBox->x1 +1) << 16) | (dstBox->y1 +1));
OUTREG(SSTREAM_WINDOW_SIZE_REG,
( ((drw_w-1) << 16) | (drw_h ) ) & 0x7ff07ff
);
-#if 0
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Weights r:%X g:%X b:%X "
- "ck:%X mb:%X or:%X ob:%X ckc:%X\n" ,
- pScrn->weight.red,
- pScrn->weight.green,
- pScrn->weight.blue,
- pPriv->colorKey,
- pScrn->mask.blue,
- pScrn->offset.red,
- pScrn->offset.blue,
- /*0x17000000*/ 0x10000000 | ((pScrn->weight.red-1) << 24) |
- ((pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red)<<16<<3 |
- ((pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green)<<8<<2 |
- ((pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue)<<3
-
- );
-#endif
-
/*cep*/
- OUTREG(COL_CHROMA_KEY_CONTROL_REG,
- /* color key ON */
- 0x10000000 |
- /* # bits to compare */
- ((pScrn->weight.red-1) << 24) |
-
- ((pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red) <<
- (16 + 8-pScrn->weight.red) |
+ if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
+ {
+ OUTREG(COL_CHROMA_KEY_CONTROL_REG,
+ /* color key ON */
+ /*0xc0000000 | */
+ /*0x40000000 | */
+ 0x40000000 |
+ /* # bits to compare */
+ ((pScrn->weight.red-1) << 24) |
+
+ ((pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red) <<
+ (16 + 8-pScrn->weight.red) |
- ((pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green) <<
- (8 + 8-pScrn->weight.green) |
+ ((pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green) <<
+ (8 + 8-pScrn->weight.green) |
- ((pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue) <<
- (8-pScrn->weight.blue)
- );
-
-#if 0
- OUTREG(MGAREG_BESA1ORG, offset);
-
- if(y1 & 0x00010000)
- OUTREG(MGAREG_BESCTL, 0x00050c41);
+ ((pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue) <<
+ (8-pScrn->weight.blue)
+ );
+ }
else
- OUTREG(MGAREG_BESCTL, 0x00050c01);
-
- OUTREG(MGAREG_BESHCOORD, (dstBox->x1 << 16) | (dstBox->x2 - 1));
- OUTREG(MGAREG_BESVCOORD, (dstBox->y1 << 16) | (dstBox->y2 - 1));
-
- OUTREG(MGAREG_BESHSRCST, x1 & 0x03fffffc);
- OUTREG(MGAREG_BESHSRCEND, (x2 - 0x00010000) & 0x03fffffc);
- OUTREG(MGAREG_BESHSRCLST, (width - 1) << 16);
-
- OUTREG(MGAREG_BESPITCH, pitch >> 1);
-
- OUTREG(MGAREG_BESV1WGHT, y1 & 0x0000fffc);
- OUTREG(MGAREG_BESV1SRCLST, height - 1 - (y1 >> 16));
-
- tmp = ((src_h - 1) << 16)/drw_h;
- if(tmp >= (32 << 16))
- tmp = (32 << 16) - 1;
- OUTREG(MGAREG_BESVISCAL, tmp & 0x001ffffc);
+ {
+ OUTREG(COL_CHROMA_KEY_CONTROL_REG,
+ /* color key ON */
+ 0x10000000 |
+ /* # bits to compare */
+ ((pScrn->weight.red-1) << 24) |
+
+ ((pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red) <<
+ (16 + 8-pScrn->weight.red) |
+
+ ((pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green) <<
+ (8 + 8-pScrn->weight.green) |
+
+ ((pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue) <<
+ (8-pScrn->weight.blue)
+ );
+ }
- tmp = (((src_w - 1) << 16)/drw_w) << 1;
- if(tmp >= (32 << 16))
- tmp = (32 << 16) - 1;
- OUTREG(MGAREG_BESHISCAL, tmp & 0x001ffffc);
-#endif /*0*/
+ if ( S3_ViRGE_GX2_SERIES(ps3v->Chipset) )
+ {
+ VGAOUT8(vgaCRIndex, 0x92);
+ VGAOUT8(vgaCRReg, (((pitch + 7) / 8) >> 8) | 0x80);
+ VGAOUT8(vgaCRIndex, 0x93);
+ VGAOUT8(vgaCRReg, (pitch + 7) / 8);
+ }
}
@@ -903,8 +961,8 @@ S3VPutImage(
S3VPortPrivPtr pPriv = ps3v->portPrivate;
INT32 x1, x2, y1, y2;
unsigned char *dst_start;
- int pitch, new_h, offset, offset2, offset3;
- int srcPitch, srcPitch2, dstPitch;
+ int pitch, new_h, offset, offset2=0, offset3=0;
+ int srcPitch, srcPitch2=0, dstPitch;
int top, left, npixels, nlines;
BoxRec dstBox;
CARD32 tmp;
@@ -1022,7 +1080,7 @@ S3VPutImage(
REGION_RECTS(clipBoxes));
}
- offset += top * dstPitch;
+ offset += left + (top * dstPitch);
S3VDisplayVideoOverlay(pScrn, id, offset, width, height, dstPitch,
x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp
index 0b9a73b71..5ce786002 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp
+++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp,v 1.9 2000/06/14 02:13:13 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp,v 1.10 2000/11/28 20:59:18 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH s3virge __drivermansuffix__ "Version 4.0.1" "XFree86"
@@ -148,6 +148,12 @@ Using it decreases performance, as it uses software emulation for drawing
operations the video driver can accelerate with hardware.
Default: acceleration is enabled.
.TP
+.B "Option \*qUseFB\*q"
+There are two framebuffer rendering methods. fb and cfb. Both are
+available in the driver. fb is the newer and default method. To switch
+back to cfb use this option with no, off or other negative parameter.
+Default: on.
+.TP
.BR "Option \*qfifo_aggressive " | " fifo_moderate " | " fifo_conservative\*q"
alter the settings
for the threshold at which the pixel FIFO takes over the internal
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/CALLMAP b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/CALLMAP
new file mode 100644
index 000000000..b7c9043d4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/CALLMAP
@@ -0,0 +1,22 @@
+-- Only Once, calling order --
+ChipIdentify (SMIIdentify)
+ChipProbe (SMIProbe)
+ Passive only, no ram determination, no writing
+
+-- For each ScrnInfoRec, still calling order --
+ChipPreInit (SMIPreInit)
+ Allows probing and mapping, hardware must remain unchanged
+ ChipGetRec
+
+ChipScreenInit
+ ChipMapMem
+ ChipSave
+ vgaHWSaveMMIO
+ ChipModeInit
+ vtSema=TRUE
+ ChipWriteMode
+ vgaHWRestoreMMIO
+
+Header: \\Mercury\Projects\archives\XFree86 4.0\CALLMAP.-arc 1.1 13 Jul 2000 18:16:58 Frido $
+
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/CALLMAP,v 1.1 2000/11/28 20:59:18 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile
new file mode 100644
index 000000000..f3873694a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile
@@ -0,0 +1,60 @@
+XCOMM Header: //Mercury/Projects/archives/XFree86/4.0/Imakefile.-arc 1.4 02 Aug 2000 13:17:16 Frido $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile,v 1.1 2000/11/28 20:59:18 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS = smi_driver.c smi_accel.c smi_dac.c smi_hwcurs.c smi_dga.c smi_i2c.c \
+ smi_shadow.c smi_video.c
+
+OBJS = smi_driver.o smi_accel.o smi_dac.o smi_hwcurs.o smi_dga.o smi_i2c.o \
+ smi_shadow.o smi_video.o
+
+DEFINES = -DPSZ=8
+
+#if defined(XF86DriverSDK)
+INCLUDES = -I. -I../../include
+#else
+INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
+ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \
+ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \
+ -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \
+ -I$(XF86SRC)/ramdac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
+ -I$(SERVERSRC)/Xext -I$(XF86SRC)/int10 \
+ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) -I$(SERVERSRC)/fb \
+ -I$(SERVERSRC)/render -I$(XF86OSSRC)/vbe
+#endif
+
+#if MakeHasPosixVariableSubstitutions
+SubdirLibraryRule($(OBJS))
+#endif
+
+NormalAsmObjectRule()
+
+ModuleObjectRule()
+ObjectModuleTarget(siliconmotion, $(OBJS))
+
+InstallObjectModule(siliconmotion,$(MODULEDIR),drivers)
+
+#if !defined(XF86DriverSDK)
+CppManTarget(siliconmotion,)
+InstallModuleManPage(siliconmotion)
+#endif
+
+DependTarget()
+
+InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_accel.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_dac.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_dga.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_driver.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_hwcurs.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_i2c.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_shadow.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_video.c,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(regsmi.h,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi.h,$(DRIVERSDKDIR)/drivers/siliconmotion)
+InstallDriverSDKNonExecFile(smi_video.h,$(DRIVERSDKDIR)/drivers/siliconmotion)
+
+InstallDriverSDKObjectModule(siliconmotion,$(DRIVERSDKMODULEDIR),drivers)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README
new file mode 100644
index 000000000..3e8b8b264
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README
@@ -0,0 +1,74 @@
+What works:
+- Supports 8bpp, 16bpp and 24bpp. Heavy testing on SM720.
+
+XCONFIG options:
+
+The driver supports quite a few different XConfig options, which can
+be used to tune the driver and improve performance. Without any options,
+the driver will use conservative settings which should work on most
+hardware. Large improvements in performance are possible by selecting
+the proper options, which will probably work on most systems.
+
+Cursor:
+
+- "hwcursor" "off" behaves exactly like "swcursor". Default: "on"
+- "swcursor" will disable the HW Cursor. HW Cursor is used by default and
+ no option is needed to enable it.
+
+Display:
+
+- "ShadowFB" Use shadow framebuffer. Default: off.
+- "Rotate" "cw" | "ccw" Rotate the screen CW - clockwise or CCW - counter
+ clockwise. Uses ShadowFB. Default: no rotation.
+
+Overlays:
+
+- "VideoKey" Set chroma key for video. Default: Off blue.
+- "ByteSwap" Turn on YUV byte swapping. Defaul: off.
+
+Video memory:
+
+- "set_mclk" sets the memory clock, format is:
+ Option "set_mclk" "50000"
+ in the XF86Config file. Valid values are any
+ integer <= 100000, where 100000 == 100 MHz.
+
+Acceleration and graphic engine:
+
+- "NoAccel" turns off all acceleration
+- "fifo_aggressive", "fifo_moderate" and "fifo_conservative" alter the settings
+ for the threshold at which the pixel FIFO takes over the internal
+ memory bus to refill itself. The smaller this threshold, the better
+ the acceleration performance of the card. You may try the fastest
+ setting ("aggressive") and move down if you encounter pixel corruption.
+ The optimal setting will probably depend on dot-clock and on color
+ depth. Note that specifying any of these options will also alter other
+ memory settings which should increase performance, so you should at
+ least use "fifo_conservative" (this uses the chip defaults).
+- Common XAA acceleration options to disable primitives for test purposes:
+ "XaaNoScreenToScreenCopy"
+ "XaaNoSolidFillRect"
+ "XaaNoColor8x8PatternFillRect"
+ "XaaNoImageWriteRect"
+ "XaaNoPixmapCache"
+
+PCI bus:
+
+- "pci_burst" will enable PCI burst mode. This should work on all but a
+ few "broken" PCI chipsets, and will increase performance. Option may
+ take a parameter "on", "off", "yes", etc...
+- "pci_retry" will allow the driver to rely on PCI Retry to program the
+ ViRGE registers. "pci_burst" must be enabled for this to work.
+ This will increase performance, especially for small fills/blits,
+ because the driver does not have to poll the ViRGE before sending it
+ commands to make sure it is ready. It should work on most
+ recent PCI chipsets.
+
+Debug:
+
+- "ShowCache" Enable or disable viewing offscreen cache memory. A
+ development debug option. Default: off.
+
+Header: //Mercury/Projects/archives/XFree86/4.0/README.-arc 1.2 14 Sep 2000 12:28:36 Frido $
+
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.1 2000/11/28 20:59:18 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt
new file mode 100644
index 000000000..28fca6afc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt
@@ -0,0 +1,126 @@
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.8, 11/27/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#640 - X Windows shift to the right when start X Windows or apply Rotation.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.7, 11/17/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#676 - Green color only shown in window when run Xlive in Linux.
+#835 - Screen black after DPMS on.
+
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.6, 11/03/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#687 - Blue rectangle appears when video is clipped on thr right edge of screen.
+#735 - When resume from sleep, X Windows does not wake up.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.5, 10/06/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#578 - Don't check for CRT-only when validating modes.
+#579 - Corrected DPI issue when DDC monitor is not attached.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.4, 09/20/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#521 - Screen corruption after return from X Server when vesafb is used.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.3, 09/18/2000
+--------------------------------------------------------------------------------
+
+New features:
+
+- Added live video capture.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.2, 09/14/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#486 - Video scaling wrong on SM720.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.1, 08/23/2000
+--------------------------------------------------------------------------------
+
+New features:
+
+- Added support for overlays.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0.1
+ Alpha Release 1.1.0, 08/11/2000
+--------------------------------------------------------------------------------
+
+New features:
+
+- Added support for XFree86 4.0.1 server. This implies that support for the 4.0
+ server has gone. Hence the change in the alpha version number from 1.0.x to
+ 1.1.x.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0
+ Alpha Release 1.0.2, 08/02/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#161, Corruption when moving windows with a wallpaper background.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0
+ Alpha Release 1.0.1, 07/27/2000
+--------------------------------------------------------------------------------
+
+Fixed bugs:
+
+#160, Mouse pointer sometimes in bad location.
+#258, Temporary corruption starting X.
+
+--------------------------------------------------------------------------------
+ Silicon Motion Driver for XFree86 4.0
+ Alpha Release 1.0.0, 06/05/2000
+--------------------------------------------------------------------------------
+
+This is alpha version 1.0.0 of the Silicon Motion drivers for the XFree86 4.0
+server. See the README file for general information.
+
+This ALPHA version has the following known problems:
+
+- During mode initialization, the screen shows temporary garbage.
+- Image Transfers are disabled in the hardware for now.
+
+This driver has been tested on the LynxEM+ 712 chip under 16-bit mode. Any other
+mode might still show lock-ups and/or garbage. Please report any problems to
+frido@siliconmotion.com.
+
+Header: //Mercury/Projects/archives/XFree86/4.0/Release.txt-arc 1.23 27 Nov 2000 14:22:48 Frido $
+
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.1 2000/11/28 20:59:18 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h
new file mode 100644
index 000000000..2b9bcc727
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h
@@ -0,0 +1,207 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/regsmi.h-arc 1.11 14 Sep 2000 11:17:30 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and SIlicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+
+#ifndef _REGSMI_H
+#define _REGSMI_H
+
+#define SMI_LYNX_SERIES(chip) ((chip & 0xF0F0) == 0x0010)
+#define SMI_LYNX3D_SERIES(chip) ((chip & 0xF0F0) == 0x0020)
+#define SMI_LYNXEM_SERIES(chip) ((chip & 0xFFF0) == 0x0710)
+#define SMI_LYNXM_SERIES(chip) ((chip & 0xFF00) == 0x0700)
+
+/* Chip tags */
+#define PCI_SMI_VENDOR_ID PCI_VENDOR_SMI
+#define SMI_UNKNOWN 0
+#define SMI_LYNX PCI_CHIP_SMI910
+#define SMI_LYNXE PCI_CHIP_SMI810
+#define SMI_LYNX3D PCI_CHIP_SMI820
+#define SMI_LYNXEM PCI_CHIP_SMI710
+#define SMI_LYNXEMplus PCI_CHIP_SMI712
+#define SMI_LYNX3DM PCI_CHIP_SMI720
+
+/* I/O Functions */
+static __inline__ CARD8
+VGAIN8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index)
+{
+ if (pSmi->IOBase)
+ {
+ MMIO_OUT8(pSmi->IOBase, indexPort, index);
+ return(MMIO_IN8(pSmi->IOBase, dataPort));
+ }
+ else
+ {
+ outb(indexPort, index);
+ return(inb(dataPort));
+ }
+}
+
+static __inline__ void
+VGAOUT8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index, CARD8 data)
+{
+ if (pSmi->IOBase)
+ {
+ MMIO_OUT8(pSmi->IOBase, indexPort, index);
+ MMIO_OUT8(pSmi->IOBase, dataPort, data);
+ }
+ else
+ {
+ outb(indexPort, index);
+ outb(dataPort, data);
+ }
+}
+
+static __inline__ CARD8
+VGAIN8(SMIPtr pSmi, int port)
+{
+ if (pSmi->IOBase)
+ {
+ return(MMIO_IN8(pSmi->IOBase, port));
+ }
+ else
+ {
+ return(inb(port));
+ }
+}
+
+static __inline__ void
+VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
+{
+ if (pSmi->IOBase)
+ {
+ MMIO_OUT8(pSmi->IOBase, port, data);
+ }
+ else
+ {
+ outb(port, data);
+ }
+}
+
+#define OUT_SEQ(pSmi, index, data) \
+ VGAOUT8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index), (data))
+#define IN_SEQ(pSmi, index) \
+ VGAIN8_INDEX((pSmi), VGA_SEQ_INDEX, VGA_SEQ_DATA, (index))
+
+#define WRITE_DPR(pSmi, dpr, data) MMIO_OUT32(pSmi->DPRBase, dpr, data); DEBUG((VERBLEV, "DPR%02X = %08X\n", dpr, data))
+#define READ_DPR(pSmi, dpr) MMIO_IN32(pSmi->DPRBase, dpr)
+#define WRITE_VPR(pSmi, vpr, data) MMIO_OUT32(pSmi->VPRBase, vpr, data); DEBUG((VERBLEV, "VPR%02X = %08X\n", vpr, data))
+#define READ_VPR(pSmi, vpr) MMIO_IN32(pSmi->VPRBase, vpr)
+#define WRITE_CPR(pSmi, cpr, data) MMIO_OUT32(pSmi->CPRBase, cpr, data); DEBUG((VERBLEV, "CPR%02X = %08X\n", cpr, data))
+#define READ_CPR(pSmi, cpr) MMIO_IN32(pSmi->CPRBase, cpr)
+
+/* 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 MAXLOOP 0x100000 /* timeout value for engine waits */
+
+#define ENGINE_IDLE() \
+ ((VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x08) == 0)
+#define FIFO_EMPTY() \
+ ((VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x10) != 0)
+
+/* Wait until "v" queue entries are free */
+#define WaitQueue(v) \
+ do \
+ { \
+ if (pSmi->NoPCIRetry) \
+ { \
+ int loop = MAXLOOP; mem_barrier(); \
+ while (!FIFO_EMPTY()) \
+ if (loop-- == 0) break; \
+ if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
+ } \
+ } while (0)
+
+/* Wait until GP is idle */
+#define WaitIdle() \
+ do \
+ { \
+ int loop = MAXLOOP; mem_barrier(); \
+ while (!ENGINE_IDLE()) \
+ if (loop-- == 0) break; \
+ if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
+ } \
+ while (0)
+
+/* Wait until GP is idle and queue is empty */
+#define WaitIdleEmpty() \
+ do \
+ { \
+ WaitQueue(MAXFIFO); \
+ WaitIdle(); \
+ } \
+ while (0)
+
+#define RGB8_PSEUDO (-1)
+#define RGB16_565 0
+#define RGB16_555 1
+#define RGB32_888 2
+
+#endif /* _REGSMI_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp
new file mode 100644
index 000000000..116da41dc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp
@@ -0,0 +1,187 @@
+.\" Header: //Mercury/Projects/archives/XFree86/4.0/siliconmotion.cpp-arc 1.3 21 Nov 2000 18:35:46 Frido $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp,v 1.1 2000/11/28 20:59:19 dawes Exp $
+.TH siliconmotion __drivermansuffix__ "Version 4.0" "XFree86"
+.SH NAME
+siliconmotion \- Silicon Motion video driver
+.SH SYNOPSIS
+.B "Section ""Device"""
+.br
+.BI " Identifier """ devname """"
+.br
+.B " Driver ""siliconmotion"""
+.br
+\ \ ...
+.br
+\ \ [
+.B "Option"
+"optionname" ["optionvalue"]]
+.br
+.B EndSection
+.SH DESCRIPTION
+.B siliconmotion
+is an XFree86 driver for Silicon Motion based video cards. The driver is fully
+accelerated, and provides support for the following framebuffer depths:
+8, 16, and 24. All
+visual types are supported for depth 8, and TrueColor
+visuals are supported for the other depths.
+.SH SUPPORTED HARDWARE
+The
+.B siliconmotion
+driver supports PCI and AGP video cards based on the following Silicon Motion chips:
+.TP 12
+.B Lynx
+SM910
+.TP 12
+.B LynxE
+SM810
+.TP 12
+.B Lynx3D
+SM820
+.TP 12
+.B LynxEM
+SM710
+.TP 12
+.B LynxEM+
+SM712
+.TP 12
+.B Lynx3DM
+SM720
+.SH CONFIGURATION DETAILS
+Please refer to XF86Config(__filemansuffix__) for general configuration
+details. This section only covers configuration details specific to this
+driver. All options names are case and white space insensitive when
+parsed by the server, for exmaple, "lynxe" and "LynxE" are equivalent.
+.PP
+The driver auto-detects the chipset type, but the following
+.B ChipSet
+names may optionally be specified in the config file
+.B """Device"""
+section, and will override the auto-detection:
+.PP
+.RS 4
+"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm".
+.RE
+
+.PP
+The following Cursor
+.B Options
+are supported:
+.TP
+.BI "Option ""HWCursor"" [""" boolean """]
+Enable or disable the HW cursor. Default: on.
+.TP
+.BI "Option ""SWCursor"" [""" boolean """]
+Inverse of "HWCursor". Default: off.
+
+.PP
+The following display
+.B Options
+are supported:
+.TP
+.BI "Option ""ShadowFB"" [""" boolean """]
+Use shadow framebuffer. Default: off.
+.TP
+.BI "Option ""Rotate"" """ cw " | " ccw """
+Rotate the screen CW - clockwise or CCW - counter clockwise.
+Uses ShadowFB. Default: no rotation.
+.TP
+.BI "Option ""VideoKey"" [""" integer """]
+Set the video colorkey. Default: a little off full blue.
+.TP
+.BI "Option ""ByteSwap"" [""" boolean """]
+Turn on byte swapping for capturing using SMI demo board. Default: off.
+.TP
+.BI "Option ""UseBIOS"" [""" boolean """]
+Use the BIOS to set the modes. This is used for custom panel timings.
+Default: off.
+
+.PP
+The following video memory
+.B Options
+are supported:
+.TP
+.BI "Option ""set_mclk"" """ integer """
+sets the memory clock, where
+.I integer
+is in kHz, and
+.I integer
+<= 100000. Default: probe the memory clock value,
+and use it at server start.
+
+
+.PP
+The following acceleration and graphics engine
+.B Options
+are supported:
+.TP
+.B "Option ""NoAccel""
+Disable acceleration. Very useful for determining if the
+driver has problems with drawing and acceleration routines. This is the first
+option to try if your server runs but you see graphic corruption on the screen.
+Using it decreases performance, as it uses software emulation for drawing
+operations the video driver can accelerate with hardware.
+Default: acceleration is enabled.
+.TP
+.BR "Option ""fifo_aggressive " | " fifo_moderate " | " fifo_conservative"""
+alter the settings
+for the threshold at which the pixel FIFO takes over the internal
+memory bus to refill itself. The smaller this threshold, the better
+the acceleration performance of the card. You may try the fastest
+setting
+.RB ( "fifo_aggressive" )
+and move down if you encounter pixel corruption.
+The optimal setting will probably depend on dot-clock and on color
+depth. Note that specifying any of these options will also alter other
+memory settings which may increase performance, so trying
+.B "fifo_conservative"
+will in most cases be a slight benefit (this uses the chip defaults).
+If pixel corruption or transient streaking is observed during drawing
+operations then removing any fifo options is recommended. Default: none.
+
+.PP
+The following PCI bus
+.B Options
+are supported:
+.TP
+.BI "Option ""pci_burst"" [""" boolean """]
+will enable PCI burst mode. This should work on all but a
+few broken PCI chipsets, and will increase performance. Default: off.
+.TP
+.BI "Option ""pci_retry"" [""" boolean """]
+will allow the driver to rely on PCI Retry to program the
+ViRGE registers.
+.B "pci_burst"
+must be enabled for this to work.
+This will increase performance, especially for small fills/blits,
+because the driver does not have to poll the ViRGE before sending it
+commands to make sure it is ready. It should work on most
+recent PCI chipsets. Default: off.
+
+.PP
+The following additional
+.B Options
+are supported:
+.TP
+.BI "Option ""ShowCache"" [""" boolean """]
+Enable or disable viewing offscreen cache memory. A
+development debug option. Default: off.
+
+.SH SEE ALSO
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(1)
+
+.SH SUPPORT
+For assistance with this driver, or XFree86 in general, check the XFree86 web
+site at http://www.xfree86.org. A FAQ is available on the web site at
+http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a
+question not answered in the FAQ please use our bug report form available on
+the web site or send mail to XFree86@XFree86.org. When reporting problems
+with the driver send as much detail as possible, including chipset type, a
+server output log, and operating system specifics.
+
+.SH AUTHORS
+Kevin Brosius,
+Matt Grossman,
+Harald Koenig,
+Sebastien Marineau,
+Mark Vojkovich,
+Frido Garritsen.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h
new file mode 100644
index 000000000..ff54368a0
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h
@@ -0,0 +1,307 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi.h-arc 1.48 10 Nov 2000 15:56:38 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+
+#ifndef _SMI_H
+#define _SMI_H
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "xf86Cursor.h"
+#include "vgaHW.h"
+
+#include "compiler.h"
+
+#include "mipointer.h"
+#include "micmap.h"
+
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h"
+#include "cfb24.h"
+
+#include "xaa.h"
+#include "xf86cmap.h"
+#include "xf86i2c.h"
+
+#include "xf86int10.h"
+#include "vbe.h"
+
+#ifdef XvExtension
+ #include "xf86xv.h"
+ #include "Xv.h"
+#endif
+
+/******************************************************************************/
+/* D E F I N I T O N S */
+/******************************************************************************/
+
+#ifndef SMI_DEBUG
+ #define SMI_DEBUG 0
+#endif
+
+#define SMI_USE_IMAGE_WRITES 0
+#define SMI_USE_VIDEO 1
+#define SMI_USE_CAPTURE 1
+
+/******************************************************************************/
+/* S T R U C T U R E S */
+/******************************************************************************/
+
+/* Driver data structure; this should contain all needed info for a mode */
+typedef struct
+{
+ CARD16 mode;
+ CARD8 SR17, SR18, SR21, SR31, SR32, SR6A, SR6B, SR81, SRA0;
+ CARD8 CR33, CR33_2, CR3A;
+ CARD8 CR40[14], CR40_2[14];
+ CARD8 CR90[16], CR9F_2;
+ CARD8 CRA0[14];
+ CARD8 smiDACMask, smiDacRegs[256][3];
+ CARD8 smiFont[8192];
+ CARD32 DPR10, DPR1C, DPR20, DPR24, DPR28, DPR2C, DPR30, DPR3C, DPR40,
+ DPR44;
+ CARD32 VPR00, VPR0C, VPR10;
+ CARD32 CPR00;
+
+} SMIRegRec, *SMIRegPtr;
+
+/* Global PDEV structure. */
+typedef struct
+{
+ /* accel additions */
+ CARD32 AccelCmd; /* Value for DPR0C */
+ CARD32 Stride; /* Stride of frame buffer */
+ CARD32 ScissorsLeft; /* Left/top of current scissors */
+ CARD32 ScissorsRight; /* Right/bottom of current scissors */
+ Bool ClipTurnedOn; /* Clipping was turned on by the
+ previous command */
+
+ CARD8 SR18Value; /* PDR#521: original SR18 value */
+ CARD8 SR21Value; /* PDR#521: original SR21 value */
+ SMIRegRec SavedReg; /* console saved mode registers */
+ SMIRegRec ModeReg; /* XServer video state mode registers */
+ xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */
+
+ Bool ModeStructInit; /* Flag indicating ModeReg has been *
+ * duped from console state */
+ int vgaCRIndex, vgaCRReg;
+ int width, height; /* Width and height of the screen */
+ int Bpp; /* Bytes per pixel */
+
+ /* XAA */
+ int videoRAMBytes; /* In units as noted, set in PreInit */
+ int videoRAMKBytes; /* In units as noted, set in PreInit */
+ unsigned char * MapBase; /* Base of mapped memory */
+ int MapSize; /* Size of mapped memory */
+ CARD8 * DPRBase; /* Base of DPR registers */
+ CARD8 * VPRBase; /* Base of VPR registers */
+ CARD8 * CPRBase; /* Base of CPR registers */
+ CARD8 * DataPortBase; /* Base of data port */
+ int DataPortSize; /* Size of data port */
+ volatile CARD8 *IOBase; /* Base of MMIO VGA ports */
+ unsigned char * FBBase; /* Base of FB */
+ CARD32 FBOffset; /* Current visual FB starting *
+ * location */
+ CARD32 FBCursorOffset; /* Cursor storage location */
+ CARD32 FBReserved; /* Reserved memory in frame buffer */
+
+ Bool PrimaryVidMapped; /* Flag indicating if vgaHWMapMem was *
+ * used successfully for this screen */
+ int dacSpeedBpp; /* Clock value */
+ int minClock; /* Mimimum clock */
+ int maxClock; /* Maximum clock */
+ int MCLK; /* Memory Clock */
+ int GEResetCnt; /* Limit the number of errors printed *
+ * using a counter */
+
+ Bool pci_burst; /* Enable PCI burst mode for reads? */
+ Bool NoPCIRetry; /* Diasable PCI retries */
+ Bool fifo_conservative; /* Adjust fifo for acceleration? */
+ Bool fifo_moderate; /* Adjust fifo for acceleration? */
+ Bool fifo_aggressive; /* Adjust fifo for acceleration? */
+ Bool NoAccel; /* Disable Acceleration */
+ Bool hwcursor; /* hardware cursor enabled */
+ Bool ShowCache; /* Debugging option */
+ Bool useBIOS; /* USe BIOS for mode sets */
+
+ CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped *
+ * CloseScreen function. */
+ XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */
+ pciVideoPtr PciInfo; /* PCI info vars. */
+ PCITAG PciTag;
+ int Chipset; /* Chip info, set using PCI above. */
+ int ChipRev;
+
+ /* DGA */
+ DGAModePtr DGAModes; /* Pointer to DGA modes */
+ int numDGAModes; /* Number of DGA modes */
+ Bool DGAactive; /* Flag if DGA is active */
+ int DGAViewportStatus; /* DGA Viewport status */
+
+ /* DPMS */
+ int CurrentDPMS; /* Current DPMS state */
+ unsigned char DPMS_SR20; /* Saved DPMS SR20 register */
+ unsigned char DPMS_SR21; /* Saved DPMS SR21 register */
+ unsigned char DPMS_SR31; /* Saved DPMS SR31 register */
+ unsigned char DPMS_SR34; /* Saved DPMS SR34 register */
+
+ /* Panel information */
+ Bool lcd; /* LCD active, 1=DSTN, 2=TFT */
+ int lcdWidth; /* LCD width */
+ int lcdHeight; /* LCD height */
+
+ I2CBusPtr I2C; /* Pointer to I2C module */
+ xf86Int10InfoPtr pInt; /* Pointer to INT10 module */
+ vbeInfoPtr pVbe; /* Pointer to VBE module */
+
+ /* Shadow frame buffer (rotation) */
+ Bool shadowFB; /* Flag if shadow buffer is used */
+ int rotate; /* Rotation flags */
+ int ShadowPitch; /* Pitch of shadow buffer */
+ int ShadowWidthBytes; /* Width of shadow buffer in bytes */
+ int ShadowWidth; /* Width of shadow buffer in pixels */
+ int ShadowHeight; /* Height of shadow buffer in pixels */
+
+ void (*PointerMoved)(int index, int x, int y);
+
+#ifdef XvExtension
+ int videoKey; /* Video chroma key */
+ Bool ByteSwap; /* Byte swap for ZV port */
+ /* XvExtension */
+ XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */
+ void (*BlockHandler)(int i, pointer blockData, pointer pTimeout,
+ pointer pReadMask);
+#endif
+
+} SMIRec, *SMIPtr;
+
+#define SMIPTR(p) ((SMIPtr)((p)->driverPrivate))
+
+/******************************************************************************/
+/* M A C R O S */
+/******************************************************************************/
+
+#if SMI_DEBUG
+ #define VERBLEV 1
+ #define ENTER_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "ENTER\t" PROCNAME \
+ "(%d)\n", __LINE__); xf86Break1()
+ #define DEBUG_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "DEBUG\t" PROCNAME \
+ "(%d)\n", __LINE__); xf86Break2()
+ #define LEAVE_PROC(PROCNAME) xf86ErrorFVerb(VERBLEV, "LEAVE\t" PROCNAME \
+ "(%d)\n", __LINE__); xf86Break1()
+ #define DEBUG(arg) xf86ErrorFVerb arg
+#else
+ #define VERBLEV 2
+ #define ENTER_PROC(PROCNAME)
+ #define DEBUG_PROC(PROCNAME)
+ #define LEAVE_PROC(PROCNAME)
+ #define DEBUG(arg)
+#endif
+
+/* Some Silicon Motion structs & registers */
+#include "regsmi.h"
+
+#if !defined (MetroLink) && !defined (VertDebug)
+#define VerticalRetraceWait() \
+do \
+{ \
+ if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \
+ { \
+ while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \
+ while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) ; \
+ while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \
+ } \
+} while (0)
+#else
+#define SPIN_LIMIT 1000000
+#define VerticalRetraceWait()
+do \
+{ \
+ if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \
+ { \
+ volatile unsigned long _spin_me; \
+ for (_spin_me = SPIN_LIMIT; \
+ ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \
+ _spin_me--) ; \
+ if (!_spin_me) \
+ ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
+ for (_spin_me = SPIN_LIMIT; \
+ ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me; \
+ _spin_me--) ; \
+ if (!_spin_me) \
+ ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
+ for (_spin_me = SPIN_LIMIT; \
+ ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \
+ _spin_me--) ; \
+ if (!_spin_me) \
+ ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \
+ } \
+} while (0)
+#endif
+
+/******************************************************************************/
+/* F U N C T I O N P R O T O T Y P E S */
+/******************************************************************************/
+
+/* smi_dac.c */
+void SMI_CommonCalcClock(long freq, int min_m, int min_n1, int max_n1,
+ int min_n2, int max_n2, long freq_min, long freq_max,
+ unsigned char * mdiv, unsigned char * ndiv);
+
+/* smi_i2c */
+Bool SMI_I2CInit(ScrnInfoPtr pScrn);
+
+/* smi_accel.c */
+Bool SMI_AccelInit(ScreenPtr pScrn);
+void SMI_AccelSync(ScrnInfoPtr pScrn);
+void SMI_GEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file);
+
+/* smi_hwcurs.c */
+Bool SMI_HWCursorInit(ScreenPtr pScrn);
+
+/* smi_driver.c */
+void SMI_AdjustFrame(int scrnIndex, int x, int y, int flags);
+Bool SMI_SwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+
+/* smi_dga.c */
+Bool SMI_DGAInit(ScreenPtr pScrn);
+
+/* smi_shadow.c */
+void SMI_PointerMoved(int index, int x, int y);
+void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+
+/* smi_video.c */
+void SMI_InitVideo(ScreenPtr pScreen);
+
+#endif /*_SMI_H*/
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c
new file mode 100644
index 000000000..421c020c4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c
@@ -0,0 +1,932 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_accel.c-arc 1.12 27 Nov 2000 15:46:54 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+
+#include "smi.h"
+
+#include "miline.h"
+#include "xaalocal.h"
+#include "xaarop.h"
+#include "servermd.h"
+
+static void SMI_EngineReset(ScrnInfoPtr);
+
+static void SMI_SetupForScreenToScreenCopy(ScrnInfoPtr, int, int, int,
+ unsigned int, int);
+static void SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr, int, int, int, int,
+ int, int);
+static void SMI_SetupForSolidFill(ScrnInfoPtr, int, int, unsigned);
+static void SMI_SubsequentSolidFillRect(ScrnInfoPtr, int, int, int, int);
+static void SMI_SubsequentSolidHorVertLine(ScrnInfoPtr, int, int, int, int);
+static void SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr, int, int, int,
+ unsigned int);
+static void SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr, int, int, int,
+ int, int);
+static void SMI_SetupForMono8x8PatternFill(ScrnInfoPtr, int, int, int, int, int,
+ unsigned int);
+static void SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr, int, int, int,
+ int, int, int);
+static void SMI_SetupForColor8x8PatternFill(ScrnInfoPtr, int, int, int,
+ unsigned int, int);
+static void SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr, int, int, int,
+ int, int, int);
+#if SMI_USE_IMAGE_WRITES
+static void SMI_SetupForImageWrite(ScrnInfoPtr, int, unsigned int, int, int,
+ int);
+static void SMI_SubsequentImageWriteRect(ScrnInfoPtr, int, int, int, int, int);
+#endif
+static void SMI_SetClippingRectangle(ScrnInfoPtr, int, int, int, int);
+static void SMI_DisableClipping(ScrnInfoPtr);
+
+Bool
+SMI_AccelInit(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoPtr;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ BoxRec AvailFBArea;
+ Bool ret;
+ int numLines, maxLines;
+
+ ENTER_PROC("SMI_AccelInit");
+
+ pSmi->AccelInfoRec = infoPtr = XAACreateInfoRec();
+ if (infoPtr == NULL)
+ {
+ LEAVE_PROC("SMI_AccelInit");
+ return FALSE;
+ }
+
+ infoPtr->Flags = PIXMAP_CACHE
+ | LINEAR_FRAMEBUFFER
+ | OFFSCREEN_PIXMAPS;
+
+ infoPtr->Sync = SMI_AccelSync;
+
+ /* Screen to screen copies */
+ infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK
+ | ONLY_TWO_BITBLT_DIRECTIONS;
+ infoPtr->SetupForScreenToScreenCopy = SMI_SetupForScreenToScreenCopy;
+ infoPtr->SubsequentScreenToScreenCopy = SMI_SubsequentScreenToScreenCopy;
+ if (pScrn->bitsPerPixel == 24)
+ {
+ infoPtr->ScreenToScreenCopyFlags |= NO_TRANSPARENCY;
+ }
+ if ((pSmi->Chipset == SMI_LYNX3D) && (pScrn->bitsPerPixel == 8))
+ {
+ infoPtr->ScreenToScreenCopyFlags |= GXCOPY_ONLY;
+ }
+
+ /* Solid Fills */
+ infoPtr->SolidFillFlags = NO_PLANEMASK;
+ infoPtr->SetupForSolidFill = SMI_SetupForSolidFill;
+ infoPtr->SubsequentSolidFillRect = SMI_SubsequentSolidFillRect;
+
+ /* Solid Lines */
+ infoPtr->SolidLineFlags = NO_PLANEMASK;
+ infoPtr->SetupForSolidLine = SMI_SetupForSolidFill;
+ infoPtr->SubsequentSolidHorVertLine = SMI_SubsequentSolidHorVertLine;
+
+ /* Color Expansion Fills */
+ infoPtr->CPUToScreenColorExpandFillFlags = ROP_NEEDS_SOURCE
+ | NO_PLANEMASK
+ | BIT_ORDER_IN_BYTE_MSBFIRST
+ | LEFT_EDGE_CLIPPING
+ | CPU_TRANSFER_PAD_DWORD
+ | SCANLINE_PAD_DWORD;
+ infoPtr->ColorExpandBase = pSmi->DataPortBase;
+ infoPtr->ColorExpandRange = pSmi->DataPortSize;
+ infoPtr->SetupForCPUToScreenColorExpandFill =
+ SMI_SetupForCPUToScreenColorExpandFill;
+ infoPtr->SubsequentCPUToScreenColorExpandFill =
+ SMI_SubsequentCPUToScreenColorExpandFill;
+
+ /* 8x8 Mono Pattern Fills */
+ infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK
+ | HARDWARE_PATTERN_PROGRAMMED_BITS
+ | HARDWARE_PATTERN_SCREEN_ORIGIN
+ | BIT_ORDER_IN_BYTE_MSBFIRST;
+ infoPtr->SetupForMono8x8PatternFill = SMI_SetupForMono8x8PatternFill;
+ infoPtr->SubsequentMono8x8PatternFillRect =
+ SMI_SubsequentMono8x8PatternFillRect;
+
+ /* 8x8 Color Pattern Fills */
+ if (!SMI_LYNX3D_SERIES(pSmi->Chipset) || (pScrn->bitsPerPixel != 24))
+ {
+ infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK
+ | HARDWARE_PATTERN_SCREEN_ORIGIN;
+ infoPtr->SetupForColor8x8PatternFill =
+ SMI_SetupForColor8x8PatternFill;
+ infoPtr->SubsequentColor8x8PatternFillRect =
+ SMI_SubsequentColor8x8PatternFillRect;
+ }
+
+#if SMI_USE_IMAGE_WRITES
+ /* Image Writes */
+ infoPtr->ImageWriteFlags = ROP_NEEDS_SOURCE
+ | NO_PLANEMASK
+ | CPU_TRANSFER_PAD_DWORD
+ | SCANLINE_PAD_DWORD;
+ infoPtr->ImageWriteBase = pSmi->DataPortBase;
+ infoPtr->ImageWriteRange = pSmi->DataPortSize;
+ infoPtr->SetupForImageWrite = SMI_SetupForImageWrite;
+ infoPtr->SubsequentImageWriteRect = SMI_SubsequentImageWriteRect;
+#endif
+
+ /* Clipping */
+ infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
+ | HARDWARE_CLIP_MONO_8x8_FILL
+ | HARDWARE_CLIP_COLOR_8x8_FILL
+ | HARDWARE_CLIP_SOLID_FILL
+ | HARDWARE_CLIP_SOLID_LINE;
+ infoPtr->SetClippingRectangle = SMI_SetClippingRectangle;
+ infoPtr->DisableClipping = SMI_DisableClipping;
+
+ /* Pixmap Cache */
+ if (pScrn->bitsPerPixel == 24)
+ {
+ infoPtr->CachePixelGranularity = 16;
+ }
+ else
+ {
+ infoPtr->CachePixelGranularity = 128 / pScrn->bitsPerPixel;
+ }
+
+ /* Offscreen Pixmaps */
+ infoPtr->maxOffPixWidth = 4096;
+ infoPtr->maxOffPixHeight = 4096;
+ if (pScrn->bitsPerPixel == 24)
+ {
+ infoPtr->maxOffPixWidth = 4096 / 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ infoPtr->maxOffPixHeight = 4096 / 3;
+ }
+ }
+
+ SMI_EngineReset(pScrn);
+
+ maxLines = pSmi->FBReserved / (pSmi->width * pSmi->Bpp);
+ if (pSmi->rotate)
+ {
+ numLines = maxLines;
+ }
+ else
+ {
+ #if defined(XvExtension) && SMI_USE_VIDEO
+ numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp * pSmi->height)
+ * 25 / 100 + pSmi->width * pSmi->Bpp - 1)
+ / (pSmi->width * pSmi->Bpp);
+ numLines += pSmi->height;
+ #else
+ numLines = maxLines;
+ #endif
+ }
+
+ AvailFBArea.x1 = 0;
+ AvailFBArea.y1 = 0;
+ AvailFBArea.x2 = pSmi->width;
+ AvailFBArea.y2 = numLines;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FrameBuffer Box: %d,%d - %d,%d\n",
+ AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2);
+ xf86InitFBManager(pScreen, &AvailFBArea);
+
+ ret = XAAInit(pScreen, infoPtr);
+
+ LEAVE_PROC("SMI_AccelInit");
+ return(ret);
+}
+
+void
+SMI_GEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 tmp;
+
+ ENTER_PROC("SMI_GEReset");
+
+ if (from_timeout)
+ {
+ if (pSmi->GEResetCnt++ < 10 || xf86GetVerbosity() > 1)
+ {
+ ErrorF("\tSMI_GEReset called from %s line %d\n", file, line);
+ }
+ }
+ else
+ {
+ WaitIdleEmpty();
+ }
+
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x15);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x15, tmp | 0x30);
+
+ WaitIdleEmpty();
+
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x15, tmp);
+ SMI_EngineReset(pScrn);
+
+ LEAVE_PROC("SMI_GEReset");
+}
+
+/* The sync function for the GE */
+void
+SMI_AccelSync(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_AccelSync");
+
+ WaitIdleEmpty(); /* #161 */
+
+ LEAVE_PROC("SMI_AccelSync");
+}
+
+static void
+SMI_EngineReset(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD32 DEDataFormat = 0;
+ int i;
+ int xyAddress[] = { 320, 400, 512, 640, 800, 1024, 1280, 1600, 2048 };
+
+ ENTER_PROC("SMI_EngineReset");
+
+ pSmi->Stride = (pSmi->width * pSmi->Bpp + 15) & ~15;
+
+ switch (pScrn->bitsPerPixel)
+ {
+ case 8:
+ DEDataFormat = 0x00000000;
+ break;
+
+ case 16:
+ pSmi->Stride >>= 1;
+ DEDataFormat = 0x00100000;
+ break;
+
+ case 24:
+ DEDataFormat = 0x00300000;
+ break;
+
+ case 32:
+ pSmi->Stride >>= 2;
+ DEDataFormat = 0x00200000;
+ break;
+ }
+ for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++)
+ {
+ if (pSmi->rotate)
+ {
+ if (xyAddress[i] == pSmi->height)
+ {
+ DEDataFormat |= i << 16;
+ break;
+ }
+ }
+ else
+ {
+ if (xyAddress[i] == pSmi->width)
+ {
+ DEDataFormat |= i << 16;
+ break;
+ }
+ }
+ }
+
+ WaitIdleEmpty();
+ WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x1C, DEDataFormat);
+ WRITE_DPR(pSmi, 0x24, 0xFFFFFFFF);
+ WRITE_DPR(pSmi, 0x28, 0xFFFFFFFF);
+ WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x40, 0);
+ WRITE_DPR(pSmi, 0x44, 0);
+
+ SMI_DisableClipping(pScrn);
+
+ LEAVE_PROC("SMI_EngineReset");
+}
+
+/******************************************************************************/
+/* Screen to Screen Copies */
+/******************************************************************************/
+
+static void
+SMI_SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
+ unsigned int planemask, int trans)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetupForScreenToScreenCopy");
+ DEBUG((VERBLEV, "xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir,
+ rop, trans));
+
+ pSmi->AccelCmd = XAACopyROP[rop]
+ | SMI_BITBLT
+ | SMI_START_ENGINE;
+
+ if ((xdir == -1) || (ydir == -1))
+ {
+ pSmi->AccelCmd |= SMI_RIGHT_TO_LEFT;
+ }
+
+ if (trans != -1)
+ {
+ pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL;
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x20, trans);
+ }
+
+ if (pSmi->ClipTurnedOn)
+ {
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ pSmi->ClipTurnedOn = FALSE;
+ }
+
+ LEAVE_PROC("SMI_SetupForScreenToScreenCopy");
+}
+
+static void
+SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
+ int y2, int w, int h)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SubsequentScreenToScreenCopy");
+ DEBUG((VERBLEV, "x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", x1, y1, x2, y2, w,
+ h));
+
+ if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT)
+ {
+ x1 += w - 1;
+ y1 += h - 1;
+ x2 += w - 1;
+ y2 += h - 1;
+ }
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x1 *= 3;
+ x2 *= 2;
+ w *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y1 *= 3;
+ y2 *= 3;
+ }
+
+ if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT)
+ {
+ x1 += 2;
+ x2 += 2;
+ }
+ }
+
+ WaitQueue(4);
+ WRITE_DPR(pSmi, 0x00, (x1 << 16) + (y1 & 0xFFFF));
+ WRITE_DPR(pSmi, 0x04, (x2 << 16) + (y2 & 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) + (h & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentScreenToScreenCopy");
+}
+
+/******************************************************************************/
+/* Solid Fills */
+/******************************************************************************/
+
+static void
+SMI_SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetupForSolidFill");
+ DEBUG((VERBLEV, "color=%08X rop=%02X\n", color, rop));
+
+ pSmi->AccelCmd = XAAPatternROP[rop]
+ | SMI_BITBLT
+ | SMI_START_ENGINE;
+
+ if (pSmi->ClipTurnedOn)
+ {
+ WaitQueue(4);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ pSmi->ClipTurnedOn = FALSE;
+ }
+ else
+ {
+ WaitQueue(3);
+ }
+ WRITE_DPR(pSmi, 0x14, color);
+ WRITE_DPR(pSmi, 0x34, 0xFFFFFFFF);
+ WRITE_DPR(pSmi, 0x38, 0xFFFFFFFF);
+
+ LEAVE_PROC("SMI_SetupForSolidFill");
+}
+
+void
+SMI_SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SubsequentSolidFillRect");
+ DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", x, y, w, h));
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x *= 3;
+ w *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y *= 3;
+ }
+ }
+
+ WaitQueue(3);
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentSolidFillRect");
+}
+
+/******************************************************************************/
+/* Solid Lines */
+/******************************************************************************/
+
+static void
+SMI_SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len,
+ int dir)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int w, h;
+
+ ENTER_PROC("SMI_SubsequentSolidHorVertLine");
+ DEBUG((VERBLEV, "x=%d y=%d len=%d dir=%d\n", x, y, len, dir));
+
+ if (dir == DEGREES_0)
+ {
+ w = len;
+ h = 1;
+ }
+ else
+ {
+ w = 1;
+ h = len;
+ }
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x *= 3;
+ w *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y *= 3;
+ }
+ }
+
+ WaitQueue(3);
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentSolidHorVertLine");
+}
+
+/******************************************************************************/
+/* Color Expansion Fills */
+/******************************************************************************/
+
+static void
+SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetupForCPUToScreenColorExpandFill");
+ DEBUG((VERBLEV, "fg=%08X bg=%08X rop=%02X\n", fg, bg, rop));
+
+ pSmi->AccelCmd = XAACopyROP[rop]
+ | SMI_HOSTBLT_WRITE
+ | SMI_SRC_MONOCHROME
+ | SMI_START_ENGINE;
+
+ if (bg == -1)
+ {
+ pSmi->AccelCmd |= SMI_TRANSPARENT_SRC;
+
+ WaitQueue(3);
+ WRITE_DPR(pSmi, 0x14, fg);
+ WRITE_DPR(pSmi, 0x18, ~fg);
+ WRITE_DPR(pSmi, 0x20, fg);
+ }
+ else
+ {
+ WaitQueue(2);
+ WRITE_DPR(pSmi, 0x14, fg);
+ WRITE_DPR(pSmi, 0x18, bg);
+ }
+
+ LEAVE_PROC("SMI_SetupForCPUToScreenColorExpandFill");
+}
+
+void
+SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w,
+ int h, int skipleft)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SubsequentCPUToScreenColorExpandFill");
+ DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft));
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x *= 3;
+ w *= 3;
+ skipleft *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y *= 3;
+ }
+ }
+
+ if (skipleft)
+ {
+ WaitQueue(5);
+ WRITE_DPR(pSmi, 0x2C, (pSmi->ScissorsLeft & 0xFFFF0000)
+ | (x + skipleft) | 0x2000);
+ pSmi->ClipTurnedOn = TRUE;
+ }
+ else
+ {
+ if (pSmi->ClipTurnedOn)
+ {
+ WaitQueue(5);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ pSmi->ClipTurnedOn = FALSE;
+ }
+ else
+ {
+ WaitQueue(4);
+ }
+ }
+ WRITE_DPR(pSmi, 0x00, 0);
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentCPUToScreenColorExpandFill");
+}
+
+/******************************************************************************/
+/* 8x8 Mono Pattern Fills */
+/******************************************************************************/
+
+static void
+SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg,
+ int bg, int rop, unsigned int planemask)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetupForMono8x8PatternFill");
+ DEBUG((VERBLEV, "patx=%08X paty=%08X fg=%08X bg=%08X rop=%02X\n", patx,
+ paty, fg, bg, rop));
+
+ pSmi->AccelCmd = XAAPatternROP[rop]
+ | SMI_BITBLT
+ | SMI_START_ENGINE;
+
+ if (pSmi->ClipTurnedOn)
+ {
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ pSmi->ClipTurnedOn = FALSE;
+ }
+
+ if (bg == -1)
+ {
+ WaitQueue(5);
+ WRITE_DPR(pSmi, 0x14, fg);
+ WRITE_DPR(pSmi, 0x18, ~fg);
+ WRITE_DPR(pSmi, 0x20, fg);
+ WRITE_DPR(pSmi, 0x34, patx);
+ WRITE_DPR(pSmi, 0x38, paty);
+ }
+ else
+ {
+ WaitQueue(4);
+ WRITE_DPR(pSmi, 0x14, fg);
+ WRITE_DPR(pSmi, 0x18, bg);
+ WRITE_DPR(pSmi, 0x34, patx);
+ WRITE_DPR(pSmi, 0x38, paty);
+ }
+
+ LEAVE_PROC("SMI_SetupForMono8x8PatternFill");
+}
+
+static void
+SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
+ int x, int y, int w, int h)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SubsequentMono8x8PatternFillRect");
+ DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", x, y, w, h));
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x *= 3;
+ w *= 3;
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y *= 3;
+ }
+ }
+
+ WaitQueue(3);
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentMono8x8PatternFillRect");
+}
+
+/******************************************************************************/
+/* 8x8 Color Pattern Fills */
+/******************************************************************************/
+
+static void
+SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop,
+ unsigned int planemask, int trans_color)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetupForColor8x8PatternFill");
+ DEBUG((VERBLEV, "patx=%d paty=%d rop=%02X trans_color=%08X\n", patx, paty,
+ rop, trans_color));
+
+ pSmi->AccelCmd = XAAPatternROP[rop]
+ | SMI_BITBLT
+ | SMI_COLOR_PATTERN
+ | SMI_START_ENGINE;
+
+ if (pScrn->bitsPerPixel <= 16)
+ {
+ unsigned char * pattern = pSmi->FBBase + patx * pSmi->Bpp
+ + paty * pSmi->Stride;
+
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x0C, SMI_BITBLT | SMI_COLOR_PATTERN);
+ memcpy(pSmi->DataPortBase, pattern, 8 * pSmi->Bpp * 8);
+ }
+ else
+ {
+ if (pScrn->bitsPerPixel == 24)
+ {
+ patx *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ paty *= 3;
+ }
+ }
+
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x00, (patx << 16) | (paty & 0xFFFF));
+ }
+
+ if (trans_color == -1)
+ {
+ pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL;
+
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x20, trans_color);
+ }
+
+ if (pSmi->ClipTurnedOn)
+ {
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ pSmi->ClipTurnedOn = FALSE;
+ }
+
+ LEAVE_PROC("SMI_SetupForColor8x8PatternFill");
+}
+
+static void
+SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
+ int x, int y, int w, int h)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SubsequentColor8x8PatternFillRect");
+ DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", x, y, w, h));
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x *= 3;
+ w *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y *= 3;
+ }
+ }
+
+ WaitQueue(3);
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) | (y & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentColor8x8PatternFillRect");
+}
+
+#if SMI_USE_IMAGE_WRITES
+/******************************************************************************/
+/* Image Writes */
+/******************************************************************************/
+
+static void
+SMI_SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
+ int trans_color, int bpp, int depth)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetupForImageWrite");
+ DEBUG((VERBLEV, "rop=%02X trans_color=%08X bpp=%d depth=%d\n", rop,
+ trans_color, bpp, depth));
+
+ pSmi->AccelCmd = XAACopyROP[rop]
+ | SMI_HOSTBLT_WRITE
+ | SMI_START_ENGINE;
+
+ if (trans_color != -1)
+ {
+ pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL;
+
+ WaitQueue(1);
+ WRITE_DPR(pSmi, 0x20, trans_color);
+ }
+
+ LEAVE_PROC("SMI_SetupForImageWrite");
+}
+
+static void
+SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SubsequentImageWriteRect");
+ DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft));
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ x *= 3;
+ w *= 3;
+ skipleft *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ y *= 3;
+ }
+ }
+
+ if (skipleft)
+ {
+ WaitQueue(5);
+ WRITE_DPR(pSmi, 0x2C, (pSmi->ScissorsLeft & 0xFFFF0000) |
+ (x + skipleft) | 0x2000);
+ pSmi->ClipTurnedOn = TRUE;
+ }
+ else
+ {
+ if (pSmi->ClipTurnedOn)
+ {
+ WaitQueue(5);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ pSmi->ClipTurnedOn = FALSE;
+ }
+ else
+ {
+ WaitQueue(4);
+ }
+ }
+ WRITE_DPR(pSmi, 0x00, 0);
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF));
+ WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+ LEAVE_PROC("SMI_SubsequentImageWriteRect");
+}
+#endif
+
+/******************************************************************************/
+/* Clipping */
+/******************************************************************************/
+
+static void
+SMI_SetClippingRectangle(ScrnInfoPtr pScrn, int left, int top, int right,
+ int bottom)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetClippingRectangle");
+ DEBUG((VERBLEV, "left=%d top=%d right=%d bottom=%d\n", left, top, right,
+ bottom));
+
+ left = max(left, 0);
+ top = max(top, 0);
+ right = min(right, pSmi->width);
+ bottom = min(bottom, pSmi->height);
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ left *= 3;
+ right *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ top *= 3;
+ bottom *= 3;
+ }
+ }
+
+ pSmi->ScissorsLeft = (top << 16) | (left & 0xFFFF) | 0x2000;
+ pSmi->ScissorsRight = (bottom << 16) | (right & 0xFFFF);
+
+ pSmi->ClipTurnedOn = FALSE;
+
+ WaitQueue(2);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ WRITE_DPR(pSmi, 0x30, pSmi->ScissorsRight);
+
+ LEAVE_PROC("SMI_SetClippingRectangle");
+}
+
+static void
+SMI_DisableClipping(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_DisableClipping");
+
+ pSmi->ScissorsLeft = 0;
+ if (pScrn->bitsPerPixel == 24)
+ {
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ pSmi->ScissorsRight = ((pSmi->height * 3) << 16)
+ | (pSmi->width * 3);
+ }
+ else
+ {
+ pSmi->ScissorsRight = (pSmi->height << 16) | (pSmi->width * 3);
+ }
+ }
+ else
+ {
+ pSmi->ScissorsRight = (pSmi->height << 16) | pSmi->width;
+ }
+
+ pSmi->ClipTurnedOn = FALSE;
+
+ WaitQueue(2);
+ WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
+ WRITE_DPR(pSmi, 0x30, pSmi->ScissorsRight);
+
+ LEAVE_PROC("SMI_DisableClipping");
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c
new file mode 100644
index 000000000..0e3f06b28
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c
@@ -0,0 +1,99 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_dac.c-arc 1.8 27 Nov 2000 15:47:08 Frido $ */
+
+/*
+Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+
+#include "smi.h"
+
+#define BASE_FREQ 14.31818 /* MHz */
+
+void
+SMI_CommonCalcClock(long freq, int min_m, int min_n1, int max_n1, int min_n2,
+ int max_n2, long freq_min, long freq_max,
+ unsigned char *mdiv, unsigned char *ndiv)
+{
+ double div, diff, best_diff;
+ unsigned int m;
+ unsigned char n1, n2;
+ unsigned char best_n1 = 63, best_n2 = 3, best_m = 255;
+
+ double ffreq = freq / 1000.0 / BASE_FREQ;
+ double ffreq_min = freq_min / 1000.0 / BASE_FREQ;
+ double ffreq_max = freq_max / 1000.0 / BASE_FREQ;
+
+ if (ffreq < ffreq_min / (1 << max_n2))
+ {
+ ErrorF("invalid frequency %1.3f MHz [freq >= %1.3f MHz]\n",
+ ffreq * BASE_FREQ, ffreq_min * BASE_FREQ / (1 << max_n2));
+ ffreq = ffreq_min / (1 << max_n2);
+ }
+ if (ffreq > ffreq_max / (1 << min_n2))
+ {
+ ErrorF("invalid frequency %1.3f MHz [freq <= %1.3f MHz]\n",
+ ffreq * BASE_FREQ, ffreq_max * BASE_FREQ / (1 << min_n2));
+ ffreq = ffreq_max / (1 << min_n2);
+ }
+
+ /* work out suitable timings */
+ best_diff = ffreq;
+
+ for (n2 = min_n2; n2 <= max_n2; n2++)
+ {
+ for (n1 = min_n1; n1 <= max_n1; n1++)
+ {
+ m = (int)(ffreq * n1 * (1 << n2) + 0.5);
+ if ( (m < min_m) || (m > 255) )
+ {
+ continue;
+ }
+ div = (double)(m) / (double)(n1);
+ if ( (div >= ffreq_min) && (div <= ffreq_max) )
+ {
+ diff = ffreq - div / (1 << n2);
+ if (diff < 0.0)
+ {
+ diff = -diff;
+ }
+ if (diff < best_diff)
+ {
+ best_diff = diff;
+ best_m = m;
+ best_n1 = n1;
+ best_n2 = n2;
+ }
+ }
+ }
+ }
+
+ DEBUG((VERBLEV, "Clock parameters for %1.6f MHz: m=%d, n1=%d, n2=%d\n",
+ ((double)(best_m) / (double)(best_n1) / (1 << best_n2)) * BASE_FREQ,
+ best_m, best_n1, best_n2));
+
+ *ndiv = best_n1 | (best_n2 << 6);
+ *mdiv = best_m;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c
new file mode 100644
index 000000000..ed6c10b91
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c
@@ -0,0 +1,301 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_dga.c-arc 1.5 27 Nov 2000 15:47:18 Frido $ */
+
+/*
+Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+#include "smi.h"
+#include "dgaproc.h"
+
+static Bool SMI_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *,
+ int *, int *);
+static Bool SMI_SetMode(ScrnInfoPtr, DGAModePtr);
+static int SMI_GetViewport(ScrnInfoPtr);
+static void SMI_SetViewport(ScrnInfoPtr, int, int, int);
+static void SMI_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
+static void SMI_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+static void SMI_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
+ unsigned long);
+
+static
+DGAFunctionRec SMI_DGAFuncs =
+{
+ SMI_OpenFramebuffer,
+ NULL,
+ SMI_SetMode,
+ SMI_SetViewport,
+ SMI_GetViewport,
+ SMI_AccelSync,
+ SMI_FillRect,
+ SMI_BlitRect,
+ SMI_BlitTransRect
+};
+
+Bool
+SMI_DGAInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ DGAModePtr modes = NULL, newmodes = NULL, currentMode;
+ DisplayModePtr pMode, firstMode;
+ int Bpp = pScrn->bitsPerPixel >> 3;
+ int num = 0;
+ Bool ret;
+
+ ENTER_PROC("SMI_DGAInit");
+
+ pMode = firstMode = pScrn->modes;
+
+ while (pMode)
+ {
+ newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
+ if (newmodes == NULL)
+ {
+ xfree(modes);
+ LEAVE_PROC("SMI_DGAInit");
+ return(FALSE);
+ }
+
+ modes = newmodes;
+
+ currentMode = modes + num;
+ num++;
+
+ currentMode->mode = pMode;
+ currentMode->flags = DGA_PIXMAP_AVAILABLE;
+ if (!pSmi->NoAccel)
+ {
+ currentMode->flags |= DGA_FILL_RECT
+ | DGA_BLIT_RECT
+ | DGA_BLIT_RECT_TRANS;
+ }
+ if (pMode->Flags & V_DBLSCAN)
+ {
+ currentMode->flags |= DGA_DOUBLESCAN;
+ }
+ if (pMode->Flags & V_INTERLACE)
+ {
+ currentMode->flags |= DGA_INTERLACED;
+ }
+
+ currentMode->byteOrder = pScrn->imageByteOrder;
+ currentMode->depth = pScrn->depth;
+ currentMode->bitsPerPixel = pScrn->bitsPerPixel;
+ currentMode->red_mask = pScrn->mask.red;
+ currentMode->green_mask = pScrn->mask.green;
+ currentMode->blue_mask = pScrn->mask.blue;
+ currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor;
+ currentMode->viewportWidth = pMode->HDisplay;
+ currentMode->viewportHeight = pMode->VDisplay;
+ currentMode->xViewportStep = (Bpp == 3) ? 8 : (8 / Bpp);
+ currentMode->yViewportStep = 1;
+ currentMode->viewportFlags = DGA_FLIP_RETRACE;
+ currentMode->offset = 0;
+ currentMode->address = pSmi->FBBase;
+
+ xf86ErrorFVerb(VERBLEV, "\tSMI_DGAInit %dx%d @ %d bpp\n",
+ currentMode->viewportWidth, currentMode->viewportHeight,
+ currentMode->bitsPerPixel);
+
+ currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 15)
+ & ~15L;
+ currentMode->imageWidth = pScrn->displayWidth;
+ currentMode->imageHeight = (pSmi->videoRAMBytes - pSmi->FBReserved)
+ / currentMode->bytesPerScanline;
+ currentMode->pixmapWidth = currentMode->imageWidth;
+ currentMode->pixmapHeight = currentMode->imageHeight;
+ currentMode->maxViewportX = currentMode->imageWidth
+ - currentMode->viewportWidth;
+ currentMode->maxViewportY = currentMode->imageHeight
+ - currentMode->viewportHeight;
+
+ pMode = pMode->next;
+ if (pMode == firstMode)
+ {
+ break;
+ }
+ }
+
+ pSmi->numDGAModes = num;
+ pSmi->DGAModes = modes;
+
+ ret = DGAInit(pScreen, &SMI_DGAFuncs, modes, num);
+ LEAVE_PROC("SMI_DGAInit");
+ return(ret);
+}
+
+static Bool
+SMI_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
+{
+ static int OldDisplayWidth[MAXSCREENS];
+ int index = pScrn->pScreen->myNum;
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetMode");
+
+ if (pMode == NULL)
+ { /* restore the original mode */
+
+ /* put the ScreenParameters back */
+ pScrn->displayWidth = OldDisplayWidth[index];
+
+ SMI_SwitchMode(index, pScrn->currentMode, 0);
+ pSmi->DGAactive = FALSE;
+ }
+ else
+ {
+ if (!pSmi->DGAactive)
+ { /* save the old parameters */
+ OldDisplayWidth[index] = pScrn->displayWidth;
+
+ pSmi->DGAactive = TRUE;
+ }
+
+ pScrn->displayWidth = pMode->bytesPerScanline
+ / (pMode->bitsPerPixel >> 3);
+
+ SMI_SwitchMode(index, pMode->mode, 0);
+ }
+
+ LEAVE_PROC("SMI_SetMode");
+ return(TRUE);
+}
+
+
+static int
+SMI_GetViewport(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_GetViewport");
+
+ LEAVE_PROC("SMI_GetViewport");
+
+ return(pSmi->DGAViewportStatus);
+}
+
+static void
+SMI_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetViewport");
+
+ SMI_AdjustFrame(pScrn->pScreen->myNum, x, y, flags);
+ pSmi->DGAViewportStatus = 0;
+
+ LEAVE_PROC("SMI_SetViewport");
+}
+
+static void
+SMI_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_FillRect");
+
+ if (pSmi->AccelInfoRec)
+ {
+ (*pSmi->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
+ (*pSmi->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ SET_SYNC_FLAG(pSmi->AccelInfoRec);
+ }
+
+ LEAVE_PROC("SMI_FillRect");
+}
+
+static void
+SMI_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx,
+ int dsty)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_BlitRect");
+
+ if (pSmi->AccelInfoRec)
+ {
+ int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
+ int ydir = (srcy < dsty) ? -1 : 1;
+
+ (*pSmi->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir,
+ GXcopy, ~0, -1);
+ (*pSmi->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy,
+ dstx, dsty, w, h);
+ SET_SYNC_FLAG(pSmi->AccelInfoRec);
+ }
+
+ LEAVE_PROC("SMI_BlitRect");
+}
+
+static void
+SMI_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx,
+ int dsty, unsigned long color)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_BlitTraneRect");
+
+ if (pSmi->AccelInfoRec)
+ {
+ int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
+ int ydir = (srcy < dsty) ? -1 : 1;
+
+ (*pSmi->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir,
+ GXcopy, ~0, color);
+ (*pSmi->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy,
+ dstx, dsty, w, h);
+ SET_SYNC_FLAG(pSmi->AccelInfoRec);
+ }
+
+ LEAVE_PROC("SMI_BlitTraneRect");
+}
+
+static Bool
+SMI_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem,
+ int *size, int *offset, int *flags)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_OpenFrameBuffer");
+
+ *name = NULL; /* no special device */
+ *mem = (unsigned char*)pSmi->FBBase;
+ *size = pSmi->videoRAMBytes;
+ *offset = 0;
+ *flags = DGA_NEED_ROOT;
+
+ LEAVE_PROC("SMI_OpenFrameBuffer");
+ return(TRUE);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
new file mode 100644
index 000000000..339ffffb7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
@@ -0,0 +1,2996 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_driver.c-arc 1.31 27 Nov 2000 14:20:52 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of The XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from The XFree86 Project or Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+
+#include "xf86Resources.h"
+#include "xf86RAC.h"
+#include "xf86DDC.h"
+#include "xf86int10.h"
+#include "vbe.h"
+#include "shadowfb.h"
+
+#include "smi.h"
+
+#ifdef DPMSExtension
+ #include "globals.h"
+ #define DPMS_SERVER
+ #include "extensions/dpms.h"
+#endif
+
+/*
+ * Internals
+ */
+static void SMI_EnableMmio(ScrnInfoPtr pScrn);
+static void SMI_DisableMmio(ScrnInfoPtr pScrn);
+
+/*
+ * Forward definitions for the functions that make up the driver.
+ */
+
+static OptionInfoPtr SMI_AvailableOptions(int chipid, int busid);
+static void SMI_Identify(int flags);
+static Bool SMI_Probe(DriverPtr drv, int flags);
+static Bool SMI_PreInit(ScrnInfoPtr pScrn, int flags);
+static Bool SMI_EnterVT(int scrnIndex, int flags);
+static void SMI_LeaveVT(int scrnIndex, int flags);
+static void SMI_Save (ScrnInfoPtr pScrn);
+static void SMI_WriteMode (ScrnInfoPtr pScrn, vgaRegPtr, SMIRegPtr);
+static Bool SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
+ char **argv);
+static int SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen);
+static void SMI_PrintRegs(ScrnInfoPtr);
+static ModeStatus SMI_ValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
+static Bool SMI_MapMem(ScrnInfoPtr pScrn);
+static void SMI_UnmapMem(ScrnInfoPtr pScrn);
+static Bool SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static Bool SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen);
+static Bool SMI_SaveScreen(ScreenPtr pScreen, int mode);
+static void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies,
+ LOCO *colors, VisualPtr pVisual);
+#ifdef DPMSExtension
+static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn,
+ int PowerManagementMode, int flags);
+#endif
+static Bool SMI_ddc1(int scrnIndex);
+static unsigned int SMI_ddc1Read(ScrnInfoPtr pScrn);
+static void SMI_FreeScreen(int ScrnIndex, int flags);
+static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index);
+
+
+#define SILICONMOTION_NAME "Silicon Motion"
+#define SILICONMOTION_DRIVER_NAME "siliconmotion"
+#define SILICONMOTION_VERSION_NAME "1.1.8"
+#define SILICONMOTION_VERSION_MAJOR 1
+#define SILICONMOTION_VERSION_MINOR 1
+#define SILICONMOTION_PATCHLEVEL 8
+#define SILICONMOTION_DRIVER_VERSION ( (SILICONMOTION_VERSION_MAJOR << 24) \
+ | (SILICONMOTION_VERSION_MINOR << 16) \
+ | (SILICONMOTION_PATCHLEVEL) \
+ )
+
+/*
+ * This contains the functions needed by the server after loading the
+ * driver module. It must be supplied, and gets added the driver list by
+ * the Module Setup funtion in the dynamic case. In the static case a
+ * reference to this is compiled in, and this requires that the name of
+ * this DriverRec be an upper-case version of the driver name.
+ */
+
+DriverRec SILICONMOTION =
+{
+ SILICONMOTION_DRIVER_VERSION,
+ SILICONMOTION_DRIVER_NAME,
+ SMI_Identify,
+ SMI_Probe,
+ SMI_AvailableOptions,
+ NULL,
+ 0
+};
+
+/* Supported chipsets */
+static SymTabRec SMIChipsets[] =
+{
+ { PCI_CHIP_SMI910, "Lynx" },
+ { PCI_CHIP_SMI810, "LynxE" },
+ { PCI_CHIP_SMI820, "Lynx3D" },
+ { PCI_CHIP_SMI710, "LynxEM" },
+ { PCI_CHIP_SMI712, "LynxEM+" },
+ { PCI_CHIP_SMI720, "Lynx3DM" },
+ { -1, NULL }
+};
+
+static PciChipsets SMIPciChipsets[] =
+{
+ /* numChipset, PciID, Resource */
+ { PCI_CHIP_SMI910, PCI_CHIP_SMI910, RES_SHARED_VGA },
+ { PCI_CHIP_SMI810, PCI_CHIP_SMI810, RES_SHARED_VGA },
+ { PCI_CHIP_SMI820, PCI_CHIP_SMI820, RES_SHARED_VGA },
+ { PCI_CHIP_SMI710, PCI_CHIP_SMI710, RES_SHARED_VGA },
+ { PCI_CHIP_SMI712, PCI_CHIP_SMI712, RES_SHARED_VGA },
+ { PCI_CHIP_SMI720, PCI_CHIP_SMI720, RES_SHARED_VGA },
+ { -1, -1, RES_UNDEFINED }
+};
+
+typedef enum
+{
+ OPTION_PCI_BURST,
+ OPTION_FIFO_CONSERV,
+ OPTION_FIFO_MODERATE,
+ OPTION_FIFO_AGGRESSIVE,
+ OPTION_PCI_RETRY,
+ OPTION_NOACCEL,
+ OPTION_MCLK,
+ OPTION_SHOWCACHE,
+ OPTION_SWCURSOR,
+ OPTION_HWCURSOR,
+ OPTION_SHADOW_FB,
+ OPTION_ROTATE,
+#ifdef XvExtension
+ OPTION_VIDEOKEY,
+ OPTION_BYTESWAP,
+#endif
+ OPTION_USEBIOS,
+ NUMBER_OF_OPTIONS
+
+} SMIOpts;
+
+static OptionInfoRec SMIOptions[] =
+{
+ { OPTION_PCI_BURST, "pci_burst", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FIFO_CONSERV, "fifo_conservative", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FIFO_MODERATE, "fifo_moderate", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FIFO_AGGRESSIVE, "fifo_aggressive", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_PCI_RETRY, "pci_retry", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_MCLK, "set_mclk", OPTV_FREQ, {0}, FALSE },
+ { OPTION_SHOWCACHE, "show_cache", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
+#ifdef XvExtension
+ { OPTION_VIDEOKEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE },
+#endif
+ { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+/*
+ * Lists of symbols that may/may not be required by this driver.
+ * This allows the loader to know which ones to issue warnings for.
+ *
+ * Note that vgahwSymbols and xaaSymbols are referenced outside the
+ * XFree86LOADER define in later code, so are defined outside of that
+ * define here also.
+ * cfbSymbols and ramdacSymbols are only referenced from within the
+ * ...LOADER define.
+ */
+
+static const char *vgahwSymbols[] =
+{
+ "vgaHWGetHWRec",
+ "vgaHWSetMmioFuncs",
+ "vgaHWGetIOBase",
+ "vgaHWSave",
+ "vgaHWProtect",
+ "vgaHWRestore",
+ "vgaHWMapMem",
+ "vgaHWUnmapMem",
+ "vgaHWInit",
+ "vgaHWSaveScreen",
+ "vgaHWLock",
+ NULL
+};
+
+static const char *xaaSymbols[] =
+{
+ "XAADestroyInfoRec",
+ "XAACreateInfoRec",
+ "XAAInit",
+ "XAAOverlayFBfuncs",
+ NULL
+};
+
+static const char *ramdacSymbols[] =
+{
+ "xf86InitCursor",
+ "xf86CreateCursorInfoRec",
+ "xf86DestroyCursorInfoRec",
+ "xf86CursorScreenIndex",
+ NULL
+};
+
+static const char *ddcSymbols[] =
+{
+ "xf86PrintEDID",
+ "xf86DoEDID_DDC1",
+ "xf86DoEDID_DDC2",
+ NULL
+};
+
+static const char *i2cSymbols[] =
+{
+ "xf86CreateI2CBusRec",
+ "xf86DestroyI2CBusRec",
+ "xf86I2CBusInit",
+ "xf86CreateI2CDevRec",
+ "xf86I2CWriteByte",
+ "xf86DestroyI2CDevRec",
+ NULL
+};
+
+static const char *shadowSymbols[] =
+{
+ "ShadowFBInit",
+ NULL
+};
+
+static const char *int10Symbols[] =
+{
+ "xf86InitInt10",
+ "xf86ExecX86int10",
+ "xf86FreeInt10",
+ NULL
+};
+
+static const char *vbeSymbols[] =
+{
+ "VBEInit",
+ "vbeDoEDID",
+ "vbeFree",
+ NULL
+};
+
+#ifdef XFree86LOADER
+
+static const char *cfbSymbols[] =
+{
+ "cfbScreenInit",
+ "cfb16ScreenInit",
+ "cfb24ScreenInit",
+ "cfb24_32ScreenInit",
+ "cfb32ScreenInit",
+ "cfb16BresS",
+ "cfb24BresS",
+ NULL
+};
+
+static MODULESETUPPROTO(siliconmotionSetup);
+
+static XF86ModuleVersionInfo SMIVersRec =
+{
+ "siliconmotion",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ SILICONMOTION_VERSION_MAJOR,
+ SILICONMOTION_VERSION_MINOR,
+ SILICONMOTION_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0, 0, 0, 0}
+};
+
+/*
+ * This is the module init data for XFree86 modules.
+ *
+ * Its name has to be the driver name followed by ModuleData.
+ */
+XF86ModuleData siliconmotionModuleData =
+{
+ &SMIVersRec,
+ siliconmotionSetup,
+ NULL
+};
+
+static pointer
+siliconmotionSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone)
+ {
+ setupDone = TRUE;
+ xf86AddDriver(&SILICONMOTION, module, 0);
+
+ /*
+ * Modules that this driver always requires can be loaded here
+ * by calling LoadSubModule().
+ */
+
+ /*
+ * Tell the loader about symbols from other modules that this module
+ * might refer to.
+ */
+ LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, ramdacSymbols,
+ ddcSymbols, i2cSymbols, int10Symbols, vbeSymbols,
+ shadowSymbols, NULL);
+
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (pointer) 1;
+ }
+ else
+ {
+ if (errmaj)
+ {
+ *errmaj = LDR_ONCEONLY;
+ }
+ return(NULL);
+ }
+}
+
+#endif /* XFree86LOADER */
+
+static Bool
+SMI_GetRec(ScrnInfoPtr pScrn)
+{
+ ENTER_PROC("SMI_GetRec");
+
+ /*
+ * Allocate an 'Chip'Rec, and hook it into pScrn->driverPrivate.
+ * pScrn->driverPrivate is initialised to NULL, so we can check if
+ * the allocation has already been done.
+ */
+ if (pScrn->driverPrivate == NULL)
+ {
+ pScrn->driverPrivate = xnfcalloc(sizeof(SMIRec), 1);
+ }
+
+ LEAVE_PROC("SMI_GetRec");
+ return(TRUE);
+}
+
+static void
+SMI_FreeRec(ScrnInfoPtr pScrn)
+{
+ ENTER_PROC("SMI_FreeRec");
+
+ if (pScrn->driverPrivate != NULL)
+ {
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+ LEAVE_PROC("SMI_FreeRec");
+}
+
+static OptionInfoPtr
+SMI_AvailableOptions(int chipid, int busid)
+{
+ ENTER_PROC("SMI_AvailableOptions");
+ LEAVE_PROC("SMI_AvailableOptions");
+ return(SMIOptions);
+}
+
+static void
+SMI_Identify(int flags)
+{
+ ENTER_PROC("SMI_Identify");
+
+ xf86PrintChipsets(SILICONMOTION_NAME, "driver (version "
+ SILICONMOTION_VERSION_NAME ") for Silicon Motion Lynx chipsets",
+ SMIChipsets);
+
+ LEAVE_PROC("SMI_Identify");
+}
+
+static Bool
+SMI_Probe(DriverPtr drv, int flags)
+{
+ int i;
+ GDevPtr *devSections = NULL;
+ int *usedChips;
+ int numDevSections;
+ int numUsed;
+ Bool foundScreen = FALSE;
+
+ ENTER_PROC("SMI_Probe");
+
+ numDevSections = xf86MatchDevice(SILICONMOTION_DRIVER_NAME, &devSections);
+ if (numDevSections <= 0)
+ {
+ /* There's no matching device section in the config file, so quit now.
+ */
+ LEAVE_PROC("SMI_Probe");
+ return(FALSE);
+ }
+
+ if (xf86GetPciVideoInfo() == NULL)
+ {
+ LEAVE_PROC("SMI_Probe");
+ return(FALSE);
+ }
+
+ numUsed = xf86MatchPciInstances(SILICONMOTION_NAME, PCI_SMI_VENDOR_ID,
+ SMIChipsets, SMIPciChipsets, devSections,
+ numDevSections, drv, &usedChips);
+
+ /* Free it since we don't need that list after this */
+ if (devSections)
+ {
+ xfree(devSections);
+ }
+ devSections = NULL;
+ if (numUsed <= 0)
+ {
+ LEAVE_PROC("SMI_Probe");
+ return(FALSE);
+ }
+
+ if (flags & PROBE_DETECT)
+ {
+ foundScreen = TRUE;
+ }
+ else
+ {
+ for (i = 0; i < numUsed; i++)
+ {
+ /* Allocate a ScrnInfoRec and claim the slot */
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
+
+ /* Fill in what we can of the ScrnInfoRec */
+ pScrn->driverVersion = SILICONMOTION_DRIVER_VERSION;
+ pScrn->driverName = SILICONMOTION_DRIVER_NAME;
+ pScrn->name = SILICONMOTION_NAME;
+ pScrn->Probe = SMI_Probe;
+ pScrn->PreInit = SMI_PreInit;
+ pScrn->ScreenInit = SMI_ScreenInit;
+ pScrn->SwitchMode = SMI_SwitchMode;
+ pScrn->AdjustFrame = SMI_AdjustFrame;
+ pScrn->EnterVT = SMI_EnterVT;
+ pScrn->LeaveVT = SMI_LeaveVT;
+ pScrn->FreeScreen = SMI_FreeScreen;
+ pScrn->ValidMode = SMI_ValidMode;
+ foundScreen = TRUE;
+
+ xf86ConfigActivePciEntity(pScrn, usedChips[i], SMIPciChipsets, NULL,
+ NULL, NULL, NULL, NULL);
+ }
+ }
+ xfree(usedChips);
+
+ LEAVE_PROC("SMI_Probe");
+ return(foundScreen);
+}
+
+static Bool
+SMI_PreInit(ScrnInfoPtr pScrn, int flags)
+{
+ EntityInfoPtr pEnt;
+ SMIPtr pSmi;
+ MessageType from;
+ int i;
+ double real;
+ ClockRangePtr clockRanges;
+ char *mod = NULL;
+ const char *reqSym = NULL;
+ char *s;
+ unsigned char config, m, n, shift;
+ int mclk;
+ vgaHWPtr hwp;
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
+
+ ENTER_PROC("SMI_PreInit");
+
+ if (flags & PROBE_DETECT)
+ {
+ SMI_ProbeDDC(pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index);
+ LEAVE_PROC("SMI_PreInit");
+ return(TRUE);
+ }
+
+ /* Ignoring the Type list for now. It might be needed when multiple cards
+ * are supported.
+ */
+ if (pScrn->numEntities > 1)
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ /* The vgahw module should be loaded here when needed */
+ if (!xf86LoadSubModule(pScrn, "vgahw"))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ xf86LoaderReqSymLists(vgahwSymbols, NULL);
+
+ /*
+ * Allocate a vgaHWRec
+ */
+ if (!vgaHWGetHWRec(pScrn))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ /* Allocate the SMIRec driverPrivate */
+ if (!SMI_GetRec(pScrn))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ pSmi = SMIPTR(pScrn);
+
+ /* Set pScrn->monitor */
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ /*
+ * The first thing we should figure out is the depth, bpp, etc. Our
+ * default depth is 8, so pass it to the helper function. We support
+ * only 24bpp layouts, so indicate that.
+ */
+ if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ /* Check that the returned depth is one we support */
+ switch (pScrn->depth)
+ {
+ case 8:
+ case 16:
+ case 24:
+ /* OK */
+ break;
+
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given depth (%d) is not supported by this driver\n",
+ pScrn->depth);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ xf86PrintDepthBpp(pScrn);
+
+ /*
+ * This must happen after pScrn->display has been set because
+ * xf86SetWeight references it.
+ */
+ if (pScrn->depth > 8)
+ {
+ /* The defaults are OK for us */
+ rgb zeros = {0, 0, 0};
+
+ if (!xf86SetWeight(pScrn, zeros, zeros))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ }
+
+ if (!xf86SetDefaultVisual(pScrn, -1))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ /* We don't currently support DirectColor at > 8bpp */
+ if ((pScrn->depth > 8) && (pScrn->defaultVisual != TrueColor))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual (%s) "
+ "is not supported at depth %d\n",
+ xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ /* We use a programamble clock */
+ pScrn->progClock = TRUE;
+
+ /* Collect all of the relevant option flags (fill in pScrn->options) */
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Set the bits per RGB for 8bpp mode */
+ if (pScrn->depth == 8)
+ {
+ pScrn->rgbBits = 6;
+ }
+
+ /* Process the options */
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SMIOptions);
+
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_PCI_BURST, FALSE))
+ {
+ pSmi->pci_burst = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_burst - PCI burst "
+ "read enabled\n");
+ }
+ else
+ {
+ pSmi->pci_burst = FALSE;
+ }
+
+ pSmi->NoPCIRetry = TRUE;
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_PCI_RETRY, FALSE))
+ {
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_PCI_BURST, FALSE))
+ {
+ pSmi->NoPCIRetry = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_retry\n");
+ }
+ else
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"pci_retry\" option "
+ "requires \"pci_burst\".\n");
+ }
+ }
+
+ if (xf86IsOptionSet(SMIOptions, OPTION_FIFO_CONSERV))
+ {
+ pSmi->fifo_conservative = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_conservative "
+ "set\n");
+ }
+ else
+ {
+ pSmi->fifo_conservative = FALSE;
+ }
+
+ if (xf86IsOptionSet(SMIOptions, OPTION_FIFO_MODERATE))
+ {
+ pSmi->fifo_moderate = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_moderate set\n");
+ }
+ else
+ {
+ pSmi->fifo_moderate = FALSE;
+ }
+
+ if (xf86IsOptionSet(SMIOptions, OPTION_FIFO_AGGRESSIVE))
+ {
+ pSmi->fifo_aggressive = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_aggressive set\n");
+ }
+ else
+ {
+ pSmi->fifo_aggressive = FALSE;
+ }
+
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_NOACCEL, FALSE))
+ {
+ pSmi->NoAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - Acceleration "
+ "disabled\n");
+ }
+ else
+ {
+ pSmi->NoAccel = FALSE;
+ }
+
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_SHOWCACHE, FALSE))
+ {
+ pSmi->ShowCache = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: show_cache set\n");
+ }
+ else
+ {
+ pSmi->ShowCache = FALSE;
+ }
+
+ if (xf86GetOptValFreq(SMIOptions, OPTION_MCLK, OPTUNITS_MHZ, &real))
+ {
+ pSmi->MCLK = (int)(real * 1000.0);
+ if (pSmi->MCLK <= 120000)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: set_mclk set to "
+ "%1.3f MHz\n", pSmi->MCLK / 1000.0);
+ }
+ else
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Memory Clock value of "
+ "%1.3f MHz is larger than limit of 120 MHz\n",
+ pSmi->MCLK / 1000.0);
+ pSmi->MCLK = 0;
+ }
+ }
+ else
+ {
+ pSmi->MCLK = 0;
+ }
+
+ from = X_DEFAULT;
+ pSmi->hwcursor = TRUE;
+ if (xf86GetOptValBool(SMIOptions, OPTION_HWCURSOR, &pSmi->hwcursor))
+ {
+ from = X_CONFIG;
+ }
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_SWCURSOR, FALSE))
+ {
+ pSmi->hwcursor = FALSE;
+ from = X_CONFIG;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s Cursor\n",
+ pSmi->hwcursor ? "Hardware" : "Software");
+
+ if (xf86GetOptValBool(SMIOptions, OPTION_SHADOW_FB, &pSmi->shadowFB))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n",
+ pSmi->shadowFB ? "enabled" : "disabled");
+ }
+
+ if ((s = xf86GetOptValString(SMIOptions, OPTION_ROTATE)))
+ {
+ if(!xf86NameCmp(s, "CW"))
+ {
+ pSmi->shadowFB = TRUE;
+ pSmi->rotate = SMI_ROTATE_CCW;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
+ "clockwise\n");
+ }
+ else if (!xf86NameCmp(s, "CCW"))
+ {
+ pSmi->shadowFB = TRUE;
+ pSmi->rotate = SMI_ROTATE_CW;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen counter "
+ "clockwise\n");
+ }
+ else
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid "
+ "value for Option \"Rotate\"\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are \"CW\" or "
+ "\"CCW\"\n");
+ }
+ }
+
+#ifdef XvExtension
+ if (xf86GetOptValInteger(SMIOptions, OPTION_VIDEOKEY, &pSmi->videoKey))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Video key set to "
+ "0x%08X\n", pSmi->videoKey);
+ }
+ else
+ {
+ pSmi->videoKey = (1 << pScrn->offset.red) | (1 << pScrn->offset.green)
+ | (((pScrn->mask.blue >> pScrn->offset.blue) - 1)
+ << pScrn->offset.blue);
+ }
+
+ if (xf86ReturnOptValBool(SMIOptions, OPTION_BYTESWAP, FALSE))
+ {
+ pSmi->ByteSwap = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ByteSwap enabled.\n");
+ }
+ else
+ {
+ pSmi->ByteSwap = FALSE;
+ }
+#endif
+
+ if (xf86GetOptValBool(SMIOptions, OPTION_USEBIOS, &pSmi->useBIOS))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: UseBIOS %s.\n",
+ pSmi->useBIOS ? "enabled" : "disabled");
+ }
+
+ /* Find the PCI slot for this screen */
+ pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if ((pEnt->location.type != BUS_PCI) || (pEnt->resources))
+ {
+ xfree(pEnt);
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ if (xf86LoadSubModule(pScrn, "int10"))
+ {
+ xf86LoaderReqSymLists(int10Symbols, NULL);
+ pSmi->pInt = xf86InitInt10(pEnt->index);
+ }
+
+ if (xf86LoadSubModule(pScrn, "vbe"))
+ {
+ xf86LoaderReqSymLists(vbeSymbols, NULL);
+ pSmi->pVbe = VBEInit(NULL, pEnt->index);
+ }
+
+ pSmi->PciInfo = xf86GetPciInfoForEntity(pEnt->index);
+ xf86RegisterResources(pEnt->index, NULL, ResExclusive);
+/* xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr);*/
+/* xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr);*/
+
+ /*
+ * Set the Chipset and ChipRev, allowing config file entries to
+ * override.
+ */
+ if (pEnt->device->chipset && *pEnt->device->chipset)
+ {
+ pScrn->chipset = pEnt->device->chipset;
+ pSmi->Chipset = xf86StringToToken(SMIChipsets, pScrn->chipset);
+ from = X_CONFIG;
+ }
+ else if (pEnt->device->chipID >= 0)
+ {
+ pSmi->Chipset = pEnt->device->chipID;
+ pScrn->chipset = (char *) xf86TokenToString(SMIChipsets, pSmi->Chipset);
+ from = X_CONFIG;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n",
+ pSmi->Chipset);
+ }
+ else
+ {
+ from = X_PROBED;
+ pSmi->Chipset = pSmi->PciInfo->chipType;
+ pScrn->chipset = (char *) xf86TokenToString(SMIChipsets, pSmi->Chipset);
+ }
+
+ if (pEnt->device->chipRev >= 0)
+ {
+ pSmi->ChipRev = pEnt->device->chipRev;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
+ pSmi->ChipRev);
+ }
+ else
+ {
+ pSmi->ChipRev = pSmi->PciInfo->chipRev;
+ }
+ xfree(pEnt);
+
+ /*
+ * This shouldn't happen because such problems should be caught in
+ * SMI_Probe(), but check it just in case.
+ */
+ if (pScrn->chipset == NULL)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04X is not "
+ "recognised\n", pSmi->Chipset);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ if (pSmi->Chipset < 0)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Chipset \"%s\" is not "
+ "recognised\n", pScrn->chipset);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);
+
+ pSmi->PciTag = pciTag(pSmi->PciInfo->bus, pSmi->PciInfo->device,
+ pSmi->PciInfo->func);
+
+ SMI_MapMem(pScrn);
+ hwp = VGAHWPTR(pScrn);
+ vgaIOBase = hwp->IOBase;
+ vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET;
+ vgaCRReg = vgaIOBase + VGA_CRTC_DATA_OFFSET;
+
+ xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, "
+ "MMIOBase=%x\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase);
+
+ /* Next go on to detect amount of installed ram */
+ config = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x71);
+
+ if (xf86LoadSubModule(pScrn, "i2c"))
+ {
+ xf86LoaderReqSymLists(i2cSymbols, NULL);
+ SMI_I2CInit(pScrn);
+ }
+ if (xf86LoadSubModule(pScrn, "ddc"))
+ {
+ xf86MonPtr pMon = NULL;
+
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
+#if 1 /* PDR#579 */
+ if (pSmi->pVbe)
+ {
+ pMon = vbeDoEDID(pSmi->pVbe, NULL);
+ if (pMon != NULL)
+ {
+ if ( (pMon->rawData[0] == 0x00)
+ && (pMon->rawData[1] == 0xFF)
+ && (pMon->rawData[2] == 0xFF)
+ && (pMon->rawData[3] == 0xFF)
+ && (pMon->rawData[4] == 0xFF)
+ && (pMon->rawData[5] == 0xFF)
+ && (pMon->rawData[6] == 0xFF)
+ && (pMon->rawData[7] == 0x00)
+ )
+ {
+ pMon = xf86PrintEDID(pMon);
+ if (pMon != NULL)
+ {
+ xf86SetDDCproperties(pScrn, pMon);
+ }
+ }
+ }
+ }
+#else
+ if ( (pSmi->pVbe)
+ && ((pMon = xf86PrintEDID(vbeDoEDID(pSmi->pVbe, NULL))) != NULL)
+ )
+ {
+ xf86SetDDCproperties(pScrn, pMon);
+ }
+#endif
+ else if (!SMI_ddc1(pScrn->scrnIndex))
+ {
+ if (pSmi->I2C)
+ {
+ xf86SetDDCproperties(pScrn,
+ xf86PrintEDID(xf86DoEDID_DDC2(pScrn->scrnIndex,
+ pSmi->I2C)));
+ }
+ }
+ }
+ if (pSmi->pVbe)
+ {
+ vbeFree(pSmi->pVbe);
+ }
+
+ /*
+ * If the driver can do gamma correction, it should call xf86SetGamma()
+ * here. (from MGA, no ViRGE gamma support yet, but needed for
+ * xf86HandleColormaps support.)
+ */
+ {
+ Gamma zeros = { 0.0, 0.0, 0.0 };
+
+ if (!xf86SetGamma(pScrn, zeros))
+ {
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ }
+
+ /* And compute the amount of video memory and offscreen memory */
+ pSmi->videoRAMKBytes = 0;
+
+ if (!pScrn->videoRam)
+ {
+ switch (pSmi->Chipset)
+ {
+ default:
+ {
+ int mem_table[4] = { 1, 2, 4, 0 };
+ pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024;
+ break;
+ }
+
+ case SMI_LYNX3D:
+ {
+ int mem_table[4] = { 0, 2, 4, 6 };
+ pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024 + 512;
+ break;
+ }
+
+ case SMI_LYNX3DM:
+ {
+ int mem_table[4] = { 16, 2, 4, 8 };
+ pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024;
+ break;
+ }
+ }
+ pSmi->videoRAMBytes = pSmi->videoRAMKBytes * 1024;
+ pScrn->videoRam = pSmi->videoRAMKBytes;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "videoram: %dkB\n",
+ pSmi->videoRAMKBytes);
+ }
+ else
+ {
+ pSmi->videoRAMKBytes = pScrn->videoRam;
+ pSmi->videoRAMBytes = pScrn->videoRam * 1024;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "videoram: %dk\n",
+ pSmi->videoRAMKBytes);
+ }
+
+ /* Lynx built-in ramdac speeds */
+ pScrn->numClocks = 4;
+
+ if ((pScrn->clock[3] <= 0) && (pScrn->clock[2] > 0))
+ {
+ pScrn->clock[3] = pScrn->clock[2];
+ }
+
+ if (pSmi->Chipset == SMI_LYNX3DM)
+ {
+ if (pScrn->clock[0] <= 0) pScrn->clock[0] = 200000;
+ if (pScrn->clock[1] <= 0) pScrn->clock[1] = 200000;
+ if (pScrn->clock[2] <= 0) pScrn->clock[2] = 200000;
+ if (pScrn->clock[3] <= 0) pScrn->clock[3] = 200000;
+ }
+ else
+ {
+ if (pScrn->clock[0] <= 0) pScrn->clock[0] = 135000;
+ if (pScrn->clock[1] <= 0) pScrn->clock[1] = 135000;
+ if (pScrn->clock[2] <= 0) pScrn->clock[2] = 135000;
+ if (pScrn->clock[3] <= 0) pScrn->clock[3] = 135000;
+ }
+
+ /* Now set RAMDAC limits */
+ switch (pSmi->Chipset)
+ {
+ default:
+ pSmi->minClock = 20000;
+ pSmi->maxClock = 135000;
+ break;
+ }
+ xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit minClock=%d, maxClock=%d\n",
+ pSmi->minClock, pSmi->maxClock);
+
+ /* Detect current MCLK and print it for user */
+ m = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6A);
+ n = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6B);
+ switch (n >> 6)
+ {
+ default:
+ shift = 1;
+ break;
+
+ case 1:
+ shift = 4;
+ break;
+
+ case 2:
+ shift = 2;
+ break;
+ }
+ n &= 0x3F;
+ mclk = ((1431818 * m) / n / shift + 50) / 100;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected current MCLK value of "
+ "%1.3f MHz\n", mclk / 1000.0);
+
+ SMI_UnmapMem(pScrn);
+
+ pScrn->virtualX = pScrn->display->virtualX;
+
+ /*
+ * Setup the ClockRanges, which describe what clock ranges are available,
+ * and what sort of modes they can be used for.
+ */
+ clockRanges = xnfalloc(sizeof(ClockRange));
+ clockRanges->next = NULL;
+ clockRanges->minClock = pSmi->minClock;
+ clockRanges->maxClock = pSmi->maxClock;
+ clockRanges->clockIndex = -1;
+ clockRanges->interlaceAllowed = FALSE;
+ clockRanges->doubleScanAllowed = FALSE;
+
+
+ i = xf86ValidateModes(
+ pScrn, /* Screen pointer */
+ pScrn->monitor->Modes, /* Available monitor modes */
+ pScrn->display->modes, /* req mode names for screen */
+ clockRanges, /* list of clock ranges allowed */
+ NULL, /* use min/max below */
+ 128, /* min line pitch (width) */
+ 4096, /* maximum line pitch (width) */
+ 128, /* bits of granularity for line pitch */
+ /* (width) above */
+ 128, /* min virtual height */
+ 4096, /* max virtual height */
+ pScrn->display->virtualX, /* force virtual x */
+ pScrn->display->virtualY, /* force virtual Y */
+ pSmi->videoRAMBytes, /* size of aperture used to access */
+ /* video memory */
+ LOOKUP_BEST_REFRESH); /* how to pick modes */
+
+ if (i == -1)
+ {
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ /* Prune the modes marked as invalid */
+ xf86PruneDriverModes(pScrn);
+
+ if ((i == 0) || (pScrn->modes == NULL))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ xf86SetCrtcForModes(pScrn, 0);
+
+ /* Set the current mode to the first in the list */
+ pScrn->currentMode = pScrn->modes;
+
+ /* Print the list of modes being used */
+ xf86PrintModes(pScrn);
+
+ /* Set display resolution */
+ xf86SetDpi(pScrn, 0, 0);
+
+ /* Load bpp-specific modules */
+ switch (pScrn->bitsPerPixel)
+ {
+ case 8:
+ mod = "cfb";
+ reqSym = "cfbScreenInit";
+ break;
+
+ case 16:
+ mod = "cfb16";
+ reqSym = "cfb16ScreenInit";
+ break;
+
+ case 24:
+ mod = "cfb24";
+ reqSym = "cfb24ScreenInit";
+ break;
+ }
+
+ if (mod && (xf86LoadSubModule(pScrn, mod) == NULL))
+ {
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+
+ xf86LoaderReqSymbols(reqSym, NULL);
+
+ /* Load XAA if needed */
+ if (!pSmi->NoAccel || pSmi->hwcursor)
+ {
+ if (!xf86LoadSubModule(pScrn, "xaa"))
+ {
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ xf86LoaderReqSymLists(xaaSymbols, NULL);
+ }
+
+ /* Load ramdac if needed */
+ if (pSmi->hwcursor)
+ {
+ if (!xf86LoadSubModule(pScrn, "ramdac"))
+ {
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ xf86LoaderReqSymLists(ramdacSymbols, NULL);
+ }
+
+ if (pSmi->shadowFB)
+ {
+ if (!xf86LoadSubModule(pScrn, "shadowfb"))
+ {
+ SMI_FreeRec(pScrn);
+ LEAVE_PROC("SMI_PreInit");
+ return(FALSE);
+ }
+ xf86LoaderReqSymLists(shadowSymbols, NULL);
+ }
+
+ LEAVE_PROC("SMI_PreInit");
+ return(TRUE);
+}
+
+/*
+ * This is called when VT switching back to the X server. Its job is to
+ * reinitialise the video mode. We may wish to unmap video/MMIO memory too.
+ */
+
+static Bool
+SMI_EnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ Bool ret;
+
+ ENTER_PROC("SMI_EnterVT");
+
+ /* Enable MMIO and map memory */
+ SMI_MapMem(pScrn);
+ SMI_Save(pScrn);
+
+ ret = SMI_ModeInit(pScrn, pScrn->currentMode);
+
+ LEAVE_PROC("SMI_EnterVT");
+ return(ret);
+}
+
+/*
+ * This is called when VT switching away from the X server. Its job is to
+ * restore the previous (text) mode. We may wish to remap video/MMIO memory
+ * too.
+ */
+
+static void
+SMI_LeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ vgaRegPtr vgaSavePtr = &hwp->SavedReg;
+ SMIRegPtr SMISavePtr = &pSmi->SavedReg;
+
+ ENTER_PROC("SMI_LeaveVT");
+
+ SMI_WriteMode(pScrn, vgaSavePtr, SMISavePtr);
+ SMI_UnmapMem(pScrn);
+
+ LEAVE_PROC("SMI_LeaveVT");
+}
+
+/*
+ * This function performs the inverse of the restore function: It saves all the
+ * standard and extended registers that we are going to modify to set up a video
+ * mode.
+ */
+
+static void
+SMI_Save(ScrnInfoPtr pScrn)
+{
+ int i;
+ CARD32 offset;
+
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ vgaRegPtr vgaSavePtr = &hwp->SavedReg;
+ SMIPtr pSmi = SMIPTR(pScrn);
+ SMIRegPtr save = &pSmi->SavedReg;
+
+ int vgaIOBase = hwp->IOBase;
+ int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET;
+ int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET;
+
+ ENTER_PROC("SMI_Save");
+
+ /* Save the standard VGA registers */
+ vgaHWSave(pScrn, vgaSavePtr, VGA_SR_MODE);
+ save->smiDACMask = VGAIN8(pSmi, VGA_DAC_MASK);
+ VGAOUT8(pSmi, VGA_DAC_READ_ADDR, 0);
+ for (i = 0; i < 256; i++)
+ {
+ save->smiDacRegs[i][0] = VGAIN8(pSmi, VGA_DAC_DATA);
+ save->smiDacRegs[i][1] = VGAIN8(pSmi, VGA_DAC_DATA);
+ save->smiDacRegs[i][2] = VGAIN8(pSmi, VGA_DAC_DATA);
+ }
+ for (i = 0, offset = 2; i < 8192; i++, offset += 8)
+ {
+ save->smiFont[i] = *(pSmi->FBBase + offset);
+ }
+
+ /* Now we save all the extended registers we need. */
+ save->SR17 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x17);
+ save->SR18 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18);
+ save->SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
+ save->SR31 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31);
+ save->SR32 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x32);
+ save->SR6A = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6A);
+ save->SR6B = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6B);
+ save->SR81 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
+ save->SRA0 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0xA0);
+
+ if (SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ /* Save primary registers */
+ save->CR90[14] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E,
+ save->CR90[14] & ~0x20);
+
+ for (i = 0; i < 16; i++)
+ {
+ save->CR90[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x90 + i);
+ }
+ save->CR33 = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33);
+ save->CR3A = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A);
+ for (i = 0; i < 14; i++)
+ {
+ save->CR40[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40 + i);
+ }
+
+ /* Save secondary registers */
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E, save->CR90[14] | 0x20);
+ save->CR33_2 = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33);
+ for (i = 0; i < 14; i++)
+ {
+ save->CR40_2[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData,
+ 0x40 + i);
+ }
+ save->CR9F_2 = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9F);
+
+ /* Save common registers */
+ for (i = 0; i < 14; i++)
+ {
+ save->CRA0[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0xA0 + i);
+ }
+ }
+ else
+ {
+ save->CR33 = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33);
+ save->CR3A = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A);
+ for (i = 0; i < 14; i++)
+ {
+ save->CR40[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40 + i);
+ }
+ }
+
+ save->DPR10 = READ_DPR(pSmi, 0x10);
+ save->DPR1C = READ_DPR(pSmi, 0x1C);
+ save->DPR20 = READ_DPR(pSmi, 0x20);
+ save->DPR24 = READ_DPR(pSmi, 0x24);
+ save->DPR28 = READ_DPR(pSmi, 0x28);
+ save->DPR2C = READ_DPR(pSmi, 0x2C);
+ save->DPR30 = READ_DPR(pSmi, 0x30);
+ save->DPR3C = READ_DPR(pSmi, 0x3C);
+ save->DPR40 = READ_DPR(pSmi, 0x40);
+ save->DPR44 = READ_DPR(pSmi, 0x44);
+
+ save->VPR00 = READ_VPR(pSmi, 0x00);
+ save->VPR0C = READ_VPR(pSmi, 0x0C);
+ save->VPR10 = READ_VPR(pSmi, 0x10);
+
+ save->CPR00 = READ_CPR(pSmi, 0x00);
+
+ if (!pSmi->ModeStructInit)
+ {
+ /* XXX Should check the return value of vgaHWCopyReg() */
+ vgaHWCopyReg(&hwp->ModeReg, vgaSavePtr);
+ memcpy(&pSmi->ModeReg, save, sizeof(SMIRegRec));
+ pSmi->ModeStructInit = TRUE;
+ }
+
+ if (pSmi->useBIOS && (pSmi->pInt != NULL))
+ {
+ pSmi->pInt->num = 0x10;
+ pSmi->pInt->ax = 0x0F00;
+ xf86ExecX86int10(pSmi->pInt);
+ save->mode = pSmi->pInt->ax & 0x00FF;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Current mode 0x%02X.\n",
+ save->mode);
+ }
+
+ if (xf86GetVerbosity() > 1)
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "Saved current video mode. Register dump:\n");
+ SMI_PrintRegs(pScrn);
+ }
+
+ LEAVE_PROC("SMI_Save");
+}
+
+/*
+ * This function is used to restore a video mode. It writes out all of the
+ * standard VGA and extended registers needed to setup a video mode.
+ */
+
+static void
+SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
+{
+ int i;
+ CARD8 tmp;
+ CARD32 offset;
+
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int vgaIOBase = hwp->IOBase;
+ int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET;
+ int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET;
+
+ ENTER_PROC("SMI_WriteMode");
+
+ vgaHWProtect(pScrn, TRUE);
+
+ /* Wait for engine to become idle */
+ WaitIdle();
+
+ if (pSmi->useBIOS && (pSmi->pInt != NULL) && (restore->mode != 0))
+ {
+ pSmi->pInt->num = 0x10;
+ pSmi->pInt->ax = restore->mode;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%02X\n",
+ restore->mode);
+ xf86ExecX86int10(pSmi->pInt);
+
+ /* Enable linear mode. */
+ outb(VGA_SEQ_INDEX, 0x18);
+ tmp = inb(VGA_SEQ_DATA);
+ pSmi->SR18Value = tmp;
+ outb(VGA_SEQ_DATA, tmp | 0x01);
+
+ /* Enable/disable PDR registers. */
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21) & ~0x03;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, tmp |
+ (restore->SR21 & 0x03));
+ }
+ else
+ {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x17, restore->SR17);
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18) & ~0x1F;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, tmp |
+ (restore->SR18 & 0x1F));
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21) & ~0x03;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, tmp |
+ (restore->SR21 & 0x03));
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & ~0xC0;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31, tmp |
+ (restore->SR31 & 0xC0));
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x32) & ~0x07;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x32, tmp |
+ (restore->SR32 & 0x07));
+ if (restore->SR6B != 0xFF)
+ {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6A,
+ restore->SR6A);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6B,
+ restore->SR6B);
+ }
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, restore->SR81);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0xA0, restore->SRA0);
+
+ /* Restore the standard VGA registers */
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
+ if (restore->smiDACMask)
+ {
+ VGAOUT8(pSmi, VGA_DAC_MASK, restore->smiDACMask);
+ }
+ else
+ {
+ VGAOUT8(pSmi, VGA_DAC_MASK, 0xFF);
+ }
+ VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, 0);
+ for (i = 0; i < 256; i++)
+ {
+ VGAOUT8(pSmi, VGA_DAC_DATA, restore->smiDacRegs[i][0]);
+ VGAOUT8(pSmi, VGA_DAC_DATA, restore->smiDacRegs[i][1]);
+ VGAOUT8(pSmi, VGA_DAC_DATA, restore->smiDacRegs[i][2]);
+ }
+ for (i = 0, offset = 2; i < 8192; i++, offset += 8)
+ {
+ *(pSmi->FBBase + offset) = restore->smiFont[i];
+ }
+
+ if (SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ /* Restore secondary registers */
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E,
+ restore->CR90[14] | 0x20);
+
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33_2);
+ for (i = 0; i < 14; i++)
+ {
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40 + i,
+ restore->CR40_2[i]);
+ }
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9F, restore->CR9F_2);
+
+ /* Restore primary registers */
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E,
+ restore->CR90[14] & ~0x20);
+
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33_2);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A, restore->CR3A);
+ for (i = 0; i < 14; i++)
+ {
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40 + i,
+ restore->CR40[i]);
+ }
+ for (i = 0; i < 16; i++)
+ {
+ if (i != 14)
+ {
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x90 + i,
+ restore->CR90[i]);
+ }
+ }
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E, restore->CR90[14]);
+
+ /* Restore common registers */
+ for (i = 0; i < 14; i++)
+ {
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0xA0 + i,
+ restore->CRA0[i]);
+ }
+ }
+
+ /* Restore the standard VGA registers */
+ if (xf86IsPrimaryPci(pSmi->PciInfo))
+ {
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
+ }
+ else
+ {
+ vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
+ }
+
+ if (!SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A, restore->CR3A);
+ for (i = 0; i < 14; i++)
+ {
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40 + i,
+ restore->CR40[i]);
+ }
+ }
+ }
+
+ WRITE_DPR(pSmi, 0x10, restore->DPR10);
+ WRITE_DPR(pSmi, 0x1C, restore->DPR1C);
+ WRITE_DPR(pSmi, 0x20, restore->DPR20);
+ WRITE_DPR(pSmi, 0x24, restore->DPR24);
+ WRITE_DPR(pSmi, 0x28, restore->DPR28);
+ WRITE_DPR(pSmi, 0x2C, restore->DPR2C);
+ WRITE_DPR(pSmi, 0x30, restore->DPR30);
+ WRITE_DPR(pSmi, 0x3C, restore->DPR3C);
+ WRITE_DPR(pSmi, 0x40, restore->DPR40);
+ WRITE_DPR(pSmi, 0x44, restore->DPR44);
+
+ WRITE_VPR(pSmi, 0x00, restore->VPR00);
+ WRITE_VPR(pSmi, 0x0C, restore->VPR0C);
+ WRITE_VPR(pSmi, 0x10, restore->VPR10);
+
+ WRITE_CPR(pSmi, 0x00, restore->CPR00);
+
+ if (xf86GetVerbosity() > 1)
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "Done restoring mode. Register dump:\n");
+ SMI_PrintRegs(pScrn);
+ }
+
+ vgaHWProtect(pScrn, FALSE);
+
+ LEAVE_PROC("SMI_WriteMode");
+}
+
+static Bool
+SMI_MapMem(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ vgaHWPtr hwp;
+ CARD32 memBase;
+
+ ENTER_PROC("SMI_MapMem");
+
+ /* Map the Lynx register space */
+ switch (pSmi->Chipset)
+ {
+ default:
+ memBase = pSmi->PciInfo->memBase[0] + 0x400000;
+ pSmi->MapSize = 0x10000;
+ break;
+
+ case SMI_LYNX3D:
+ memBase = pSmi->PciInfo->memBase[0] + 0x680000;
+ pSmi->MapSize = 0x180000;
+ break;
+
+ case SMI_LYNXEM:
+ case SMI_LYNXEMplus:
+ memBase = pSmi->PciInfo->memBase[0] + 0x400000;
+ pSmi->MapSize = 0x400000;
+ break;
+
+ case SMI_LYNX3DM:
+ memBase = pSmi->PciInfo->memBase[0];
+ pSmi->MapSize = 0x200000;
+ break;
+ }
+ pSmi->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pSmi->PciTag,
+ memBase, pSmi->MapSize);
+
+ if (pSmi->MapBase == NULL)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not map "
+ "MMIO registers.\n");
+ LEAVE_PROC("SMI_MapMem");
+ return(FALSE);
+ }
+
+ switch (pSmi->Chipset)
+ {
+ default:
+ pSmi->DPRBase = pSmi->MapBase + 0x8000;
+ pSmi->VPRBase = pSmi->MapBase + 0xC000;
+ pSmi->CPRBase = pSmi->MapBase + 0xE000;
+ pSmi->IOBase = NULL;
+ pSmi->DataPortBase = pSmi->MapBase;
+ pSmi->DataPortSize = 0x8000;
+ break;
+
+ case SMI_LYNX3D:
+ pSmi->DPRBase = pSmi->MapBase + 0x000000;
+ pSmi->VPRBase = pSmi->MapBase + 0x000800;
+ pSmi->CPRBase = pSmi->MapBase + 0x001000;
+ pSmi->IOBase = pSmi->MapBase + 0x040000;
+ pSmi->DataPortBase = pSmi->MapBase + 0x080000;
+ pSmi->DataPortSize = 0x100000;
+ break;
+
+ case SMI_LYNXEM:
+ case SMI_LYNXEMplus:
+ pSmi->DPRBase = pSmi->MapBase + 0x008000;
+ pSmi->VPRBase = pSmi->MapBase + 0x00C000;
+ pSmi->CPRBase = pSmi->MapBase + 0x00E000;
+ pSmi->IOBase = pSmi->MapBase + 0x300000;
+ pSmi->DataPortBase = pSmi->MapBase /*+ 0x100000*/;
+ pSmi->DataPortSize = 0x8000 /*0x200000*/;
+ break;
+
+ case SMI_LYNX3DM:
+ pSmi->DPRBase = pSmi->MapBase + 0x000000;
+ pSmi->VPRBase = pSmi->MapBase + 0x000800;
+ pSmi->CPRBase = pSmi->MapBase + 0x001000;
+ pSmi->IOBase = pSmi->MapBase + 0x0C0000;
+ pSmi->DataPortBase = pSmi->MapBase + 0x100000;
+ pSmi->DataPortSize = 0x100000;
+ break;
+ }
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "Physical MMIO at 0x%08X\n", memBase);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "Logical MMIO at 0x%08X - 0x%08X\n", pSmi->MapBase,
+ pSmi->MapBase + pSmi->MapSize - 1);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "DPR=0x%08X, VPR=0x%08X, IOBase=0x%08X\n", pSmi->DPRBase,
+ pSmi->VPRBase, pSmi->IOBase);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "DataPort=0x%08X - 0x%08X\n", pSmi->DataPortBase,
+ pSmi->DataPortBase + pSmi->DataPortSize - 1);
+
+ /* Map the frame buffer */
+ if (pSmi->Chipset == SMI_LYNX3DM)
+ {
+ pScrn->memPhysBase = pSmi->PciInfo->memBase[0] + 0x200000;
+ }
+ else
+ {
+ pScrn->memPhysBase = pSmi->PciInfo->memBase[0];
+ }
+ if (pSmi->videoRAMBytes)
+ {
+ pSmi->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+ pSmi->PciTag, pScrn->memPhysBase, pSmi->videoRAMBytes);
+
+ if (pSmi->FBBase == NULL)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not "
+ "map framebuffer.\n");
+ LEAVE_PROC("SMI_MapMem");
+ return(FALSE);
+ }
+ }
+ pSmi->FBOffset = pScrn->fbOffset = 0;
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "Physical frame buffer at 0x%08X\n", pScrn->memPhysBase);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "Logical frame buffer at 0x%08X - 0x%08X\n", pSmi->FBBase,
+ pSmi->FBBase + pSmi->videoRAMBytes - 1);
+
+ SMI_EnableMmio(pScrn);
+
+ /* Set up offset to hwcursor memory area. It's a 1K chunk at the end of
+ * the frame buffer. Also set up the reserved memory space.
+ */
+ pSmi->FBCursorOffset = pSmi->videoRAMBytes - 1024;
+ if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_INDEX, 0x30) & 0x01)
+ {
+ CARD32 fifiOffset = 0;
+ fifiOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x46)
+ << 3;
+ fifiOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x47)
+ << 11;
+ fifiOffset |= (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49)
+ & 0x1C) << 17;
+ pSmi->FBReserved = pSmi->videoRAMBytes - fifiOffset;
+ }
+ else
+ {
+ pSmi->FBReserved = pSmi->videoRAMBytes - 2048;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Cursor Offset: %08X Reserved: %08X\n",
+ pSmi->FBCursorOffset, pSmi->FBReserved);
+
+ pSmi->lcd = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & 0x01;
+ if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01)
+ {
+ pSmi->lcd <<= 1;
+ }
+ switch (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x0C)
+ {
+ case 0x00:
+ pSmi->lcdWidth = 640;
+ pSmi->lcdHeight = 480;
+ break;
+
+ case 0x04:
+ pSmi->lcdWidth = 800;
+ pSmi->lcdHeight = 600;
+ break;
+
+ case 0x08:
+ if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x74) & 0x02)
+ {
+ pSmi->lcdWidth = 1024;
+ pSmi->lcdHeight = 600;
+ }
+ else
+ {
+ pSmi->lcdWidth = 1024;
+ pSmi->lcdHeight = 768;
+ }
+ break;
+
+ case 0x0C:
+ pSmi->lcdWidth = 1280;
+ pSmi->lcdHeight = 1024;
+ break;
+ }
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, "%s Panel Size = %dx%d\n",
+ (pSmi->lcd == 0) ? "OFF" : (pSmi->lcd == 1) ? "TFT" : "DSTN",
+ pSmi->lcdWidth, pSmi->lcdHeight);
+
+ /* Assign hwp->MemBase & IOBase here */
+ hwp = VGAHWPTR(pScrn);
+ if (pSmi->IOBase != NULL)
+ {
+ vgaHWSetMmioFuncs(hwp, pSmi->MapBase, pSmi->IOBase - pSmi->MapBase);
+ }
+ vgaHWGetIOBase(hwp);
+
+ /* Map the VGA memory when the primary video */
+ if (xf86IsPrimaryPci(pSmi->PciInfo))
+ {
+ hwp->MapSize = 0x10000;
+ if (!vgaHWMapMem(pScrn))
+ {
+ LEAVE_PROC("SMI_MapMem");
+ return(FALSE);
+ }
+ pSmi->PrimaryVidMapped = TRUE;
+ }
+
+ LEAVE_PROC("SMI_MapMem");
+ return(TRUE);
+}
+
+/* UnMapMem - contains half of pre-4.0 EnterLeave function. The EnterLeave
+ * function which en/disable access to IO ports and ext. regs
+ */
+
+static void
+SMI_UnmapMem(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_UnmapMem");
+
+ /* Unmap VGA mem if mapped. */
+ if (pSmi->PrimaryVidMapped)
+ {
+ vgaHWUnmapMem(pScrn);
+ pSmi->PrimaryVidMapped = FALSE;
+ }
+
+ SMI_DisableMmio(pScrn);
+
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pSmi->MapBase, pSmi->MapSize);
+ if (pSmi->FBBase != NULL)
+ {
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pSmi->FBBase,
+ pSmi->videoRAMBytes);
+ }
+
+ LEAVE_PROC("SMI_UnmapMem");
+}
+
+/* This gets called at the start of each server generation. */
+
+static Bool
+SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_ScreenInit");
+
+ /* Map MMIO regs and framebuffer */
+ if (!SMI_MapMem(pScrn))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+
+ /* Save the chip/graphics state */
+ SMI_Save(pScrn);
+
+ /* Initialise the first mode */
+ if (!SMI_ModeInit(pScrn, pScrn->currentMode))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+
+ /*
+ * The next step is to setup the screen's visuals, and initialise the
+ * framebuffer code. In cases where the framebuffer's default choises for
+ * things like visual layouts and bits per RGB are OK, this may be as simple
+ * as calling the framebuffer's ScreenInit() function. If not, the visuals
+ * will need to be setup before calling a fb ScreenInit() function and fixed
+ * up after.
+ *
+ * For most PC hardware at depths >= 8, the defaults that cfb uses are not
+ * appropriate. In this driver, we fixup the visuals after.
+ */
+
+ /*
+ * Reset the visual list.
+ */
+ miClearVisualTypes();
+
+ /* Setup the visuals we support. */
+
+ /*
+ * For bpp > 8, the default visuals are not acceptable because we only
+ * support TrueColor and not DirectColor. To deal with this, call
+ * miSetVisualTypes with the appropriate visual mask.
+ */
+
+ if (pScrn->bitsPerPixel > 8)
+ {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits,
+ pScrn->defaultVisual))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+ }
+ else
+ {
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits,
+ pScrn->defaultVisual))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+ }
+
+ if (!SMI_InternalScreenInit(scrnIndex, pScreen))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+
+ xf86SetBlackWhitePixels(pScreen);
+
+ if (pScrn->bitsPerPixel > 8)
+ {
+ VisualPtr visual;
+ /* Fixup RGB ordering */
+ visual = pScreen->visuals + pScreen->numVisuals;
+ while (--visual >= pScreen->visuals)
+ {
+ if ((visual->class | DynamicClass) == DirectColor)
+ {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ /* Initialize acceleration layer */
+ if (!pSmi->NoAccel)
+ {
+ if (!SMI_AccelInit(pScreen))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+ }
+ miInitializeBackingStore(pScreen);
+
+ /* hardware cursor needs to wrap this layer */
+ SMI_DGAInit(pScreen);
+
+ /* Initialise cursor functions */
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ /* Initialize HW cursor layer. Must follow software cursor
+ * initialization.
+ */
+ if (pSmi->hwcursor)
+ {
+ if (!SMI_HWCursorInit(pScreen))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor "
+ "initialization failed\n");
+ }
+ }
+
+ if (pSmi->shadowFB)
+ {
+ RefreshAreaFuncPtr refreshArea = SMI_RefreshArea;
+
+ if (pSmi->rotate)
+ {
+ if (pSmi->PointerMoved == NULL)
+ {
+ pSmi->PointerMoved = pScrn->PointerMoved;
+ pScrn->PointerMoved = SMI_PointerMoved;
+ }
+ }
+
+ ShadowFBInit(pScreen, refreshArea);
+ }
+
+ /* Initialise default colormap */
+ if (!miCreateDefColormap(pScreen))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+
+ /* Initialize colormap layer. Must follow initialization of the default
+ * colormap. And SetGamma call, else it will load palette with solid white.
+ */
+ if (!xf86HandleColormaps(pScreen, 256, 6, SMI_LoadPalette, NULL,
+ CMAP_RELOAD_ON_MODE_SWITCH))
+ {
+ LEAVE_PROC("SMI_ScreenInit");
+ return(FALSE);
+ }
+
+ pScreen->SaveScreen = SMI_SaveScreen;
+ pSmi->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = SMI_CloseScreen;
+
+#ifdef DPMSExtension
+ if (!xf86DPMSInit(pScreen, SMI_DisplayPowerManagementSet, 0))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n");
+ }
+#endif
+
+ SMI_InitVideo(pScreen);
+
+ /* Report any unused options (only for the first generation) */
+ if (serverGeneration == 1)
+ {
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+ }
+
+ LEAVE_PROC("SMI_ScreenInit");
+ return(TRUE);
+}
+
+/* Common init routines needed in EnterVT and ScreenInit */
+
+static int
+SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int width, height, displayWidth;
+ int bytesPerPixel = pScrn->bitsPerPixel / 8;
+ int xDpi, yDpi;
+ int ret;
+
+ ENTER_PROC("SMI_InternalScreenInit");
+
+ if (pSmi->rotate)
+ {
+ width = pScrn->virtualY;
+ height = pScrn->virtualX;
+ xDpi = pScrn->yDpi;
+ yDpi = pScrn->xDpi;
+ displayWidth = ((width * bytesPerPixel + 15) & ~15) / bytesPerPixel;
+ }
+ else
+ {
+ width = pScrn->virtualX;
+ height = pScrn->virtualY;
+ xDpi = pScrn->xDpi;
+ yDpi = pScrn->yDpi;
+ displayWidth = pScrn->displayWidth;
+ }
+
+ if (pSmi->shadowFB)
+ {
+ pSmi->ShadowWidth = width;
+ pSmi->ShadowHeight = height;
+ pSmi->ShadowWidthBytes = (width * bytesPerPixel + 15) & ~15;
+ if (bytesPerPixel == 3)
+ {
+ pSmi->ShadowPitch = ((height * 3) << 16)
+ | pSmi->ShadowWidthBytes;
+ }
+ else
+ {
+ pSmi->ShadowPitch = (height << 16)
+ | (pSmi->ShadowWidthBytes / bytesPerPixel);
+ }
+
+ pSmi->FBReserved -= pSmi->ShadowWidthBytes * pSmi->ShadowHeight;
+ pSmi->FBReserved &= ~0x15;
+ WRITE_VPR(pSmi, 0x0C, (pSmi->FBOffset = pSmi->FBReserved) >> 3);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Shadow: width=%d height=%d "
+ "offset=0x%08X pitch=0x%08X\n", pSmi->ShadowWidth,
+ pSmi->ShadowHeight, pSmi->FBOffset, pSmi->ShadowPitch);
+ }
+ else
+ {
+ pSmi->FBOffset = 0;
+ }
+
+ /*
+ * Call the framebuffer layer's ScreenInit function, and fill in other
+ * pScreen fields.
+ */
+
+ DEBUG((VERBLEV, "\tInitializing FB @ 0x%08X for %dx%d (%d)\n",
+ pSmi->FBBase, width, height, displayWidth));
+ switch (pScrn->bitsPerPixel)
+ {
+ case 8:
+ ret = cfbScreenInit(pScreen, pSmi->FBBase, width, height, xDpi,
+ yDpi, displayWidth);
+ break;
+
+ case 16:
+ ret = cfb16ScreenInit(pScreen, pSmi->FBBase, width, height, xDpi,
+ yDpi, displayWidth);
+ break;
+
+ case 24:
+ ret = cfb24ScreenInit(pScreen, pSmi->FBBase, width, height, xDpi,
+ yDpi, displayWidth);
+ break;
+
+ default:
+ xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) "
+ "in SMI_InternalScreenInit\n", pScrn->bitsPerPixel);
+ LEAVE_PROC("SMI_InternalScreenInit");
+ return(FALSE);
+ }
+
+ LEAVE_PROC("SMI_InternalScreenInit");
+ return(ret);
+}
+
+/* Checks if a mode is suitable for the selected configuration. */
+static ModeStatus
+SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_ValidMode");
+
+ xf86DrvMsg(scrnIndex, X_INFO, "Mode: %dx%d %d-bpp, %fHz\n", mode->HDisplay,
+ mode->VDisplay, pScrn->bitsPerPixel, mode->VRefresh);
+
+ if (pSmi->shadowFB)
+ {
+ int mem;
+
+ if (pScrn->bitsPerPixel == 24)
+ {
+ LEAVE_PROC("SMI_ValidMode");
+ return(MODE_BAD);
+ }
+
+ mem = (pScrn->virtualX * pScrn->bitsPerPixel / 8 + 15) & ~15;
+ mem *= pScrn->virtualY * 2;
+
+ if (mem > pSmi->videoRAMBytes - pSmi->FBReserved)
+ {
+ LEAVE_PROC("SMI_ValidMode");
+ return(MODE_MEM);
+ }
+ }
+
+ if (!pSmi->useBIOS || pSmi->lcd)
+ {
+ if ( (mode->HDisplay != pSmi->lcdWidth)
+ || (mode->VDisplay != pSmi->lcdHeight)
+ )
+ {
+ LEAVE_PROC("SMI_ValidMode");
+ return(MODE_PANEL);
+ }
+
+ if (pSmi->rotate)
+ {
+ if ( (mode->HDisplay > pSmi->lcdWidth)
+ || (mode->VDisplay > pSmi->lcdHeight)
+ )
+ {
+ LEAVE_PROC("SMI_ValidMode");
+ return(MODE_PANEL);
+ }
+ }
+ }
+
+ LEAVE_PROC("SMI_ValidMode");
+ return(MODE_OK);
+}
+
+static Bool
+SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ unsigned char tmp;
+ int panelIndex, modeIndex, i;
+ int xyAddress[] = { 320, 400, 512, 640, 800, 1024, 1280, 1600, 2048 };
+ CARD32 DEDataFormat = 0;
+
+ /* Store values to current mode register structs */
+ SMIRegPtr new = &pSmi->ModeReg;
+ vgaRegPtr vganew = &hwp->ModeReg;
+
+ ENTER_PROC("SMI_ModeInit");
+
+ if(!vgaHWInit(pScrn, mode))
+ {
+ LEAVE_PROC("SMI_ModeInit");
+ return(FALSE);
+ }
+
+ if (pSmi->rotate)
+ {
+ pSmi->width = pScrn->virtualY;
+ pSmi->height = pScrn->virtualX;
+ }
+ else
+ {
+ pSmi->width = pScrn->virtualX;
+ pSmi->height = pScrn->virtualY;
+ }
+ pSmi->Bpp = pScrn->bitsPerPixel / 8;
+
+ outb(VGA_SEQ_INDEX, 0x17);
+ tmp = inb(VGA_SEQ_DATA);
+ if (pSmi->pci_burst)
+ {
+ new->SR17 = tmp | 0x20;
+ }
+ else
+ {
+ new->SR17 = tmp & ~0x20;
+ }
+
+ outb(VGA_SEQ_INDEX, 0x18);
+ new->SR18 = inb(VGA_SEQ_DATA) | 0x11;
+
+ outb(VGA_SEQ_INDEX, 0x21);
+ new->SR21 = inb(VGA_SEQ_DATA) & ~0x03;
+
+ outb(VGA_SEQ_INDEX, 0x31);
+ new->SR31 = inb(VGA_SEQ_DATA) & ~0xC0;
+
+ outb(VGA_SEQ_INDEX, 0x32);
+ new->SR32 = inb(VGA_SEQ_DATA) & ~0x07;
+ if (SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ new->SR32 |= 0x04;
+ }
+
+ new->SRA0 = new->CR33 = new->CR3A = 0x00;
+
+ if (pSmi->lcdWidth == 640)
+ {
+ panelIndex = 0;
+ }
+ else if (pSmi->lcdWidth == 800)
+ {
+ panelIndex = 1;
+ }
+ else
+ {
+ panelIndex = 2;
+ }
+
+ if (mode->HDisplay == 640)
+ {
+ modeIndex = 0;
+ }
+ else if (mode->HDisplay == 800)
+ {
+ modeIndex = 1;
+ }
+ else
+ {
+ modeIndex = 2;
+ }
+
+ if (SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ static unsigned char PanelTable[3][14] =
+ {
+ { 0x5F, 0x4F, 0x00, 0x52, 0x1E, 0x0B, 0xDF, 0x00, 0xE9, 0x0B, 0x2E,
+ 0x00, 0x4F, 0xDF },
+ { 0x7F, 0x63, 0x00, 0x69, 0x19, 0x72, 0x57, 0x00, 0x58, 0x0C, 0xA2,
+ 0x20, 0x4F, 0xDF },
+ { 0xA3, 0x7F, 0x00, 0x83, 0x14, 0x24, 0xFF, 0x00, 0x02, 0x08, 0xA7,
+ 0xE0, 0x4F, 0xDF },
+ };
+
+ for (i = 0; i < 14; i++)
+ {
+ new->CR40[i] = PanelTable[panelIndex][i];
+ }
+ new->CR90[14] = 0x03;
+ new->CR90[15] = 0x00;
+ if (mode->VDisplay < pSmi->lcdHeight)
+ {
+ new->CRA0[6] = (pSmi->lcdHeight - mode->VDisplay) / 8;
+ }
+ else
+ {
+ new->CRA0[6] = 0;
+ }
+
+ if (mode->HDisplay < pSmi->lcdWidth)
+ {
+ new->CRA0[7] = (pSmi->lcdWidth - mode->HDisplay) / 16;
+ }
+ else
+ {
+ new->CRA0[7] = 0;
+ }
+ }
+ else
+ {
+ static unsigned char PanelTable[3][3][14] =
+ {
+ { /* 640x480 panel */
+ { 0x5F, 0x4F, 0x00, 0x53, 0x00, 0x0B, 0xDF, 0x00, 0xEA, 0x0C,
+ 0x2E, 0x00, 0x4F, 0xDF },
+ { 0x5F, 0x4F, 0x00, 0x53, 0x00, 0x0B, 0xDF, 0x00, 0xEA, 0x0C,
+ 0x2E, 0x00, 0x4F, 0xDF },
+ { 0x5F, 0x4F, 0x00, 0x53, 0x00, 0x0B, 0xDF, 0x00, 0xEA, 0x0C,
+ 0x2E, 0x00, 0x4F, 0xDF },
+ },
+ { /* 800x600 panel */
+ { 0x7F, 0x59, 0x19, 0x5E, 0x8E, 0x72, 0x1C, 0x37, 0x1D, 0x00,
+ 0xA2, 0x20, 0x4F, 0xDF },
+ { 0x7F, 0x63, 0x00, 0x68, 0x18, 0x72, 0x58, 0x00, 0x59, 0x0C,
+ 0xE0, 0x20, 0x63, 0x57 },
+ { 0x7F, 0x63, 0x00, 0x68, 0x18, 0x72, 0x58, 0x00, 0x59, 0x0C,
+ 0xE0, 0x20, 0x63, 0x57 },
+ },
+ { /* 1024x768 panel */
+ { 0xA3, 0x67, 0x0F, 0x6D, 0x1D, 0x24, 0x70, 0x95, 0x72, 0x07,
+ 0xA3, 0x20, 0x4F, 0xDF },
+ { 0xA3, 0x71, 0x19, 0x77, 0x07, 0x24, 0xAC, 0xD1, 0xAE, 0x03,
+ 0xE1, 0x20, 0x63, 0x57 },
+ { 0xA3, 0x7F, 0x00, 0x85, 0x15, 0x24, 0xFF, 0x00, 0x01, 0x07,
+ 0xE5, 0x20, 0x7F, 0xFF },
+ },
+ };
+
+ for (i = 0; i < 14; i++)
+ {
+ new->CR40[i] = PanelTable[panelIndex][modeIndex][i];
+ }
+ }
+
+ outb(VGA_SEQ_INDEX, 0x30);
+ if (inb(VGA_SEQ_DATA) & 0x01)
+ {
+ new->SR21 = 0x00;
+ }
+
+ if (pSmi->MCLK > 0)
+ {
+ SMI_CommonCalcClock(pSmi->MCLK, 1, 1, 31, 0, 2, pSmi->minClock,
+ pSmi->maxClock, &new->SR6A, &new->SR6B);
+ }
+ else
+ {
+ new->SR6B = 0xFF;
+ }
+
+ if ((mode->HDisplay == 640) && SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ vganew->MiscOutReg &= ~0x0C;
+ }
+ else
+ {
+ vganew->MiscOutReg |= 0x0C;
+ }
+ vganew->MiscOutReg |= 0xE0;
+ if (mode->HDisplay == 800)
+ {
+ vganew->MiscOutReg &= ~0xC0;
+ }
+ if ((mode->HDisplay == 1024) && SMI_LYNXM_SERIES(pSmi->Chipset))
+ {
+ vganew->MiscOutReg &= ~0xC0;
+ }
+
+ /* Set DPR registers */
+ pSmi->Stride = (pSmi->width * pSmi->Bpp + 15) & ~15;
+ switch (pScrn->bitsPerPixel)
+ {
+ case 8:
+ DEDataFormat = 0x00000000;
+ break;
+
+ case 16:
+ pSmi->Stride >>= 1;
+ DEDataFormat = 0x00100000;
+ break;
+
+ case 24:
+ DEDataFormat = 0x00300000;
+ break;
+
+ case 32:
+ pSmi->Stride >>= 2;
+ DEDataFormat = 0x00200000;
+ break;
+ }
+ for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++)
+ {
+ if (pSmi->rotate)
+ {
+ if (xyAddress[i] == pSmi->height)
+ {
+ DEDataFormat |= i << 16;
+ break;
+ }
+ }
+ else
+ {
+ if (xyAddress[i] == pSmi->width)
+ {
+ DEDataFormat |= i << 16;
+ break;
+ }
+ }
+ }
+ new->DPR10 = (pSmi->Stride << 16) | pSmi->Stride;
+ new->DPR1C = DEDataFormat;
+ new->DPR20 = 0;
+ new->DPR24 = 0xFFFFFFFF;
+ new->DPR28 = 0xFFFFFFFF;
+ new->DPR2C = 0;
+ new->DPR30 = 0;
+ new->DPR3C = (pSmi->Stride << 16) | pSmi->Stride;
+ new->DPR40 = 0;
+ new->DPR44 = 0;
+
+ /* Set VPR registers */
+ switch (pScrn->bitsPerPixel)
+ {
+ case 8:
+ new->VPR00 = 0x00000000;
+ break;
+
+ case 16:
+ new->VPR00 = 0x00020000;
+ break;
+
+ case 24:
+ new->VPR00 = 0x00040000;
+ break;
+
+ case 32:
+ new->VPR00 = 0x00030000;
+ break;
+ }
+ new->VPR0C = pSmi->FBOffset >> 3;
+ if (pSmi->rotate)
+ {
+ new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->height) * pSmi->Bpp) >> 3)
+ + 2) << 16) | ((pSmi->height * pSmi->Bpp) >> 3);
+ }
+ else
+ {
+ new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->width) * pSmi->Bpp) >> 3)
+ + 2) << 16) | ((pSmi->width * pSmi->Bpp) >> 3);
+ }
+
+ /* Set CPR registers */
+ new->CPR00 = 0x00000000;
+
+ pScrn->vtSema = TRUE;
+
+ /* Find the INT 10 mode number */
+ {
+ static struct
+ {
+ int x, y, bpp;
+ CARD16 mode;
+
+ } modeTable[] =
+ {
+ { 640, 480, 8, 0x50 },
+ { 640, 480, 16, 0x52 },
+ { 640, 480, 24, 0x53 },
+ { 640, 480, 32, 0x54 },
+ { 800, 600, 8, 0x55 },
+ { 800, 600, 16, 0x57 },
+ { 800, 600, 24, 0x58 },
+ { 800, 600, 32, 0x59 },
+ { 1024, 768, 8, 0x60 },
+ { 1024, 768, 16, 0x62 },
+ { 1024, 768, 24, 0x63 },
+ { 1024, 768, 32, 0x64 },
+ { 1280, 1024, 8, 0x65 },
+ { 1280, 1024, 16, 0x67 },
+ { 1280, 1024, 24, 0x68 },
+ { 1280, 1024, 32, 0x69 },
+ };
+
+ new->mode = 0;
+ for (i = 0; i < sizeof(modeTable) / sizeof(modeTable[0]); i++)
+ {
+ if ( (modeTable[i].x == mode->HDisplay)
+ && (modeTable[i].y == mode->VDisplay)
+ && (modeTable[i].bpp == pScrn->bitsPerPixel)
+ )
+ {
+ new->mode = modeTable[i].mode;
+ break;
+ }
+ }
+ }
+
+ /* Zero the font memory */
+ memset(new->smiFont, 0, sizeof(new->smiFont));
+
+ /* Zero the frame buffer, #258 */
+ memset(pSmi->FBBase + pSmi->FBOffset, 0,
+ pSmi->width * pSmi->height * pSmi->Bpp);
+
+ /* Write the mode registers to hardware */
+ SMI_WriteMode(pScrn, vganew, new);
+
+ /* Adjust the viewport */
+ SMI_AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ LEAVE_PROC("SMI_ModeInit");
+ return(TRUE);
+}
+
+/*
+ * This is called at the end of each server generation. It restores the
+ * original (text) mode. It should also unmap the video memory, and free any
+ * per-generation data allocated by the driver. It should finish by unwrapping
+ * and calling the saved CloseScreen function.
+ */
+
+static Bool
+SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ vgaRegPtr vgaSavePtr = &hwp->SavedReg;
+ SMIRegPtr SMISavePtr = &pSmi->SavedReg;
+ Bool ret;
+
+ ENTER_PROC("SMI_CloseScreen");
+
+ if (pScrn->vtSema)
+ {
+ SMI_WriteMode(pScrn, vgaSavePtr, SMISavePtr);
+ vgaHWLock(hwp);
+ SMI_UnmapMem(pScrn);
+ }
+
+ if (pSmi->AccelInfoRec != NULL)
+ {
+ XAADestroyInfoRec(pSmi->AccelInfoRec);
+ }
+ if (pSmi->CursorInfoRec != NULL)
+ {
+ xf86DestroyCursorInfoRec(pSmi->CursorInfoRec);
+ }
+ if (pSmi->DGAModes != NULL)
+ {
+ xfree(pSmi->DGAModes);
+ }
+ if (pSmi->pInt != NULL)
+ {
+ xf86FreeInt10(pSmi->pInt);
+ }
+#ifdef XvExtension
+ if (pSmi->ptrAdaptor != NULL)
+ {
+ xfree(pSmi->ptrAdaptor);
+ }
+ if (pSmi->BlockHandler != NULL)
+ {
+ pScreen->BlockHandler = pSmi->BlockHandler;
+ }
+#endif
+ if (pSmi->I2C != NULL)
+ {
+ xf86DestroyI2CBusRec(pSmi->I2C, TRUE, TRUE);
+ }
+
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = pSmi->CloseScreen;
+ ret = (*pScreen->CloseScreen)(scrnIndex, pScreen);
+
+ LEAVE_PROC("SMI_CloseScreen");
+ return(ret);
+}
+
+static void
+SMI_FreeScreen(int scrnIndex, int flags)
+{
+ SMI_FreeRec(xf86Screens[scrnIndex]);
+}
+
+static Bool
+SMI_SaveScreen(ScreenPtr pScreen, int mode)
+{
+ Bool ret;
+
+ ENTER_PROC("SMI_SaveScreen");
+
+ ret = vgaHWSaveScreen(pScreen, mode);
+
+ LEAVE_PROC("SMI_SaveScreen");
+ return(ret);
+}
+
+void
+SMI_AdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD32 Base;
+
+ ENTER_PROC("SMI_AdjustFrame");
+
+ if (pSmi->ShowCache && y)
+ {
+ y += pScrn->virtualY - 1;
+ }
+
+ Base = pSmi->FBOffset + (x + y * pScrn->virtualX) * pSmi->Bpp;
+ if (SMI_LYNX3D_SERIES(pSmi->Chipset))
+ {
+ Base = (Base + 15) & ~15;
+ }
+ else
+ {
+ Base = (Base + 7) & ~7;
+ }
+
+ WRITE_VPR(pSmi, 0x0C, Base >> 3);
+
+ LEAVE_PROC("SMI_AdjustFrame");
+}
+
+Bool
+SMI_SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ Bool ret;
+
+ ENTER_PROC("SMI_SwitchMode");
+
+ ret = SMI_ModeInit(xf86Screens[scrnIndex], mode);
+
+ LEAVE_PROC("SMI_SwitchMode");
+ return(ret);
+}
+
+void
+SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors,
+ VisualPtr pVisual)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int i;
+
+ ENTER_PROC("SMI_LoadPalette");
+
+ for(i = 0; i < numColors; i++)
+ {
+ VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, indicies[i]);
+ VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].red);
+ VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].green);
+ VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].blue);
+ }
+
+ LEAVE_PROC("SMI_LoadPalette");
+}
+
+void
+SMI_EnableMmio(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 tmp;
+
+ ENTER_PROC("SMI_EnableMmio");
+
+ /*
+ * Enable chipset (seen on uninitialized secondary cards) might not be
+ * needed once we use the VGA softbooter
+ */
+ vgaHWSetStdFuncs(hwp);
+
+ /* Disable video output */
+ outb(VGA_DAC_MASK, 0x00);
+
+ /* Enable linear mode */
+ outb(VGA_SEQ_INDEX, 0x18);
+ tmp = inb(VGA_SEQ_DATA);
+ pSmi->SR18Value = tmp; /* PDR#521 */
+ outb(VGA_SEQ_DATA, tmp | 0x11);
+
+ /* Enable 2D/3D Engine and Video Processor */
+ outb(VGA_SEQ_INDEX, 0x21);
+ tmp = inb(VGA_SEQ_DATA);
+ pSmi->SR21Value = tmp; /* PDR#521 */
+ outb(VGA_SEQ_DATA, tmp & ~0x03);
+
+ LEAVE_PROC("SMI_EnableMmio");
+}
+
+void
+SMI_DisableMmio(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_DisableMmio");
+
+ vgaHWSetStdFuncs(hwp);
+
+ /* Disable 2D/3D Engine and Video Processor */
+ outb(VGA_SEQ_INDEX, 0x21);
+ outb(VGA_SEQ_DATA, pSmi->SR21Value); /* PDR#521 */
+
+ /* Disable linear mode */
+ outb(VGA_SEQ_INDEX, 0x18);
+ outb(VGA_SEQ_DATA, pSmi->SR18Value); /* PDR#521 */
+
+ LEAVE_PROC("SMI_DisableMmio");
+}
+
+/* This function is used to debug, it prints out the contents of Lynx regs */
+static void
+SMI_PrintRegs(ScrnInfoPtr pScrn)
+{
+ unsigned char i, tmp;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int vgaCRIndex = hwp->IOBase + VGA_CRTC_INDEX_OFFSET;
+ int vgaCRReg = hwp->IOBase + VGA_CRTC_DATA_OFFSET;
+ int vgaStatus = hwp->IOBase + VGA_IN_STAT_1_OFFSET;
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "START register dump ------------------\n");
+
+ xf86ErrorFVerb(VERBLEV, "MISCELLANEOUS OUTPUT\n %02X\n",
+ VGAIN8(pSmi, VGA_MISC_OUT_R));
+
+ xf86ErrorFVerb(VERBLEV, "\nSEQUENCER\n"
+ " x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF");
+ for (i = 0x00; i <= 0xAF; i++)
+ {
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ if ((i & 0x3) == 0x0) xf86ErrorFVerb(VERBLEV, " ");
+ xf86ErrorFVerb(VERBLEV, "%02X ",
+ VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, i));
+ }
+
+ xf86ErrorFVerb(VERBLEV, "\n\nCRT CONTROLLER\n"
+ " x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF");
+ for (i = 0x00; i <= 0xAD; i++)
+ {
+ if (i == 0x20) i = 0x30;
+ if (i == 0x50) i = 0x90;
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ if ((i & 0x3) == 0x0) xf86ErrorFVerb(VERBLEV, " ");
+ xf86ErrorFVerb(VERBLEV, "%02X ",
+ VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRReg, i));
+ }
+
+ xf86ErrorFVerb(VERBLEV, "\n\nGRAPHICS CONTROLLER\n"
+ " x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF");
+ for (i = 0x00; i <= 0x08; i++)
+ {
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ if ((i & 0x3) == 0x0) xf86ErrorFVerb(VERBLEV, " ");
+ xf86ErrorFVerb(VERBLEV, "%02X ",
+ VGAIN8_INDEX(pSmi, VGA_GRAPH_INDEX, VGA_GRAPH_DATA, i));
+ }
+
+ xf86ErrorFVerb(VERBLEV, "\n\nATTRIBUTE 0CONTROLLER\n"
+ " x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF");
+ for (i = 0x00; i <= 0x14; i++)
+ {
+ tmp = VGAIN8(pSmi, vgaStatus);
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ if ((i & 0x3) == 0x0) xf86ErrorFVerb(VERBLEV, " ");
+ xf86ErrorFVerb(VERBLEV, "%02X ",
+ VGAIN8_INDEX(pSmi, VGA_ATTR_INDEX, VGA_ATTR_DATA_R, i));
+ }
+ tmp = VGAIN8(pSmi, vgaStatus);
+ VGAOUT8(pSmi, VGA_ATTR_INDEX, 0x20);
+
+ xf86ErrorFVerb(VERBLEV, "\n\nDPR x0 x4 x8 xC");
+ for (i = 0x00; i <= 0x44; i += 4)
+ {
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ xf86ErrorFVerb(VERBLEV, " %08X", READ_DPR(pSmi, i));
+ }
+
+ xf86ErrorFVerb(VERBLEV, "\n\nVPR x0 x4 x8 xC");
+ for (i = 0x00; i <= 0x60; i += 4)
+ {
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ xf86ErrorFVerb(VERBLEV, " %08X", READ_VPR(pSmi, i));
+ }
+
+ xf86ErrorFVerb(VERBLEV, "\n\nCPR x0 x4 x8 xC");
+ for (i = 0x00; i <= 0x18; i += 4)
+ {
+ if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
+ xf86ErrorFVerb(VERBLEV, " %08X", READ_CPR(pSmi, i));
+ }
+
+ xf86ErrorFVerb(VERBLEV, "\n\n");
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
+ "END register dump --------------------\n");
+}
+
+/*
+ * SMI_DisplayPowerManagementSet -- Sets VESA Display Power Management
+ * Signaling (DPMS) Mode.
+ */
+#ifdef DPMSExtension
+static void
+SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
+ int flags)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 SR01, SR20, SR21, SR22, SR23, SR24, SR31, SR34;
+
+ ENTER_PROC("SMI_DisplayPowerManagementSet");
+
+ /* If we already are in the requested DPMS mode, just return */
+ if (pSmi->CurrentDPMS == PowerManagementMode)
+ {
+ LEAVE_PROC("SMI_DisplayPowerManagementSet");
+ return;
+ }
+
+ #if 1 /* PDR#735 */
+ if (pSmi->pInt != NULL)
+ {
+ pSmi->pInt->ax = 0x4F10;
+ switch (PowerManagementMode)
+ {
+ case DPMSModeOn:
+ pSmi->pInt->bx = 0x0001;
+ break;
+
+ case DPMSModeStandby:
+ pSmi->pInt->bx = 0x0101;
+ break;
+
+ case DPMSModeSuspend:
+ pSmi->pInt->bx = 0x0201;
+ break;
+
+ case DPMSModeOff:
+ pSmi->pInt->bx = 0x0401;
+ break;
+ }
+ pSmi->pInt->cx = 0x0000;
+ pSmi->pInt->num = 0x10;
+ xf86ExecX86int10(pSmi->pInt);
+ if (pSmi->pInt->ax == 0x004F)
+ {
+ pSmi->CurrentDPMS = PowerManagementMode;
+ #if 1 /* PDR#835 */
+ if (PowerManagementMode == DPMSModeOn)
+ {
+ SR01 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01,
+ SR01 & ~0x20);
+ }
+ #endif
+ LEAVE_PROC("SMI_DisplayPowerManagementSet");
+ return;
+ }
+ }
+ #endif
+
+ /* Save the current SR registers */
+ if (pSmi->CurrentDPMS == DPMSModeOn)
+ {
+ pSmi->DPMS_SR20 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x20);
+ pSmi->DPMS_SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
+ pSmi->DPMS_SR31 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31);
+ pSmi->DPMS_SR34 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x34);
+ }
+
+ /* Read the required SR registers for the DPMS handler */
+ SR01 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01);
+ SR20 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x20);
+ SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
+ SR22 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x22);
+ SR23 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x23);
+ SR24 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x24);
+ SR31 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31);
+ SR34 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x34);
+
+ switch (PowerManagementMode)
+ {
+ case DPMSModeOn:
+ /* Screen On: HSync: On, VSync : On */
+ SR01 &= ~0x20;
+ SR20 = pSmi->DPMS_SR20;
+ SR21 = pSmi->DPMS_SR21;
+ SR22 &= ~0x30;
+ SR23 &= ~0xC0;
+ SR24 |= 0x01;
+ SR31 = pSmi->DPMS_SR31;
+ SR34 = pSmi->DPMS_SR34;
+ break;
+
+ case DPMSModeStandby:
+ /* Screen: Off; HSync: Off, VSync: On */
+ SR01 |= 0x20;
+ SR20 = (SR20 & ~0xB0) | 0x10;
+ SR21 |= 0x88;
+ SR22 = (SR22 & ~0x30) | 0x10;
+ SR23 = (SR23 & ~0x07) | 0xD8;
+ SR24 &= ~0x01;
+ SR31 = (SR31 & ~0x07) | 0x00;
+ SR34 |= 0x80;
+ break;
+
+ case DPMSModeSuspend:
+ /* Screen: Off; HSync: On, VSync: Off */
+ SR01 |= 0x20;
+ SR20 = (SR20 & ~0xB0) | 0x10;
+ SR21 |= 0x88;
+ SR22 = (SR22 & ~0x30) | 0x20;
+ SR23 = (SR23 & ~0x07) | 0xD8;
+ SR24 &= ~0x01;
+ SR31 = (SR31 & ~0x07) | 0x00;
+ SR34 |= 0x80;
+ break;
+
+ case DPMSModeOff:
+ /* Screen: Off; HSync: Off, VSync: Off */
+ SR01 |= 0x20;
+ SR20 = (SR20 & ~0xB0) | 0x10;
+ SR21 |= 0x88;
+ SR22 = (SR22 & ~0x30) | 0x30;
+ SR23 = (SR23 & ~0x07) | 0xD8;
+ SR24 &= ~0x01;
+ SR31 = (SR31 & ~0x07) | 0x00;
+ SR34 |= 0x80;
+ break;
+
+ default:
+ xf86ErrorFVerb(VERBLEV, "Invalid PowerManagementMode %d passed to "
+ "SMI_DisplayPowerManagementSet\n", PowerManagementMode);
+ LEAVE_PROC("SMI_DisplayPowerManagementSet");
+ return;
+ }
+
+ /* Wait for vertical retrace */
+ while (hwp->readST01(hwp) & 0x8) ;
+ while (!(hwp->readST01(hwp) & 0x8)) ;
+
+ /* Write the registers */
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x01, SR01);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x34, SR34);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31, SR31);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x20, SR20);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x22, SR22);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x23, SR23);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, SR21);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x24, SR24);
+
+ /* Save the current power state */
+ pSmi->CurrentDPMS = PowerManagementMode;
+
+ LEAVE_PROC("SMI_DisplayPowerManagementSet");
+}
+#endif
+
+static void
+SMI_ProbeDDC(ScrnInfoPtr pScrn, int index)
+{
+ vbeInfoPtr pVbe;
+ if (xf86LoadSubModule(pScrn, "vbe"))
+ {
+ pVbe = VBEInit(NULL, index);
+ ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
+ }
+}
+
+static unsigned int
+SMI_ddc1Read(ScrnInfoPtr pScrn)
+{
+ register vgaHWPtr hwp = VGAHWPTR(pScrn);
+ SMIPtr pSmi = SMIPTR(pScrn);
+ unsigned int ret;
+
+ ENTER_PROC("SMI_ddc1Read");
+
+ while (hwp->readST01(hwp) & 0x8) ;
+ while (!(hwp->readST01(hwp) & 0x8)) ;
+
+ ret = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72) & 0x08;
+
+ LEAVE_PROC("SMI_ddc1Read");
+ return(ret);
+}
+
+static Bool
+SMI_ddc1(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ Bool success = FALSE;
+ xf86MonPtr pMon;
+ unsigned char tmp;
+
+ ENTER_PROC("SMI_ddc1");
+
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72, tmp | 0x20);
+
+ pMon = xf86PrintEDID(xf86DoEDID_DDC1(scrnIndex, vgaHWddc1SetSpeed,
+ SMI_ddc1Read));
+ if (pMon != NULL)
+ {
+ success = TRUE;
+ }
+ xf86SetDDCproperties(pScrn, pMon);
+
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72, tmp);
+
+ LEAVE_PROC("SMI_ddc1");
+ return(success);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c
new file mode 100644
index 000000000..323f78c57
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c
@@ -0,0 +1,375 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_hwcurs.c-arc 1.12 27 Nov 2000 15:47:48 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+
+#include <cursorstr.h>
+#include "smi.h"
+
+#define MAX_CURSOR 32
+
+static unsigned char *
+SMI_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+ SMIPtr pSmi = SMIPTR(infoPtr->pScrn);
+ CursorBitsPtr bits = pCurs->bits;
+ unsigned char * ram;
+ unsigned char * psource = bits->source;
+ unsigned char * pmask = bits->mask;
+ int x, y, srcwidth, i;
+
+ ENTER_PROC("SMI_RealizeCursor");
+
+ /* Allocate memory */
+ ram = (unsigned char *) xcalloc(1, 1024);
+ if (ram == NULL)
+ {
+ LEAVE_PROC("SMI_RealizeCursor");
+ return(NULL);
+ }
+
+ /* Calculate cursor information */
+ srcwidth = ((bits->width + 31) / 8) & ~3;
+ i = 0;
+
+ switch (pSmi->rotate)
+ {
+ default:
+ /* Copy cursor image */
+ for (y = 0; y < min(MAX_CURSOR, bits->height); y++)
+ {
+ for (x = 0; x < min(MAX_CURSOR / 8, srcwidth); x++)
+ {
+ unsigned char mask = byte_reversed[*pmask++];
+ unsigned char source = byte_reversed[*psource++] & mask;
+
+ ram[i++] = ~mask;
+ ram[i++] = source;
+ if (i & 4) i += 4;
+ }
+
+ pmask += srcwidth - x;
+ psource += srcwidth - x;
+
+ /* Fill remaining part of line with no shape */
+ for (; x < MAX_CURSOR / 8; x++)
+ {
+ ram[i++] = 0xFF;
+ ram[i++] = 0x00;
+ if (i & 4) i += 4;
+ }
+ }
+
+ /* Fill remaining part of memory with no shape */
+ for (; y < MAX_CURSOR; y++)
+ {
+ for (x = 0; x < MAX_CURSOR / 8; x++)
+ {
+ ram[i++] = 0xFF;
+ ram[i++] = 0x00;
+ if (i & 4) i += 4;
+ }
+ }
+ break;
+
+ case SMI_ROTATE_CW:
+ /* Initialize cursor memory */
+ for (i = 0; i < 1024;)
+ {
+ ram[i++] = 0xFF;
+ ram[i++] = 0x00;
+ if (i & 4) i += 4;
+ }
+
+ /* Rotate cursor image */
+ for (y = 0; y < min(MAX_CURSOR, bits->height); y++)
+ {
+ unsigned char bitmask = 0x01 << (y & 7);
+ int index = ((MAX_CURSOR - y - 1) / 8) * 2;
+ if (index & 4) index += 4;
+
+ for (x = 0; x < min(MAX_CURSOR / 8, srcwidth); x++)
+ {
+ unsigned char mask = *pmask++;
+ unsigned char source = *psource++ & mask;
+
+ i = index + (x * 8) * 16;
+ if (mask || (source & mask))
+ {
+ unsigned char bit;
+ for (bit = 0x01; bit; bit <<= 1)
+ {
+ if (mask & bit)
+ {
+ ram[i + 0] &= ~bitmask;
+ }
+
+ if (source & bit)
+ {
+ ram[i + 1] |= bitmask;
+ }
+
+ i += 16;
+ }
+ }
+ }
+
+ pmask += srcwidth - x;
+ psource += srcwidth - x;
+ }
+ break;
+
+ case SMI_ROTATE_CCW:
+ /* Initialize cursor memory */
+ for (i = 0; i < 1024;)
+ {
+ ram[i++] = 0xFF;
+ ram[i++] = 0x00;
+ if (i & 4) i += 4;
+ }
+
+ /* Rotate cursor image */
+ for (y = 0; y < min(MAX_CURSOR, bits->height); y++)
+ {
+ unsigned char bitmask = 0x80 >> (y & 7);
+ int index = (y >> 3) * 2;
+ if (index & 4) index += 4;
+
+ for (x = 0; x < min(MAX_CURSOR / 8, srcwidth); x++)
+ {
+ unsigned char mask = *pmask++;
+ unsigned char source = *psource++ & mask;
+
+ i = index + (MAX_CURSOR - x * 8 - 1) * 16;
+ if (mask || (source & mask))
+ {
+ unsigned char bit;
+ for (bit = 0x01; bit; bit <<= 1)
+ {
+ if (mask & bit)
+ {
+ ram[i + 0] &= ~bitmask;
+ }
+
+ if (source & bit)
+ {
+ ram[i + 1] |= bitmask;
+ }
+
+ i -= 16;
+ }
+ }
+ }
+
+ pmask += srcwidth - x;
+ psource += srcwidth - x;
+ }
+ break;
+ }
+
+ LEAVE_PROC("SMI_RealizeCursor");
+ return(ram);
+}
+
+static void
+SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 tmp;
+
+ ENTER_PROC("SMI_LoadCursorImage");
+
+ /* Load storage location. */
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x80,
+ pSmi->FBCursorOffset / 2048);
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81) & 0x80;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81,
+ tmp | ((pSmi->FBCursorOffset / 2048) >> 8));
+
+ /* Copy cursor image to framebuffer storage */
+ memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024);
+
+ LEAVE_PROC("SMI_LoadCursorImage");
+}
+
+static void
+SMI_ShowCursor(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ char tmp;
+
+ ENTER_PROC("SMI_ShowCursor");
+
+ /* Show cursor */
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | 0x80);
+
+ LEAVE_PROC("SMI_ShowCursor");
+}
+
+static void
+SMI_HideCursor(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ char tmp;
+
+ ENTER_PROC("SMI_HideCursor");
+
+ /* Hide cursor */
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp & ~0x80);
+
+ LEAVE_PROC("SMI_HideCursor");
+}
+
+static void
+SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int xoff, yoff;
+
+ ENTER_PROC("SMI_SetCursorPosition");
+
+ /* Calculate coordinates for rotation */
+ switch (pSmi->rotate)
+ {
+ default:
+ xoff = x;
+ yoff = y;
+ break;
+
+ case SMI_ROTATE_CW:
+ xoff = pSmi->ShadowHeight - y - MAX_CURSOR;
+ yoff = x;
+ break;
+
+ case SMI_ROTATE_CCW:
+ xoff = y;
+ yoff = pSmi->ShadowWidth - x - MAX_CURSOR;
+ break;
+ }
+
+ /* Program coordinates */
+ if (xoff >= 0)
+ {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x88, xoff & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x89,
+ (xoff >> 8) & 0x07);
+ }
+ else
+ {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x88,
+ (-xoff) & (MAX_CURSOR - 1));
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x89, 0x08);
+ }
+
+ if (yoff >= 0)
+ {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8A, yoff & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B,
+ (yoff >> 8) & 0x07);
+ }
+ else
+ {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8A,
+ (-yoff) & (MAX_CURSOR - 1));
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B, 0x08);
+ }
+
+ LEAVE_PROC("SMI_SetCursorPosition");
+}
+
+static void
+SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ unsigned char packedFG, packedBG;
+
+ ENTER_PROC("SMI_SetCursorColors");
+
+ /* Pack the true color into 8 bit */
+ packedFG = (fg & 0xE00000) >> 16
+ | (fg & 0x00E000) >> 11
+ | (fg & 0x0000C0) >> 6
+ ;
+ packedBG = (bg & 0xE00000) >> 16
+ | (bg & 0x00E000) >> 11
+ | (bg & 0x0000C0) >> 6
+ ;
+
+ /* Program the colors */
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8C, packedFG);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8D, packedBG);
+
+ LEAVE_PROC("SMI_SetCursorColors");
+}
+
+Bool
+SMI_HWCursorInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ xf86CursorInfoPtr infoPtr;
+ Bool ret;
+
+ ENTER_PROC("SMI_HWCursorInit");
+
+ /* Create cursor infor record */
+ infoPtr = xf86CreateCursorInfoRec();
+ if (infoPtr == NULL)
+ {
+ LEAVE_PROC("SMI_HWCursorInit");
+ return(FALSE);
+ }
+
+ pSmi->CursorInfoRec = infoPtr;
+
+ /* Fill in the information */
+ infoPtr->MaxWidth = MAX_CURSOR;
+ infoPtr->MaxHeight = MAX_CURSOR;
+ infoPtr->Flags = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8
+ | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK
+ | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
+ | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+ | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
+ | HARDWARE_CURSOR_INVERT_MASK;
+
+ infoPtr->SetCursorColors = SMI_SetCursorColors;
+ infoPtr->SetCursorPosition = SMI_SetCursorPosition;
+ infoPtr->LoadCursorImage = SMI_LoadCursorImage;
+ infoPtr->HideCursor = SMI_HideCursor;
+ infoPtr->ShowCursor = SMI_ShowCursor;
+ infoPtr->RealizeCursor = SMI_RealizeCursor;
+ infoPtr->UseHWCursor = NULL;
+
+ /* Proceed with cursor initialization */
+ ret = xf86InitCursor(pScreen, infoPtr);
+
+ LEAVE_PROC("SMI_HWCursorInit");
+ return(ret);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c
new file mode 100644
index 000000000..d3874cdb6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c
@@ -0,0 +1,104 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_i2c.c-arc 1.10 27 Nov 2000 15:47:58 Frido $ */
+
+/*
+Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "compiler.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+#include "vgaHW.h"
+
+#include "smi.h"
+
+static void
+SMI_I2CPutBits(I2CBusPtr b, int clock, int data)
+{
+ SMIPtr pSmi = SMIPTR(xf86Screens[b->scrnIndex]);
+ unsigned int reg = 0x30;
+
+ ENTER_PROC("SMI_I2CPutBits");
+
+ if (clock) reg |= 0x01;
+ if (data) reg |= 0x02;
+
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72, reg);
+
+ LEAVE_PROC("SMI_I2CPutBits");
+}
+
+static void
+SMI_I2CGetBits(I2CBusPtr b, int *clock, int *data)
+{
+ SMIPtr pSmi = SMIPTR(xf86Screens[b->scrnIndex]);
+ unsigned int reg = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x72);
+
+ ENTER_PROC("SMI_I2CGetBits");
+
+ *clock = reg & 0x04;
+ *data = reg & 0x08;
+
+ LEAVE_PROC("SMI_I2CGetBits");
+}
+
+Bool
+SMI_I2CInit(ScrnInfoPtr pScrn)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_I2CInit");
+
+ if (pSmi->I2C == NULL)
+ {
+ I2CBusPtr I2CPtr = xf86CreateI2CBusRec();
+ if (I2CPtr == NULL)
+ {
+ LEAVE_PROC("SMI_I2CInit");
+ return(FALSE);
+ }
+
+ I2CPtr->BusName = "I2C bus";
+ I2CPtr->scrnIndex = pScrn->scrnIndex;
+ I2CPtr->I2CPutBits = SMI_I2CPutBits;
+ I2CPtr->I2CGetBits = SMI_I2CGetBits;
+
+ if (!xf86I2CBusInit(I2CPtr))
+ {
+ xf86DestroyI2CBusRec(I2CPtr, TRUE, TRUE);
+ LEAVE_PROC("SMI_I2CInit");
+ return(FALSE);
+ }
+
+ pSmi->I2C = I2CPtr;
+ }
+
+ LEAVE_PROC("SMI_I2CInit");
+ return(TRUE);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c
new file mode 100644
index 000000000..e249fb1a8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c
@@ -0,0 +1,205 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_shadow.c-arc 1.8 27 Nov 2000 15:46:16 Frido $ */
+
+/*
+Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and Silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Resources.h"
+#include "xf86_ansic.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "shadowfb.h"
+#include "servermd.h"
+
+#include "smi.h"
+
+/******************************************************************************\
+|* SMI_RefreshArea
+|*=============================================================================
+|*
+|* PARAMETERS: pScrn Pointer to ScrnInfo structure.
+|* num Number of boxes to refresh.
+|* pbox Pointer to an array of boxes to refresh.
+|*
+|* DESCRIPTION: Refresh a portion of the shadow buffer to the visual screen
+|* buffer. This is mainly used for rotation purposes.
+|*
+|* RETURNS: Nothing.
+|*
+\******************************************************************************/
+void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int width, height, srcX, srcY, destX, destY;
+
+ if (pSmi->rotate)
+ {
+ /* IF we need to do rotation, setup the hardware here. */
+ WaitIdleEmpty();
+ WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch);
+ WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch);
+ WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3);
+ }
+
+ while (num--)
+ {
+ /* Get coordinates of the box to refresh. */
+ srcX = pbox->x1;
+ srcY = pbox->y1;
+ width = pbox->x2 - srcX;
+ height = pbox->y2 - srcY;
+
+ if ((width > 0) && (height > 0))
+ {
+ switch (pSmi->rotate)
+ {
+ case SMI_ROTATE_CW:
+ /* 90 degrees CW rotation. Calculate destination
+ coordinates:
+
+ *---+
+ | | +-----*
+ | | | | destX = shadowHeight - srcY - 1
+ | | --> | | destY = srcX
+ | | | |
+ | | +-----+
+ +---+
+ */
+ destX = pSmi->ShadowHeight - srcY - 1;
+ destY = srcX;
+
+ WaitQueue(4);
+ WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY);
+ WRITE_DPR(pSmi, 0x04, (destX << 16) + destY);
+ WRITE_DPR(pSmi, 0x08, (width << 16) + height);
+ WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT |
+ SMI_ROTATE_CW | SMI_START_ENGINE);
+ break;
+
+ case SMI_ROTATE_CCW:
+ /* 90 degrees CCW rotatation. Calculate destination
+ coordinates:
+
+ *---+
+ | | +-----+
+ | | | | destX = srcY
+ | | --> | | destY = shadowWidth - srcX - 1
+ | | | |
+ | | *-----+
+ +---+
+ */
+ destX = srcY;
+ destY = pSmi->ShadowWidth - srcX - 1;
+
+ WaitQueue(4);
+ WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY);
+ WRITE_DPR(pSmi, 0x04, (destX << 16) + destY);
+ WRITE_DPR(pSmi, 0x08, (width << 16) + height);
+ WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT |
+ SMI_ROTATE_CCW | SMI_START_ENGINE);
+ break;
+
+ default:
+ /* No rotation, perform a normal copy. */
+ if (pScrn->bitsPerPixel == 24)
+ {
+ srcX *= 3;
+ width *= 3;
+
+ if (pSmi->Chipset == SMI_LYNX)
+ {
+ srcY *= 3;
+ }
+ }
+
+ WaitQueue(4);
+ WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY);
+ WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY);
+ WRITE_DPR(pSmi, 0x08, (width << 16) + height);
+ WRITE_DPR(pSmi, 0x0C, SMI_BITBLT + SMI_START_ENGINE + 0xCC);
+ break;
+ }
+ }
+
+ pbox++;
+ }
+
+ if (pSmi->rotate)
+ {
+ /* If we did a rotation, we need to restore the hardware state here. */
+ WaitIdleEmpty();
+ WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
+ WRITE_DPR(pSmi, 0x44, 0);
+ }
+}
+
+/******************************************************************************\
+|* SMI_PointerMoved
+|*=============================================================================
+|*
+|* PARAMETERS: index Index of current screen.
+|* x X location of pointer.
+|* y Y location of pointer.
+|*
+|* DESCRIPTION: Adjust the pointer location if we are in rotation mode.
+|*
+|* RETURNS: Nothing.
+|*
+\******************************************************************************/
+void SMI_PointerMoved(int index, int x, int y)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int newX, newY;
+
+ switch (pSmi->rotate)
+ {
+ case SMI_ROTATE_CW:
+ /* 90 degrees CW rotation. */
+ newX = pScrn->pScreen->height - y - 1;
+ newY = x;
+ break;
+
+ case SMI_ROTATE_CCW:
+ /* 90 degrees CCW rotation. */
+ newX = y;
+ newY = pScrn->pScreen->width - x - 1;
+ break;
+
+ default:
+ /* No rotation. */
+ newX = x;
+ newY = y;
+ break;
+ }
+
+ /* Pass adjusted pointer coordinates original PointerMoved function. */
+ (*pSmi->PointerMoved)(index, newX, newY);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
new file mode 100644
index 000000000..5506b1015
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
@@ -0,0 +1,1822 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_video.c.-arc 1.12 08 Nov 2000 18:38:34 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+
+#include "smi.h"
+#include "smi_video.h"
+
+#define nElems(x) (sizeof(x) / sizeof(x[0]))
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+#if defined(XvExtension) && SMI_USE_VIDEO
+
+#include <dixstruct.h>
+#include <xaa.h>
+#include <xaalocal.h>
+
+static XF86VideoAdaptorPtr SMI_SetupVideo(ScreenPtr pScreen);
+static void SMI_ResetVideo(ScrnInfoPtr pScrn);
+
+#if SMI_USE_CAPTURE
+static int SMI_GetVideo(ScrnInfoPtr pScrn,
+ 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);
+#endif
+static void SMI_StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit);
+static int SMI_SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 value, pointer data);
+static int SMI_GetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 *value, pointer data);
+static void SMI_QueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, pointer data);
+static int SMI_PutImage(ScrnInfoPtr pScrn,
+ short src_x, short src_y, short drw_x, short drw_y,
+ short src_w, short src_h, short drw_w, short drw_h,
+ int id, unsigned char *buf, short width, short height, Bool sync,
+ RegionPtr clipBoxes, pointer data);
+static int SMI_QueryImageAttributes(ScrnInfoPtr pScrn,
+ int id, unsigned short *width, unsigned short *height,
+ int *picthes, int *offsets);
+
+static Bool RegionsEqual(RegionPtr A, RegionPtr B);
+static Bool SMI_ClipVideo(ScrnInfoPtr pScrn, BoxPtr dst,
+ INT32 *x1, INT32 *y1, INT32 *x2, INT32 *y2,
+ RegionPtr reg, INT32 width, INT32 height);
+static void SMI_DisplayVideo(ScrnInfoPtr pScrn, int id, int offset,
+ short width, short height, int pitch, int x1, int y1, int x2, int y2,
+ BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h);
+static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout,
+ pointer pReadMask);
+static void SMI_WaitForSync(ScrnInfoPtr pScrn);
+static int SMI_SendI2C(ScrnInfoPtr pScrn, CARD8 device, char *devName,
+ SMI_I2CDataPtr i2cData);
+
+static void SMI_InitOffscreenImages(ScreenPtr pScreen);
+static FBAreaPtr SMI_AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area,
+ int numLines);
+static void SMI_CopyData(unsigned char *src, unsigned char *dst, int srcPitch,
+ int dstPitch, int height, int width);
+static void SMI_CopyYV12Data(unsigned char *src1, unsigned char *src2,
+ unsigned char *src3, unsigned char *dst, int srcPitch1, int srcPitch2,
+ int dstPitch, int height, int width);
+
+static int SMI_AllocSurface(ScrnInfoPtr pScrn,
+ int id, unsigned short width, unsigned short height,
+ XF86SurfacePtr surface);
+static int SMI_FreeSurface(XF86SurfacePtr surface);
+static int SMI_DisplaySurface(XF86SurfacePtr 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);
+static int SMI_StopSurface(XF86SurfacePtr surface);
+static int SMI_GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 *value);
+static int SMI_SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 value);
+
+static Atom xvColorKey, xvBrightness;
+
+/******************************************************************************\
+** **
+** X V E X T E N S I O N I N T E R F A C E **
+** **
+\******************************************************************************/
+
+void SMI_InitVideo(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr psmi = SMIPTR(pScrn);
+ XF86VideoAdaptorPtr *ptrAdaptors, *newAdaptors = NULL;
+ XF86VideoAdaptorPtr newAdaptor = NULL;
+ int numAdaptors;
+
+ ENTER_PROC("SMI_InitVideo");
+
+ numAdaptors = xf86XVListGenericAdaptors(pScrn, &ptrAdaptors);
+
+ if ( (psmi->rotate == 0)
+ && !psmi->NoAccel
+ && (pScrn->bitsPerPixel != 8)
+ )
+ {
+ newAdaptor = SMI_SetupVideo(pScreen);
+ SMI_InitOffscreenImages(pScreen);
+ }
+
+ if (newAdaptor != NULL)
+ {
+ if (numAdaptors == 0)
+ {
+ numAdaptors = 1;
+ ptrAdaptors = &newAdaptor;
+ }
+ else
+ {
+ newAdaptors = xalloc((numAdaptors + 1) *
+ sizeof(XF86VideoAdaptorPtr*));
+ if (newAdaptors != NULL)
+ {
+ memcpy(newAdaptors, ptrAdaptors,
+ numAdaptors * sizeof(XF86VideoAdaptorPtr));
+ newAdaptors[numAdaptors++] = newAdaptor;
+ ptrAdaptors = newAdaptors;
+ }
+ }
+ }
+
+ if (numAdaptors != 0)
+ {
+ xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors);
+ }
+
+ if (newAdaptors != NULL)
+ {
+ xfree(newAdaptors);
+ }
+
+ LEAVE_PROC("SMI_InitVideo");
+}
+
+/******************************************************************************\
+** **
+** C A P A B I L I T I E S **
+** **
+\******************************************************************************/
+
+static XF86VideoEncodingRec SMI_VideoEncodings[] =
+{
+#if SMI_USE_CAPTURE
+ {
+ SMI_VIDEO_VIDEO, /* id */
+ "XV_VIDEO", /* name */
+ 1024, 1024, /* width, height */
+ {1, 1} /* rate */
+ },
+#endif
+ {
+ SMI_VIDEO_IMAGE, /* id */
+ "XV_IMAGE", /* name */
+ 1024, 1024, /* width, height */
+ {1, 1} /* rate */
+ },
+};
+
+static XF86VideoFormatRec SMI_VideoFormats[] =
+{
+ { 8, PseudoColor }, /* depth, class */
+ { 15, TrueColor }, /* depth, class */
+ { 16, TrueColor }, /* depth, class */
+ { 24, TrueColor }, /* depth, class */
+};
+
+static XF86AttributeRec SMI_VideoAttributes[] =
+{
+ {
+ XvSettable | XvGettable, /* flags */
+ 0x000000, 0xFFFFFF, /* min_value, max_value */
+ "XV_COLORKEY" /* name */
+ },
+ {
+ XvSettable | XvGettable, /* flags */
+ -128, 127, /* min_value, max_value */
+ "XV_BRIGHTNESS" /* name */
+ },
+};
+
+static XF86ImageRec SMI_VideoImages[] =
+{
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ {
+ FOURCC_RV15, /* id */
+ XvRGB, /* type */
+ LSBFirst, /* byte_order */
+ { 'R', 'V' ,'1', '5',
+ 0x00, '5', 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 }, /* guid */
+ 16, /* bits_per_pixel */
+ XvPacked, /* format */
+ 1, /* num_planes */
+ 15, /* depth */
+ 0x001F, 0x03E0, 0x7C00, /* red_mask, green, blue */
+ 0, 0, 0, /* y_sample_bits, u, v */
+ 0, 0, 0, /* horz_y_period, u, v */
+ 0, 0, 0, /* vert_y_period, u, v */
+ { 'R', 'V', 'B' }, /* component_order */
+ XvTopToBottom /* scaline_order */
+ },
+ {
+ FOURCC_RV16, /* id */
+ XvRGB, /* type */
+ LSBFirst, /* byte_order */
+ { 'R', 'V' ,'1', '6',
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 }, /* guid */
+ 16, /* bits_per_pixel */
+ XvPacked, /* format */
+ 1, /* num_planes */
+ 16, /* depth */
+ 0x001F, 0x07E0, 0xF800, /* red_mask, green, blue */
+ 0, 0, 0, /* y_sample_bits, u, v */
+ 0, 0, 0, /* horz_y_period, u, v */
+ 0, 0, 0, /* vert_y_period, u, v */
+ { 'R', 'V', 'B' }, /* component_order */
+ XvTopToBottom /* scaline_order */
+ },
+ {
+ FOURCC_RV24, /* id */
+ XvRGB, /* type */
+ LSBFirst, /* byte_order */
+ { 'R', 'V' ,'2', '4',
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 }, /* guid */
+ 24, /* bits_per_pixel */
+ XvPacked, /* format */
+ 1, /* num_planes */
+ 24, /* depth */
+ 0x0000FF, 0x00FF00, 0xFF0000, /* red_mask, green, blue */
+ 0, 0, 0, /* y_sample_bits, u, v */
+ 0, 0, 0, /* horz_y_period, u, v */
+ 0, 0, 0, /* vert_y_period, u, v */
+ { 'R', 'V', 'B' }, /* component_order */
+ XvTopToBottom /* scaline_order */
+ },
+ {
+ FOURCC_RV32, /* id */
+ XvRGB, /* type */
+ LSBFirst, /* byte_order */
+ { 'R', 'V' ,'3', '2',
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 }, /* guid */
+ 32, /* bits_per_pixel */
+ XvPacked, /* format */
+ 1, /* num_planes */
+ 24, /* depth */
+ 0x0000FF, 0x00FF00, 0xFF0000, /* red_mask, green, blue */
+ 0, 0, 0, /* y_sample_bits, u, v */
+ 0, 0, 0, /* horz_y_period, u, v */
+ 0, 0, 0, /* vert_y_period, u, v */
+ { 'R', 'V', 'B' }, /* component_order */
+ XvTopToBottom /* scaline_order */
+ },
+};
+
+SMI_I2CDataRec data_SAA7110[] =
+{
+ /* Configuration */
+ { 0x00, 0x4C }, { 0x01, 0x3C }, { 0x02, 0x00 }, { 0x03, 0xEF },
+ { 0x04, 0xBD }, { 0x05, 0xE2 }, { 0x06, 0x00 }, { 0x07, 0x00 },
+ { 0x08, 0xF8 }, { 0x09, 0xF8 }, { 0x0A, 0x60 }, { 0x0B, 0x60 },
+ { 0x0C, 0x00 }, { 0x0D, 0x80 }, { 0x0E, 0x18 }, { 0x0F, 0xD9 },
+ { 0x10, 0x00 }, { 0x11, 0x2B }, { 0x12, 0x40 }, { 0x13, 0x40 },
+ { 0x14, 0x42 }, { 0x15, 0x1A }, { 0x16, 0xFF }, { 0x17, 0xDA },
+ { 0x18, 0xE6 }, { 0x19, 0x90 }, { 0x20, 0xD9 }, { 0x21, 0x16 },
+ { 0x22, 0x40 }, { 0x23, 0x40 }, { 0x24, 0x80 }, { 0x25, 0x40 },
+ { 0x26, 0x80 }, { 0x27, 0x4F }, { 0x28, 0xFE }, { 0x29, 0x01 },
+ { 0x2A, 0xCF }, { 0x2B, 0x0F }, { 0x2C, 0x03 }, { 0x2D, 0x01 },
+ { 0x2E, 0x83 }, { 0x2F, 0x03 }, { 0x30, 0x40 }, { 0x31, 0x35 },
+ { 0x32, 0x02 }, { 0x33, 0x8C }, { 0x34, 0x03 },
+
+ /* NTSC */
+ { 0x11, 0x2B }, { 0x0F, 0xD9 },
+
+ /* RCA input connector */
+ { 0x06, 0x00 }, { 0x0E, 0x18 }, { 0x20, 0xD9 }, { 0x21, 0x16 },
+ { 0x22, 0x40 }, { 0x2C, 0x03 },
+
+ { 0xFF, 0xFF }
+};
+
+/******************************************************************************\
+** **
+** V I D E O M A N A G E M E N T **
+** **
+\******************************************************************************/
+
+static XF86VideoAdaptorPtr
+SMI_SetupVideo(
+ ScreenPtr pScreen
+)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ SMI_PortPtr smiPortPtr;
+ XF86VideoAdaptorPtr ptrAdaptor;
+ int i;
+
+ ENTER_PROC("SMI_SetupVideo");
+
+ ptrAdaptor = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(DevUnion) + sizeof(SMI_PortRec));
+ if (ptrAdaptor == NULL)
+ {
+ LEAVE_PROC("SMI_SetupVideo");
+ return(NULL);
+ }
+
+ ptrAdaptor->type = XvInputMask
+#if SMI_USE_CAPTURE
+ | XvOutputMask
+ | XvVideoMask
+#endif
+ | XvImageMask
+ | XvWindowMask
+ ;
+
+ ptrAdaptor->flags = VIDEO_OVERLAID_IMAGES
+ | VIDEO_CLIP_TO_VIEWPORT
+ ;
+
+ ptrAdaptor->name = "Silicon Motion Lynx Series Video Engine";
+
+ ptrAdaptor->nEncodings = nElems(SMI_VideoEncodings);
+ ptrAdaptor->pEncodings = SMI_VideoEncodings;
+ for (i = 0; i < nElems(SMI_VideoEncodings); i++)
+ {
+ SMI_VideoEncodings[i].width = pSmi->lcdWidth;
+ SMI_VideoEncodings[i].height = pSmi->lcdHeight;
+ }
+
+ ptrAdaptor->nFormats = nElems(SMI_VideoFormats);
+ ptrAdaptor->pFormats = SMI_VideoFormats;
+
+ ptrAdaptor->nPorts = 1;
+ ptrAdaptor->pPortPrivates = (DevUnion*) &ptrAdaptor[1];
+ ptrAdaptor->pPortPrivates[0].ptr = (pointer) &ptrAdaptor->pPortPrivates[1];
+
+ ptrAdaptor->nAttributes = nElems(SMI_VideoAttributes);
+ ptrAdaptor->pAttributes = SMI_VideoAttributes;
+
+ ptrAdaptor->nImages = nElems(SMI_VideoImages);
+ ptrAdaptor->pImages = SMI_VideoImages;
+
+#if SMI_USE_CAPTURE
+ ptrAdaptor->PutVideo = NULL;
+ ptrAdaptor->PutStill = NULL;
+ ptrAdaptor->GetVideo = SMI_GetVideo;
+ ptrAdaptor->GetStill = NULL;
+#else
+ ptrAdaptor->PutVideo = NULL;
+ ptrAdaptor->PutStill = NULL;
+ ptrAdaptor->GetVideo = NULL;
+ ptrAdaptor->GetStill = NULL;
+#endif
+ ptrAdaptor->StopVideo = SMI_StopVideo;
+ ptrAdaptor->SetPortAttribute = SMI_SetPortAttribute;
+ ptrAdaptor->GetPortAttribute = SMI_GetPortAttribute;
+ ptrAdaptor->QueryBestSize = SMI_QueryBestSize;
+ ptrAdaptor->PutImage = SMI_PutImage;
+ ptrAdaptor->QueryImageAttributes = SMI_QueryImageAttributes;
+
+ smiPortPtr = (SMI_PortPtr) ptrAdaptor->pPortPrivates[0].ptr;
+ smiPortPtr->colorKey = pSmi->videoKey;
+ smiPortPtr->videoStatus = 0;
+ smiPortPtr->brightness = 0;
+ REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0);
+
+ pSmi->ptrAdaptor = ptrAdaptor;
+ pSmi->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = SMI_BlockHandler;
+
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+
+ SMI_ResetVideo(pScrn);
+
+ LEAVE_PROC("SMI_SetupVideo");
+ return(ptrAdaptor);
+}
+
+static void
+SMI_ResetVideo(
+ ScrnInfoPtr pScrn
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ SMI_PortPtr ptrPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr;
+ int r, g, b;
+
+ ENTER_PROC("SMI_ResetVideo");
+
+ switch (pScrn->depth)
+ {
+ case 8:
+ WRITE_VPR(pSmi, 0x04, ptrPort->colorKey & 0x00FF);
+ WRITE_VPR(pSmi, 0x08, 0);
+ break;
+
+ case 15:
+ case 16:
+ WRITE_VPR(pSmi, 0x04, ptrPort->colorKey & 0xFFFF);
+ WRITE_VPR(pSmi, 0x08, 0);
+ break;
+
+ default:
+ r = (ptrPort->colorKey & pScrn->mask.red) >> pScrn->offset.red;
+ g = (ptrPort->colorKey & pScrn->mask.green) >> pScrn->offset.green;
+ b = (ptrPort->colorKey & pScrn->mask.blue) >> pScrn->offset.blue;
+ WRITE_VPR(pSmi, 0x04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
+ WRITE_VPR(pSmi, 0x08, 0);
+ break;
+ }
+
+ WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (ptrPort->brightness << 24));
+
+ LEAVE_PROC("SMI_ResetVideo");
+}
+
+#if SMI_USE_CAPTURE
+static int
+SMI_GetVideo(
+ ScrnInfoPtr pScrn,
+ 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
+)
+{
+ SMI_PortPtr ptrPort = (SMI_PortPtr) data;
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD32 vid_pitch, vid_address;
+ CARD32 vpr00, cpr00;
+ int xscale, yscale;
+ BoxRec dstBox;
+ INT32 x1, y1, x2, y2;
+ int areaHeight, width, height, fbPitch;
+ int top, left;
+
+ ENTER_PROC("SMI_GetVideo");
+
+ x1 = vid_x;
+ y1 = vid_y;
+ x2 = vid_x + vid_w;
+ y2 = vid_y + vid_h;
+
+ width = vid_w;
+ height = vid_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.y1 = drw_y;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y2 = drw_y + drw_h;
+
+ if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width,
+ height))
+ {
+ LEAVE_PROC("SMI_GetVideo");
+ return(Success);
+ }
+
+ dstBox.x1 -= pScrn->frameX0;
+ dstBox.y1 -= pScrn->frameY0;
+ dstBox.x2 -= pScrn->frameX0;
+ dstBox.y2 -= pScrn->frameY0;
+
+ if (ptrPort->i2cDevice == 0)
+ {
+ if (SMI_SendI2C(pScrn, SAA7110, "SAA7110", data_SAA7110) == Success)
+ {
+ ptrPort->i2cDevice = SAA7110;
+ }
+ else
+ {
+ xf86FreeOffscreenArea(ptrPort->area);
+ ptrPort->area = NULL;
+ LEAVE_PROC("SMI_GetVideo");
+ return(BadAlloc);
+ }
+ }
+
+ vid_pitch = (vid_w * 2 + 7) & ~7;
+
+ vpr00 = READ_VPR(pSmi, 0x00) & ~0x0FF000FF;
+ cpr00 = READ_CPR(pSmi, 0x00) & ~0x000FFF00;
+
+ vpr00 |= 0x0110000E;
+ cpr00 |= 0x00000001;
+ if (pSmi->ByteSwap)
+ cpr00 |= 0x00004000;
+
+ fbPitch = pSmi->Stride;
+ if (pSmi->Bpp != 3)
+ {
+ fbPitch *= pSmi->Bpp;
+ }
+
+ if (vid_w <= drw_w)
+ {
+ xscale = (256 * vid_w / drw_w) & 0xFF;
+ }
+ else if (vid_w / 2 <= drw_w)
+ {
+ xscale = (128 * vid_w / drw_w) & 0xFF;
+ width /= 2;
+ vid_pitch /= 2;
+ cpr00 |= 0x00010000;
+ }
+ else if (vid_w / 4 <= drw_w)
+ {
+ xscale = (64 * vid_w / drw_w) & 0xFF;
+ width /= 4;
+ vid_pitch /= 4;
+ cpr00 |= 0x00020000;
+ }
+ else
+ {
+ xscale = 0;
+ width /= 4;
+ vid_pitch /= 4;
+ cpr00 |= 0x00020000;
+ }
+
+ if (vid_h <= drw_h)
+ {
+ yscale = (256 * vid_h / drw_h) & 0xFF;
+ }
+ else if (vid_h / 2 <= drw_h)
+ {
+ yscale = (128 * vid_h / drw_h) & 0xFF;
+ height /= 2;
+ cpr00 |= 0x00040000;
+ }
+ else if (vid_h / 4 <= drw_h)
+ {
+ yscale = (64 * vid_h / drw_h) & 0xFF;
+ height /= 4;
+ cpr00 |= 0x00080000;
+ }
+ else
+ {
+ yscale = 0;
+ height /= 4;
+ cpr00 |= 0x00080000;
+ }
+
+ do
+ {
+ areaHeight = (vid_pitch * height + fbPitch - 1) / fbPitch;
+ ptrPort->area = SMI_AllocateMemory(pScrn, ptrPort->area, areaHeight);
+ if (ptrPort->area == NULL)
+ {
+ if ((cpr00 & 0x000C0000) == 0)
+ {
+ /* height -> 1/2 height */
+ yscale = (128 * vid_h / drw_h) & 0xFF;
+ height = vid_h / 2;
+ cpr00 |= 0x00040000;
+ }
+ else if (cpr00 & 0x00040000)
+ {
+ /* 1/2 height -> 1/4 height */
+ yscale = (64 * vid_h / drw_h) & 0xFF;
+ height = vid_h / 4;
+ cpr00 ^= 0x000C0000;
+ }
+ else
+ {
+ /* 1/4 height */
+ if ((cpr00 & 0x00030000) == 0)
+ {
+ /* width -> 1/2 width */
+ xscale = (128 * vid_w / drw_w) & 0xFF;
+ width = vid_w / 2;
+ cpr00 |= 0x00010000;
+ }
+ else if (cpr00 & 0x00010000)
+ {
+ /* 1/2 width -> 1/4 width */
+ xscale = (64 * vid_w / drw_w) & 0xFF;
+ width = vid_w / 4;
+ cpr00 ^= 0x00030000;
+ }
+ else
+ {
+ LEAVE_PROC("SMI_GetVideo");
+ return(BadAlloc);
+ }
+ }
+ }
+ }
+ while (ptrPort->area == NULL);
+
+ vid_address = (ptrPort->area->box.y1 * fbPitch) + ((y1 >> 16) * vid_pitch);
+
+ if (!RegionsEqual(&ptrPort->clip, clipBoxes))
+ {
+ REGION_COPY(pScreen, &ptrPort->clip, clipBoxes);
+ XAAFillSolidRects(pScrn, ptrPort->colorKey, GXcopy, ~0,
+ REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes));
+ }
+
+ left = x1 >> 16;
+ top = y1 >> 16;
+ width = (x2 - x1) >> 16;
+ height = (y2 - y1) >> 16;
+ if (ptrPort->i2cDevice == SAA7110)
+ {
+ left += 79;
+ top += 12;
+ }
+
+ OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) & ~0x04);
+ WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) | 0x00200000);
+
+ SMI_WaitForSync(pScrn);
+
+ WRITE_VPR(pSmi, 0x14, dstBox.x1 + (dstBox.y1 << 16));
+ WRITE_VPR(pSmi, 0x18, dstBox.x2 + (dstBox.y2 << 16));
+ WRITE_VPR(pSmi, 0x20, (vid_pitch / 8) + ((vid_pitch / 8) << 16));
+ WRITE_VPR(pSmi, 0x24, (xscale << 8) + yscale);
+
+ WRITE_CPR(pSmi, 0x04, left + (top << 16));
+ WRITE_CPR(pSmi, 0x08, width + (height << 16));
+ WRITE_CPR(pSmi, 0x0C, vid_address / 8);
+ WRITE_CPR(pSmi, 0x10, vid_address / 8);
+ WRITE_CPR(pSmi, 0x14, (vid_pitch / 8) + ((vid_pitch / 8) << 16));
+
+ WRITE_CPR(pSmi, 0x00, cpr00);
+ WRITE_VPR(pSmi, 0x00, vpr00);
+
+ ptrPort->videoStatus = CLIENT_VIDEO_ON;
+ LEAVE_PROC("SMI_GetVideo");
+ return(Success);
+}
+#endif
+
+static void
+SMI_StopVideo(
+ ScrnInfoPtr pScrn,
+ pointer data,
+ Bool exit
+)
+{
+ SMI_PortPtr ptrPort = (SMI_PortPtr) data;
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_StopVideo");
+
+ REGION_EMPTY(pScrn->pScreen, &ptrPort->clip);
+
+ if (exit)
+ {
+ if (ptrPort->videoStatus & CLIENT_VIDEO_ON)
+ {
+ WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008);
+ #if SMI_USE_CAPTURE
+ WRITE_CPR(pSmi, 0x00, READ_CPR(pSmi, 0x00) & ~0x00000001);
+ WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) & ~0x00F00000);
+ OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04);
+ #endif
+ }
+ if (ptrPort->area != NULL)
+ {
+ xf86FreeOffscreenArea(ptrPort->area);
+ ptrPort->area = NULL;
+ }
+ ptrPort->videoStatus = 0;
+ ptrPort->i2cDevice = 0;
+ }
+ else
+ {
+ if (ptrPort->videoStatus & CLIENT_VIDEO_ON)
+ {
+ ptrPort->videoStatus |= OFF_TIMER;
+ ptrPort->offTime = currentTime.milliseconds + OFF_DELAY;
+ }
+ }
+
+ LEAVE_PROC("SMI_StopVideo");
+}
+
+static int
+SMI_SetPortAttribute(
+ ScrnInfoPtr pScrn,
+ Atom attribute,
+ INT32 value,
+ pointer data
+)
+{
+ SMI_PortPtr ptrPort = (SMI_PortPtr) data;
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_SetPortAttribute");
+
+ if (attribute == xvColorKey)
+ {
+ int r, g, b;
+
+ ptrPort->colorKey = value;
+ switch (pScrn->depth)
+ {
+ case 8:
+ WRITE_VPR(pSmi, 0x04, value & 0x00FF);
+ break;
+
+ case 15:
+ case 16:
+ WRITE_VPR(pSmi, 0x04, value & 0xFFFF);
+ break;
+
+ default:
+ r = (value & pScrn->mask.red) >> pScrn->offset.red;
+ g = (value & pScrn->mask.green) >> pScrn->offset.green;
+ b = (value & pScrn->mask.blue) >> pScrn->offset.blue;
+ WRITE_VPR(pSmi, 0x04,
+ ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
+ break;
+ }
+ }
+
+ else if (attribute == xvBrightness)
+ {
+ if ((value < -128) || (value > 127))
+ {
+ LEAVE_PROC("SMI_SetPortAttribute");
+ return(BadValue);
+ }
+ ptrPort->brightness = value;
+ WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (value << 24));
+ }
+
+ else
+ {
+ LEAVE_PROC("SMI_SetPortAttribute");
+ return(BadMatch);
+ }
+
+ LEAVE_PROC("SMI_SetPortAttribute");
+ return(Success);
+}
+
+static int
+SMI_GetPortAttribute(
+ ScrnInfoPtr pScrn,
+ Atom attribute,
+ INT32 *value,
+ pointer data
+)
+{
+ SMI_PortPtr ptrPort = (SMI_PortPtr) data;
+
+ ENTER_PROC("SMI_GetPortAttribute");
+
+ if (attribute == xvColorKey)
+ {
+ *value = ptrPort->colorKey;
+ }
+
+ else if (attribute == xvBrightness)
+ {
+ *value = ptrPort->brightness;
+ }
+
+ else
+ {
+ LEAVE_PROC("SMI_GetPortAttribute");
+ return(BadMatch);
+ }
+
+ LEAVE_PROC("SMI_GetPortAttribute");
+ return(Success);
+}
+
+static void
+SMI_QueryBestSize(
+ ScrnInfoPtr pScrn,
+ Bool motion,
+ short vid_w,
+ short vid_h,
+ short drw_w,
+ short drw_h,
+ unsigned int *p_w,
+ unsigned int *p_h,
+ pointer data
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_QueryBestSize");
+
+ *p_w = min(drw_w, pSmi->lcdWidth);
+ *p_h = min(drw_h, pSmi->lcdHeight);
+
+ LEAVE_PROC("SMI_QueryBestSize");
+}
+
+static int
+SMI_PutImage(
+ ScrnInfoPtr pScrn,
+ short src_x,
+ short src_y,
+ short drw_x,
+ short drw_y,
+ short src_w,
+ short src_h,
+ short drw_w,
+ short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool sync,
+ RegionPtr clipBoxes,
+ pointer data
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ SMI_PortPtr ptrPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr;
+ INT32 x1, y1, x2, y2;
+ int bpp = 0;
+ int fbPitch, srcPitch, srcPitch2 = 0, dstPitch, areaHeight;
+ BoxRec dstBox;
+ CARD32 offset, offset2 = 0, offset3 = 0, tmp;
+ int left, top, nPixels, nLines;
+ unsigned char *dstStart;
+
+ ENTER_PROC("SMI_PutImage");
+
+ x1 = src_x;
+ y1 = src_y;
+ x2 = src_x + src_w;
+ y2 = src_y + src_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.y1 = drw_y;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y2 = drw_y + drw_h;
+
+ if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width,
+ height))
+ {
+ LEAVE_PROC("SMI_PutImage");
+ return(Success);
+ }
+
+ dstBox.x1 -= pScrn->frameX0;
+ dstBox.y1 -= pScrn->frameY0;
+ dstBox.x2 -= pScrn->frameX0;
+ dstBox.y2 -= pScrn->frameY0;
+
+ if (pSmi->Bpp == 3)
+ {
+ fbPitch = pSmi->Stride;
+ }
+ else
+ {
+ fbPitch = pSmi->Stride * pSmi->Bpp;
+ }
+
+ switch (id)
+ {
+ case FOURCC_YV12:
+ srcPitch = (width + 3) & ~3;
+ offset2 = srcPitch * height;
+ srcPitch2 = ((width >> 1) + 3) & ~3;
+ offset3 = offset2 + (srcPitch2 * (height >> 1));
+ dstPitch = ((width << 1) + 15) & ~15;
+ break;
+
+ case FOURCC_RV24:
+ bpp = 3;
+ srcPitch = width * bpp;
+ dstPitch = (srcPitch + 15) & ~15;
+ break;
+
+ case FOURCC_RV32:
+ bpp = 4;
+ srcPitch = width * bpp;
+ dstPitch = (srcPitch + 15) & ~15;
+ break;
+
+ case FOURCC_YUY2:
+ case FOURCC_RV15:
+ case FOURCC_RV16:
+ default:
+ bpp = 2;
+ srcPitch = width * bpp;
+ dstPitch = (srcPitch + 15) & ~15;
+ break;
+ }
+
+ areaHeight = ((dstPitch * height) + fbPitch - 1) / fbPitch;
+ ptrPort->area = SMI_AllocateMemory(pScrn, ptrPort->area, areaHeight);
+ if (ptrPort->area == NULL)
+ {
+ LEAVE_PROC("SMI_PutImage");
+ return(BadAlloc);
+ }
+
+ top = y1 >> 16;
+ left = (x1 >> 16) & ~1;
+ nPixels = ((((x2 + 0xFFFF) >> 16) + 1) & ~1) - left;
+ left *= bpp;
+
+ offset = (ptrPort->area->box.y1 * fbPitch) + (top * dstPitch);
+ dstStart = pSmi->FBBase + offset + left;
+
+ switch (id)
+ {
+ case FOURCC_YV12:
+ top &= ~1;
+ tmp = ((top >> 1) * srcPitch2) + (left >> 2);
+ offset2 += tmp;
+ offset3 += tmp;
+ nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top;
+ SMI_CopyYV12Data(buf + (top * srcPitch) + (left >> 1),
+ buf + offset2, buf + offset3, dstStart, srcPitch, srcPitch2,
+ dstPitch, nLines, nPixels);
+ break;
+
+ default:
+ buf += (top * srcPitch) + left;
+ nLines = ((y2 + 0xFFFF) >> 16) - top;
+ SMI_CopyData(buf, dstStart, srcPitch, dstPitch, nLines,
+ nPixels * bpp);
+ break;
+ }
+
+ if (!RegionsEqual(&ptrPort->clip, clipBoxes))
+ {
+ REGION_COPY(pScreen, &ptrPort->clip, clipBoxes);
+ XAAFillSolidRects(pScrn, ptrPort->colorKey, GXcopy, ~0,
+ REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes));
+ }
+
+ SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2,
+ &dstBox, src_w, src_h, drw_w, drw_h);
+
+ ptrPort->videoStatus = CLIENT_VIDEO_ON;
+ LEAVE_PROC("SMI_PutImage");
+ return(Success);
+
+}
+
+static int
+SMI_QueryImageAttributes(
+ ScrnInfoPtr pScrn,
+ int id,
+ unsigned short *width,
+ unsigned short *height,
+ int *pitches,
+ int *offsets
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int size, tmp;
+
+ ENTER_PROC("SMI_QueryImageAttributes");
+
+ if (*width > pSmi->lcdWidth)
+ {
+ *width = pSmi->lcdWidth;
+ }
+ if (*height > pSmi->lcdHeight)
+ {
+ *height = pSmi->lcdHeight;
+ }
+
+ *width = (*width + 1) & ~1;
+ if (offsets != NULL)
+ {
+ offsets[0] = 0;
+ }
+
+ switch (id)
+ {
+ case FOURCC_YV12:
+ *height = (*height + 1) & ~1;
+ size = (*width + 3) & ~3;
+ if (pitches != NULL)
+ {
+ pitches[0] = size;
+ }
+ size *= *height;
+ if (offsets != NULL)
+ {
+ offsets[1] = size;
+ }
+ tmp = ((*width >> 1) + 3) & ~3;
+ if (pitches != NULL)
+ {
+ pitches[1] = pitches[2] = tmp;
+ }
+ tmp *= (*height >> 1);
+ size += tmp;
+ if (offsets != NULL)
+ {
+ offsets[2] = size;
+ }
+ size += tmp;
+ break;
+
+ case FOURCC_YUY2:
+ case FOURCC_RV15:
+ case FOURCC_RV16:
+ default:
+ size = *width * 2;
+ if (pitches != NULL)
+ {
+ pitches[0] = size;
+ }
+ size *= *height;
+ break;
+
+ case FOURCC_RV24:
+ size = *width * 3;
+ if (pitches != NULL)
+ {
+ pitches[0] = size;
+ }
+ size *= *height;
+ break;
+
+ case FOURCC_RV32:
+ size = *width * 4;
+ if (pitches != NULL)
+ {
+ pitches[0] = size;
+ }
+ size *= *height;
+ break;
+ }
+
+ LEAVE_PROC("SMI_QueryImageAttributes");
+ return(size);
+}
+
+/******************************************************************************\
+** **
+** S U P P O R T F U N C T I O N S **
+** **
+\******************************************************************************/
+
+static void
+SMI_WaitForSync(
+ ScrnInfoPtr pScrn
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int vgaIOBase = hwp->IOBase;
+ int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET;
+ int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET;
+
+ VerticalRetraceWait();
+}
+
+static Bool
+RegionsEqual(
+ RegionPtr A,
+ RegionPtr B
+)
+{
+ int *dataA, *dataB;
+ int num;
+
+ ENTER_PROC("RegionsEqual");
+
+ num = REGION_NUM_RECTS(A);
+ if (num != REGION_NUM_RECTS(B))
+ {
+ LEAVE_PROC("RegionsEqual");
+ return(FALSE);
+ }
+
+ if ( (A->extents.x1 != B->extents.x1)
+ || (A->extents.y1 != B->extents.y1)
+ || (A->extents.x2 != B->extents.x2)
+ || (A->extents.y2 != B->extents.y2)
+ )
+ {
+ LEAVE_PROC("RegionsEqual");
+ return(FALSE);
+ }
+
+ dataA = (int*) REGION_RECTS(A);
+ dataB = (int*) REGION_RECTS(B);
+
+ while (num--)
+ {
+ if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
+ {
+ return(FALSE);
+ }
+ dataA += 2;
+ dataB += 2;
+ }
+
+ LEAVE_PROC("RegionsEqual");
+ return(TRUE);
+}
+
+static Bool
+SMI_ClipVideo(
+ ScrnInfoPtr pScrn,
+ BoxPtr dst,
+ INT32 *x1,
+ INT32 *y1,
+ INT32 *x2,
+ INT32 *y2,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height
+)
+{
+ INT32 vscale, hscale, delta;
+ BoxPtr extents = REGION_EXTENTS(pScrn, reg);
+ int diff;
+
+ ENTER_PROC("SMI_ClipVideo");
+
+ hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
+ vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
+
+ *x1 <<= 16; *y1 <<= 16;
+ *x2 <<= 16; *y2 <<= 16;
+
+ diff = extents->x1 - dst->x1;
+ if (diff > 0)
+ {
+ dst->x1 = extents->x1;
+ *x1 += diff * hscale;
+ }
+
+ diff = extents->y1 - dst->y1;
+ if (diff > 0)
+ {
+ dst->y1 = extents->y1;
+ *y1 += diff * vscale;
+ }
+
+ diff = dst->x2 - extents->x2;
+ if (diff > 0)
+ {
+ dst->x2 = extents->x2; /* PDR#687 */
+ *x2 -= diff * hscale;
+ }
+
+ 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;
+ }
+
+ if (*y1 < 0)
+ {
+ diff = (-*y1 + vscale - 1) / vscale;
+ dst->y1 += diff;
+ *y1 += diff * vscale;
+ }
+
+ delta = *x2 - (width << 16);
+ if (delta > 0)
+ {
+ diff = (delta + hscale - 1) / hscale;
+ dst->x2 -= diff;
+ *x2 -= diff * hscale;
+ }
+
+ delta = *y2 - (height << 16);
+ if (delta > 0)
+ {
+ diff = (delta + vscale - 1) / vscale;
+ dst->y2 -= diff;
+ *y2 -= diff * vscale;
+ }
+
+ if ((*x1 >= *x2) || (*y1 >= *y2))
+ {
+ LEAVE_PROC("SMI_ClipVideo");
+ return(FALSE);
+ }
+
+ if ( (dst->x1 != extents->x1) || (dst->y1 != extents->y1)
+ || (dst->x2 != extents->x2) || (dst->y2 != extents->y2)
+ )
+ {
+ RegionRec clipReg;
+ REGION_INIT(pScrn, &clipReg, dst, 1);
+ REGION_INTERSECT(pScrn, reg, reg, &clipReg);
+ REGION_UNINIT(pScrn, &clipReg);
+ }
+
+ LEAVE_PROC("SMI_ClipVideo");
+ return(TRUE);
+}
+
+static void
+SMI_DisplayVideo(
+ ScrnInfoPtr pScrn,
+ int id,
+ int offset,
+ short width,
+ short height,
+ int pitch,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ BoxPtr dstBox,
+ short vid_w,
+ short vid_h,
+ short drw_w,
+ short drw_h
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD32 vpr00;
+ int hstretch, vstretch;
+
+ ENTER_PROC("SMI_DisplayVideo");
+
+ vpr00 = READ_VPR(pSmi, 0x00) & ~0x0CB800FF;
+
+ switch (id)
+ {
+ case FOURCC_YV12:
+ case FOURCC_YUY2:
+ vpr00 |= 0x6;
+ break;
+
+ case FOURCC_RV15:
+ vpr00 |= 0x1;
+ break;
+
+ case FOURCC_RV16:
+ vpr00 |= 0x2;
+ break;
+
+ case FOURCC_RV24:
+ vpr00 |= 0x4;
+ break;
+
+ case FOURCC_RV32:
+ vpr00 |= 0x3;
+ break;
+ }
+
+
+ if (drw_w > vid_w)
+ {
+ hstretch = (2560 * vid_w / drw_w + 5) / 10;
+ }
+ else
+ {
+ hstretch = 0;
+ }
+
+ if (drw_h > vid_h)
+ {
+ vstretch = (2560 * vid_h / drw_h + 5) / 10;
+ vpr00 |= 1 << 21;
+ }
+ else
+ {
+ vstretch = 0;
+ }
+
+ SMI_WaitForSync(pScrn);
+
+ WRITE_VPR(pSmi, 0x00, vpr00 | (1 << 3) | (1 << 20));
+ WRITE_VPR(pSmi, 0x14, (dstBox->x1) | (dstBox->y1 << 16));
+ WRITE_VPR(pSmi, 0x18, (dstBox->x2) | (dstBox->y2 << 16));
+ WRITE_VPR(pSmi, 0x1C, offset >> 3);
+ WRITE_VPR(pSmi, 0x20, (pitch >> 3) | ((pitch >> 3) << 16));
+ WRITE_VPR(pSmi, 0x24, (hstretch << 8) | vstretch);
+
+ LEAVE_PROC("SMI_DisplayVideo");
+}
+
+static void
+SMI_BlockHandler(
+ int i,
+ pointer blockData,
+ pointer pTimeout,
+ pointer pReadMask
+)
+{
+ ScreenPtr pScreen = screenInfo.screens[i];
+ ScrnInfoPtr pScrn = xf86Screens[i];
+ SMIPtr pSmi = SMIPTR(pScrn);
+ SMI_PortPtr ptrPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr;
+
+ pScreen->BlockHandler = pSmi->BlockHandler;
+ (*pScreen->BlockHandler)(i, blockData, pTimeout, pReadMask);
+ pScreen->BlockHandler = SMI_BlockHandler;
+
+ if (ptrPort->videoStatus & TIMER_MASK)
+ {
+ UpdateCurrentTime();
+ if (ptrPort->videoStatus & OFF_TIMER)
+ {
+ if (ptrPort->offTime < currentTime.milliseconds)
+ {
+ WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008);
+ ptrPort->videoStatus = FREE_TIMER;
+ ptrPort->freeTime = currentTime.milliseconds + FREE_DELAY;
+ }
+ }
+ else
+ {
+ if (ptrPort->freeTime < currentTime.milliseconds)
+ {
+ xf86FreeOffscreenArea(ptrPort->area);
+ ptrPort->area = NULL;
+ }
+ ptrPort->videoStatus = 0;
+ }
+ }
+}
+
+static int
+SMI_SendI2C(
+ ScrnInfoPtr pScrn,
+ CARD8 device,
+ char *devName,
+ SMI_I2CDataPtr i2cData
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ I2CDevPtr dev;
+ int status = Success;
+
+ ENTER_PROC("SMI_SendI2C");
+
+ if (pSmi->I2C == NULL)
+ {
+ LEAVE_PROC("SMI_SendI2C");
+ return(BadAlloc);
+ }
+
+ dev = xf86CreateI2CDevRec();
+ if (dev == NULL)
+ {
+ LEAVE_PROC("SMI_SendI2C");
+ return(BadAlloc);
+ }
+ dev->DevName = devName;
+ dev->SlaveAddr = device;
+ dev->pI2CBus = pSmi->I2C;
+
+ if (!xf86I2CDevInit(dev))
+ {
+ status = BadAlloc;
+ }
+ else
+ {
+ while (i2cData->address != 0xFF || i2cData->data != 0xFF) /* PDR#676 */
+ {
+ if (!xf86I2CWriteByte(dev, i2cData->address, i2cData->data))
+ {
+ status = BadAlloc;
+ break;
+ }
+ i2cData++;
+ }
+ }
+
+ xf86DestroyI2CDevRec(dev, TRUE);
+ LEAVE_PROC("SMI_SendI2C");
+ return(status);
+}
+
+/******************************************************************************\
+** **
+** O F F S C R E E N M E M O R Y M A N A G E R **
+** **
+\******************************************************************************/
+
+static void
+SMI_InitOffscreenImages(
+ ScreenPtr pScreen
+)
+{
+ XF86OffscreenImagePtr offscreenImages;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER_PROC("SMI_InitOffscreenImages");
+
+ offscreenImages = xalloc(sizeof(XF86OffscreenImageRec));
+ if (offscreenImages == NULL)
+ {
+ LEAVE_PROC("SMI_InitOffscreenImages");
+ return;
+ }
+
+ offscreenImages->image = SMI_VideoImages;
+ offscreenImages->flags = VIDEO_OVERLAID_IMAGES
+ | VIDEO_CLIP_TO_VIEWPORT;
+ offscreenImages->alloc_surface = SMI_AllocSurface;
+ offscreenImages->free_surface = SMI_FreeSurface;
+ offscreenImages->display = SMI_DisplaySurface;
+ offscreenImages->stop = SMI_StopSurface;
+ offscreenImages->getAttribute = SMI_GetSurfaceAttribute;
+ offscreenImages->setAttribute = SMI_SetSurfaceAttribute;
+ offscreenImages->max_width = pSmi->lcdWidth;
+ offscreenImages->max_height = pSmi->lcdHeight;
+ offscreenImages->num_attributes = nElems(SMI_VideoAttributes);
+ offscreenImages->attributes = SMI_VideoAttributes;
+
+ xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1);
+
+ LEAVE_PROC("SMI_InitOffscreenImages");
+}
+
+static FBAreaPtr
+SMI_AllocateMemory(
+ ScrnInfoPtr pScrn,
+ FBAreaPtr area,
+ int numLines
+)
+{
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+
+ ENTER_PROC("SMI_AllocateMemory");
+
+ if (area != NULL)
+ {
+ if ((area->box.y2 - area->box.y1) >= numLines)
+ {
+ LEAVE_PROC("SMI_AllocateMemory");
+ return(area);
+ }
+
+ if (xf86ResizeOffscreenArea(area, pScrn->displayWidth, numLines))
+ {
+ LEAVE_PROC("SMI_AllocateMemory");
+ return(area);
+ }
+
+ xf86FreeOffscreenArea(area);
+ }
+
+ area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, numLines, 0,
+ NULL, NULL, NULL);
+
+ if (area == NULL)
+ {
+ int maxW, maxH;
+
+ xf86QueryLargestOffscreenArea(pScreen, &maxW, &maxH, 0,
+ FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME);
+
+ if ((maxW < pScrn->displayWidth) || (maxH < numLines))
+ {
+ LEAVE_PROC("SMI_AllocateMemory");
+ return(NULL);
+ }
+
+ xf86PurgeUnlockedOffscreenAreas(pScreen);
+ area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, numLines,
+ 0, NULL, NULL, NULL);
+ }
+
+ LEAVE_PROC("SMI_AllocateMemory");
+ return(area);
+}
+
+static void
+SMI_CopyData(
+ unsigned char *src,
+ unsigned char *dst,
+ int srcPitch,
+ int dstPitch,
+ int height,
+ int width
+)
+{
+ ENTER_PROC("SMI_CopyData");
+
+ while (height-- > 0)
+ {
+ memcpy(dst, src, width);
+ src += srcPitch;
+ dst += dstPitch;
+ }
+
+ LEAVE_PROC("SMI_CopyData");
+}
+
+static void
+SMI_CopyYV12Data(
+ unsigned char *src1,
+ unsigned char *src2,
+ unsigned char *src3,
+ unsigned char *dst,
+ int srcPitch1,
+ int srcPitch2,
+ int dstPitch,
+ int height,
+ int width
+)
+{
+ CARD32 *pDst = (CARD32 *) dst;
+ int i, j;
+
+ ENTER_PROC("SMI_CopyYV12Data");
+
+ for (j = 0; j < height; j++)
+ {
+ for (i =0; i < width; i++)
+ {
+ pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
+ (src3[i] << 8) | (src2[i] << 24);
+ }
+ pDst += dstPitch >> 2;
+ src1 += srcPitch1;
+ if (j & 1)
+ {
+ src2 += srcPitch2;
+ src3 += srcPitch2;
+ }
+ }
+
+ LEAVE_PROC("SMI_CopyYV12Data");
+}
+
+static int
+SMI_AllocSurface(
+ ScrnInfoPtr pScrn,
+ int id,
+ unsigned short width,
+ unsigned short height,
+ XF86SurfacePtr surface
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int numLines, pitch, fbPitch, bpp;
+ SMI_OffscreenPtr ptrOffscreen;
+ FBAreaPtr area;
+
+ ENTER_PROC("SMI_AllocSurface");
+
+ if ((width > pSmi->lcdWidth) || (height > pSmi->lcdHeight))
+ {
+ LEAVE_PROC("SMI_AllocSurface");
+ return(BadAlloc);
+ }
+
+ if (pSmi->Bpp == 3)
+ {
+ fbPitch = pSmi->Stride;
+ }
+ else
+ {
+ fbPitch = pSmi->Stride * pSmi->Bpp;
+ }
+
+ width = (width + 1) & ~1;
+ switch (id)
+ {
+ case FOURCC_YV12:
+ case FOURCC_YUY2:
+ case FOURCC_RV15:
+ case FOURCC_RV16:
+ bpp = 2;
+ break;
+
+ case FOURCC_RV24:
+ bpp = 3;
+ break;
+
+ case FOURCC_RV32:
+ bpp = 4;
+ break;
+
+ default:
+ LEAVE_PROC("SMI_AllocSurface");
+ return(BadAlloc);
+ }
+ pitch = (width * bpp + 15) & ~15;
+
+ numLines = ((height * pitch) + fbPitch - 1) / fbPitch;
+
+ area = SMI_AllocateMemory(pScrn, NULL, numLines);
+ if (area == NULL)
+ {
+ LEAVE_PROC("SMI_AllocSurface");
+ return(BadAlloc);
+ }
+
+ surface->pitches = xalloc(sizeof(int));
+ if (surface->pitches == NULL)
+ {
+ xf86FreeOffscreenArea(area);
+ LEAVE_PROC("SMI_AllocSurface");
+ return(BadAlloc);
+ }
+ surface->offsets = xalloc(sizeof(int));
+ if (surface->offsets == NULL)
+ {
+ xfree(surface->pitches);
+ xf86FreeOffscreenArea(area);
+ LEAVE_PROC("SMI_AllocSurface");
+ return(BadAlloc);
+ }
+
+ ptrOffscreen = xalloc(sizeof(SMI_OffscreenRec));
+ if (ptrOffscreen == NULL)
+ {
+ xfree(surface->offsets);
+ xfree(surface->pitches);
+ xf86FreeOffscreenArea(area);
+ LEAVE_PROC("SMI_AllocSurface");
+ return(BadAlloc);
+ }
+
+ surface->pScrn = pScrn;
+ surface->id = id;
+ surface->width = width;
+ surface->height = height;
+ surface->pitches[0] = pitch;
+ surface->offsets[0] = area->box.y1 * fbPitch;
+ surface->devPrivate.ptr = (pointer) ptrOffscreen;
+
+ ptrOffscreen->area = area;
+ ptrOffscreen->isOn = FALSE;
+
+ LEAVE_PROC("SMI_AllocSurface");
+ return(Success);
+}
+
+static int
+SMI_FreeSurface(
+ XF86SurfacePtr surface
+)
+{
+ SMI_OffscreenPtr ptrOffscreen = (SMI_OffscreenPtr) surface->devPrivate.ptr;
+
+ ENTER_PROC("SMI_FreeSurface");
+
+ if (ptrOffscreen->isOn)
+ {
+ SMI_StopSurface(surface);
+ }
+
+ xf86FreeOffscreenArea(ptrOffscreen->area);
+ xfree(surface->pitches);
+ xfree(surface->offsets);
+ xfree(surface->devPrivate.ptr);
+
+ LEAVE_PROC("SMI_FreeSurface");
+ return(Success);
+}
+
+static int
+SMI_DisplaySurface(
+ XF86SurfacePtr 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
+)
+{
+ SMI_OffscreenPtr ptrOffscreen = (SMI_OffscreenPtr) surface->devPrivate.ptr;
+ SMIPtr pSmi = SMIPTR(surface->pScrn);
+ SMI_PortPtr ptrPort = pSmi->ptrAdaptor->pPortPrivates[0].ptr;
+ INT32 x1, y1, x2, y2;
+ BoxRec dstBox;
+
+ ENTER_PROC("SMI_DisplaySurface");
+
+ x1 = vid_x;
+ x2 = vid_x + vid_w;
+ y1 = vid_y;
+ y2 = vid_y + vid_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y1 = drw_y;
+ dstBox.y2 = drw_y + drw_h;
+
+ if (!SMI_ClipVideo(surface->pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes,
+ surface->width, surface->height))
+ {
+ LEAVE_PROC("SMI_DisplaySurface");
+ return(Success);
+ }
+
+ dstBox.x1 -= surface->pScrn->frameX0;
+ dstBox.y1 -= surface->pScrn->frameY0;
+ dstBox.x2 -= surface->pScrn->frameX0;
+ dstBox.y2 -= surface->pScrn->frameY0;
+
+ XAAFillSolidRects(surface->pScrn, ptrPort->colorKey, GXcopy, ~0,
+ REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes));
+
+ SMI_ResetVideo(surface->pScrn);
+ SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0],
+ surface->width, surface->height, surface->pitches[0], x1, y1, x2,
+ y2, &dstBox, vid_w, vid_h, drw_w, drw_h);
+
+ ptrOffscreen->isOn = TRUE;
+ if (ptrPort->videoStatus & CLIENT_VIDEO_ON)
+ {
+ REGION_EMPTY(pScrn->pScreen, &ptrPort->clip);
+ UpdateCurrentTime();
+ ptrPort->videoStatus = FREE_TIMER;
+ ptrPort->freeTime = currentTime.milliseconds + FREE_DELAY;
+ }
+
+ LEAVE_PROC("SMI_DisplaySurface");
+ return(Success);
+}
+
+static int
+SMI_StopSurface(
+ XF86SurfacePtr surface
+)
+{
+ SMI_OffscreenPtr ptrOffscreen = (SMI_OffscreenPtr) surface->devPrivate.ptr;
+
+ ENTER_PROC("SMI_StopSurface");
+
+ if (ptrOffscreen->isOn)
+ {
+ SMIPtr pSmi = SMIPTR(surface->pScrn);
+ WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008);
+ ptrOffscreen->isOn = FALSE;
+ }
+
+ LEAVE_PROC("SMI_StopSurface");
+ return(Success);
+}
+
+static int
+SMI_GetSurfaceAttribute(
+ ScrnInfoPtr pScrn,
+ Atom attr,
+ INT32 *value
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ return(SMI_GetPortAttribute(pScrn, attr, value,
+ (pointer) pSmi->ptrAdaptor->pPortPrivates[0].ptr));
+}
+
+static int
+SMI_SetSurfaceAttribute(
+ ScrnInfoPtr pScrn,
+ Atom attr,
+ INT32 value
+)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ return(SMI_SetPortAttribute(pScrn, attr, value,
+ (pointer) pSmi->ptrAdaptor->pPortPrivates[0].ptr));
+}
+#else /* XvExtension */
+void SMI_InitVideo(ScreenPtr pScreen) {}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h
new file mode 100644
index 000000000..3d4729994
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h
@@ -0,0 +1,81 @@
+/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_video.h.-arc 1.8 27 Nov 2000 15:46:06 Frido $ */
+
+/*
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS 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 names of the XFree86 Project and
+Silicon Motion shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the XFree86 Project and silicon Motion.
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+
+#ifndef _SMI_VIDEO_H
+#define _SMI_VIDEO_H
+
+#include <fourcc.h>
+
+#define SMI_VIDEO_VIDEO 0
+#define SMI_VIDEO_IMAGE 1
+
+#define FOURCC_RV15 0x35315652
+#define FOURCC_RV16 0x36315652
+#define FOURCC_RV24 0x34325652
+#define FOURCC_RV32 0x32335652
+
+#define OFF_DELAY 200 /* milliseconds */
+#define FREE_DELAY 60000 /* milliseconds */
+
+#define OFF_TIMER 0x01
+#define FREE_TIMER 0x02
+#define CLIENT_VIDEO_ON 0x04
+#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
+
+#define SAA7110 0x9C
+
+typedef struct
+{
+ FBAreaPtr area;
+ RegionRec clip;
+ CARD32 colorKey;
+ CARD32 brightness;
+ CARD32 videoStatus;
+ Time offTime;
+ Time freeTime;
+ int i2cDevice;
+
+} SMI_PortRec, *SMI_PortPtr;
+
+typedef struct
+{
+ FBAreaPtr area;
+ Bool isOn;
+
+} SMI_OffscreenRec, *SMI_OffscreenPtr;
+
+typedef struct
+{
+ CARD8 address;
+ CARD8 data;
+
+} SMI_I2CDataRec, *SMI_I2CDataPtr;
+
+#endif /* _SMI_VIDEO_H */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile
index a66c4db4f..04819e1c8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.20 2000/10/09 23:12:46 alanh Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.21 2000/11/09 11:32:21 alanh Exp $
XCOMM
XCOMM This is an Imakefile for the SIS driver.
XCOMM
@@ -26,7 +26,7 @@ INCLUDES = -I. -I../../include
#else
INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \
-I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \
- -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \
+ -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \
-I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \
-I$(XF86SRC)/xf24_32bpp \
-I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
index 7d72a139d..1ef028274 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.6 2000/10/10 16:38:19 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.7 2000/11/09 11:32:21 alanh Exp $ */
/* modified from tdfx_dri.c, mga_dri.c */
@@ -9,11 +9,7 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb16.h"
-#include "cfb32.h"
+#include "fb.h"
#include "miline.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
index 9ffbfa2e5..9b0b6c11a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
@@ -25,16 +25,10 @@
* Mitani Hiroshi <hmitani@drl.mei.co.jp>
* David Thomas <davtom@dream.org.uk>.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.52 2000/10/09 23:37:15 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.53 2000/11/09 11:32:21 alanh Exp $ */
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb16.h"
-#include "cfb24.h"
-#include "cfb32.h"
-#include "cfb24_32.h"
+#include "fb.h"
#include "xf1bpp.h"
#include "xf4bpp.h"
#include "mibank.h"
@@ -200,11 +194,7 @@ static const char *vgahwSymbols[] = {
static const char *fbSymbols[] = {
"xf1bppScreenInit",
"xf4bppScreenInit",
- "cfbScreenInit",
- "cfb16ScreenInit",
- "cfb24ScreenInit",
- "cfb24_32ScreenInit",
- "cfb32ScreenInit",
+ "fbScreenInit",
NULL
};
@@ -939,25 +929,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
Sym = "xf4bppScreenInit";
break;
case 8:
- mod = "cfb";
- Sym = "cfbScreenInit";
- break;
case 16:
- mod = "cfb16";
- Sym = "cfb16ScreenInit";
- break;
case 24:
- if (pix24bpp == 24) {
- mod = "cfb24";
- Sym = "cfb24ScreenInit";
- } else {
- mod = "xf24_32bpp";
- Sym = "cfb24_32ScreenInit";
- }
- break;
case 32:
- mod = "cfb32";
- Sym = "cfb32ScreenInit";
+ mod = "fb";
+ Sym = "fbScreenInit";
break;
}
@@ -1316,29 +1292,12 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->displayWidth);
break;
case 8:
- ret = cfbScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX,
- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
case 16:
- ret = cfb16ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX,
- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
case 24:
- if (pix24bpp == 24)
- ret = cfb24ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX,
- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- else
- ret = cfb24_32ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX,
- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
case 32:
- ret = cfb32ScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX,
+ ret = fbScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX,
pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
+ pScrn->displayWidth, pScrn->bitsPerPixel);
break;
default:
xf86DrvMsg(scrnIndex, X_ERROR,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c
index 61fedbebb..a02188670 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c
@@ -25,16 +25,10 @@
* Mitani Hiroshi <hmitani@drl.mei.co.jp>
* David Thomas <davtom@dream.org.uk>.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.2 2000/03/31 20:13:37 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.3 2000/11/09 11:32:22 alanh Exp $ */
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb16.h"
-#include "cfb24.h"
-#include "cfb32.h"
-#include "cfb24_32.h"
+#include "fb.h"
#include "xf1bpp.h"
#include "xf4bpp.h"
#include "mibank.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile
index 7ec7f391b..1593a7166 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile
@@ -18,10 +18,10 @@ DRIDEFINES = $(GLX_DEFINES)
#endif
SRCS = tdfx_driver.c tdfx_io.c tdfx_hwcurs.c tdfx_accel.c \
- tdfx_dga.c tdfx_priv.c tdfx_sli.c $(DRISRCS)
+ tdfx_dga.c tdfx_priv.c tdfx_sli.c tdfx_video.c $(DRISRCS)
OBJS = tdfx_driver.o tdfx_io.o tdfx_hwcurs.o tdfx_accel.o \
- tdfx_dga.o tdfx_priv.o tdfx_sli.o $(DRIOBJS)
+ tdfx_dga.o tdfx_priv.o tdfx_sli.o tdfx_video.o $(DRIOBJS)
#if defined(XF86DriverSDK)
INCLUDES = -I. -I../../include
@@ -71,5 +71,6 @@ InstallDriverSDKNonExecFile(tdfx_io.c,$(DRIVERSDKDIR)/drivers/tdfx)
InstallDriverSDKNonExecFile(tdfx_priv.c,$(DRIVERSDKDIR)/drivers/tdfx)
InstallDriverSDKNonExecFile(tdfx_priv.h,$(DRIVERSDKDIR)/drivers/tdfx)
InstallDriverSDKNonExecFile(tdfx_sli.c,$(DRIVERSDKDIR)/drivers/tdfx)
+InstallDriverSDKNonExecFile(tdfx_video.c,$(DRIVERSDKDIR)/drivers/tdfx)
InstallDriverSDKObjectModule(tdfx,$(DRIVERSDKMODULEDIR),drivers)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp
index a92c55a65..950f10368 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp
@@ -15,7 +15,7 @@ tdfx \- 3Dfx video driver
.SH DESCRIPTION
.B tdfx
is an XFree86 driver for 3Dfx video cards.
-THIS MAN PAGE NEEDS TO BE FILLED IN.
+It supports the Voodoo Banshee, Voodoo3, Voodoo4 and Voodoo5 cards.
.SH SUPPORTED HARDWARE
The
.B tdfx
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
index 17221f249..97c039ba5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
@@ -41,16 +41,14 @@ typedef struct _TDFXRec *TDFXPtr;
#define PIXMAP_CACHE_LINES 512
#endif
-#ifdef PROP_3DFX
#include "tdfx_priv.h"
-#else
-#define PROPDATA
-#define PROPSAREADATA
-#endif
-extern Bool TDFXInitPrivate(ScreenPtr pScreen);
-extern void TDFXShutdownPrivate(ScreenPtr pScreen);
-extern void TDFXSwapContextPrivate(ScreenPtr pScreen);
+
+extern Bool TDFXInitFifo(ScreenPtr pScreen);
+extern void TDFXShutdownFifo(ScreenPtr pScreen);
+extern void TDFXSwapContextFifo(ScreenPtr pScreen);
extern void TDFXLostContext(ScreenPtr pScreen);
+extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples);
+extern Bool TDFXDisableSLI(TDFXPtr pTDFX);
#ifdef XF86DRI
extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI);
@@ -126,6 +124,7 @@ typedef struct {
unsigned int srcbaseaddr;
unsigned int dstbaseaddr;
unsigned char ExtVga[2];
+ unsigned char dactable[512];
} TDFXRegRec, *TDFXRegPtr;
typedef struct TextureData_t {
@@ -198,6 +197,18 @@ typedef struct _TDFXRec {
TDFXConfigPrivPtr pVisualConfigsPriv;
TDFXRegRec DRContextRegs;
#endif
+ /* State for video */
+ FBAreaPtr offscreenYUVBuf;
+ int offscreenYUVBufWidth;
+ int offscreenYUVBufHeight;
+
+ /* This is a small register shadow. I'm only shadowing
+ * sst2dDstFmt
+ * sst2dSrcFmt
+ * If a real register shadow is ever needed we should probably
+ * shadow everything and make it happen automatically for every write. */
+ INT32 sst2DSrcFmtShadow;
+ INT32 sst2DDstFmtShadow;
} TDFXRec;
typedef struct {
@@ -232,7 +243,7 @@ extern Bool TDFXDRIFinishScreenInit(ScreenPtr pScreen);
extern Bool TDFXDGAInit(ScreenPtr pScreen);
extern void TDFXCursorGrabMemory(ScreenPtr pScreen);
extern void TDFXSetLFBConfig(TDFXPtr pTDFX);
-extern void TDFXSendNOPPrivate(ScrnInfoPtr pScrn);
+extern void TDFXSendNOPFifo(ScrnInfoPtr pScrn);
extern Bool TDFXSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
extern void TDFXAdjustFrame(int scrnIndex, int x, int y, int flags);
@@ -259,34 +270,6 @@ extern void TDFXSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which);
-
-#ifndef PROP_3DFX
-#define DECLARE(a)
-#define DECLARE_LAUNCH(size, x)
-#ifdef TDFX_DEBUG_CMDS
-#define TDFXMakeRoom(p, n) \
- do { \
- if (cmdCnt) \
- ErrorF("Previous TDFXMakeRoom passed incorrect size\n"); \
- cmdCnt=n; \
- lastAddr=0;
- TDFXMakeRoomNoProp(p, n); \
- } while(0)
-#define TDFXWriteLong(p, a, v) \
- do { \
- if (lastAddr && a<lastAddr) \
- ErrorF("TDFXWriteLong not ordered\n"); \
- lastAddr=a; \
- cmdCnt--; \
- TDFXWriteLongMMIO(p, a, v); \
- while (0)
-#else
-#define TDFXMakeRoom(p, n) TDFXMakeRoomNoProp(p, n)
-#define TDFXWriteLong(p, a, v) TDFXWriteLongMMIO(p, a, v)
-#endif
-#define TDFXSendNOP TDFXSendNOPNoProp
-#endif
-
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
index 89ba45a50..1d72845d5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
@@ -73,6 +73,8 @@ static void TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int skipleft);
static void TDFXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
+void TDFXSelectBuffer(TDFXPtr pTDFX, int which);
+
void
TDFXNeedSync(ScrnInfoPtr pScrn) {
TDFXPtr pTDFX = TDFXPTR(pScrn);
@@ -88,7 +90,7 @@ TDFXFirstSync(ScrnInfoPtr pScrn) {
#ifdef XF86DRI
if (pTDFX->directRenderingEnabled) {
DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
- TDFXSwapContextPrivate(screenInfo.screens[pScrn->scrnIndex]);
+ TDFXSwapContextFifo(screenInfo.screens[pScrn->scrnIndex]);
}
#endif
pTDFX->syncDone=TRUE;
@@ -105,7 +107,6 @@ TDFXCheckSync(ScrnInfoPtr pScrn) {
pTDFX->syncDone=FALSE;
#ifdef XF86DRI
if (pTDFX->directRenderingEnabled) {
- TDFXLostContext(screenInfo.screens[pScrn->scrnIndex]);
DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
}
#endif
@@ -124,8 +125,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
else fmt=pTDFX->stride|((pTDFX->cpp+1)<<16);
TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->fbOffset);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->fbOffset);
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
break;
case TDFX_BACK:
if (pTDFX->cpp==2)
@@ -134,8 +137,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */
TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->backOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->backOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
break;
case TDFX_DEPTH:
if (pTDFX->cpp==2)
@@ -144,8 +149,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) {
fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */
TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->depthOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->depthOffset|BIT(31));
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
break;
default:
;
@@ -233,21 +240,7 @@ TDFXAccelInit(ScreenPtr pScreen)
infoPtr->SubsequentScreenToScreenCopy = TDFXSubsequentScreenToScreenCopy;
infoPtr->ScreenToScreenCopyFlags = commonFlags;
-#ifndef PROP_3DFX
- /* We can use direct method because we're writing straight to the board */
- infoPtr->SetupForCPUToScreenColorExpandFill =
- TDFXSetupForCPUToScreenColorExpandFill;
- infoPtr->SubsequentCPUToScreenColorExpandFill =
- TDFXSubsequentCPUToScreenColorExpandFill;
- infoPtr->ColorExpandBase = pTDFX->MMIOBase[0]+SST_2D_LAUNCH;
- infoPtr->ColorExpandRange = 128;
- infoPtr->CPUToScreenColorExpandFillFlags = commonFlags |
- CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD |
- LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */
- pTDFX->scanlineColorExpandBuffers[0]=0;
- pTDFX->scanlineColorExpandBuffers[1]=0;
-#else
- /* When we're using the proprietary interface we have to use indirect */
+ /* When we're using the fifo we have to use indirect expansion */
pTDFX->scanlineColorExpandBuffers[0] = xalloc((pScrn->virtualX+62)/32*4);
pTDFX->scanlineColorExpandBuffers[1] = xalloc((pScrn->virtualX+62)/32*4);
infoPtr->NumScanlineColorExpandBuffers=2;
@@ -261,7 +254,6 @@ TDFXAccelInit(ScreenPtr pScreen)
infoPtr->ScanlineCPUToScreenColorExpandFillFlags = commonFlags |
CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD |
LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */
-#endif
infoPtr->SetupForMono8x8PatternFill = TDFXSetupForMono8x8PatternFill;
infoPtr->SubsequentMono8x8PatternFillRect =
@@ -289,6 +281,9 @@ TDFXAccelInit(ScreenPtr pScreen)
pTDFX->ModeReg.dstbaseaddr=pTDFX->fbOffset;
TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, pTDFX->ModeReg.dstbaseaddr);
+ pTDFX->sst2DSrcFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_SRCFORMAT);
+ pTDFX->sst2DDstFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_DSTFORMAT);
+
/* Fill in acceleration functions */
return XAAInit(pScreen, infoPtr);
}
@@ -433,7 +428,9 @@ TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
TDFXMakeRoom(pTDFX, 2);
DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt);
+ pTDFX->sst2DSrcFmtShadow = fmt;
}
void
@@ -491,6 +488,7 @@ TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
DECLARE(SSTCP_DSTFORMAT|SSTCP_COLORFORE|
SSTCP_COLORBACK);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_COLORBACK, color);
TDFXWriteLong(pTDFX, SST_2D_COLORFORE, color);
}
@@ -540,6 +538,7 @@ TDFXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
|SSTCP_PATTERN1ALIAS|SSTCP_COLORFORE|
SSTCP_COLORBACK);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_PATTERN0, patx);
TDFXWriteLong(pTDFX, SST_2D_PATTERN1, paty);
TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg);
@@ -655,6 +654,7 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
(pbox->x2&0x1FFF));
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP |
SST_2D_SOURCE_PACKING_DWORD);
+ pTDFX->sst2DSrcFmtShadow = SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD;
TDFXWriteLong(pTDFX, SST_2D_SRCXY, 0);
TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg);
TDFXWriteLong(pTDFX, SST_2D_COMMAND, pTDFX->Cmd);
@@ -788,9 +788,11 @@ TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y,
SSTCP_DSTSIZE|SSTCP_DSTXY|SSTCP_COMMAND |
SSTCP_CLIP1MIN|SSTCP_CLIP1MAX);
TDFXWriteLong(pTDFX,SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX,SST_2D_CLIP1MIN, (x&0x1FFF) | ((y&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_CLIP1MAX, ((x+w)&0x1FFF) | (((y+h)&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_SRCFORMAT, pTDFX->stride);
+ pTDFX->sst2DSrcFmtShadow = pTDFX->stride;
TDFXWriteLong(pTDFX,SST_2D_SRCXY, (srcx&0x1FFF) | ((srcy&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_DSTSIZE, ((w+offset)&0x1FFF) | ((h&0x1FFF)<<16));
TDFXWriteLong(pTDFX,SST_2D_DSTXY, ((x-offset)&0x1FFF) | ((y&0x1FFF)<<16));
@@ -849,9 +851,11 @@ TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y,
SSTCP_DSTFORMAT|SSTCP_DSTSIZE|SSTCP_SRCXY|
SSTCP_DSTXY|SSTCP_COMMAND);
TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt);
+ pTDFX->sst2DDstFmtShadow = fmt;
TDFXWriteLong(pTDFX, SST_2D_CLIP1MIN, ((y&0x1FFF)<<16)|(x&0x1FFF));
TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, (((y+h)&0x1FFF)<<16)|((x+w)&0x1FFF));
TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF);
+ pTDFX->sst2DSrcFmtShadow = (((w+31)/32)*4) & 0x3FFF;
TDFXWriteLong(pTDFX, SST_2D_SRCXY, skipleft&0x1F);
TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, ((w-skipleft)&0x1FFF)|((h&0x1FFF)<<16));
TDFXWriteLong(pTDFX, SST_2D_DSTXY, ((x+skipleft)&0x1FFF) | ((y&0x1FFF)<<16));
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
index a9fc4499b..51d719a27 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
@@ -26,6 +26,8 @@ static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
void *readContextStore,
DRIContextType writeContextType,
void *writeContextStore);
+static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen);
+static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen);
static void TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index);
@@ -489,21 +491,6 @@ TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType oldContextType, void *oldContext,
DRIContextType newContextType, void *newContext)
{
-#if 0
- ScrnInfoPtr pScrn;
-
- pScrn = xf86Screens[pScreen->myNum];
- if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) &&
- (newContextType==DRI_2D_CONTEXT)) { /* Exiting from Block Handler */
- TDFXCheckSync(pScrn);
- TDFXLostContext(pScreen);
- }
- if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) &&
- (newContextType==DRI_2D_CONTEXT)) { /* Entering from Wakeup */
- TDFXSwapContextPrivate(pScreen);
- TDFXNeedSync(pScrn);
- }
-#endif
}
static void
@@ -684,3 +671,34 @@ TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
pTDFX->AccelInfoRec->NeedToSync = TRUE;
}
+
+static Bool
+TDFXDRIOpenFullScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+ TDFXPtr pTDFX;
+
+ xf86DrvMsg(pScreen->myNum, X_INFO, "OpenFullScreen\n");
+#if 0
+ pScrn = xf86Screens[pScreen->myNum];
+ pTDFX=TDFXPTR(pScrn);
+ if (pTDFX->numChips>1) {
+ TDFXSetupSLI(pScrn);
+ }
+#endif
+ return TRUE;
+}
+
+static Bool
+TDFXDRICloseFullScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+
+ xf86DrvMsg(pScreen->myNum, X_INFO, "CloseFullScreen\n");
+#if 0
+ pScrn = xf86Screens[pScreen->myNum];
+ TDFXDisableSLI(pScrn);
+#endif
+ return TRUE;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
index 48c16e61e..9f0398075 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.43 2000/09/24 13:51:31 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.45 2000/11/14 13:12:21 alanh Exp $ */
/*
* Authors:
@@ -172,7 +172,6 @@ static PciChipsets TDFXPciChipsets[] = {
{ -1, -1, RES_UNDEFINED }
};
-/* !!! Do we want an option for PIO address space? !!! */
/* !!! Do we want an option for alternate clocking? !!! */
typedef enum {
@@ -281,6 +280,9 @@ static const char *driSymbols[] = {
"DRIGetSAREAPrivate",
"DRIGetContext",
"DRIQueryVersion",
+ "DRIAdjustFrame",
+ "DRIOpenFullScreen",
+ "DRICloseFullScreen",
"GlxSetVisualConfigs",
NULL
};
@@ -389,7 +391,7 @@ TDFXAvailableOptions(int chipid, int busid)
return TDFXOptions;
}
-void
+static void
TDFXProbeDDC(ScrnInfoPtr pScrn, int index)
{
vbeInfoPtr pVbe;
@@ -497,7 +499,10 @@ TDFXCountRam(ScrnInfoPtr pScrn) {
/* set memory interface delay values and enable refresh */
/* these apply to all RAM vendors */
dramInit1 = 0x0;
- dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT;
+ if (pTDFX->ChipType==PCI_CHIP_BANSHEE)
+ dramInit1 |= 7<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT;
+ else
+ dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT;
dramInit1 |= SST_SGRAM_CLK_NODELAY;
dramInit1 |= SST_DRAM_REFRESH_EN;
dramInit1 |= (0x18 << SST_DRAM_REFRESH_VALUE_SHIFT) & SST_DRAM_REFRESH_VALUE;
@@ -599,28 +604,31 @@ static void
TDFXInitChips(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
- int i, cfgbits, initbits;
+ int i, v, cfgbits, initbits;
int mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits;
pTDFX=TDFXPTR(pScrn);
cfgbits=pciReadLong(pTDFX->PciTag[0], CFG_PCI_DECODE);
mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE);
mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE);
+ initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE);
mem0size=32*1024*1024; /* Registers are always 32MB */
mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */
mem0bits=TDFXSizeToCfg(mem0size);
mem1bits=TDFXSizeToCfg(mem1size)<<4;
cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits;
for (i=0; i<pTDFX->numChips; i++) {
- initbits=pciReadLong(pTDFX->PciTag[i], CFG_INIT_ENABLE);
initbits|=BIT(10);
pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits);
+ v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
+ if (!i)
+ pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3);
+ else
+ pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2);
pTDFX->MMIOAddr[i]=mem0base+i*mem0size;
- pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, 0xFFFFFFFF);
pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, pTDFX->MMIOAddr[i]);
pTDFX->MMIOAddr[i]&=0xFFFFFF00;
pTDFX->LinearAddr[i]=mem1base+i*mem1size;
- pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, 0xFFFFFFFF);
pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, pTDFX->LinearAddr[i]);
pTDFX->LinearAddr[i]&=0xFFFFFF00;
pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits);
@@ -661,17 +669,12 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
pTDFX->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
if (flags & PROBE_DETECT) {
- TDFXProbeDDC(pScrn, pTDFX->pEnt->index);
- return TRUE;
+ TDFXProbeDDC(pScrn, pTDFX->pEnt->index);
+ return TRUE;
}
if (pTDFX->pEnt->location.type != BUS_PCI) return FALSE;
- if (flags & PROBE_DETECT) {
- TDFXProbeDDC(pScrn, pTDFX->pEnt->index);
- return TRUE;
- }
-
/* The vgahw module should be loaded here when needed */
if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE;
@@ -701,8 +704,11 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index);
TDFXFindChips(pScrn, match);
- if (xf86RegisterResources(pTDFX->pEnt->index, 0, ResNone))
+ if (xf86RegisterResources(pTDFX->pEnt->index, 0, ResExclusive)) {
+ TDFXFreeRec(pScrn);
return FALSE;
+ }
+
if (pTDFX->usePIO)
pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
else
@@ -1092,6 +1098,7 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts)
{
TDFXPtr pTDFX;
vgaHWPtr hwp;
+ int i, dummy, count;
TDFXTRACE("TDFXDoSave start\n");
pTDFX = TDFXPTR(pScrn);
@@ -1122,6 +1129,15 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts)
tdfxReg->clip1max=TDFXReadLongMMIO(pTDFX, SST_2D_CLIP1MAX);
tdfxReg->srcbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_SRCBASEADDR);
tdfxReg->dstbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_DSTBASEADDR);
+ for (i=0; i<512; i++) {
+ count=0;
+ do {
+ TDFXWriteLongMMIO(pTDFX, DACADDR, i);
+ dummy=TDFXReadLongMMIO(pTDFX, DACADDR);
+ } while (count++<100 && dummy!=i);
+ tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA);
+ dummy=tdfxReg->dactable[i];
+ }
}
static void
@@ -1141,6 +1157,7 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
Bool restoreFonts) {
TDFXPtr pTDFX;
vgaHWPtr hwp;
+ int i, dummy, count;
TDFXTRACE("TDFXDoRestore start\n");
pTDFX = TDFXPTR(pScrn);
@@ -1171,8 +1188,19 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
pTDFX->writeLong(pTDFX, VIDPROCCFG, tdfxReg->vidcfg);
TDFXWriteLongMMIO(pTDFX, SST_2D_SRCBASEADDR, tdfxReg->srcbaseaddr);
TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, tdfxReg->dstbaseaddr);
-
vgaHWProtect(pScrn, FALSE);
+ for (i=0; i<512; i++) {
+ count=0;
+ do {
+ TDFXWriteLongMMIO(pTDFX, DACADDR, i);
+ dummy=TDFXReadLongMMIO(pTDFX, DACADDR);
+ } while (count++<100 && dummy!=i);
+ count=0;
+ do {
+ TDFXWriteLongMMIO(pTDFX, DACDATA, tdfxReg->dactable[i]);
+ dummy=TDFXReadLongMMIO(pTDFX, DACDATA);
+ } while (count++<100 && dummy!=tdfxReg->dactable[i]);
+ }
pTDFX->sync(pScrn);
}
@@ -1460,7 +1488,7 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#ifdef XF86DRI
if (pTDFX->directRenderingEnabled) {
DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
- TDFXSwapContextPrivate(screenInfo.screens[pScrn->scrnIndex]);
+ TDFXSwapContextFifo(screenInfo.screens[pScrn->scrnIndex]);
}
#endif
DoRestore(pScrn, &hwp->ModeReg, &pTDFX->ModeReg, FALSE);
@@ -1489,8 +1517,8 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
for (j=index<<2; j<max; j++) {
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACADDR, j);
- } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=j);
+ TDFXWriteLongMMIO(pTDFX, DACADDR, j);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=j);
if (!repeat) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, "
"bypassing CLUT\n");
@@ -1499,8 +1527,8 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
}
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACDATA, v);
- } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v);
+ TDFXWriteLongMMIO(pTDFX, DACDATA, v);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v);
if (!repeat) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, "
"bypassing CLUT\n");
@@ -1524,8 +1552,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
v=(colors[index].red<<16)|(colors[index].green<<8)|colors[index].blue;
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACADDR, index);
- } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=index);
+ TDFXWriteLongMMIO(pTDFX, DACADDR, index);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=index);
if (!repeat) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, "
"bypassing CLUT\n");
@@ -1534,8 +1562,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
}
repeat=100;
do {
- pTDFX->writeLong(pTDFX, DACDATA, v);
- } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v);
+ TDFXWriteLongMMIO(pTDFX, DACDATA, v);
+ } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v);
if (!repeat) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, "
"bypassing CLUT\n");
@@ -1664,12 +1692,12 @@ static void allocateMemory(ScrnInfoPtr pScrn) {
fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12;
/* We give 4096 bytes to the cursor, fifoSize to the */
/* FIFO, and everything to textures. */
- texSize = (pTDFX->fbOffset - fifoSize - 4096);
- pTDFX->texOffset = pTDFX->fbOffset - texSize;
+ texSize = (pTDFX->fbOffset - fifoSize - 4096 - 16*1024);
+ pTDFX->texOffset = pTDFX->fbOffset - texSize + 16*1024;
pTDFX->texSize = texSize;
- pTDFX->fifoOffset = 4096;
+ pTDFX->fifoOffset = 4096+16*1024;
pTDFX->fifoSize = fifoSize;
- pTDFX->cursorOffset = 0;
+ pTDFX->cursorOffset = 0+16*1024;
#if 0
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Cursor Offset: [0x%08X,0x%08X)\n",
@@ -1724,6 +1752,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
allocateMemory(pScrn);
+#if 0
if (pTDFX->numChips>1) {
if (xf86ReturnOptValBool(TDFXOptions, OPTION_NO_SLI, FALSE)) {
TDFXSetupSLI(pScrn, FALSE, 0);
@@ -1731,13 +1760,14 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
TDFXSetupSLI(pScrn, TRUE, 0);
}
}
+#endif
TDFXSetLFBConfig(pTDFX);
/* We initialize in the state that our FIFO is up to date */
pTDFX->syncDone=TRUE;
#ifdef PROP_3DFX
- if (!TDFXInitPrivate(pScreen)) {
+ if (!TDFXInitFifo(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize private\n");
return FALSE;
}
@@ -1745,7 +1775,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
pTDFX->sync=TDFXSync;
#endif
- maxy=pScrn->virtualY+128;
+ maxy=pScrn->virtualY+PIXMAP_CACHE_LINES;
MemBox.y1 = pScrn->virtualY;
MemBox.x1 = 0;
MemBox.x2 = pScrn->displayWidth;
@@ -1756,6 +1786,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
TDFXSave(pScrn);
if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ TDFXSetLFBConfig(pTDFX);
+
miClearVisualTypes();
if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
@@ -1764,16 +1796,15 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
miSetPixmapDepths ();
+ pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE);
#ifdef XF86DRI
/*
* Setup DRI after visuals have been established, but before fbScreenInit
* is called. fbScreenInit will eventually call into the drivers
* InitGLXVisuals call back.
*/
- pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen);
- /* Force the initialization of the context */
- if (pTDFX->directRenderingEnabled)
- TDFXLostContext(pScreen);
+ if (!pTDFX->NoAccel)
+ pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen);
#endif
switch (pScrn->bitsPerPixel) {
@@ -1823,7 +1854,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
}
REGION_UNINIT(pScreen, &MemRegion);
- pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE);
if (!pTDFX->NoAccel) {
if (!TDFXAccelInit(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1863,19 +1893,23 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
#endif
#ifdef XF86DRI
+ if (!pTDFX->NoAccel) {
if (pTDFX->directRenderingEnabled) {
/* Now that mi, fb, drm and others have done their thing,
* complete the DRI setup.
*/
pTDFX->directRenderingEnabled = TDFXDRIFinishScreenInit(pScreen);
}
- if (pTDFX->directRenderingEnabled) {
+ }
+ if (pTDFX->directRenderingEnabled) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n");
- } else {
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n");
- }
+ }
#endif
+#if 0
+ /* Disable for now, not up with latest XFree release */
#ifdef XvExtension
{
XF86VideoAdaptorPtr *ptr;
@@ -1887,6 +1921,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
}
}
#endif
+#endif
pScreen->SaveScreen = TDFXSaveScreen;
pTDFX->CloseScreen = pScreen->CloseScreen;
@@ -1932,12 +1967,12 @@ TDFXEnterVT(int scrnIndex, int flags) {
TDFXTRACE("TDFXEnterVT start\n");
pScrn = xf86Screens[scrnIndex];
+ InstallFifo(pScrn);
#ifdef XF86DRI
pTDFX = TDFXPTR(pScrn);
if (pTDFX->directRenderingEnabled) {
pScreen = screenInfo.screens[scrnIndex];
DRIUnlock(pScreen);
- TDFXLostContext(pScreen);
}
#endif
if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE;
@@ -1960,11 +1995,12 @@ TDFXLeaveVT(int scrnIndex, int flags) {
TDFXRestore(pScrn);
vgaHWLock(hwp);
pScreen = screenInfo.screens[scrnIndex];
+ TDFXShutdownFifo(pScreen);
#ifdef XF86DRI
pTDFX = TDFXPTR(pScrn);
if (pTDFX->directRenderingEnabled) {
DRILock(pScreen, 0);
- TDFXSwapContextPrivate(pScreen);
+ TDFXSwapContextFifo(pScreen);
}
#endif
}
@@ -1988,9 +2024,7 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen)
}
#endif
-#ifdef PROP_3DFX
- TDFXShutdownPrivate(pScreen);
-#endif
+ TDFXShutdownFifo(pScreen);
if (pScrn->vtSema) {
TDFXRestore(pScrn);
@@ -2057,7 +2091,7 @@ TDFXBlankScreen(ScrnInfoPtr pScrn, Bool unblank)
scrn |= 0x20; /* blank screen */
}
- vgaHWSeqReset(hwp, TRUE);
+ vgaHWSeqReset(hwp, TRUE);
hwp->writeSeq(hwp, 0x01, scrn); /* change mode */
vgaHWSeqReset(hwp, FALSE);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
index 41d9d2270..ce7a157ec 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
@@ -1,9 +1,6 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.10 2000/06/21 21:40:04 tsi Exp $ */
-#if 0
-#include <sys/time.h>
-#endif
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
@@ -23,7 +20,7 @@
C - D-1 : Z buffer
*/
-void TDFXSendNOPPrivate3D(ScrnInfoPtr pScrn)
+void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
@@ -33,7 +30,7 @@ void TDFXSendNOPPrivate3D(ScrnInfoPtr pScrn)
WRITE_FIFO(pTDFX, 0, 0);
}
-void TDFXSendNOPPrivate2D(ScrnInfoPtr pScrn)
+void TDFXSendNOPFifo2D(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
@@ -47,10 +44,10 @@ void TDFXSendNOPPrivate2D(ScrnInfoPtr pScrn)
WRITE_FIFO(pTDFX, SST_2D_COMMAND, SST_2D_NOP|SST_2D_GO);
}
-void TDFXSendNOPPrivate(ScrnInfoPtr pScrn)
+void TDFXSendNOPFifo(ScrnInfoPtr pScrn)
{
- TDFXSendNOPPrivate2D(pScrn);
- TDFXSendNOPPrivate3D(pScrn);
+ TDFXSendNOPFifo2D(pScrn);
+ TDFXSendNOPFifo3D(pScrn);
}
void InstallFifo(ScrnInfoPtr pScrn)
@@ -78,7 +75,7 @@ void InstallFifo(ScrnInfoPtr pScrn)
pTDFX->fifoPtr = pTDFX->fifoBase;
pTDFX->fifoSlots = (pTDFX->fifoSize>>2) - 1;
pTDFX->fifoEnd = pTDFX->fifoBase+pTDFX->fifoSlots;
- TDFXSendNOPPrivate(pScrn);
+ TDFXSendNOPFifo(pScrn);
}
void TDFXResetFifo(ScrnInfoPtr pScrn)
@@ -122,15 +119,16 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn)
TDFXPtr pTDFX;
int i, cnt;
int stat;
- long start_sec, end_sec, dummy;
+ long start_sec, end_sec, dummy, readptr;
TDFXTRACEACCEL("TDFXSyncFifo start\n");
pTDFX=TDFXPTR(pScrn);
- TDFXSendNOPPrivate(pScrn);
+ TDFXSendNOPFifo(pScrn);
i=0;
cnt=0;
start_sec=0;
do {
+ readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0);
stat=TDFXReadLongMMIO(pTDFX, 0);
if (stat&SST_BUSY) i=0; else i++;
cnt++;
@@ -140,7 +138,9 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn)
} else {
getsecs(&end_sec, &dummy);
if (end_sec-start_sec>3) {
- TDFXResetFifo(pScrn);
+ dummy=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0);
+ if (dummy=readptr)
+ TDFXResetFifo(pScrn);
start_sec=0;
}
}
@@ -152,7 +152,7 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn)
pTDFX->prevBlitDest.x2=pTDFX->prevBlitDest.y2=0;
}
-Bool TDFXInitPrivate(ScreenPtr pScreen)
+Bool TDFXInitFifo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn;
TDFXPtr pTDFX;
@@ -172,7 +172,7 @@ Bool TDFXInitPrivate(ScreenPtr pScreen)
return TRUE;
}
-void TDFXShutdownPrivate(ScreenPtr pScreen)
+void TDFXShutdownFifo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn;
TDFXPtr pTDFX;
@@ -200,7 +200,7 @@ GetReadPtr(TDFXPtr pTDFX)
}
#ifdef XF86DRI
-void TDFXSwapContextPrivate(ScreenPtr pScreen)
+void TDFXSwapContextFifo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn;
TDFXPtr pTDFX;
@@ -240,24 +240,6 @@ void TDFXSwapContextPrivate(ScreenPtr pScreen)
pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8;
}
-void TDFXLostContext(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn;
- TDFXPtr pTDFX;
- TDFXSAREAPriv *sPriv;
-
- pScrn = xf86Screens[pScreen->myNum];
- pTDFX=TDFXPTR(pScrn);
- sPriv=(TDFXSAREAPriv*)DRIGetSAREAPrivate(pScreen);
- if (!sPriv) return;
- if (sPriv->fifoPtr!=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase) ||
- sPriv->fifoRead!=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase)) {
- sPriv->fifoPtr=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase);
- sPriv->fifoRead=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase);
- sPriv->fifoOwner=DRIGetContext(pScreen);
- /* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */
- }
-}
#endif
static void
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h
index 657992d21..2437de898 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h
@@ -11,7 +11,7 @@ typedef int int32;
typedef short int16;
typedef char int8;
-#define CMDFIFO_PAGES 64
+#define CMDFIFO_PAGES 255
#define PROPSAREADATA \
volatile int fifoPtr; \
@@ -58,7 +58,7 @@ typedef char int8;
#endif
#define DECLARE SET_PKT2_HEADER
#define DECLARE_LAUNCH SET_PK1_HEADER_LAUNCH
-#define TDFXSendNOP TDFXSendNOPPrivate
+#define TDFXSendNOP TDFXSendNOPFifo
/*
** Structures for Banshee AGP/CMD Transfer/MISC registers.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c
index 07d4a711e..390b9b711 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c
@@ -12,7 +12,7 @@
/* #define RD_ABORT_ERROR */
#define H3VDD
-static Bool TDFXDisableSLI(TDFXPtr pTDFX)
+Bool TDFXDisableSLI(TDFXPtr pTDFX)
{
int i;
int v;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
index 850f35398..cf195f16b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
@@ -201,6 +201,7 @@
#define SST_3D_CHIPMASK SST_3D_OFFSET+0x214
/* NAPALM REGISTERS */
+#define CFG_PCI_COMMAND 4
#define CFG_MEM0BASE 16
#define CFG_MEM1BASE 20
#define CFG_INIT_ENABLE 64
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c
index 04ad36259..8fea7a726 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c
@@ -23,7 +23,7 @@
*
* Trident Blade3D accelerated options.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.8 2000/11/03 18:46:13 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.10 2000/11/28 00:04:39 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -71,11 +71,12 @@ static void BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
static void BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int srcx, int srcy,
int offset);
-static void BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn,
+static void BladeSetupForScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask);
-static void BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn,
+static void BladeSubsequentScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int skipleft);
+static void BladeSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
static void BladeSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2);
static void BladeDisableClipping(ScrnInfoPtr pScrn);
@@ -91,11 +92,12 @@ static void BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
static void BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
int patternx, int patterny, int x, int y,
int w, int h);
-static void BladeSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
+static void BladeSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
unsigned int planemask, int transparency_color,
int bpp, int depth);
-static void BladeSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y,
- int w, int h, int skipleft);
+static void BladeSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x,
+ int y, int w, int h, int skipleft);
+static void BladeSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
static void
BladeInitializeAccelerator(ScrnInfoPtr pScrn)
@@ -128,10 +130,14 @@ BladeInitializeAccelerator(ScrnInfoPtr pScrn)
BLADE_OUT(0x21BC, stride);
BLADE_OUT(0x21C0, stride);
BLADE_OUT(0x21C4, stride);
+#if 0
+ /* It appears that the driver sometimes misdetects the RAM type, so we
+ * don't force this for now */
if (pTrident->HasSGRAM)
BLADE_OUT(0x2168, 1<<26); /* Enables Block Write if available (SGRAM) */
else
BLADE_OUT(0x2168, 0);
+#endif
BLADE_OUT(0x216C, 0);
}
@@ -214,20 +220,32 @@ BladeAccelInit(ScreenPtr pScreen)
#endif
infoPtr->CPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD |
+ NO_TRANSPARENCY |
LEFT_EDGE_CLIPPING |
LEFT_EDGE_CLIPPING_NEGATIVE_X |
- SYNC_AFTER_COLOR_EXPAND |
+ NO_PLANEMASK |
BIT_ORDER_IN_BYTE_MSBFIRST |
SCANLINE_PAD_DWORD;
infoPtr->ColorExpandRange = 0x10000;
infoPtr->ColorExpandBase = pTrident->IOBase + 0x10000;
infoPtr->SetupForCPUToScreenColorExpandFill =
- BladeSetupForCPUToScreenColorExpand;
+ BladeSetupForScanlineCPUToScreenColorExpand;
infoPtr->SubsequentCPUToScreenColorExpandFill =
- BladeSubsequentCPUToScreenColorExpand;
+ BladeSubsequentScanlineCPUToScreenColorExpand;
+ infoPtr->SubsequentColorExpandScanline =
+ BladeSubsequentColorExpandScanline;
+
+ pTrident->XAAScanlineColorExpandBuffers[0] =
+ xnfalloc(((pScrn->virtualX + 63)) *4* (pScrn->bitsPerPixel / 8));
+
+ infoPtr->NumScanlineColorExpandBuffers = 1;
+ infoPtr->ScanlineColorExpandBuffers =
+ pTrident->XAAScanlineColorExpandBuffers;
- infoPtr->SetupForImageWrite = BladeSetupForImageWrite;
- infoPtr->SubsequentImageWriteRect = BladeSubsequentImageWriteRect;
+ infoPtr->SetupForImageWrite = BladeSetupForScanlineImageWrite;
+ infoPtr->SubsequentImageWriteRect = BladeSubsequentScanlineImageWriteRect;
+ infoPtr->SubsequentImageWriteScanline =
+ BladeSubsequentImageWriteScanline;
infoPtr->ImageWriteFlags = NO_PLANEMASK |
NO_TRANSPARENCY |
LEFT_EDGE_CLIPPING_NEGATIVE_X |
@@ -236,6 +254,11 @@ BladeAccelInit(ScreenPtr pScreen)
SYNC_AFTER_IMAGE_WRITE;
infoPtr->ImageWriteBase = pTrident->IOBase + 0x10000;
infoPtr->ImageWriteRange = 0x10000;
+ infoPtr->NumScanlineImageWriteBuffers = 1;
+ infoPtr->ScanlineImageWriteBuffers = pTrident->XAAImageScanlineBuffer;
+
+ pTrident->XAAImageScanlineBuffer[0] =
+ xnfalloc(pScrn->virtualX * pScrn->bitsPerPixel / 8);
AvailFBArea.x1 = 0;
AvailFBArea.y1 = 0;
@@ -558,8 +581,36 @@ BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
IMAGE_OUT(0x24, 0x80000000 | 3<<22 | 1<<7 | pTrident->BltScanDirection | (pTrident->ROP == GXcopy ? 0 : 1<<10) | offset<<25);
}
+static void MoveDWORDS(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *(src + 1);
+ *(dest + 2) = *(src + 2);
+ *(dest + 3) = *(src + 3);
+ src += 4;
+ dest += 4;
+ dwords -= 4;
+ }
+ if (!dwords) return;
+ *dest = *src;
+ dest += 1;
+ src += 1;
+ if (dwords == 1) return;
+ *dest = *src;
+ dest += 1;
+ src += 1;
+ if (dwords == 2) return;
+ *dest = *src;
+ dest += 1;
+ src += 1;
+}
+
static void
-BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn,
+BladeSetupForScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask)
{
@@ -587,7 +638,7 @@ BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn,
}
static void
-BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn,
+BladeSubsequentScanlineCPUToScreenColorExpand(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int skipleft)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
@@ -596,34 +647,23 @@ BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn,
BLADE_OUT(0x2144, 0xE0000000 | pTrident->BltScanDirection | 1<<4 | (skipleft ? 1 : 0));
BLADE_OUT(0x2108, (y&0xfff)<<16 | (x&0xfff));
BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff));
+ pTrident->dwords = (w + 31) >> 5;
+ pTrident->h = h;
}
-static void MoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
+static void
+BladeSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
- while(dwords & ~0x03) {
- *dest = *src;
- *(dest + 1) = *(src + 1);
- *(dest + 2) = *(src + 2);
- *(dest + 3) = *(src + 3);
- src += 4;
- dest += 4;
- dwords -= 4;
- }
- if (!dwords) return;
- *dest = *src;
- dest += 1;
- src += 1;
- if (dwords == 1) return;
- *dest = *src;
- dest += 1;
- src += 1;
- if (dwords == 2) return;
- *dest = *src;
- dest += 1;
- src += 1;
+ TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+ XAAInfoRecPtr infoRec;
+ infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ MoveDWORDS((CARD32*)infoRec->ColorExpandBase,
+ (CARD32*)pTrident->XAAScanlineColorExpandBuffers[bufno], pTrident->dwords);
+
+ pTrident->h--;
+ if (!pTrident->h)
+ BladeSync(pScrn);
}
static void
@@ -719,7 +759,7 @@ BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
CHECKCLIPPING;
}
-static void BladeSetupForImageWrite(
+static void BladeSetupForScanlineImageWrite(
ScrnInfoPtr pScrn,
int rop,
unsigned int planemask,
@@ -737,15 +777,33 @@ static void BladeSetupForImageWrite(
}
}
-static void BladeSubsequentImageWriteRect(
+static void BladeSubsequentScanlineImageWriteRect(
ScrnInfoPtr pScrn,
int x, int y, int w, int h,
int skipleft
){
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+ pTrident->dwords = ((w * (pScrn->bitsPerPixel/8)) + 3) >> 2;
+ pTrident->h = h;
+
if (skipleft) BladeSetClippingRectangle(pScrn,x+skipleft,y,(x+w-1),(y+h-1));
BLADE_OUT(0x2144, 0xE0000000 | 1<<19 | 1<<4 | pTrident->BltScanDirection | (skipleft ? 1 : 0));
- BLADE_OUT(0x2108, y<<16 | x);
+ BLADE_OUT(0x2108, y<<16 | (x&0xfff));
BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff));
}
+
+static void
+BladeSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
+{
+ TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+ XAAInfoRecPtr infoRec;
+ infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ MoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)pTrident->XAAImageScanlineBuffer[bufno], pTrident->dwords);
+
+ pTrident->h--;
+ if (!pTrident->h)
+ BladeSync(pScrn);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
index b30f32fc6..453d33e2e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
@@ -21,7 +21,7 @@
*
* Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.28 2000/11/03 18:46:13 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.29 2000/11/26 10:08:52 alanh Exp $ */
#ifndef _TRIDENT_H_
#define _TRIDENT_H_
@@ -240,7 +240,7 @@ typedef enum {
CYBER9397DVD,
CYBER9520,
CYBER9525DVD,
- CYBER9540,
+ CYBERBLADEE4,
IMAGE975,
IMAGE985,
BLADE3D,
@@ -265,6 +265,7 @@ typedef enum {
(pTrident->Chipset == CYBER9397DVD) || \
(pTrident->Chipset == CYBER9520) || \
(pTrident->Chipset == CYBER9525DVD) || \
+ (pTrident->Chipset == CYBERBLADEE4) || \
(pTrident->Chipset == IMAGE975) || \
(pTrident->Chipset == IMAGE985) || \
(pTrident->Chipset == CYBERBLADEI7) || \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c
index f0d8824c6..905c44497 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c
@@ -23,7 +23,7 @@
*
* Trident accelerated options.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.16 2000/11/03 18:46:13 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.18 2000/11/16 20:11:30 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -91,12 +91,19 @@ static void
TridentInitializeAccelerator(ScrnInfoPtr pScrn)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+
/* This forces updating the clipper */
pTrident->Clipping = TRUE;
+
CHECKCLIPPING;
- if (pTrident->Chipset == PROVIDIA9682)
+
+ if ( (pTrident->Chipset == PROVIDIA9682) ||
+ (pTrident->Chipset == CYBER9385) ||
+ (pTrident->Chipset == CYBER9382) )
pTrident->EngineOperation |= 0x100; /* Disable Clipping */
+
TGUI_OPERMODE(pTrident->EngineOperation);
+
pTrident->PatternLocation = pScrn->displayWidth*pScrn->bitsPerPixel/8;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
index 05f529f68..849d25c78 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
@@ -21,7 +21,7 @@
*
* Author: Alan Hourihane, alanh@fairlite.demon.co.uk
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.28 2000/11/03 18:46:14 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.32 2000/11/27 23:07:27 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -314,6 +314,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
case CYBERBLADEI7D:
case CYBERBLADEI1:
case CYBERBLADEI1D:
+ case CYBERBLADEE4:
case BLADE3D:
OUTB(vgaIOBase + 4, RAMDACTiming);
pReg->tridentRegs3x4[RAMDACTiming] |= 0x0F;
@@ -321,7 +322,6 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* Fall Through */
case CYBER9520:
case CYBER9525DVD:
- case CYBER9540:
case CYBER9397DVD:
case CYBER9397:
case CYBER9388:
@@ -386,6 +386,10 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
offset = (pScrn->displayWidth * 3) >> 3;
pReg->tridentRegs3x4[PixelBusReg] = 0x29;
pReg->tridentRegsDAC[0x00] = 0xD0;
+ if (pTrident->Chipset == CYBERBLADEE4) {
+ OUTB(vgaIOBase+ 4, New32);
+ pReg->tridentRegs3x4[New32] = INB(vgaIOBase + 5) & 0x7F;
+ }
break;
case 32:
pReg->tridentRegs3CE[MiscExtFunc] |= 0x02;
@@ -394,6 +398,12 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
offset = pScrn->displayWidth >> 1;
pReg->tridentRegs3x4[PixelBusReg] = 0x09;
pReg->tridentRegsDAC[0x00] = 0xD0;
+ if (pTrident->Chipset == CYBERBLADEE4) {
+ OUTB(vgaIOBase+ 4, New32);
+ pReg->tridentRegs3x4[New32] = INB(vgaIOBase + 5) | 0x80;
+ /* With new mode 32bpp we set the packed flag */
+ pReg->tridentRegs3x4[PixelBusReg] |= 0x20;
+ }
break;
}
pReg->tridentRegs3x4[Offset] = offset & 0xFF;
@@ -414,15 +424,19 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pReg->tridentRegs3C4[NewMode1] = 0xC0;
pReg->tridentRegs3C4[Protection] = 0x92;
- if (pTrident->Linear)
- pReg->tridentRegs3x4[LinearAddReg] = ((pTrident->FbAddress >> 24) << 6)|
- ((pTrident->FbAddress >> 20) & 0x0F)|
- 0x20;
- else {
+ pReg->tridentRegs3x4[LinearAddReg] = 0;
+ if (pTrident->Linear) {
+ /* This is used for VLB, when we support it again in 4.0 */
+ if (pTrident->Chipset < PROVIDIA9685)
+ pReg->tridentRegs3x4[LinearAddReg] |=
+ ((pTrident->FbAddress >> 24) << 6)|
+ ((pTrident->FbAddress >> 20) & 0x0F);
+ /* Turn on linear mapping */
+ pReg->tridentRegs3x4[LinearAddReg] |= 0x20;
+ } else {
pReg->tridentRegs3CE[MiscExtFunc] |= 0x04;
- pReg->tridentRegs3x4[LinearAddReg] = 0;
}
-
+
pReg->tridentRegs3x4[CRTCModuleTest] =
(mode->Flags & V_INTERLACE ? 0x84 : 0x80);
OUTB(vgaIOBase+ 4, InterfaceSel);
@@ -462,6 +476,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pReg->tridentRegs3x4[PCIReg] = INB(vgaIOBase + 5) & 0xF9;
else
pReg->tridentRegs3x4[PCIReg] = INB(vgaIOBase + 5) & 0xF8;
+
/* Enable PCI Bursting on capable chips */
if (pTrident->Chipset >= TGUI9660) {
if(pTrident->UsePCIBurst) {
@@ -523,7 +538,8 @@ TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg)
OUTW_3CE(MiscExtFunc);
OUTW_3x4(Offset);
if (pTrident->Chipset >= PROVIDIA9685) OUTW_3x4(Enhancement0);
- if (pTrident->Chipset >= BLADE3D) OUTW_3x4(RAMDACTiming);
+ if (pTrident->Chipset >= BLADE3D) OUTW_3x4(RAMDACTiming);
+ if (pTrident->Chipset == CYBERBLADEE4) OUTW_3x4(New32);
if (pTrident->IsCyber) {
CARD8 tmp;
@@ -622,7 +638,8 @@ TridentSave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg)
INB_3x4(PCIReg);
INB_3x4(PCIRetry);
if (pTrident->Chipset >= PROVIDIA9685) INB_3x4(Enhancement0);
- if (pTrident->Chipset >= BLADE3D) INB_3x4(RAMDACTiming);
+ if (pTrident->Chipset >= BLADE3D) INB_3x4(RAMDACTiming);
+ if (pTrident->Chipset == CYBERBLADEE4) INB_3x4(New32);
if (pTrident->IsCyber) {
CARD8 tmp;
INB_3CE(VertStretch);
@@ -716,7 +733,6 @@ TridentSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
vgaHWGetIOBase(VGAHWPTR(pScrn));
vgaIOBase = VGAHWPTR(pScrn)->IOBase;
-
if (x < 0) {
OUTW(vgaIOBase + 4, (-x)<<8 | 0x46);
x = 0;
@@ -780,6 +796,8 @@ TridentUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
if (pTrident->MUX && pScrn->bitsPerPixel == 8) return FALSE;
+ if (!pTrident->HWCursor) return FALSE;
+
return TRUE;
}
@@ -794,7 +812,7 @@ TridentHWCursorInit(ScreenPtr pScreen)
if (memory > (pScrn->videoRam * 1024 - 4096)) return FALSE;
infoPtr = xf86CreateCursorInfoRec();
if(!infoPtr) return FALSE;
-
+
pTrident->CursorInfoRec = infoPtr;
infoPtr->MaxWidth = 64;
@@ -864,7 +882,10 @@ void TridentLoadPalette(
vgaHWPtr hwp = VGAHWPTR(pScrn);
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
int i, index;
-
+ int sig;
+#if 0
+ sig = xf86BlockSIGIO ();
+#endif
for(i = 0; i < numColors; i++) {
index = indicies[i];
OUTB(0x3C6, 0xFF);
@@ -878,4 +899,8 @@ void TridentLoadPalette(
OUTB(0x3c9, colors[index].blue);
DACDelay(hwp);
}
+#if 0
+ xf86UnblockSIGIO (sig);
+#endif
}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
index a8a574d1a..191984040 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
@@ -28,7 +28,7 @@
* Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the
* clockchip programming code.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.108 2000/11/03 18:46:14 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.111 2000/11/26 10:08:52 alanh Exp $ */
#include "xf1bpp.h"
#include "xf4bpp.h"
@@ -143,7 +143,7 @@ static SymTabRec TRIDENTChipsets[] = {
{ CYBER9397DVD, "cyber9397dvd" },
{ CYBER9520, "cyber9520" },
{ CYBER9525DVD, "cyber9525dvd" },
- { CYBER9540, "cyber9540" },
+ { CYBERBLADEE4, "cyberblade/e4" },
{ TGUI9420DGi, "tgui9420dgi" },
{ TGUI9440AGi, "tgui9440agi" },
{ TGUI9660, "tgui9660" },
@@ -174,7 +174,7 @@ static PciChipsets TRIDENTPciChipsets[] = {
{ CYBER9397DVD, PCI_CHIP_939A, RES_SHARED_VGA },
{ CYBER9520, PCI_CHIP_9520, RES_SHARED_VGA },
{ CYBER9525DVD, PCI_CHIP_9525, RES_SHARED_VGA },
- { CYBER9540, PCI_CHIP_9540, RES_SHARED_VGA },
+ { CYBERBLADEE4, PCI_CHIP_9540, RES_SHARED_VGA },
{ TGUI9420DGi, PCI_CHIP_9420, RES_SHARED_VGA },
{ TGUI9440AGi, PCI_CHIP_9440, RES_SHARED_VGA },
{ TGUI9660, PCI_CHIP_9660, RES_SHARED_VGA },
@@ -425,8 +425,8 @@ static int ClockLimit32bpp[] = {
tridentLCD LCD[] = { /* 0 3 4 5 6 7 10 11 16 */
{ 0,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08},
{ 1,"800x600",40000,0x7f,0x99,0x69,0x99,0x72,0xf0,0x59,0x2d,0x5e,0x08},
- { 2,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08},
- { 3,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08}, /*0x96*/
+ { 2,"1024x768",65000,0xa3,/*0x6*/ 0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08},
+ { 3,"1024x768",65000,0xa3,/*0x6*/ 0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08}, /*0x96*/
{ 4,"1280x1024",108000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x25,0x96,0x08},
{ 5,"1024x600",50500 ,0xa3,0x6,0x8f,0xa0,0xb,0x3e,0xea,0x8c,0xb,0x08},
{ 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
@@ -435,7 +435,7 @@ tridentLCD LCD[] = { /* 0 3 4 5 6 7 10 11 16 */
tridentLCD LCD[] = {
{ 1,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08},
{ 3,"800x600",40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08},
- { 2,"1024x768",65000,0xa3,0x6,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08},
+ { 2,"1024x768",65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08},
{ 0,"1280x1024",108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8},
{ 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@@ -1584,19 +1584,12 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
chipset = "Cyber 9525/DVD";
pTrident->NewClockCode = TRUE;
break;
- case CYBER9540:
+ case CYBERBLADEE4:
pTrident->ddc1Read = Tridentddc1Read;
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x04)
- ramtype = "EDO Ram";
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x08)
- ramtype = "SDRAM";
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x0C) {
- pTrident->HasSGRAM = TRUE;
- ramtype = "SGRAM";
- }
+ ramtype = "SDRAM";
pTrident->IsCyber = TRUE;
Support24bpp = TRUE;
- chipset = "Cyber 9540";
+ chipset = "CyberBlade e4/128";
pTrident->NewClockCode = TRUE;
break;
case IMAGE975:
@@ -1642,12 +1635,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
break;
case CYBERBLADEI7:
pTrident->ddc1Read = Tridentddc1Read;
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x08)
- ramtype = "SDRAM";
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x0C) {
- pTrident->HasSGRAM = TRUE;
- ramtype = "SGRAM";
- }
+ ramtype = "SDRAM";
pTrident->IsCyber = TRUE;
Support24bpp = TRUE;
chipset = "CyberBlade/i7";
@@ -1656,12 +1644,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
break;
case CYBERBLADEI7D:
pTrident->ddc1Read = Tridentddc1Read;
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x08)
- ramtype = "SDRAM";
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x0C) {
- pTrident->HasSGRAM = TRUE;
- ramtype = "SGRAM";
- }
+ ramtype = "SDRAM";
pTrident->IsCyber = TRUE;
Support24bpp = TRUE;
chipset = "CyberBlade/DSTN/i7";
@@ -1670,12 +1653,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
break;
case CYBERBLADEI1:
pTrident->ddc1Read = Tridentddc1Read;
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x08)
- ramtype = "SDRAM";
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x0C) {
- pTrident->HasSGRAM = TRUE;
- ramtype = "SGRAM";
- }
+ ramtype = "SDRAM";
pTrident->IsCyber = TRUE;
Support24bpp = TRUE;
chipset = "CyberBlade/i1";
@@ -1684,12 +1662,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
break;
case CYBERBLADEI1D:
pTrident->ddc1Read = Tridentddc1Read;
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x08)
- ramtype = "SDRAM";
- if ((INB(vgaIOBase + 5) & 0x0C) == 0x0C) {
- pTrident->HasSGRAM = TRUE;
- ramtype = "SGRAM";
- }
+ ramtype = "SDRAM";
pTrident->IsCyber = TRUE;
Support24bpp = TRUE;
chipset = "CyberBlade/DSTN/i1";
@@ -1750,9 +1723,13 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
case 0x04: /* 8MB, but - hw cursor can't store above 4MB */
/* So, we force to 4MB for now */
/* pScrn->videoRam = 8192; */
+
+ if (pTrident->HWCursor) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Found 8MB board, using 4MB\n");
+ "Found 8MB board, using 4MB\n");
pScrn->videoRam = 4096;
+ } else
+ pScrn->videoRam = 8192;
break;
case 0x07:
pScrn->videoRam = 2048;
@@ -2202,7 +2179,7 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
case CYBERBLADEI1D:
case CYBER9520:
case CYBER9525DVD:
- case CYBER9540:
+ case CYBERBLADEE4:
case CYBER9397:
case CYBER9397DVD:
/* Get ready for MUX mode */
@@ -2499,6 +2476,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
(pTrident->Chipset == CYBERBLADEI7D) ||
(pTrident->Chipset == CYBERBLADEI1) ||
(pTrident->Chipset == CYBERBLADEI1D) ||
+ (pTrident->Chipset == CYBERBLADEE4) ||
(pTrident->Chipset == BLADE3D))
BladeAccelInit(pScreen);
else
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h
index 8de17c25b..22b1bedd4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h
@@ -21,7 +21,7 @@
*
* Author: Alan Hourihane, alanh@fairlite.demon.co.uk
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.13 2000/08/04 16:13:35 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.15 2000/11/28 00:04:39 alanh Exp $ */
#define DEBUG 1
@@ -53,6 +53,7 @@
#define FIFOControl 0x20
#define LinearAddReg 0x21
#define DRAMTiming 0x23
+#define New32 0x23
#define RAMDACTiming 0x25
#define CRTHiOrd 0x27
#define AddColReg 0x29
@@ -324,7 +325,7 @@
#define IMAGEBUSY(b) \
(b = MMIO_IN32(pTrident->IOBase,IMAGE_GE_STATUS) & 0xF0000000)
#define BLADEBUSY(b) \
- (b = MMIO_IN32(pTrident->IOBase,BLADE_GE_STATUS) & 0xFE800000)
+ (b = MMIO_IN32(pTrident->IOBase,BLADE_GE_STATUS) & 0xF0000000)
#define IMAGE_OUT(addr, c) \
MMIO_OUT32(pTrident->IOBase, addr, (c))
#define BLADE_OUT(addr, c) \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c
index a6defb300..26d0f11d0 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c,v 1.1 2000/11/03 18:46:14 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c,v 1.2 2000/11/16 19:45:01 eich Exp $ */
/*
Copyright (c) 1999, 2000 The XFree86 Project Inc.
@@ -256,3 +256,4 @@ TRIDENTRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
}
}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c
index 2d365d9ba..92d1e151f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.75 2000/11/03 18:46:15 eich Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.76 2000/11/16 19:45:01 eich Exp $
*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -2142,7 +2142,7 @@ TsengScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!miCreateDefColormap(pScreen))
return FALSE;
- if (pScrn->depth == 4 || pScrn->depth == 8) { /* cfb and xf4bpp */
+ if (pScrn->depth == 4 || pScrn->depth == 8) { /* fb and xf4bpp */
vgaHWHandleColormaps(pScreen);
}
pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c
index 558652a18..68b7adf65 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c
@@ -26,7 +26,7 @@
*
* Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.4 2000/10/27 18:31:04 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.6 2000/11/14 16:54:54 dawes Exp $
*/
#include "vesa.h"
@@ -118,7 +118,7 @@ static IsaChipsets VESAISAchipsets[] = {
};
typedef enum {
- OPTION_SHADOW_FB,
+ OPTION_SHADOW_FB
} VESAOpts;
static OptionInfoRec VESAOptions[] = {
@@ -1621,12 +1621,13 @@ VESASaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
Bool on = xf86IsUnblank(mode);
- unsigned char scrn = ReadSeq(0x01);
if (on)
SetTimeSinceLastInputEvent();
if (pScrn->vtSema) {
+ unsigned char scrn = ReadSeq(0x01);
+
if (on)
scrn &= ~0x20;
else
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c b/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c
index 9649216b3..ef0dfc062 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.46 2000/11/03 18:46:15 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.47 2000/11/16 19:45:02 eich Exp $ */
/*
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -278,8 +278,8 @@ GenericProbe(DriverPtr drv, int flags)
pScrn->ValidMode = GenericValidMode;
foundScreen = TRUE;
}
- xfree(usedChips);
}
+ xfree(usedChips);
}
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/dummylib/Imakefile b/xc/programs/Xserver/hw/xfree86/dummylib/Imakefile
index d6520ea99..9e985f814 100644
--- a/xc/programs/Xserver/hw/xfree86/dummylib/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/dummylib/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/Imakefile,v 1.1 2000/02/13 03:06:38 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/Imakefile,v 1.2 2000/11/16 19:45:02 eich Exp $
#include <Server.tmpl>
@@ -25,7 +25,8 @@ SRCS = \
xf86opt.c \
xf86screens.c \
xf86servisinit.c \
- xf86verbose.c
+ xf86verbose.c \
+ sigiostubs.c
OBJS = \
fatalerror.o \
@@ -47,8 +48,10 @@ OBJS = \
xf86opt.o \
xf86screens.o \
xf86servisinit.o \
- xf86verbose.o
+ xf86verbose.o \
+ sigiostubs.o
+LinkSourceFile(sigiostubs.c,../os-support/shared)
NormalLibraryObjectRule()
NormalLibraryTarget(dummy,$(OBJS))
diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def
index 2d926a581..643edd2ef 100644
--- a/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def
+++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def
@@ -6,7 +6,7 @@
* - XFree86 doctools package (requires groff)
* - nroff/troff or groff
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.4 2000/03/03 23:16:25 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.5 2000/11/28 18:50:22 dawes Exp $
*/
#define HasSgmlFmt YES
@@ -14,6 +14,9 @@
#define InstallJapaneseDocs YES
#define BuildSpecsDocs YES
-#define SpecsDocDirs GL Xext Xv xterm
+#define SpecsDocDirs BDF CTEXT FSProtocol ICCCM \
+ /*XProtocol*/ Xserver X11 XDMCP XLFD Xaw \
+ Xmu Xt Xext /*Xi*/ xfs /*PEX5*/ ICE SM xtrans \
+ xterm rstart GL Xv /*i18n*/ programs
diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h
index 7c5c6c4cd..151b64ae7 100644
--- a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h
@@ -1,4 +1,10 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.8 2000/10/20 14:59:01 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.9 2000/11/18 19:37:14 tsi Exp $ */
+
+#ifndef _FBDEVHW_H_
+#define _FBDEVHW_H_
+
+#include "xf86str.h"
+#include "colormapst.h"
#define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */
#define FBDEVHW_PLANES 1 /* Non interleaved planes */
@@ -40,3 +46,5 @@ void fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags);
Bool fbdevHWEnterVT(int scrnIndex, int flags);
void fbdevHWLeaveVT(int scrnIndex, int flags);
void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c
index 517c87500..5fb55c3e4 100644
--- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c
+++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c
@@ -25,7 +25,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.4 2000/11/03 13:13:31 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.5 2000/11/21 23:10:37 tsi Exp $ */
/*
* Based, in part, on code with the following copyright notice:
@@ -120,19 +120,13 @@ char version[]="Touch Driver V2.04 (c) 1999-2000 Citron GmbH";
#define NEED_XF86_TYPES
/*#include <xf86Version.h>*/
#include <xf86_ansic.h>
-/* #define XF86_OS_PRIVS for xf86SoundKbdBell */
#include <xf86_OSproc.h>
#include <xf86Optrec.h>
#include <xf86Xinput.h>
#include <xisb.h>
-#include <exevents.h> /* Needed for InitValuator/Proximity stuff*/
+#include <exevents.h> /* Needed for InitValuator/Proximity stuff*/
-/* I have to explicit declare this function, because I get an error if I compile */
-/* with "#define XF86_OS_PRIVS". I also have to put a "SYMVAR(xf86SoundKbdBell)" */
-/* statement into the "/loader/xf86sym.c file" to be able to access this function (PK) */
-extern void xf86SoundKbdBell(int loudness, int pitch, int duration);
-
/* #define CI_TIM */ /* Enable timer */
#define CIT_BEEP /* enable beep feature */
diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
index 601256fcc..19f01fdcc 100644
--- a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
+++ b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
@@ -1,6 +1,6 @@
/* $XConsortium: xf86Wacom.c /main/20 1996/10/27 11:05:20 kaleb $ */
/*
- * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ * Copyright 1995-2000 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/input/wacom/xf86Wacom.c,v 1.19 2000/08/11 19:10:49 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.20 2000/11/14 17:33:00 dawes Exp $ */
/*
* This driver is only able to handle the Wacom IV and Wacom V protocols.
@@ -49,7 +49,7 @@
*
*/
-static const char identification[] = "$Identification: 18 $";
+static const char identification[] = "$Identification: 19 $";
#include <xf86Version.h>
@@ -290,6 +290,7 @@ typedef struct _WacomCommonRec
int wcmThreshold; /* Threshold for counting pressure as a button */
WacomDeviceState wcmDevStat[2]; /* device state for each tool */
int wcmInitNumber; /* magic number for the init phasis */
+ unsigned int wcmLinkSpeed; /* serial link speed */
} WacomCommonRec, *WacomCommonPtr;
/******************************************************************************
@@ -323,6 +324,7 @@ typedef struct _WacomCommonRec
#define RESOLUTION_X 20
#define RESOLUTION_Y 21
#define RESOLUTION_Z 22
+#define USB 23
#if !defined(sun) || defined(i386)
static SymTabRec WcmTab[] = {
@@ -349,6 +351,7 @@ static SymTabRec WcmTab[] = {
{ RESOLUTION_X, "resolutionx" },
{ RESOLUTION_Y, "resolutiony" },
{ RESOLUTION_Z, "resolutionz" },
+ { USB, "usb" },
{ -1, "" }
};
@@ -368,6 +371,7 @@ static SymTabRec ModeTabRec[] = {
/******************************************************************************
* constant and macros declarations
*****************************************************************************/
+#define DEFAULT_MAXZ 240 /* default value of MaxZ when nothing is configured */
#define BUFFER_SIZE 256 /* size of reception buffer */
#define XI_STYLUS "STYLUS" /* X device name for the stylus */
#define XI_CURSOR "CURSOR" /* X device name for the cursor */
@@ -410,6 +414,7 @@ static const char * penpartner_setup_string = WC_PRESSURE_MODE WC_START;
#define WC_V_MULTI "MT1\r"
#define WC_V_ID "ID1\r"
#define WC_V_19200 "BA19\r"
+#define WC_V_38400 "BA38\r"
/* #define WC_V_9600 "BA96\r" */
#define WC_V_9600 "$\r"
@@ -717,11 +722,14 @@ xf86WcmConfig(LocalDevicePtr *array,
if (xf86GetToken(NULL) != NUMBER)
xf86ConfigError("Option number expected");
switch(val->num) {
+ case 38400:
+ common->wcmLinkSpeed = 38400;
+ break;
case 19200:
- common->wcmFlags = common->wcmFlags | BAUD_19200_FLAG;
+ common->wcmLinkSpeed = 19200;
break;
case 9600:
- common->wcmFlags = common->wcmFlags & ~BAUD_19200_FLAG;
+ common->wcmLinkSpeed = 9600;
break;
default:
xf86ConfigError("Illegal speed value");
@@ -791,6 +799,10 @@ xf86WcmConfig(LocalDevicePtr *array,
ErrorF("%s Wacom resolution y = %d\n", XCONFIG_GIVEN, common->wcmResolZ);
break;
+ case USB:
+ /* local->read_input=xf86WcmReadUSBInput; */
+ break;
+
case EOF:
FatalError("Unexpected EOF (missing EndSubSection)");
break;
@@ -1721,17 +1733,17 @@ xf86WcmReadInput(LocalDevicePtr local)
((common->wcmData[3] & ZAXIS_BIT) >> 2);
if (common->wcmMaxZ == 512) {
- z = z*2 + ((common->wcmData[0] & ZAXIS_BIT) >> 2);
+ z = z*4 + ((common->wcmData[0] & ZAXIS_BIT) >> 1);
if (common->wcmData[6] & ZAXIS_SIGN_BIT) {
- z -= 256;
+ z /= 2;
}
DBG(10, ErrorF("graphire pressure(%c)=%d\n",
(common->wcmData[6] & ZAXIS_SIGN_BIT) ? '-' : '+', z));
}
else {
if (common->wcmData[6] & ZAXIS_SIGN_BIT) {
- z -= 128;
+ z /= 2;
}
}
@@ -1939,7 +1951,7 @@ xf86WcmReadInput(LocalDevicePtr local)
((common->wcmData[5] & 0x78) >> 3));
if ((common->wcmData[0] & 0xb8) == 0xa0) {
ds->pressure = (((common->wcmData[5] & 0x07) << 7) |
- (common->wcmData[6] & 0x7f)) - 512;
+ (common->wcmData[6] & 0x7f));
ds->buttons = (((common->wcmData[0]) & 0x06) |
(ds->pressure >= common->wcmThreshold));
}
@@ -2113,6 +2125,36 @@ xf86WcmOpen(LocalDevicePtr local)
DBG(1, ErrorF("initializing tablet\n"));
+ /* Set the speed of the serial link to 38400 */
+#ifdef XFREE86_V4
+ if (xf86SetSerialSpeed(local->fd, 38400) < 0) {
+ return !Success;
+ }
+#else
+ if (set_serial_speed(local->fd, B38400) == !Success)
+ return !Success;
+#endif
+
+ /* Send reset to the tablet */
+ SYSCALL(err = write(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
+ if (err == -1) {
+ ErrorF("Wacom write error : %s\n", strerror(errno));
+ return !Success;
+ }
+
+ /* Wait 250 mSecs */
+ WAIT(250);
+
+ /* Send reset to the tablet */
+ SYSCALL(err = write(local->fd, WC_RESET, strlen(WC_RESET)));
+ if (err == -1) {
+ ErrorF("Wacom write error : %s\n", strerror(errno));
+ return !Success;
+ }
+
+ /* Wait 75 mSecs */
+ WAIT(75);
+
/* Set the speed of the serial link to 19200 */
#ifdef XFREE86_V4
if (xf86SetSerialSpeed(local->fd, 19200) < 0) {
@@ -2201,7 +2243,7 @@ xf86WcmOpen(LocalDevicePtr local)
if (buffer[2] == 'G' && buffer[3] == 'D') {
DBG(2, ErrorF("detected an Intuos model\n"));
common->wcmProtocolLevel = 5;
- common->wcmMaxZ = 1024; /* max Z value */
+ common->wcmMaxZ = 1023; /* max Z value */
common->wcmResolX = 2540; /* X resolution in points/inch */
common->wcmResolY = 2540; /* Y resolution in points/inch */
common->wcmResolZ = 2540; /* Z resolution in points/inch */
@@ -2252,7 +2294,7 @@ xf86WcmOpen(LocalDevicePtr local)
* config header don't use buffer+xx because the header size
* varies on different tablets
*/
- if (sscanf(buffer, "%[^,],%d,%d,%d,%d", header, &a, &b, &common->wcmResolX, &common->wcmResolY) == 5) {
+ if (sscanf(buffer, "%[^,],%d,%d,%d,%d", &header, &a, &b, &common->wcmResolX, &common->wcmResolY) == 5) {
DBG(6, ErrorF("WC_CONFIG Header = %s\n", header));
}
else {
@@ -2264,7 +2306,6 @@ xf86WcmOpen(LocalDevicePtr local)
ErrorF("WACOM: unable to read resolution. Using default.\n");
common->wcmResolX = common->wcmResolY = 1270;
}
-
}
if (!(common->wcmFlags & GRAPHIRE_FLAG) && !(common->wcmMaxX && common->wcmMaxY)) {
@@ -2305,7 +2346,7 @@ xf86WcmOpen(LocalDevicePtr local)
* config header don't use buffer+xx because the header size
* varies on different tablets
*/
- if (sscanf(buffer, "%[^,],%d,%d,%d,%d", header, &a, &b, &common->wcmResolX, &common->wcmResolY) == 5) {
+ if (sscanf(buffer, "%[^,],%d,%d,%d,%d", &header, &a, &b, &common->wcmResolX, &common->wcmResolY) == 5) {
DBG(6, ErrorF("WC_CONFIG Header = %s\n", header));
}
else {
@@ -2396,12 +2437,37 @@ xf86WcmOpen(LocalDevicePtr local)
}
/* change the serial speed if requested */
- if (common->wcmFlags & BAUD_19200_FLAG) {
+ if (common->wcmLinkSpeed > 9600) {
if (common->wcmProtocolLevel == 5) {
- DBG(1, ErrorF("Switching serial link to 19200\n"));
-
- /* Switch the tablet to 19200 */
- SYSCALL(err = write(local->fd, WC_V_19200, strlen(WC_V_19200)));
+ char *speed_init_string = WC_V_19200;
+#ifndef XFREE86_V4
+ int speed = B19200;
+#endif
+ DBG(1, ErrorF("Switching serial link to %d\n", common->wcmLinkSpeed));
+
+ if (common->wcmLinkSpeed == 38400 && version < 2.0) {
+ ErrorF("Wacom: 38400 speed not supported with this Intuos firmware (%f)\n", version);
+ ErrorF("Switching to 19200\n");
+ common->wcmLinkSpeed = 19200;
+ }
+
+ switch (common->wcmLinkSpeed) {
+ case 38400:
+ speed_init_string = WC_V_38400;
+#ifndef XFREE86_V4
+ speed = B38400;
+#endif
+ break;
+
+ case 19200:
+ speed_init_string = WC_V_19200;
+#ifndef XFREE86_V4
+ speed = B19200;
+#endif
+ break;
+ }
+ /* Switch the tablet to the requested speed */
+ SYSCALL(err = write(local->fd, speed_init_string, strlen(speed_init_string)));
if (err == -1) {
ErrorF("Wacom write error : %s\n", strerror(errno));
return !Success;
@@ -2410,13 +2476,13 @@ xf86WcmOpen(LocalDevicePtr local)
/* Wait 75 mSecs */
WAIT(75);
- /* Set the speed of the serial link to 19200 */
+ /* Set the speed of the serial link to requested speed */
#ifdef XFREE86_V4
- if (xf86SetSerialSpeed(local->fd, 19200) < 0) {
+ if (xf86SetSerialSpeed(local->fd, common->wcmLinkSpeed) < 0) {
return !Success;
}
#else
- if (set_serial_speed(local->fd, B19200) == !Success)
+ if (set_serial_speed(local->fd, speed) == !Success)
return !Success;
#endif
}
@@ -2552,39 +2618,39 @@ xf86WcmOpenDevice(DeviceIntPtr pWcm)
/* Check threshold correctness */
DBG(2, ErrorF("Threshold=%d\n", common->wcmThreshold));
- if (common->wcmThreshold > ((common->wcmMaxZ / 2) - 1) ||
- common->wcmThreshold < - (common->wcmMaxZ / 2)) {
+ if (common->wcmThreshold > common->wcmMaxZ ||
+ common->wcmThreshold < 0) {
if (((common->wcmProtocolLevel == 5) ||
(common->wcmFlags & GRAPHIRE_FLAG)) &&
xf86Verbose &&
common->wcmThreshold != INVALID_THRESHOLD)
ErrorF("%s Wacom invalid threshold %d. Reset to %d\n",
- XCONFIG_PROBED, common->wcmThreshold, - (common->wcmMaxZ / 3));
- common->wcmThreshold = - (common->wcmMaxZ / 3);
+ XCONFIG_PROBED, common->wcmThreshold, common->wcmMaxZ / 3);
+ common->wcmThreshold = common->wcmMaxZ / 3;
}
DBG(2, ErrorF("New threshold=%d\n", common->wcmThreshold));
/* Set the real values */
InitValuatorAxisStruct(pWcm,
0,
- 0, /* min val */
+ 0, /* min val */
priv->bottomX - priv->topX, /* max val */
mils(common->wcmResolX), /* resolution */
- 0, /* min_res */
+ 0, /* min_res */
mils(common->wcmResolX)); /* max_res */
InitValuatorAxisStruct(pWcm,
1,
- 0, /* min val */
+ 0, /* min val */
priv->bottomY - priv->topY, /* max val */
mils(common->wcmResolY), /* resolution */
- 0, /* min_res */
+ 0, /* min_res */
mils(common->wcmResolY)); /* max_res */
InitValuatorAxisStruct(pWcm,
2,
- - common->wcmMaxZ / 2, /* min val */
- (common->wcmMaxZ / 2) - 1, /* max val */
+ 0, /* min val */
+ common->wcmMaxZ, /* max val */
mils(common->wcmResolZ), /* resolution */
- 0, /* min_res */
+ 0, /* min_res */
mils(common->wcmResolZ)); /* max_res */
InitValuatorAxisStruct(pWcm,
3,
@@ -2948,7 +3014,7 @@ xf86WcmAllocate(char * name,
common->wcmPktLength = 7; /* length of a packet */
common->wcmMaxX = 0; /* max X value */
common->wcmMaxY = 0; /* max Y value */
- common->wcmMaxZ = 240; /* max Z value */
+ common->wcmMaxZ = DEFAULT_MAXZ; /* max Z value */
common->wcmResolX = 0; /* X resolution in points/inch */
common->wcmResolY = 0; /* Y resolution in points/inch */
common->wcmResolZ = 1270; /* Z resolution in points/inch */
@@ -2958,6 +3024,7 @@ xf86WcmAllocate(char * name,
common->wcmProtocolLevel = 4; /* protocol level */
common->wcmThreshold = INVALID_THRESHOLD; /* button 1 threshold for some tablet models */
common->wcmInitNumber = 0; /* magic number for the init phasis */
+ common->wcmLinkSpeed = 9600; /* serial link speed */
return local;
}
@@ -3236,6 +3303,10 @@ xf86WcmInit(InputDriverPtr drv,
common->wcmFlags |= TILT_FLAG;
}
+ if (xf86SetBoolOption(local->options, "Usb", 0)) {
+ /*local->read_input = xf86WcmReadUSBInput;*/
+ }
+
if (xf86SetBoolOption(local->options, "KeepShape", 0)) {
priv->flags |= KEEP_SHAPE_FLAG;
xf86Msg(X_CONFIG, "%s: keeps shape\n", dev->identifier);
@@ -3279,8 +3350,8 @@ xf86WcmInit(InputDriverPtr drv,
xf86Msg(X_CONFIG, "%s: max x = %d\n", dev->identifier,
common->wcmMaxY);
}
- common->wcmMaxZ = xf86SetIntOption(local->options, "MaxZ", 0);
- if (common->wcmMaxZ != 0) {
+ common->wcmMaxZ = xf86SetIntOption(local->options, "MaxZ", DEFAULT_MAXZ);
+ if (common->wcmMaxZ != DEFAULT_MAXZ) {
xf86Msg(X_CONFIG, "%s: max x = %d\n", dev->identifier,
common->wcmMaxZ);
}
@@ -3305,14 +3376,17 @@ xf86WcmInit(InputDriverPtr drv,
val = xf86SetIntOption(local->options, "BaudRate", 0);
switch(val) {
+ case 38400:
+ common->wcmLinkSpeed = 38400;
+ break;
case 19200:
- common->wcmFlags = common->wcmFlags | BAUD_19200_FLAG;
+ common->wcmLinkSpeed = 19200;
break;
case 9600:
- common->wcmFlags = common->wcmFlags & ~BAUD_19200_FLAG;
+ common->wcmLinkSpeed = 9600;
break;
default:
- xf86Msg(X_ERROR, "%s: Illegal speed value (must be 9600 or 19200).", dev->identifier);
+ xf86Msg(X_ERROR, "%s: Illegal speed value (must be 9600 or 19200 or 38400).", dev->identifier);
break;
}
if (xf86Verbose)
@@ -3330,7 +3404,9 @@ xf86WcmInit(InputDriverPtr drv,
xfree(common);
if (priv)
xfree(priv);
- return local;
+ if (local)
+ xfree(local);
+ return NULL;
}
#ifdef XFree86LOADER
diff --git a/xc/programs/Xserver/hw/xfree86/int10/Imakefile b/xc/programs/Xserver/hw/xfree86/int10/Imakefile
index b2d7f3141..1664f33a6 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/int10/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.11 2000/09/29 08:59:47 eich Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/int10/Imakefile,v 1.12 2000/11/14 00:11:21 dawes Exp $
/* An OS-independent INT10 module/library */
@@ -37,7 +37,7 @@ X86EMUDEFINES = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG
# if defined(i386Architecture)
ARCHDEFINES = -D_PC
-#else if defined(ia64Architecture)
+# elif defined(ia64Architecture)
ARCHDEFINES = -D_PC_IO -DPC_PCI
# endif
diff --git a/xc/programs/Xserver/hw/xfree86/int10/generic.c b/xc/programs/Xserver/hw/xfree86/int10/generic.c
index 756fb1e69..3a03b0d6f 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/generic.c
+++ b/xc/programs/Xserver/hw/xfree86/int10/generic.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.12 2000/10/12 11:15:41 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.13 2000/11/21 23:10:38 tsi Exp $ */
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
@@ -57,7 +57,7 @@ xf86Int10InfoPtr
xf86InitInt10(int entityIndex)
{
xf86Int10InfoPtr pInt;
- int screen;
+ int screen, cs;
void* base = 0;
void* vbiosMem = 0;
legacyVGARec vga;
@@ -76,13 +76,12 @@ xf86InitInt10(int entityIndex)
INTPriv(pInt)->alloc =
(pointer)xnfcalloc(1,ALLOC_ENTRIES(getpagesize()));
pInt->scrnIndex = screen;
- base = INTPriv(pInt)->base = xnfalloc(0xf0000);
+ base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
/*
* we need to map video RAM MMIO as some chipsets map mmio
* registers into this range.
*/
-
MapVRam(pInt);
#ifdef _PC
if (!sysMem)
@@ -93,17 +92,30 @@ xf86InitInt10(int entityIndex)
xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n");
goto error1;
}
+
+ /*
+ * Retrieve everything between V_BIOS and SYS_BIOS as some system BIOSes
+ * have executable code there. Note that xf86ReadBIOS() can only read in
+ * 64kB at a time.
+ */
+ (void)memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS);
+ for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
+ if (xf86ReadBIOS(cs, 0, (unsigned char *)base + cs, V_BIOS_SIZE) <
+ V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%06X.\n", cs);
+
if (xf86IsEntityPrimary(entityIndex)) {
- int cs = MEM_RW(pInt,((0x10<<2)+2));
+ cs = MEM_RW(pInt,((0x10<<2)+2));
vbiosMem = (unsigned char *)base + (cs << 4);
- if (!int10_read_bios(screen,cs,vbiosMem)) {
+ if (!int10_check_bios(screen, cs, vbiosMem)) {
cs = MEM_RW(pInt,((0x42<<2)+2));
vbiosMem = (unsigned char *)base + (cs << 4);
- if (!int10_read_bios(screen,cs,vbiosMem)) {
+ if (!int10_check_bios(screen, cs, vbiosMem)) {
cs = V_BIOS >> 4;
vbiosMem = (unsigned char *)base + (cs << 4);
- if (!int10_read_bios(screen,cs,vbiosMem)) {
+ if (!int10_check_bios(screen, cs, vbiosMem)) {
xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n");
goto error1;
}
@@ -146,7 +158,11 @@ xf86InitInt10(int entityIndex)
}
break;
case BUS_ISA:
- if (!int10_read_bios(screen,V_BIOS >> 4,vbiosMem)) {
+ (void)memset(vbiosMem, 0, V_BIOS_SIZE);
+ if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x0C0000.\n");
+ if (!int10_check_bios(screen, V_BIOS >> 4, vbiosMem)) {
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5)\n");
goto error1;
}
diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
index 3c5766155..94f13a65f 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
+++ b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.9 2000/11/03 18:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.10 2000/11/18 19:37:14 tsi Exp $ */
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
@@ -302,22 +302,24 @@ dump_code(xf86Int10InfoPtr pInt)
void
dump_registers(xf86Int10InfoPtr pInt)
{
- PRINT(X86_IP);
PRINT(X86_AX);
PRINT(X86_BX);
PRINT(X86_CX);
PRINT(X86_DX);
+ ErrorF("\n");
+ PRINT(X86_IP);
PRINT(X86_SI);
PRINT(X86_DI);
PRINT(X86_BP);
- ErrorF("\n");
PRINT(X86_SP);
+ ErrorF("\n");
PRINT(X86_CS);
PRINT(X86_SS);
PRINT(X86_ES);
PRINT(X86_DS);
PRINT(X86_FS);
PRINT(X86_GS);
+ ErrorF("\n");
PRINT_FLAGS(X86_EFLAGS);
ErrorF("\n");
}
diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
index a138dc09f..6e9c6fefa 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
+++ b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.12 2000/11/03 18:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.13 2000/11/21 23:10:38 tsi Exp $ */
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
@@ -165,7 +165,7 @@ int10skip(ScrnInfoPtr pScrn, int entityIndex)
Bool
-int10_read_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem)
+int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem)
{
int size;
@@ -180,11 +180,6 @@ int10_read_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem)
if (xf86IsPc98())
return FALSE;
- if (xf86ReadBIOS(codeSeg << 4, 0, vbiosMem, 0x10) < 0) {
- xf86DrvMsg(scrnIndex,X_WARNING,"Cannot read V_BIOS (1)\n");
- return FALSE;
- }
-
if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2) ||
(*(vbiosMem+2) > 0x80U))
return FALSE;
@@ -194,22 +189,6 @@ int10_read_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem)
if ((size + (codeSeg << 4)) > SYS_SIZE)
return FALSE;
-#ifdef _PC
- /*
- * Read everything between V_BIOS start and SYS_BIOS:
- * Some systems with built in graphics might jump here.
- */
- size = SYS_BIOS - (codeSeg << 4);
-#else
- /* We might already have the tail end */
- if ((size + (codeSeg << 4)) > SYS_BIOS)
- size = SYS_BIOS - (codeSeg << 4);
-#endif
-
- if (xf86ReadBIOS(codeSeg << 4,0,vbiosMem, size) < 0) {
- xf86DrvMsg(scrnIndex,X_ERROR,"Cannot read V_BIOS (2)\n");
- return FALSE;
- }
if (bios_checksum(vbiosMem, size))
xf86DrvMsg(scrnIndex, X_WARNING, "Bad V_BIOS checksum\n");
diff --git a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
index 9f1008a75..3dbdf098b 100644
--- a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
+++ b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.10 2000/11/03 18:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.13 2000/11/21 23:10:38 tsi Exp $ */
/*
* XFree86 int10 module
@@ -170,7 +170,7 @@ int setup_system_bios(unsigned long base_addr);
void reset_int_vect(xf86Int10InfoPtr pInt);
void set_return_trap(xf86Int10InfoPtr pInt);
Bool int10skip(ScrnInfoPtr pScrn, int entityIndex);
-Bool int10_read_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem);
+Bool int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem);
#ifdef DEBUG
void dprint(unsigned long start, unsigned long size);
diff --git a/xc/programs/Xserver/hw/xfree86/loader/coffloader.c b/xc/programs/Xserver/hw/xfree86/loader/coffloader.c
index 64fdee4a2..fd464072d 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/coffloader.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/coffloader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.11 1999/03/14 11:18:05 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.12 2000/11/20 22:12:09 tsi Exp $ */
/*
*
@@ -1142,6 +1142,11 @@ COFFModulePtr cofffile;
".stabstr" ) == 0 ) {
continue;
}
+ /* .stab.* */
+ if( strncmp(cofffile->sections[i].s_name,
+ ".stab.", strlen(".stab.") ) == 0 ) {
+ continue;
+ }
ErrorF("Not loading %s\n", cofffile->sections[i].s_name );
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/loader/dixsym.c b/xc/programs/Xserver/hw/xfree86/loader/dixsym.c
index 830f24e61..028f013f4 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/dixsym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/dixsym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.34 2000/11/03 11:50:20 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.35 2000/11/22 07:19:44 keithp Exp $ */
/*
@@ -324,6 +324,7 @@ LOOKUP dixLookupTab[] = {
SYMFUNC(miPictureInit)
SYMFUNC(miComputeCompositeRegion)
SYMFUNC(miGlyphs)
+ SYMFUNC(miCompositeRects)
SYMVAR(PictureScreenPrivateIndex)
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/loader/elfloader.c b/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
index a1efe7108..b98afb81e 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.28 2000/09/29 08:59:47 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.29 2000/11/20 22:12:09 tsi Exp $ */
/*
*
@@ -2599,6 +2599,11 @@ int *maxalign;
".stabstr" ) == 0 ) {
continue;
}
+ /* .stab.* */
+ if( strncmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name),
+ ".stab.", strlen(".stab.") ) == 0 ) {
+ continue;
+ }
#if defined(__powerpc__) || defined(__mc68000__)
/* .rela.tdesc */
if( strcmp(ElfGetSectionName(elffile, elffile->sections[i].sh_name),
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loader.c b/xc/programs/Xserver/hw/xfree86/loader/loader.c
index 60acebe02..b4cf43d55 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loader.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/loader.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.46 2000/11/03 18:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.47 2000/11/13 23:09:55 dawes Exp $ */
/*
*
@@ -1309,3 +1309,24 @@ LoaderDuplicateSymbol(const char *symbol, const int handle)
void _loader_debug_state()
{
}
+
+unsigned long LoaderOptions = 0;
+
+void
+LoaderResetOptions(void)
+{
+ LoaderOptions = 0;
+}
+
+void
+LoaderSetOptions(unsigned long opts)
+{
+ LoaderOptions |= opts;
+}
+
+void
+LoaderClearOptions(unsigned long opts)
+{
+ LoaderOptions &= ~opts;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loader.h b/xc/programs/Xserver/hw/xfree86/loader/loader.h
index 4fdc1c15f..5bdc63366 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loader.h
+++ b/xc/programs/Xserver/hw/xfree86/loader/loader.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.22 2000/09/26 15:57:18 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.23 2000/11/13 23:09:56 dawes Exp $ */
/*
*
@@ -208,6 +208,8 @@ typedef struct {
} ModuleVersions;
extern ModuleVersions LoaderVersionInfo;
+extern unsigned long LoaderOptions;
+
/* Internal Functions */
void LoaderAddSymbols(int, int, LOOKUP *);
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h b/xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h
index a6759df22..d6c0d9eab 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h
+++ b/xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h,v 1.16 2000/01/29 17:17:05 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loaderProcs.h,v 1.17 2000/11/13 23:09:57 dawes Exp $ */
/*
*
@@ -81,4 +81,12 @@ void LoaderShowStack(void);
void *LoaderSymbolHandle(const char *, int);
int LoaderUnload(int);
+void LoaderResetOptions(void);
+void LoaderSetOptions(unsigned long);
+void LoaderClearOptions(unsigned long);
+
+/* Options for LoaderSetOptions */
+#define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001
+
+
#endif /* _LOADERPROCS_H */
diff --git a/xc/programs/Xserver/hw/xfree86/loader/loadmod.c b/xc/programs/Xserver/hw/xfree86/loader/loadmod.c
index f1025f944..fbc631453 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/loadmod.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/loadmod.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.56 2000/11/03 18:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.57 2000/11/13 23:09:57 dawes Exp $ */
/*
*
@@ -545,6 +545,7 @@ CheckVersion (const char *module, XF86ModuleVersionInfo *data,
int vercode[3];
char verstr[4];
long ver = data->xf86version;
+ int errtype = 0;
xf86Msg (X_INFO, "Module %s: vendor=\"%s\"\n",
data->modname ? data->modname : "UNKNOWN!",
@@ -593,17 +594,27 @@ CheckVersion (const char *module, XF86ModuleVersionInfo *data,
vermaj = GET_ABI_MAJOR(ver);
vermin = GET_ABI_MINOR(ver);
if (abimaj != vermaj) {
- /* XXX This should be an error condition */
- xf86MsgVerb(X_WARNING, 0,
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
"module ABI major version (%d) doesn't"
" match the server's version (%d)\n",
abimaj, vermaj);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
} else if (abimin > vermin) {
- /* XXX This should be an error condition */
- xf86MsgVerb(X_WARNING, 0,
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
"module ABI minor version (%d) is "
"newer than the server's version "
"(%d)\n", abimin, vermin);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
}
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
index 77523bee5..a93f6e1ec 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.170 2000/11/06 19:24:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.173 2000/11/21 23:10:39 tsi Exp $ */
/*
*
@@ -241,6 +241,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86BindGARTMemory)
SYMFUNC(xf86UnbindGARTMemory)
SYMFUNC(xf86EnableAGP)
+ SYMFUNC(xf86SoundKbdBell)
#ifdef XINPUT
/* XISB routines (Merged from Metrolink tree) */
@@ -362,6 +363,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86EnableInputHandler)
SYMFUNC(xf86AddEnabledDevice)
SYMFUNC(xf86RemoveEnabledDevice)
+ SYMFUNC(xf86InterceptSignals)
/* xf86Helper.c */
SYMFUNC(xf86AddDriver)
@@ -915,7 +917,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86WriteMmioNB8)
SYMFUNC(memcpy)
#endif
-#if defined(sun) || defined(SVR4) && !defined(USL)
+#if defined(sun) && defined(SVR4)
SYMFUNC(inb)
SYMFUNC(inw)
SYMFUNC(inl)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c
index 73ad37281..e25769eda 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/xc/programs/Xserver/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.14 2000/11/06 19:24:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.15 2000/11/14 21:59:24 dawes Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -143,6 +143,7 @@ void
xf86OpenConsole()
{
int i, fd = -1;
+ int result;
xf86ConsOpen_t *driver;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
vtmode_t vtmode;
@@ -243,11 +244,15 @@ 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)
{
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)
{
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c
index 9f1b00077..d5b13298e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.37 2000/11/06 19:24:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.38 2000/11/19 16:38:06 tsi Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -393,8 +393,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
}
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- /* Base is assumed to be page-aligned. */
ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE);
if ((long)ptr == -1)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
index ffbcfa0bc..b25c3041e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.37 2000/10/28 13:35:06 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.40 2000/11/18 19:37:22 tsi Exp $ */
/*
* Pci.c - New server PCI access functions
*
@@ -1070,16 +1070,19 @@ readPciBIOS(unsigned long Offset, PCITAG Tag, int basereg,
romaddr = PCIGETROM(newbase);
if (romaddr != 0 && romaddr == newbase) {
#if 1
+ if ((basereg >= 0) && (basereg <= 5)) {
savebase = pciReadLong(Tag, PCI_MAP_REG_START + (basereg << 2));
if (PCIGETROM(savebase) == romaddr)
pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), 0);
- else
- savebase = 0;
+ }
#endif
pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr);
} else
romaddr = 0;
}
+#ifdef DEBUG
+ ErrorF("ValidBIOSBase: %x\n",newbase);
+#endif
if (romaddr == 0) {
xf86Msg(X_WARNING, "xf86ReadPciBIOS: cannot locate a BIOS address\n");
return -1;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c b/xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c
index d4fe3913b..db3143304 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c,v 1.3 2000/02/11 22:36:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c,v 1.4 2000/11/19 16:38:06 tsi Exp $ */
/*
* INTEL DG/UX RELEASE 4.20 MU03
* Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK
@@ -48,8 +48,9 @@ int Len;
return(-1);
}
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- /* Base is assumed to be page-aligned. */
ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, MAP_SHARED,
fd, (off_t)Base);
if ((int)ptr == -1)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile
index 0740c0c31..6adb8a6e4 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.12 2000/08/15 16:05:38 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.13 2000/11/14 18:20:37 dawes Exp $
#include <Server.tmpl>
@@ -8,11 +8,11 @@ MOUSESRC = hurd_mouse.c
MOUSEOBJ = hurd_mouse.o
SRCS = hurd_init.c hurd_video.c hurd_io.c libc_wrapper.c $(BIOS_MOD).c \
- VTsw_noop.c posix_tty.c std_kbdEv.c $(MOUSESRC) \
+ VTsw_noop.c posix_tty.c $(MOUSESRC) \
stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c
OBJS = hurd_init.o hurd_video.o hurd_io.o libc_wrapper.o $(BIOS_MOD).o \
- VTsw_noop.o posix_tty.o std_kbdEv.o $(MOUSEOBJ) \
+ VTsw_noop.o posix_tty.o $(MOUSEOBJ) \
stdResource.o stdPci.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o
INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
@@ -28,7 +28,6 @@ NormalLibraryObjectRule()
LinkSourceFile(VTsw_noop.c,../shared)
LinkSourceFile(posix_tty.c,../shared)
-LinkSourceFile(std_kbdEv.c,../shared)
LinkSourceFile(libc_wrapper.c,../shared)
LinkSourceFile(stdResource.c,../shared)
LinkSourceFile(stdPci.c,../shared)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c b/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c
index d187eb5a6..85a47f32b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c
@@ -20,7 +20,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c,v 1.6 1999/09/04 13:04:43 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c,v 1.7 2000/11/14 18:20:37 dawes Exp $ */
#define NEED_EVENTS
#include "X.h"
@@ -117,3 +117,11 @@ xf86KbdOff()
if( ioctl( xf86Info.consoleFd, _IOW('k', 1, int),&data) < 0)
FatalError("can't reset keyboard mode (%s)\n",strerror(errno));
}
+
+void
+xf86KbdEvents()
+{
+ kd_event ke;
+ while( read(xf86Info.consoleFd, &ke, sizeof(ke)) == sizeof(ke) )
+ xf86PostKbdEvent(ke.value.sc);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c b/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c
index 3320f147d..6d0b06299 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c
@@ -20,7 +20,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c,v 1.7 2000/02/10 22:33:44 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c,v 1.8 2000/11/14 18:20:37 dawes Exp $ */
#define NEED_EVENTS
#include "X.h"
@@ -168,7 +168,7 @@ OsMouseReadInput(InputInfoPtr pInfo)
pBuf = (unsigned char *)eventList;
n = 0;
while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList))
- pBuf[n] = (unsigned char)c;
+ pBuf[n++] = (unsigned char)c;
if (n == 0)
return;
@@ -289,7 +289,7 @@ xf86OSMouseInit(int flags)
p->BuiltinNames = BuiltinNames;
p->DefaultProtocol = DefaultProtocol;
p->CheckProtocol = CheckProtocol;
- p->PreInit = OSMousePreInit;
+ p->PreInit = OsMousePreInit;
return p;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c b/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c
index 63f77da24..867b70ac4 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c
@@ -20,7 +20,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c,v 1.3 1999/04/29 12:24:52 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c,v 1.4 2000/11/14 18:20:37 dawes Exp $ */
#include <mach.h>
#include <device/device.h>
@@ -169,3 +169,9 @@ xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
{
}
+Bool
+xf86CheckMTRR(int s)
+{
+ return FALSE;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile
index 45c93c4d6..919d13f90 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile
@@ -1,5 +1,5 @@
XCOMM $XConsortium: Imakefile /main/10 1996/10/19 18:06:19 kaleb $
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.42 2000/08/15 16:05:38 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.43 2000/11/16 19:45:03 eich Exp $
#include <Server.tmpl>
@@ -35,8 +35,8 @@ RES_OBJS=lnxResource.o
#endif
#if defined(AlphaArchitecture)
-AXP_SRC=lnx_ev56.c
-AXP_OBJ=lnx_ev56.o
+AXP_SRC=lnx_ev56.c xf86Axp.c lnx_axp.c
+AXP_OBJ=lnx_ev56.o xf86Axp.o lnx_axp.o
#endif
SRCS = lnx_init.c lnx_video.c lnx_io.c libc_wrapper.c bios_mmap.c \
@@ -50,7 +50,7 @@ OBJS = lnx_init.o lnx_video.o lnx_io.o libc_wrapper.o bios_mmap.o \
$(AXP_OBJ) lnx_kmod.o lnx_agp.o
INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
- -I$(XINCLUDESRC) -I$(EXTINCSRC)
+ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC)/shared
RESDEFINES = -DUSESTDRES
@@ -106,7 +106,9 @@ LinkSourceFile($(DRI_SRC),../shared)
#if defined(i386Architecture) || defined(ia64Architecture)
LinkSourceFile(stdResource.c,../shared)
#endif
-
+#if defined(AlphaArchitecture)
+LinkSourceFile(xf86Axp.c,../shared)
+#endif
DependTarget()
InstallDriverSDKNonExecFile(agpgart.h,$(DRIVERSDKINCLUDEDIR)/linux)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile
index 6457b2732..1b24a75a1 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile,v 1.2 2000/02/23 04:47:24 martin Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile,v 1.3 2000/11/08 05:03:06 dawes Exp $
#include <Server.tmpl>
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
index 29cce2f8a..ea0e96190 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.16 2000/11/03 18:30:49 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.18 2000/11/21 23:10:40 tsi Exp $ */
/*
* linux specific part of the int10 module
* Copyright 1999 Egbert Eich
@@ -57,6 +57,7 @@ xf86Int10InfoPtr
xf86InitInt10(int entityIndex)
{
xf86Int10InfoPtr pInt = NULL;
+ CARD8 *bios_base;
int screen;
int fd;
static void* vidMem = NULL;
@@ -65,7 +66,7 @@ xf86InitInt10(int entityIndex)
int high_mem;
char *base;
char *base_high;
- int pagesize;
+ int pagesize, cs;
legacyVGARec vga;
screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
@@ -154,23 +155,28 @@ xf86InitInt10(int entityIndex)
goto error3;
}
-#ifdef DEBUG
- dprint(0,0x20);
- dprint(0xa0000,0x20);
- dprint(0xf0000,0x20);
-#endif
+ /*
+ * Read in everything between V_BIOS and SYS_BIOS as some system BIOSes
+ * have executable code there. Note that xf86ReadBIOS() can only bring in
+ * 64K bytes at a time.
+ */
+ (void)memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS);
+ for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
+ if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%06X.\n", cs);
if (xf86IsEntityPrimary(entityIndex)) {
- int cs = ((CARD16*)0)[(0x10<<1)+1];
- CARD8 *bios_base = (unsigned char *)(cs << 4);
+ cs = ((CARD16*)0)[(0x10<<1)+1];
+ bios_base = (unsigned char *)(cs << 4);
- if (!int10_read_bios(screen,cs,bios_base)) {
+ if (!int10_check_bios(screen, cs, bios_base)) {
cs = ((CARD16*)0)[(0x42<<1)+1];
bios_base = (unsigned char *)(cs << 4);
- if (!int10_read_bios(screen,cs,bios_base)) {
+ if (!int10_check_bios(screen, cs, bios_base)) {
cs = V_BIOS >> 4;
bios_base = (unsigned char *)(cs << 4);
- if (!int10_read_bios(screen,cs,bios_base)) {
+ if (!int10_check_bios(screen, cs, bios_base)) {
xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n");
goto error3;
}
@@ -361,9 +367,19 @@ xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
static int
do_vm86(xf86Int10InfoPtr pInt)
{
- int retval;
+ int retval, signo;
+ xf86InterceptSignals(&signo);
retval = vm86_rep(VM86S);
+ xf86InterceptSignals(NULL);
+
+ if (signo >= 0) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86() syscall generated signal %d.\n", signo);
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ }
switch (VM86_TYPE(retval)) {
case VM86_UNKNOWN:
@@ -371,8 +387,9 @@ do_vm86(xf86Int10InfoPtr pInt)
break;
case VM86_STI:
xf86DrvMsg(pInt->scrnIndex,X_ERROR,"vm86_sti :-((\n");
- stack_trace(pInt);
+ dump_registers(pInt);
dump_code(pInt);
+ stack_trace(pInt);
return 0;
case VM86_INTx:
pInt->num = VM86_ARG(retval);
@@ -380,6 +397,8 @@ do_vm86(xf86Int10InfoPtr pInt)
xf86DrvMsg(pInt->scrnIndex,
X_ERROR,"Unknown vm86_int: 0x%X\n\n",VM86_ARG(retval));
dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
return 0;
}
/* I'm not sure yet what to do if we can handle ints */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c
index a4f22690c..c2954e3e0 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.6 2000/03/31 22:55:52 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.7 2000/11/16 19:45:04 eich Exp $ */
#include "X.h"
#include "os.h"
@@ -66,15 +66,7 @@ lnxPMGetEventFromOs(int fd, pmEvent *events, int num)
{
int i,j,n;
apm_event_t linuxEvents[8];
-#if 0
- if (wait) {
- FD_ZERO( &fds );
- FD_SET( fd, &fds );
- ret = select( fd + 1, &fds, NULL, NULL, NULL );
- if (ret <= 0)
- return 0;
- }
-#endif
+
if ((n = read( fd, linuxEvents, num * sizeof(apm_event_t) )) == -1)
return 0;
n /= sizeof(apm_event_t);
@@ -121,13 +113,18 @@ xf86OSPMOpen(void)
{
int fd;
+#ifdef DEBUG
+ ErrorF("APM: OSPMOpen called\n");
+#endif
if (APMihPtr || !xf86Info.pmFlag)
return NULL;
if (access( APM_PROC, R_OK ) || ((fd = open( APM_PROC, O_RDONLY)) == -1))
return NULL;
close( fd );
-
+#ifdef DEBUG
+ ErrorF("APM: Opening device\n");
+#endif
if ((fd = open( APM_DEVICE, O_RDWR )) > -1) {
xf86PMGetEventFromOs = lnxPMGetEventFromOs;
xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
@@ -142,6 +139,9 @@ lnxCloseAPM(void)
{
int fd;
+#ifdef DEBUG
+ ErrorF("APM: Closing device\n");
+#endif
if (APMihPtr) {
fd = xf86RemoveInputHandler(APMihPtr);
close(fd);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c
index 314530dc8..5590a926d 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xc/programs/Xserver/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.12 2000/02/25 18:28:11 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.13 2000/11/14 21:59:24 dawes Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -49,6 +49,7 @@ void
xf86OpenConsole(void)
{
int i, fd;
+ int result;
struct vt_mode VT;
char vtname[11];
struct vt_stat vts;
@@ -158,15 +159,19 @@ xf86OpenConsole(void)
/*
* 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)
{
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)
{
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");
}
@@ -203,11 +208,14 @@ xf86OpenConsole(void)
/*
* 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)
{
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)
{
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
index 4553552b3..47e33b66e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.38 2000/10/28 01:42:27 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.41 2000/11/21 23:45:56 mvojkovi Exp $ */
/*
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -34,6 +34,9 @@
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
#include "lnx.h"
+#ifdef __alpha__
+#include "xf86Axp.h"
+#endif
#ifdef HAS_MTRR_SUPPORT
#include <asm/mtrr.h>
@@ -63,7 +66,7 @@ extern void sethae(unsigned long hae);
# ifdef TEST_JENSEN_CODE
# define isJensen (1)
# else
-# define isJensen (!_bus_base())
+# define isJensen (axpSystem == JENSEN)
# endif
# define needSparse (_bus_base_sparse() != 0)
@@ -84,11 +87,18 @@ 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 HAS_MTRR_SUPPORT
@@ -295,10 +305,19 @@ 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();
+ }
if (isJensen) {
# ifndef JENSEN_SUPPORT
FatalError("Jensen is not supported any more\n"
- "If you are interesetd in fixing Jensen support\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");
@@ -334,6 +353,14 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
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
@@ -348,33 +375,43 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
mapflags |= MAP_NONCACHED;
#endif
-#if defined(__ia64_)
+#if defined(__ia64__)
/* this will disappear when people upgrade their kernels */
- if ((fd = open(DEV_MEM, O_RDWR|O_SYNC)) < 0) {
+ if ((fd = open(DEV_MEM, O_RDWR|O_SYNC)) < 0)
#else
- if ((fd = open(DEV_MEM, O_RDWR)) < 0) {
+ if ((fd = open(DEV_MEM, O_RDWR)) < 0)
#endif
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
+ {
+ 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,
- PROT_READ|PROT_WRITE,
- mapflags, fd,
- (off_t)(off_t)Base + BUS_BASE);
+ 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));
+ FatalError("xf86MapVidMem: Could not mmap framebuffer"
+ " (0x%08x,0x%x) (%s)\n", Base, Size,
+ strerror(errno));
}
- return base;
+#ifdef DEBUG
+ ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff);
+#endif
+ return (char *)base + alignOff;
}
-
+
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- munmap((caddr_t)Base, 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));
}
@@ -561,8 +598,8 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
lnxBase = mmap((caddr_t)0, 0x100000000,
PROT_READ | PROT_WRITE,
MAP_SHARED, fd,
- (off_t) _bus_base());
- lnxSBase = mmap((caddr_t)0, 0x100000000,
+ (off_t) bus_base);
+ lnxSBase = mmap((caddr_t)0, 0x400000000,
PROT_READ | PROT_WRITE,
MAP_SHARED, fd,
(off_t) _bus_base_sparse());
@@ -590,8 +627,8 @@ readSparse8(pointer Base, register unsigned long Offset)
Offset += (unsigned long)Base - (unsigned long)lnxBase;
shift = (Offset & 0x3) << 3;
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000UL;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
Offset -= msb;
if (msb_set != msb) {
sethae(msb);
@@ -612,8 +649,8 @@ readSparse16(pointer Base, register unsigned long Offset)
Offset += (unsigned long)Base - (unsigned long)lnxBase;
shift = (Offset & 0x2) << 3;
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000UL;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
Offset -= msb;
if (msb_set != msb) {
sethae(msb);
@@ -638,11 +675,11 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
register unsigned int b = Value & 0xffU;
Offset += (unsigned long)Base - (unsigned long)lnxBase;
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
Offset -= msb;
if (msb_set != msb) {
- sethae(msb);
+ sethae(msb);
msb_set = msb;
}
}
@@ -657,8 +694,8 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
register unsigned int w = Value & 0xffffU;
Offset += (unsigned long)Base - (unsigned long)lnxBase;
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
Offset -= msb;
if (msb_set != msb) {
sethae(msb);
@@ -686,8 +723,8 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
register unsigned int b = Value & 0xffU;
Offset += (unsigned long)Base - (unsigned long)lnxBase;
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
Offset -= msb;
if (msb_set != msb) {
sethae(msb);
@@ -704,8 +741,8 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
register unsigned int w = Value & 0xffffU;
Offset += (unsigned long)Base - (unsigned long)lnxBase;
- if (Offset >= (1UL << 24)) {
- msb = Offset & 0xf8000000;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
Offset -= msb;
if (msb_set != msb) {
sethae(msb);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c b/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c
index 04fe5b0b5..32b1b4650 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c,v 3.1 2000/08/04 16:13:41 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c,v 3.2 2000/11/16 19:45:04 eich Exp $ */
#include "X.h"
#include "xf86.h"
@@ -10,8 +10,16 @@
void
xf86UDelay(long usec)
{
+#if 0
struct timeval start, interrupt;
+#else
+ int sigio;
+ sigio = xf86BlockSIGIO();
+ xf86usleep(usec);
+ xf86UnblockSIGIO(sigio);
+#endif
+#if 0
gettimeofday(&start,NULL);
do {
@@ -23,6 +31,6 @@ xf86UDelay(long usec)
break;
} while (1);
-
+#endif
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c b/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c
index 9e5698982..4a1d7d33d 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c,v 1.7 2000/06/27 14:27:31 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c,v 1.8 2000/11/19 16:38:06 tsi Exp $ */
/*
* Copyright 1998 by Concurrent Computer Corporation
*
@@ -170,6 +170,8 @@ xf86ReadPciBIOS(unsigned long Base, unsigned long Offset, PCITAG Tag,
int mlen;
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
base = pmax_iomap((unsigned long)hostbase, mlen);
if (base == MAP_FAILED) {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c
index b372b5cb5..e4ecfab59 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c,v 1.7 2000/02/12 20:45:45 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c,v 1.8 2000/11/19 16:38:06 tsi Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
*
@@ -54,8 +54,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(-1);
}
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- /* Base is assumed to be page-aligned. */
ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
MAP_SHARED, fd, (off_t)Base);
if (ptr == MAP_FAILED)
@@ -135,8 +136,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
}
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- /* Base is assumed to be page-aligned. */
base = mmap((caddr_t)0, JENSEN_SHIFT(mlen), PROT_READ,
MAP_SHARED, fd, (off_t)(JENSEN_SHIFT(Base) + BUS_BASE));
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c
index 547e7006b..2d61839a9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.24 1999/11/19 13:55:02 hohndel Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.25 2000/11/14 21:59:24 dawes Exp $ */
/*
* Copyright 1993-1999 by The XFree86 Project, Inc.
*
@@ -60,8 +60,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-
static int
GetBaud (int baudrate)
{
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
index e603af4d7..7f8cbc1db 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c
@@ -25,7 +25,7 @@
*
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.11 2000/06/17 00:03:43 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.12 2000/11/14 21:59:24 dawes Exp $
*
*/
@@ -46,6 +46,7 @@
# include <errno.h>
# include <stdio.h>
# include <string.h>
+# define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
#endif
/*
@@ -76,8 +77,6 @@ static int xf86SigIOMax;
static int xf86SigIOMaxFd;
static fd_set xf86SigIOMask;
-#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-
/*
* SIGIO gives no way of discovering which fd signalled, select
* to discover
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c
index 9bc049a48..4899f995b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c,v 1.2 2000/02/11 22:36:04 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c,v 1.3 2000/11/19 16:38:07 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -75,8 +75,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(-1);
}
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- /* Base is assumed to be page-aligned. */
ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
MAP_SHARED, fd, (off_t)Base);
if (ptr == MAP_FAILED)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c
index b42f62b92..abec389cc 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c,v 1.5 2000/02/11 22:36:04 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c,v 1.6 2000/11/19 16:38:07 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -58,6 +58,8 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
* is considered the "default" file to open.
*/
psize = xf86getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
if (Base >= 0xA0000 && Base + mlen < 0xFFFFF && xf86Info.vtno >= 0)
sprintf(solx86_vtname,"/dev/vt%02d",xf86Info.vtno);
@@ -76,7 +78,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
solx86_vtname, strerror(errno));
return(-1);
}
- /* Base is assumed to be page-aligned. */
ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
MAP_SHARED, fd, (off_t)Base);
if (ptr == MAP_FAILED)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
index e444f7366..4549805b3 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.75 2000/10/17 16:53:19 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.76 2000/11/14 21:59:23 dawes Exp $ */
/*
* Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1992 by David Dawes <dawes@XFree86.org>
@@ -889,6 +889,8 @@ double RInt(
# endif
#endif
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
index ad389070d..ef7a81ab2 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
@@ -64,11 +64,15 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.46 2000/08/23 21:06:21 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.48 2000/11/21 23:10:40 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
@@ -143,6 +147,7 @@ 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];
@@ -229,7 +234,6 @@ extern Bool xf86VTSwitchTo(void);
extern void xf86VTRequest(int sig);
extern int xf86ProcessArgument(int, char **, int);
extern void xf86UseMsg(void);
-extern void xf86SoundKbdBell(int, int, int);
extern void xf86SetKbdLeds(int);
extern int xf86GetKbdLeds(void);
extern void xf86SetKbdRepeat(char);
@@ -257,6 +261,7 @@ resPtr xf86PciBusAccWindowsFromOS(void);
resPtr xf86IsaBusAccWindowsFromOS(void);
resPtr xf86AccResFromOS(resPtr ret);
#endif /* NEED_OS_RAC_PROTOS */
+
Bool xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits);
#endif /* XF86_OS_PRIVS */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h
index da1ee67d1..6a1ebd912 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h
@@ -25,14 +25,17 @@
*
* Author: Kevin E. Martin <kevin@precisioninsight.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.1 2000/06/17 00:03:26 martin Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.2 2000/11/18 19:37:21 tsi Exp $
*
*/
#ifndef _XF86DRI_R128_H_
#define _XF86DRI_R128_H_
-/* WARNING: If you change any of these defines, make sure to change
+#include "X11/Xmd.h"
+
+/*
+ * WARNING: If you change any of these defines, make sure to change
* the kernel include file as well (r128_drm.h)
*/
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Monitor.c b/xc/programs/Xserver/hw/xfree86/parser/Monitor.c
index 9b91207c9..9009cc231 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Monitor.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Monitor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.15 2000/10/24 22:45:10 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.17 2000/11/15 00:22:27 dawes Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -201,6 +201,7 @@ xf86parseModeLine (void)
if (xf86getToken (NULL) != NUMBER)
Error (NUMBER_MSG, "Vscan");
ptr->ml_vscan = val.num;
+ ptr->ml_flags |= XF86CONF_VSCAN;
break;
case TT_CUSTOM:
ptr->ml_flags |= XF86CONF_CUSTOM;
@@ -345,6 +346,7 @@ xf86parseVerboseMode (void)
case VSCAN:
if (xf86getToken (NULL) != NUMBER)
Error ("Vertical scan count expected", NULL);
+ ptr->ml_flags |= XF86CONF_VSCAN;
ptr->ml_vscan = val.num;
break;
case EOF_TOKEN:
@@ -634,10 +636,12 @@ xf86printMonitorSection (FILE * cf, XF86ConfMonitorPtr ptr)
{
int i;
XF86ConfModeLinePtr mlptr;
+ XF86ConfModesLinkPtr mptr;
XF86OptionPtr optr;
while (ptr)
{
+ mptr = ptr->mon_modes_sect_lst;
fprintf (cf, "Section \"Monitor\"\n");
if (ptr->mon_comment)
fprintf (cf, "\t### \"%s\"\n", ptr->mon_comment);
@@ -647,6 +651,10 @@ xf86printMonitorSection (FILE * cf, XF86ConfMonitorPtr ptr)
fprintf (cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
if (ptr->mon_modelname)
fprintf (cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
+ while (mptr) {
+ fprintf (cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
+ mptr = mptr->list.next;
+ }
if (ptr->mon_width)
fprintf (cf, "\tDisplaySize %d\t%d\n",
ptr->mon_width,
@@ -760,6 +768,8 @@ xf86printModesSection (FILE * cf, XF86ConfModesPtr ptr)
fprintf (cf, " doublescan");
if (mlptr->ml_flags & XF86CONF_HSKEW)
fprintf (cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_VSCAN)
+ fprintf (cf, " vscan %d", mlptr->ml_vscan);
if (mlptr->ml_flags & XF86CONF_BCAST)
fprintf (cf, " bcast");
fprintf (cf, "\n");
@@ -870,6 +880,7 @@ xf86validateMonitor (XF86ConfigPtr p, XF86ConfScreenPtr screen)
screen->scrn_identifier);
return (FALSE);
}
+ modeslnk->ml_modes = modes;
modeslnk = modeslnk->list.next;
}
return (TRUE);
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Screen.c b/xc/programs/Xserver/hw/xfree86/parser/Screen.c
index 580c4a29c..399f3417d 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Screen.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Screen.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.13 2000/10/20 14:59:03 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.14 2000/11/28 16:10:40 dawes Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -553,7 +553,7 @@ xf86validateScreen (XF86ConfigPtr p)
return (FALSE);
}
- adaptor->al_adaptor->va_fwdref = screen->scrn_identifier;
+ adaptor->al_adaptor->va_fwdref = xf86configStrdup(screen->scrn_identifier);
adaptor = adaptor->list.next;
}
diff --git a/xc/programs/Xserver/hw/xfree86/parser/Video.c b/xc/programs/Xserver/hw/xfree86/parser/Video.c
index c2923f9c6..bb9387500 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/Video.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/Video.c
@@ -25,7 +25,7 @@
* in this Software without prior written authorization from Metro Link.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.4 2000/10/20 14:59:03 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.5 2000/11/28 16:10:40 dawes Exp $ */
/* View/edit this file with tab stops set to 4 */
@@ -256,6 +256,7 @@ xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
TestFree (ptr->va_board);
TestFree (ptr->va_busid);
TestFree (ptr->va_driver);
+ TestFree (ptr->va_fwdref);
xf86freeVideoPortList (ptr->va_port_lst);
xf86optionListFree (ptr->va_option_lst);
prev = ptr;
diff --git a/xc/programs/Xserver/hw/xfree86/parser/read.c b/xc/programs/Xserver/hw/xfree86/parser/read.c
index 1be2b5760..b684ab210 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/read.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/read.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.14 2000/11/02 19:10:58 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.15 2000/11/15 00:22:27 dawes Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -210,6 +210,7 @@ xf86freeConfig (XF86ConfigPtr p)
xf86freeModules (p->conf_modules);
xf86freeFlags (p->conf_flags);
xf86freeMonitorList (p->conf_monitor_lst);
+ xf86freeModesList (p->conf_modes_lst);
xf86freeVideoAdaptorList (p->conf_videoadaptor_lst);
xf86freeDeviceList (p->conf_device_lst);
xf86freeScreenList (p->conf_screen_lst);
diff --git a/xc/programs/Xserver/hw/xfree86/parser/write.c b/xc/programs/Xserver/hw/xfree86/parser/write.c
index 8d5ab3a0c..9afe9a549 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/write.c
+++ b/xc/programs/Xserver/hw/xfree86/parser/write.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.11 2000/10/20 14:59:03 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.12 2000/11/14 17:33:01 dawes Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -90,6 +90,8 @@ doWriteConfigFile (const char *filename, XF86ConfigPtr cptr)
xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst);
+ xf86printModesSection (cf, cptr->conf_modes_lst);
+
xf86printMonitorSection (cf, cptr->conf_monitor_lst);
xf86printDeviceSection (cf, cptr->conf_device_lst);
diff --git a/xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h b/xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h
index 5a780e6cb..3bfce72a9 100644
--- a/xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h
+++ b/xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h,v 1.25 2000/11/02 19:58:21 anderson Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/xf86Parser.h,v 1.26 2000/11/15 00:22:27 dawes Exp $ */
/*
*
* Copyright (c) 1997 Metro Link Incorporated
@@ -83,6 +83,7 @@ XF86ConfModuleRec, *XF86ConfModulePtr;
#define XF86CONF_HSKEW 0x0200 /* hskew provided */
#define XF86CONF_BCAST 0x0400
#define XF86CONF_CUSTOM 0x0800 /* timing numbers customized by editor */
+#define XF86CONF_VSCAN 0x1000
typedef struct
{
@@ -421,7 +422,7 @@ XF86ConfVendorPtr xf86findVendor(const char *name, XF86ConfVendorPtr list);
XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
XF86ConfVideoAdaptorPtr p);
-GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr new);
+GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new);
int xf86pathIsAbsolute(const char *path);
int xf86pathIsSafe(const char *path);
diff --git a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
index 2730ba091..d14a5097d 100644
--- a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
+++ b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.41 2000/11/03 18:46:17 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.42 2000/11/14 18:20:38 dawes Exp $ */
/*
*
@@ -30,7 +30,7 @@
#define SAVE_FONT1
#endif
-#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) || defined(sun)
+#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) || defined(sun) || defined(__GNU__)
#ifndef NEED_SAVED_CMAP
#define NEED_SAVED_CMAP
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaa.h b/xc/programs/Xserver/hw/xfree86/xaa/xaa.h
index d435a88a8..2fe5f785d 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaa.h
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaa.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaa.h,v 1.34 2000/10/21 22:26:20 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaa.h,v 1.35 2000/11/18 19:37:24 tsi Exp $ */
#ifndef _XAA_H
#define _XAA_H
@@ -1328,6 +1328,8 @@ typedef struct _XAAInfoRec {
} XAAInfoRec, *XAAInfoRecPtr;
+#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE
+
Bool
XAAInit(
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c
index 69c2dce13..0133e4203 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.31 2000/09/28 20:48:00 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.32 2000/11/16 19:45:05 eich Exp $ */
#include "misc.h"
#include "xf86.h"
@@ -108,7 +108,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
XAAScreenPtr pScreenPriv;
int i;
#ifdef RENDER
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
if (XAAGeneration != serverGeneration) {
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h b/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h
index e6aeb3ca0..e64c6a775 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.31 2000/10/21 22:26:20 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.32 2000/11/18 19:37:25 tsi Exp $ */
#ifndef _XAALOCAL_H
#define _XAALOCAL_H
@@ -1620,8 +1620,6 @@ CARD32 XAAReverseBitOrder(CARD32 data);
#define XAA_GET_PIXMAP_PRIVATE(pix)\
(XAAPixmapPtr)((pix)->devPrivates[XAAPixmapIndex].ptr)
-#define SET_SYNC_FLAG(infoRec) infoRec->NeedToSync = TRUE
-
#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
#define CHECK_FG(pGC, flags) \
diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h
index a1ffbf12c..c62543ea9 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86Version.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h
@@ -1,13 +1,13 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.449 2000/11/06 18:21:56 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.452 2000/11/29 15:51:19 dawes Exp $ */
-#define XF86_VERSION " 4.0.1e "
+#define XF86_VERSION " 4.0.1g "
/* The finer points in versions... */
#define XF86_VERSION_MAJOR 4
#define XF86_VERSION_MINOR 0
#define XF86_VERSION_SUBMINOR 1
#define XF86_VERSION_BETA 0 /* 0="", 1="A", 2="B", etc... */
-#define XF86_VERSION_ALPHA 5 /* 0="", 1="a", 2="b", etc... */
+#define XF86_VERSION_ALPHA 7 /* 0="", 1="a", 2="b", etc... */
#define XF86_VERSION_NUMERIC(major,minor,subminor,beta,alpha) \
((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
@@ -18,6 +18,6 @@
XF86_VERSION_BETA, \
XF86_VERSION_ALPHA)
-#define XF86_DATE "6 November 2000"
+#define XF86_DATE "29 November 2000"
/* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c
index 6d836644c..4a562d422 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.1 2000/10/20 14:59:05 alanh Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.2 2000/11/08 17:58:43 alanh Exp $
*/
#define LOADER_PRIVATE
#include "loader.h"
@@ -227,9 +227,6 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86shmctl)
SYMFUNC(xf86setjmp)
SYMFUNC(xf86longjmp)
-#ifdef __alpha__
- SYMFUNC(_bus_base)
-#endif
SYMFUNC(xf86AddDriver)
{0,0}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
index e9dafe5cf..9316a5211 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.3 2000/10/20 14:59:08 alanh Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.4 2000/11/14 21:59:24 dawes Exp $
*/
/*
@@ -34,7 +34,6 @@
*/
#include "vidmode.h"
-#include <X11/extensions/Xinerama.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Label.h>
diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/Cards b/xc/programs/Xserver/hw/xfree86/xf86config/Cards
index 46d238391..648e872f1 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86config/Cards
+++ b/xc/programs/Xserver/hw/xfree86/xf86config/Cards
@@ -18,7 +18,7 @@
# The majority of entries are just a binding of a model name to a
# chipset/server and untested.
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.71 2000/11/02 21:45:14 robin Exp $
+# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.73 2000/11/28 20:59:20 dawes Exp $
# VGA
@@ -1437,7 +1437,10 @@ SEE Unsupported VGA compatible
NAME S3 Savage3D
SEE Unsupported VGA compatible
-
+NAME S3 Savage4
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
# ET4000/ET6000
@@ -1639,39 +1642,44 @@ SEE ET6000 (generic)
# ATI
+NAME ATI Rage 128
+CHIPSET ati
+SERVER SVGA
+DRIVER r128
+
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
DRIVER ati
NAME ATI Graphics Ultra Pro
-CHIPSET ATI-Mach32
+CHIPSET ati
SERVER Mach32
DRIVER ati
NAME ATI Wonder SVGA
-CHIPSET ATI vgawonder
+CHIPSET ati
SERVER SVGA
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
@@ -2278,6 +2286,18 @@ 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
@@ -2537,6 +2557,12 @@ 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
@@ -2633,6 +2659,29 @@ 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
@@ -2751,8 +2800,7 @@ SEE AT3D
NAME NeoMagic (laptop/notebook)
CHIPSET MagicGraph 128 series
SERVER SVGA
-DRIVER vga
-UNSUPPORTED
+DRIVER neomagic
LINE # Chipset "NM2160"
LINE # IOBase 0xfea00000
LINE # MemBase 0xfd000000
@@ -2786,6 +2834,14 @@ LINE # Option "noaccel"
LINE # Option "fifo_moderate"
LINE # Option "fifo_conservative"
+# Silicon Motion, Inc.
+
+NAME Silicon Motion Lynx family
+CHIPSET Lynx
+SERVER SVGA
+DRIVER siliconmotion
+NOCLOCPROBE
+
# Rendition
NAME Rendition Verite 1000
@@ -2848,6 +2904,18 @@ 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